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KACZiyC,EAAOQ,EAAY31B,KAAK9c,GACxBiyC,IACFA,EAAOA,EAAK,GACC,MAATA,IACFroD,KAAKqoD,KAAOA,EAAKnvB,OAAO,IAE1B9iB,EAAOA,EAAK8iB,OAAO,EAAG9iB,EAAKpV,OAASqnD,EAAKrnD,SAEvCoV,IAAMpW,KAAKqW,SAAWD,EAC5B,C","sources":["webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/callback/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/logger/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/context/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/emitter/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/priority-queue/backoff.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/priority-queue/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/queue/delivery.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/stats/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/validation/helpers.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/get-process-env.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/arguments-resolver/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/analytics/dispatch.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/pick.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/page/get-page-context.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/page/add-page-context.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/events/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/utils/group-by.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/utils/is-thenable.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/task/task-group.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/queue/event-queue.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/queue/event-queue.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/bind-all.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/types.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/universalStorage.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/memoryStorage.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/settings.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/user/tld.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/cookieStorage.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/localStorage.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/storage/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/user/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/is-thenable.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/buffer/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/analytics/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/env-enrichment/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/create-deferred.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/client-hints/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/remote-loader/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/on-page-change.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/segmentio/batched-dispatcher.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/segmentio/fetch-dispatcher.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/segmentio/normalize.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/segmentio/schedule-flush.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/segmentio/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/validation/errors.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-core/dist/esm/validation/assertions.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/validation/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/inspector/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/browser/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/connection/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/constants/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/context/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/environment/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/query-string/gracefulDecodeURIComponent.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/stats/remote-metrics.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/core/stats/index.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/generated/version.js","webpack://rokk3rfuel/./node_modules/unfetch/dist/unfetch.module.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/fetch.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/get-global.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/global-analytics-helper.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/load-script.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/merged-options.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/p-while.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/parse-cdn.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/priority-queue/persisted.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/to-facade.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/lib/version-type.js","webpack://rokk3rfuel/./node_modules/@segment/analytics-next/dist/pkg/plugins/middleware/index.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/address.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/alias.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/clone.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/delete.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/facade.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/group.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/identify.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/index.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/is-email.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/is-enabled.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/page.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/screen.js","webpack://rokk3rfuel/./node_modules/@segment/facade/dist/track.js","webpack://rokk3rfuel/./node_modules/@segment/isodate-traverse/lib/index.js","webpack://rokk3rfuel/./node_modules/@segment/isodate/lib/index.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/browser.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/can-promise.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/alignment-pattern.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/alphanumeric-data.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/bit-buffer.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/bit-matrix.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/byte-data.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/error-correction-code.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/error-correction-level.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/finder-pattern.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/format-info.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/galois-field.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/kanji-data.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/mask-pattern.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/mode.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/numeric-data.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/polynomial.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/qrcode.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/reed-solomon-encoder.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/regex.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/segments.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/utils.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/version-check.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/core/version.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/renderer/canvas.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/renderer/svg-tag.js","webpack://rokk3rfuel/./node_modules/qrcode/lib/renderer/utils.js","webpack://rokk3rfuel/./node_modules/querystring/decode.js","webpack://rokk3rfuel/./node_modules/querystring/encode.js","webpack://rokk3rfuel/./node_modules/querystring/index.js","webpack://rokk3rfuel/./node_modules/safe-json-parse/tuple.js","webpack://rokk3rfuel/./node_modules/scroll-out/lib/index.js","webpack://rokk3rfuel/./node_modules/signature_pad/dist/signature_pad.js","webpack://rokk3rfuel/./node_modules/spark-md5/spark-md5.js","webpack://rokk3rfuel/./node_modules/tinyqueue/index.js","webpack://rokk3rfuel/./node_modules/tslib/tslib.es6.js","webpack://rokk3rfuel/./node_modules/url-toolkit/src/url-toolkit.js","webpack://rokk3rfuel/./node_modules/url/url.js"],"sourcesContent":["export function pTimeout(promise, timeout) {\n return new Promise(function (resolve, reject) {\n var timeoutId = setTimeout(function () {\n reject(Error('Promise timed out'));\n }, timeout);\n promise\n .then(function (val) {\n clearTimeout(timeoutId);\n return resolve(val);\n })\n .catch(reject);\n });\n}\nexport function sleep(timeoutInMs) {\n return new Promise(function (resolve) { return setTimeout(resolve, timeoutInMs); });\n}\n/**\n * @param ctx\n * @param callback - the function to invoke\n * @param delay - aka \"timeout\". The amount of time in ms to wait before invoking the callback.\n */\nexport function invokeCallback(ctx, callback, delay) {\n var cb = function () {\n try {\n return Promise.resolve(callback(ctx));\n }\n catch (err) {\n return Promise.reject(err);\n }\n };\n return (sleep(delay)\n // pTimeout ensures that the callback can't cause the context to hang\n .then(function () { return pTimeout(cb(), 1000); })\n .catch(function (err) {\n ctx === null || ctx === void 0 ? void 0 : ctx.log('warn', 'Callback Error', { error: err });\n ctx === null || ctx === void 0 ? void 0 : ctx.stats.increment('callback_error');\n })\n .then(function () { return ctx; }));\n}\n//# sourceMappingURL=index.js.map","import { __assign } from \"tslib\";\nvar CoreLogger = /** @class */ (function () {\n function CoreLogger() {\n this._logs = [];\n }\n CoreLogger.prototype.log = function (level, message, extras) {\n var time = new Date();\n this._logs.push({\n level: level,\n message: message,\n time: time,\n extras: extras,\n });\n };\n Object.defineProperty(CoreLogger.prototype, \"logs\", {\n get: function () {\n return this._logs;\n },\n enumerable: false,\n configurable: true\n });\n CoreLogger.prototype.flush = function () {\n if (this.logs.length > 1) {\n var formatted = this._logs.reduce(function (logs, log) {\n var _a;\n var _b, _c;\n var line = __assign(__assign({}, log), { json: JSON.stringify(log.extras, null, ' '), extras: log.extras });\n delete line['time'];\n var key = (_c = (_b = log.time) === null || _b === void 0 ? void 0 : _b.toISOString()) !== null && _c !== void 0 ? _c : '';\n if (logs[key]) {\n key = \"\".concat(key, \"-\").concat(Math.random());\n }\n return __assign(__assign({}, logs), (_a = {}, _a[key] = line, _a));\n }, {});\n // ie doesn't like console.table\n if (console.table) {\n console.table(formatted);\n }\n else {\n console.log(formatted);\n }\n }\n else {\n this.logs.forEach(function (logEntry) {\n var level = logEntry.level, message = logEntry.message, extras = logEntry.extras;\n if (level === 'info' || level === 'debug') {\n console.log(message, extras !== null && extras !== void 0 ? extras : '');\n }\n else {\n console[level](message, extras !== null && extras !== void 0 ? extras : '');\n }\n });\n }\n this._logs = [];\n };\n return CoreLogger;\n}());\nexport { CoreLogger };\n//# sourceMappingURL=index.js.map","import { v4 as uuid } from '@lukeed/uuid';\nimport { dset } from 'dset';\nimport { CoreLogger } from '../logger';\nimport { NullStats } from '../stats';\nvar ContextCancelation = /** @class */ (function () {\n function ContextCancelation(options) {\n var _a, _b, _c;\n this.retry = (_a = options.retry) !== null && _a !== void 0 ? _a : true;\n this.type = (_b = options.type) !== null && _b !== void 0 ? _b : 'plugin Error';\n this.reason = (_c = options.reason) !== null && _c !== void 0 ? _c : '';\n }\n return ContextCancelation;\n}());\nexport { ContextCancelation };\nvar CoreContext = /** @class */ (function () {\n function CoreContext(event, id, stats, logger) {\n if (id === void 0) { id = uuid(); }\n if (stats === void 0) { stats = new NullStats(); }\n if (logger === void 0) { logger = new CoreLogger(); }\n this.attempts = 0;\n this.event = event;\n this._id = id;\n this.logger = logger;\n this.stats = stats;\n }\n CoreContext.system = function () {\n // This should be overridden by the subclass to return an instance of the subclass.\n };\n CoreContext.prototype.isSame = function (other) {\n return other.id === this.id;\n };\n CoreContext.prototype.cancel = function (error) {\n if (error) {\n throw error;\n }\n throw new ContextCancelation({ reason: 'Context Cancel' });\n };\n CoreContext.prototype.log = function (level, message, extras) {\n this.logger.log(level, message, extras);\n };\n Object.defineProperty(CoreContext.prototype, \"id\", {\n get: function () {\n return this._id;\n },\n enumerable: false,\n configurable: true\n });\n CoreContext.prototype.updateEvent = function (path, val) {\n var _a;\n // Don't allow integrations that are set to false to be overwritten with integration settings.\n if (path.split('.')[0] === 'integrations') {\n var integrationName = path.split('.')[1];\n if (((_a = this.event.integrations) === null || _a === void 0 ? void 0 : _a[integrationName]) === false) {\n return this.event;\n }\n }\n dset(this.event, path, val);\n return this.event;\n };\n CoreContext.prototype.failedDelivery = function () {\n return this._failedDelivery;\n };\n CoreContext.prototype.setFailedDelivery = function (options) {\n this._failedDelivery = options;\n };\n CoreContext.prototype.logs = function () {\n return this.logger.logs;\n };\n CoreContext.prototype.flush = function () {\n this.logger.flush();\n this.stats.flush();\n };\n CoreContext.prototype.toJSON = function () {\n return {\n id: this._id,\n event: this.event,\n logs: this.logger.logs,\n metrics: this.stats.metrics,\n };\n };\n return CoreContext;\n}());\nexport { CoreContext };\n//# sourceMappingURL=index.js.map","/**\n * Event Emitter that takes the expected contract as a generic\n * @example\n * ```ts\n * type Contract = {\n * delivery_success: [DeliverySuccessResponse, Metrics],\n * delivery_failure: [DeliveryError]\n * }\n * new Emitter()\n * .on('delivery_success', (res, metrics) => ...)\n * .on('delivery_failure', (err) => ...)\n * ```\n */\nvar Emitter = /** @class */ (function () {\n function Emitter() {\n this.callbacks = {};\n }\n Emitter.prototype.on = function (event, callback) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [callback];\n }\n else {\n this.callbacks[event].push(callback);\n }\n return this;\n };\n Emitter.prototype.once = function (event, callback) {\n var _this = this;\n var on = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n _this.off(event, on);\n callback.apply(_this, args);\n };\n this.on(event, on);\n return this;\n };\n Emitter.prototype.off = function (event, callback) {\n var _a;\n var fns = (_a = this.callbacks[event]) !== null && _a !== void 0 ? _a : [];\n var without = fns.filter(function (fn) { return fn !== callback; });\n this.callbacks[event] = without;\n return this;\n };\n Emitter.prototype.emit = function (event) {\n var _this = this;\n var _a;\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var callbacks = (_a = this.callbacks[event]) !== null && _a !== void 0 ? _a : [];\n callbacks.forEach(function (callback) {\n callback.apply(_this, args);\n });\n return this;\n };\n return Emitter;\n}());\nexport { Emitter };\n//# sourceMappingURL=index.js.map","export function backoff(params) {\n var random = Math.random() + 1;\n var _a = params.minTimeout, minTimeout = _a === void 0 ? 500 : _a, _b = params.factor, factor = _b === void 0 ? 2 : _b, attempt = params.attempt, _c = params.maxTimeout, maxTimeout = _c === void 0 ? Infinity : _c;\n return Math.min(random * minTimeout * Math.pow(factor, attempt), maxTimeout);\n}\n//# sourceMappingURL=backoff.js.map","import { __extends } from \"tslib\";\nimport { Emitter } from '../emitter';\nimport { backoff } from './backoff';\n/**\n * @internal\n */\nexport var ON_REMOVE_FROM_FUTURE = 'onRemoveFromFuture';\nvar PriorityQueue = /** @class */ (function (_super) {\n __extends(PriorityQueue, _super);\n function PriorityQueue(maxAttempts, queue, seen) {\n var _this = _super.call(this) || this;\n _this.future = [];\n _this.maxAttempts = maxAttempts;\n _this.queue = queue;\n _this.seen = seen !== null && seen !== void 0 ? seen : {};\n return _this;\n }\n PriorityQueue.prototype.push = function () {\n var _this = this;\n var items = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n items[_i] = arguments[_i];\n }\n var accepted = items.map(function (operation) {\n var attempts = _this.updateAttempts(operation);\n if (attempts > _this.maxAttempts || _this.includes(operation)) {\n return false;\n }\n _this.queue.push(operation);\n return true;\n });\n this.queue = this.queue.sort(function (a, b) { return _this.getAttempts(a) - _this.getAttempts(b); });\n return accepted;\n };\n PriorityQueue.prototype.pushWithBackoff = function (item) {\n var _this = this;\n if (this.getAttempts(item) === 0) {\n return this.push(item)[0];\n }\n var attempt = this.updateAttempts(item);\n if (attempt > this.maxAttempts || this.includes(item)) {\n return false;\n }\n var timeout = backoff({ attempt: attempt - 1 });\n setTimeout(function () {\n _this.queue.push(item);\n // remove from future list\n _this.future = _this.future.filter(function (f) { return f.id !== item.id; });\n // Lets listeners know that a 'future' message is now available in the queue\n _this.emit(ON_REMOVE_FROM_FUTURE);\n }, timeout);\n this.future.push(item);\n return true;\n };\n PriorityQueue.prototype.getAttempts = function (item) {\n var _a;\n return (_a = this.seen[item.id]) !== null && _a !== void 0 ? _a : 0;\n };\n PriorityQueue.prototype.updateAttempts = function (item) {\n this.seen[item.id] = this.getAttempts(item) + 1;\n return this.getAttempts(item);\n };\n PriorityQueue.prototype.includes = function (item) {\n return (this.queue.includes(item) ||\n this.future.includes(item) ||\n Boolean(this.queue.find(function (i) { return i.id === item.id; })) ||\n Boolean(this.future.find(function (i) { return i.id === item.id; })));\n };\n PriorityQueue.prototype.pop = function () {\n return this.queue.shift();\n };\n Object.defineProperty(PriorityQueue.prototype, \"length\", {\n get: function () {\n return this.queue.length;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(PriorityQueue.prototype, \"todo\", {\n get: function () {\n return this.queue.length + this.future.length;\n },\n enumerable: false,\n configurable: true\n });\n return PriorityQueue;\n}(Emitter));\nexport { PriorityQueue };\n//# sourceMappingURL=index.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { CoreContext, ContextCancelation } from '../context';\nfunction tryAsync(fn) {\n return __awaiter(this, void 0, void 0, function () {\n var err_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, fn()];\n case 1: return [2 /*return*/, _a.sent()];\n case 2:\n err_1 = _a.sent();\n return [2 /*return*/, Promise.reject(err_1)];\n case 3: return [2 /*return*/];\n }\n });\n });\n}\nexport function attempt(ctx, plugin) {\n ctx.log('debug', 'plugin', { plugin: plugin.name });\n var start = new Date().getTime();\n var hook = plugin[ctx.event.type];\n if (hook === undefined) {\n return Promise.resolve(ctx);\n }\n var newCtx = tryAsync(function () { return hook.apply(plugin, [ctx]); })\n .then(function (ctx) {\n var done = new Date().getTime() - start;\n ctx.stats.gauge('plugin_time', done, [\"plugin:\".concat(plugin.name)]);\n return ctx;\n })\n .catch(function (err) {\n if (err instanceof ContextCancelation &&\n err.type === 'middleware_cancellation') {\n throw err;\n }\n if (err instanceof ContextCancelation) {\n ctx.log('warn', err.type, {\n plugin: plugin.name,\n error: err,\n });\n return err;\n }\n ctx.log('error', 'plugin Error', {\n plugin: plugin.name,\n error: err,\n });\n ctx.stats.increment('plugin_error', 1, [\"plugin:\".concat(plugin.name)]);\n return err;\n });\n return newCtx;\n}\nexport function ensure(ctx, plugin) {\n return attempt(ctx, plugin).then(function (newContext) {\n if (newContext instanceof CoreContext) {\n return newContext;\n }\n ctx.log('debug', 'Context canceled');\n ctx.stats.increment('context_canceled');\n ctx.cancel(newContext);\n });\n}\n//# sourceMappingURL=delivery.js.map","import { __assign, __extends } from \"tslib\";\nvar compactMetricType = function (type) {\n var enums = {\n gauge: 'g',\n counter: 'c',\n };\n return enums[type];\n};\nvar CoreStats = /** @class */ (function () {\n function CoreStats() {\n this.metrics = [];\n }\n CoreStats.prototype.increment = function (metric, by, tags) {\n if (by === void 0) { by = 1; }\n this.metrics.push({\n metric: metric,\n value: by,\n tags: tags !== null && tags !== void 0 ? tags : [],\n type: 'counter',\n timestamp: Date.now(),\n });\n };\n CoreStats.prototype.gauge = function (metric, value, tags) {\n this.metrics.push({\n metric: metric,\n value: value,\n tags: tags !== null && tags !== void 0 ? tags : [],\n type: 'gauge',\n timestamp: Date.now(),\n });\n };\n CoreStats.prototype.flush = function () {\n var formatted = this.metrics.map(function (m) { return (__assign(__assign({}, m), { tags: m.tags.join(',') })); });\n // ie doesn't like console.table\n if (console.table) {\n console.table(formatted);\n }\n else {\n console.log(formatted);\n }\n this.metrics = [];\n };\n /**\n * compact keys for smaller payload\n */\n CoreStats.prototype.serialize = function () {\n return this.metrics.map(function (m) {\n return {\n m: m.metric,\n v: m.value,\n t: m.tags,\n k: compactMetricType(m.type),\n e: m.timestamp,\n };\n });\n };\n return CoreStats;\n}());\nexport { CoreStats };\nvar NullStats = /** @class */ (function (_super) {\n __extends(NullStats, _super);\n function NullStats() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n NullStats.prototype.gauge = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n NullStats.prototype.increment = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n NullStats.prototype.flush = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n NullStats.prototype.serialize = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n return [];\n };\n return NullStats;\n}(CoreStats));\nexport { NullStats };\n//# sourceMappingURL=index.js.map","export function isString(obj) {\n return typeof obj === 'string';\n}\nexport function isNumber(obj) {\n return typeof obj === 'number';\n}\nexport function isFunction(obj) {\n return typeof obj === 'function';\n}\nexport function exists(val) {\n return val !== undefined && val !== null;\n}\nexport function isPlainObject(obj) {\n return (Object.prototype.toString.call(obj).slice(8, -1).toLowerCase() === 'object');\n}\n//# sourceMappingURL=helpers.js.map","/**\n * Returns `process.env` if it is available in the environment.\n * Always returns an object make it similarly easy to use as `process.env`.\n */\nexport function getProcessEnv() {\n if (typeof process === 'undefined' || !process.env) {\n return {};\n }\n return process.env;\n}\n//# sourceMappingURL=get-process-env.js.map","import { isFunction, isPlainObject, isString, isNumber, } from '@segment/analytics-core';\n/**\n * Helper for the track method\n */\nexport function resolveArguments(eventName, properties, options, callback) {\n var _a;\n var args = [eventName, properties, options, callback];\n var name = isPlainObject(eventName) ? eventName.event : eventName;\n if (!name || !isString(name)) {\n throw new Error('Event missing');\n }\n var data = isPlainObject(eventName)\n ? (_a = eventName.properties) !== null && _a !== void 0 ? _a : {}\n : isPlainObject(properties)\n ? properties\n : {};\n var opts = {};\n if (!isFunction(options)) {\n opts = options !== null && options !== void 0 ? options : {};\n }\n if (isPlainObject(eventName) && !isFunction(properties)) {\n opts = properties !== null && properties !== void 0 ? properties : {};\n }\n var cb = args.find(isFunction);\n return [name, data, opts, cb];\n}\n/**\n * Helper for page, screen methods\n */\nexport function resolvePageArguments(category, name, properties, options, callback) {\n var _a, _b;\n var resolvedCategory = null;\n var resolvedName = null;\n var args = [category, name, properties, options, callback];\n var strings = args.filter(isString);\n if (strings[0] !== undefined && strings[1] !== undefined) {\n resolvedCategory = strings[0];\n resolvedName = strings[1];\n }\n if (strings.length === 1) {\n resolvedCategory = null;\n resolvedName = strings[0];\n }\n var resolvedCallback = args.find(isFunction);\n var objects = args.filter(function (obj) {\n if (resolvedName === null) {\n return isPlainObject(obj);\n }\n return isPlainObject(obj) || obj === null;\n });\n var resolvedProperties = ((_a = objects[0]) !== null && _a !== void 0 ? _a : {});\n var resolvedOptions = ((_b = objects[1]) !== null && _b !== void 0 ? _b : {});\n return [\n resolvedCategory,\n resolvedName,\n resolvedProperties,\n resolvedOptions,\n resolvedCallback,\n ];\n}\n/**\n * Helper for group, identify methods\n */\nexport var resolveUserArguments = function (user) {\n return function () {\n var _a, _b, _c;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var values = {};\n // It's a stack so it's reversed so that we go through each of the expected arguments\n var orderStack = [\n 'callback',\n 'options',\n 'traits',\n 'id',\n ];\n // Read each argument and eval the possible values here\n for (var _d = 0, args_1 = args; _d < args_1.length; _d++) {\n var arg = args_1[_d];\n var current = orderStack.pop();\n if (current === 'id') {\n if (isString(arg) || isNumber(arg)) {\n values.id = arg.toString();\n continue;\n }\n if (arg === null || arg === undefined) {\n continue;\n }\n // First argument should always be the id, if it is not a valid value we can skip it\n current = orderStack.pop();\n }\n // Traits and Options\n if ((current === 'traits' || current === 'options') &&\n (arg === null || arg === undefined || isPlainObject(arg))) {\n values[current] = arg;\n }\n // Callback\n if (isFunction(arg)) {\n values.callback = arg;\n break; // This is always the last argument\n }\n }\n return [\n (_a = values.id) !== null && _a !== void 0 ? _a : user.id(),\n ((_b = values.traits) !== null && _b !== void 0 ? _b : {}),\n (_c = values.options) !== null && _c !== void 0 ? _c : {},\n values.callback,\n ];\n };\n};\n/**\n * Helper for alias method\n */\nexport function resolveAliasArguments(to, from, options, callback) {\n if (isNumber(to))\n to = to.toString(); // Legacy behaviour - allow integers for alias calls\n if (isNumber(from))\n from = from.toString();\n var args = [to, from, options, callback];\n var _a = args.filter(isString), _b = _a[0], aliasTo = _b === void 0 ? to : _b, _c = _a[1], aliasFrom = _c === void 0 ? null : _c;\n var _d = args.filter(isPlainObject)[0], opts = _d === void 0 ? {} : _d;\n var resolvedCallback = args.find(isFunction);\n return [aliasTo, aliasFrom, opts, resolvedCallback];\n}\n//# sourceMappingURL=index.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { invokeCallback } from '../callback';\n/* The amount of time in ms to wait before invoking the callback. */\nexport var getDelay = function (startTimeInEpochMS, timeoutInMS) {\n var elapsedTime = Date.now() - startTimeInEpochMS;\n // increasing the timeout increases the delay by almost the same amount -- this is weird legacy behavior.\n return Math.max((timeoutInMS !== null && timeoutInMS !== void 0 ? timeoutInMS : 300) - elapsedTime, 0);\n};\n/**\n * Push an event into the dispatch queue and invoke any callbacks.\n *\n * @param event - Segment event to enqueue.\n * @param queue - Queue to dispatch against.\n * @param emitter - This is typically an instance of \"Analytics\" -- used for metrics / progress information.\n * @param options\n */\nexport function dispatch(ctx, queue, emitter, options) {\n return __awaiter(this, void 0, void 0, function () {\n var startTime, dispatched;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n emitter.emit('dispatch_start', ctx);\n startTime = Date.now();\n if (!queue.isEmpty()) return [3 /*break*/, 2];\n return [4 /*yield*/, queue.dispatchSingle(ctx)];\n case 1:\n dispatched = _a.sent();\n return [3 /*break*/, 4];\n case 2: return [4 /*yield*/, queue.dispatch(ctx)];\n case 3:\n dispatched = _a.sent();\n _a.label = 4;\n case 4:\n if (!(options === null || options === void 0 ? void 0 : options.callback)) return [3 /*break*/, 6];\n return [4 /*yield*/, invokeCallback(dispatched, options.callback, getDelay(startTime, options.timeout))];\n case 5:\n dispatched = _a.sent();\n _a.label = 6;\n case 6:\n if (options === null || options === void 0 ? void 0 : options.debug) {\n dispatched.flush();\n }\n return [2 /*return*/, dispatched];\n }\n });\n });\n}\n//# sourceMappingURL=dispatch.js.map","import { __spreadArray } from \"tslib\";\n/**\n * @example\n * pick({ 'a': 1, 'b': '2', 'c': 3 }, ['a', 'c'])\n * => { 'a': 1, 'c': 3 }\n */\nexport function pick(object, keys) {\n return Object.assign.apply(Object, __spreadArray([{}], keys.map(function (key) {\n var _a;\n if (object && Object.prototype.hasOwnProperty.call(object, key)) {\n return _a = {}, _a[key] = object[key], _a;\n }\n }), false));\n}\n//# sourceMappingURL=pick.js.map","import { isPlainObject } from '@segment/analytics-core';\nexport var BufferedPageContextDiscriminant = 'bpc';\n/**\n * `BufferedPageContext` object builder\n */\nexport var createBufferedPageContext = function (url, canonicalUrl, search, path, title, referrer) { return ({\n __t: BufferedPageContextDiscriminant,\n c: canonicalUrl,\n p: path,\n u: url,\n s: search,\n t: title,\n r: referrer,\n}); };\n// my clever/dubious way of making sure this type guard does not get out sync with the type definition\nvar BUFFERED_PAGE_CONTEXT_KEYS = Object.keys(createBufferedPageContext('', '', '', '', '', ''));\nexport function isBufferedPageContext(bufferedPageCtx) {\n if (!isPlainObject(bufferedPageCtx))\n return false;\n if (bufferedPageCtx.__t !== BufferedPageContextDiscriminant)\n return false;\n // ensure obj has all the keys we expect, and none we don't.\n for (var k in bufferedPageCtx) {\n if (!BUFFERED_PAGE_CONTEXT_KEYS.includes(k)) {\n return false;\n }\n }\n return true;\n}\n// Legacy logic: we are we appending search parameters to the canonical URL -- I guess the canonical URL is \"not canonical enough\" (lol)\nvar createCanonicalURL = function (canonicalUrl, searchParams) {\n return canonicalUrl.indexOf('?') > -1\n ? canonicalUrl\n : canonicalUrl + searchParams;\n};\n/**\n * Strips hash from URL.\n * http://www.segment.local#test -> http://www.segment.local\n */\nvar removeHash = function (href) {\n var hashIdx = href.indexOf('#');\n return hashIdx === -1 ? href : href.slice(0, hashIdx);\n};\nvar parseCanonicalPath = function (canonicalUrl) {\n try {\n return new URL(canonicalUrl).pathname;\n }\n catch (_e) {\n // this is classic behavior -- we assume that if the canonical URL is invalid, it's a raw path.\n return canonicalUrl[0] === '/' ? canonicalUrl : '/' + canonicalUrl;\n }\n};\n/**\n * Create a `PageContext` from a `BufferedPageContext`.\n * `BufferedPageContext` keys are minified to save bytes in the snippet.\n */\nexport var createPageContext = function (_a) {\n var canonicalUrl = _a.c, pathname = _a.p, search = _a.s, url = _a.u, referrer = _a.r, title = _a.t;\n var newPath = canonicalUrl ? parseCanonicalPath(canonicalUrl) : pathname;\n var newUrl = canonicalUrl\n ? createCanonicalURL(canonicalUrl, search)\n : removeHash(url);\n return {\n path: newPath,\n referrer: referrer,\n search: search,\n title: title,\n url: newUrl,\n };\n};\n/**\n * Get page properties from the browser window/document.\n */\nexport var getDefaultBufferedPageContext = function () {\n var c = document.querySelector(\"link[rel='canonical']\");\n return createBufferedPageContext(location.href, (c && c.getAttribute('href')) || undefined, location.search, location.pathname, document.title, document.referrer);\n};\n/**\n * Get page properties from the browser window/document.\n */\nexport var getDefaultPageContext = function () {\n return createPageContext(getDefaultBufferedPageContext());\n};\n//# sourceMappingURL=get-page-context.js.map","import { __assign } from \"tslib\";\nimport { pick } from '../../lib/pick';\nimport { getDefaultPageContext } from './get-page-context';\n/**\n * Augments a segment event with information about the current page.\n * Page information like URL changes frequently, so this is meant to be captured as close to the event call as possible.\n * Things like `userAgent` do not change, so they can be added later in the flow.\n * We prefer not to add this information to this function, as it increases the main bundle size.\n */\nexport var addPageContext = function (event, pageCtx) {\n if (pageCtx === void 0) { pageCtx = getDefaultPageContext(); }\n var evtCtx = event.context; // Context should be set earlier in the flow\n var pageContextFromEventProps;\n if (event.type === 'page') {\n pageContextFromEventProps =\n event.properties && pick(event.properties, Object.keys(pageCtx));\n event.properties = __assign(__assign(__assign({}, pageCtx), event.properties), (event.name ? { name: event.name } : {}));\n }\n evtCtx.page = __assign(__assign(__assign({}, pageCtx), pageContextFromEventProps), evtCtx.page);\n};\n//# sourceMappingURL=add-page-context.js.map","import { __assign, __rest } from \"tslib\";\nimport { v4 as uuid } from '@lukeed/uuid';\nimport { dset } from 'dset';\nimport md5 from 'spark-md5';\nimport { addPageContext } from '../page';\nexport * from './interfaces';\nvar EventFactory = /** @class */ (function () {\n function EventFactory(user) {\n this.user = user;\n }\n EventFactory.prototype.track = function (event, properties, options, globalIntegrations, pageCtx) {\n return this.normalize(__assign(__assign({}, this.baseEvent()), { event: event, type: 'track', properties: properties, options: __assign({}, options), integrations: __assign({}, globalIntegrations) }), pageCtx);\n };\n EventFactory.prototype.page = function (category, page, properties, options, globalIntegrations, pageCtx) {\n var _a;\n var event = {\n type: 'page',\n properties: __assign({}, properties),\n options: __assign({}, options),\n integrations: __assign({}, globalIntegrations),\n };\n if (category !== null) {\n event.category = category;\n event.properties = (_a = event.properties) !== null && _a !== void 0 ? _a : {};\n event.properties.category = category;\n }\n if (page !== null) {\n event.name = page;\n }\n return this.normalize(__assign(__assign({}, this.baseEvent()), event), pageCtx);\n };\n EventFactory.prototype.screen = function (category, screen, properties, options, globalIntegrations, pageCtx) {\n var event = {\n type: 'screen',\n properties: __assign({}, properties),\n options: __assign({}, options),\n integrations: __assign({}, globalIntegrations),\n };\n if (category !== null) {\n event.category = category;\n }\n if (screen !== null) {\n event.name = screen;\n }\n return this.normalize(__assign(__assign({}, this.baseEvent()), event), pageCtx);\n };\n EventFactory.prototype.identify = function (userId, traits, options, globalIntegrations, pageCtx) {\n return this.normalize(__assign(__assign({}, this.baseEvent()), { type: 'identify', userId: userId, traits: traits, options: __assign({}, options), integrations: __assign({}, globalIntegrations) }), pageCtx);\n };\n EventFactory.prototype.group = function (groupId, traits, options, globalIntegrations, pageCtx) {\n return this.normalize(__assign(__assign({}, this.baseEvent()), { type: 'group', traits: traits, options: __assign({}, options), integrations: __assign({}, globalIntegrations), groupId: groupId }), pageCtx);\n };\n EventFactory.prototype.alias = function (to, from, options, globalIntegrations, pageCtx) {\n var base = {\n userId: to,\n type: 'alias',\n options: __assign({}, options),\n integrations: __assign({}, globalIntegrations),\n };\n if (from !== null) {\n base.previousId = from;\n }\n if (to === undefined) {\n return this.normalize(__assign(__assign({}, base), this.baseEvent()));\n }\n return this.normalize(__assign(__assign({}, this.baseEvent()), base), pageCtx);\n };\n EventFactory.prototype.baseEvent = function () {\n var base = {\n integrations: {},\n options: {},\n };\n var user = this.user;\n if (user.id()) {\n base.userId = user.id();\n }\n if (user.anonymousId()) {\n base.anonymousId = user.anonymousId();\n }\n return base;\n };\n /**\n * Builds the context part of an event based on \"foreign\" keys that\n * are provided in the `Options` parameter for an Event\n */\n EventFactory.prototype.context = function (event) {\n var _a, _b, _c;\n var optionsKeys = ['integrations', 'anonymousId', 'timestamp', 'userId'];\n var options = (_a = event.options) !== null && _a !== void 0 ? _a : {};\n delete options['integrations'];\n var providedOptionsKeys = Object.keys(options);\n var context = (_c = (_b = event.options) === null || _b === void 0 ? void 0 : _b.context) !== null && _c !== void 0 ? _c : {};\n var overrides = {};\n providedOptionsKeys.forEach(function (key) {\n if (key === 'context') {\n return;\n }\n if (optionsKeys.includes(key)) {\n dset(overrides, key, options[key]);\n }\n else {\n dset(context, key, options[key]);\n }\n });\n return [context, overrides];\n };\n EventFactory.prototype.normalize = function (event, pageCtx) {\n var _a, _b, _c;\n // set anonymousId globally if we encounter an override\n //segment.com/docs/connections/sources/catalog/libraries/website/javascript/identity/#override-the-anonymous-id-using-the-options-object\n ((_a = event.options) === null || _a === void 0 ? void 0 : _a.anonymousId) &&\n this.user.anonymousId(event.options.anonymousId);\n var integrationBooleans = Object.keys((_b = event.integrations) !== null && _b !== void 0 ? _b : {}).reduce(function (integrationNames, name) {\n var _a;\n var _b;\n return __assign(__assign({}, integrationNames), (_a = {}, _a[name] = Boolean((_b = event.integrations) === null || _b === void 0 ? void 0 : _b[name]), _a));\n }, {});\n // This is pretty trippy, but here's what's going on:\n // - a) We don't pass initial integration options as part of the event, only if they're true or false\n // - b) We do accept per integration overrides (like integrations.Amplitude.sessionId) at the event level\n // Hence the need to convert base integration options to booleans, but maintain per event integration overrides\n var allIntegrations = __assign(__assign({}, integrationBooleans), (_c = event.options) === null || _c === void 0 ? void 0 : _c.integrations);\n var _d = this.context(event), context = _d[0], overrides = _d[1];\n var options = event.options, rest = __rest(event, [\"options\"]);\n var newEvent = __assign(__assign(__assign(__assign({ timestamp: new Date() }, rest), { context: context, integrations: allIntegrations }), overrides), { messageId: 'ajs-next-' + md5.hash(JSON.stringify(event) + uuid()) });\n addPageContext(newEvent, pageCtx);\n return newEvent;\n };\n return EventFactory;\n}());\nexport { EventFactory };\n//# sourceMappingURL=index.js.map","import { __spreadArray } from \"tslib\";\nexport function groupBy(collection, grouper) {\n var results = {};\n collection.forEach(function (item) {\n var _a;\n var key = undefined;\n if (typeof grouper === 'string') {\n var suggestedKey = item[grouper];\n key =\n typeof suggestedKey !== 'string'\n ? JSON.stringify(suggestedKey)\n : suggestedKey;\n }\n else if (grouper instanceof Function) {\n key = grouper(item);\n }\n if (key === undefined) {\n return;\n }\n results[key] = __spreadArray(__spreadArray([], ((_a = results[key]) !== null && _a !== void 0 ? _a : []), true), [item], false);\n });\n return results;\n}\n//# sourceMappingURL=group-by.js.map","/**\n * Check if thenable\n * (instanceof Promise doesn't respect realms)\n */\nexport var isThenable = function (value) {\n return typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function';\n};\n//# sourceMappingURL=is-thenable.js.map","import { isThenable } from '../utils/is-thenable';\nexport var createTaskGroup = function () {\n var taskCompletionPromise;\n var resolvePromise;\n var count = 0;\n return {\n done: function () { return taskCompletionPromise; },\n run: function (op) {\n var returnValue = op();\n if (isThenable(returnValue)) {\n if (++count === 1) {\n taskCompletionPromise = new Promise(function (res) { return (resolvePromise = res); });\n }\n returnValue.finally(function () { return --count === 0 && resolvePromise(); });\n }\n return returnValue;\n },\n };\n};\n//# sourceMappingURL=task-group.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport { groupBy } from '../utils/group-by';\nimport { ON_REMOVE_FROM_FUTURE } from '../priority-queue';\nimport { CoreContext, ContextCancelation } from '../context';\nimport { Emitter } from '../emitter';\nimport { createTaskGroup } from '../task/task-group';\nimport { attempt, ensure } from './delivery';\nvar CoreEventQueue = /** @class */ (function (_super) {\n __extends(CoreEventQueue, _super);\n function CoreEventQueue(priorityQueue) {\n var _this = _super.call(this) || this;\n /**\n * All event deliveries get suspended until all the tasks in this task group are complete.\n * For example: a middleware that augments the event object should be loaded safely as a\n * critical task, this way, event queue will wait for it to be ready before sending events.\n *\n * This applies to all the events already in the queue, and the upcoming ones\n */\n _this.criticalTasks = createTaskGroup();\n _this.plugins = [];\n _this.failedInitializations = [];\n _this.flushing = false;\n _this.queue = priorityQueue;\n _this.queue.on(ON_REMOVE_FROM_FUTURE, function () {\n _this.scheduleFlush(0);\n });\n return _this;\n }\n CoreEventQueue.prototype.register = function (ctx, plugin, instance) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, Promise.resolve(plugin.load(ctx, instance))\n .then(function () {\n _this.plugins.push(plugin);\n })\n .catch(function (err) {\n if (plugin.type === 'destination') {\n _this.failedInitializations.push(plugin.name);\n console.warn(plugin.name, err);\n ctx.log('warn', 'Failed to load destination', {\n plugin: plugin.name,\n error: err,\n });\n return;\n }\n throw err;\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n CoreEventQueue.prototype.deregister = function (ctx, plugin, instance) {\n return __awaiter(this, void 0, void 0, function () {\n var e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3, , 4]);\n if (!plugin.unload) return [3 /*break*/, 2];\n return [4 /*yield*/, Promise.resolve(plugin.unload(ctx, instance))];\n case 1:\n _a.sent();\n _a.label = 2;\n case 2:\n this.plugins = this.plugins.filter(function (p) { return p.name !== plugin.name; });\n return [3 /*break*/, 4];\n case 3:\n e_1 = _a.sent();\n ctx.log('warn', 'Failed to unload destination', {\n plugin: plugin.name,\n error: e_1,\n });\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n };\n CoreEventQueue.prototype.dispatch = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var willDeliver;\n return __generator(this, function (_a) {\n ctx.log('debug', 'Dispatching');\n ctx.stats.increment('message_dispatched');\n this.queue.push(ctx);\n willDeliver = this.subscribeToDelivery(ctx);\n this.scheduleFlush(0);\n return [2 /*return*/, willDeliver];\n });\n });\n };\n CoreEventQueue.prototype.subscribeToDelivery = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, new Promise(function (resolve) {\n var onDeliver = function (flushed, delivered) {\n if (flushed.isSame(ctx)) {\n _this.off('flush', onDeliver);\n if (delivered) {\n resolve(flushed);\n }\n else {\n resolve(flushed);\n }\n }\n };\n _this.on('flush', onDeliver);\n })];\n });\n });\n };\n CoreEventQueue.prototype.dispatchSingle = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n ctx.log('debug', 'Dispatching');\n ctx.stats.increment('message_dispatched');\n this.queue.updateAttempts(ctx);\n ctx.attempts = 1;\n return [2 /*return*/, this.deliver(ctx).catch(function (err) {\n var accepted = _this.enqueuRetry(err, ctx);\n if (!accepted) {\n ctx.setFailedDelivery({ reason: err });\n return ctx;\n }\n return _this.subscribeToDelivery(ctx);\n })];\n });\n });\n };\n CoreEventQueue.prototype.isEmpty = function () {\n return this.queue.length === 0;\n };\n CoreEventQueue.prototype.scheduleFlush = function (timeout) {\n var _this = this;\n if (timeout === void 0) { timeout = 500; }\n if (this.flushing) {\n return;\n }\n this.flushing = true;\n setTimeout(function () {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n _this.flush().then(function () {\n setTimeout(function () {\n _this.flushing = false;\n if (_this.queue.length) {\n _this.scheduleFlush(0);\n }\n }, 0);\n });\n }, timeout);\n };\n CoreEventQueue.prototype.deliver = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var start, done, err_1, error;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.criticalTasks.done()];\n case 1:\n _a.sent();\n start = Date.now();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n return [4 /*yield*/, this.flushOne(ctx)];\n case 3:\n ctx = _a.sent();\n done = Date.now() - start;\n this.emit('delivery_success', ctx);\n ctx.stats.gauge('delivered', done);\n ctx.log('debug', 'Delivered', ctx.event);\n return [2 /*return*/, ctx];\n case 4:\n err_1 = _a.sent();\n error = err_1;\n ctx.log('error', 'Failed to deliver', error);\n this.emit('delivery_failure', ctx, error);\n ctx.stats.increment('delivery_failed');\n throw err_1;\n case 5: return [2 /*return*/];\n }\n });\n });\n };\n CoreEventQueue.prototype.enqueuRetry = function (err, ctx) {\n var retriable = !(err instanceof ContextCancelation) || err.retry;\n if (!retriable) {\n return false;\n }\n return this.queue.pushWithBackoff(ctx);\n };\n CoreEventQueue.prototype.flush = function () {\n return __awaiter(this, void 0, void 0, function () {\n var ctx, err_2, accepted;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.queue.length === 0) {\n return [2 /*return*/, []];\n }\n ctx = this.queue.pop();\n if (!ctx) {\n return [2 /*return*/, []];\n }\n ctx.attempts = this.queue.getAttempts(ctx);\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 4]);\n return [4 /*yield*/, this.deliver(ctx)];\n case 2:\n ctx = _a.sent();\n this.emit('flush', ctx, true);\n return [3 /*break*/, 4];\n case 3:\n err_2 = _a.sent();\n accepted = this.enqueuRetry(err_2, ctx);\n if (!accepted) {\n ctx.setFailedDelivery({ reason: err_2 });\n this.emit('flush', ctx, false);\n }\n return [2 /*return*/, []];\n case 4: return [2 /*return*/, [ctx]];\n }\n });\n });\n };\n CoreEventQueue.prototype.isReady = function () {\n // return this.plugins.every((p) => p.isLoaded())\n // should we wait for every plugin to load?\n return true;\n };\n CoreEventQueue.prototype.availableExtensions = function (denyList) {\n var available = this.plugins.filter(function (p) {\n var _a, _b, _c;\n // Only filter out destination plugins or the Segment.io plugin\n if (p.type !== 'destination' && p.name !== 'Segment.io') {\n return true;\n }\n var alternativeNameMatch = undefined;\n (_a = p.alternativeNames) === null || _a === void 0 ? void 0 : _a.forEach(function (name) {\n if (denyList[name] !== undefined) {\n alternativeNameMatch = denyList[name];\n }\n });\n // Explicit integration option takes precedence, `All: false` does not apply to Segment.io\n return ((_c = (_b = denyList[p.name]) !== null && _b !== void 0 ? _b : alternativeNameMatch) !== null && _c !== void 0 ? _c : (p.name === 'Segment.io' ? true : denyList.All) !== false);\n });\n var _a = groupBy(available, 'type'), _b = _a.before, before = _b === void 0 ? [] : _b, _c = _a.enrichment, enrichment = _c === void 0 ? [] : _c, _d = _a.destination, destination = _d === void 0 ? [] : _d, _e = _a.after, after = _e === void 0 ? [] : _e;\n return {\n before: before,\n enrichment: enrichment,\n destinations: destination,\n after: after,\n };\n };\n CoreEventQueue.prototype.flushOne = function (ctx) {\n var _a, _b;\n return __awaiter(this, void 0, void 0, function () {\n var _c, before, enrichment, _i, before_1, beforeWare, temp, _d, enrichment_1, enrichmentWare, temp, _e, destinations, after, afterCalls;\n return __generator(this, function (_f) {\n switch (_f.label) {\n case 0:\n if (!this.isReady()) {\n throw new Error('Not ready');\n }\n if (ctx.attempts > 1) {\n this.emit('delivery_retry', ctx);\n }\n _c = this.availableExtensions((_a = ctx.event.integrations) !== null && _a !== void 0 ? _a : {}), before = _c.before, enrichment = _c.enrichment;\n _i = 0, before_1 = before;\n _f.label = 1;\n case 1:\n if (!(_i < before_1.length)) return [3 /*break*/, 4];\n beforeWare = before_1[_i];\n return [4 /*yield*/, ensure(ctx, beforeWare)];\n case 2:\n temp = _f.sent();\n if (temp instanceof CoreContext) {\n ctx = temp;\n }\n this.emit('message_enriched', ctx, beforeWare);\n _f.label = 3;\n case 3:\n _i++;\n return [3 /*break*/, 1];\n case 4:\n _d = 0, enrichment_1 = enrichment;\n _f.label = 5;\n case 5:\n if (!(_d < enrichment_1.length)) return [3 /*break*/, 8];\n enrichmentWare = enrichment_1[_d];\n return [4 /*yield*/, attempt(ctx, enrichmentWare)];\n case 6:\n temp = _f.sent();\n if (temp instanceof CoreContext) {\n ctx = temp;\n }\n this.emit('message_enriched', ctx, enrichmentWare);\n _f.label = 7;\n case 7:\n _d++;\n return [3 /*break*/, 5];\n case 8:\n _e = this.availableExtensions((_b = ctx.event.integrations) !== null && _b !== void 0 ? _b : {}), destinations = _e.destinations, after = _e.after;\n return [4 /*yield*/, new Promise(function (resolve, reject) {\n setTimeout(function () {\n var attempts = destinations.map(function (destination) {\n return attempt(ctx, destination);\n });\n Promise.all(attempts).then(resolve).catch(reject);\n }, 0);\n })];\n case 9:\n _f.sent();\n ctx.stats.increment('message_delivered');\n this.emit('message_delivered', ctx);\n afterCalls = after.map(function (after) { return attempt(ctx, after); });\n return [4 /*yield*/, Promise.all(afterCalls)];\n case 10:\n _f.sent();\n return [2 /*return*/, ctx];\n }\n });\n });\n };\n return CoreEventQueue;\n}(Emitter));\nexport { CoreEventQueue };\n//# sourceMappingURL=event-queue.js.map","import { __awaiter, __extends, __generator } from \"tslib\";\nimport { PersistedPriorityQueue } from '../../lib/priority-queue/persisted';\nimport { CoreEventQueue } from '@segment/analytics-core';\nimport { isOffline } from '../connection';\nvar EventQueue = /** @class */ (function (_super) {\n __extends(EventQueue, _super);\n function EventQueue(nameOrQueue) {\n return _super.call(this, typeof nameOrQueue === 'string'\n ? new PersistedPriorityQueue(4, nameOrQueue)\n : nameOrQueue) || this;\n }\n EventQueue.prototype.flush = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n if (isOffline())\n return [2 /*return*/, []];\n return [2 /*return*/, _super.prototype.flush.call(this)];\n });\n });\n };\n return EventQueue;\n}(CoreEventQueue));\nexport { EventQueue };\n//# sourceMappingURL=event-queue.js.map","export default function bindAll(obj) {\n var proto = obj.constructor.prototype;\n for (var _i = 0, _a = Object.getOwnPropertyNames(proto); _i < _a.length; _i++) {\n var key = _a[_i];\n if (key !== 'constructor') {\n var desc = Object.getOwnPropertyDescriptor(obj.constructor.prototype, key);\n if (!!desc && typeof desc.value === 'function') {\n obj[key] = obj[key].bind(obj);\n }\n }\n }\n return obj;\n}\n//# sourceMappingURL=bind-all.js.map","export var StoreType = {\n Cookie: 'cookie',\n LocalStorage: 'localStorage',\n Memory: 'memory',\n};\n//# sourceMappingURL=types.js.map","// not adding to private method because those method names do not get minified atm, and does not use 'this'\nvar _logStoreKeyError = function (store, action, key, err) {\n console.warn(\"\".concat(store.constructor.name, \": Can't \").concat(action, \" key \\\"\").concat(key, \"\\\" | Err: \").concat(err));\n};\n/**\n * Uses multiple storages in a priority list to get/set values in the order they are specified.\n */\nvar UniversalStorage = /** @class */ (function () {\n function UniversalStorage(stores) {\n this.stores = stores;\n }\n UniversalStorage.prototype.get = function (key) {\n var val = null;\n for (var _i = 0, _a = this.stores; _i < _a.length; _i++) {\n var store = _a[_i];\n try {\n val = store.get(key);\n if (val !== undefined && val !== null) {\n return val;\n }\n }\n catch (e) {\n _logStoreKeyError(store, 'get', key, e);\n }\n }\n return null;\n };\n UniversalStorage.prototype.set = function (key, value) {\n this.stores.forEach(function (store) {\n try {\n store.set(key, value);\n }\n catch (e) {\n _logStoreKeyError(store, 'set', key, e);\n }\n });\n };\n UniversalStorage.prototype.clear = function (key) {\n this.stores.forEach(function (store) {\n try {\n store.remove(key);\n }\n catch (e) {\n _logStoreKeyError(store, 'remove', key, e);\n }\n });\n };\n /*\n This is to support few scenarios where:\n - value exist in one of the stores ( as a result of other stores being cleared from browser ) and we want to resync them\n - read values in AJS 1.0 format ( for customers after 1.0 --> 2.0 migration ) and then re-write them in AJS 2.0 format\n */\n UniversalStorage.prototype.getAndSync = function (key) {\n var val = this.get(key);\n // legacy behavior, getAndSync can change the type of a value from number to string (AJS 1.0 stores numerical values as a number)\n var coercedValue = (typeof val === 'number' ? val.toString() : val);\n this.set(key, coercedValue);\n return coercedValue;\n };\n return UniversalStorage;\n}());\nexport { UniversalStorage };\n//# sourceMappingURL=universalStorage.js.map","/**\n * Data Storage using in memory object\n */\nvar MemoryStorage = /** @class */ (function () {\n function MemoryStorage() {\n this.cache = {};\n }\n MemoryStorage.prototype.get = function (key) {\n var _a;\n return ((_a = this.cache[key]) !== null && _a !== void 0 ? _a : null);\n };\n MemoryStorage.prototype.set = function (key, value) {\n this.cache[key] = value;\n };\n MemoryStorage.prototype.remove = function (key) {\n delete this.cache[key];\n };\n return MemoryStorage;\n}());\nexport { MemoryStorage };\n//# sourceMappingURL=memoryStorage.js.map","import { StoreType } from './types';\nexport function isArrayOfStoreType(s) {\n return (s &&\n s.stores &&\n Array.isArray(s.stores) &&\n s.stores.every(function (e) { return Object.values(StoreType).includes(e); }));\n}\nexport function isStoreTypeWithSettings(s) {\n return typeof s === 'object' && s.name !== undefined;\n}\n//# sourceMappingURL=settings.js.map","import cookie from 'js-cookie';\n/**\n * Levels returns all levels of the given url.\n *\n * @param {string} url\n * @return {Array}\n * @api public\n */\nfunction levels(url) {\n var host = url.hostname;\n var parts = host.split('.');\n var last = parts[parts.length - 1];\n var levels = [];\n // Ip address.\n if (parts.length === 4 && parseInt(last, 10) > 0) {\n return levels;\n }\n // Localhost.\n if (parts.length <= 1) {\n return levels;\n }\n // Create levels.\n for (var i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join('.'));\n }\n return levels;\n}\nfunction parseUrl(url) {\n try {\n return new URL(url);\n }\n catch (_a) {\n return;\n }\n}\nexport function tld(url) {\n var parsedUrl = parseUrl(url);\n if (!parsedUrl)\n return;\n var lvls = levels(parsedUrl);\n // Lookup the real top level one.\n for (var i = 0; i < lvls.length; ++i) {\n var cname = '__tld__';\n var domain = lvls[i];\n var opts = { domain: '.' + domain };\n try {\n // cookie access throw an error if the library is ran inside a sandboxed environment (e.g. sandboxed iframe)\n cookie.set(cname, '1', opts);\n if (cookie.get(cname)) {\n cookie.remove(cname, opts);\n return domain;\n }\n }\n catch (_) {\n return;\n }\n }\n}\n//# sourceMappingURL=tld.js.map","import { __assign } from \"tslib\";\nimport jar from 'js-cookie';\nimport { tld } from '../user/tld';\nvar ONE_YEAR = 365;\n/**\n * Data storage using browser cookies\n */\nvar CookieStorage = /** @class */ (function () {\n function CookieStorage(options) {\n if (options === void 0) { options = CookieStorage.defaults; }\n this.options = __assign(__assign({}, CookieStorage.defaults), options);\n }\n Object.defineProperty(CookieStorage, \"defaults\", {\n get: function () {\n return {\n maxage: ONE_YEAR,\n domain: tld(window.location.href),\n path: '/',\n sameSite: 'Lax',\n };\n },\n enumerable: false,\n configurable: true\n });\n CookieStorage.prototype.opts = function () {\n return {\n sameSite: this.options.sameSite,\n expires: this.options.maxage,\n domain: this.options.domain,\n path: this.options.path,\n secure: this.options.secure,\n };\n };\n CookieStorage.prototype.get = function (key) {\n var _a;\n try {\n var value = jar.get(key);\n if (value === undefined || value === null) {\n return null;\n }\n try {\n return (_a = JSON.parse(value)) !== null && _a !== void 0 ? _a : null;\n }\n catch (e) {\n return (value !== null && value !== void 0 ? value : null);\n }\n }\n catch (e) {\n return null;\n }\n };\n CookieStorage.prototype.set = function (key, value) {\n if (typeof value === 'string') {\n jar.set(key, value, this.opts());\n }\n else if (value === null) {\n jar.remove(key, this.opts());\n }\n else {\n jar.set(key, JSON.stringify(value), this.opts());\n }\n };\n CookieStorage.prototype.remove = function (key) {\n return jar.remove(key, this.opts());\n };\n return CookieStorage;\n}());\nexport { CookieStorage };\n//# sourceMappingURL=cookieStorage.js.map","/**\n * Data storage using browser's localStorage\n */\nvar LocalStorage = /** @class */ (function () {\n function LocalStorage() {\n }\n LocalStorage.prototype.localStorageWarning = function (key, state) {\n console.warn(\"Unable to access \".concat(key, \", localStorage may be \").concat(state));\n };\n LocalStorage.prototype.get = function (key) {\n var _a;\n try {\n var val = localStorage.getItem(key);\n if (val === null) {\n return null;\n }\n try {\n return (_a = JSON.parse(val)) !== null && _a !== void 0 ? _a : null;\n }\n catch (e) {\n return (val !== null && val !== void 0 ? val : null);\n }\n }\n catch (err) {\n this.localStorageWarning(key, 'unavailable');\n return null;\n }\n };\n LocalStorage.prototype.set = function (key, value) {\n try {\n localStorage.setItem(key, JSON.stringify(value));\n }\n catch (_a) {\n this.localStorageWarning(key, 'full');\n }\n };\n LocalStorage.prototype.remove = function (key) {\n try {\n return localStorage.removeItem(key);\n }\n catch (err) {\n this.localStorageWarning(key, 'unavailable');\n }\n };\n return LocalStorage;\n}());\nexport { LocalStorage };\n//# sourceMappingURL=localStorage.js.map","import { CookieStorage } from './cookieStorage';\nimport { LocalStorage } from './localStorage';\nimport { MemoryStorage } from './memoryStorage';\nimport { isStoreTypeWithSettings } from './settings';\nimport { StoreType } from './types';\nexport * from './types';\nexport * from './localStorage';\nexport * from './cookieStorage';\nexport * from './memoryStorage';\nexport * from './universalStorage';\nexport * from './settings';\n/**\n * Creates multiple storage systems from an array of StoreType and options\n * @param args StoreType and options\n * @returns Storage array\n */\nexport function initializeStorages(args) {\n var storages = args.map(function (s) {\n var type;\n var settings;\n if (isStoreTypeWithSettings(s)) {\n type = s.name;\n settings = s.settings;\n }\n else {\n type = s;\n }\n switch (type) {\n case StoreType.Cookie:\n return new CookieStorage(settings);\n case StoreType.LocalStorage:\n return new LocalStorage();\n case StoreType.Memory:\n return new MemoryStorage();\n default:\n throw new Error(\"Unknown Store Type: \".concat(s));\n }\n });\n return storages;\n}\n/**\n * Injects the CookieOptions into a the arguments for initializeStorage\n * @param storeTypes list of storeType\n * @param cookieOptions cookie Options\n * @returns arguments for initializeStorage\n */\nexport function applyCookieOptions(storeTypes, cookieOptions) {\n return storeTypes.map(function (s) {\n if (cookieOptions && s === StoreType.Cookie) {\n return {\n name: s,\n settings: cookieOptions,\n };\n }\n return s;\n });\n}\n//# sourceMappingURL=index.js.map","import { __assign, __extends } from \"tslib\";\nimport { v4 as uuid } from '@lukeed/uuid';\nimport autoBind from '../../lib/bind-all';\nimport { UniversalStorage, MemoryStorage, StoreType, applyCookieOptions, initializeStorages, isArrayOfStoreType, } from '../storage';\nvar defaults = {\n persist: true,\n cookie: {\n key: 'ajs_user_id',\n oldKey: 'ajs_user',\n },\n localStorage: {\n key: 'ajs_user_traits',\n },\n};\nvar User = /** @class */ (function () {\n function User(options, cookieOptions) {\n if (options === void 0) { options = defaults; }\n var _this = this;\n var _a, _b, _c, _d;\n this.options = {};\n this.id = function (id) {\n if (_this.options.disable) {\n return null;\n }\n var prevId = _this.identityStore.getAndSync(_this.idKey);\n if (id !== undefined) {\n _this.identityStore.set(_this.idKey, id);\n var changingIdentity = id !== prevId && prevId !== null && id !== null;\n if (changingIdentity) {\n _this.anonymousId(null);\n }\n }\n var retId = _this.identityStore.getAndSync(_this.idKey);\n if (retId)\n return retId;\n var retLeg = _this.legacyUserStore.get(defaults.cookie.oldKey);\n return retLeg ? (typeof retLeg === 'object' ? retLeg.id : retLeg) : null;\n };\n this.anonymousId = function (id) {\n var _a, _b;\n if (_this.options.disable) {\n return null;\n }\n if (id === undefined) {\n var val = (_a = _this.identityStore.getAndSync(_this.anonKey)) !== null && _a !== void 0 ? _a : (_b = _this.legacySIO()) === null || _b === void 0 ? void 0 : _b[0];\n if (val) {\n return val;\n }\n }\n if (id === null) {\n _this.identityStore.set(_this.anonKey, null);\n return _this.identityStore.getAndSync(_this.anonKey);\n }\n _this.identityStore.set(_this.anonKey, id !== null && id !== void 0 ? id : uuid());\n return _this.identityStore.getAndSync(_this.anonKey);\n };\n this.traits = function (traits) {\n var _a;\n if (_this.options.disable) {\n return;\n }\n if (traits === null) {\n traits = {};\n }\n if (traits) {\n _this.traitsStore.set(_this.traitsKey, traits !== null && traits !== void 0 ? traits : {});\n }\n return (_a = _this.traitsStore.get(_this.traitsKey)) !== null && _a !== void 0 ? _a : {};\n };\n this.options = __assign(__assign({}, defaults), options);\n this.cookieOptions = cookieOptions;\n this.idKey = (_b = (_a = options.cookie) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : defaults.cookie.key;\n this.traitsKey = (_d = (_c = options.localStorage) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : defaults.localStorage.key;\n this.anonKey = 'ajs_anonymous_id';\n this.identityStore = this.createStorage(this.options, cookieOptions);\n // using only cookies for legacy user store\n this.legacyUserStore = this.createStorage(this.options, cookieOptions, function (s) { return s === StoreType.Cookie; });\n // using only localStorage / memory for traits store\n this.traitsStore = this.createStorage(this.options, cookieOptions, function (s) { return s !== StoreType.Cookie; });\n var legacyUser = this.legacyUserStore.get(defaults.cookie.oldKey);\n if (legacyUser && typeof legacyUser === 'object') {\n legacyUser.id && this.id(legacyUser.id);\n legacyUser.traits && this.traits(legacyUser.traits);\n }\n autoBind(this);\n }\n User.prototype.legacySIO = function () {\n var val = this.legacyUserStore.get('_sio');\n if (!val) {\n return null;\n }\n var _a = val.split('----'), anon = _a[0], user = _a[1];\n return [anon, user];\n };\n User.prototype.identify = function (id, traits) {\n if (this.options.disable) {\n return;\n }\n traits = traits !== null && traits !== void 0 ? traits : {};\n var currentId = this.id();\n if (currentId === null || currentId === id) {\n traits = __assign(__assign({}, this.traits()), traits);\n }\n if (id) {\n this.id(id);\n }\n this.traits(traits);\n };\n User.prototype.logout = function () {\n this.anonymousId(null);\n this.id(null);\n this.traits({});\n };\n User.prototype.reset = function () {\n this.logout();\n this.identityStore.clear(this.idKey);\n this.identityStore.clear(this.anonKey);\n this.traitsStore.clear(this.traitsKey);\n };\n User.prototype.load = function () {\n return new User(this.options, this.cookieOptions);\n };\n User.prototype.save = function () {\n return true;\n };\n /**\n * Creates the right storage system applying all the user options, cookie options and particular filters\n * @param options UserOptions\n * @param cookieOpts CookieOptions\n * @param filterStores filter function to apply to any StoreTypes (skipped if options specify using a custom storage)\n * @returns a Storage object\n */\n User.prototype.createStorage = function (options, cookieOpts, filterStores) {\n var stores = [\n StoreType.LocalStorage,\n StoreType.Cookie,\n StoreType.Memory,\n ];\n // If disabled we won't have any storage functionality\n if (options.disable) {\n return new UniversalStorage([]);\n }\n // If persistance is disabled we will always fallback to Memory Storage\n if (!options.persist) {\n return new UniversalStorage([new MemoryStorage()]);\n }\n if (options.storage !== undefined && options.storage !== null) {\n if (isArrayOfStoreType(options.storage)) {\n // If the user only specified order of stores we will still apply filters and transformations e.g. not using localStorage if localStorageFallbackDisabled\n stores = options.storage.stores;\n }\n }\n // Disable LocalStorage\n if (options.localStorageFallbackDisabled) {\n stores = stores.filter(function (s) { return s !== StoreType.LocalStorage; });\n }\n // Apply Additional filters\n if (filterStores) {\n stores = stores.filter(filterStores);\n }\n return new UniversalStorage(initializeStorages(applyCookieOptions(stores, cookieOpts)));\n };\n User.defaults = defaults;\n return User;\n}());\nexport { User };\nvar groupDefaults = {\n persist: true,\n cookie: {\n key: 'ajs_group_id',\n },\n localStorage: {\n key: 'ajs_group_properties',\n },\n};\nvar Group = /** @class */ (function (_super) {\n __extends(Group, _super);\n function Group(options, cookie) {\n if (options === void 0) { options = groupDefaults; }\n var _this = _super.call(this, __assign(__assign({}, groupDefaults), options), cookie) || this;\n _this.anonymousId = function (_id) {\n return undefined;\n };\n autoBind(_this);\n return _this;\n }\n return Group;\n}(User));\nexport { Group };\n//# sourceMappingURL=index.js.map","/**\n * Check if thenable\n * (instanceof Promise doesn't respect realms)\n */\nexport var isThenable = function (value) {\n return typeof value === 'object' &&\n value !== null &&\n 'then' in value &&\n typeof value.then === 'function';\n};\n//# sourceMappingURL=is-thenable.js.map","import { __awaiter, __generator, __spreadArray } from \"tslib\";\nimport { isThenable } from '../../lib/is-thenable';\nimport { version } from '../../generated/version';\nimport { getGlobalAnalytics } from '../../lib/global-analytics-helper';\nimport { isBufferedPageContext, getDefaultBufferedPageContext, createPageContext, } from '../page';\nvar flushSyncAnalyticsCalls = function (name, analytics, buffer) {\n buffer.getCalls(name).forEach(function (c) {\n // While the underlying methods are synchronous, the callAnalyticsMethod returns a promise,\n // which normalizes success and error states between async and non-async methods, with no perf penalty.\n callAnalyticsMethod(analytics, c).catch(console.error);\n });\n};\nexport var flushAddSourceMiddleware = function (analytics, buffer) { return __awaiter(void 0, void 0, void 0, function () {\n var _i, _a, c;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _i = 0, _a = buffer.getCalls('addSourceMiddleware');\n _b.label = 1;\n case 1:\n if (!(_i < _a.length)) return [3 /*break*/, 4];\n c = _a[_i];\n return [4 /*yield*/, callAnalyticsMethod(analytics, c).catch(console.error)];\n case 2:\n _b.sent();\n _b.label = 3;\n case 3:\n _i++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/];\n }\n });\n}); };\nexport var flushOn = flushSyncAnalyticsCalls.bind(this, 'on');\nexport var flushSetAnonymousID = flushSyncAnalyticsCalls.bind(this, 'setAnonymousId');\nexport var flushAnalyticsCallsInNewTask = function (analytics, buffer) {\n buffer.toArray().forEach(function (m) {\n setTimeout(function () {\n callAnalyticsMethod(analytics, m).catch(console.error);\n }, 0);\n });\n};\nexport var popPageContext = function (args) {\n if (hasBufferedPageContextAsLastArg(args)) {\n var ctx = args.pop();\n return createPageContext(ctx);\n }\n};\nexport var hasBufferedPageContextAsLastArg = function (args) {\n var lastArg = args[args.length - 1];\n return isBufferedPageContext(lastArg);\n};\n/**\n * Represents a buffered method call that occurred before initialization.\n */\nvar PreInitMethodCall = /** @class */ (function () {\n function PreInitMethodCall(method, args, resolve, reject) {\n if (resolve === void 0) { resolve = function () { }; }\n if (reject === void 0) { reject = console.error; }\n this.method = method;\n this.resolve = resolve;\n this.reject = reject;\n this.called = false;\n this.args = args;\n }\n return PreInitMethodCall;\n}());\nexport { PreInitMethodCall };\n/**\n * Represents any and all the buffered method calls that occurred before initialization.\n */\nvar PreInitMethodCallBuffer = /** @class */ (function () {\n function PreInitMethodCallBuffer() {\n var calls = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n calls[_i] = arguments[_i];\n }\n this._callMap = {};\n this.push.apply(this, calls);\n }\n Object.defineProperty(PreInitMethodCallBuffer.prototype, \"calls\", {\n /**\n * Pull any buffered method calls from the window object, and use them to hydrate the instance buffer.\n */\n get: function () {\n this._pushSnippetWindowBuffer();\n return this._callMap;\n },\n set: function (calls) {\n this._callMap = calls;\n },\n enumerable: false,\n configurable: true\n });\n PreInitMethodCallBuffer.prototype.getCalls = function (methodName) {\n var _a;\n return ((_a = this.calls[methodName]) !== null && _a !== void 0 ? _a : []);\n };\n PreInitMethodCallBuffer.prototype.push = function () {\n var _this = this;\n var calls = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n calls[_i] = arguments[_i];\n }\n calls.forEach(function (call) {\n var eventsExpectingPageContext = [\n 'track',\n 'screen',\n 'alias',\n 'group',\n 'page',\n 'identify',\n ];\n if (eventsExpectingPageContext.includes(call.method) &&\n !hasBufferedPageContextAsLastArg(call.args)) {\n call.args = __spreadArray(__spreadArray([], call.args, true), [getDefaultBufferedPageContext()], false);\n }\n if (_this.calls[call.method]) {\n _this.calls[call.method].push(call);\n }\n else {\n _this.calls[call.method] = [call];\n }\n });\n };\n PreInitMethodCallBuffer.prototype.clear = function () {\n // clear calls in the global snippet buffered array.\n this._pushSnippetWindowBuffer();\n // clear calls in this instance\n this.calls = {};\n };\n PreInitMethodCallBuffer.prototype.toArray = function () {\n var _a;\n return (_a = []).concat.apply(_a, Object.values(this.calls));\n };\n /**\n * Fetch the buffered method calls from the window object,\n * normalize them, and use them to hydrate the buffer.\n * This removes existing buffered calls from the window object.\n */\n PreInitMethodCallBuffer.prototype._pushSnippetWindowBuffer = function () {\n var wa = getGlobalAnalytics();\n if (!Array.isArray(wa))\n return undefined;\n var buffered = wa.splice(0, wa.length);\n var calls = buffered.map(function (_a) {\n var methodName = _a[0], args = _a.slice(1);\n return new PreInitMethodCall(methodName, args);\n });\n this.push.apply(this, calls);\n };\n return PreInitMethodCallBuffer;\n}());\nexport { PreInitMethodCallBuffer };\n/**\n * Call method and mark as \"called\"\n * This function should never throw an error\n */\nexport function callAnalyticsMethod(analytics, call) {\n return __awaiter(this, void 0, void 0, function () {\n var result, err_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3, , 4]);\n if (call.called) {\n return [2 /*return*/, undefined];\n }\n call.called = true;\n result = analytics[call.method].apply(analytics, call.args);\n if (!isThenable(result)) return [3 /*break*/, 2];\n // do not defer for non-async methods\n return [4 /*yield*/, result];\n case 1:\n // do not defer for non-async methods\n _a.sent();\n _a.label = 2;\n case 2:\n call.resolve(result);\n return [3 /*break*/, 4];\n case 3:\n err_1 = _a.sent();\n call.reject(err_1);\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/];\n }\n });\n });\n}\nvar AnalyticsBuffered = /** @class */ (function () {\n function AnalyticsBuffered(loader) {\n var _this = this;\n this.trackSubmit = this._createMethod('trackSubmit');\n this.trackClick = this._createMethod('trackClick');\n this.trackLink = this._createMethod('trackLink');\n this.pageView = this._createMethod('pageview');\n this.identify = this._createMethod('identify');\n this.reset = this._createMethod('reset');\n this.group = this._createMethod('group');\n this.track = this._createMethod('track');\n this.ready = this._createMethod('ready');\n this.alias = this._createMethod('alias');\n this.debug = this._createChainableMethod('debug');\n this.page = this._createMethod('page');\n this.once = this._createChainableMethod('once');\n this.off = this._createChainableMethod('off');\n this.on = this._createChainableMethod('on');\n this.addSourceMiddleware = this._createMethod('addSourceMiddleware');\n this.setAnonymousId = this._createMethod('setAnonymousId');\n this.addDestinationMiddleware = this._createMethod('addDestinationMiddleware');\n this.screen = this._createMethod('screen');\n this.register = this._createMethod('register');\n this.deregister = this._createMethod('deregister');\n this.user = this._createMethod('user');\n this.VERSION = version;\n this._preInitBuffer = new PreInitMethodCallBuffer();\n this._promise = loader(this._preInitBuffer);\n this._promise\n .then(function (_a) {\n var ajs = _a[0], ctx = _a[1];\n _this.instance = ajs;\n _this.ctx = ctx;\n })\n .catch(function () {\n // intentionally do nothing...\n // this result of this promise will be caught by the 'catch' block on this class.\n });\n }\n AnalyticsBuffered.prototype.then = function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = this._promise).then.apply(_a, args);\n };\n AnalyticsBuffered.prototype.catch = function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = this._promise).catch.apply(_a, args);\n };\n AnalyticsBuffered.prototype.finally = function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_a = this._promise).finally.apply(_a, args);\n };\n AnalyticsBuffered.prototype._createMethod = function (methodName) {\n var _this = this;\n return function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (_this.instance) {\n var result = (_a = _this.instance)[methodName].apply(_a, args);\n return Promise.resolve(result);\n }\n return new Promise(function (resolve, reject) {\n _this._preInitBuffer.push(new PreInitMethodCall(methodName, args, resolve, reject));\n });\n };\n };\n /**\n * These are for methods that where determining when the method gets \"flushed\" is not important.\n * These methods will resolve when analytics is fully initialized, and return type (other than Analytics)will not be available.\n */\n AnalyticsBuffered.prototype._createChainableMethod = function (methodName) {\n var _this = this;\n return function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (_this.instance) {\n void (_a = _this.instance)[methodName].apply(_a, args);\n return _this;\n }\n else {\n _this._preInitBuffer.push(new PreInitMethodCall(methodName, args));\n }\n return _this;\n };\n };\n return AnalyticsBuffered;\n}());\nexport { AnalyticsBuffered };\n//# sourceMappingURL=index.js.map","import { __assign, __awaiter, __extends, __generator, __spreadArray } from \"tslib\";\nimport { resolveAliasArguments, resolveArguments, resolvePageArguments, resolveUserArguments, } from '../arguments-resolver';\nimport { isOffline } from '../connection';\nimport { Context } from '../context';\nimport { dispatch, Emitter } from '@segment/analytics-core';\nimport { EventFactory, } from '../events';\nimport { EventQueue } from '../queue/event-queue';\nimport { Group, User } from '../user';\nimport autoBind from '../../lib/bind-all';\nimport { PersistedPriorityQueue } from '../../lib/priority-queue/persisted';\nimport { version } from '../../generated/version';\nimport { PriorityQueue } from '../../lib/priority-queue';\nimport { getGlobal } from '../../lib/get-global';\nimport { MemoryStorage, UniversalStorage, StoreType, applyCookieOptions, initializeStorages, isArrayOfStoreType, } from '../storage';\nimport { setGlobalAnalytics } from '../../lib/global-analytics-helper';\nimport { popPageContext } from '../buffer';\nvar deprecationWarning = 'This is being deprecated and will be not be available in future releases of Analytics JS';\n// reference any pre-existing \"analytics\" object so a user can restore the reference\nvar global = getGlobal();\nvar _analytics = global === null || global === void 0 ? void 0 : global.analytics;\nfunction createDefaultQueue(name, retryQueue, disablePersistance) {\n if (retryQueue === void 0) { retryQueue = false; }\n if (disablePersistance === void 0) { disablePersistance = false; }\n var maxAttempts = retryQueue ? 4 : 1;\n var priorityQueue = disablePersistance\n ? new PriorityQueue(maxAttempts, [])\n : new PersistedPriorityQueue(maxAttempts, name);\n return new EventQueue(priorityQueue);\n}\n/* analytics-classic stubs */\nfunction _stub() {\n console.warn(deprecationWarning);\n}\nvar Analytics = /** @class */ (function (_super) {\n __extends(Analytics, _super);\n function Analytics(settings, options, queue, user, group) {\n var _this = this;\n var _a, _b, _c;\n _this = _super.call(this) || this;\n _this._debug = false;\n _this.initialized = false;\n _this.user = function () {\n return _this._user;\n };\n _this.init = _this.initialize.bind(_this);\n _this.log = _stub;\n _this.addIntegrationMiddleware = _stub;\n _this.listeners = _stub;\n _this.addEventListener = _stub;\n _this.removeAllListeners = _stub;\n _this.removeListener = _stub;\n _this.removeEventListener = _stub;\n _this.hasListeners = _stub;\n _this.add = _stub;\n _this.addIntegration = _stub;\n var cookieOptions = options === null || options === void 0 ? void 0 : options.cookie;\n var disablePersistance = (_a = options === null || options === void 0 ? void 0 : options.disableClientPersistence) !== null && _a !== void 0 ? _a : false;\n _this.settings = settings;\n _this.settings.timeout = (_b = _this.settings.timeout) !== null && _b !== void 0 ? _b : 300;\n _this.queue =\n queue !== null && queue !== void 0 ? queue : createDefaultQueue(\"\".concat(settings.writeKey, \":event-queue\"), options === null || options === void 0 ? void 0 : options.retryQueue, disablePersistance);\n var storageSetting = options === null || options === void 0 ? void 0 : options.storage;\n _this._universalStorage = _this.createStore(disablePersistance, storageSetting, cookieOptions);\n _this._user =\n user !== null && user !== void 0 ? user : new User(__assign({ persist: !disablePersistance, storage: options === null || options === void 0 ? void 0 : options.storage }, options === null || options === void 0 ? void 0 : options.user), cookieOptions).load();\n _this._group =\n group !== null && group !== void 0 ? group : new Group(__assign({ persist: !disablePersistance, storage: options === null || options === void 0 ? void 0 : options.storage }, options === null || options === void 0 ? void 0 : options.group), cookieOptions).load();\n _this.eventFactory = new EventFactory(_this._user);\n _this.integrations = (_c = options === null || options === void 0 ? void 0 : options.integrations) !== null && _c !== void 0 ? _c : {};\n _this.options = options !== null && options !== void 0 ? options : {};\n autoBind(_this);\n return _this;\n }\n /**\n * Creates the storage system based on the settings received\n * @returns Storage\n */\n Analytics.prototype.createStore = function (disablePersistance, storageSetting, cookieOptions) {\n // DisablePersistance option overrides all, no storage will be used outside of memory even if specified\n if (disablePersistance) {\n return new UniversalStorage([new MemoryStorage()]);\n }\n else {\n if (storageSetting) {\n if (isArrayOfStoreType(storageSetting)) {\n // We will create the store with the priority for customer settings\n return new UniversalStorage(initializeStorages(applyCookieOptions(storageSetting.stores, cookieOptions)));\n }\n }\n }\n // We default to our multi storage with priority\n return new UniversalStorage(initializeStorages([\n StoreType.LocalStorage,\n {\n name: StoreType.Cookie,\n settings: cookieOptions,\n },\n StoreType.Memory,\n ]));\n };\n Object.defineProperty(Analytics.prototype, \"storage\", {\n get: function () {\n return this._universalStorage;\n },\n enumerable: false,\n configurable: true\n });\n Analytics.prototype.track = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var pageCtx, _a, name, data, opts, cb, segmentEvent;\n var _this = this;\n return __generator(this, function (_b) {\n pageCtx = popPageContext(args);\n _a = resolveArguments.apply(void 0, args), name = _a[0], data = _a[1], opts = _a[2], cb = _a[3];\n segmentEvent = this.eventFactory.track(name, data, opts, this.integrations, pageCtx);\n return [2 /*return*/, this._dispatch(segmentEvent, cb).then(function (ctx) {\n _this.emit('track', name, ctx.event.properties, ctx.event.options);\n return ctx;\n })];\n });\n });\n };\n Analytics.prototype.page = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var pageCtx, _a, category, page, properties, options, callback, segmentEvent;\n var _this = this;\n return __generator(this, function (_b) {\n pageCtx = popPageContext(args);\n _a = resolvePageArguments.apply(void 0, args), category = _a[0], page = _a[1], properties = _a[2], options = _a[3], callback = _a[4];\n segmentEvent = this.eventFactory.page(category, page, properties, options, this.integrations, pageCtx);\n return [2 /*return*/, this._dispatch(segmentEvent, callback).then(function (ctx) {\n _this.emit('page', category, page, ctx.event.properties, ctx.event.options);\n return ctx;\n })];\n });\n });\n };\n Analytics.prototype.identify = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var pageCtx, _a, id, _traits, options, callback, segmentEvent;\n var _this = this;\n return __generator(this, function (_b) {\n pageCtx = popPageContext(args);\n _a = resolveUserArguments(this._user).apply(void 0, args), id = _a[0], _traits = _a[1], options = _a[2], callback = _a[3];\n this._user.identify(id, _traits);\n segmentEvent = this.eventFactory.identify(this._user.id(), this._user.traits(), options, this.integrations, pageCtx);\n return [2 /*return*/, this._dispatch(segmentEvent, callback).then(function (ctx) {\n _this.emit('identify', ctx.event.userId, ctx.event.traits, ctx.event.options);\n return ctx;\n })];\n });\n });\n };\n Analytics.prototype.group = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var pageCtx = popPageContext(args);\n if (args.length === 0) {\n return this._group;\n }\n var _a = resolveUserArguments(this._group).apply(void 0, args), id = _a[0], _traits = _a[1], options = _a[2], callback = _a[3];\n this._group.identify(id, _traits);\n var groupId = this._group.id();\n var groupTraits = this._group.traits();\n var segmentEvent = this.eventFactory.group(groupId, groupTraits, options, this.integrations, pageCtx);\n return this._dispatch(segmentEvent, callback).then(function (ctx) {\n _this.emit('group', ctx.event.groupId, ctx.event.traits, ctx.event.options);\n return ctx;\n });\n };\n Analytics.prototype.alias = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var pageCtx, _a, to, from, options, callback, segmentEvent;\n var _this = this;\n return __generator(this, function (_b) {\n pageCtx = popPageContext(args);\n _a = resolveAliasArguments.apply(void 0, args), to = _a[0], from = _a[1], options = _a[2], callback = _a[3];\n segmentEvent = this.eventFactory.alias(to, from, options, this.integrations, pageCtx);\n return [2 /*return*/, this._dispatch(segmentEvent, callback).then(function (ctx) {\n _this.emit('alias', to, from, ctx.event.options);\n return ctx;\n })];\n });\n });\n };\n Analytics.prototype.screen = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var pageCtx, _a, category, page, properties, options, callback, segmentEvent;\n var _this = this;\n return __generator(this, function (_b) {\n pageCtx = popPageContext(args);\n _a = resolvePageArguments.apply(void 0, args), category = _a[0], page = _a[1], properties = _a[2], options = _a[3], callback = _a[4];\n segmentEvent = this.eventFactory.screen(category, page, properties, options, this.integrations, pageCtx);\n return [2 /*return*/, this._dispatch(segmentEvent, callback).then(function (ctx) {\n _this.emit('screen', category, page, ctx.event.properties, ctx.event.options);\n return ctx;\n })];\n });\n });\n };\n Analytics.prototype.trackClick = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var autotrack;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, import(\n /* webpackChunkName: \"auto-track\" */ '../auto-track')];\n case 1:\n autotrack = _b.sent();\n return [2 /*return*/, (_a = autotrack.link).call.apply(_a, __spreadArray([this], args, false))];\n }\n });\n });\n };\n Analytics.prototype.trackLink = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var autotrack;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, import(\n /* webpackChunkName: \"auto-track\" */ '../auto-track')];\n case 1:\n autotrack = _b.sent();\n return [2 /*return*/, (_a = autotrack.link).call.apply(_a, __spreadArray([this], args, false))];\n }\n });\n });\n };\n Analytics.prototype.trackSubmit = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var autotrack;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, import(\n /* webpackChunkName: \"auto-track\" */ '../auto-track')];\n case 1:\n autotrack = _b.sent();\n return [2 /*return*/, (_a = autotrack.form).call.apply(_a, __spreadArray([this], args, false))];\n }\n });\n });\n };\n Analytics.prototype.trackForm = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var autotrack;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, import(\n /* webpackChunkName: \"auto-track\" */ '../auto-track')];\n case 1:\n autotrack = _b.sent();\n return [2 /*return*/, (_a = autotrack.form).call.apply(_a, __spreadArray([this], args, false))];\n }\n });\n });\n };\n Analytics.prototype.register = function () {\n var plugins = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n plugins[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var ctx, registrations;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ctx = Context.system();\n registrations = plugins.map(function (xt) {\n return _this.queue.register(ctx, xt, _this);\n });\n return [4 /*yield*/, Promise.all(registrations)];\n case 1:\n _a.sent();\n return [2 /*return*/, ctx];\n }\n });\n });\n };\n Analytics.prototype.deregister = function () {\n var plugins = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n plugins[_i] = arguments[_i];\n }\n return __awaiter(this, void 0, void 0, function () {\n var ctx, deregistrations;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ctx = Context.system();\n deregistrations = plugins.map(function (pl) {\n var plugin = _this.queue.plugins.find(function (p) { return p.name === pl; });\n if (plugin) {\n return _this.queue.deregister(ctx, plugin, _this);\n }\n else {\n ctx.log('warn', \"plugin \".concat(pl, \" not found\"));\n }\n });\n return [4 /*yield*/, Promise.all(deregistrations)];\n case 1:\n _a.sent();\n return [2 /*return*/, ctx];\n }\n });\n });\n };\n Analytics.prototype.debug = function (toggle) {\n // Make sure legacy ajs debug gets turned off if it was enabled before upgrading.\n if (toggle === false && localStorage.getItem('debug')) {\n localStorage.removeItem('debug');\n }\n this._debug = toggle;\n return this;\n };\n Analytics.prototype.reset = function () {\n this._user.reset();\n this._group.reset();\n this.emit('reset');\n };\n Analytics.prototype.timeout = function (timeout) {\n this.settings.timeout = timeout;\n };\n Analytics.prototype._dispatch = function (event, callback) {\n return __awaiter(this, void 0, void 0, function () {\n var ctx;\n return __generator(this, function (_a) {\n ctx = new Context(event);\n if (isOffline() && !this.options.retryQueue) {\n return [2 /*return*/, ctx];\n }\n return [2 /*return*/, dispatch(ctx, this.queue, this, {\n callback: callback,\n debug: this._debug,\n timeout: this.settings.timeout,\n })];\n });\n });\n };\n Analytics.prototype.addSourceMiddleware = function (fn) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, this.queue.criticalTasks.run(function () { return __awaiter(_this, void 0, void 0, function () {\n var sourceMiddlewarePlugin, integrations, plugin;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, import(\n /* webpackChunkName: \"middleware\" */ '../../plugins/middleware')];\n case 1:\n sourceMiddlewarePlugin = (_a.sent()).sourceMiddlewarePlugin;\n integrations = {};\n this.queue.plugins.forEach(function (plugin) {\n if (plugin.type === 'destination') {\n return (integrations[plugin.name] = true);\n }\n });\n plugin = sourceMiddlewarePlugin(fn, integrations);\n return [4 /*yield*/, this.register(plugin)];\n case 2:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })];\n case 1:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n /* TODO: This does not have to return a promise? */\n Analytics.prototype.addDestinationMiddleware = function (integrationName) {\n var middlewares = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n middlewares[_i - 1] = arguments[_i];\n }\n var legacyDestinations = this.queue.plugins.filter(function (xt) { return xt.name.toLowerCase() === integrationName.toLowerCase(); });\n legacyDestinations.forEach(function (destination) {\n destination.addMiddleware.apply(destination, middlewares);\n });\n return Promise.resolve(this);\n };\n Analytics.prototype.setAnonymousId = function (id) {\n return this._user.anonymousId(id);\n };\n Analytics.prototype.queryString = function (query) {\n return __awaiter(this, void 0, void 0, function () {\n var queryString;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.options.useQueryString === false) {\n return [2 /*return*/, []];\n }\n return [4 /*yield*/, import(\n /* webpackChunkName: \"queryString\" */ '../query-string')];\n case 1:\n queryString = (_a.sent()).queryString;\n return [2 /*return*/, queryString(this, query)];\n }\n });\n });\n };\n /**\n * @deprecated This function does not register a destination plugin.\n *\n * Instantiates a legacy Analytics.js destination.\n *\n * This function does not register the destination as an Analytics.JS plugin,\n * all the it does it to invoke the factory function back.\n */\n Analytics.prototype.use = function (legacyPluginFactory) {\n legacyPluginFactory(this);\n return this;\n };\n Analytics.prototype.ready = function (callback) {\n if (callback === void 0) { callback = function (res) { return res; }; }\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2 /*return*/, Promise.all(this.queue.plugins.map(function (i) { return (i.ready ? i.ready() : Promise.resolve()); })).then(function (res) {\n callback(res);\n return res;\n })];\n });\n });\n };\n // analytics-classic api\n Analytics.prototype.noConflict = function () {\n console.warn(deprecationWarning);\n setGlobalAnalytics(_analytics !== null && _analytics !== void 0 ? _analytics : this);\n return this;\n };\n Analytics.prototype.normalize = function (msg) {\n console.warn(deprecationWarning);\n return this.eventFactory.normalize(msg);\n };\n Object.defineProperty(Analytics.prototype, \"failedInitializations\", {\n get: function () {\n console.warn(deprecationWarning);\n return this.queue.failedInitializations;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Analytics.prototype, \"VERSION\", {\n get: function () {\n return version;\n },\n enumerable: false,\n configurable: true\n });\n /* @deprecated - noop */\n Analytics.prototype.initialize = function (_settings, _options) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n console.warn(deprecationWarning);\n return [2 /*return*/, Promise.resolve(this)];\n });\n });\n };\n Analytics.prototype.pageview = function (url) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n console.warn(deprecationWarning);\n return [4 /*yield*/, this.page({ path: url })];\n case 1:\n _a.sent();\n return [2 /*return*/, this];\n }\n });\n });\n };\n Object.defineProperty(Analytics.prototype, \"plugins\", {\n get: function () {\n var _a;\n console.warn(deprecationWarning);\n // @ts-expect-error\n return (_a = this._plugins) !== null && _a !== void 0 ? _a : {};\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Analytics.prototype, \"Integrations\", {\n get: function () {\n console.warn(deprecationWarning);\n var integrations = this.queue.plugins\n .filter(function (plugin) { return plugin.type === 'destination'; })\n .reduce(function (acc, plugin) {\n var name = \"\".concat(plugin.name\n .toLowerCase()\n .replace('.', '')\n .split(' ')\n .join('-'), \"Integration\");\n // @ts-expect-error\n var integration = window[name];\n if (!integration) {\n return acc;\n }\n var nested = integration.Integration; // hack - Google Analytics function resides in the \"Integration\" field\n if (nested) {\n acc[plugin.name] = nested;\n return acc;\n }\n acc[plugin.name] = integration;\n return acc;\n }, {});\n return integrations;\n },\n enumerable: false,\n configurable: true\n });\n // snippet function\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Analytics.prototype.push = function (args) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var an = this;\n var method = args.shift();\n if (method) {\n if (!an[method])\n return;\n }\n an[method].apply(this, args);\n };\n return Analytics;\n}(Emitter));\nexport { Analytics };\n//# sourceMappingURL=index.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport jar from 'js-cookie';\nimport { version } from '../../generated/version';\nimport { getVersionType } from '../../lib/version-type';\nimport { tld } from '../../core/user/tld';\nimport { gracefulDecodeURIComponent } from '../../core/query-string/gracefulDecodeURIComponent';\nimport { CookieStorage, UniversalStorage } from '../../core/storage';\nimport { clientHints } from '../../lib/client-hints';\nvar cookieOptions;\nfunction getCookieOptions() {\n if (cookieOptions) {\n return cookieOptions;\n }\n var domain = tld(window.location.href);\n cookieOptions = {\n expires: 31536000000,\n secure: false,\n path: '/',\n };\n if (domain) {\n cookieOptions.domain = domain;\n }\n return cookieOptions;\n}\nfunction ads(query) {\n var queryIds = {\n btid: 'dataxu',\n urid: 'millennial-media',\n };\n if (query.startsWith('?')) {\n query = query.substring(1);\n }\n query = query.replace(/\\?/g, '&');\n var parts = query.split('&');\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n var _a = part.split('='), k = _a[0], v = _a[1];\n if (queryIds[k]) {\n return {\n id: v,\n type: queryIds[k],\n };\n }\n }\n}\nexport function utm(query) {\n if (query.startsWith('?')) {\n query = query.substring(1);\n }\n query = query.replace(/\\?/g, '&');\n return query.split('&').reduce(function (acc, str) {\n var _a = str.split('='), k = _a[0], _b = _a[1], v = _b === void 0 ? '' : _b;\n if (k.includes('utm_') && k.length > 4) {\n var utmParam = k.slice(4);\n if (utmParam === 'campaign') {\n utmParam = 'name';\n }\n acc[utmParam] = gracefulDecodeURIComponent(v);\n }\n return acc;\n }, {});\n}\nexport function ampId() {\n var ampId = jar.get('_ga');\n if (ampId && ampId.startsWith('amp')) {\n return ampId;\n }\n}\nfunction referrerId(query, ctx, disablePersistance) {\n var _a;\n var storage = new UniversalStorage(disablePersistance ? [] : [new CookieStorage(getCookieOptions())]);\n var stored = storage.get('s:context.referrer');\n var ad = (_a = ads(query)) !== null && _a !== void 0 ? _a : stored;\n if (!ad) {\n return;\n }\n if (ctx) {\n ctx.referrer = __assign(__assign({}, ctx.referrer), ad);\n }\n storage.set('s:context.referrer', ad);\n}\n/**\n *\n * @param obj e.g. { foo: 'b', bar: 'd', baz: ['123', '456']}\n * @returns e.g. 'foo=b&bar=d&baz=123&baz=456'\n */\nvar objectToQueryString = function (obj) {\n try {\n var searchParams_1 = new URLSearchParams();\n Object.entries(obj).forEach(function (_a) {\n var k = _a[0], v = _a[1];\n if (Array.isArray(v)) {\n v.forEach(function (value) { return searchParams_1.append(k, value); });\n }\n else {\n searchParams_1.append(k, v);\n }\n });\n return searchParams_1.toString();\n }\n catch (_a) {\n return '';\n }\n};\nvar EnvironmentEnrichmentPlugin = /** @class */ (function () {\n function EnvironmentEnrichmentPlugin() {\n var _this = this;\n this.name = 'Page Enrichment';\n this.type = 'before';\n this.version = '0.1.0';\n this.isLoaded = function () { return true; };\n this.load = function (_ctx, instance) { return __awaiter(_this, void 0, void 0, function () {\n var _a, _1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n this.instance = instance;\n _b.label = 1;\n case 1:\n _b.trys.push([1, 3, , 4]);\n _a = this;\n return [4 /*yield*/, clientHints(this.instance.options.highEntropyValuesClientHints)];\n case 2:\n _a.userAgentData = _b.sent();\n return [3 /*break*/, 4];\n case 3:\n _1 = _b.sent();\n return [3 /*break*/, 4];\n case 4: return [2 /*return*/, Promise.resolve()];\n }\n });\n }); };\n this.enrich = function (ctx) {\n var _a, _b;\n // Note: Types are off - context should never be undefined here, since it is set as part of event creation.\n var evtCtx = ctx.event.context;\n var search = evtCtx.page.search || '';\n var query = typeof search === 'object' ? objectToQueryString(search) : search;\n evtCtx.userAgent = navigator.userAgent;\n evtCtx.userAgentData = _this.userAgentData;\n // @ts-ignore\n var locale = navigator.userLanguage || navigator.language;\n if (typeof evtCtx.locale === 'undefined' && typeof locale !== 'undefined') {\n evtCtx.locale = locale;\n }\n (_a = evtCtx.library) !== null && _a !== void 0 ? _a : (evtCtx.library = {\n name: 'analytics.js',\n version: \"\".concat(getVersionType() === 'web' ? 'next' : 'npm:next', \"-\").concat(version),\n });\n if (query && !evtCtx.campaign) {\n evtCtx.campaign = utm(query);\n }\n var amp = ampId();\n if (amp) {\n evtCtx.amp = { id: amp };\n }\n referrerId(query, evtCtx, (_b = _this.instance.options.disableClientPersistence) !== null && _b !== void 0 ? _b : false);\n try {\n evtCtx.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n }\n catch (_) {\n // If browser doesn't have support leave timezone undefined\n }\n return ctx;\n };\n this.track = this.enrich;\n this.identify = this.enrich;\n this.page = this.enrich;\n this.group = this.enrich;\n this.alias = this.enrich;\n this.screen = this.enrich;\n }\n return EnvironmentEnrichmentPlugin;\n}());\nexport var envEnrichment = new EnvironmentEnrichmentPlugin();\n//# sourceMappingURL=index.js.map","/**\n * Return a promise that can be externally resolved\n */\nexport var createDeferred = function () {\n var resolve;\n var reject;\n var promise = new Promise(function (_resolve, _reject) {\n resolve = _resolve;\n reject = _reject;\n });\n return {\n resolve: resolve,\n reject: reject,\n promise: promise,\n };\n};\n//# sourceMappingURL=create-deferred.js.map","import { __awaiter, __generator } from \"tslib\";\nexport function clientHints(hints) {\n return __awaiter(this, void 0, void 0, function () {\n var userAgentData;\n return __generator(this, function (_a) {\n userAgentData = navigator.userAgentData;\n if (!userAgentData)\n return [2 /*return*/, undefined];\n if (!hints)\n return [2 /*return*/, userAgentData.toJSON()];\n return [2 /*return*/, userAgentData\n .getHighEntropyValues(hints)\n .catch(function () { return userAgentData.toJSON(); })];\n });\n });\n}\n//# sourceMappingURL=index.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { loadScript } from '../../lib/load-script';\nimport { getCDN } from '../../lib/parse-cdn';\nimport { applyDestinationMiddleware, } from '../middleware';\nimport { Context, ContextCancelation } from '../../core/context';\nvar ActionDestination = /** @class */ (function () {\n function ActionDestination(name, action) {\n this.version = '1.0.0';\n this.alternativeNames = [];\n this.middleware = [];\n this.alias = this._createMethod('alias');\n this.group = this._createMethod('group');\n this.identify = this._createMethod('identify');\n this.page = this._createMethod('page');\n this.screen = this._createMethod('screen');\n this.track = this._createMethod('track');\n this.action = action;\n this.name = name;\n this.type = action.type;\n this.alternativeNames.push(action.name);\n }\n ActionDestination.prototype.addMiddleware = function () {\n var _a;\n var fn = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fn[_i] = arguments[_i];\n }\n if (this.type === 'destination') {\n (_a = this.middleware).push.apply(_a, fn);\n }\n };\n ActionDestination.prototype.transform = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var modifiedEvent;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, applyDestinationMiddleware(this.name, ctx.event, this.middleware)];\n case 1:\n modifiedEvent = _a.sent();\n if (modifiedEvent === null) {\n ctx.cancel(new ContextCancelation({\n retry: false,\n reason: 'dropped by destination middleware',\n }));\n }\n return [2 /*return*/, new Context(modifiedEvent)];\n }\n });\n });\n };\n ActionDestination.prototype._createMethod = function (methodName) {\n var _this = this;\n return function (ctx) { return __awaiter(_this, void 0, void 0, function () {\n var transformedContext, error_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this.action[methodName])\n return [2 /*return*/, ctx];\n transformedContext = ctx;\n if (!(this.type === 'destination')) return [3 /*break*/, 2];\n return [4 /*yield*/, this.transform(ctx)];\n case 1:\n transformedContext = _a.sent();\n _a.label = 2;\n case 2:\n _a.trys.push([2, 4, , 5]);\n ctx.stats.increment('analytics_js.action_plugin.invoke', 1, [\n \"method:\".concat(methodName),\n \"action_plugin_name:\".concat(this.action.name),\n ]);\n return [4 /*yield*/, this.action[methodName](transformedContext)];\n case 3:\n _a.sent();\n return [3 /*break*/, 5];\n case 4:\n error_1 = _a.sent();\n ctx.stats.increment('analytics_js.action_plugin.invoke.error', 1, [\n \"method:\".concat(methodName),\n \"action_plugin_name:\".concat(this.action.name),\n ]);\n throw error_1;\n case 5: return [2 /*return*/, ctx];\n }\n });\n }); };\n };\n /* --- PASSTHROUGH METHODS --- */\n ActionDestination.prototype.isLoaded = function () {\n return this.action.isLoaded();\n };\n ActionDestination.prototype.ready = function () {\n return this.action.ready ? this.action.ready() : Promise.resolve();\n };\n ActionDestination.prototype.load = function (ctx, analytics) {\n return __awaiter(this, void 0, void 0, function () {\n var error_2;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n ctx.stats.increment('analytics_js.action_plugin.invoke', 1, [\n \"method:load\",\n \"action_plugin_name:\".concat(this.action.name),\n ]);\n return [4 /*yield*/, this.action.load(ctx, analytics)];\n case 1: return [2 /*return*/, _a.sent()];\n case 2:\n error_2 = _a.sent();\n ctx.stats.increment('analytics_js.action_plugin.invoke.error', 1, [\n \"method:load\",\n \"action_plugin_name:\".concat(this.action.name),\n ]);\n throw error_2;\n case 3: return [2 /*return*/];\n }\n });\n });\n };\n ActionDestination.prototype.unload = function (ctx, analytics) {\n var _a, _b;\n return (_b = (_a = this.action).unload) === null || _b === void 0 ? void 0 : _b.call(_a, ctx, analytics);\n };\n return ActionDestination;\n}());\nexport { ActionDestination };\nfunction validate(pluginLike) {\n if (!Array.isArray(pluginLike)) {\n throw new Error('Not a valid list of plugins');\n }\n var required = ['load', 'isLoaded', 'name', 'version', 'type'];\n pluginLike.forEach(function (plugin) {\n required.forEach(function (method) {\n var _a;\n if (plugin[method] === undefined) {\n throw new Error(\"Plugin: \".concat((_a = plugin.name) !== null && _a !== void 0 ? _a : 'unknown', \" missing required function \").concat(method));\n }\n });\n });\n return true;\n}\nfunction isPluginDisabled(userIntegrations, remotePlugin) {\n var creationNameEnabled = userIntegrations[remotePlugin.creationName];\n var currentNameEnabled = userIntegrations[remotePlugin.name];\n // Check that the plugin isn't explicitly enabled when All: false\n if (userIntegrations.All === false &&\n !creationNameEnabled &&\n !currentNameEnabled) {\n return true;\n }\n // Check that the plugin isn't explicitly disabled\n if (creationNameEnabled === false || currentNameEnabled === false) {\n return true;\n }\n return false;\n}\nfunction loadPluginFactory(remotePlugin, obfuscate) {\n return __awaiter(this, void 0, void 0, function () {\n var defaultCdn, cdn, urlSplit, name_1, obfuscatedURL, error_3;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n defaultCdn = new RegExp('https://cdn.segment.(com|build)');\n cdn = getCDN();\n if (!obfuscate) return [3 /*break*/, 6];\n urlSplit = remotePlugin.url.split('/');\n name_1 = urlSplit[urlSplit.length - 2];\n obfuscatedURL = remotePlugin.url.replace(name_1, btoa(name_1).replace(/=/g, ''));\n _a.label = 1;\n case 1:\n _a.trys.push([1, 3, , 5]);\n return [4 /*yield*/, loadScript(obfuscatedURL.replace(defaultCdn, cdn))];\n case 2:\n _a.sent();\n return [3 /*break*/, 5];\n case 3:\n error_3 = _a.sent();\n // Due to syncing concerns it is possible that the obfuscated action destination (or requested version) might not exist.\n // We should use the unobfuscated version as a fallback.\n return [4 /*yield*/, loadScript(remotePlugin.url.replace(defaultCdn, cdn))];\n case 4:\n // Due to syncing concerns it is possible that the obfuscated action destination (or requested version) might not exist.\n // We should use the unobfuscated version as a fallback.\n _a.sent();\n return [3 /*break*/, 5];\n case 5: return [3 /*break*/, 8];\n case 6: return [4 /*yield*/, loadScript(remotePlugin.url.replace(defaultCdn, cdn))];\n case 7:\n _a.sent();\n _a.label = 8;\n case 8:\n // @ts-expect-error\n if (typeof window[remotePlugin.libraryName] === 'function') {\n // @ts-expect-error\n return [2 /*return*/, window[remotePlugin.libraryName]];\n }\n return [2 /*return*/];\n }\n });\n });\n}\nexport function remoteLoader(settings, userIntegrations, mergedIntegrations, obfuscate, routingMiddleware, pluginSources) {\n var _a, _b, _c;\n return __awaiter(this, void 0, void 0, function () {\n var allPlugins, routingRules, pluginPromises;\n var _this = this;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n allPlugins = [];\n routingRules = (_b = (_a = settings.middlewareSettings) === null || _a === void 0 ? void 0 : _a.routingRules) !== null && _b !== void 0 ? _b : [];\n pluginPromises = ((_c = settings.remotePlugins) !== null && _c !== void 0 ? _c : []).map(function (remotePlugin) { return __awaiter(_this, void 0, void 0, function () {\n var pluginFactory, _a, plugin, plugins, routing_1, error_4;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (isPluginDisabled(userIntegrations, remotePlugin))\n return [2 /*return*/];\n _b.label = 1;\n case 1:\n _b.trys.push([1, 6, , 7]);\n _a = (pluginSources === null || pluginSources === void 0 ? void 0 : pluginSources.find(function (_a) {\n var pluginName = _a.pluginName;\n return pluginName === remotePlugin.name;\n }));\n if (_a) return [3 /*break*/, 3];\n return [4 /*yield*/, loadPluginFactory(remotePlugin, obfuscate)];\n case 2:\n _a = (_b.sent());\n _b.label = 3;\n case 3:\n pluginFactory = _a;\n if (!pluginFactory) return [3 /*break*/, 5];\n return [4 /*yield*/, pluginFactory(__assign(__assign({}, remotePlugin.settings), mergedIntegrations[remotePlugin.name]))];\n case 4:\n plugin = _b.sent();\n plugins = Array.isArray(plugin) ? plugin : [plugin];\n validate(plugins);\n routing_1 = routingRules.filter(function (rule) { return rule.destinationName === remotePlugin.creationName; });\n plugins.forEach(function (plugin) {\n var wrapper = new ActionDestination(remotePlugin.creationName, plugin);\n /** Make sure we only apply destination filters to actions of the \"destination\" type to avoid causing issues for hybrid destinations */\n if (routing_1.length &&\n routingMiddleware &&\n plugin.type === 'destination') {\n wrapper.addMiddleware(routingMiddleware);\n }\n allPlugins.push(wrapper);\n });\n _b.label = 5;\n case 5: return [3 /*break*/, 7];\n case 6:\n error_4 = _b.sent();\n console.warn('Failed to load Remote Plugin', error_4);\n return [3 /*break*/, 7];\n case 7: return [2 /*return*/];\n }\n });\n }); });\n return [4 /*yield*/, Promise.all(pluginPromises)];\n case 1:\n _d.sent();\n return [2 /*return*/, allPlugins.filter(Boolean)];\n }\n });\n });\n}\n//# sourceMappingURL=index.js.map","/**\n * Register event listener on document that fires when:\n * * tab change or tab close (in mobile or desktop)\n * * click back / forward button\n * * click any link or perform any other navigation action\n * * soft refresh / hard refresh\n *\n * adapted from https://stackoverflow.com/questions/3239834/window-onbeforeunload-not-working-on-the-ipad/52864508#52864508,\n */\nexport var onPageChange = function (cb) {\n var unloaded = false; // prevents double firing if both are supported\n window.addEventListener('pagehide', function () {\n if (unloaded)\n return;\n unloaded = true;\n cb(unloaded);\n });\n // using document instead of window because of bug affecting browsers before safari 14 (detail in footnotes https://caniuse.com/?search=visibilitychange)\n document.addEventListener('visibilitychange', function () {\n if (document.visibilityState == 'hidden') {\n if (unloaded)\n return;\n unloaded = true;\n }\n else {\n unloaded = false;\n }\n cb(unloaded);\n });\n};\n//# sourceMappingURL=on-page-change.js.map","import { __awaiter, __generator, __rest } from \"tslib\";\nimport { fetch } from '../../lib/fetch';\nimport { onPageChange } from '../../lib/on-page-change';\nvar MAX_PAYLOAD_SIZE = 500;\nfunction kilobytes(buffer) {\n var size = encodeURI(JSON.stringify(buffer)).split(/%..|./).length - 1;\n return size / 1024;\n}\n/**\n * Checks if the payload is over or close to\n * the maximum payload size allowed by tracking\n * API.\n */\nfunction approachingTrackingAPILimit(buffer) {\n return kilobytes(buffer) >= MAX_PAYLOAD_SIZE - 50;\n}\nfunction chunks(batch) {\n var result = [];\n var index = 0;\n batch.forEach(function (item) {\n var size = kilobytes(result[index]);\n if (size >= 64) {\n index++;\n }\n if (result[index]) {\n result[index].push(item);\n }\n else {\n result[index] = [item];\n }\n });\n return result;\n}\nexport default function batch(apiHost, config) {\n var _a, _b;\n var buffer = [];\n var pageUnloaded = false;\n var limit = (_a = config === null || config === void 0 ? void 0 : config.size) !== null && _a !== void 0 ? _a : 10;\n var timeout = (_b = config === null || config === void 0 ? void 0 : config.timeout) !== null && _b !== void 0 ? _b : 5000;\n function sendBatch(batch) {\n var _a;\n if (batch.length === 0) {\n return;\n }\n var writeKey = (_a = batch[0]) === null || _a === void 0 ? void 0 : _a.writeKey;\n // Remove sentAt from every event as batching only needs a single timestamp\n var updatedBatch = batch.map(function (event) {\n var _a = event, sentAt = _a.sentAt, newEvent = __rest(_a, [\"sentAt\"]);\n return newEvent;\n });\n return fetch(\"https://\".concat(apiHost, \"/b\"), {\n keepalive: pageUnloaded,\n headers: {\n 'Content-Type': 'text/plain',\n },\n method: 'post',\n body: JSON.stringify({\n writeKey: writeKey,\n batch: updatedBatch,\n sentAt: new Date().toISOString(),\n }),\n });\n }\n function flush() {\n return __awaiter(this, void 0, void 0, function () {\n var batch_1;\n return __generator(this, function (_a) {\n if (buffer.length) {\n batch_1 = buffer;\n buffer = [];\n return [2 /*return*/, sendBatch(batch_1)];\n }\n return [2 /*return*/];\n });\n });\n }\n var schedule;\n function scheduleFlush() {\n if (schedule) {\n return;\n }\n schedule = setTimeout(function () {\n schedule = undefined;\n flush().catch(console.error);\n }, timeout);\n }\n onPageChange(function (unloaded) {\n pageUnloaded = unloaded;\n if (pageUnloaded && buffer.length) {\n var reqs = chunks(buffer).map(sendBatch);\n Promise.all(reqs).catch(console.error);\n }\n });\n function dispatch(_url, body) {\n return __awaiter(this, void 0, void 0, function () {\n var bufferOverflow;\n return __generator(this, function (_a) {\n buffer.push(body);\n bufferOverflow = buffer.length >= limit || approachingTrackingAPILimit(buffer);\n return [2 /*return*/, bufferOverflow || pageUnloaded ? flush() : scheduleFlush()];\n });\n });\n }\n return {\n dispatch: dispatch,\n };\n}\n//# sourceMappingURL=batched-dispatcher.js.map","import { fetch } from '../../lib/fetch';\nexport default function (config) {\n function dispatch(url, body) {\n return fetch(url, {\n keepalive: config === null || config === void 0 ? void 0 : config.keepalive,\n headers: { 'Content-Type': 'text/plain' },\n method: 'post',\n body: JSON.stringify(body),\n });\n }\n return {\n dispatch: dispatch,\n };\n}\n//# sourceMappingURL=fetch-dispatcher.js.map","import { __assign } from \"tslib\";\nexport function normalize(analytics, json, settings, integrations) {\n var _a;\n var user = analytics.user();\n delete json.options;\n json.writeKey = settings === null || settings === void 0 ? void 0 : settings.apiKey;\n json.userId = json.userId || user.id();\n json.anonymousId = json.anonymousId || user.anonymousId();\n json.sentAt = new Date();\n var failed = analytics.queue.failedInitializations || [];\n if (failed.length > 0) {\n json._metadata = { failedInitializations: failed };\n }\n var bundled = [];\n var unbundled = [];\n for (var key in integrations) {\n var integration = integrations[key];\n if (key === 'Segment.io') {\n bundled.push(key);\n }\n if (integration.bundlingStatus === 'bundled') {\n bundled.push(key);\n }\n if (integration.bundlingStatus === 'unbundled') {\n unbundled.push(key);\n }\n }\n // This will make sure that the disabled cloud mode destinations will be\n // included in the unbundled list.\n for (var _i = 0, _b = (settings === null || settings === void 0 ? void 0 : settings.unbundledIntegrations) || []; _i < _b.length; _i++) {\n var settingsUnbundled = _b[_i];\n if (!unbundled.includes(settingsUnbundled)) {\n unbundled.push(settingsUnbundled);\n }\n }\n var configIds = (_a = settings === null || settings === void 0 ? void 0 : settings.maybeBundledConfigIds) !== null && _a !== void 0 ? _a : {};\n var bundledConfigIds = [];\n bundled.sort().forEach(function (name) {\n var _a;\n ;\n ((_a = configIds[name]) !== null && _a !== void 0 ? _a : []).forEach(function (id) {\n bundledConfigIds.push(id);\n });\n });\n if ((settings === null || settings === void 0 ? void 0 : settings.addBundledMetadata) !== false) {\n json._metadata = __assign(__assign({}, json._metadata), { bundled: bundled.sort(), unbundled: unbundled.sort(), bundledIds: bundledConfigIds });\n }\n return json;\n}\n//# sourceMappingURL=normalize.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { isOffline } from '../../core/connection';\nimport { Context } from '../../core/context';\nimport { attempt } from '@segment/analytics-core';\nimport { pWhile } from '../../lib/p-while';\nfunction flushQueue(xt, queue) {\n return __awaiter(this, void 0, void 0, function () {\n var failedQueue;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n failedQueue = [];\n if (isOffline()) {\n return [2 /*return*/, queue];\n }\n return [4 /*yield*/, pWhile(function () { return queue.length > 0 && !isOffline(); }, function () { return __awaiter(_this, void 0, void 0, function () {\n var ctx, result, success;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ctx = queue.pop();\n if (!ctx) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, attempt(ctx, xt)];\n case 1:\n result = _a.sent();\n success = result instanceof Context;\n if (!success) {\n failedQueue.push(ctx);\n }\n return [2 /*return*/];\n }\n });\n }); })\n // re-add failed tasks\n ];\n case 1:\n _a.sent();\n // re-add failed tasks\n failedQueue.map(function (failed) { return queue.pushWithBackoff(failed); });\n return [2 /*return*/, queue];\n }\n });\n });\n}\nexport function scheduleFlush(flushing, buffer, xt, scheduleFlush) {\n var _this = this;\n if (flushing) {\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {\n var isFlushing, newBuffer;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n isFlushing = true;\n return [4 /*yield*/, flushQueue(xt, buffer)];\n case 1:\n newBuffer = _a.sent();\n isFlushing = false;\n if (buffer.todo > 0) {\n scheduleFlush(isFlushing, newBuffer, xt, scheduleFlush);\n }\n return [2 /*return*/];\n }\n });\n }); }, Math.random() * 5000);\n}\n//# sourceMappingURL=schedule-flush.js.map","import { __awaiter, __generator } from \"tslib\";\nimport { isOffline } from '../../core/connection';\nimport { PriorityQueue } from '../../lib/priority-queue';\nimport { PersistedPriorityQueue } from '../../lib/priority-queue/persisted';\nimport { toFacade } from '../../lib/to-facade';\nimport batch from './batched-dispatcher';\nimport standard from './fetch-dispatcher';\nimport { normalize } from './normalize';\nimport { scheduleFlush } from './schedule-flush';\nimport { SEGMENT_API_HOST } from '../../core/constants';\nfunction onAlias(analytics, json) {\n var _a, _b, _c, _d;\n var user = analytics.user();\n json.previousId =\n (_c = (_b = (_a = json.previousId) !== null && _a !== void 0 ? _a : json.from) !== null && _b !== void 0 ? _b : user.id()) !== null && _c !== void 0 ? _c : user.anonymousId();\n json.userId = (_d = json.userId) !== null && _d !== void 0 ? _d : json.to;\n delete json.from;\n delete json.to;\n return json;\n}\nexport function segmentio(analytics, settings, integrations) {\n var _a, _b, _c;\n // Attach `pagehide` before buffer is created so that inflight events are added\n // to the buffer before the buffer persists events in its own `pagehide` handler.\n window.addEventListener('pagehide', function () {\n buffer.push.apply(buffer, Array.from(inflightEvents));\n inflightEvents.clear();\n });\n var writeKey = (_a = settings === null || settings === void 0 ? void 0 : settings.apiKey) !== null && _a !== void 0 ? _a : '';\n var buffer = analytics.options.disableClientPersistence\n ? new PriorityQueue(analytics.queue.queue.maxAttempts, [])\n : new PersistedPriorityQueue(analytics.queue.queue.maxAttempts, \"\".concat(writeKey, \":dest-Segment.io\"));\n var inflightEvents = new Set();\n var flushing = false;\n var apiHost = (_b = settings === null || settings === void 0 ? void 0 : settings.apiHost) !== null && _b !== void 0 ? _b : SEGMENT_API_HOST;\n var protocol = (_c = settings === null || settings === void 0 ? void 0 : settings.protocol) !== null && _c !== void 0 ? _c : 'https';\n var remote = \"\".concat(protocol, \"://\").concat(apiHost);\n var deliveryStrategy = settings === null || settings === void 0 ? void 0 : settings.deliveryStrategy;\n var client = (deliveryStrategy === null || deliveryStrategy === void 0 ? void 0 : deliveryStrategy.strategy) === 'batching'\n ? batch(apiHost, deliveryStrategy.config)\n : standard(deliveryStrategy === null || deliveryStrategy === void 0 ? void 0 : deliveryStrategy.config);\n function send(ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var path, json;\n return __generator(this, function (_a) {\n if (isOffline()) {\n buffer.push(ctx);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n scheduleFlush(flushing, buffer, segmentio, scheduleFlush);\n return [2 /*return*/, ctx];\n }\n inflightEvents.add(ctx);\n path = ctx.event.type.charAt(0);\n json = toFacade(ctx.event).json();\n if (ctx.event.type === 'track') {\n delete json.traits;\n }\n if (ctx.event.type === 'alias') {\n json = onAlias(analytics, json);\n }\n return [2 /*return*/, client\n .dispatch(\"\".concat(remote, \"/\").concat(path), normalize(analytics, json, settings, integrations))\n .then(function () { return ctx; })\n .catch(function () {\n buffer.pushWithBackoff(ctx);\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n scheduleFlush(flushing, buffer, segmentio, scheduleFlush);\n return ctx;\n })\n .finally(function () {\n inflightEvents.delete(ctx);\n })];\n });\n });\n }\n var segmentio = {\n name: 'Segment.io',\n type: 'after',\n version: '0.1.0',\n isLoaded: function () { return true; },\n load: function () { return Promise.resolve(); },\n track: send,\n identify: send,\n page: send,\n alias: send,\n group: send,\n screen: send,\n };\n // Buffer may already have items if they were previously stored in localStorage.\n // Start flushing them immediately.\n if (buffer.todo) {\n scheduleFlush(flushing, buffer, segmentio, scheduleFlush);\n }\n return segmentio;\n}\n//# sourceMappingURL=index.js.map","import { __extends } from \"tslib\";\nvar ValidationError = /** @class */ (function (_super) {\n __extends(ValidationError, _super);\n function ValidationError(field, message) {\n var _this = _super.call(this, \"\".concat(field, \" \").concat(message)) || this;\n _this.field = field;\n return _this;\n }\n return ValidationError;\n}(Error));\nexport { ValidationError };\n//# sourceMappingURL=errors.js.map","import { ValidationError } from './errors';\nimport { isString, isPlainObject, exists } from './helpers';\nvar stringError = 'is not a string';\nvar objError = 'is not an object';\nvar nilError = 'is nil';\nexport function assertUserIdentity(event) {\n var USER_FIELD_NAME = '.userId/anonymousId/previousId/groupId';\n var getAnyUserId = function (event) { var _a, _b, _c; return (_c = (_b = (_a = event.userId) !== null && _a !== void 0 ? _a : event.anonymousId) !== null && _b !== void 0 ? _b : event.groupId) !== null && _c !== void 0 ? _c : event.previousId; };\n var id = getAnyUserId(event);\n if (!exists(id)) {\n throw new ValidationError(USER_FIELD_NAME, nilError);\n }\n else if (!isString(id)) {\n throw new ValidationError(USER_FIELD_NAME, stringError);\n }\n}\nexport function assertEventExists(event) {\n if (!exists(event)) {\n throw new ValidationError('Event', nilError);\n }\n if (typeof event !== 'object') {\n throw new ValidationError('Event', objError);\n }\n}\nexport function assertEventType(event) {\n if (!isString(event.type)) {\n throw new ValidationError('.type', stringError);\n }\n}\nexport function assertTrackEventName(event) {\n if (!isString(event.event)) {\n throw new ValidationError('.event', stringError);\n }\n}\nexport function assertTrackEventProperties(event) {\n if (!isPlainObject(event.properties)) {\n throw new ValidationError('.properties', objError);\n }\n}\nexport function assertTraits(event) {\n if (!isPlainObject(event.traits)) {\n throw new ValidationError('.traits', objError);\n }\n}\nexport function validateEvent(event) {\n assertEventExists(event);\n assertEventType(event);\n if (event.type === 'track') {\n assertTrackEventName(event);\n assertTrackEventProperties(event);\n }\n if (['group', 'identify'].includes(event.type)) {\n assertTraits(event);\n }\n assertUserIdentity(event);\n}\n//# sourceMappingURL=assertions.js.map","import { assertUserIdentity, isPlainObject, ValidationError, assertEventExists, assertEventType, assertTrackEventName, } from '@segment/analytics-core';\nfunction validate(ctx) {\n var _a;\n var event = ctx.event;\n assertEventExists(event);\n assertEventType(event);\n if (event.type === 'track') {\n assertTrackEventName(event);\n }\n var props = (_a = event.properties) !== null && _a !== void 0 ? _a : event.traits;\n if (event.type !== 'alias' && !isPlainObject(props)) {\n throw new ValidationError('.properties', 'is not an object');\n }\n assertUserIdentity(event);\n return ctx;\n}\nexport var validation = {\n name: 'Event Validation',\n type: 'before',\n version: '1.0.0',\n isLoaded: function () { return true; },\n load: function () { return Promise.resolve(); },\n track: validate,\n identify: validate,\n page: validate,\n alias: validate,\n group: validate,\n screen: validate,\n};\n//# sourceMappingURL=index.js.map","var _a;\nvar _b;\nimport { getGlobal } from '../../lib/get-global';\nvar env = getGlobal();\n// The code below assumes the inspector extension will use Object.assign\n// to add the inspect interface on to this object reference (unless the\n// extension code ran first and has already set up the variable)\nvar inspectorHost = ((_a = (_b = env)['__SEGMENT_INSPECTOR__']) !== null && _a !== void 0 ? _a : (_b['__SEGMENT_INSPECTOR__'] = {}));\nexport var attachInspector = function (analytics) { var _a; return (_a = inspectorHost.attach) === null || _a === void 0 ? void 0 : _a.call(inspectorHost, analytics); };\n//# sourceMappingURL=index.js.map","import { __assign, __awaiter, __extends, __generator, __spreadArray } from \"tslib\";\nimport { getProcessEnv } from '../lib/get-process-env';\nimport { getCDN, setGlobalCDNUrl } from '../lib/parse-cdn';\nimport { fetch } from '../lib/fetch';\nimport { Analytics } from '../core/analytics';\nimport { mergedOptions } from '../lib/merged-options';\nimport { createDeferred } from '../lib/create-deferred';\nimport { envEnrichment } from '../plugins/env-enrichment';\nimport { remoteLoader, } from '../plugins/remote-loader';\nimport { segmentio } from '../plugins/segmentio';\nimport { validation } from '../plugins/validation';\nimport { AnalyticsBuffered, flushAnalyticsCallsInNewTask, flushAddSourceMiddleware, flushSetAnonymousID, flushOn, } from '../core/buffer';\nimport { attachInspector } from '../core/inspector';\nimport { Stats } from '../core/stats';\nimport { setGlobalAnalyticsKey } from '../lib/global-analytics-helper';\nexport function loadLegacySettings(writeKey, cdnURL) {\n var baseUrl = cdnURL !== null && cdnURL !== void 0 ? cdnURL : getCDN();\n return fetch(\"\".concat(baseUrl, \"/v1/projects/\").concat(writeKey, \"/settings\"))\n .then(function (res) {\n if (!res.ok) {\n return res.text().then(function (errorResponseMessage) {\n throw new Error(errorResponseMessage);\n });\n }\n return res.json();\n })\n .catch(function (err) {\n console.error(err.message);\n throw err;\n });\n}\nfunction hasLegacyDestinations(settings) {\n return (getProcessEnv().NODE_ENV !== 'test' &&\n // just one integration means segmentio\n Object.keys(settings.integrations).length > 1);\n}\nfunction hasTsubMiddleware(settings) {\n var _a, _b, _c;\n return (getProcessEnv().NODE_ENV !== 'test' &&\n ((_c = (_b = (_a = settings.middlewareSettings) === null || _a === void 0 ? void 0 : _a.routingRules) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0);\n}\n/**\n * With AJS classic, we allow users to call setAnonymousId before the library initialization.\n * This is important because some of the destinations will use the anonymousId during the initialization,\n * and if we set anonId afterwards, that wouldn’t impact the destination.\n *\n * Also Ensures events can be registered before library initialization.\n * This is important so users can register to 'initialize' and any events that may fire early during setup.\n */\nfunction flushPreBuffer(analytics, buffer) {\n flushSetAnonymousID(analytics, buffer);\n flushOn(analytics, buffer);\n}\n/**\n * Finish flushing buffer and cleanup.\n */\nfunction flushFinalBuffer(analytics, buffer) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: \n // Call popSnippetWindowBuffer before each flush task since there may be\n // analytics calls during async function calls.\n return [4 /*yield*/, flushAddSourceMiddleware(analytics, buffer)];\n case 1:\n // Call popSnippetWindowBuffer before each flush task since there may be\n // analytics calls during async function calls.\n _a.sent();\n flushAnalyticsCallsInNewTask(analytics, buffer);\n // Clear buffer, just in case analytics is loaded twice; we don't want to fire events off again.\n buffer.clear();\n return [2 /*return*/];\n }\n });\n });\n}\nfunction registerPlugins(writeKey, legacySettings, analytics, opts, options, pluginLikes, legacyIntegrationSources) {\n var _a, _b, _c;\n if (pluginLikes === void 0) { pluginLikes = []; }\n return __awaiter(this, void 0, void 0, function () {\n var plugins, pluginSources, tsubMiddleware, _d, legacyDestinations, _e, schemaFilter, _f, mergedSettings, remotePlugins, toRegister, shouldIgnoreSegmentio, _g, _h, ctx;\n var _this = this;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n plugins = pluginLikes === null || pluginLikes === void 0 ? void 0 : pluginLikes.filter(function (pluginLike) { return typeof pluginLike === 'object'; });\n pluginSources = pluginLikes === null || pluginLikes === void 0 ? void 0 : pluginLikes.filter(function (pluginLike) {\n return typeof pluginLike === 'function' &&\n typeof pluginLike.pluginName === 'string';\n });\n if (!hasTsubMiddleware(legacySettings)) return [3 /*break*/, 2];\n return [4 /*yield*/, import(\n /* webpackChunkName: \"tsub-middleware\" */ '../plugins/routing-middleware').then(function (mod) {\n return mod.tsubMiddleware(legacySettings.middlewareSettings.routingRules);\n })];\n case 1:\n _d = _j.sent();\n return [3 /*break*/, 3];\n case 2:\n _d = undefined;\n _j.label = 3;\n case 3:\n tsubMiddleware = _d;\n if (!(hasLegacyDestinations(legacySettings) || legacyIntegrationSources.length > 0)) return [3 /*break*/, 5];\n return [4 /*yield*/, import(\n /* webpackChunkName: \"ajs-destination\" */ '../plugins/ajs-destination').then(function (mod) {\n return mod.ajsDestinations(writeKey, legacySettings, analytics.integrations, opts, tsubMiddleware, legacyIntegrationSources);\n })];\n case 4:\n _e = _j.sent();\n return [3 /*break*/, 6];\n case 5:\n _e = [];\n _j.label = 6;\n case 6:\n legacyDestinations = _e;\n if (!legacySettings.legacyVideoPluginsEnabled) return [3 /*break*/, 8];\n return [4 /*yield*/, import(\n /* webpackChunkName: \"legacyVideos\" */ '../plugins/legacy-video-plugins').then(function (mod) {\n return mod.loadLegacyVideoPlugins(analytics);\n })];\n case 7:\n _j.sent();\n _j.label = 8;\n case 8:\n if (!((_a = opts.plan) === null || _a === void 0 ? void 0 : _a.track)) return [3 /*break*/, 10];\n return [4 /*yield*/, import(\n /* webpackChunkName: \"schemaFilter\" */ '../plugins/schema-filter').then(function (mod) {\n var _a;\n return mod.schemaFilter((_a = opts.plan) === null || _a === void 0 ? void 0 : _a.track, legacySettings);\n })];\n case 9:\n _f = _j.sent();\n return [3 /*break*/, 11];\n case 10:\n _f = undefined;\n _j.label = 11;\n case 11:\n schemaFilter = _f;\n mergedSettings = mergedOptions(legacySettings, options);\n return [4 /*yield*/, remoteLoader(legacySettings, analytics.integrations, mergedSettings, options.obfuscate, tsubMiddleware, pluginSources).catch(function () { return []; })];\n case 12:\n remotePlugins = _j.sent();\n toRegister = __spreadArray(__spreadArray(__spreadArray([\n validation,\n envEnrichment\n ], plugins, true), legacyDestinations, true), remotePlugins, true);\n if (schemaFilter) {\n toRegister.push(schemaFilter);\n }\n shouldIgnoreSegmentio = (((_b = opts.integrations) === null || _b === void 0 ? void 0 : _b.All) === false && !opts.integrations['Segment.io']) ||\n (opts.integrations && opts.integrations['Segment.io'] === false);\n if (!!shouldIgnoreSegmentio) return [3 /*break*/, 14];\n _h = (_g = toRegister).push;\n return [4 /*yield*/, segmentio(analytics, mergedSettings['Segment.io'], legacySettings.integrations)];\n case 13:\n _h.apply(_g, [_j.sent()]);\n _j.label = 14;\n case 14: return [4 /*yield*/, analytics.register.apply(analytics, toRegister)];\n case 15:\n ctx = _j.sent();\n if (!Object.entries((_c = legacySettings.enabledMiddleware) !== null && _c !== void 0 ? _c : {}).some(function (_a) {\n var enabled = _a[1];\n return enabled;\n })) return [3 /*break*/, 17];\n return [4 /*yield*/, import(\n /* webpackChunkName: \"remoteMiddleware\" */ '../plugins/remote-middleware').then(function (_a) {\n var remoteMiddlewares = _a.remoteMiddlewares;\n return __awaiter(_this, void 0, void 0, function () {\n var middleware, promises;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, remoteMiddlewares(ctx, legacySettings, options.obfuscate)];\n case 1:\n middleware = _b.sent();\n promises = middleware.map(function (mdw) {\n return analytics.addSourceMiddleware(mdw);\n });\n return [2 /*return*/, Promise.all(promises)];\n }\n });\n });\n })];\n case 16:\n _j.sent();\n _j.label = 17;\n case 17: return [2 /*return*/, ctx];\n }\n });\n });\n}\nfunction loadAnalytics(settings, options, preInitBuffer) {\n var _a, _b, _c, _d, _e, _f, _g;\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var legacySettings, _h, retryQueue, opts, analytics, plugins, classicIntegrations, ctx, search, hash, term;\n return __generator(this, function (_j) {\n switch (_j.label) {\n case 0:\n if (options.globalAnalyticsKey)\n setGlobalAnalyticsKey(options.globalAnalyticsKey);\n // this is an ugly side-effect, but it's for the benefits of the plugins that get their cdn via getCDN()\n if (settings.cdnURL)\n setGlobalCDNUrl(settings.cdnURL);\n if (!((_a = settings.cdnSettings) !== null && _a !== void 0)) return [3 /*break*/, 1];\n _h = _a;\n return [3 /*break*/, 3];\n case 1: return [4 /*yield*/, loadLegacySettings(settings.writeKey, settings.cdnURL)];\n case 2:\n _h = (_j.sent());\n _j.label = 3;\n case 3:\n legacySettings = _h;\n if (options.updateCDNSettings) {\n legacySettings = options.updateCDNSettings(legacySettings);\n }\n retryQueue = (_c = (_b = legacySettings.integrations['Segment.io']) === null || _b === void 0 ? void 0 : _b.retryQueue) !== null && _c !== void 0 ? _c : true;\n opts = __assign({ retryQueue: retryQueue }, options);\n analytics = new Analytics(settings, opts);\n attachInspector(analytics);\n plugins = (_d = settings.plugins) !== null && _d !== void 0 ? _d : [];\n classicIntegrations = (_e = settings.classicIntegrations) !== null && _e !== void 0 ? _e : [];\n Stats.initRemoteMetrics(legacySettings.metrics);\n // needs to be flushed before plugins are registered\n flushPreBuffer(analytics, preInitBuffer);\n return [4 /*yield*/, registerPlugins(settings.writeKey, legacySettings, analytics, opts, options, plugins, classicIntegrations)];\n case 4:\n ctx = _j.sent();\n search = (_f = window.location.search) !== null && _f !== void 0 ? _f : '';\n hash = (_g = window.location.hash) !== null && _g !== void 0 ? _g : '';\n term = search.length ? search : hash.replace(/(?=#).*(?=\\?)/, '');\n if (!term.includes('ajs_')) return [3 /*break*/, 6];\n return [4 /*yield*/, analytics.queryString(term).catch(console.error)];\n case 5:\n _j.sent();\n _j.label = 6;\n case 6:\n analytics.initialized = true;\n analytics.emit('initialize', settings, options);\n if (options.initialPageview) {\n analytics.page().catch(console.error);\n }\n return [4 /*yield*/, flushFinalBuffer(analytics, preInitBuffer)];\n case 7:\n _j.sent();\n return [2 /*return*/, [analytics, ctx]];\n }\n });\n });\n}\n/**\n * The public browser interface for Segment Analytics\n *\n * @example\n * ```ts\n * export const analytics = new AnalyticsBrowser()\n * analytics.load({ writeKey: 'foo' })\n * ```\n * @link https://github.com/segmentio/analytics-next/#readme\n */\nvar AnalyticsBrowser = /** @class */ (function (_super) {\n __extends(AnalyticsBrowser, _super);\n function AnalyticsBrowser() {\n var _this = this;\n var _a = createDeferred(), loadStart = _a.promise, resolveLoadStart = _a.resolve;\n _this = _super.call(this, function (buffer) {\n return loadStart.then(function (_a) {\n var settings = _a[0], options = _a[1];\n return loadAnalytics(settings, options, buffer);\n });\n }) || this;\n _this._resolveLoadStart = function (settings, options) {\n return resolveLoadStart([settings, options]);\n };\n return _this;\n }\n /**\n * Fully initialize an analytics instance, including:\n *\n * * Fetching settings from the segment CDN (by default).\n * * Fetching all remote destinations configured by the user (if applicable).\n * * Flushing buffered analytics events.\n * * Loading all middleware.\n *\n * Note:️ This method should only be called *once* in your application.\n *\n * @example\n * ```ts\n * export const analytics = new AnalyticsBrowser()\n * analytics.load({ writeKey: 'foo' })\n * ```\n */\n AnalyticsBrowser.prototype.load = function (settings, options) {\n if (options === void 0) { options = {}; }\n this._resolveLoadStart(settings, options);\n return this;\n };\n /**\n * Instantiates an object exposing Analytics methods.\n *\n * @example\n * ```ts\n * const ajs = AnalyticsBrowser.load({ writeKey: '' })\n *\n * ajs.track(\"foo\")\n * ...\n * ```\n */\n AnalyticsBrowser.load = function (settings, options) {\n if (options === void 0) { options = {}; }\n return new AnalyticsBrowser().load(settings, options);\n };\n AnalyticsBrowser.standalone = function (writeKey, options) {\n return AnalyticsBrowser.load({ writeKey: writeKey }, options).then(function (res) { return res[0]; });\n };\n return AnalyticsBrowser;\n}(AnalyticsBuffered));\nexport { AnalyticsBrowser };\n//# sourceMappingURL=index.js.map","import { isBrowser } from '../environment';\nexport function isOnline() {\n if (isBrowser()) {\n return window.navigator.onLine;\n }\n return true;\n}\nexport function isOffline() {\n return !isOnline();\n}\n//# sourceMappingURL=index.js.map","export var SEGMENT_API_HOST = 'api.segment.io/v1';\n//# sourceMappingURL=index.js.map","import { __extends } from \"tslib\";\nimport { CoreContext, ContextCancelation, } from '@segment/analytics-core';\nimport { Stats } from '../stats';\nvar Context = /** @class */ (function (_super) {\n __extends(Context, _super);\n function Context(event, id) {\n return _super.call(this, event, id, new Stats()) || this;\n }\n Context.system = function () {\n return new this({ type: 'track', event: 'system' });\n };\n return Context;\n}(CoreContext));\nexport { Context };\nexport { ContextCancelation };\n//# sourceMappingURL=index.js.map","export function isBrowser() {\n return typeof window !== 'undefined';\n}\nexport function isServer() {\n return !isBrowser();\n}\n//# sourceMappingURL=index.js.map","/**\n * Tries to gets the unencoded version of an encoded component of a\n * Uniform Resource Identifier (URI). If input string is malformed,\n * returns it back as-is.\n *\n * Note: All occurences of the `+` character become ` ` (spaces).\n **/\nexport function gracefulDecodeURIComponent(encodedURIComponent) {\n try {\n return decodeURIComponent(encodedURIComponent.replace(/\\+/g, ' '));\n }\n catch (_a) {\n return encodedURIComponent;\n }\n}\n//# sourceMappingURL=gracefulDecodeURIComponent.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { fetch } from '../../lib/fetch';\nimport { version } from '../../generated/version';\nimport { getVersionType } from '../../lib/version-type';\nimport { SEGMENT_API_HOST } from '../constants';\nvar createRemoteMetric = function (metric, tags, versionType) {\n var formattedTags = tags.reduce(function (acc, t) {\n var _a = t.split(':'), k = _a[0], v = _a[1];\n acc[k] = v;\n return acc;\n }, {});\n return {\n type: 'Counter',\n metric: metric,\n value: 1,\n tags: __assign(__assign({}, formattedTags), { library: 'analytics.js', library_version: versionType === 'web' ? \"next-\".concat(version) : \"npm:next-\".concat(version) }),\n };\n};\nfunction logError(err) {\n console.error('Error sending segment performance metrics', err);\n}\nvar RemoteMetrics = /** @class */ (function () {\n function RemoteMetrics(options) {\n var _this = this;\n var _a, _b, _c, _d;\n this.host = (_a = options === null || options === void 0 ? void 0 : options.host) !== null && _a !== void 0 ? _a : SEGMENT_API_HOST;\n this.sampleRate = (_b = options === null || options === void 0 ? void 0 : options.sampleRate) !== null && _b !== void 0 ? _b : 1;\n this.flushTimer = (_c = options === null || options === void 0 ? void 0 : options.flushTimer) !== null && _c !== void 0 ? _c : 30 * 1000; /* 30s */\n this.maxQueueSize = (_d = options === null || options === void 0 ? void 0 : options.maxQueueSize) !== null && _d !== void 0 ? _d : 20;\n this.queue = [];\n if (this.sampleRate > 0) {\n var flushing_1 = false;\n var run_1 = function () {\n if (flushing_1) {\n return;\n }\n flushing_1 = true;\n _this.flush().catch(logError);\n flushing_1 = false;\n setTimeout(run_1, _this.flushTimer);\n };\n run_1();\n }\n }\n RemoteMetrics.prototype.increment = function (metric, tags) {\n // All metrics are part of an allow list in Tracking API\n if (!metric.includes('analytics_js.')) {\n return;\n }\n // /m doesn't like empty tags\n if (tags.length === 0) {\n return;\n }\n if (Math.random() > this.sampleRate) {\n return;\n }\n if (this.queue.length >= this.maxQueueSize) {\n return;\n }\n var remoteMetric = createRemoteMetric(metric, tags, getVersionType());\n this.queue.push(remoteMetric);\n if (metric.includes('error')) {\n this.flush().catch(logError);\n }\n };\n RemoteMetrics.prototype.flush = function () {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (this.queue.length <= 0) {\n return [2 /*return*/];\n }\n return [4 /*yield*/, this.send().catch(function (error) {\n logError(error);\n _this.sampleRate = 0;\n })];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n RemoteMetrics.prototype.send = function () {\n return __awaiter(this, void 0, void 0, function () {\n var payload, headers, url;\n return __generator(this, function (_a) {\n payload = { series: this.queue };\n this.queue = [];\n headers = { 'Content-Type': 'text/plain' };\n url = \"https://\".concat(this.host, \"/m\");\n return [2 /*return*/, fetch(url, {\n headers: headers,\n body: JSON.stringify(payload),\n method: 'POST',\n })];\n });\n });\n };\n return RemoteMetrics;\n}());\nexport { RemoteMetrics };\n//# sourceMappingURL=remote-metrics.js.map","import { __extends } from \"tslib\";\nimport { CoreStats } from '@segment/analytics-core';\nimport { RemoteMetrics } from './remote-metrics';\nvar remoteMetrics;\nvar Stats = /** @class */ (function (_super) {\n __extends(Stats, _super);\n function Stats() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Stats.initRemoteMetrics = function (options) {\n remoteMetrics = new RemoteMetrics(options);\n };\n Stats.prototype.increment = function (metric, by, tags) {\n _super.prototype.increment.call(this, metric, by, tags);\n remoteMetrics === null || remoteMetrics === void 0 ? void 0 : remoteMetrics.increment(metric, tags !== null && tags !== void 0 ? tags : []);\n };\n return Stats;\n}(CoreStats));\nexport { Stats };\n//# sourceMappingURL=index.js.map","// This file is generated.\nexport var version = '1.59.0';\n//# sourceMappingURL=version.js.map","export default function(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t}),t(a())},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null)})}\n//# sourceMappingURL=unfetch.module.js.map\n","import unfetch from 'unfetch';\nimport { getGlobal } from './get-global';\n/**\n * Wrapper around native `fetch` containing `unfetch` fallback.\n */\nexport var fetch = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var global = getGlobal();\n return ((global && global.fetch) || unfetch).apply(void 0, args);\n};\n//# sourceMappingURL=fetch.js.map","// This an imperfect polyfill for globalThis\nexport var getGlobal = function () {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n return null;\n};\n//# sourceMappingURL=get-global.js.map","/**\n * Stores the global window analytics key\n */\nvar _globalAnalyticsKey = 'analytics';\n/**\n * Gets the global analytics/buffer\n * @param key name of the window property where the buffer is stored (default: analytics)\n * @returns AnalyticsSnippet\n */\nexport function getGlobalAnalytics() {\n return window[_globalAnalyticsKey];\n}\n/**\n * Replaces the global window key for the analytics/buffer object\n * @param key key name\n */\nexport function setGlobalAnalyticsKey(key) {\n _globalAnalyticsKey = key;\n}\n/**\n * Sets the global analytics object\n * @param analytics analytics snippet\n */\nexport function setGlobalAnalytics(analytics) {\n ;\n window[_globalAnalyticsKey] = analytics;\n}\n//# sourceMappingURL=global-analytics-helper.js.map","function findScript(src) {\n var scripts = Array.prototype.slice.call(window.document.querySelectorAll('script'));\n return scripts.find(function (s) { return s.src === src; });\n}\nexport function loadScript(src, attributes) {\n var found = findScript(src);\n if (found !== undefined) {\n var status_1 = found === null || found === void 0 ? void 0 : found.getAttribute('status');\n if (status_1 === 'loaded') {\n return Promise.resolve(found);\n }\n if (status_1 === 'loading') {\n return new Promise(function (resolve, reject) {\n found.addEventListener('load', function () { return resolve(found); });\n found.addEventListener('error', function (err) { return reject(err); });\n });\n }\n }\n return new Promise(function (resolve, reject) {\n var _a;\n var script = window.document.createElement('script');\n script.type = 'text/javascript';\n script.src = src;\n script.async = true;\n script.setAttribute('status', 'loading');\n for (var _i = 0, _b = Object.entries(attributes !== null && attributes !== void 0 ? attributes : {}); _i < _b.length; _i++) {\n var _c = _b[_i], k = _c[0], v = _c[1];\n script.setAttribute(k, v);\n }\n script.onload = function () {\n script.onerror = script.onload = null;\n script.setAttribute('status', 'loaded');\n resolve(script);\n };\n script.onerror = function () {\n script.onerror = script.onload = null;\n script.setAttribute('status', 'error');\n reject(new Error(\"Failed to load \".concat(src)));\n };\n var tag = window.document.getElementsByTagName('script')[0];\n (_a = tag.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(script, tag);\n });\n}\nexport function unloadScript(src) {\n var found = findScript(src);\n if (found !== undefined) {\n found.remove();\n }\n return Promise.resolve();\n}\n//# sourceMappingURL=load-script.js.map","import { __assign } from \"tslib\";\n/**\n * Merge legacy settings and initialized Integration option overrides.\n *\n * This will merge any options that were passed from initialization into\n * overrides for settings that are returned by the Segment CDN.\n *\n * i.e. this allows for passing options directly into destinations from\n * the Analytics constructor.\n */\nexport function mergedOptions(settings, options) {\n var _a;\n var optionOverrides = Object.entries((_a = options.integrations) !== null && _a !== void 0 ? _a : {}).reduce(function (overrides, _a) {\n var _b, _c;\n var integration = _a[0], options = _a[1];\n if (typeof options === 'object') {\n return __assign(__assign({}, overrides), (_b = {}, _b[integration] = options, _b));\n }\n return __assign(__assign({}, overrides), (_c = {}, _c[integration] = {}, _c));\n }, {});\n return Object.entries(settings.integrations).reduce(function (integrationSettings, _a) {\n var _b;\n var integration = _a[0], settings = _a[1];\n return __assign(__assign({}, integrationSettings), (_b = {}, _b[integration] = __assign(__assign({}, settings), optionOverrides[integration]), _b));\n }, {});\n}\n//# sourceMappingURL=merged-options.js.map","import { __awaiter, __generator } from \"tslib\";\nexport var pWhile = function (condition, action) { return __awaiter(void 0, void 0, void 0, function () {\n var loop;\n return __generator(this, function (_a) {\n loop = function (actionResult) { return __awaiter(void 0, void 0, void 0, function () {\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (!condition(actionResult)) return [3 /*break*/, 2];\n _a = loop;\n return [4 /*yield*/, action()];\n case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];\n case 2: return [2 /*return*/];\n }\n });\n }); };\n return [2 /*return*/, loop(undefined)];\n });\n}); };\n//# sourceMappingURL=p-while.js.map","import { getGlobalAnalytics } from './global-analytics-helper';\nimport { embeddedWriteKey } from './embedded-write-key';\nvar analyticsScriptRegex = /(https:\\/\\/.*)\\/analytics\\.js\\/v1\\/(?:.*?)\\/(?:platform|analytics.*)?/;\nvar getCDNUrlFromScriptTag = function () {\n var cdn;\n var scripts = Array.prototype.slice.call(document.querySelectorAll('script'));\n scripts.forEach(function (s) {\n var _a;\n var src = (_a = s.getAttribute('src')) !== null && _a !== void 0 ? _a : '';\n var result = analyticsScriptRegex.exec(src);\n if (result && result[1]) {\n cdn = result[1];\n }\n });\n return cdn;\n};\nvar _globalCDN; // set globalCDN as in-memory singleton\nvar getGlobalCDNUrl = function () {\n var _a;\n var result = _globalCDN !== null && _globalCDN !== void 0 ? _globalCDN : (_a = getGlobalAnalytics()) === null || _a === void 0 ? void 0 : _a._cdn;\n return result;\n};\nexport var setGlobalCDNUrl = function (cdn) {\n var globalAnalytics = getGlobalAnalytics();\n if (globalAnalytics) {\n globalAnalytics._cdn = cdn;\n }\n _globalCDN = cdn;\n};\nexport var getCDN = function () {\n var globalCdnUrl = getGlobalCDNUrl();\n if (globalCdnUrl)\n return globalCdnUrl;\n var cdnFromScriptTag = getCDNUrlFromScriptTag();\n if (cdnFromScriptTag) {\n return cdnFromScriptTag;\n }\n else {\n // it's possible that the CDN is not found in the page because:\n // - the script is loaded through a proxy\n // - the script is removed after execution\n // in this case, we fall back to the default Segment CDN\n return \"https://cdn.segment.com\";\n }\n};\nexport var getNextIntegrationsURL = function () {\n var cdn = getCDN();\n return \"\".concat(cdn, \"/next-integrations\");\n};\n/**\n * Replaces the CDN URL in the script tag with the one from Analytics.js 1.0\n *\n * @returns the path to Analytics JS 1.0\n **/\nexport function getLegacyAJSPath() {\n var _a, _b, _c;\n var writeKey = (_a = embeddedWriteKey()) !== null && _a !== void 0 ? _a : (_b = getGlobalAnalytics()) === null || _b === void 0 ? void 0 : _b._writeKey;\n var scripts = Array.prototype.slice.call(document.querySelectorAll('script'));\n var path = undefined;\n for (var _i = 0, scripts_1 = scripts; _i < scripts_1.length; _i++) {\n var s = scripts_1[_i];\n var src = (_c = s.getAttribute('src')) !== null && _c !== void 0 ? _c : '';\n var result = analyticsScriptRegex.exec(src);\n if (result && result[1]) {\n path = src;\n break;\n }\n }\n if (path) {\n return path.replace('analytics.min.js', 'analytics.classic.js');\n }\n return \"https://cdn.segment.com/analytics.js/v1/\".concat(writeKey, \"/analytics.classic.js\");\n}\n//# sourceMappingURL=parse-cdn.js.map","import { __assign, __extends, __spreadArray } from \"tslib\";\nimport { PriorityQueue } from '.';\nimport { Context } from '../../core/context';\nimport { isBrowser } from '../../core/environment';\nvar loc = {\n getItem: function () { },\n setItem: function () { },\n removeItem: function () { },\n};\ntry {\n loc = isBrowser() && window.localStorage ? window.localStorage : loc;\n}\ncatch (err) {\n console.warn('Unable to access localStorage', err);\n}\nfunction persisted(key) {\n var items = loc.getItem(key);\n return (items ? JSON.parse(items) : []).map(function (p) { return new Context(p.event, p.id); });\n}\nfunction persistItems(key, items) {\n var existing = persisted(key);\n var all = __spreadArray(__spreadArray([], items, true), existing, true);\n var merged = all.reduce(function (acc, item) {\n var _a;\n return __assign(__assign({}, acc), (_a = {}, _a[item.id] = item, _a));\n }, {});\n loc.setItem(key, JSON.stringify(Object.values(merged)));\n}\nfunction seen(key) {\n var stored = loc.getItem(key);\n return stored ? JSON.parse(stored) : {};\n}\nfunction persistSeen(key, memory) {\n var stored = seen(key);\n loc.setItem(key, JSON.stringify(__assign(__assign({}, stored), memory)));\n}\nfunction remove(key) {\n loc.removeItem(key);\n}\nvar now = function () { return new Date().getTime(); };\nfunction mutex(key, onUnlock, attempt) {\n if (attempt === void 0) { attempt = 0; }\n var lockTimeout = 50;\n var lockKey = \"persisted-queue:v1:\".concat(key, \":lock\");\n var expired = function (lock) { return new Date().getTime() > lock; };\n var rawLock = loc.getItem(lockKey);\n var lock = rawLock ? JSON.parse(rawLock) : null;\n var allowed = lock === null || expired(lock);\n if (allowed) {\n loc.setItem(lockKey, JSON.stringify(now() + lockTimeout));\n onUnlock();\n loc.removeItem(lockKey);\n return;\n }\n if (!allowed && attempt < 3) {\n setTimeout(function () {\n mutex(key, onUnlock, attempt + 1);\n }, lockTimeout);\n }\n else {\n console.error('Unable to retrieve lock');\n }\n}\nvar PersistedPriorityQueue = /** @class */ (function (_super) {\n __extends(PersistedPriorityQueue, _super);\n function PersistedPriorityQueue(maxAttempts, key) {\n var _this = _super.call(this, maxAttempts, []) || this;\n var itemsKey = \"persisted-queue:v1:\".concat(key, \":items\");\n var seenKey = \"persisted-queue:v1:\".concat(key, \":seen\");\n var saved = [];\n var lastSeen = {};\n mutex(key, function () {\n try {\n saved = persisted(itemsKey);\n lastSeen = seen(seenKey);\n remove(itemsKey);\n remove(seenKey);\n _this.queue = __spreadArray(__spreadArray([], saved, true), _this.queue, true);\n _this.seen = __assign(__assign({}, lastSeen), _this.seen);\n }\n catch (err) {\n console.error(err);\n }\n });\n window.addEventListener('pagehide', function () {\n // we deliberately want to use the less powerful 'pagehide' API to only persist on events where the analytics instance gets destroyed, and not on tab away.\n if (_this.todo > 0) {\n var items_1 = __spreadArray(__spreadArray([], _this.queue, true), _this.future, true);\n try {\n mutex(key, function () {\n persistItems(itemsKey, items_1);\n persistSeen(seenKey, _this.seen);\n });\n }\n catch (err) {\n console.error(err);\n }\n }\n });\n return _this;\n }\n return PersistedPriorityQueue;\n}(PriorityQueue));\nexport { PersistedPriorityQueue };\n//# sourceMappingURL=persisted.js.map","import { Alias, Facade, Group, Identify, Page, Screen, Track, } from '@segment/facade';\nexport function toFacade(evt, options) {\n var fcd = new Facade(evt, options);\n if (evt.type === 'track') {\n fcd = new Track(evt, options);\n }\n if (evt.type === 'identify') {\n fcd = new Identify(evt, options);\n }\n if (evt.type === 'page') {\n fcd = new Page(evt, options);\n }\n if (evt.type === 'alias') {\n fcd = new Alias(evt, options);\n }\n if (evt.type === 'group') {\n fcd = new Group(evt, options);\n }\n if (evt.type === 'screen') {\n fcd = new Screen(evt, options);\n }\n Object.defineProperty(fcd, 'obj', {\n value: evt,\n writable: true,\n });\n return fcd;\n}\n//# sourceMappingURL=to-facade.js.map","// Default value will be updated to 'web' in `bundle-umd.ts` for web build.\nvar _version = 'npm';\nexport function setVersionType(version) {\n _version = version;\n}\nexport function getVersionType() {\n return _version;\n}\n//# sourceMappingURL=version-type.js.map","import { __assign, __awaiter, __generator } from \"tslib\";\nimport { ContextCancelation } from '../../core/context';\nimport { toFacade } from '../../lib/to-facade';\nexport function applyDestinationMiddleware(destination, evt, middleware) {\n return __awaiter(this, void 0, void 0, function () {\n function applyMiddleware(event, fn) {\n return __awaiter(this, void 0, void 0, function () {\n var nextCalled, returnedEvent;\n var _a;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n nextCalled = false;\n returnedEvent = null;\n return [4 /*yield*/, fn({\n payload: toFacade(event, {\n clone: true,\n traverse: false,\n }),\n integration: destination,\n next: function (evt) {\n nextCalled = true;\n if (evt === null) {\n returnedEvent = null;\n }\n if (evt) {\n returnedEvent = evt.obj;\n }\n },\n })];\n case 1:\n _b.sent();\n if (!nextCalled && returnedEvent !== null) {\n returnedEvent = returnedEvent;\n returnedEvent.integrations = __assign(__assign({}, event.integrations), (_a = {}, _a[destination] = false, _a));\n }\n return [2 /*return*/, returnedEvent];\n }\n });\n });\n }\n var modifiedEvent, _i, middleware_1, md, result;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n modifiedEvent = toFacade(evt, {\n clone: true,\n traverse: false,\n }).rawEvent();\n _i = 0, middleware_1 = middleware;\n _a.label = 1;\n case 1:\n if (!(_i < middleware_1.length)) return [3 /*break*/, 4];\n md = middleware_1[_i];\n return [4 /*yield*/, applyMiddleware(modifiedEvent, md)];\n case 2:\n result = _a.sent();\n if (result === null) {\n return [2 /*return*/, null];\n }\n modifiedEvent = result;\n _a.label = 3;\n case 3:\n _i++;\n return [3 /*break*/, 1];\n case 4: return [2 /*return*/, modifiedEvent];\n }\n });\n });\n}\nexport function sourceMiddlewarePlugin(fn, integrations) {\n function apply(ctx) {\n return __awaiter(this, void 0, void 0, function () {\n var nextCalled;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n nextCalled = false;\n return [4 /*yield*/, fn({\n payload: toFacade(ctx.event, {\n clone: true,\n traverse: false,\n }),\n integrations: integrations !== null && integrations !== void 0 ? integrations : {},\n next: function (evt) {\n nextCalled = true;\n if (evt) {\n ctx.event = evt.obj;\n }\n },\n })];\n case 1:\n _a.sent();\n if (!nextCalled) {\n throw new ContextCancelation({\n retry: false,\n type: 'middleware_cancellation',\n reason: 'Middleware `next` function skipped',\n });\n }\n return [2 /*return*/, ctx];\n }\n });\n });\n }\n return {\n name: \"Source Middleware \".concat(fn.name),\n type: 'before',\n version: '0.1.0',\n isLoaded: function () { return true; },\n load: function (ctx) { return Promise.resolve(ctx); },\n track: apply,\n page: apply,\n identify: apply,\n alias: apply,\n group: apply,\n };\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar obj_case_1 = __importDefault(require(\"obj-case\"));\nfunction trait(a, b) {\n return function () {\n var traits = this.traits();\n var props = this.properties ? this.properties() : {};\n return (obj_case_1.default(traits, \"address.\" + a) ||\n obj_case_1.default(traits, a) ||\n (b ? obj_case_1.default(traits, \"address.\" + b) : null) ||\n (b ? obj_case_1.default(traits, b) : null) ||\n obj_case_1.default(props, \"address.\" + a) ||\n obj_case_1.default(props, a) ||\n (b ? obj_case_1.default(props, \"address.\" + b) : null) ||\n (b ? obj_case_1.default(props, b) : null));\n };\n}\nfunction default_1(proto) {\n proto.zip = trait(\"postalCode\", \"zip\");\n proto.country = trait(\"country\");\n proto.street = trait(\"street\");\n proto.state = trait(\"state\");\n proto.city = trait(\"city\");\n proto.region = trait(\"region\");\n}\nexports.default = default_1;\n//# sourceMappingURL=address.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Alias = void 0;\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar facade_1 = require(\"./facade\");\nfunction Alias(dictionary, opts) {\n facade_1.Facade.call(this, dictionary, opts);\n}\nexports.Alias = Alias;\ninherits_1.default(Alias, facade_1.Facade);\nAlias.prototype.action = function () {\n return \"alias\";\n};\nAlias.prototype.type = Alias.prototype.action;\nAlias.prototype.previousId = function () {\n return this.field(\"previousId\") || this.field(\"from\");\n};\nAlias.prototype.from = Alias.prototype.previousId;\nAlias.prototype.userId = function () {\n return this.field(\"userId\") || this.field(\"to\");\n};\nAlias.prototype.to = Alias.prototype.userId;\n//# sourceMappingURL=alias.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clone = void 0;\nfunction clone(properties) {\n if (typeof properties !== 'object')\n return properties;\n if (Object.prototype.toString.call(properties) === '[object Object]') {\n var temp = {};\n for (var key in properties) {\n if (Object.prototype.hasOwnProperty.call(properties, key)) {\n temp[key] = clone(properties[key]);\n }\n }\n return temp;\n }\n else if (Array.isArray(properties)) {\n return properties.map(clone);\n }\n else {\n return properties;\n }\n}\nexports.clone = clone;\n//# sourceMappingURL=clone.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Delete = void 0;\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar facade_1 = require(\"./facade\");\nfunction Delete(dictionary, opts) {\n facade_1.Facade.call(this, dictionary, opts);\n}\nexports.Delete = Delete;\ninherits_1.default(Delete, facade_1.Facade);\nDelete.prototype.type = function () {\n return \"delete\";\n};\n//# sourceMappingURL=delete.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Facade = void 0;\nvar address_1 = __importDefault(require(\"./address\"));\nvar clone_1 = require(\"./clone\");\nvar is_enabled_1 = __importDefault(require(\"./is-enabled\"));\nvar new_date_1 = __importDefault(require(\"new-date\"));\nvar obj_case_1 = __importDefault(require(\"obj-case\"));\nvar isodate_traverse_1 = __importDefault(require(\"@segment/isodate-traverse\"));\nfunction Facade(obj, opts) {\n opts = opts || {};\n this.raw = clone_1.clone(obj);\n if (!(\"clone\" in opts))\n opts.clone = true;\n if (opts.clone)\n obj = clone_1.clone(obj);\n if (!(\"traverse\" in opts))\n opts.traverse = true;\n if (!(\"timestamp\" in obj))\n obj.timestamp = new Date();\n else\n obj.timestamp = new_date_1.default(obj.timestamp);\n if (opts.traverse)\n isodate_traverse_1.default(obj);\n this.opts = opts;\n this.obj = obj;\n}\nexports.Facade = Facade;\nvar f = Facade.prototype;\nf.proxy = function (field) {\n var fields = field.split(\".\");\n field = fields.shift();\n var obj = this[field] || this.obj[field];\n if (!obj)\n return obj;\n if (typeof obj === \"function\")\n obj = obj.call(this) || {};\n if (fields.length === 0)\n return this.opts.clone ? transform(obj) : obj;\n obj = obj_case_1.default(obj, fields.join(\".\"));\n return this.opts.clone ? transform(obj) : obj;\n};\nf.field = function (field) {\n var obj = this.obj[field];\n return this.opts.clone ? transform(obj) : obj;\n};\nFacade.proxy = function (field) {\n return function () {\n return this.proxy(field);\n };\n};\nFacade.field = function (field) {\n return function () {\n return this.field(field);\n };\n};\nFacade.multi = function (path) {\n return function () {\n var multi = this.proxy(path + \"s\");\n if (Array.isArray(multi))\n return multi;\n var one = this.proxy(path);\n if (one)\n one = [this.opts.clone ? clone_1.clone(one) : one];\n return one || [];\n };\n};\nFacade.one = function (path) {\n return function () {\n var one = this.proxy(path);\n if (one)\n return one;\n var multi = this.proxy(path + \"s\");\n if (Array.isArray(multi))\n return multi[0];\n };\n};\nf.json = function () {\n var ret = this.opts.clone ? clone_1.clone(this.obj) : this.obj;\n if (this.type)\n ret.type = this.type();\n return ret;\n};\nf.rawEvent = function () {\n return this.raw;\n};\nf.options = function (integration) {\n var obj = this.obj.options || this.obj.context || {};\n var options = this.opts.clone ? clone_1.clone(obj) : obj;\n if (!integration)\n return options;\n if (!this.enabled(integration))\n return;\n var integrations = this.integrations();\n var value = integrations[integration] || obj_case_1.default(integrations, integration);\n if (typeof value !== \"object\")\n value = obj_case_1.default(this.options(), integration);\n return typeof value === \"object\" ? value : {};\n};\nf.context = f.options;\nf.enabled = function (integration) {\n var allEnabled = this.proxy(\"options.providers.all\");\n if (typeof allEnabled !== \"boolean\")\n allEnabled = this.proxy(\"options.all\");\n if (typeof allEnabled !== \"boolean\")\n allEnabled = this.proxy(\"integrations.all\");\n if (typeof allEnabled !== \"boolean\")\n allEnabled = true;\n var enabled = allEnabled && is_enabled_1.default(integration);\n var options = this.integrations();\n if (options.providers && options.providers.hasOwnProperty(integration)) {\n enabled = options.providers[integration];\n }\n if (options.hasOwnProperty(integration)) {\n var settings = options[integration];\n if (typeof settings === \"boolean\") {\n enabled = settings;\n }\n else {\n enabled = true;\n }\n }\n return !!enabled;\n};\nf.integrations = function () {\n return (this.obj.integrations || this.proxy(\"options.providers\") || this.options());\n};\nf.active = function () {\n var active = this.proxy(\"options.active\");\n if (active === null || active === undefined)\n active = true;\n return active;\n};\nf.anonymousId = function () {\n return this.field(\"anonymousId\") || this.field(\"sessionId\");\n};\nf.sessionId = f.anonymousId;\nf.groupId = Facade.proxy(\"options.groupId\");\nf.traits = function (aliases) {\n var ret = this.proxy(\"options.traits\") || {};\n var id = this.userId();\n aliases = aliases || {};\n if (id)\n ret.id = id;\n for (var alias in aliases) {\n if (Object.prototype.hasOwnProperty.call(aliases, alias)) {\n var value = this[alias] == null\n ? this.proxy(\"options.traits.\" + alias)\n : this[alias]();\n if (value == null)\n continue;\n ret[aliases[alias]] = value;\n delete ret[alias];\n }\n }\n return ret;\n};\nf.library = function () {\n var library = this.proxy(\"options.library\");\n if (!library)\n return { name: \"unknown\", version: null };\n if (typeof library === \"string\")\n return { name: library, version: null };\n return library;\n};\nf.device = function () {\n var device = this.proxy(\"context.device\");\n if (typeof device !== \"object\" || device === null) {\n device = {};\n }\n var library = this.library().name;\n if (device.type)\n return device;\n if (library.indexOf(\"ios\") > -1)\n device.type = \"ios\";\n if (library.indexOf(\"android\") > -1)\n device.type = \"android\";\n return device;\n};\nf.userAgent = Facade.proxy(\"context.userAgent\");\nf.timezone = Facade.proxy(\"context.timezone\");\nf.timestamp = Facade.field(\"timestamp\");\nf.channel = Facade.field(\"channel\");\nf.ip = Facade.proxy(\"context.ip\");\nf.userId = Facade.field(\"userId\");\naddress_1.default(f);\nfunction transform(obj) {\n return clone_1.clone(obj);\n}\n//# sourceMappingURL=facade.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Group = void 0;\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar is_email_1 = __importDefault(require(\"./is-email\"));\nvar new_date_1 = __importDefault(require(\"new-date\"));\nvar facade_1 = require(\"./facade\");\nfunction Group(dictionary, opts) {\n facade_1.Facade.call(this, dictionary, opts);\n}\nexports.Group = Group;\ninherits_1.default(Group, facade_1.Facade);\nvar g = Group.prototype;\ng.action = function () {\n return \"group\";\n};\ng.type = g.action;\ng.groupId = facade_1.Facade.field(\"groupId\");\ng.created = function () {\n var created = this.proxy(\"traits.createdAt\") ||\n this.proxy(\"traits.created\") ||\n this.proxy(\"properties.createdAt\") ||\n this.proxy(\"properties.created\");\n if (created)\n return new_date_1.default(created);\n};\ng.email = function () {\n var email = this.proxy(\"traits.email\");\n if (email)\n return email;\n var groupId = this.groupId();\n if (is_email_1.default(groupId))\n return groupId;\n};\ng.traits = function (aliases) {\n var ret = this.properties();\n var id = this.groupId();\n aliases = aliases || {};\n if (id)\n ret.id = id;\n for (var alias in aliases) {\n if (Object.prototype.hasOwnProperty.call(aliases, alias)) {\n var value = this[alias] == null\n ? this.proxy(\"traits.\" + alias)\n : this[alias]();\n if (value == null)\n continue;\n ret[aliases[alias]] = value;\n delete ret[alias];\n }\n }\n return ret;\n};\ng.name = facade_1.Facade.proxy(\"traits.name\");\ng.industry = facade_1.Facade.proxy(\"traits.industry\");\ng.employees = facade_1.Facade.proxy(\"traits.employees\");\ng.properties = function () {\n return this.field(\"traits\") || this.field(\"properties\") || {};\n};\n//# sourceMappingURL=group.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Identify = void 0;\nvar facade_1 = require(\"./facade\");\nvar obj_case_1 = __importDefault(require(\"obj-case\"));\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar is_email_1 = __importDefault(require(\"./is-email\"));\nvar new_date_1 = __importDefault(require(\"new-date\"));\nvar trim = function (str) { return str.trim(); };\nfunction Identify(dictionary, opts) {\n facade_1.Facade.call(this, dictionary, opts);\n}\nexports.Identify = Identify;\ninherits_1.default(Identify, facade_1.Facade);\nvar i = Identify.prototype;\ni.action = function () {\n return \"identify\";\n};\ni.type = i.action;\ni.traits = function (aliases) {\n var ret = this.field(\"traits\") || {};\n var id = this.userId();\n aliases = aliases || {};\n if (id)\n ret.id = id;\n for (var alias in aliases) {\n var value = this[alias] == null ? this.proxy(\"traits.\" + alias) : this[alias]();\n if (value == null)\n continue;\n ret[aliases[alias]] = value;\n if (alias !== aliases[alias])\n delete ret[alias];\n }\n return ret;\n};\ni.email = function () {\n var email = this.proxy(\"traits.email\");\n if (email)\n return email;\n var userId = this.userId();\n if (is_email_1.default(userId))\n return userId;\n};\ni.created = function () {\n var created = this.proxy(\"traits.created\") || this.proxy(\"traits.createdAt\");\n if (created)\n return new_date_1.default(created);\n};\ni.companyCreated = function () {\n var created = this.proxy(\"traits.company.created\") ||\n this.proxy(\"traits.company.createdAt\");\n if (created) {\n return new_date_1.default(created);\n }\n};\ni.companyName = function () {\n return this.proxy(\"traits.company.name\");\n};\ni.name = function () {\n var name = this.proxy(\"traits.name\");\n if (typeof name === \"string\") {\n return trim(name);\n }\n var firstName = this.firstName();\n var lastName = this.lastName();\n if (firstName && lastName) {\n return trim(firstName + \" \" + lastName);\n }\n};\ni.firstName = function () {\n var firstName = this.proxy(\"traits.firstName\");\n if (typeof firstName === \"string\") {\n return trim(firstName);\n }\n var name = this.proxy(\"traits.name\");\n if (typeof name === \"string\") {\n return trim(name).split(\" \")[0];\n }\n};\ni.lastName = function () {\n var lastName = this.proxy(\"traits.lastName\");\n if (typeof lastName === \"string\") {\n return trim(lastName);\n }\n var name = this.proxy(\"traits.name\");\n if (typeof name !== \"string\") {\n return;\n }\n var space = trim(name).indexOf(\" \");\n if (space === -1) {\n return;\n }\n return trim(name.substr(space + 1));\n};\ni.uid = function () {\n return this.userId() || this.username() || this.email();\n};\ni.description = function () {\n return this.proxy(\"traits.description\") || this.proxy(\"traits.background\");\n};\ni.age = function () {\n var date = this.birthday();\n var age = obj_case_1.default(this.traits(), \"age\");\n if (age != null)\n return age;\n if (!(date instanceof Date))\n return;\n var now = new Date();\n return now.getFullYear() - date.getFullYear();\n};\ni.avatar = function () {\n var traits = this.traits();\n return (obj_case_1.default(traits, \"avatar\") || obj_case_1.default(traits, \"photoUrl\") || obj_case_1.default(traits, \"avatarUrl\"));\n};\ni.position = function () {\n var traits = this.traits();\n return obj_case_1.default(traits, \"position\") || obj_case_1.default(traits, \"jobTitle\");\n};\ni.username = facade_1.Facade.proxy(\"traits.username\");\ni.website = facade_1.Facade.one(\"traits.website\");\ni.websites = facade_1.Facade.multi(\"traits.website\");\ni.phone = facade_1.Facade.one(\"traits.phone\");\ni.phones = facade_1.Facade.multi(\"traits.phone\");\ni.address = facade_1.Facade.proxy(\"traits.address\");\ni.gender = facade_1.Facade.proxy(\"traits.gender\");\ni.birthday = facade_1.Facade.proxy(\"traits.birthday\");\n//# sourceMappingURL=identify.js.map","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Delete = exports.Screen = exports.Page = exports.Track = exports.Identify = exports.Group = exports.Alias = exports.Facade = void 0;\nvar facade_1 = require(\"./facade\");\nObject.defineProperty(exports, \"Facade\", { enumerable: true, get: function () { return facade_1.Facade; } });\nvar alias_1 = require(\"./alias\");\nObject.defineProperty(exports, \"Alias\", { enumerable: true, get: function () { return alias_1.Alias; } });\nvar group_1 = require(\"./group\");\nObject.defineProperty(exports, \"Group\", { enumerable: true, get: function () { return group_1.Group; } });\nvar identify_1 = require(\"./identify\");\nObject.defineProperty(exports, \"Identify\", { enumerable: true, get: function () { return identify_1.Identify; } });\nvar track_1 = require(\"./track\");\nObject.defineProperty(exports, \"Track\", { enumerable: true, get: function () { return track_1.Track; } });\nvar page_1 = require(\"./page\");\nObject.defineProperty(exports, \"Page\", { enumerable: true, get: function () { return page_1.Page; } });\nvar screen_1 = require(\"./screen\");\nObject.defineProperty(exports, \"Screen\", { enumerable: true, get: function () { return screen_1.Screen; } });\nvar delete_1 = require(\"./delete\");\nObject.defineProperty(exports, \"Delete\", { enumerable: true, get: function () { return delete_1.Delete; } });\nexports.default = __assign(__assign({}, facade_1.Facade), { Alias: alias_1.Alias,\n Group: group_1.Group,\n Identify: identify_1.Identify,\n Track: track_1.Track,\n Page: page_1.Page,\n Screen: screen_1.Screen,\n Delete: delete_1.Delete });\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar matcher = /.+\\@.+\\..+/;\nfunction isEmail(string) {\n return matcher.test(string);\n}\nexports.default = isEmail;\n//# sourceMappingURL=is-email.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar disabled = {\n Salesforce: true,\n};\nfunction default_1(integration) {\n return !disabled[integration];\n}\nexports.default = default_1;\n//# sourceMappingURL=is-enabled.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Page = void 0;\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar facade_1 = require(\"./facade\");\nvar track_1 = require(\"./track\");\nvar is_email_1 = __importDefault(require(\"./is-email\"));\nfunction Page(dictionary, opts) {\n facade_1.Facade.call(this, dictionary, opts);\n}\nexports.Page = Page;\ninherits_1.default(Page, facade_1.Facade);\nvar p = Page.prototype;\np.action = function () {\n return \"page\";\n};\np.type = p.action;\np.category = facade_1.Facade.field(\"category\");\np.name = facade_1.Facade.field(\"name\");\np.title = facade_1.Facade.proxy(\"properties.title\");\np.path = facade_1.Facade.proxy(\"properties.path\");\np.url = facade_1.Facade.proxy(\"properties.url\");\np.referrer = function () {\n return (this.proxy(\"context.referrer.url\") ||\n this.proxy(\"context.page.referrer\") ||\n this.proxy(\"properties.referrer\"));\n};\np.properties = function (aliases) {\n var props = this.field(\"properties\") || {};\n var category = this.category();\n var name = this.name();\n aliases = aliases || {};\n if (category)\n props.category = category;\n if (name)\n props.name = name;\n for (var alias in aliases) {\n if (Object.prototype.hasOwnProperty.call(aliases, alias)) {\n var value = this[alias] == null\n ? this.proxy(\"properties.\" + alias)\n : this[alias]();\n if (value == null)\n continue;\n props[aliases[alias]] = value;\n if (alias !== aliases[alias])\n delete props[alias];\n }\n }\n return props;\n};\np.email = function () {\n var email = this.proxy(\"context.traits.email\") || this.proxy(\"properties.email\");\n if (email)\n return email;\n var userId = this.userId();\n if (is_email_1.default(userId))\n return userId;\n};\np.fullName = function () {\n var category = this.category();\n var name = this.name();\n return name && category ? category + \" \" + name : name;\n};\np.event = function (name) {\n return name ? \"Viewed \" + name + \" Page\" : \"Loaded a Page\";\n};\np.track = function (name) {\n var json = this.json();\n json.event = this.event(name);\n json.timestamp = this.timestamp();\n json.properties = this.properties();\n return new track_1.Track(json, this.opts);\n};\n//# sourceMappingURL=page.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Screen = void 0;\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar page_1 = require(\"./page\");\nvar track_1 = require(\"./track\");\nfunction Screen(dictionary, opts) {\n page_1.Page.call(this, dictionary, opts);\n}\nexports.Screen = Screen;\ninherits_1.default(Screen, page_1.Page);\nScreen.prototype.action = function () {\n return \"screen\";\n};\nScreen.prototype.type = Screen.prototype.action;\nScreen.prototype.event = function (name) {\n return name ? \"Viewed \" + name + \" Screen\" : \"Loaded a Screen\";\n};\nScreen.prototype.track = function (name) {\n var json = this.json();\n json.event = this.event(name);\n json.timestamp = this.timestamp();\n json.properties = this.properties();\n return new track_1.Track(json, this.opts);\n};\n//# sourceMappingURL=screen.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Track = void 0;\nvar inherits_1 = __importDefault(require(\"inherits\"));\nvar facade_1 = require(\"./facade\");\nvar identify_1 = require(\"./identify\");\nvar is_email_1 = __importDefault(require(\"./is-email\"));\nvar obj_case_1 = __importDefault(require(\"obj-case\"));\nfunction Track(dictionary, opts) {\n facade_1.Facade.call(this, dictionary, opts);\n}\nexports.Track = Track;\ninherits_1.default(Track, facade_1.Facade);\nvar t = Track.prototype;\nt.action = function () {\n return \"track\";\n};\nt.type = t.action;\nt.event = facade_1.Facade.field(\"event\");\nt.value = facade_1.Facade.proxy(\"properties.value\");\nt.category = facade_1.Facade.proxy(\"properties.category\");\nt.id = facade_1.Facade.proxy(\"properties.id\");\nt.productId = function () {\n return (this.proxy(\"properties.product_id\") || this.proxy(\"properties.productId\"));\n};\nt.promotionId = function () {\n return (this.proxy(\"properties.promotion_id\") ||\n this.proxy(\"properties.promotionId\"));\n};\nt.cartId = function () {\n return this.proxy(\"properties.cart_id\") || this.proxy(\"properties.cartId\");\n};\nt.checkoutId = function () {\n return (this.proxy(\"properties.checkout_id\") || this.proxy(\"properties.checkoutId\"));\n};\nt.paymentId = function () {\n return (this.proxy(\"properties.payment_id\") || this.proxy(\"properties.paymentId\"));\n};\nt.couponId = function () {\n return (this.proxy(\"properties.coupon_id\") || this.proxy(\"properties.couponId\"));\n};\nt.wishlistId = function () {\n return (this.proxy(\"properties.wishlist_id\") || this.proxy(\"properties.wishlistId\"));\n};\nt.reviewId = function () {\n return (this.proxy(\"properties.review_id\") || this.proxy(\"properties.reviewId\"));\n};\nt.orderId = function () {\n return (this.proxy(\"properties.id\") ||\n this.proxy(\"properties.order_id\") ||\n this.proxy(\"properties.orderId\"));\n};\nt.sku = facade_1.Facade.proxy(\"properties.sku\");\nt.tax = facade_1.Facade.proxy(\"properties.tax\");\nt.name = facade_1.Facade.proxy(\"properties.name\");\nt.price = facade_1.Facade.proxy(\"properties.price\");\nt.total = facade_1.Facade.proxy(\"properties.total\");\nt.repeat = facade_1.Facade.proxy(\"properties.repeat\");\nt.coupon = facade_1.Facade.proxy(\"properties.coupon\");\nt.shipping = facade_1.Facade.proxy(\"properties.shipping\");\nt.discount = facade_1.Facade.proxy(\"properties.discount\");\nt.shippingMethod = function () {\n return (this.proxy(\"properties.shipping_method\") ||\n this.proxy(\"properties.shippingMethod\"));\n};\nt.paymentMethod = function () {\n return (this.proxy(\"properties.payment_method\") ||\n this.proxy(\"properties.paymentMethod\"));\n};\nt.description = facade_1.Facade.proxy(\"properties.description\");\nt.plan = facade_1.Facade.proxy(\"properties.plan\");\nt.subtotal = function () {\n var subtotal = obj_case_1.default(this.properties(), \"subtotal\");\n var total = this.total() || this.revenue();\n if (subtotal)\n return subtotal;\n if (!total)\n return 0;\n if (this.total()) {\n var n = this.tax();\n if (n)\n total -= n;\n n = this.shipping();\n if (n)\n total -= n;\n n = this.discount();\n if (n)\n total += n;\n }\n return total;\n};\nt.products = function () {\n var props = this.properties();\n var products = obj_case_1.default(props, \"products\");\n if (Array.isArray(products)) {\n return products.filter(function (item) { return item !== null; });\n }\n return [];\n};\nt.quantity = function () {\n var props = this.obj.properties || {};\n return props.quantity || 1;\n};\nt.currency = function () {\n var props = this.obj.properties || {};\n return props.currency || \"USD\";\n};\nt.referrer = function () {\n return (this.proxy(\"context.referrer.url\") ||\n this.proxy(\"context.page.referrer\") ||\n this.proxy(\"properties.referrer\"));\n};\nt.query = facade_1.Facade.proxy(\"options.query\");\nt.properties = function (aliases) {\n var ret = this.field(\"properties\") || {};\n aliases = aliases || {};\n for (var alias in aliases) {\n if (Object.prototype.hasOwnProperty.call(aliases, alias)) {\n var value = this[alias] == null\n ? this.proxy(\"properties.\" + alias)\n : this[alias]();\n if (value == null)\n continue;\n ret[aliases[alias]] = value;\n delete ret[alias];\n }\n }\n return ret;\n};\nt.username = function () {\n return (this.proxy(\"traits.username\") ||\n this.proxy(\"properties.username\") ||\n this.userId() ||\n this.sessionId());\n};\nt.email = function () {\n var email = this.proxy(\"traits.email\") ||\n this.proxy(\"properties.email\") ||\n this.proxy(\"options.traits.email\");\n if (email)\n return email;\n var userId = this.userId();\n if (is_email_1.default(userId))\n return userId;\n};\nt.revenue = function () {\n var revenue = this.proxy(\"properties.revenue\");\n var event = this.event();\n var orderCompletedRegExp = /^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;\n if (!revenue && event && event.match(orderCompletedRegExp)) {\n revenue = this.proxy(\"properties.total\");\n }\n return currency(revenue);\n};\nt.cents = function () {\n var revenue = this.revenue();\n return typeof revenue !== \"number\" ? this.value() || 0 : revenue * 100;\n};\nt.identify = function () {\n var json = this.json();\n json.traits = this.traits();\n return new identify_1.Identify(json, this.opts);\n};\nfunction currency(val) {\n if (!val)\n return;\n if (typeof val === \"number\") {\n return val;\n }\n if (typeof val !== \"string\") {\n return;\n }\n val = val.replace(/\\$/g, \"\");\n val = parseFloat(val);\n if (!isNaN(val)) {\n return val;\n }\n}\n//# sourceMappingURL=track.js.map","'use strict';\n\nvar isodate = require('@segment/isodate');\n\n/**\n * Expose `traverse`.\n */\nmodule.exports = traverse;\n\n/**\n * Recursively traverse an object or array, and convert\n * all ISO date strings parse into Date objects.\n *\n * @param {Object} input - object, array, or string to convert\n * @param {Boolean} strict - only convert strings with year, month, and date\n * @return {Object}\n */\nfunction traverse(input, strict) {\n if (strict === undefined) strict = true;\n if (input && typeof input === 'object') {\n return traverseObject(input, strict);\n } else if (Array.isArray(input)) {\n return traverseArray(input, strict);\n } else if (isodate.is(input, strict)) {\n return isodate.parse(input);\n }\n return input;\n}\n\n/**\n * Object traverser helper function.\n *\n * @param {Object} obj - object to traverse\n * @param {Boolean} strict - only convert strings with year, month, and date\n * @return {Object}\n */\nfunction traverseObject(obj, strict) {\n Object.keys(obj).forEach(function(key) {\n obj[key] = traverse(obj[key], strict);\n });\n return obj;\n}\n\n/**\n * Array traverser helper function\n *\n * @param {Array} arr - array to traverse\n * @param {Boolean} strict - only convert strings with year, month, and date\n * @return {Array}\n */\nfunction traverseArray(arr, strict) {\n arr.forEach(function(value, index) {\n arr[index] = traverse(value, strict);\n });\n return arr;\n}\n","'use strict';\n\n/**\n * Matcher, slightly modified from:\n *\n * https://github.com/csnover/js-iso8601/blob/lax/iso8601.js\n */\n\nvar matcher = /^(\\d{4})(?:-?(\\d{2})(?:-?(\\d{2}))?)?(?:([ T])(\\d{2}):?(\\d{2})(?::?(\\d{2})(?:[,\\.](\\d{1,}))?)?(?:(Z)|([+\\-])(\\d{2})(?::?(\\d{2}))?)?)?$/;\n\n/**\n * Convert an ISO date string to a date. Fallback to native `Date.parse`.\n *\n * https://github.com/csnover/js-iso8601/blob/lax/iso8601.js\n *\n * @param {String} iso\n * @return {Date}\n */\n\nexports.parse = function(iso) {\n var numericKeys = [1, 5, 6, 7, 11, 12];\n var arr = matcher.exec(iso);\n var offset = 0;\n\n // fallback to native parsing\n if (!arr) {\n return new Date(iso);\n }\n\n /* eslint-disable no-cond-assign */\n // remove undefined values\n for (var i = 0, val; val = numericKeys[i]; i++) {\n arr[val] = parseInt(arr[val], 10) || 0;\n }\n /* eslint-enable no-cond-assign */\n\n // allow undefined days and months\n arr[2] = parseInt(arr[2], 10) || 1;\n arr[3] = parseInt(arr[3], 10) || 1;\n\n // month is 0-11\n arr[2]--;\n\n // allow abitrary sub-second precision\n arr[8] = arr[8] ? (arr[8] + '00').substring(0, 3) : 0;\n\n // apply timezone if one exists\n if (arr[4] === ' ') {\n offset = new Date().getTimezoneOffset();\n } else if (arr[9] !== 'Z' && arr[10]) {\n offset = arr[11] * 60 + arr[12];\n if (arr[10] === '+') {\n offset = 0 - offset;\n }\n }\n\n var millis = Date.UTC(arr[1], arr[2], arr[3], arr[5], arr[6] + offset, arr[7], arr[8]);\n return new Date(millis);\n};\n\n\n/**\n * Checks whether a `string` is an ISO date string. `strict` mode requires that\n * the date string at least have a year, month and date.\n *\n * @param {String} string\n * @param {Boolean} strict\n * @return {Boolean}\n */\n\nexports.is = function(string, strict) {\n if (typeof string !== 'string') {\n return false;\n }\n if (strict && (/^\\d{4}-\\d{2}-\\d{2}/).test(string) === false) {\n return false;\n }\n return matcher.test(string);\n};\n","\nconst canPromise = require('./can-promise')\n\nconst QRCode = require('./core/qrcode')\nconst CanvasRenderer = require('./renderer/canvas')\nconst SvgRenderer = require('./renderer/svg-tag.js')\n\nfunction renderCanvas (renderFunc, canvas, text, opts, cb) {\n const args = [].slice.call(arguments, 1)\n const argsNum = args.length\n const isLastArgCb = typeof args[argsNum - 1] === 'function'\n\n if (!isLastArgCb && !canPromise()) {\n throw new Error('Callback required as last argument')\n }\n\n if (isLastArgCb) {\n if (argsNum < 2) {\n throw new Error('Too few arguments provided')\n }\n\n if (argsNum === 2) {\n cb = text\n text = canvas\n canvas = opts = undefined\n } else if (argsNum === 3) {\n if (canvas.getContext && typeof cb === 'undefined') {\n cb = opts\n opts = undefined\n } else {\n cb = opts\n opts = text\n text = canvas\n canvas = undefined\n }\n }\n } else {\n if (argsNum < 1) {\n throw new Error('Too few arguments provided')\n }\n\n if (argsNum === 1) {\n text = canvas\n canvas = opts = undefined\n } else if (argsNum === 2 && !canvas.getContext) {\n opts = text\n text = canvas\n canvas = undefined\n }\n\n return new Promise(function (resolve, reject) {\n try {\n const data = QRCode.create(text, opts)\n resolve(renderFunc(data, canvas, opts))\n } catch (e) {\n reject(e)\n }\n })\n }\n\n try {\n const data = QRCode.create(text, opts)\n cb(null, renderFunc(data, canvas, opts))\n } catch (e) {\n cb(e)\n }\n}\n\nexports.create = QRCode.create\nexports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render)\nexports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL)\n\n// only svg for now.\nexports.toString = renderCanvas.bind(null, function (data, _, opts) {\n return SvgRenderer.render(data, opts)\n})\n","// can-promise has a crash in some versions of react native that dont have\n// standard global objects\n// https://github.com/soldair/node-qrcode/issues/157\n\nmodule.exports = function () {\n return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then\n}\n","/**\n * Alignment pattern are fixed reference pattern in defined positions\n * in a matrix symbology, which enables the decode software to re-synchronise\n * the coordinate mapping of the image modules in the event of moderate amounts\n * of distortion of the image.\n *\n * Alignment patterns are present only in QR Code symbols of version 2 or larger\n * and their number depends on the symbol version.\n */\n\nconst getSymbolSize = require('./utils').getSymbolSize\n\n/**\n * Calculate the row/column coordinates of the center module of each alignment pattern\n * for the specified QR Code version.\n *\n * The alignment patterns are positioned symmetrically on either side of the diagonal\n * running from the top left corner of the symbol to the bottom right corner.\n *\n * Since positions are simmetrical only half of the coordinates are returned.\n * Each item of the array will represent in turn the x and y coordinate.\n * @see {@link getPositions}\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinate\n */\nexports.getRowColCoords = function getRowColCoords (version) {\n if (version === 1) return []\n\n const posCount = Math.floor(version / 7) + 2\n const size = getSymbolSize(version)\n const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2\n const positions = [size - 7] // Last coord is always (size - 7)\n\n for (let i = 1; i < posCount - 1; i++) {\n positions[i] = positions[i - 1] - intervals\n }\n\n positions.push(6) // First coord is always 6\n\n return positions.reverse()\n}\n\n/**\n * Returns an array containing the positions of each alignment pattern.\n * Each array's element represent the center point of the pattern as (x, y) coordinates\n *\n * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords}\n * and filtering out the items that overlaps with finder pattern\n *\n * @example\n * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38.\n * The alignment patterns, therefore, are to be centered on (row, column)\n * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38).\n * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns\n * and are not therefore used for alignment patterns.\n *\n * let pos = getPositions(7)\n * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]]\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const coords = []\n const pos = exports.getRowColCoords(version)\n const posLength = pos.length\n\n for (let i = 0; i < posLength; i++) {\n for (let j = 0; j < posLength; j++) {\n // Skip if position is occupied by finder patterns\n if ((i === 0 && j === 0) || // top-left\n (i === 0 && j === posLength - 1) || // bottom-left\n (i === posLength - 1 && j === 0)) { // top-right\n continue\n }\n\n coords.push([pos[i], pos[j]])\n }\n }\n\n return coords\n}\n","const Mode = require('./mode')\n\n/**\n * Array of characters available in alphanumeric mode\n *\n * As per QR Code specification, to each character\n * is assigned a value from 0 to 44 which in this case coincides\n * with the array index\n *\n * @type {Array}\n */\nconst ALPHA_NUM_CHARS = [\n '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\n 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',\n 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',\n ' ', '$', '%', '*', '+', '-', '.', '/', ':'\n]\n\nfunction AlphanumericData (data) {\n this.mode = Mode.ALPHANUMERIC\n this.data = data\n}\n\nAlphanumericData.getBitsLength = function getBitsLength (length) {\n return 11 * Math.floor(length / 2) + 6 * (length % 2)\n}\n\nAlphanumericData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nAlphanumericData.prototype.getBitsLength = function getBitsLength () {\n return AlphanumericData.getBitsLength(this.data.length)\n}\n\nAlphanumericData.prototype.write = function write (bitBuffer) {\n let i\n\n // Input data characters are divided into groups of two characters\n // and encoded as 11-bit binary codes.\n for (i = 0; i + 2 <= this.data.length; i += 2) {\n // The character value of the first character is multiplied by 45\n let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45\n\n // The character value of the second digit is added to the product\n value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1])\n\n // The sum is then stored as 11-bit binary number\n bitBuffer.put(value, 11)\n }\n\n // If the number of input data characters is not a multiple of two,\n // the character value of the final character is encoded as a 6-bit binary number.\n if (this.data.length % 2) {\n bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6)\n }\n}\n\nmodule.exports = AlphanumericData\n","function BitBuffer () {\n this.buffer = []\n this.length = 0\n}\n\nBitBuffer.prototype = {\n\n get: function (index) {\n const bufIndex = Math.floor(index / 8)\n return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) === 1\n },\n\n put: function (num, length) {\n for (let i = 0; i < length; i++) {\n this.putBit(((num >>> (length - i - 1)) & 1) === 1)\n }\n },\n\n getLengthInBits: function () {\n return this.length\n },\n\n putBit: function (bit) {\n const bufIndex = Math.floor(this.length / 8)\n if (this.buffer.length <= bufIndex) {\n this.buffer.push(0)\n }\n\n if (bit) {\n this.buffer[bufIndex] |= (0x80 >>> (this.length % 8))\n }\n\n this.length++\n }\n}\n\nmodule.exports = BitBuffer\n","/**\n * Helper class to handle QR Code symbol modules\n *\n * @param {Number} size Symbol size\n */\nfunction BitMatrix (size) {\n if (!size || size < 1) {\n throw new Error('BitMatrix size must be defined and greater than 0')\n }\n\n this.size = size\n this.data = new Uint8Array(size * size)\n this.reservedBit = new Uint8Array(size * size)\n}\n\n/**\n * Set bit value at specified location\n * If reserved flag is set, this bit will be ignored during masking process\n *\n * @param {Number} row\n * @param {Number} col\n * @param {Boolean} value\n * @param {Boolean} reserved\n */\nBitMatrix.prototype.set = function (row, col, value, reserved) {\n const index = row * this.size + col\n this.data[index] = value\n if (reserved) this.reservedBit[index] = true\n}\n\n/**\n * Returns bit value at specified location\n *\n * @param {Number} row\n * @param {Number} col\n * @return {Boolean}\n */\nBitMatrix.prototype.get = function (row, col) {\n return this.data[row * this.size + col]\n}\n\n/**\n * Applies xor operator at specified location\n * (used during masking process)\n *\n * @param {Number} row\n * @param {Number} col\n * @param {Boolean} value\n */\nBitMatrix.prototype.xor = function (row, col, value) {\n this.data[row * this.size + col] ^= value\n}\n\n/**\n * Check if bit at specified location is reserved\n *\n * @param {Number} row\n * @param {Number} col\n * @return {Boolean}\n */\nBitMatrix.prototype.isReserved = function (row, col) {\n return this.reservedBit[row * this.size + col]\n}\n\nmodule.exports = BitMatrix\n","const encodeUtf8 = require('encode-utf8')\nconst Mode = require('./mode')\n\nfunction ByteData (data) {\n this.mode = Mode.BYTE\n if (typeof (data) === 'string') {\n data = encodeUtf8(data)\n }\n this.data = new Uint8Array(data)\n}\n\nByteData.getBitsLength = function getBitsLength (length) {\n return length * 8\n}\n\nByteData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nByteData.prototype.getBitsLength = function getBitsLength () {\n return ByteData.getBitsLength(this.data.length)\n}\n\nByteData.prototype.write = function (bitBuffer) {\n for (let i = 0, l = this.data.length; i < l; i++) {\n bitBuffer.put(this.data[i], 8)\n }\n}\n\nmodule.exports = ByteData\n","const ECLevel = require('./error-correction-level')\r\n\r\nconst EC_BLOCKS_TABLE = [\r\n// L M Q H\r\n 1, 1, 1, 1,\r\n 1, 1, 1, 1,\r\n 1, 1, 2, 2,\r\n 1, 2, 2, 4,\r\n 1, 2, 4, 4,\r\n 2, 4, 4, 4,\r\n 2, 4, 6, 5,\r\n 2, 4, 6, 6,\r\n 2, 5, 8, 8,\r\n 4, 5, 8, 8,\r\n 4, 5, 8, 11,\r\n 4, 8, 10, 11,\r\n 4, 9, 12, 16,\r\n 4, 9, 16, 16,\r\n 6, 10, 12, 18,\r\n 6, 10, 17, 16,\r\n 6, 11, 16, 19,\r\n 6, 13, 18, 21,\r\n 7, 14, 21, 25,\r\n 8, 16, 20, 25,\r\n 8, 17, 23, 25,\r\n 9, 17, 23, 34,\r\n 9, 18, 25, 30,\r\n 10, 20, 27, 32,\r\n 12, 21, 29, 35,\r\n 12, 23, 34, 37,\r\n 12, 25, 34, 40,\r\n 13, 26, 35, 42,\r\n 14, 28, 38, 45,\r\n 15, 29, 40, 48,\r\n 16, 31, 43, 51,\r\n 17, 33, 45, 54,\r\n 18, 35, 48, 57,\r\n 19, 37, 51, 60,\r\n 19, 38, 53, 63,\r\n 20, 40, 56, 66,\r\n 21, 43, 59, 70,\r\n 22, 45, 62, 74,\r\n 24, 47, 65, 77,\r\n 25, 49, 68, 81\r\n]\r\n\r\nconst EC_CODEWORDS_TABLE = [\r\n// L M Q H\r\n 7, 10, 13, 17,\r\n 10, 16, 22, 28,\r\n 15, 26, 36, 44,\r\n 20, 36, 52, 64,\r\n 26, 48, 72, 88,\r\n 36, 64, 96, 112,\r\n 40, 72, 108, 130,\r\n 48, 88, 132, 156,\r\n 60, 110, 160, 192,\r\n 72, 130, 192, 224,\r\n 80, 150, 224, 264,\r\n 96, 176, 260, 308,\r\n 104, 198, 288, 352,\r\n 120, 216, 320, 384,\r\n 132, 240, 360, 432,\r\n 144, 280, 408, 480,\r\n 168, 308, 448, 532,\r\n 180, 338, 504, 588,\r\n 196, 364, 546, 650,\r\n 224, 416, 600, 700,\r\n 224, 442, 644, 750,\r\n 252, 476, 690, 816,\r\n 270, 504, 750, 900,\r\n 300, 560, 810, 960,\r\n 312, 588, 870, 1050,\r\n 336, 644, 952, 1110,\r\n 360, 700, 1020, 1200,\r\n 390, 728, 1050, 1260,\r\n 420, 784, 1140, 1350,\r\n 450, 812, 1200, 1440,\r\n 480, 868, 1290, 1530,\r\n 510, 924, 1350, 1620,\r\n 540, 980, 1440, 1710,\r\n 570, 1036, 1530, 1800,\r\n 570, 1064, 1590, 1890,\r\n 600, 1120, 1680, 1980,\r\n 630, 1204, 1770, 2100,\r\n 660, 1260, 1860, 2220,\r\n 720, 1316, 1950, 2310,\r\n 750, 1372, 2040, 2430\r\n]\r\n\r\n/**\r\n * Returns the number of error correction block that the QR Code should contain\r\n * for the specified version and error correction level.\r\n *\r\n * @param {Number} version QR Code version\r\n * @param {Number} errorCorrectionLevel Error correction level\r\n * @return {Number} Number of error correction blocks\r\n */\r\nexports.getBlocksCount = function getBlocksCount (version, errorCorrectionLevel) {\r\n switch (errorCorrectionLevel) {\r\n case ECLevel.L:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]\r\n case ECLevel.M:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]\r\n case ECLevel.Q:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]\r\n case ECLevel.H:\r\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]\r\n default:\r\n return undefined\r\n }\r\n}\r\n\r\n/**\r\n * Returns the number of error correction codewords to use for the specified\r\n * version and error correction level.\r\n *\r\n * @param {Number} version QR Code version\r\n * @param {Number} errorCorrectionLevel Error correction level\r\n * @return {Number} Number of error correction codewords\r\n */\r\nexports.getTotalCodewordsCount = function getTotalCodewordsCount (version, errorCorrectionLevel) {\r\n switch (errorCorrectionLevel) {\r\n case ECLevel.L:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]\r\n case ECLevel.M:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]\r\n case ECLevel.Q:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]\r\n case ECLevel.H:\r\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]\r\n default:\r\n return undefined\r\n }\r\n}\r\n","exports.L = { bit: 1 }\nexports.M = { bit: 0 }\nexports.Q = { bit: 3 }\nexports.H = { bit: 2 }\n\nfunction fromString (string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string')\n }\n\n const lcStr = string.toLowerCase()\n\n switch (lcStr) {\n case 'l':\n case 'low':\n return exports.L\n\n case 'm':\n case 'medium':\n return exports.M\n\n case 'q':\n case 'quartile':\n return exports.Q\n\n case 'h':\n case 'high':\n return exports.H\n\n default:\n throw new Error('Unknown EC Level: ' + string)\n }\n}\n\nexports.isValid = function isValid (level) {\n return level && typeof level.bit !== 'undefined' &&\n level.bit >= 0 && level.bit < 4\n}\n\nexports.from = function from (value, defaultValue) {\n if (exports.isValid(value)) {\n return value\n }\n\n try {\n return fromString(value)\n } catch (e) {\n return defaultValue\n }\n}\n","const getSymbolSize = require('./utils').getSymbolSize\nconst FINDER_PATTERN_SIZE = 7\n\n/**\n * Returns an array containing the positions of each finder pattern.\n * Each array's element represent the top-left point of the pattern as (x, y) coordinates\n *\n * @param {Number} version QR Code version\n * @return {Array} Array of coordinates\n */\nexports.getPositions = function getPositions (version) {\n const size = getSymbolSize(version)\n\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ]\n}\n","const Utils = require('./utils')\n\nconst G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0)\nconst G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1)\nconst G15_BCH = Utils.getBCHDigit(G15)\n\n/**\n * Returns format information with relative error correction bits\n *\n * The format information is a 15-bit sequence containing 5 data bits,\n * with 10 error correction bits calculated using the (15, 5) BCH code.\n *\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Number} mask Mask pattern\n * @return {Number} Encoded format information bits\n */\nexports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {\n const data = ((errorCorrectionLevel.bit << 3) | mask)\n let d = data << 10\n\n while (Utils.getBCHDigit(d) - G15_BCH >= 0) {\n d ^= (G15 << (Utils.getBCHDigit(d) - G15_BCH))\n }\n\n // xor final data with mask pattern in order to ensure that\n // no combination of Error Correction Level and data mask pattern\n // will result in an all-zero data string\n return ((data << 10) | d) ^ G15_MASK\n}\n","const EXP_TABLE = new Uint8Array(512)\nconst LOG_TABLE = new Uint8Array(256)\n/**\n * Precompute the log and anti-log tables for faster computation later\n *\n * For each possible value in the galois field 2^8, we will pre-compute\n * the logarithm and anti-logarithm (exponential) of this value\n *\n * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields}\n */\n;(function initTables () {\n let x = 1\n for (let i = 0; i < 255; i++) {\n EXP_TABLE[i] = x\n LOG_TABLE[x] = i\n\n x <<= 1 // multiply by 2\n\n // The QR code specification says to use byte-wise modulo 100011101 arithmetic.\n // This means that when a number is 256 or larger, it should be XORed with 0x11D.\n if (x & 0x100) { // similar to x >= 256, but a lot faster (because 0x100 == 256)\n x ^= 0x11D\n }\n }\n\n // Optimization: double the size of the anti-log table so that we don't need to mod 255 to\n // stay inside the bounds (because we will mainly use this table for the multiplication of\n // two GF numbers, no more).\n // @see {@link mul}\n for (let i = 255; i < 512; i++) {\n EXP_TABLE[i] = EXP_TABLE[i - 255]\n }\n}())\n\n/**\n * Returns log value of n inside Galois Field\n *\n * @param {Number} n\n * @return {Number}\n */\nexports.log = function log (n) {\n if (n < 1) throw new Error('log(' + n + ')')\n return LOG_TABLE[n]\n}\n\n/**\n * Returns anti-log value of n inside Galois Field\n *\n * @param {Number} n\n * @return {Number}\n */\nexports.exp = function exp (n) {\n return EXP_TABLE[n]\n}\n\n/**\n * Multiplies two number inside Galois Field\n *\n * @param {Number} x\n * @param {Number} y\n * @return {Number}\n */\nexports.mul = function mul (x, y) {\n if (x === 0 || y === 0) return 0\n\n // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized\n // @see {@link initTables}\n return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]\n}\n","const Mode = require('./mode')\nconst Utils = require('./utils')\n\nfunction KanjiData (data) {\n this.mode = Mode.KANJI\n this.data = data\n}\n\nKanjiData.getBitsLength = function getBitsLength (length) {\n return length * 13\n}\n\nKanjiData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nKanjiData.prototype.getBitsLength = function getBitsLength () {\n return KanjiData.getBitsLength(this.data.length)\n}\n\nKanjiData.prototype.write = function (bitBuffer) {\n let i\n\n // In the Shift JIS system, Kanji characters are represented by a two byte combination.\n // These byte values are shifted from the JIS X 0208 values.\n // JIS X 0208 gives details of the shift coded representation.\n for (i = 0; i < this.data.length; i++) {\n let value = Utils.toSJIS(this.data[i])\n\n // For characters with Shift JIS values from 0x8140 to 0x9FFC:\n if (value >= 0x8140 && value <= 0x9FFC) {\n // Subtract 0x8140 from Shift JIS value\n value -= 0x8140\n\n // For characters with Shift JIS values from 0xE040 to 0xEBBF\n } else if (value >= 0xE040 && value <= 0xEBBF) {\n // Subtract 0xC140 from Shift JIS value\n value -= 0xC140\n } else {\n throw new Error(\n 'Invalid SJIS character: ' + this.data[i] + '\\n' +\n 'Make sure your charset is UTF-8')\n }\n\n // Multiply most significant byte of result by 0xC0\n // and add least significant byte to product\n value = (((value >>> 8) & 0xff) * 0xC0) + (value & 0xff)\n\n // Convert result to a 13-bit binary string\n bitBuffer.put(value, 13)\n }\n}\n\nmodule.exports = KanjiData\n","/**\n * Data mask pattern reference\n * @type {Object}\n */\nexports.Patterns = {\n PATTERN000: 0,\n PATTERN001: 1,\n PATTERN010: 2,\n PATTERN011: 3,\n PATTERN100: 4,\n PATTERN101: 5,\n PATTERN110: 6,\n PATTERN111: 7\n}\n\n/**\n * Weighted penalty scores for the undesirable features\n * @type {Object}\n */\nconst PenaltyScores = {\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n}\n\n/**\n * Check if mask pattern value is valid\n *\n * @param {Number} mask Mask pattern\n * @return {Boolean} true if valid, false otherwise\n */\nexports.isValid = function isValid (mask) {\n return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7\n}\n\n/**\n * Returns mask pattern from a value.\n * If value is not valid, returns undefined\n *\n * @param {Number|String} value Mask pattern value\n * @return {Number} Valid mask pattern or undefined\n */\nexports.from = function from (value) {\n return exports.isValid(value) ? parseInt(value, 10) : undefined\n}\n\n/**\n* Find adjacent modules in row/column with the same color\n* and assign a penalty value.\n*\n* Points: N1 + i\n* i is the amount by which the number of adjacent modules of the same color exceeds 5\n*/\nexports.getPenaltyN1 = function getPenaltyN1 (data) {\n const size = data.size\n let points = 0\n let sameCountCol = 0\n let sameCountRow = 0\n let lastCol = null\n let lastRow = null\n\n for (let row = 0; row < size; row++) {\n sameCountCol = sameCountRow = 0\n lastCol = lastRow = null\n\n for (let col = 0; col < size; col++) {\n let module = data.get(row, col)\n if (module === lastCol) {\n sameCountCol++\n } else {\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)\n lastCol = module\n sameCountCol = 1\n }\n\n module = data.get(col, row)\n if (module === lastRow) {\n sameCountRow++\n } else {\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)\n lastRow = module\n sameCountRow = 1\n }\n }\n\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5)\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5)\n }\n\n return points\n}\n\n/**\n * Find 2x2 blocks with the same color and assign a penalty value\n *\n * Points: N2 * (m - 1) * (n - 1)\n */\nexports.getPenaltyN2 = function getPenaltyN2 (data) {\n const size = data.size\n let points = 0\n\n for (let row = 0; row < size - 1; row++) {\n for (let col = 0; col < size - 1; col++) {\n const last = data.get(row, col) +\n data.get(row, col + 1) +\n data.get(row + 1, col) +\n data.get(row + 1, col + 1)\n\n if (last === 4 || last === 0) points++\n }\n }\n\n return points * PenaltyScores.N2\n}\n\n/**\n * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column,\n * preceded or followed by light area 4 modules wide\n *\n * Points: N3 * number of pattern found\n */\nexports.getPenaltyN3 = function getPenaltyN3 (data) {\n const size = data.size\n let points = 0\n let bitsCol = 0\n let bitsRow = 0\n\n for (let row = 0; row < size; row++) {\n bitsCol = bitsRow = 0\n for (let col = 0; col < size; col++) {\n bitsCol = ((bitsCol << 1) & 0x7FF) | data.get(row, col)\n if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++\n\n bitsRow = ((bitsRow << 1) & 0x7FF) | data.get(col, row)\n if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++\n }\n }\n\n return points * PenaltyScores.N3\n}\n\n/**\n * Calculate proportion of dark modules in entire symbol\n *\n * Points: N4 * k\n *\n * k is the rating of the deviation of the proportion of dark modules\n * in the symbol from 50% in steps of 5%\n */\nexports.getPenaltyN4 = function getPenaltyN4 (data) {\n let darkCount = 0\n const modulesCount = data.data.length\n\n for (let i = 0; i < modulesCount; i++) darkCount += data.data[i]\n\n const k = Math.abs(Math.ceil((darkCount * 100 / modulesCount) / 5) - 10)\n\n return k * PenaltyScores.N4\n}\n\n/**\n * Return mask value at given position\n *\n * @param {Number} maskPattern Pattern reference value\n * @param {Number} i Row\n * @param {Number} j Column\n * @return {Boolean} Mask value\n */\nfunction getMaskAt (maskPattern, i, j) {\n switch (maskPattern) {\n case exports.Patterns.PATTERN000: return (i + j) % 2 === 0\n case exports.Patterns.PATTERN001: return i % 2 === 0\n case exports.Patterns.PATTERN010: return j % 3 === 0\n case exports.Patterns.PATTERN011: return (i + j) % 3 === 0\n case exports.Patterns.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0\n case exports.Patterns.PATTERN101: return (i * j) % 2 + (i * j) % 3 === 0\n case exports.Patterns.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 === 0\n case exports.Patterns.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 === 0\n\n default: throw new Error('bad maskPattern:' + maskPattern)\n }\n}\n\n/**\n * Apply a mask pattern to a BitMatrix\n *\n * @param {Number} pattern Pattern reference number\n * @param {BitMatrix} data BitMatrix data\n */\nexports.applyMask = function applyMask (pattern, data) {\n const size = data.size\n\n for (let col = 0; col < size; col++) {\n for (let row = 0; row < size; row++) {\n if (data.isReserved(row, col)) continue\n data.xor(row, col, getMaskAt(pattern, row, col))\n }\n }\n}\n\n/**\n * Returns the best mask pattern for data\n *\n * @param {BitMatrix} data\n * @return {Number} Mask pattern reference number\n */\nexports.getBestMask = function getBestMask (data, setupFormatFunc) {\n const numPatterns = Object.keys(exports.Patterns).length\n let bestPattern = 0\n let lowerPenalty = Infinity\n\n for (let p = 0; p < numPatterns; p++) {\n setupFormatFunc(p)\n exports.applyMask(p, data)\n\n // Calculate penalty\n const penalty =\n exports.getPenaltyN1(data) +\n exports.getPenaltyN2(data) +\n exports.getPenaltyN3(data) +\n exports.getPenaltyN4(data)\n\n // Undo previously applied mask\n exports.applyMask(p, data)\n\n if (penalty < lowerPenalty) {\n lowerPenalty = penalty\n bestPattern = p\n }\n }\n\n return bestPattern\n}\n","const VersionCheck = require('./version-check')\nconst Regex = require('./regex')\n\n/**\n * Numeric mode encodes data from the decimal digit set (0 - 9)\n * (byte values 30HEX to 39HEX).\n * Normally, 3 data characters are represented by 10 bits.\n *\n * @type {Object}\n */\nexports.NUMERIC = {\n id: 'Numeric',\n bit: 1 << 0,\n ccBits: [10, 12, 14]\n}\n\n/**\n * Alphanumeric mode encodes data from a set of 45 characters,\n * i.e. 10 numeric digits (0 - 9),\n * 26 alphabetic characters (A - Z),\n * and 9 symbols (SP, $, %, *, +, -, ., /, :).\n * Normally, two input characters are represented by 11 bits.\n *\n * @type {Object}\n */\nexports.ALPHANUMERIC = {\n id: 'Alphanumeric',\n bit: 1 << 1,\n ccBits: [9, 11, 13]\n}\n\n/**\n * In byte mode, data is encoded at 8 bits per character.\n *\n * @type {Object}\n */\nexports.BYTE = {\n id: 'Byte',\n bit: 1 << 2,\n ccBits: [8, 16, 16]\n}\n\n/**\n * The Kanji mode efficiently encodes Kanji characters in accordance with\n * the Shift JIS system based on JIS X 0208.\n * The Shift JIS values are shifted from the JIS X 0208 values.\n * JIS X 0208 gives details of the shift coded representation.\n * Each two-byte character value is compacted to a 13-bit binary codeword.\n *\n * @type {Object}\n */\nexports.KANJI = {\n id: 'Kanji',\n bit: 1 << 3,\n ccBits: [8, 10, 12]\n}\n\n/**\n * Mixed mode will contain a sequences of data in a combination of any of\n * the modes described above\n *\n * @type {Object}\n */\nexports.MIXED = {\n bit: -1\n}\n\n/**\n * Returns the number of bits needed to store the data length\n * according to QR Code specifications.\n *\n * @param {Mode} mode Data mode\n * @param {Number} version QR Code version\n * @return {Number} Number of bits\n */\nexports.getCharCountIndicator = function getCharCountIndicator (mode, version) {\n if (!mode.ccBits) throw new Error('Invalid mode: ' + mode)\n\n if (!VersionCheck.isValid(version)) {\n throw new Error('Invalid version: ' + version)\n }\n\n if (version >= 1 && version < 10) return mode.ccBits[0]\n else if (version < 27) return mode.ccBits[1]\n return mode.ccBits[2]\n}\n\n/**\n * Returns the most efficient mode to store the specified data\n *\n * @param {String} dataStr Input data string\n * @return {Mode} Best mode\n */\nexports.getBestModeForData = function getBestModeForData (dataStr) {\n if (Regex.testNumeric(dataStr)) return exports.NUMERIC\n else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC\n else if (Regex.testKanji(dataStr)) return exports.KANJI\n else return exports.BYTE\n}\n\n/**\n * Return mode name as string\n *\n * @param {Mode} mode Mode object\n * @returns {String} Mode name\n */\nexports.toString = function toString (mode) {\n if (mode && mode.id) return mode.id\n throw new Error('Invalid mode')\n}\n\n/**\n * Check if input param is a valid mode object\n *\n * @param {Mode} mode Mode object\n * @returns {Boolean} True if valid mode, false otherwise\n */\nexports.isValid = function isValid (mode) {\n return mode && mode.bit && mode.ccBits\n}\n\n/**\n * Get mode object from its name\n *\n * @param {String} string Mode name\n * @returns {Mode} Mode object\n */\nfunction fromString (string) {\n if (typeof string !== 'string') {\n throw new Error('Param is not a string')\n }\n\n const lcStr = string.toLowerCase()\n\n switch (lcStr) {\n case 'numeric':\n return exports.NUMERIC\n case 'alphanumeric':\n return exports.ALPHANUMERIC\n case 'kanji':\n return exports.KANJI\n case 'byte':\n return exports.BYTE\n default:\n throw new Error('Unknown mode: ' + string)\n }\n}\n\n/**\n * Returns mode from a value.\n * If value is not a valid mode, returns defaultValue\n *\n * @param {Mode|String} value Encoding mode\n * @param {Mode} defaultValue Fallback value\n * @return {Mode} Encoding mode\n */\nexports.from = function from (value, defaultValue) {\n if (exports.isValid(value)) {\n return value\n }\n\n try {\n return fromString(value)\n } catch (e) {\n return defaultValue\n }\n}\n","const Mode = require('./mode')\n\nfunction NumericData (data) {\n this.mode = Mode.NUMERIC\n this.data = data.toString()\n}\n\nNumericData.getBitsLength = function getBitsLength (length) {\n return 10 * Math.floor(length / 3) + ((length % 3) ? ((length % 3) * 3 + 1) : 0)\n}\n\nNumericData.prototype.getLength = function getLength () {\n return this.data.length\n}\n\nNumericData.prototype.getBitsLength = function getBitsLength () {\n return NumericData.getBitsLength(this.data.length)\n}\n\nNumericData.prototype.write = function write (bitBuffer) {\n let i, group, value\n\n // The input data string is divided into groups of three digits,\n // and each group is converted to its 10-bit binary equivalent.\n for (i = 0; i + 3 <= this.data.length; i += 3) {\n group = this.data.substr(i, 3)\n value = parseInt(group, 10)\n\n bitBuffer.put(value, 10)\n }\n\n // If the number of input digits is not an exact multiple of three,\n // the final one or two digits are converted to 4 or 7 bits respectively.\n const remainingNum = this.data.length - i\n if (remainingNum > 0) {\n group = this.data.substr(i)\n value = parseInt(group, 10)\n\n bitBuffer.put(value, remainingNum * 3 + 1)\n }\n}\n\nmodule.exports = NumericData\n","const GF = require('./galois-field')\n\n/**\n * Multiplies two polynomials inside Galois Field\n *\n * @param {Uint8Array} p1 Polynomial\n * @param {Uint8Array} p2 Polynomial\n * @return {Uint8Array} Product of p1 and p2\n */\nexports.mul = function mul (p1, p2) {\n const coeff = new Uint8Array(p1.length + p2.length - 1)\n\n for (let i = 0; i < p1.length; i++) {\n for (let j = 0; j < p2.length; j++) {\n coeff[i + j] ^= GF.mul(p1[i], p2[j])\n }\n }\n\n return coeff\n}\n\n/**\n * Calculate the remainder of polynomials division\n *\n * @param {Uint8Array} divident Polynomial\n * @param {Uint8Array} divisor Polynomial\n * @return {Uint8Array} Remainder\n */\nexports.mod = function mod (divident, divisor) {\n let result = new Uint8Array(divident)\n\n while ((result.length - divisor.length) >= 0) {\n const coeff = result[0]\n\n for (let i = 0; i < divisor.length; i++) {\n result[i] ^= GF.mul(divisor[i], coeff)\n }\n\n // remove all zeros from buffer head\n let offset = 0\n while (offset < result.length && result[offset] === 0) offset++\n result = result.slice(offset)\n }\n\n return result\n}\n\n/**\n * Generate an irreducible generator polynomial of specified degree\n * (used by Reed-Solomon encoder)\n *\n * @param {Number} degree Degree of the generator polynomial\n * @return {Uint8Array} Buffer containing polynomial coefficients\n */\nexports.generateECPolynomial = function generateECPolynomial (degree) {\n let poly = new Uint8Array([1])\n for (let i = 0; i < degree; i++) {\n poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]))\n }\n\n return poly\n}\n","const Utils = require('./utils')\nconst ECLevel = require('./error-correction-level')\nconst BitBuffer = require('./bit-buffer')\nconst BitMatrix = require('./bit-matrix')\nconst AlignmentPattern = require('./alignment-pattern')\nconst FinderPattern = require('./finder-pattern')\nconst MaskPattern = require('./mask-pattern')\nconst ECCode = require('./error-correction-code')\nconst ReedSolomonEncoder = require('./reed-solomon-encoder')\nconst Version = require('./version')\nconst FormatInfo = require('./format-info')\nconst Mode = require('./mode')\nconst Segments = require('./segments')\n\n/**\n * QRCode for JavaScript\n *\n * modified by Ryan Day for nodejs support\n * Copyright (c) 2011 Ryan Day\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/mit-license.php\n *\n//---------------------------------------------------------------------\n// QRCode for JavaScript\n//\n// Copyright (c) 2009 Kazuhiko Arase\n//\n// URL: http://www.d-project.com/\n//\n// Licensed under the MIT license:\n// http://www.opensource.org/licenses/mit-license.php\n//\n// The word \"QR Code\" is registered trademark of\n// DENSO WAVE INCORPORATED\n// http://www.denso-wave.com/qrcode/faqpatent-e.html\n//\n//---------------------------------------------------------------------\n*/\n\n/**\n * Add finder patterns bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupFinderPattern (matrix, version) {\n const size = matrix.size\n const pos = FinderPattern.getPositions(version)\n\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0]\n const col = pos[i][1]\n\n for (let r = -1; r <= 7; r++) {\n if (row + r <= -1 || size <= row + r) continue\n\n for (let c = -1; c <= 7; c++) {\n if (col + c <= -1 || size <= col + c) continue\n\n if ((r >= 0 && r <= 6 && (c === 0 || c === 6)) ||\n (c >= 0 && c <= 6 && (r === 0 || r === 6)) ||\n (r >= 2 && r <= 4 && c >= 2 && c <= 4)) {\n matrix.set(row + r, col + c, true, true)\n } else {\n matrix.set(row + r, col + c, false, true)\n }\n }\n }\n }\n}\n\n/**\n * Add timing pattern bits to matrix\n *\n * Note: this function must be called before {@link setupAlignmentPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n */\nfunction setupTimingPattern (matrix) {\n const size = matrix.size\n\n for (let r = 8; r < size - 8; r++) {\n const value = r % 2 === 0\n matrix.set(r, 6, value, true)\n matrix.set(6, r, value, true)\n }\n}\n\n/**\n * Add alignment patterns bits to matrix\n *\n * Note: this function must be called after {@link setupTimingPattern}\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupAlignmentPattern (matrix, version) {\n const pos = AlignmentPattern.getPositions(version)\n\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0]\n const col = pos[i][1]\n\n for (let r = -2; r <= 2; r++) {\n for (let c = -2; c <= 2; c++) {\n if (r === -2 || r === 2 || c === -2 || c === 2 ||\n (r === 0 && c === 0)) {\n matrix.set(row + r, col + c, true, true)\n } else {\n matrix.set(row + r, col + c, false, true)\n }\n }\n }\n }\n}\n\n/**\n * Add version info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Number} version QR Code version\n */\nfunction setupVersionInfo (matrix, version) {\n const size = matrix.size\n const bits = Version.getEncodedBits(version)\n let row, col, mod\n\n for (let i = 0; i < 18; i++) {\n row = Math.floor(i / 3)\n col = i % 3 + size - 8 - 3\n mod = ((bits >> i) & 1) === 1\n\n matrix.set(row, col, mod, true)\n matrix.set(col, row, mod, true)\n }\n}\n\n/**\n * Add format info bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {Number} maskPattern Mask pattern reference value\n */\nfunction setupFormatInfo (matrix, errorCorrectionLevel, maskPattern) {\n const size = matrix.size\n const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern)\n let i, mod\n\n for (i = 0; i < 15; i++) {\n mod = ((bits >> i) & 1) === 1\n\n // vertical\n if (i < 6) {\n matrix.set(i, 8, mod, true)\n } else if (i < 8) {\n matrix.set(i + 1, 8, mod, true)\n } else {\n matrix.set(size - 15 + i, 8, mod, true)\n }\n\n // horizontal\n if (i < 8) {\n matrix.set(8, size - i - 1, mod, true)\n } else if (i < 9) {\n matrix.set(8, 15 - i - 1 + 1, mod, true)\n } else {\n matrix.set(8, 15 - i - 1, mod, true)\n }\n }\n\n // fixed module\n matrix.set(size - 8, 8, 1, true)\n}\n\n/**\n * Add encoded data bits to matrix\n *\n * @param {BitMatrix} matrix Modules matrix\n * @param {Uint8Array} data Data codewords\n */\nfunction setupData (matrix, data) {\n const size = matrix.size\n let inc = -1\n let row = size - 1\n let bitIndex = 7\n let byteIndex = 0\n\n for (let col = size - 1; col > 0; col -= 2) {\n if (col === 6) col--\n\n while (true) {\n for (let c = 0; c < 2; c++) {\n if (!matrix.isReserved(row, col - c)) {\n let dark = false\n\n if (byteIndex < data.length) {\n dark = (((data[byteIndex] >>> bitIndex) & 1) === 1)\n }\n\n matrix.set(row, col - c, dark)\n bitIndex--\n\n if (bitIndex === -1) {\n byteIndex++\n bitIndex = 7\n }\n }\n }\n\n row += inc\n\n if (row < 0 || size <= row) {\n row -= inc\n inc = -inc\n break\n }\n }\n }\n}\n\n/**\n * Create encoded codewords from data input\n *\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @param {ByteData} data Data input\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createData (version, errorCorrectionLevel, segments) {\n // Prepare data buffer\n const buffer = new BitBuffer()\n\n segments.forEach(function (data) {\n // prefix data with mode indicator (4 bits)\n buffer.put(data.mode.bit, 4)\n\n // Prefix data with character count indicator.\n // The character count indicator is a string of bits that represents the\n // number of characters that are being encoded.\n // The character count indicator must be placed after the mode indicator\n // and must be a certain number of bits long, depending on the QR version\n // and data mode\n // @see {@link Mode.getCharCountIndicator}.\n buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version))\n\n // add binary data sequence to buffer\n data.write(buffer)\n })\n\n // Calculate required number of bits\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8\n\n // Add a terminator.\n // If the bit string is shorter than the total number of required bits,\n // a terminator of up to four 0s must be added to the right side of the string.\n // If the bit string is more than four bits shorter than the required number of bits,\n // add four 0s to the end.\n if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {\n buffer.put(0, 4)\n }\n\n // If the bit string is fewer than four bits shorter, add only the number of 0s that\n // are needed to reach the required number of bits.\n\n // After adding the terminator, if the number of bits in the string is not a multiple of 8,\n // pad the string on the right with 0s to make the string's length a multiple of 8.\n while (buffer.getLengthInBits() % 8 !== 0) {\n buffer.putBit(0)\n }\n\n // Add pad bytes if the string is still shorter than the total number of required bits.\n // Extend the buffer to fill the data capacity of the symbol corresponding to\n // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC)\n // and 00010001 (0x11) alternately.\n const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8\n for (let i = 0; i < remainingByte; i++) {\n buffer.put(i % 2 ? 0x11 : 0xEC, 8)\n }\n\n return createCodewords(buffer, version, errorCorrectionLevel)\n}\n\n/**\n * Encode input data with Reed-Solomon and return codewords with\n * relative error correction bits\n *\n * @param {BitBuffer} bitBuffer Data to encode\n * @param {Number} version QR Code version\n * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level\n * @return {Uint8Array} Buffer containing encoded codewords\n */\nfunction createCodewords (bitBuffer, version, errorCorrectionLevel) {\n // Total codewords for this QR code version (Data + Error correction)\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n\n // Total number of error correction codewords\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n\n // Total number of data codewords\n const dataTotalCodewords = totalCodewords - ecTotalCodewords\n\n // Total number of blocks\n const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel)\n\n // Calculate how many blocks each group should contain\n const blocksInGroup2 = totalCodewords % ecTotalBlocks\n const blocksInGroup1 = ecTotalBlocks - blocksInGroup2\n\n const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks)\n\n const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks)\n const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1\n\n // Number of EC codewords is the same for both groups\n const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1\n\n // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount\n const rs = new ReedSolomonEncoder(ecCount)\n\n let offset = 0\n const dcData = new Array(ecTotalBlocks)\n const ecData = new Array(ecTotalBlocks)\n let maxDataSize = 0\n const buffer = new Uint8Array(bitBuffer.buffer)\n\n // Divide the buffer into the required number of blocks\n for (let b = 0; b < ecTotalBlocks; b++) {\n const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2\n\n // extract a block of data from buffer\n dcData[b] = buffer.slice(offset, offset + dataSize)\n\n // Calculate EC codewords for this data block\n ecData[b] = rs.encode(dcData[b])\n\n offset += dataSize\n maxDataSize = Math.max(maxDataSize, dataSize)\n }\n\n // Create final data\n // Interleave the data and error correction codewords from each block\n const data = new Uint8Array(totalCodewords)\n let index = 0\n let i, r\n\n // Add data codewords\n for (i = 0; i < maxDataSize; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n if (i < dcData[r].length) {\n data[index++] = dcData[r][i]\n }\n }\n }\n\n // Apped EC codewords\n for (i = 0; i < ecCount; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n data[index++] = ecData[r][i]\n }\n }\n\n return data\n}\n\n/**\n * Build QR Code symbol\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @param {ErrorCorretionLevel} errorCorrectionLevel Error level\n * @param {MaskPattern} maskPattern Mask pattern\n * @return {Object} Object containing symbol data\n */\nfunction createSymbol (data, version, errorCorrectionLevel, maskPattern) {\n let segments\n\n if (Array.isArray(data)) {\n segments = Segments.fromArray(data)\n } else if (typeof data === 'string') {\n let estimatedVersion = version\n\n if (!estimatedVersion) {\n const rawSegments = Segments.rawSplit(data)\n\n // Estimate best version that can contain raw splitted segments\n estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel)\n }\n\n // Build optimized segments\n // If estimated version is undefined, try with the highest version\n segments = Segments.fromString(data, estimatedVersion || 40)\n } else {\n throw new Error('Invalid data')\n }\n\n // Get the min version that can contain data\n const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel)\n\n // If no version is found, data cannot be stored\n if (!bestVersion) {\n throw new Error('The amount of data is too big to be stored in a QR Code')\n }\n\n // If not specified, use min version as default\n if (!version) {\n version = bestVersion\n\n // Check if the specified version can contain the data\n } else if (version < bestVersion) {\n throw new Error('\\n' +\n 'The chosen QR Code version cannot contain this amount of data.\\n' +\n 'Minimum version required to store current data is: ' + bestVersion + '.\\n'\n )\n }\n\n const dataBits = createData(version, errorCorrectionLevel, segments)\n\n // Allocate matrix buffer\n const moduleCount = Utils.getSymbolSize(version)\n const modules = new BitMatrix(moduleCount)\n\n // Add function modules\n setupFinderPattern(modules, version)\n setupTimingPattern(modules)\n setupAlignmentPattern(modules, version)\n\n // Add temporary dummy bits for format info just to set them as reserved.\n // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask}\n // since the masking operation must be performed only on the encoding region.\n // These blocks will be replaced with correct values later in code.\n setupFormatInfo(modules, errorCorrectionLevel, 0)\n\n if (version >= 7) {\n setupVersionInfo(modules, version)\n }\n\n // Add data codewords\n setupData(modules, dataBits)\n\n if (isNaN(maskPattern)) {\n // Find best mask pattern\n maskPattern = MaskPattern.getBestMask(modules,\n setupFormatInfo.bind(null, modules, errorCorrectionLevel))\n }\n\n // Apply mask pattern\n MaskPattern.applyMask(maskPattern, modules)\n\n // Replace format info bits with correct values\n setupFormatInfo(modules, errorCorrectionLevel, maskPattern)\n\n return {\n modules: modules,\n version: version,\n errorCorrectionLevel: errorCorrectionLevel,\n maskPattern: maskPattern,\n segments: segments\n }\n}\n\n/**\n * QR Code\n *\n * @param {String | Array} data Input data\n * @param {Object} options Optional configurations\n * @param {Number} options.version QR Code version\n * @param {String} options.errorCorrectionLevel Error correction level\n * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis\n */\nexports.create = function create (data, options) {\n if (typeof data === 'undefined' || data === '') {\n throw new Error('No input text')\n }\n\n let errorCorrectionLevel = ECLevel.M\n let version\n let mask\n\n if (typeof options !== 'undefined') {\n // Use higher error correction level as default\n errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M)\n version = Version.from(options.version)\n mask = MaskPattern.from(options.maskPattern)\n\n if (options.toSJISFunc) {\n Utils.setToSJISFunction(options.toSJISFunc)\n }\n }\n\n return createSymbol(data, version, errorCorrectionLevel, mask)\n}\n","const Polynomial = require('./polynomial')\n\nfunction ReedSolomonEncoder (degree) {\n this.genPoly = undefined\n this.degree = degree\n\n if (this.degree) this.initialize(this.degree)\n}\n\n/**\n * Initialize the encoder.\n * The input param should correspond to the number of error correction codewords.\n *\n * @param {Number} degree\n */\nReedSolomonEncoder.prototype.initialize = function initialize (degree) {\n // create an irreducible generator polynomial\n this.degree = degree\n this.genPoly = Polynomial.generateECPolynomial(this.degree)\n}\n\n/**\n * Encodes a chunk of data\n *\n * @param {Uint8Array} data Buffer containing input data\n * @return {Uint8Array} Buffer containing encoded data\n */\nReedSolomonEncoder.prototype.encode = function encode (data) {\n if (!this.genPoly) {\n throw new Error('Encoder not initialized')\n }\n\n // Calculate EC for this data block\n // extends data size to data+genPoly size\n const paddedData = new Uint8Array(data.length + this.degree)\n paddedData.set(data)\n\n // The error correction codewords are the remainder after dividing the data codewords\n // by a generator polynomial\n const remainder = Polynomial.mod(paddedData, this.genPoly)\n\n // return EC data blocks (last n byte, where n is the degree of genPoly)\n // If coefficients number in remainder are less than genPoly degree,\n // pad with 0s to the left to reach the needed number of coefficients\n const start = this.degree - remainder.length\n if (start > 0) {\n const buff = new Uint8Array(this.degree)\n buff.set(remainder, start)\n\n return buff\n }\n\n return remainder\n}\n\nmodule.exports = ReedSolomonEncoder\n","const numeric = '[0-9]+'\nconst alphanumeric = '[A-Z $%*+\\\\-./:]+'\nlet kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' +\n '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' +\n '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' +\n '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'\nkanji = kanji.replace(/u/g, '\\\\u')\n\nconst byte = '(?:(?![A-Z0-9 $%*+\\\\-./:]|' + kanji + ')(?:.|[\\r\\n]))+'\n\nexports.KANJI = new RegExp(kanji, 'g')\nexports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\\\-./:]+', 'g')\nexports.BYTE = new RegExp(byte, 'g')\nexports.NUMERIC = new RegExp(numeric, 'g')\nexports.ALPHANUMERIC = new RegExp(alphanumeric, 'g')\n\nconst TEST_KANJI = new RegExp('^' + kanji + '$')\nconst TEST_NUMERIC = new RegExp('^' + numeric + '$')\nconst TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\\\-./:]+$')\n\nexports.testKanji = function testKanji (str) {\n return TEST_KANJI.test(str)\n}\n\nexports.testNumeric = function testNumeric (str) {\n return TEST_NUMERIC.test(str)\n}\n\nexports.testAlphanumeric = function testAlphanumeric (str) {\n return TEST_ALPHANUMERIC.test(str)\n}\n","const Mode = require('./mode')\nconst NumericData = require('./numeric-data')\nconst AlphanumericData = require('./alphanumeric-data')\nconst ByteData = require('./byte-data')\nconst KanjiData = require('./kanji-data')\nconst Regex = require('./regex')\nconst Utils = require('./utils')\nconst dijkstra = require('dijkstrajs')\n\n/**\n * Returns UTF8 byte length\n *\n * @param {String} str Input string\n * @return {Number} Number of byte\n */\nfunction getStringByteLength (str) {\n return unescape(encodeURIComponent(str)).length\n}\n\n/**\n * Get a list of segments of the specified mode\n * from a string\n *\n * @param {Mode} mode Segment mode\n * @param {String} str String to process\n * @return {Array} Array of object with segments data\n */\nfunction getSegments (regex, mode, str) {\n const segments = []\n let result\n\n while ((result = regex.exec(str)) !== null) {\n segments.push({\n data: result[0],\n index: result.index,\n mode: mode,\n length: result[0].length\n })\n }\n\n return segments\n}\n\n/**\n * Extracts a series of segments with the appropriate\n * modes from a string\n *\n * @param {String} dataStr Input string\n * @return {Array} Array of object with segments data\n */\nfunction getSegmentsFromString (dataStr) {\n const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr)\n const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr)\n let byteSegs\n let kanjiSegs\n\n if (Utils.isKanjiModeEnabled()) {\n byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr)\n kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr)\n } else {\n byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr)\n kanjiSegs = []\n }\n\n const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs)\n\n return segs\n .sort(function (s1, s2) {\n return s1.index - s2.index\n })\n .map(function (obj) {\n return {\n data: obj.data,\n mode: obj.mode,\n length: obj.length\n }\n })\n}\n\n/**\n * Returns how many bits are needed to encode a string of\n * specified length with the specified mode\n *\n * @param {Number} length String length\n * @param {Mode} mode Segment mode\n * @return {Number} Bit length\n */\nfunction getSegmentBitsLength (length, mode) {\n switch (mode) {\n case Mode.NUMERIC:\n return NumericData.getBitsLength(length)\n case Mode.ALPHANUMERIC:\n return AlphanumericData.getBitsLength(length)\n case Mode.KANJI:\n return KanjiData.getBitsLength(length)\n case Mode.BYTE:\n return ByteData.getBitsLength(length)\n }\n}\n\n/**\n * Merges adjacent segments which have the same mode\n *\n * @param {Array} segs Array of object with segments data\n * @return {Array} Array of object with segments data\n */\nfunction mergeSegments (segs) {\n return segs.reduce(function (acc, curr) {\n const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null\n if (prevSeg && prevSeg.mode === curr.mode) {\n acc[acc.length - 1].data += curr.data\n return acc\n }\n\n acc.push(curr)\n return acc\n }, [])\n}\n\n/**\n * Generates a list of all possible nodes combination which\n * will be used to build a segments graph.\n *\n * Nodes are divided by groups. Each group will contain a list of all the modes\n * in which is possible to encode the given text.\n *\n * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte.\n * The group for '12345' will contain then 3 objects, one for each\n * possible encoding mode.\n *\n * Each node represents a possible segment.\n *\n * @param {Array} segs Array of object with segments data\n * @return {Array} Array of object with segments data\n */\nfunction buildNodes (segs) {\n const nodes = []\n for (let i = 0; i < segs.length; i++) {\n const seg = segs[i]\n\n switch (seg.mode) {\n case Mode.NUMERIC:\n nodes.push([seg,\n { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ])\n break\n case Mode.ALPHANUMERIC:\n nodes.push([seg,\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ])\n break\n case Mode.KANJI:\n nodes.push([seg,\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ])\n break\n case Mode.BYTE:\n nodes.push([\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ])\n }\n }\n\n return nodes\n}\n\n/**\n * Builds a graph from a list of nodes.\n * All segments in each node group will be connected with all the segments of\n * the next group and so on.\n *\n * At each connection will be assigned a weight depending on the\n * segment's byte length.\n *\n * @param {Array} nodes Array of object with segments data\n * @param {Number} version QR Code version\n * @return {Object} Graph of all possible segments\n */\nfunction buildGraph (nodes, version) {\n const table = {}\n const graph = { start: {} }\n let prevNodeIds = ['start']\n\n for (let i = 0; i < nodes.length; i++) {\n const nodeGroup = nodes[i]\n const currentNodeIds = []\n\n for (let j = 0; j < nodeGroup.length; j++) {\n const node = nodeGroup[j]\n const key = '' + i + j\n\n currentNodeIds.push(key)\n table[key] = { node: node, lastCount: 0 }\n graph[key] = {}\n\n for (let n = 0; n < prevNodeIds.length; n++) {\n const prevNodeId = prevNodeIds[n]\n\n if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {\n graph[prevNodeId][key] =\n getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) -\n getSegmentBitsLength(table[prevNodeId].lastCount, node.mode)\n\n table[prevNodeId].lastCount += node.length\n } else {\n if (table[prevNodeId]) table[prevNodeId].lastCount = node.length\n\n graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) +\n 4 + Mode.getCharCountIndicator(node.mode, version) // switch cost\n }\n }\n }\n\n prevNodeIds = currentNodeIds\n }\n\n for (let n = 0; n < prevNodeIds.length; n++) {\n graph[prevNodeIds[n]].end = 0\n }\n\n return { map: graph, table: table }\n}\n\n/**\n * Builds a segment from a specified data and mode.\n * If a mode is not specified, the more suitable will be used.\n *\n * @param {String} data Input data\n * @param {Mode | String} modesHint Data mode\n * @return {Segment} Segment\n */\nfunction buildSingleSegment (data, modesHint) {\n let mode\n const bestMode = Mode.getBestModeForData(data)\n\n mode = Mode.from(modesHint, bestMode)\n\n // Make sure data can be encoded\n if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {\n throw new Error('\"' + data + '\"' +\n ' cannot be encoded with mode ' + Mode.toString(mode) +\n '.\\n Suggested mode is: ' + Mode.toString(bestMode))\n }\n\n // Use Mode.BYTE if Kanji support is disabled\n if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {\n mode = Mode.BYTE\n }\n\n switch (mode) {\n case Mode.NUMERIC:\n return new NumericData(data)\n\n case Mode.ALPHANUMERIC:\n return new AlphanumericData(data)\n\n case Mode.KANJI:\n return new KanjiData(data)\n\n case Mode.BYTE:\n return new ByteData(data)\n }\n}\n\n/**\n * Builds a list of segments from an array.\n * Array can contain Strings or Objects with segment's info.\n *\n * For each item which is a string, will be generated a segment with the given\n * string and the more appropriate encoding mode.\n *\n * For each item which is an object, will be generated a segment with the given\n * data and mode.\n * Objects must contain at least the property \"data\".\n * If property \"mode\" is not present, the more suitable mode will be used.\n *\n * @param {Array} array Array of objects with segments data\n * @return {Array} Array of Segments\n */\nexports.fromArray = function fromArray (array) {\n return array.reduce(function (acc, seg) {\n if (typeof seg === 'string') {\n acc.push(buildSingleSegment(seg, null))\n } else if (seg.data) {\n acc.push(buildSingleSegment(seg.data, seg.mode))\n }\n\n return acc\n }, [])\n}\n\n/**\n * Builds an optimized sequence of segments from a string,\n * which will produce the shortest possible bitstream.\n *\n * @param {String} data Input string\n * @param {Number} version QR Code version\n * @return {Array} Array of segments\n */\nexports.fromString = function fromString (data, version) {\n const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled())\n\n const nodes = buildNodes(segs)\n const graph = buildGraph(nodes, version)\n const path = dijkstra.find_path(graph.map, 'start', 'end')\n\n const optimizedSegs = []\n for (let i = 1; i < path.length - 1; i++) {\n optimizedSegs.push(graph.table[path[i]].node)\n }\n\n return exports.fromArray(mergeSegments(optimizedSegs))\n}\n\n/**\n * Splits a string in various segments with the modes which\n * best represent their content.\n * The produced segments are far from being optimized.\n * The output of this function is only used to estimate a QR Code version\n * which may contain the data.\n *\n * @param {string} data Input string\n * @return {Array} Array of segments\n */\nexports.rawSplit = function rawSplit (data) {\n return exports.fromArray(\n getSegmentsFromString(data, Utils.isKanjiModeEnabled())\n )\n}\n","let toSJISFunction\nconst CODEWORDS_COUNT = [\n 0, // Not used\n 26, 44, 70, 100, 134, 172, 196, 242, 292, 346,\n 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085,\n 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185,\n 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706\n]\n\n/**\n * Returns the QR Code size for the specified version\n *\n * @param {Number} version QR Code version\n * @return {Number} size of QR code\n */\nexports.getSymbolSize = function getSymbolSize (version) {\n if (!version) throw new Error('\"version\" cannot be null or undefined')\n if (version < 1 || version > 40) throw new Error('\"version\" should be in range from 1 to 40')\n return version * 4 + 17\n}\n\n/**\n * Returns the total number of codewords used to store data and EC information.\n *\n * @param {Number} version QR Code version\n * @return {Number} Data length in bits\n */\nexports.getSymbolTotalCodewords = function getSymbolTotalCodewords (version) {\n return CODEWORDS_COUNT[version]\n}\n\n/**\n * Encode data with Bose-Chaudhuri-Hocquenghem\n *\n * @param {Number} data Value to encode\n * @return {Number} Encoded value\n */\nexports.getBCHDigit = function (data) {\n let digit = 0\n\n while (data !== 0) {\n digit++\n data >>>= 1\n }\n\n return digit\n}\n\nexports.setToSJISFunction = function setToSJISFunction (f) {\n if (typeof f !== 'function') {\n throw new Error('\"toSJISFunc\" is not a valid function.')\n }\n\n toSJISFunction = f\n}\n\nexports.isKanjiModeEnabled = function () {\n return typeof toSJISFunction !== 'undefined'\n}\n\nexports.toSJIS = function toSJIS (kanji) {\n return toSJISFunction(kanji)\n}\n","/**\n * Check if QR Code version is valid\n *\n * @param {Number} version QR Code version\n * @return {Boolean} true if valid version, false otherwise\n */\nexports.isValid = function isValid (version) {\n return !isNaN(version) && version >= 1 && version <= 40\n}\n","const Utils = require('./utils')\nconst ECCode = require('./error-correction-code')\nconst ECLevel = require('./error-correction-level')\nconst Mode = require('./mode')\nconst VersionCheck = require('./version-check')\n\n// Generator polynomial used to encode version information\nconst G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)\nconst G18_BCH = Utils.getBCHDigit(G18)\n\nfunction getBestVersionForDataLength (mode, length, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {\n return currentVersion\n }\n }\n\n return undefined\n}\n\nfunction getReservedBitsCount (mode, version) {\n // Character count indicator + mode indicator bits\n return Mode.getCharCountIndicator(mode, version) + 4\n}\n\nfunction getTotalBitsFromDataArray (segments, version) {\n let totalBits = 0\n\n segments.forEach(function (data) {\n const reservedBits = getReservedBitsCount(data.mode, version)\n totalBits += reservedBits + data.getBitsLength()\n })\n\n return totalBits\n}\n\nfunction getBestVersionForMixedData (segments, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n const length = getTotalBitsFromDataArray(segments, currentVersion)\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {\n return currentVersion\n }\n }\n\n return undefined\n}\n\n/**\n * Returns version number from a value.\n * If value is not a valid version, returns defaultValue\n *\n * @param {Number|String} value QR Code version\n * @param {Number} defaultValue Fallback value\n * @return {Number} QR Code version number\n */\nexports.from = function from (value, defaultValue) {\n if (VersionCheck.isValid(value)) {\n return parseInt(value, 10)\n }\n\n return defaultValue\n}\n\n/**\n * Returns how much data can be stored with the specified QR code version\n * and error correction level\n *\n * @param {Number} version QR Code version (1-40)\n * @param {Number} errorCorrectionLevel Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} Quantity of storable data\n */\nexports.getCapacity = function getCapacity (version, errorCorrectionLevel, mode) {\n if (!VersionCheck.isValid(version)) {\n throw new Error('Invalid QR Code version')\n }\n\n // Use Byte mode as default\n if (typeof mode === 'undefined') mode = Mode.BYTE\n\n // Total codewords for this QR code version (Data + Error correction)\n const totalCodewords = Utils.getSymbolTotalCodewords(version)\n\n // Total number of error correction codewords\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel)\n\n // Total number of data codewords\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8\n\n if (mode === Mode.MIXED) return dataTotalCodewordsBits\n\n const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version)\n\n // Return max number of storable codewords\n switch (mode) {\n case Mode.NUMERIC:\n return Math.floor((usableBits / 10) * 3)\n\n case Mode.ALPHANUMERIC:\n return Math.floor((usableBits / 11) * 2)\n\n case Mode.KANJI:\n return Math.floor(usableBits / 13)\n\n case Mode.BYTE:\n default:\n return Math.floor(usableBits / 8)\n }\n}\n\n/**\n * Returns the minimum version needed to contain the amount of data\n *\n * @param {Segment} data Segment of data\n * @param {Number} [errorCorrectionLevel=H] Error correction level\n * @param {Mode} mode Data mode\n * @return {Number} QR Code version\n */\nexports.getBestVersionForData = function getBestVersionForData (data, errorCorrectionLevel) {\n let seg\n\n const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M)\n\n if (Array.isArray(data)) {\n if (data.length > 1) {\n return getBestVersionForMixedData(data, ecl)\n }\n\n if (data.length === 0) {\n return 1\n }\n\n seg = data[0]\n } else {\n seg = data\n }\n\n return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl)\n}\n\n/**\n * Returns version information with relative error correction bits\n *\n * The version information is included in QR Code symbols of version 7 or larger.\n * It consists of an 18-bit sequence containing 6 data bits,\n * with 12 error correction bits calculated using the (18, 6) Golay code.\n *\n * @param {Number} version QR Code version\n * @return {Number} Encoded version info bits\n */\nexports.getEncodedBits = function getEncodedBits (version) {\n if (!VersionCheck.isValid(version) || version < 7) {\n throw new Error('Invalid QR Code version')\n }\n\n let d = version << 12\n\n while (Utils.getBCHDigit(d) - G18_BCH >= 0) {\n d ^= (G18 << (Utils.getBCHDigit(d) - G18_BCH))\n }\n\n return (version << 12) | d\n}\n","const Utils = require('./utils')\n\nfunction clearCanvas (ctx, canvas, size) {\n ctx.clearRect(0, 0, canvas.width, canvas.height)\n\n if (!canvas.style) canvas.style = {}\n canvas.height = size\n canvas.width = size\n canvas.style.height = size + 'px'\n canvas.style.width = size + 'px'\n}\n\nfunction getCanvasElement () {\n try {\n return document.createElement('canvas')\n } catch (e) {\n throw new Error('You need to specify a canvas element')\n }\n}\n\nexports.render = function render (qrData, canvas, options) {\n let opts = options\n let canvasEl = canvas\n\n if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {\n opts = canvas\n canvas = undefined\n }\n\n if (!canvas) {\n canvasEl = getCanvasElement()\n }\n\n opts = Utils.getOptions(opts)\n const size = Utils.getImageWidth(qrData.modules.size, opts)\n\n const ctx = canvasEl.getContext('2d')\n const image = ctx.createImageData(size, size)\n Utils.qrToImageData(image.data, qrData, opts)\n\n clearCanvas(ctx, canvasEl, size)\n ctx.putImageData(image, 0, 0)\n\n return canvasEl\n}\n\nexports.renderToDataURL = function renderToDataURL (qrData, canvas, options) {\n let opts = options\n\n if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) {\n opts = canvas\n canvas = undefined\n }\n\n if (!opts) opts = {}\n\n const canvasEl = exports.render(qrData, canvas, opts)\n\n const type = opts.type || 'image/png'\n const rendererOpts = opts.rendererOpts || {}\n\n return canvasEl.toDataURL(type, rendererOpts.quality)\n}\n","const Utils = require('./utils')\n\nfunction getColorAttrib (color, attrib) {\n const alpha = color.a / 255\n const str = attrib + '=\"' + color.hex + '\"'\n\n return alpha < 1\n ? str + ' ' + attrib + '-opacity=\"' + alpha.toFixed(2).slice(1) + '\"'\n : str\n}\n\nfunction svgCmd (cmd, x, y) {\n let str = cmd + x\n if (typeof y !== 'undefined') str += ' ' + y\n\n return str\n}\n\nfunction qrToPath (data, size, margin) {\n let path = ''\n let moveBy = 0\n let newRow = false\n let lineLength = 0\n\n for (let i = 0; i < data.length; i++) {\n const col = Math.floor(i % size)\n const row = Math.floor(i / size)\n\n if (!col && !newRow) newRow = true\n\n if (data[i]) {\n lineLength++\n\n if (!(i > 0 && col > 0 && data[i - 1])) {\n path += newRow\n ? svgCmd('M', col + margin, 0.5 + row + margin)\n : svgCmd('m', moveBy, 0)\n\n moveBy = 0\n newRow = false\n }\n\n if (!(col + 1 < size && data[i + 1])) {\n path += svgCmd('h', lineLength)\n lineLength = 0\n }\n } else {\n moveBy++\n }\n }\n\n return path\n}\n\nexports.render = function render (qrData, options, cb) {\n const opts = Utils.getOptions(options)\n const size = qrData.modules.size\n const data = qrData.modules.data\n const qrcodesize = size + opts.margin * 2\n\n const bg = !opts.color.light.a\n ? ''\n : ''\n\n const path =\n ''\n\n const viewBox = 'viewBox=\"' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '\"'\n\n const width = !opts.width ? '' : 'width=\"' + opts.width + '\" height=\"' + opts.width + '\" '\n\n const svgTag = '' + bg + path + '\\n'\n\n if (typeof cb === 'function') {\n cb(null, svgTag)\n }\n\n return svgTag\n}\n","function hex2rgba (hex) {\n if (typeof hex === 'number') {\n hex = hex.toString()\n }\n\n if (typeof hex !== 'string') {\n throw new Error('Color should be defined as hex string')\n }\n\n let hexCode = hex.slice().replace('#', '').split('')\n if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {\n throw new Error('Invalid hex color: ' + hex)\n }\n\n // Convert from short to long form (fff -> ffffff)\n if (hexCode.length === 3 || hexCode.length === 4) {\n hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) {\n return [c, c]\n }))\n }\n\n // Add default alpha value\n if (hexCode.length === 6) hexCode.push('F', 'F')\n\n const hexValue = parseInt(hexCode.join(''), 16)\n\n return {\n r: (hexValue >> 24) & 255,\n g: (hexValue >> 16) & 255,\n b: (hexValue >> 8) & 255,\n a: hexValue & 255,\n hex: '#' + hexCode.slice(0, 6).join('')\n }\n}\n\nexports.getOptions = function getOptions (options) {\n if (!options) options = {}\n if (!options.color) options.color = {}\n\n const margin = typeof options.margin === 'undefined' ||\n options.margin === null ||\n options.margin < 0\n ? 4\n : options.margin\n\n const width = options.width && options.width >= 21 ? options.width : undefined\n const scale = options.scale || 4\n\n return {\n width: width,\n scale: width ? 4 : scale,\n margin: margin,\n color: {\n dark: hex2rgba(options.color.dark || '#000000ff'),\n light: hex2rgba(options.color.light || '#ffffffff')\n },\n type: options.type,\n rendererOpts: options.rendererOpts || {}\n }\n}\n\nexports.getScale = function getScale (qrSize, opts) {\n return opts.width && opts.width >= qrSize + opts.margin * 2\n ? opts.width / (qrSize + opts.margin * 2)\n : opts.scale\n}\n\nexports.getImageWidth = function getImageWidth (qrSize, opts) {\n const scale = exports.getScale(qrSize, opts)\n return Math.floor((qrSize + opts.margin * 2) * scale)\n}\n\nexports.qrToImageData = function qrToImageData (imgData, qr, opts) {\n const size = qr.modules.size\n const data = qr.modules.data\n const scale = exports.getScale(size, opts)\n const symbolSize = Math.floor((size + opts.margin * 2) * scale)\n const scaledMargin = opts.margin * scale\n const palette = [opts.color.light, opts.color.dark]\n\n for (let i = 0; i < symbolSize; i++) {\n for (let j = 0; j < symbolSize; j++) {\n let posDst = (i * symbolSize + j) * 4\n let pxColor = opts.color.light\n\n if (i >= scaledMargin && j >= scaledMargin &&\n i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {\n const iSrc = Math.floor((i - scaledMargin) / scale)\n const jSrc = Math.floor((j - scaledMargin) / scale)\n pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]\n }\n\n imgData[posDst++] = pxColor.r\n imgData[posDst++] = pxColor.g\n imgData[posDst++] = pxColor.b\n imgData[posDst] = pxColor.a\n }\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","module.exports = SafeParseTuple\n\nfunction SafeParseTuple(obj, reviver) {\n var json\n var error = null\n\n try {\n json = JSON.parse(obj, reviver)\n } catch (err) {\n error = err\n }\n\n return [error, json]\n}\n","'use strict';\n\nfunction clamp(v, min, max) {\r\n return min > v ? min : max < v ? max : v;\r\n}\r\nfunction sign(x) {\r\n return (+(x > 0) - +(x < 0));\r\n}\r\nfunction round(n) {\r\n return Math.round(n * 10000) / 10000;\r\n}\n\nvar cache = {};\r\nfunction replacer(match) {\r\n return '-' + match[0].toLowerCase();\r\n}\r\nfunction hyphenate(value) {\r\n return cache[value] || (cache[value] = value.replace(/([A-Z])/g, replacer));\r\n}\n\n/** find elements */\r\nfunction $(e, parent) {\r\n return !e || e.length === 0\r\n ? // null or empty string returns empty array\r\n []\r\n : e.nodeName\r\n ? // a single element is wrapped in an array\r\n [e]\r\n : // selector and NodeList are converted to Element[]\r\n [].slice.call(e[0].nodeName ? e : (parent || document.documentElement).querySelectorAll(e));\r\n}\r\nfunction setAttrs(el, attrs) {\r\n // tslint:disable-next-line:forin\r\n for (var key in attrs) {\r\n if (key.indexOf('_')) {\r\n el.setAttribute('data-' + hyphenate(key), attrs[key]);\r\n }\r\n }\r\n}\r\nfunction setProps(cssProps) {\r\n return function (el, props) {\r\n for (var key in props) {\r\n if (key.indexOf('_') && (cssProps === true || cssProps[key])) {\r\n el.style.setProperty('--' + hyphenate(key), round(props[key]));\r\n }\r\n }\r\n };\r\n}\n\nvar clearTask;\r\nvar subscribers = [];\r\nfunction loop() {\r\n clearTask = 0;\r\n subscribers.slice().forEach(function (s2) { return s2(); });\r\n enqueue();\r\n}\r\nfunction enqueue() {\r\n if (!clearTask && subscribers.length) {\r\n clearTask = requestAnimationFrame(loop);\r\n }\r\n}\r\nfunction subscribe(fn) {\r\n subscribers.push(fn);\r\n enqueue();\r\n return function () {\r\n subscribers = subscribers.filter(function (s) { return s !== fn; });\r\n if (!subscribers.length && clearTask) {\r\n cancelAnimationFrame(clearTask);\r\n clearTask = 0;\r\n }\r\n };\r\n}\n\nfunction unwrap(value, el, ctx, doc) {\r\n return typeof value === 'function' ? value(el, ctx, doc) : value;\r\n}\r\nfunction noop() { }\n\n/**\r\n * Creates a new instance of ScrollOut that marks elements in the viewport with\r\n * an \"in\" class and marks elements outside of the viewport with an \"out\"\r\n */\r\n// tslint:disable-next-line:no-default-export\r\nfunction main (opts) {\r\n // Apply default options.\r\n opts = opts || {};\r\n // Debounce onChange/onHidden/onShown.\r\n var onChange = opts.onChange || noop;\r\n var onHidden = opts.onHidden || noop;\r\n var onShown = opts.onShown || noop;\r\n var onScroll = opts.onScroll || noop;\r\n var props = opts.cssProps ? setProps(opts.cssProps) : noop;\r\n var se = opts.scrollingElement;\r\n var container = se ? $(se)[0] : window;\r\n var doc = se ? $(se)[0] : document.documentElement;\r\n var rootChanged = false;\r\n var scrollingElementContext = {};\r\n var elementContextList = [];\r\n var clientOffsetX, clientOffsety;\r\n var sub;\r\n function index() {\r\n elementContextList = $(opts.targets || '[data-scroll]', $(opts.scope || doc)[0]).map(function (el) { return ({ element: el }); });\r\n }\r\n function update() {\r\n // Calculate position, direction and ratio.\r\n var clientWidth = doc.clientWidth;\r\n var clientHeight = doc.clientHeight;\r\n var scrollDirX = sign(-clientOffsetX + (clientOffsetX = doc.scrollLeft || window.pageXOffset));\r\n var scrollDirY = sign(-clientOffsety + (clientOffsety = doc.scrollTop || window.pageYOffset));\r\n var scrollPercentX = doc.scrollLeft / (doc.scrollWidth - clientWidth || 1);\r\n var scrollPercentY = doc.scrollTop / (doc.scrollHeight - clientHeight || 1);\r\n // Detect if the root context has changed.\r\n rootChanged =\r\n rootChanged ||\r\n scrollingElementContext.scrollDirX !== scrollDirX ||\r\n scrollingElementContext.scrollDirY !== scrollDirY ||\r\n scrollingElementContext.scrollPercentX !== scrollPercentX ||\r\n scrollingElementContext.scrollPercentY !== scrollPercentY;\r\n scrollingElementContext.scrollDirX = scrollDirX;\r\n scrollingElementContext.scrollDirY = scrollDirY;\r\n scrollingElementContext.scrollPercentX = scrollPercentX;\r\n scrollingElementContext.scrollPercentY = scrollPercentY;\r\n var childChanged = false;\r\n for (var index_1 = 0; index_1 < elementContextList.length; index_1++) {\r\n var ctx = elementContextList[index_1];\r\n var element = ctx.element;\r\n // find the distance from the element to the scrolling container\r\n var target = element;\r\n var offsetX = 0;\r\n var offsetY = 0;\r\n do {\r\n offsetX += target.offsetLeft;\r\n offsetY += target.offsetTop;\r\n target = target.offsetParent;\r\n } while (target && target !== container);\r\n // Get element dimensions.\r\n var elementHeight = element.clientHeight || element.offsetHeight || 0;\r\n var elementWidth = element.clientWidth || element.offsetWidth || 0;\r\n // Find visible ratios for each element.\r\n var visibleX = (clamp(offsetX + elementWidth, clientOffsetX, clientOffsetX + clientWidth) -\r\n clamp(offsetX, clientOffsetX, clientOffsetX + clientWidth)) /\r\n elementWidth;\r\n var visibleY = (clamp(offsetY + elementHeight, clientOffsety, clientOffsety + clientHeight) -\r\n clamp(offsetY, clientOffsety, clientOffsety + clientHeight)) /\r\n elementHeight;\r\n var intersectX = visibleX === 1 ? 0 : sign(offsetX - clientOffsetX);\r\n var intersectY = visibleY === 1 ? 0 : sign(offsetY - clientOffsety);\r\n var viewportX = clamp((clientOffsetX - (elementWidth / 2 + offsetX - clientWidth / 2)) / (clientWidth / 2), -1, 1);\r\n var viewportY = clamp((clientOffsety - (elementHeight / 2 + offsetY - clientHeight / 2)) / (clientHeight / 2), -1, 1);\r\n var visible = void 0;\r\n if (opts.offset) {\r\n visible = unwrap(opts.offset, element, ctx, doc) <= clientOffsety ? 1 : 0;\r\n }\r\n else if ((unwrap(opts.threshold, element, ctx, doc) || 0) < visibleX * visibleY) {\r\n visible = 1;\r\n }\r\n else {\r\n visible = 0;\r\n }\r\n var changedVisible = ctx.visible !== visible;\r\n var changed = ctx._changed ||\r\n changedVisible ||\r\n ctx.visibleX !== visibleX ||\r\n ctx.visibleY !== visibleY ||\r\n ctx.index !== index_1 ||\r\n ctx.elementHeight !== elementHeight ||\r\n ctx.elementWidth !== elementWidth ||\r\n ctx.offsetX !== offsetX ||\r\n ctx.offsetY !== offsetY ||\r\n ctx.intersectX !== ctx.intersectX ||\r\n ctx.intersectY !== ctx.intersectY ||\r\n ctx.viewportX !== viewportX ||\r\n ctx.viewportY !== viewportY;\r\n if (changed) {\r\n childChanged = true;\r\n ctx._changed = true;\r\n ctx._visibleChanged = changedVisible;\r\n ctx.visible = visible;\r\n ctx.elementHeight = elementHeight;\r\n ctx.elementWidth = elementWidth;\r\n ctx.index = index_1;\r\n ctx.offsetX = offsetX;\r\n ctx.offsetY = offsetY;\r\n ctx.visibleX = visibleX;\r\n ctx.visibleY = visibleY;\r\n ctx.intersectX = intersectX;\r\n ctx.intersectY = intersectY;\r\n ctx.viewportX = viewportX;\r\n ctx.viewportY = viewportY;\r\n ctx.visible = visible;\r\n }\r\n }\r\n if (!sub && (rootChanged || childChanged)) {\r\n sub = subscribe(render);\r\n }\r\n }\r\n function render() {\r\n maybeUnsubscribe();\r\n // Update root attributes if they have changed.\r\n if (rootChanged) {\r\n rootChanged = false;\r\n setAttrs(doc, {\r\n scrollDirX: scrollingElementContext.scrollDirX,\r\n scrollDirY: scrollingElementContext.scrollDirY\r\n });\r\n props(doc, scrollingElementContext);\r\n onScroll(doc, scrollingElementContext, elementContextList);\r\n }\r\n var len = elementContextList.length;\r\n for (var x = len - 1; x > -1; x--) {\r\n var ctx = elementContextList[x];\r\n var el = ctx.element;\r\n var visible = ctx.visible;\r\n var justOnce = el.hasAttribute('scrollout-once') || false; // Once\r\n if (ctx._changed) {\r\n ctx._changed = false;\r\n props(el, ctx);\r\n }\r\n if (ctx._visibleChanged) {\r\n setAttrs(el, { scroll: visible ? 'in' : 'out' });\r\n onChange(el, ctx, doc);\r\n (visible ? onShown : onHidden)(el, ctx, doc);\r\n }\r\n // if this is shown multiple times, keep it in the list\r\n if (visible && (opts.once || justOnce)) { // or if this element just display it once\r\n elementContextList.splice(x, 1);\r\n }\r\n }\r\n }\r\n function maybeUnsubscribe() {\r\n if (sub) {\r\n sub();\r\n sub = undefined;\r\n }\r\n }\r\n // Run initialize index.\r\n index();\r\n update();\r\n render();\r\n // Collapses sequential updates into a single update.\r\n var updateTaskId = 0;\r\n var onUpdate = function () {\r\n updateTaskId = updateTaskId || setTimeout(function () {\r\n updateTaskId = 0;\r\n update();\r\n }, 0);\r\n };\r\n // Hook up document listeners to automatically detect changes.\r\n window.addEventListener('resize', onUpdate);\r\n container.addEventListener('scroll', onUpdate);\r\n return {\r\n index: index,\r\n update: update,\r\n teardown: function () {\r\n maybeUnsubscribe();\r\n window.removeEventListener('resize', onUpdate);\r\n container.removeEventListener('scroll', onUpdate);\r\n }\r\n };\r\n}\n\nmodule.exports = main;\n","/*!\n * Signature Pad v3.0.0-beta.4 | https://github.com/szimek/signature_pad\n * (c) 2020 Szymon Nowak | Released under the MIT license\n */\n\nclass Point {\n constructor(x, y, time) {\n this.x = x;\n this.y = y;\n this.time = time || Date.now();\n }\n distanceTo(start) {\n return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));\n }\n equals(other) {\n return this.x === other.x && this.y === other.y && this.time === other.time;\n }\n velocityFrom(start) {\n return this.time !== start.time\n ? this.distanceTo(start) / (this.time - start.time)\n : 0;\n }\n}\n\nclass Bezier {\n constructor(startPoint, control2, control1, endPoint, startWidth, endWidth) {\n this.startPoint = startPoint;\n this.control2 = control2;\n this.control1 = control1;\n this.endPoint = endPoint;\n this.startWidth = startWidth;\n this.endWidth = endWidth;\n }\n static fromPoints(points, widths) {\n const c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;\n const c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;\n return new Bezier(points[1], c2, c3, points[2], widths.start, widths.end);\n }\n static calculateControlPoints(s1, s2, s3) {\n const dx1 = s1.x - s2.x;\n const dy1 = s1.y - s2.y;\n const dx2 = s2.x - s3.x;\n const dy2 = s2.y - s3.y;\n const m1 = { x: (s1.x + s2.x) / 2.0, y: (s1.y + s2.y) / 2.0 };\n const m2 = { x: (s2.x + s3.x) / 2.0, y: (s2.y + s3.y) / 2.0 };\n const l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);\n const l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);\n const dxm = m1.x - m2.x;\n const dym = m1.y - m2.y;\n const k = l2 / (l1 + l2);\n const cm = { x: m2.x + dxm * k, y: m2.y + dym * k };\n const tx = s2.x - cm.x;\n const ty = s2.y - cm.y;\n return {\n c1: new Point(m1.x + tx, m1.y + ty),\n c2: new Point(m2.x + tx, m2.y + ty),\n };\n }\n length() {\n const steps = 10;\n let length = 0;\n let px;\n let py;\n for (let i = 0; i <= steps; i += 1) {\n const t = i / steps;\n const cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);\n const cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);\n if (i > 0) {\n const xdiff = cx - px;\n const ydiff = cy - py;\n length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n }\n px = cx;\n py = cy;\n }\n return length;\n }\n point(t, start, c1, c2, end) {\n return (start * (1.0 - t) * (1.0 - t) * (1.0 - t))\n + (3.0 * c1 * (1.0 - t) * (1.0 - t) * t)\n + (3.0 * c2 * (1.0 - t) * t * t)\n + (end * t * t * t);\n }\n}\n\nfunction throttle(fn, wait = 250) {\n let previous = 0;\n let timeout = null;\n let result;\n let storedContext;\n let storedArgs;\n const later = () => {\n previous = Date.now();\n timeout = null;\n result = fn.apply(storedContext, storedArgs);\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n };\n return function wrapper(...args) {\n const now = Date.now();\n const remaining = wait - (now - previous);\n storedContext = this;\n storedArgs = args;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n result = fn.apply(storedContext, storedArgs);\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n }\n else if (!timeout) {\n timeout = window.setTimeout(later, remaining);\n }\n return result;\n };\n}\n\nclass SignaturePad {\n constructor(canvas, options = {}) {\n this.canvas = canvas;\n this.options = options;\n this._handleMouseDown = (event) => {\n if (event.which === 1) {\n this._mouseButtonDown = true;\n this._strokeBegin(event);\n }\n };\n this._handleMouseMove = (event) => {\n if (this._mouseButtonDown) {\n this._strokeMoveUpdate(event);\n }\n };\n this._handleMouseUp = (event) => {\n if (event.which === 1 && this._mouseButtonDown) {\n this._mouseButtonDown = false;\n this._strokeEnd(event);\n }\n };\n this._handleTouchStart = (event) => {\n event.preventDefault();\n if (event.targetTouches.length === 1) {\n const touch = event.changedTouches[0];\n this._strokeBegin(touch);\n }\n };\n this._handleTouchMove = (event) => {\n event.preventDefault();\n const touch = event.targetTouches[0];\n this._strokeMoveUpdate(touch);\n };\n this._handleTouchEnd = (event) => {\n const wasCanvasTouched = event.target === this.canvas;\n if (wasCanvasTouched) {\n event.preventDefault();\n const touch = event.changedTouches[0];\n this._strokeEnd(touch);\n }\n };\n this.velocityFilterWeight = options.velocityFilterWeight || 0.7;\n this.minWidth = options.minWidth || 0.5;\n this.maxWidth = options.maxWidth || 2.5;\n this.throttle = ('throttle' in options ? options.throttle : 16);\n this.minDistance = ('minDistance' in options\n ? options.minDistance\n : 5);\n this.dotSize =\n options.dotSize ||\n function dotSize() {\n return (this.minWidth + this.maxWidth) / 2;\n };\n this.penColor = options.penColor || 'black';\n this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)';\n this.onBegin = options.onBegin;\n this.onEnd = options.onEnd;\n this._strokeMoveUpdate = this.throttle\n ? throttle(SignaturePad.prototype._strokeUpdate, this.throttle)\n : SignaturePad.prototype._strokeUpdate;\n this._ctx = canvas.getContext('2d');\n this.clear();\n this.on();\n }\n clear() {\n const { _ctx: ctx, canvas } = this;\n ctx.fillStyle = this.backgroundColor;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n this._data = [];\n this._reset();\n this._isEmpty = true;\n }\n fromDataURL(dataUrl, options = {}, callback) {\n const image = new Image();\n const ratio = options.ratio || window.devicePixelRatio || 1;\n const width = options.width || this.canvas.width / ratio;\n const height = options.height || this.canvas.height / ratio;\n this._reset();\n image.onload = () => {\n this._ctx.drawImage(image, 0, 0, width, height);\n if (callback) {\n callback();\n }\n };\n image.onerror = (error) => {\n if (callback) {\n callback(error);\n }\n };\n image.src = dataUrl;\n this._isEmpty = false;\n }\n toDataURL(type = 'image/png', encoderOptions) {\n switch (type) {\n case 'image/svg+xml':\n return this._toSVG();\n default:\n return this.canvas.toDataURL(type, encoderOptions);\n }\n }\n on() {\n this.canvas.style.touchAction = 'none';\n this.canvas.style.msTouchAction = 'none';\n if (window.PointerEvent) {\n this._handlePointerEvents();\n }\n else {\n this._handleMouseEvents();\n if ('ontouchstart' in window) {\n this._handleTouchEvents();\n }\n }\n }\n off() {\n this.canvas.style.touchAction = 'auto';\n this.canvas.style.msTouchAction = 'auto';\n this.canvas.removeEventListener('pointerdown', this._handleMouseDown);\n this.canvas.removeEventListener('pointermove', this._handleMouseMove);\n document.removeEventListener('pointerup', this._handleMouseUp);\n this.canvas.removeEventListener('mousedown', this._handleMouseDown);\n this.canvas.removeEventListener('mousemove', this._handleMouseMove);\n document.removeEventListener('mouseup', this._handleMouseUp);\n this.canvas.removeEventListener('touchstart', this._handleTouchStart);\n this.canvas.removeEventListener('touchmove', this._handleTouchMove);\n this.canvas.removeEventListener('touchend', this._handleTouchEnd);\n }\n isEmpty() {\n return this._isEmpty;\n }\n fromData(pointGroups) {\n this.clear();\n this._fromData(pointGroups, ({ color, curve }) => this._drawCurve({ color, curve }), ({ color, point }) => this._drawDot({ color, point }));\n this._data = pointGroups;\n }\n toData() {\n return this._data;\n }\n _strokeBegin(event) {\n const newPointGroup = {\n color: this.penColor,\n points: [],\n };\n if (typeof this.onBegin === 'function') {\n this.onBegin(event);\n }\n this._data.push(newPointGroup);\n this._reset();\n this._strokeUpdate(event);\n }\n _strokeUpdate(event) {\n if (this._data.length === 0) {\n this._strokeBegin(event);\n return;\n }\n const x = event.clientX;\n const y = event.clientY;\n const point = this._createPoint(x, y);\n const lastPointGroup = this._data[this._data.length - 1];\n const lastPoints = lastPointGroup.points;\n const lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];\n const isLastPointTooClose = lastPoint\n ? point.distanceTo(lastPoint) <= this.minDistance\n : false;\n const color = lastPointGroup.color;\n if (!lastPoint || !(lastPoint && isLastPointTooClose)) {\n const curve = this._addPoint(point);\n if (!lastPoint) {\n this._drawDot({ color, point });\n }\n else if (curve) {\n this._drawCurve({ color, curve });\n }\n lastPoints.push({\n time: point.time,\n x: point.x,\n y: point.y,\n });\n }\n }\n _strokeEnd(event) {\n this._strokeUpdate(event);\n if (typeof this.onEnd === 'function') {\n this.onEnd(event);\n }\n }\n _handlePointerEvents() {\n this._mouseButtonDown = false;\n this.canvas.addEventListener('pointerdown', this._handleMouseDown);\n this.canvas.addEventListener('pointermove', this._handleMouseMove);\n document.addEventListener('pointerup', this._handleMouseUp);\n }\n _handleMouseEvents() {\n this._mouseButtonDown = false;\n this.canvas.addEventListener('mousedown', this._handleMouseDown);\n this.canvas.addEventListener('mousemove', this._handleMouseMove);\n document.addEventListener('mouseup', this._handleMouseUp);\n }\n _handleTouchEvents() {\n this.canvas.addEventListener('touchstart', this._handleTouchStart);\n this.canvas.addEventListener('touchmove', this._handleTouchMove);\n this.canvas.addEventListener('touchend', this._handleTouchEnd);\n }\n _reset() {\n this._lastPoints = [];\n this._lastVelocity = 0;\n this._lastWidth = (this.minWidth + this.maxWidth) / 2;\n this._ctx.fillStyle = this.penColor;\n }\n _createPoint(x, y) {\n const rect = this.canvas.getBoundingClientRect();\n return new Point(x - rect.left, y - rect.top, new Date().getTime());\n }\n _addPoint(point) {\n const { _lastPoints } = this;\n _lastPoints.push(point);\n if (_lastPoints.length > 2) {\n if (_lastPoints.length === 3) {\n _lastPoints.unshift(_lastPoints[0]);\n }\n const widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2]);\n const curve = Bezier.fromPoints(_lastPoints, widths);\n _lastPoints.shift();\n return curve;\n }\n return null;\n }\n _calculateCurveWidths(startPoint, endPoint) {\n const velocity = this.velocityFilterWeight * endPoint.velocityFrom(startPoint) +\n (1 - this.velocityFilterWeight) * this._lastVelocity;\n const newWidth = this._strokeWidth(velocity);\n const widths = {\n end: newWidth,\n start: this._lastWidth,\n };\n this._lastVelocity = velocity;\n this._lastWidth = newWidth;\n return widths;\n }\n _strokeWidth(velocity) {\n return Math.max(this.maxWidth / (velocity + 1), this.minWidth);\n }\n _drawCurveSegment(x, y, width) {\n const ctx = this._ctx;\n ctx.moveTo(x, y);\n ctx.arc(x, y, width, 0, 2 * Math.PI, false);\n this._isEmpty = false;\n }\n _drawCurve({ color, curve }) {\n const ctx = this._ctx;\n const widthDelta = curve.endWidth - curve.startWidth;\n const drawSteps = Math.floor(curve.length()) * 2;\n ctx.beginPath();\n ctx.fillStyle = color;\n for (let i = 0; i < drawSteps; i += 1) {\n const t = i / drawSteps;\n const tt = t * t;\n const ttt = tt * t;\n const u = 1 - t;\n const uu = u * u;\n const uuu = uu * u;\n let x = uuu * curve.startPoint.x;\n x += 3 * uu * t * curve.control1.x;\n x += 3 * u * tt * curve.control2.x;\n x += ttt * curve.endPoint.x;\n let y = uuu * curve.startPoint.y;\n y += 3 * uu * t * curve.control1.y;\n y += 3 * u * tt * curve.control2.y;\n y += ttt * curve.endPoint.y;\n const width = Math.min(curve.startWidth + ttt * widthDelta, this.maxWidth);\n this._drawCurveSegment(x, y, width);\n }\n ctx.closePath();\n ctx.fill();\n }\n _drawDot({ color, point, }) {\n const ctx = this._ctx;\n const width = typeof this.dotSize === 'function' ? this.dotSize() : this.dotSize;\n ctx.beginPath();\n this._drawCurveSegment(point.x, point.y, width);\n ctx.closePath();\n ctx.fillStyle = color;\n ctx.fill();\n }\n _fromData(pointGroups, drawCurve, drawDot) {\n for (const group of pointGroups) {\n const { color, points } = group;\n if (points.length > 1) {\n for (let j = 0; j < points.length; j += 1) {\n const basicPoint = points[j];\n const point = new Point(basicPoint.x, basicPoint.y, basicPoint.time);\n this.penColor = color;\n if (j === 0) {\n this._reset();\n }\n const curve = this._addPoint(point);\n if (curve) {\n drawCurve({ color, curve });\n }\n }\n }\n else {\n this._reset();\n drawDot({\n color,\n point: points[0],\n });\n }\n }\n }\n _toSVG() {\n const pointGroups = this._data;\n const ratio = Math.max(window.devicePixelRatio || 1, 1);\n const minX = 0;\n const minY = 0;\n const maxX = this.canvas.width / ratio;\n const maxY = this.canvas.height / ratio;\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('width', this.canvas.width.toString());\n svg.setAttribute('height', this.canvas.height.toString());\n this._fromData(pointGroups, ({ color, curve }) => {\n const path = document.createElement('path');\n if (!isNaN(curve.control1.x) &&\n !isNaN(curve.control1.y) &&\n !isNaN(curve.control2.x) &&\n !isNaN(curve.control2.y)) {\n const attr = `M ${curve.startPoint.x.toFixed(3)},${curve.startPoint.y.toFixed(3)} ` +\n `C ${curve.control1.x.toFixed(3)},${curve.control1.y.toFixed(3)} ` +\n `${curve.control2.x.toFixed(3)},${curve.control2.y.toFixed(3)} ` +\n `${curve.endPoint.x.toFixed(3)},${curve.endPoint.y.toFixed(3)}`;\n path.setAttribute('d', attr);\n path.setAttribute('stroke-width', (curve.endWidth * 2.25).toFixed(3));\n path.setAttribute('stroke', color);\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke-linecap', 'round');\n svg.appendChild(path);\n }\n }, ({ color, point }) => {\n const circle = document.createElement('circle');\n const dotSize = typeof this.dotSize === 'function' ? this.dotSize() : this.dotSize;\n circle.setAttribute('r', dotSize.toString());\n circle.setAttribute('cx', point.x.toString());\n circle.setAttribute('cy', point.y.toString());\n circle.setAttribute('fill', color);\n svg.appendChild(circle);\n });\n const prefix = 'data:image/svg+xml;base64,';\n const header = '';\n let body = svg.innerHTML;\n if (body === undefined) {\n const dummy = document.createElement('dummy');\n const nodes = svg.childNodes;\n dummy.innerHTML = '';\n for (let i = 0; i < nodes.length; i += 1) {\n dummy.appendChild(nodes[i].cloneNode(true));\n }\n body = dummy.innerHTML;\n }\n const footer = '';\n const data = header + body + footer;\n return prefix + btoa(data);\n }\n}\n\nexport default SignaturePad;\n//# sourceMappingURL=signature_pad.js.map\n","(function (factory) {\n if (typeof exports === 'object') {\n // Node/CommonJS\n module.exports = factory();\n } else if (typeof define === 'function' && define.amd) {\n // AMD\n define(factory);\n } else {\n // Browser globals (with support for web workers)\n var glob;\n\n try {\n glob = window;\n } catch (e) {\n glob = self;\n }\n\n glob.SparkMD5 = factory();\n }\n}(function (undefined) {\n\n 'use strict';\n\n /*\n * Fastest md5 implementation around (JKM md5).\n * Credits: Joseph Myers\n *\n * @see http://www.myersdaily.org/joseph/javascript/md5-text.html\n * @see http://jsperf.com/md5-shootout/7\n */\n\n /* this function is much faster,\n so if possible we use it. Some IEs\n are the only ones I know of that\n need the idiotic second function,\n generated by an if clause. */\n var add32 = function (a, b) {\n return (a + b) & 0xFFFFFFFF;\n },\n hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];\n\n\n function cmn(q, a, b, x, s, t) {\n a = add32(add32(a, q), add32(x, t));\n return add32((a << s) | (a >>> (32 - s)), b);\n }\n\n function md5cycle(x, k) {\n var a = x[0],\n b = x[1],\n c = x[2],\n d = x[3];\n\n a += (b & c | ~b & d) + k[0] - 680876936 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[1] - 389564586 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[2] + 606105819 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[3] - 1044525330 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[4] - 176418897 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[5] + 1200080426 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[6] - 1473231341 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[7] - 45705983 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[8] + 1770035416 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[9] - 1958414417 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[10] - 42063 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[11] - 1990404162 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n a += (b & c | ~b & d) + k[12] + 1804603682 | 0;\n a = (a << 7 | a >>> 25) + b | 0;\n d += (a & b | ~a & c) + k[13] - 40341101 | 0;\n d = (d << 12 | d >>> 20) + a | 0;\n c += (d & a | ~d & b) + k[14] - 1502002290 | 0;\n c = (c << 17 | c >>> 15) + d | 0;\n b += (c & d | ~c & a) + k[15] + 1236535329 | 0;\n b = (b << 22 | b >>> 10) + c | 0;\n\n a += (b & d | c & ~d) + k[1] - 165796510 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[6] - 1069501632 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[11] + 643717713 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[0] - 373897302 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[5] - 701558691 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[10] + 38016083 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[15] - 660478335 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[4] - 405537848 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[9] + 568446438 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[14] - 1019803690 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[3] - 187363961 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[8] + 1163531501 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n a += (b & d | c & ~d) + k[13] - 1444681467 | 0;\n a = (a << 5 | a >>> 27) + b | 0;\n d += (a & c | b & ~c) + k[2] - 51403784 | 0;\n d = (d << 9 | d >>> 23) + a | 0;\n c += (d & b | a & ~b) + k[7] + 1735328473 | 0;\n c = (c << 14 | c >>> 18) + d | 0;\n b += (c & a | d & ~a) + k[12] - 1926607734 | 0;\n b = (b << 20 | b >>> 12) + c | 0;\n\n a += (b ^ c ^ d) + k[5] - 378558 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[8] - 2022574463 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[11] + 1839030562 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[14] - 35309556 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[1] - 1530992060 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[4] + 1272893353 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[7] - 155497632 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[10] - 1094730640 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[13] + 681279174 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[0] - 358537222 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[3] - 722521979 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[6] + 76029189 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n a += (b ^ c ^ d) + k[9] - 640364487 | 0;\n a = (a << 4 | a >>> 28) + b | 0;\n d += (a ^ b ^ c) + k[12] - 421815835 | 0;\n d = (d << 11 | d >>> 21) + a | 0;\n c += (d ^ a ^ b) + k[15] + 530742520 | 0;\n c = (c << 16 | c >>> 16) + d | 0;\n b += (c ^ d ^ a) + k[2] - 995338651 | 0;\n b = (b << 23 | b >>> 9) + c | 0;\n\n a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;\n b = (b << 21 |b >>> 11) + c | 0;\n a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;\n a = (a << 6 | a >>> 26) + b | 0;\n d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;\n d = (d << 10 | d >>> 22) + a | 0;\n c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;\n c = (c << 15 | c >>> 17) + d | 0;\n b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;\n b = (b << 21 | b >>> 11) + c | 0;\n\n x[0] = a + x[0] | 0;\n x[1] = b + x[1] | 0;\n x[2] = c + x[2] | 0;\n x[3] = d + x[3] | 0;\n }\n\n function md5blk(s) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);\n }\n return md5blks;\n }\n\n function md5blk_array(a) {\n var md5blks = [],\n i; /* Andy King said do it this way. */\n\n for (i = 0; i < 64; i += 4) {\n md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);\n }\n return md5blks;\n }\n\n function md51(s) {\n var n = s.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk(s.substring(i - 64, i)));\n }\n s = s.substring(i - 64);\n length = s.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);\n }\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n return state;\n }\n\n function md51_array(a) {\n var n = a.length,\n state = [1732584193, -271733879, -1732584194, 271733878],\n i,\n length,\n tail,\n tmp,\n lo,\n hi;\n\n for (i = 64; i <= n; i += 64) {\n md5cycle(state, md5blk_array(a.subarray(i - 64, i)));\n }\n\n // Not sure if it is a bug, however IE10 will always produce a sub array of length 1\n // containing the last element of the parent array if the sub array specified starts\n // beyond the length of the parent array - weird.\n // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue\n a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0);\n\n length = a.length;\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= a[i] << ((i % 4) << 3);\n }\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(state, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Beware that the final length might not fit in 32 bits so we take care of that\n tmp = n * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n\n md5cycle(state, tail);\n\n return state;\n }\n\n function rhex(n) {\n var s = '',\n j;\n for (j = 0; j < 4; j += 1) {\n s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F];\n }\n return s;\n }\n\n function hex(x) {\n var i;\n for (i = 0; i < x.length; i += 1) {\n x[i] = rhex(x[i]);\n }\n return x.join('');\n }\n\n // In some cases the fast add32 function cannot be used..\n if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {\n add32 = function (x, y) {\n var lsw = (x & 0xFFFF) + (y & 0xFFFF),\n msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return (msw << 16) | (lsw & 0xFFFF);\n };\n }\n\n // ---------------------------------------------------\n\n /**\n * ArrayBuffer slice polyfill.\n *\n * @see https://github.com/ttaubert/node-arraybuffer-slice\n */\n\n if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {\n (function () {\n function clamp(val, length) {\n val = (val | 0) || 0;\n\n if (val < 0) {\n return Math.max(val + length, 0);\n }\n\n return Math.min(val, length);\n }\n\n ArrayBuffer.prototype.slice = function (from, to) {\n var length = this.byteLength,\n begin = clamp(from, length),\n end = length,\n num,\n target,\n targetArray,\n sourceArray;\n\n if (to !== undefined) {\n end = clamp(to, length);\n }\n\n if (begin > end) {\n return new ArrayBuffer(0);\n }\n\n num = end - begin;\n target = new ArrayBuffer(num);\n targetArray = new Uint8Array(target);\n\n sourceArray = new Uint8Array(this, begin, num);\n targetArray.set(sourceArray);\n\n return target;\n };\n })();\n }\n\n // ---------------------------------------------------\n\n /**\n * Helpers.\n */\n\n function toUtf8(str) {\n if (/[\\u0080-\\uFFFF]/.test(str)) {\n str = unescape(encodeURIComponent(str));\n }\n\n return str;\n }\n\n function utf8Str2ArrayBuffer(str, returnUInt8Array) {\n var length = str.length,\n buff = new ArrayBuffer(length),\n arr = new Uint8Array(buff),\n i;\n\n for (i = 0; i < length; i += 1) {\n arr[i] = str.charCodeAt(i);\n }\n\n return returnUInt8Array ? arr : buff;\n }\n\n function arrayBuffer2Utf8Str(buff) {\n return String.fromCharCode.apply(null, new Uint8Array(buff));\n }\n\n function concatenateArrayBuffers(first, second, returnUInt8Array) {\n var result = new Uint8Array(first.byteLength + second.byteLength);\n\n result.set(new Uint8Array(first));\n result.set(new Uint8Array(second), first.byteLength);\n\n return returnUInt8Array ? result : result.buffer;\n }\n\n function hexToBinaryString(hex) {\n var bytes = [],\n length = hex.length,\n x;\n\n for (x = 0; x < length - 1; x += 2) {\n bytes.push(parseInt(hex.substr(x, 2), 16));\n }\n\n return String.fromCharCode.apply(String, bytes);\n }\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation.\n *\n * Use this class to perform an incremental md5, otherwise use the\n * static methods instead.\n */\n\n function SparkMD5() {\n // call reset to init the instance\n this.reset();\n }\n\n /**\n * Appends a string.\n * A conversion will be applied if an utf8 string is detected.\n *\n * @param {String} str The string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.append = function (str) {\n // Converts the string to utf8 bytes if necessary\n // Then append as binary\n this.appendBinary(toUtf8(str));\n\n return this;\n };\n\n /**\n * Appends a binary string.\n *\n * @param {String} contents The binary string to be appended\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.appendBinary = function (contents) {\n this._buff += contents;\n this._length += contents.length;\n\n var length = this._buff.length,\n i;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));\n }\n\n this._buff = this._buff.substring(i - 64);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n i,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.reset = function () {\n this._buff = '';\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.prototype.getState = function () {\n return {\n buff: this._buff,\n length: this._length,\n hash: this._hash.slice()\n };\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5} The instance itself\n */\n SparkMD5.prototype.setState = function (state) {\n this._buff = state.buff;\n this._length = state.length;\n this._hash = state.hash;\n\n return this;\n };\n\n /**\n * Releases memory used by the incremental buffer and other additional\n * resources. If you plan to use the instance again, use reset instead.\n */\n SparkMD5.prototype.destroy = function () {\n delete this._hash;\n delete this._buff;\n delete this._length;\n };\n\n /**\n * Finish the final calculation based on the tail.\n *\n * @param {Array} tail The tail (will be modified)\n * @param {Number} length The length of the remaining buffer\n */\n SparkMD5.prototype._finish = function (tail, length) {\n var i = length,\n tmp,\n lo,\n hi;\n\n tail[i >> 2] |= 0x80 << ((i % 4) << 3);\n if (i > 55) {\n md5cycle(this._hash, tail);\n for (i = 0; i < 16; i += 1) {\n tail[i] = 0;\n }\n }\n\n // Do the final computation based on the tail and length\n // Beware that the final length may not fit in 32 bits so we take care of that\n tmp = this._length * 8;\n tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);\n lo = parseInt(tmp[2], 16);\n hi = parseInt(tmp[1], 16) || 0;\n\n tail[14] = lo;\n tail[15] = hi;\n md5cycle(this._hash, tail);\n };\n\n /**\n * Performs the md5 hash on a string.\n * A conversion will be applied if utf8 string is detected.\n *\n * @param {String} str The string\n * @param {Boolean} [raw] True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hash = function (str, raw) {\n // Converts the string to utf8 bytes if necessary\n // Then compute it using the binary function\n return SparkMD5.hashBinary(toUtf8(str), raw);\n };\n\n /**\n * Performs the md5 hash on a binary string.\n *\n * @param {String} content The binary string\n * @param {Boolean} [raw] True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.hashBinary = function (content, raw) {\n var hash = md51(content),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n // ---------------------------------------------------\n\n /**\n * SparkMD5 OOP implementation for array buffers.\n *\n * Use this class to perform an incremental md5 ONLY for array buffers.\n */\n SparkMD5.ArrayBuffer = function () {\n // call reset to init the instance\n this.reset();\n };\n\n /**\n * Appends an array buffer.\n *\n * @param {ArrayBuffer} arr The array to be appended\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.append = function (arr) {\n var buff = concatenateArrayBuffers(this._buff.buffer, arr, true),\n length = buff.length,\n i;\n\n this._length += arr.byteLength;\n\n for (i = 64; i <= length; i += 64) {\n md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));\n }\n\n this._buff = (i - 64) < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);\n\n return this;\n };\n\n /**\n * Finishes the incremental computation, reseting the internal state and\n * returning the result.\n *\n * @param {Boolean} raw True to get the raw string, false to get the hex string\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.prototype.end = function (raw) {\n var buff = this._buff,\n length = buff.length,\n tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n i,\n ret;\n\n for (i = 0; i < length; i += 1) {\n tail[i >> 2] |= buff[i] << ((i % 4) << 3);\n }\n\n this._finish(tail, length);\n ret = hex(this._hash);\n\n if (raw) {\n ret = hexToBinaryString(ret);\n }\n\n this.reset();\n\n return ret;\n };\n\n /**\n * Resets the internal state of the computation.\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.reset = function () {\n this._buff = new Uint8Array(0);\n this._length = 0;\n this._hash = [1732584193, -271733879, -1732584194, 271733878];\n\n return this;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @return {Object} The state\n */\n SparkMD5.ArrayBuffer.prototype.getState = function () {\n var state = SparkMD5.prototype.getState.call(this);\n\n // Convert buffer to a string\n state.buff = arrayBuffer2Utf8Str(state.buff);\n\n return state;\n };\n\n /**\n * Gets the internal state of the computation.\n *\n * @param {Object} state The state\n *\n * @return {SparkMD5.ArrayBuffer} The instance itself\n */\n SparkMD5.ArrayBuffer.prototype.setState = function (state) {\n // Convert string to buffer\n state.buff = utf8Str2ArrayBuffer(state.buff, true);\n\n return SparkMD5.prototype.setState.call(this, state);\n };\n\n SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;\n\n SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;\n\n /**\n * Performs the md5 hash on an array buffer.\n *\n * @param {ArrayBuffer} arr The array buffer\n * @param {Boolean} [raw] True to get the raw string, false to get the hex one\n *\n * @return {String} The result\n */\n SparkMD5.ArrayBuffer.hash = function (arr, raw) {\n var hash = md51_array(new Uint8Array(arr)),\n ret = hex(hash);\n\n return raw ? hexToBinaryString(ret) : ret;\n };\n\n return SparkMD5;\n}));\n","\nexport default class TinyQueue {\n constructor(data = [], compare = defaultCompare) {\n this.data = data;\n this.length = this.data.length;\n this.compare = compare;\n\n if (this.length > 0) {\n for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i);\n }\n }\n\n push(item) {\n this.data.push(item);\n this.length++;\n this._up(this.length - 1);\n }\n\n pop() {\n if (this.length === 0) return undefined;\n\n const top = this.data[0];\n const bottom = this.data.pop();\n this.length--;\n\n if (this.length > 0) {\n this.data[0] = bottom;\n this._down(0);\n }\n\n return top;\n }\n\n peek() {\n return this.data[0];\n }\n\n _up(pos) {\n const {data, compare} = this;\n const item = data[pos];\n\n while (pos > 0) {\n const parent = (pos - 1) >> 1;\n const current = data[parent];\n if (compare(item, current) >= 0) break;\n data[pos] = current;\n pos = parent;\n }\n\n data[pos] = item;\n }\n\n _down(pos) {\n const {data, compare} = this;\n const halfLength = this.length >> 1;\n const item = data[pos];\n\n while (pos < halfLength) {\n let left = (pos << 1) + 1;\n let best = data[left];\n const right = left + 1;\n\n if (right < this.length && compare(data[right], best) < 0) {\n left = right;\n best = data[right];\n }\n if (compare(best, item) >= 0) break;\n\n data[pos] = best;\n pos = left;\n }\n\n data[pos] = item;\n }\n}\n\nfunction defaultCompare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","// see https://tools.ietf.org/html/rfc1808\n\n(function (root) {\n var URL_REGEX =\n /^(?=((?:[a-zA-Z0-9+\\-.]+:)?))\\1(?=((?:\\/\\/[^\\/?#]*)?))\\2(?=((?:(?:[^?#\\/]*\\/)*[^;?#\\/]*)?))\\3((?:;[^?#]*)?)(\\?[^#]*)?(#[^]*)?$/;\n var FIRST_SEGMENT_REGEX = /^(?=([^\\/?#]*))\\1([^]*)$/;\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/)[^\\/]*(?=\\/)/g;\n\n var URLToolkit = {\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n // E.g\n // With opts.alwaysNormalize = false (default, spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n // With opts.alwaysNormalize = true (not spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n buildAbsoluteURL: function (baseURL, relativeURL, opts) {\n opts = opts || {};\n // remove any remaining space and CRLF\n baseURL = baseURL.trim();\n relativeURL = relativeURL.trim();\n if (!relativeURL) {\n // 2a) If the embedded URL is entirely empty, it inherits the\n // entire base URL (i.e., is set equal to the base URL)\n // and we are done.\n if (!opts.alwaysNormalize) {\n return baseURL;\n }\n var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n if (!basePartsForNormalise) {\n throw new Error('Error trying to parse base URL.');\n }\n basePartsForNormalise.path = URLToolkit.normalizePath(\n basePartsForNormalise.path\n );\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\n }\n var relativeParts = URLToolkit.parseURL(relativeURL);\n if (!relativeParts) {\n throw new Error('Error trying to parse relative URL.');\n }\n if (relativeParts.scheme) {\n // 2b) If the embedded URL starts with a scheme name, it is\n // interpreted as an absolute URL and we are done.\n if (!opts.alwaysNormalize) {\n return relativeURL;\n }\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n return URLToolkit.buildURLFromParts(relativeParts);\n }\n var baseParts = URLToolkit.parseURL(baseURL);\n if (!baseParts) {\n throw new Error('Error trying to parse base URL.');\n }\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n baseParts.netLoc = pathParts[1];\n baseParts.path = pathParts[2];\n }\n if (baseParts.netLoc && !baseParts.path) {\n baseParts.path = '/';\n }\n var builtParts = {\n // 2c) Otherwise, the embedded URL inherits the scheme of\n // the base URL.\n scheme: baseParts.scheme,\n netLoc: relativeParts.netLoc,\n path: null,\n params: relativeParts.params,\n query: relativeParts.query,\n fragment: relativeParts.fragment,\n };\n if (!relativeParts.netLoc) {\n // 3) If the embedded URL's is non-empty, we skip to\n // Step 7. Otherwise, the embedded URL inherits the \n // (if any) of the base URL.\n builtParts.netLoc = baseParts.netLoc;\n // 4) If the embedded URL path is preceded by a slash \"/\", the\n // path is not relative and we skip to Step 7.\n if (relativeParts.path[0] !== '/') {\n if (!relativeParts.path) {\n // 5) If the embedded URL path is empty (and not preceded by a\n // slash), then the embedded URL inherits the base URL path\n builtParts.path = baseParts.path;\n // 5a) if the embedded URL's is non-empty, we skip to\n // step 7; otherwise, it inherits the of the base\n // URL (if any) and\n if (!relativeParts.params) {\n builtParts.params = baseParts.params;\n // 5b) if the embedded URL's is non-empty, we skip to\n // step 7; otherwise, it inherits the of the base\n // URL (if any) and we skip to step 7.\n if (!relativeParts.query) {\n builtParts.query = baseParts.query;\n }\n }\n } else {\n // 6) The last segment of the base URL's path (anything\n // following the rightmost slash \"/\", or the entire path if no\n // slash is present) is removed and the embedded URL's path is\n // appended in its place.\n var baseURLPath = baseParts.path;\n var newPath =\n baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) +\n relativeParts.path;\n builtParts.path = URLToolkit.normalizePath(newPath);\n }\n }\n }\n if (builtParts.path === null) {\n builtParts.path = opts.alwaysNormalize\n ? URLToolkit.normalizePath(relativeParts.path)\n : relativeParts.path;\n }\n return URLToolkit.buildURLFromParts(builtParts);\n },\n parseURL: function (url) {\n var parts = URL_REGEX.exec(url);\n if (!parts) {\n return null;\n }\n return {\n scheme: parts[1] || '',\n netLoc: parts[2] || '',\n path: parts[3] || '',\n params: parts[4] || '',\n query: parts[5] || '',\n fragment: parts[6] || '',\n };\n },\n normalizePath: function (path) {\n // The following operations are\n // then applied, in order, to the new path:\n // 6a) All occurrences of \"./\", where \".\" is a complete path\n // segment, are removed.\n // 6b) If the path ends with \".\" as a complete path segment,\n // that \".\" is removed.\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n // 6c) All occurrences of \"/../\", where is a\n // complete path segment not equal to \"..\", are removed.\n // Removal of these path segments is performed iteratively,\n // removing the leftmost matching pattern on each iteration,\n // until no matching pattern remains.\n // 6d) If the path ends with \"/..\", where is a\n // complete path segment not equal to \"..\", that\n // \"/..\" is removed.\n while (\n path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length\n ) {}\n return path.split('').reverse().join('');\n },\n buildURLFromParts: function (parts) {\n return (\n parts.scheme +\n parts.netLoc +\n parts.path +\n parts.params +\n parts.query +\n parts.fragment\n );\n },\n };\n\n if (typeof exports === 'object' && typeof module === 'object')\n module.exports = URLToolkit;\n else if (typeof define === 'function' && define.amd)\n define([], function () {\n return URLToolkit;\n });\n else if (typeof exports === 'object') exports['URLToolkit'] = URLToolkit;\n else root['URLToolkit'] = URLToolkit;\n})(this);\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar punycode = require('punycode');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n },\n querystring = require('querystring');\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && isObject(url) && url instanceof Url) return url;\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n hostEnd = hec;\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n hostEnd = rest.length;\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) continue;\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a puny coded representation of \"domain\".\n // It only converts the part of the domain name that\n // has non ASCII characters. I.e. it dosent matter if\n // you call it with a domain that already is in ASCII.\n var domainArray = this.hostname.split('.');\n var newOut = [];\n for (var i = 0; i < domainArray.length; ++i) {\n var s = domainArray[i];\n newOut.push(s.match(/[^A-Za-z0-9_-]/) ?\n 'xn--' + punycode.encode(s) : s);\n }\n this.hostname = newOut.join('.');\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) this.pathname = rest;\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (isString(obj)) obj = urlParse(obj);\n if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n if (search && search.charAt(0) !== '?') search = '?' + search;\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\n}\n\nUrl.prototype.resolveObject = function(relative) {\n if (isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n Object.keys(this).forEach(function(k) {\n result[k] = this[k];\n }, this);\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n Object.keys(relative).forEach(function(k) {\n if (k !== 'protocol')\n result[k] = relative[k];\n });\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n Object.keys(relative).forEach(function(k) {\n result[k] = relative[k];\n });\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift()));\n if (!relative.host) relative.host = '';\n if (!relative.hostname) relative.hostname = '';\n if (relPath[0] !== '') relPath.unshift('');\n if (relPath.length < 2) relPath.unshift('');\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') srcPath[0] = result.host;\n else srcPath.unshift(result.host);\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') relPath[0] = relative.host;\n else relPath.unshift(relative.host);\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) srcPath = [];\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especialy happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!isNull(result.pathname) || !isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host) && (last === '.' || last === '..') ||\n last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last == '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especialy happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!isNull(result.pathname) || !isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) this.hostname = host;\n};\n\nfunction isString(arg) {\n return typeof arg === \"string\";\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isNull(arg) {\n return arg === null;\n}\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\n"],"names":["pTimeout","promise","timeout","Promise","resolve","reject","timeoutId","setTimeout","Error","then","val","clearTimeout","catch","sleep","timeoutInMs","invokeCallback","ctx","callback","delay","cb","err","log","error","stats","increment","CoreLogger","this","_logs","prototype","level","message","extras","time","Date","push","Object","defineProperty","get","enumerable","configurable","flush","logs","length","formatted","reduce","_a","_b","_c","line","json","JSON","stringify","key","toISOString","concat","Math","random","console","table","forEach","logEntry","ContextCancelation","options","retry","type","reason","CoreContext","event","id","logger","attempts","_id","system","isSame","other","cancel","updateEvent","path","split","integrationName","integrations","failedDelivery","_failedDelivery","setFailedDelivery","toJSON","metrics","Emitter","callbacks","on","once","_this","args","_i","arguments","off","apply","fns","without","filter","fn","emit","backoff","params","minTimeout","factor","attempt","maxTimeout","Infinity","min","pow","ON_REMOVE_FROM_FUTURE","PriorityQueue","_super","maxAttempts","queue","seen","call","future","items","accepted","map","operation","updateAttempts","includes","sort","a","b","getAttempts","pushWithBackoff","item","f","Boolean","find","i","pop","shift","tryAsync","err_1","label","trys","sent","plugin","name","start","getTime","hook","undefined","newCtx","done","gauge","ensure","newContext","compactMetricType","enums","counter","CoreStats","metric","by","tags","value","timestamp","now","m","join","serialize","v","t","k","e","NullStats","_args","isString","obj","isNumber","isFunction","exists","isPlainObject","toString","slice","toLowerCase","getProcessEnv","process","resolveArguments","eventName","properties","data","opts","resolvePageArguments","category","resolvedCategory","resolvedName","strings","resolvedCallback","objects","resolvedProperties","resolvedOptions","resolveUserArguments","user","values","orderStack","_d","args_1","arg","current","traits","resolveAliasArguments","to","from","aliasTo","aliasFrom","getDelay","startTimeInEpochMS","timeoutInMS","elapsedTime","max","dispatch","emitter","startTime","dispatched","isEmpty","dispatchSingle","debug","pick","object","keys","assign","hasOwnProperty","BufferedPageContextDiscriminant","createBufferedPageContext","url","canonicalUrl","search","title","referrer","__t","c","p","u","s","r","BUFFERED_PAGE_CONTEXT_KEYS","isBufferedPageContext","bufferedPageCtx","createCanonicalURL","searchParams","indexOf","removeHash","href","hashIdx","parseCanonicalPath","URL","pathname","_e","createPageContext","newPath","newUrl","getDefaultBufferedPageContext","document","querySelector","location","getAttribute","getDefaultPageContext","addPageContext","pageCtx","pageContextFromEventProps","evtCtx","context","page","EventFactory","track","globalIntegrations","normalize","baseEvent","screen","identify","userId","group","groupId","alias","base","previousId","anonymousId","optionsKeys","providedOptionsKeys","overrides","integrationBooleans","integrationNames","allIntegrations","rest","newEvent","messageId","groupBy","collection","grouper","results","suggestedKey","Function","isThenable","createTaskGroup","taskCompletionPromise","resolvePromise","count","run","op","returnValue","res","finally","CoreEventQueue","priorityQueue","criticalTasks","plugins","failedInitializations","flushing","scheduleFlush","register","instance","load","warn","deregister","e_1","unload","willDeliver","subscribeToDelivery","onDeliver","flushed","delivered","deliver","enqueuRetry","flushOne","retriable","err_2","isReady","availableExtensions","denyList","available","alternativeNameMatch","alternativeNames","All","before","enrichment","destination","after","destinations","before_1","beforeWare","enrichment_1","enrichmentWare","temp","afterCalls","_f","all","EventQueue","nameOrQueue","bindAll","proto","constructor","getOwnPropertyNames","desc","getOwnPropertyDescriptor","bind","StoreType","Cookie","LocalStorage","Memory","_logStoreKeyError","store","action","UniversalStorage","stores","set","clear","remove","getAndSync","coercedValue","MemoryStorage","cache","isArrayOfStoreType","Array","isArray","every","isStoreTypeWithSettings","levels","host","hostname","parts","last","parseInt","parseUrl","tld","parsedUrl","lvls","cname","domain","_","ONE_YEAR","CookieStorage","defaults","maxage","window","sameSite","expires","secure","parse","localStorageWarning","state","localStorage","getItem","setItem","removeItem","initializeStorages","storages","settings","applyCookieOptions","storeTypes","cookieOptions","persist","cookie","oldKey","User","disable","prevId","identityStore","idKey","changingIdentity","retId","retLeg","legacyUserStore","anonKey","legacySIO","traitsStore","traitsKey","createStorage","legacyUser","anon","currentId","logout","reset","save","cookieOpts","filterStores","storage","localStorageFallbackDisabled","groupDefaults","Group","flushSyncAnalyticsCalls","analytics","buffer","getCalls","callAnalyticsMethod","flushAddSourceMiddleware","flushOn","flushSetAnonymousID","flushAnalyticsCallsInNewTask","toArray","popPageContext","hasBufferedPageContextAsLastArg","lastArg","PreInitMethodCall","method","called","PreInitMethodCallBuffer","calls","_callMap","_pushSnippetWindowBuffer","methodName","eventsExpectingPageContext","wa","buffered","splice","result","AnalyticsBuffered","loader","trackSubmit","_createMethod","trackClick","trackLink","pageView","ready","_createChainableMethod","addSourceMiddleware","setAnonymousId","addDestinationMiddleware","VERSION","version","_preInitBuffer","_promise","ajs","deprecationWarning","global","_analytics","createDefaultQueue","retryQueue","disablePersistance","_stub","Analytics","_debug","initialized","_user","init","initialize","addIntegrationMiddleware","listeners","addEventListener","removeAllListeners","removeListener","removeEventListener","hasListeners","add","addIntegration","disableClientPersistence","writeKey","storageSetting","_universalStorage","createStore","_group","eventFactory","segmentEvent","_dispatch","_traits","groupTraits","autotrack","link","form","trackForm","registrations","xt","deregistrations","pl","toggle","sourceMiddlewarePlugin","middlewares","legacyDestinations","addMiddleware","queryString","query","useQueryString","use","legacyPluginFactory","noConflict","msg","_settings","_options","pageview","_plugins","acc","replace","integration","nested","Integration","an","createDeferred","_resolve","_reject","clientHints","hints","userAgentData","navigator","getHighEntropyValues","getCookieOptions","ads","queryIds","btid","urid","startsWith","substring","parts_1","part","utm","str","utmParam","gracefulDecodeURIComponent","ampId","referrerId","stored","ad","objectToQueryString","searchParams_1","URLSearchParams","entries","append","EnvironmentEnrichmentPlugin","isLoaded","_ctx","highEntropyValuesClientHints","enrich","userAgent","locale","userLanguage","language","library","campaign","amp","timezone","Intl","DateTimeFormat","timeZone","envEnrichment","ActionDestination","middleware","transform","modifiedEvent","applyDestinationMiddleware","transformedContext","error_1","error_2","validate","pluginLike","required","isPluginDisabled","userIntegrations","remotePlugin","creationNameEnabled","creationName","currentNameEnabled","loadPluginFactory","obfuscate","defaultCdn","cdn","urlSplit","name_1","obfuscatedURL","RegExp","btoa","libraryName","remoteLoader","mergedIntegrations","routingMiddleware","pluginSources","allPlugins","routingRules","pluginPromises","middlewareSettings","remotePlugins","pluginFactory","routing_1","error_4","pluginName","rule","destinationName","wrapper","onPageChange","unloaded","visibilityState","MAX_PAYLOAD_SIZE","kilobytes","size","encodeURI","approachingTrackingAPILimit","chunks","batch","index","apiHost","config","schedule","pageUnloaded","limit","sendBatch","updatedBatch","sentAt","fetch","keepalive","headers","body","batch_1","_url","bufferOverflow","reqs","apiKey","failed","_metadata","bundled","unbundled","bundlingStatus","unbundledIntegrations","settingsUnbundled","configIds","maybeBundledConfigIds","bundledConfigIds","addBundledMetadata","bundledIds","flushQueue","failedQueue","success","isFlushing","newBuffer","todo","onAlias","segmentio","inflightEvents","Set","protocol","remote","deliveryStrategy","client","strategy","send","charAt","delete","ValidationError","field","stringError","objError","nilError","assertUserIdentity","USER_FIELD_NAME","getAnyUserId","assertEventExists","assertEventType","assertTrackEventName","props","validation","env","inspectorHost","attachInspector","attach","loadLegacySettings","cdnURL","baseUrl","ok","text","errorResponseMessage","hasLegacyDestinations","NODE_ENV","hasTsubMiddleware","flushPreBuffer","flushFinalBuffer","registerPlugins","legacySettings","pluginLikes","legacyIntegrationSources","tsubMiddleware","schemaFilter","mergedSettings","toRegister","shouldIgnoreSegmentio","_g","_h","_j","mod","ajsDestinations","legacyVideoPluginsEnabled","loadLegacyVideoPlugins","plan","enabledMiddleware","some","enabled","remoteMiddlewares","promises","mdw","loadAnalytics","preInitBuffer","classicIntegrations","hash","term","globalAnalyticsKey","cdnSettings","updateCDNSettings","initialPageview","AnalyticsBrowser","loadStart","resolveLoadStart","_resolveLoadStart","standalone","isOnline","onLine","isOffline","SEGMENT_API_HOST","Context","isBrowser","isServer","encodedURIComponent","decodeURIComponent","createRemoteMetric","versionType","formattedTags","library_version","logError","remoteMetrics","RemoteMetrics","sampleRate","flushTimer","maxQueueSize","flushing_1","run_1","remoteMetric","payload","series","Stats","initRemoteMetrics","n","XMLHttpRequest","o","status","statusText","responseURL","responseText","blob","Blob","response","clone","has","l","open","onload","getAllResponseHeaders","onerror","withCredentials","credentials","setRequestHeader","getGlobal","globalThis","self","g","_globalAnalyticsKey","getGlobalAnalytics","setGlobalAnalyticsKey","setGlobalAnalytics","findScript","src","scripts","querySelectorAll","loadScript","attributes","found","status_1","script","createElement","async","setAttribute","tag","getElementsByTagName","parentElement","insertBefore","unloadScript","mergedOptions","optionOverrides","integrationSettings","pWhile","condition","loop","actionResult","_globalCDN","analyticsScriptRegex","getCDNUrlFromScriptTag","exec","getGlobalCDNUrl","_cdn","setGlobalCDNUrl","globalAnalytics","getCDN","globalCdnUrl","cdnFromScriptTag","getNextIntegrationsURL","loc","persisted","persistItems","existing","merged","persistSeen","memory","mutex","onUnlock","lockTimeout","lockKey","expired","lock","rawLock","allowed","PersistedPriorityQueue","itemsKey","seenKey","saved","lastSeen","items_1","toFacade","evt","fcd","Facade","Track","Identify","Page","Alias","Screen","writable","_version","getVersionType","applyMiddleware","nextCalled","returnedEvent","traverse","next","middleware_1","md","rawEvent","__importDefault","__esModule","exports","obj_case_1","trait","default","default_1","zip","country","street","city","region","inherits_1","facade_1","dictionary","Delete","address_1","clone_1","is_enabled_1","new_date_1","isodate_traverse_1","raw","proxy","fields","multi","one","ret","allEnabled","providers","active","sessionId","aliases","device","channel","ip","is_email_1","created","email","industry","employees","trim","companyCreated","companyName","firstName","lastName","space","substr","uid","username","description","age","date","birthday","getFullYear","avatar","position","website","websites","phone","phones","address","gender","__assign","alias_1","group_1","identify_1","track_1","page_1","screen_1","delete_1","matcher","isEmail","string","test","disabled","Salesforce","fullName","currency","parseFloat","isNaN","productId","promotionId","cartId","checkoutId","paymentId","couponId","wishlistId","reviewId","orderId","sku","tax","price","total","repeat","coupon","shipping","discount","shippingMethod","paymentMethod","subtotal","revenue","products","quantity","orderCompletedRegExp","match","cents","isodate","input","strict","traverseObject","traverseArray","is","arr","module","iso","numericKeys","offset","getTimezoneOffset","millis","UTC","canPromise","QRCode","CanvasRenderer","SvgRenderer","renderCanvas","renderFunc","canvas","argsNum","isLastArgCb","getContext","create","toCanvas","render","toDataURL","renderToDataURL","getSymbolSize","getRowColCoords","posCount","floor","intervals","ceil","positions","reverse","getPositions","coords","pos","posLength","j","Mode","ALPHA_NUM_CHARS","AlphanumericData","mode","ALPHANUMERIC","getBitsLength","getLength","write","bitBuffer","put","BitBuffer","bufIndex","num","putBit","getLengthInBits","bit","BitMatrix","Uint8Array","reservedBit","row","col","reserved","xor","isReserved","encodeUtf8","ByteData","BYTE","ECLevel","EC_BLOCKS_TABLE","EC_CODEWORDS_TABLE","getBlocksCount","errorCorrectionLevel","L","M","Q","H","getTotalCodewordsCount","fromString","lcStr","isValid","defaultValue","FINDER_PATTERN_SIZE","Utils","G15","G15_MASK","G15_BCH","getBCHDigit","getEncodedBits","mask","d","EXP_TABLE","LOG_TABLE","x","exp","mul","y","KanjiData","KANJI","toSJIS","Patterns","PATTERN000","PATTERN001","PATTERN010","PATTERN011","PATTERN100","PATTERN101","PATTERN110","PATTERN111","PenaltyScores","N1","N2","N3","N4","getMaskAt","maskPattern","getPenaltyN1","points","sameCountCol","sameCountRow","lastCol","lastRow","getPenaltyN2","getPenaltyN3","bitsCol","bitsRow","getPenaltyN4","darkCount","modulesCount","abs","applyMask","pattern","getBestMask","setupFormatFunc","numPatterns","bestPattern","lowerPenalty","penalty","VersionCheck","Regex","NUMERIC","ccBits","MIXED","getCharCountIndicator","getBestModeForData","dataStr","testNumeric","testAlphanumeric","testKanji","NumericData","remainingNum","GF","p1","p2","coeff","divident","divisor","generateECPolynomial","degree","poly","AlignmentPattern","FinderPattern","MaskPattern","ECCode","ReedSolomonEncoder","Version","FormatInfo","Segments","setupFinderPattern","matrix","setupTimingPattern","setupAlignmentPattern","setupVersionInfo","bits","setupFormatInfo","setupData","inc","bitIndex","byteIndex","dark","createData","segments","totalCodewords","getSymbolTotalCodewords","ecTotalCodewords","dataTotalCodewordsBits","remainingByte","createCodewords","dataTotalCodewords","ecTotalBlocks","blocksInGroup2","blocksInGroup1","totalCodewordsInGroup1","dataCodewordsInGroup1","dataCodewordsInGroup2","ecCount","rs","dcData","ecData","maxDataSize","dataSize","encode","createSymbol","fromArray","estimatedVersion","rawSegments","rawSplit","getBestVersionForData","bestVersion","dataBits","moduleCount","modules","toSJISFunc","setToSJISFunction","Polynomial","genPoly","paddedData","remainder","buff","numeric","alphanumeric","kanji","byte","BYTE_KANJI","TEST_KANJI","TEST_NUMERIC","TEST_ALPHANUMERIC","dijkstra","getStringByteLength","unescape","encodeURIComponent","getSegments","regex","getSegmentsFromString","numSegs","alphaNumSegs","byteSegs","kanjiSegs","isKanjiModeEnabled","segs","s1","s2","getSegmentBitsLength","mergeSegments","curr","prevSeg","buildNodes","nodes","seg","buildGraph","graph","prevNodeIds","nodeGroup","currentNodeIds","node","lastCount","prevNodeId","end","buildSingleSegment","modesHint","bestMode","array","find_path","optimizedSegs","toSJISFunction","CODEWORDS_COUNT","digit","G18","G18_BCH","getBestVersionForDataLength","currentVersion","getCapacity","getReservedBitsCount","getTotalBitsFromDataArray","totalBits","reservedBits","getBestVersionForMixedData","usableBits","ecl","clearCanvas","clearRect","width","height","style","getCanvasElement","qrData","canvasEl","getOptions","getImageWidth","image","createImageData","qrToImageData","putImageData","rendererOpts","quality","getColorAttrib","color","attrib","alpha","hex","toFixed","svgCmd","cmd","qrToPath","margin","moveBy","newRow","lineLength","qrcodesize","bg","light","viewBox","svgTag","hex2rgba","hexCode","hexValue","scale","getScale","qrSize","imgData","qr","symbolSize","scaledMargin","palette","posDst","pxColor","iSrc","jSrc","prop","qs","sep","eq","regexp","maxKeys","len","kstr","vstr","idx","stringifyPrimitive","isFinite","ks","decode","SafeParseTuple","reviver","clamp","sign","round","clearTask","replacer","hyphenate","$","parent","nodeName","documentElement","setAttrs","el","attrs","setProps","cssProps","setProperty","subscribers","enqueue","requestAnimationFrame","subscribe","cancelAnimationFrame","unwrap","doc","noop","main","clientOffsetX","clientOffsety","sub","onChange","onHidden","onShown","onScroll","se","scrollingElement","container","rootChanged","scrollingElementContext","elementContextList","targets","scope","element","update","clientWidth","clientHeight","scrollDirX","scrollLeft","pageXOffset","scrollDirY","scrollTop","pageYOffset","scrollPercentX","scrollWidth","scrollPercentY","scrollHeight","childChanged","index_1","target","offsetX","offsetY","offsetLeft","offsetTop","offsetParent","elementHeight","offsetHeight","elementWidth","offsetWidth","visibleX","visibleY","intersectX","intersectY","viewportX","viewportY","visible","threshold","changedVisible","changed","_changed","_visibleChanged","maybeUnsubscribe","justOnce","hasAttribute","scroll","updateTaskId","onUpdate","teardown","Point","distanceTo","sqrt","equals","velocityFrom","Bezier","startPoint","control2","control1","endPoint","startWidth","endWidth","static","widths","c2","calculateControlPoints","c3","c1","s3","dx1","dy1","dx2","dy2","m1","m2","l1","l2","dxm","dym","cm","tx","ty","steps","px","py","cx","point","cy","xdiff","ydiff","throttle","wait","storedContext","storedArgs","previous","later","remaining","SignaturePad","_handleMouseDown","which","_mouseButtonDown","_strokeBegin","_handleMouseMove","_strokeMoveUpdate","_handleMouseUp","_strokeEnd","_handleTouchStart","preventDefault","targetTouches","touch","changedTouches","_handleTouchMove","_handleTouchEnd","wasCanvasTouched","velocityFilterWeight","minWidth","maxWidth","minDistance","dotSize","penColor","backgroundColor","onBegin","onEnd","_strokeUpdate","fillStyle","fillRect","_data","_reset","_isEmpty","fromDataURL","dataUrl","Image","ratio","devicePixelRatio","drawImage","encoderOptions","_toSVG","touchAction","msTouchAction","PointerEvent","_handlePointerEvents","_handleMouseEvents","_handleTouchEvents","fromData","pointGroups","_fromData","curve","_drawCurve","_drawDot","toData","newPointGroup","clientX","clientY","_createPoint","lastPointGroup","lastPoints","lastPoint","isLastPointTooClose","_addPoint","_lastPoints","_lastVelocity","_lastWidth","rect","getBoundingClientRect","left","top","unshift","_calculateCurveWidths","fromPoints","velocity","newWidth","_strokeWidth","_drawCurveSegment","moveTo","arc","PI","widthDelta","drawSteps","beginPath","tt","ttt","uu","uuu","closePath","fill","drawCurve","drawDot","basicPoint","minX","minY","maxX","maxY","svg","createElementNS","attr","appendChild","circle","prefix","header","innerHTML","dummy","childNodes","cloneNode","footer","factory","hex_chr","md5cycle","md5blk","md5blks","charCodeAt","md5blk_array","md51","tail","tmp","lo","hi","md51_array","subarray","rhex","toUtf8","utf8Str2ArrayBuffer","returnUInt8Array","ArrayBuffer","arrayBuffer2Utf8Str","String","fromCharCode","concatenateArrayBuffers","first","second","byteLength","hexToBinaryString","bytes","SparkMD5","lsw","msw","targetArray","sourceArray","begin","appendBinary","contents","_buff","_length","_hash","_finish","getState","setState","destroy","hashBinary","content","TinyQueue","compare","defaultCompare","_down","_up","bottom","peek","halfLength","best","right","extendStatics","setPrototypeOf","__proto__","__extends","TypeError","__","__rest","getOwnPropertySymbols","propertyIsEnumerable","__awaiter","thisArg","_arguments","P","generator","adopt","fulfilled","step","rejected","__generator","ops","verb","Symbol","iterator","__values","__read","ar","__spread","__spreadArray","pack","root","URL_REGEX","FIRST_SEGMENT_REGEX","SLASH_DOT_REGEX","SLASH_DOT_DOT_REGEX","URLToolkit","buildAbsoluteURL","baseURL","relativeURL","alwaysNormalize","basePartsForNormalise","parseURL","normalizePath","buildURLFromParts","relativeParts","scheme","baseParts","netLoc","pathParts","builtParts","fragment","baseURLPath","lastIndexOf","punycode","Url","slashes","auth","port","urlParse","urlResolve","resolveObject","urlResolveObject","format","urlFormat","protocolPattern","portPattern","delims","unwise","autoEscape","nonHostChars","hostEndingChars","hostnameMaxLen","hostnamePartPattern","hostnamePartStart","unsafeProtocol","hostlessProtocol","slashedProtocol","querystring","parseQueryString","slashesDenoteHost","isObject","source","relative","isNull","isNullOrUndefined","lowerProto","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","newpart","validParts","notHost","domainArray","newOut","h","ae","esc","escape","qm","rel","relPath","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","authInHost","hasTrailingSlash","up","isAbsolute"],"sourceRoot":""}