{ "version": 3, "sources": ["../../../node_modules/@rails/actioncable/src/adapters.js", "../../../node_modules/@rails/actioncable/src/logger.js", "../../../node_modules/@rails/actioncable/src/connection_monitor.js", "../../../node_modules/@rails/actioncable/src/internal.js", "../../../node_modules/@rails/actioncable/src/connection.js", "../../../node_modules/@rails/actioncable/src/subscription.js", "../../../node_modules/@rails/actioncable/src/subscription_guarantor.js", "../../../node_modules/@rails/actioncable/src/subscriptions.js", "../../../node_modules/@rails/actioncable/src/consumer.js", "../../../node_modules/@rails/actioncable/src/index.js", "../../../node_modules/@honeybadger-io/core/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js", "../../../node_modules/@honeybadger-io/core/build/src/util.js", "../../../node_modules/@honeybadger-io/core/build/src/plugins/events.js", "../../../node_modules/@honeybadger-io/core/build/src/store.js", "../../../node_modules/@honeybadger-io/core/node_modules/json-nd/dist/module/index.js", "../../../node_modules/@honeybadger-io/core/build/src/defaults.js", "../../../node_modules/@honeybadger-io/core/build/src/throttled_events_logger.js", "../../../node_modules/@honeybadger-io/core/build/src/client.js", "../../../node_modules/@honeybadger-io/core/build/src/types.js", "../../../node_modules/@honeybadger-io/core/build/src/index.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/util.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/onerror.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/onunhandledrejection.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/breadcrumbs.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/timers.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/integrations/event_listeners.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/transport.js", "../../../node_modules/@honeybadger-io/js/build/src/browser/feedback-form.js", "../../../node_modules/@honeybadger-io/js/build/src/browser.js", "../../../node_modules/tom-select/src/contrib/microevent.ts", "../../../node_modules/tom-select/src/contrib/microplugin.ts", "../../../node_modules/tom-select/node_modules/@orchidjs/unicode-variants/dist/esm/regex.js", "../../../node_modules/tom-select/node_modules/@orchidjs/unicode-variants/dist/esm/strings.js", "../../../node_modules/tom-select/node_modules/@orchidjs/unicode-variants/dist/esm/index.js", "../../../node_modules/tom-select/node_modules/@orchidjs/sifter/dist/esm/utils.js", "../../../node_modules/tom-select/node_modules/@orchidjs/sifter/dist/esm/sifter.js", "../../../node_modules/tom-select/node_modules/@orchidjs/sifter/lib/utils.ts", "../../../node_modules/tom-select/src/vanilla.ts", "../../../node_modules/tom-select/src/contrib/highlight.ts", "../../../node_modules/tom-select/src/constants.ts", "../../../node_modules/tom-select/src/defaults.ts", "../../../node_modules/tom-select/src/utils.ts", "../../../node_modules/tom-select/src/getSettings.ts", "../../../node_modules/tom-select/src/tom-select.ts", "../../../node_modules/tom-select/src/plugins/change_listener/plugin.ts", "../../../node_modules/tom-select/src/plugins/checkbox_options/plugin.ts", "../../../node_modules/tom-select/src/plugins/clear_button/plugin.ts", "../../../node_modules/tom-select/src/plugins/drag_drop/plugin.ts", "../../../node_modules/tom-select/src/plugins/dropdown_header/plugin.ts", "../../../node_modules/tom-select/src/plugins/caret_position/plugin.ts", "../../../node_modules/tom-select/src/plugins/dropdown_input/plugin.ts", "../../../node_modules/tom-select/src/plugins/input_autogrow/plugin.ts", "../../../node_modules/tom-select/src/plugins/no_backspace_delete/plugin.ts", "../../../node_modules/tom-select/src/plugins/no_active_items/plugin.ts", "../../../node_modules/tom-select/src/plugins/optgroup_columns/plugin.ts", "../../../node_modules/tom-select/src/plugins/remove_button/plugin.ts", "../../../node_modules/tom-select/src/plugins/restore_on_backspace/plugin.ts", "../../../node_modules/tom-select/src/plugins/virtual_scroll/plugin.ts", "../../../node_modules/tom-select/src/tom-select.complete.ts", "../../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js", "../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js", "../../../node_modules/invokers-polyfill/invoker.js", "../../javascript/helpers/config_value.js", "../../../node_modules/@hotwired/stimulus/dist/stimulus.js", "../../javascript/controllers/application.js", "../../../node_modules/@rails/request.js/src/fetch_response.js", "../../../node_modules/@rails/request.js/src/request_interceptor.js", "../../../node_modules/@rails/request.js/src/lib/utils.js", "../../../node_modules/@rails/request.js/src/fetch_request.js", "../../../node_modules/@rails/request.js/src/verbs.js", "../../javascript/controllers/application/activation_section_controller.js", "../../javascript/controllers/application/analytics_controller.js", "../../javascript/controllers/application/calculator_controller.js", "../../javascript/helpers/stimulus_util.js", "../../javascript/controllers/application/course_controller.js", "../../javascript/controllers/application/tabs_controller.js", "../../javascript/controllers/application/wistia_controller.js", "../../javascript/controllers/application/wistia_thumbnail_controller.js", "../../javascript/controllers/shared/auto_submit_form_controller.js", "../../javascript/helpers/notify_assistive_tech.js", "../../javascript/controllers/shared/clipboard_controller.js", "../../javascript/controllers/shared/elements_controller.js", "../../javascript/controllers/shared/scrollable_region_controller.js", "../../javascript/controllers/shared/toggle_controller.js", "../../javascript/controllers/shared/tom_select_controller.js", "../../javascript/controllers/shared/window_controller.js", "../../javascript/controllers/application/index.js", "../../javascript/application.js"], "sourcesContent": ["export default {\n logger: self.console,\n WebSocket: self.WebSocket\n}\n", "import adapters from \"./adapters\"\n\n// The logger is disabled by default. You can enable it with:\n//\n// ActionCable.logger.enabled = true\n//\n// Example:\n//\n// import * as ActionCable from '@rails/actioncable'\n//\n// ActionCable.logger.enabled = true\n// ActionCable.logger.log('Connection Established.')\n//\n\nexport default {\n log(...messages) {\n if (this.enabled) {\n messages.push(Date.now())\n adapters.logger.log(\"[ActionCable]\", ...messages)\n }\n },\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting\n// revival reconnections if things go astray. Internal class, not intended for direct user manipulation.\n\nconst now = () => new Date().getTime()\n\nconst secondsSince = time => (now() - time) / 1000\n\nclass ConnectionMonitor {\n constructor(connection) {\n this.visibilityDidChange = this.visibilityDidChange.bind(this)\n this.connection = connection\n this.reconnectAttempts = 0\n }\n\n start() {\n if (!this.isRunning()) {\n this.startedAt = now()\n delete this.stoppedAt\n this.startPolling()\n addEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)\n }\n }\n\n stop() {\n if (this.isRunning()) {\n this.stoppedAt = now()\n this.stopPolling()\n removeEventListener(\"visibilitychange\", this.visibilityDidChange)\n logger.log(\"ConnectionMonitor stopped\")\n }\n }\n\n isRunning() {\n return this.startedAt && !this.stoppedAt\n }\n\n recordPing() {\n this.pingedAt = now()\n }\n\n recordConnect() {\n this.reconnectAttempts = 0\n this.recordPing()\n delete this.disconnectedAt\n logger.log(\"ConnectionMonitor recorded connect\")\n }\n\n recordDisconnect() {\n this.disconnectedAt = now()\n logger.log(\"ConnectionMonitor recorded disconnect\")\n }\n\n // Private\n\n startPolling() {\n this.stopPolling()\n this.poll()\n }\n\n stopPolling() {\n clearTimeout(this.pollTimeout)\n }\n\n poll() {\n this.pollTimeout = setTimeout(() => {\n this.reconnectIfStale()\n this.poll()\n }\n , this.getPollInterval())\n }\n\n getPollInterval() {\n const { staleThreshold, reconnectionBackoffRate } = this.constructor\n const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10))\n const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate\n const jitter = jitterMax * Math.random()\n return staleThreshold * 1000 * backoff * (1 + jitter)\n }\n\n reconnectIfStale() {\n if (this.connectionIsStale()) {\n logger.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`)\n this.reconnectAttempts++\n if (this.disconnectedRecently()) {\n logger.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`)\n } else {\n logger.log(\"ConnectionMonitor reopening\")\n this.connection.reopen()\n }\n }\n }\n\n get refreshedAt() {\n return this.pingedAt ? this.pingedAt : this.startedAt\n }\n\n connectionIsStale() {\n return secondsSince(this.refreshedAt) > this.constructor.staleThreshold\n }\n\n disconnectedRecently() {\n return this.disconnectedAt && (secondsSince(this.disconnectedAt) < this.constructor.staleThreshold)\n }\n\n visibilityDidChange() {\n if (document.visibilityState === \"visible\") {\n setTimeout(() => {\n if (this.connectionIsStale() || !this.connection.isOpen()) {\n logger.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`)\n this.connection.reopen()\n }\n }\n , 200)\n }\n }\n\n}\n\nConnectionMonitor.staleThreshold = 6 // Server::Connections::BEAT_INTERVAL * 2 (missed two pings)\nConnectionMonitor.reconnectionBackoffRate = 0.15\n\nexport default ConnectionMonitor\n", "export default {\n \"message_types\": {\n \"welcome\": \"welcome\",\n \"disconnect\": \"disconnect\",\n \"ping\": \"ping\",\n \"confirmation\": \"confirm_subscription\",\n \"rejection\": \"reject_subscription\"\n },\n \"disconnect_reasons\": {\n \"unauthorized\": \"unauthorized\",\n \"invalid_request\": \"invalid_request\",\n \"server_restart\": \"server_restart\",\n \"remote\": \"remote\"\n },\n \"default_mount_path\": \"/cable\",\n \"protocols\": [\n \"actioncable-v1-json\",\n \"actioncable-unsupported\"\n ]\n}\n", "import adapters from \"./adapters\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport INTERNAL from \"./internal\"\nimport logger from \"./logger\"\n\n// Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.\n\nconst {message_types, protocols} = INTERNAL\nconst supportedProtocols = protocols.slice(0, protocols.length - 1)\n\nconst indexOf = [].indexOf\n\nclass Connection {\n constructor(consumer) {\n this.open = this.open.bind(this)\n this.consumer = consumer\n this.subscriptions = this.consumer.subscriptions\n this.monitor = new ConnectionMonitor(this)\n this.disconnected = true\n }\n\n send(data) {\n if (this.isOpen()) {\n this.webSocket.send(JSON.stringify(data))\n return true\n } else {\n return false\n }\n }\n\n open() {\n if (this.isActive()) {\n logger.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`)\n return false\n } else {\n const socketProtocols = [...protocols, ...this.consumer.subprotocols || []]\n logger.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${socketProtocols}`)\n if (this.webSocket) { this.uninstallEventHandlers() }\n this.webSocket = new adapters.WebSocket(this.consumer.url, socketProtocols)\n this.installEventHandlers()\n this.monitor.start()\n return true\n }\n }\n\n close({allowReconnect} = {allowReconnect: true}) {\n if (!allowReconnect) { this.monitor.stop() }\n // Avoid closing websockets in a \"connecting\" state due to Safari 15.1+ bug. See: https://github.com/rails/rails/issues/43835#issuecomment-1002288478\n if (this.isOpen()) {\n return this.webSocket.close()\n }\n }\n\n reopen() {\n logger.log(`Reopening WebSocket, current state is ${this.getState()}`)\n if (this.isActive()) {\n try {\n return this.close()\n } catch (error) {\n logger.log(\"Failed to reopen WebSocket\", error)\n }\n finally {\n logger.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`)\n setTimeout(this.open, this.constructor.reopenDelay)\n }\n } else {\n return this.open()\n }\n }\n\n getProtocol() {\n if (this.webSocket) {\n return this.webSocket.protocol\n }\n }\n\n isOpen() {\n return this.isState(\"open\")\n }\n\n isActive() {\n return this.isState(\"open\", \"connecting\")\n }\n\n triedToReconnect() {\n return this.monitor.reconnectAttempts > 0\n }\n\n // Private\n\n isProtocolSupported() {\n return indexOf.call(supportedProtocols, this.getProtocol()) >= 0\n }\n\n isState(...states) {\n return indexOf.call(states, this.getState()) >= 0\n }\n\n getState() {\n if (this.webSocket) {\n for (let state in adapters.WebSocket) {\n if (adapters.WebSocket[state] === this.webSocket.readyState) {\n return state.toLowerCase()\n }\n }\n }\n return null\n }\n\n installEventHandlers() {\n for (let eventName in this.events) {\n const handler = this.events[eventName].bind(this)\n this.webSocket[`on${eventName}`] = handler\n }\n }\n\n uninstallEventHandlers() {\n for (let eventName in this.events) {\n this.webSocket[`on${eventName}`] = function() {}\n }\n }\n\n}\n\nConnection.reopenDelay = 500\n\nConnection.prototype.events = {\n message(event) {\n if (!this.isProtocolSupported()) { return }\n const {identifier, message, reason, reconnect, type} = JSON.parse(event.data)\n switch (type) {\n case message_types.welcome:\n if (this.triedToReconnect()) {\n this.reconnectAttempted = true\n }\n this.monitor.recordConnect()\n return this.subscriptions.reload()\n case message_types.disconnect:\n logger.log(`Disconnecting. Reason: ${reason}`)\n return this.close({allowReconnect: reconnect})\n case message_types.ping:\n return this.monitor.recordPing()\n case message_types.confirmation:\n this.subscriptions.confirmSubscription(identifier)\n if (this.reconnectAttempted) {\n this.reconnectAttempted = false\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: true})\n } else {\n return this.subscriptions.notify(identifier, \"connected\", {reconnected: false})\n }\n case message_types.rejection:\n return this.subscriptions.reject(identifier)\n default:\n return this.subscriptions.notify(identifier, \"received\", message)\n }\n },\n\n open() {\n logger.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`)\n this.disconnected = false\n if (!this.isProtocolSupported()) {\n logger.log(\"Protocol is unsupported. Stopping monitor and disconnecting.\")\n return this.close({allowReconnect: false})\n }\n },\n\n close(event) {\n logger.log(\"WebSocket onclose event\")\n if (this.disconnected) { return }\n this.disconnected = true\n this.monitor.recordDisconnect()\n return this.subscriptions.notifyAll(\"disconnected\", {willAttemptReconnect: this.monitor.isRunning()})\n },\n\n error() {\n logger.log(\"WebSocket onerror event\")\n }\n}\n\nexport default Connection\n", "// A new subscription is created through the ActionCable.Subscriptions instance available on the consumer.\n// It provides a number of callbacks and a method for calling remote procedure calls on the corresponding\n// Channel instance on the server side.\n//\n// An example demonstrates the basic functionality:\n//\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\", {\n// connected() {\n// // Called once the subscription has been successfully completed\n// },\n//\n// disconnected({ willAttemptReconnect: boolean }) {\n// // Called when the client has disconnected with the server.\n// // The object will have an `willAttemptReconnect` property which\n// // says whether the client has the intention of attempting\n// // to reconnect.\n// },\n//\n// appear() {\n// this.perform('appear', {appearing_on: this.appearingOn()})\n// },\n//\n// away() {\n// this.perform('away')\n// },\n//\n// appearingOn() {\n// $('main').data('appearing-on')\n// }\n// })\n//\n// The methods #appear and #away forward their intent to the remote AppearanceChannel instance on the server\n// by calling the `perform` method with the first parameter being the action (which maps to AppearanceChannel#appear/away).\n// The second parameter is a hash that'll get JSON encoded and made available on the server in the data parameter.\n//\n// This is how the server component would look:\n//\n// class AppearanceChannel < ApplicationActionCable::Channel\n// def subscribed\n// current_user.appear\n// end\n//\n// def unsubscribed\n// current_user.disappear\n// end\n//\n// def appear(data)\n// current_user.appear on: data['appearing_on']\n// end\n//\n// def away\n// current_user.away\n// end\n// end\n//\n// The \"AppearanceChannel\" name is automatically mapped between the client-side subscription creation and the server-side Ruby class name.\n// The AppearanceChannel#appear/away public methods are exposed automatically to client-side invocation through the perform method.\n\nconst extend = function(object, properties) {\n if (properties != null) {\n for (let key in properties) {\n const value = properties[key]\n object[key] = value\n }\n }\n return object\n}\n\nexport default class Subscription {\n constructor(consumer, params = {}, mixin) {\n this.consumer = consumer\n this.identifier = JSON.stringify(params)\n extend(this, mixin)\n }\n\n // Perform a channel action with the optional data passed as an attribute\n perform(action, data = {}) {\n data.action = action\n return this.send(data)\n }\n\n send(data) {\n return this.consumer.send({command: \"message\", identifier: this.identifier, data: JSON.stringify(data)})\n }\n\n unsubscribe() {\n return this.consumer.subscriptions.remove(this)\n }\n}\n", "import logger from \"./logger\"\n\n// Responsible for ensuring channel subscribe command is confirmed, retrying until confirmation is received.\n// Internal class, not intended for direct user manipulation.\n\nclass SubscriptionGuarantor {\n constructor(subscriptions) {\n this.subscriptions = subscriptions\n this.pendingSubscriptions = []\n }\n\n guarantee(subscription) {\n if(this.pendingSubscriptions.indexOf(subscription) == -1){ \n logger.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`)\n this.pendingSubscriptions.push(subscription) \n }\n else {\n logger.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`)\n }\n this.startGuaranteeing()\n }\n\n forget(subscription) {\n logger.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`)\n this.pendingSubscriptions = (this.pendingSubscriptions.filter((s) => s !== subscription))\n }\n\n startGuaranteeing() {\n this.stopGuaranteeing()\n this.retrySubscribing()\n }\n \n stopGuaranteeing() {\n clearTimeout(this.retryTimeout)\n }\n\n retrySubscribing() {\n this.retryTimeout = setTimeout(() => {\n if (this.subscriptions && typeof(this.subscriptions.subscribe) === \"function\") {\n this.pendingSubscriptions.map((subscription) => {\n logger.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`)\n this.subscriptions.subscribe(subscription)\n })\n }\n }\n , 500)\n }\n}\n\nexport default SubscriptionGuarantor", "import Subscription from \"./subscription\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport logger from \"./logger\"\n\n// Collection class for creating (and internally managing) channel subscriptions.\n// The only method intended to be triggered by the user is ActionCable.Subscriptions#create,\n// and it should be called through the consumer like so:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n\nexport default class Subscriptions {\n constructor(consumer) {\n this.consumer = consumer\n this.guarantor = new SubscriptionGuarantor(this)\n this.subscriptions = []\n }\n\n create(channelName, mixin) {\n const channel = channelName\n const params = typeof channel === \"object\" ? channel : {channel}\n const subscription = new Subscription(this.consumer, params, mixin)\n return this.add(subscription)\n }\n\n // Private\n\n add(subscription) {\n this.subscriptions.push(subscription)\n this.consumer.ensureActiveConnection()\n this.notify(subscription, \"initialized\")\n this.subscribe(subscription)\n return subscription\n }\n\n remove(subscription) {\n this.forget(subscription)\n if (!this.findAll(subscription.identifier).length) {\n this.sendCommand(subscription, \"unsubscribe\")\n }\n return subscription\n }\n\n reject(identifier) {\n return this.findAll(identifier).map((subscription) => {\n this.forget(subscription)\n this.notify(subscription, \"rejected\")\n return subscription\n })\n }\n\n forget(subscription) {\n this.guarantor.forget(subscription)\n this.subscriptions = (this.subscriptions.filter((s) => s !== subscription))\n return subscription\n }\n\n findAll(identifier) {\n return this.subscriptions.filter((s) => s.identifier === identifier)\n }\n\n reload() {\n return this.subscriptions.map((subscription) =>\n this.subscribe(subscription))\n }\n\n notifyAll(callbackName, ...args) {\n return this.subscriptions.map((subscription) =>\n this.notify(subscription, callbackName, ...args))\n }\n\n notify(subscription, callbackName, ...args) {\n let subscriptions\n if (typeof subscription === \"string\") {\n subscriptions = this.findAll(subscription)\n } else {\n subscriptions = [subscription]\n }\n\n return subscriptions.map((subscription) =>\n (typeof subscription[callbackName] === \"function\" ? subscription[callbackName](...args) : undefined))\n }\n\n subscribe(subscription) {\n if (this.sendCommand(subscription, \"subscribe\")) {\n this.guarantor.guarantee(subscription)\n }\n }\n\n confirmSubscription(identifier) {\n logger.log(`Subscription confirmed ${identifier}`)\n this.findAll(identifier).map((subscription) =>\n this.guarantor.forget(subscription))\n }\n\n sendCommand(subscription, command) {\n const {identifier} = subscription\n return this.consumer.send({command, identifier})\n }\n}\n", "import Connection from \"./connection\"\nimport Subscriptions from \"./subscriptions\"\n\n// The ActionCable.Consumer establishes the connection to a server-side Ruby Connection object. Once established,\n// the ActionCable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates.\n// The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription\n// method.\n//\n// The following example shows how this can be set up:\n//\n// App = {}\n// App.cable = ActionCable.createConsumer(\"ws://example.com/accounts/1\")\n// App.appearance = App.cable.subscriptions.create(\"AppearanceChannel\")\n//\n// For more details on how you'd configure an actual channel subscription, see ActionCable.Subscription.\n//\n// When a consumer is created, it automatically connects with the server.\n//\n// To disconnect from the server, call\n//\n// App.cable.disconnect()\n//\n// and to restart the connection:\n//\n// App.cable.connect()\n//\n// Any channel subscriptions which existed prior to disconnecting will\n// automatically resubscribe.\n\nexport default class Consumer {\n constructor(url) {\n this._url = url\n this.subscriptions = new Subscriptions(this)\n this.connection = new Connection(this)\n this.subprotocols = []\n }\n\n get url() {\n return createWebSocketURL(this._url)\n }\n\n send(data) {\n return this.connection.send(data)\n }\n\n connect() {\n return this.connection.open()\n }\n\n disconnect() {\n return this.connection.close({allowReconnect: false})\n }\n\n ensureActiveConnection() {\n if (!this.connection.isActive()) {\n return this.connection.open()\n }\n }\n\n addSubProtocol(subprotocol) {\n this.subprotocols = [...this.subprotocols, subprotocol]\n }\n}\n\nexport function createWebSocketURL(url) {\n if (typeof url === \"function\") {\n url = url()\n }\n\n if (url && !/^wss?:/i.test(url)) {\n const a = document.createElement(\"a\")\n a.href = url\n // Fix populating Location properties in IE. Otherwise, protocol will be blank.\n a.href = a.href\n a.protocol = a.protocol.replace(\"http\", \"ws\")\n return a.href\n } else {\n return url\n }\n}\n", "import Connection from \"./connection\"\nimport ConnectionMonitor from \"./connection_monitor\"\nimport Consumer, { createWebSocketURL } from \"./consumer\"\nimport INTERNAL from \"./internal\"\nimport Subscription from \"./subscription\"\nimport Subscriptions from \"./subscriptions\"\nimport SubscriptionGuarantor from \"./subscription_guarantor\"\nimport adapters from \"./adapters\"\nimport logger from \"./logger\"\n\nexport {\n Connection,\n ConnectionMonitor,\n Consumer,\n INTERNAL,\n Subscription,\n Subscriptions,\n SubscriptionGuarantor,\n adapters,\n createWebSocketURL,\n logger,\n}\n\nexport function createConsumer(url = getConfig(\"url\") || INTERNAL.default_mount_path) {\n return new Consumer(url)\n}\n\nexport function getConfig(name) {\n const element = document.head.querySelector(`meta[name='action-cable-${name}']`)\n if (element) {\n return element.getAttribute(\"content\")\n }\n}\n", "var UNKNOWN_FUNCTION = '';\n/**\n * This parses the different stack traces and puts them into one format\n * This borrows heavily from TraceKit (https://github.com/csnover/TraceKit)\n */\n\nfunction parse(stackString) {\n var lines = stackString.split('\\n');\n return lines.reduce(function (stack, line) {\n var parseResult = parseChrome(line) || parseWinjs(line) || parseGecko(line) || parseNode(line) || parseJSC(line);\n\n if (parseResult) {\n stack.push(parseResult);\n }\n\n return stack;\n }, []);\n}\nvar chromeRe = /^\\s*at (.*?) ?\\(((?:file|https?|blob|chrome-extension|native|eval|webpack||\\/|[a-z]:\\\\|\\\\\\\\).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i;\nvar chromeEvalRe = /\\((\\S*)(?::(\\d+))(?::(\\d+))\\)/;\n\nfunction parseChrome(line) {\n var parts = chromeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line\n\n var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line\n\n var submatch = chromeEvalRe.exec(parts[2]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line/column number\n parts[2] = submatch[1]; // url\n\n parts[3] = submatch[2]; // line\n\n parts[4] = submatch[3]; // column\n }\n\n return {\n file: !isNative ? parts[2] : null,\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: isNative ? [parts[2]] : [],\n lineNumber: parts[3] ? +parts[3] : null,\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar winjsRe = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseWinjs(line) {\n var parts = winjsRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nvar geckoRe = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\\[native).*?|[^@]*bundle)(?::(\\d+))?(?::(\\d+))?\\s*$/i;\nvar geckoEvalRe = /(\\S+) line (\\d+)(?: > eval line \\d+)* > eval/i;\n\nfunction parseGecko(line) {\n var parts = geckoRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;\n var submatch = geckoEvalRe.exec(parts[3]);\n\n if (isEval && submatch != null) {\n // throw out eval line/column and use top-most line number\n parts[3] = submatch[1];\n parts[4] = submatch[2];\n parts[5] = null; // no column when eval\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: parts[2] ? parts[2].split(',') : [],\n lineNumber: parts[4] ? +parts[4] : null,\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar javaScriptCoreRe = /^\\s*(?:([^@]*)(?:\\((.*?)\\))?@)?(\\S.*?):(\\d+)(?::(\\d+))?\\s*$/i;\n\nfunction parseJSC(line) {\n var parts = javaScriptCoreRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[3],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[4],\n column: parts[5] ? +parts[5] : null\n };\n}\n\nvar nodeRe = /^\\s*at (?:((?:\\[object object\\])?[^\\\\/]+(?: \\[as \\S+\\])?) )?\\(?(.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i;\n\nfunction parseNode(line) {\n var parts = nodeRe.exec(line);\n\n if (!parts) {\n return null;\n }\n\n return {\n file: parts[2],\n methodName: parts[1] || UNKNOWN_FUNCTION,\n arguments: [],\n lineNumber: +parts[3],\n column: parts[4] ? +parts[4] : null\n };\n}\n\nexport { parse };\n", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.logDeprecatedMethod = exports.globalThisOrWindow = exports.isBrowserConfig = exports.clone = exports.formatCGIData = exports.filterUrl = exports.filter = exports.generateStackTrace = exports.endpoint = exports.instrumentConsole = exports.instrument = exports.isErrorObject = exports.makeNotice = exports.logger = exports.sanitize = exports.shallowClone = exports.runAfterNotifyHandlers = exports.runBeforeNotifyHandlers = exports.getSourceForBacktrace = exports.getCauses = exports.calculateBacktraceShift = exports.DEFAULT_BACKTRACE_SHIFT = exports.makeBacktrace = exports.objectIsExtensible = exports.objectIsEmpty = exports.mergeNotice = exports.merge = void 0;\n/* eslint-disable prefer-rest-params */\nvar stackTraceParser = __importStar(require(\"stacktrace-parser\"));\nfunction merge(obj1, obj2) {\n var result = {};\n for (var k in obj1) {\n result[k] = obj1[k];\n }\n for (var k in obj2) {\n result[k] = obj2[k];\n }\n return result;\n}\nexports.merge = merge;\nfunction mergeNotice(notice1, notice2) {\n var result = merge(notice1, notice2);\n if (notice1.context && notice2.context) {\n result.context = merge(notice1.context, notice2.context);\n }\n return result;\n}\nexports.mergeNotice = mergeNotice;\nfunction objectIsEmpty(obj) {\n for (var k in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, k)) {\n return false;\n }\n }\n return true;\n}\nexports.objectIsEmpty = objectIsEmpty;\nfunction objectIsExtensible(obj) {\n if (typeof Object.isExtensible !== 'function') {\n return true;\n }\n return Object.isExtensible(obj);\n}\nexports.objectIsExtensible = objectIsExtensible;\nfunction makeBacktrace(stack, filterHbSourceCode, logger) {\n if (filterHbSourceCode === void 0) { filterHbSourceCode = false; }\n if (logger === void 0) { logger = console; }\n if (!stack) {\n return [];\n }\n try {\n var backtrace = stackTraceParser\n .parse(stack)\n .map(function (line) {\n return {\n file: line.file,\n method: line.methodName,\n number: line.lineNumber,\n column: line.column\n };\n });\n if (filterHbSourceCode) {\n backtrace.splice(0, calculateBacktraceShift(backtrace));\n }\n return backtrace;\n }\n catch (err) {\n logger.debug(err);\n return [];\n }\n}\nexports.makeBacktrace = makeBacktrace;\nfunction isFrameFromHbSourceCode(frame) {\n var hasHbFile = false;\n var hasHbMethod = false;\n if (frame.file) {\n hasHbFile = frame.file.toLowerCase().indexOf('@honeybadger-io') > -1;\n }\n if (frame.method) {\n hasHbMethod = frame.method.toLowerCase().indexOf('@honeybadger-io') > -1;\n }\n return hasHbFile || hasHbMethod;\n}\nexports.DEFAULT_BACKTRACE_SHIFT = 3;\n/**\n * If {@link generateStackTrace} is used, we want to exclude frames that come from\n * Honeybadger's source code.\n *\n * Logic:\n * - For each frame, increment the shift if source code is from Honeybadger\n * - If a frame from an file is encountered increment the shift ONLY if between Honeybadger source code\n * (i.e. previous and next frames are from Honeybadger)\n * - Exit when frame encountered is not from Honeybadger source code\n *\n * Note: this will not always work, especially in browser versions where code\n * is minified, uglified and bundled.\n * For those cases we default to 3:\n * - generateStackTrace\n * - makeNotice\n * - notify\n */\nfunction calculateBacktraceShift(backtrace) {\n var shift = 0;\n for (var i = 0; i < backtrace.length; i++) {\n var frame = backtrace[i];\n if (isFrameFromHbSourceCode(frame)) {\n shift++;\n continue;\n }\n if (!frame.file || frame.file === '') {\n var nextFrame = backtrace[i + 1];\n if (nextFrame && isFrameFromHbSourceCode(nextFrame)) {\n shift++;\n continue;\n }\n }\n break;\n }\n return shift || exports.DEFAULT_BACKTRACE_SHIFT;\n}\nexports.calculateBacktraceShift = calculateBacktraceShift;\nfunction getCauses(notice, logger) {\n if (notice.cause) {\n var causes = [];\n var cause = notice;\n // @ts-ignore this throws an error if tsconfig.json has strict: true\n while (causes.length < 3 && (cause = cause.cause)) {\n causes.push({\n class: cause.name,\n message: cause.message,\n backtrace: typeof cause.stack == 'string' ? makeBacktrace(cause.stack, false, logger) : null\n });\n }\n return causes;\n }\n return [];\n}\nexports.getCauses = getCauses;\nfunction getSourceForBacktrace(backtrace, getSourceFileHandler) {\n return __awaiter(this, void 0, void 0, function () {\n var result, index, trace, fileContent;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n result = [];\n if (!getSourceFileHandler || !backtrace || !backtrace.length) {\n return [2 /*return*/, result];\n }\n index = 0;\n _a.label = 1;\n case 1:\n if (!backtrace.length) return [3 /*break*/, 3];\n trace = backtrace.splice(0)[index];\n return [4 /*yield*/, getSourceFileHandler(trace.file)];\n case 2:\n fileContent = _a.sent();\n result[index] = getSourceCodeSnippet(fileContent, trace.number);\n index++;\n return [3 /*break*/, 1];\n case 3: return [2 /*return*/, result];\n }\n });\n });\n}\nexports.getSourceForBacktrace = getSourceForBacktrace;\nfunction runBeforeNotifyHandlers(notice, handlers) {\n var results = [];\n var result = true;\n for (var i = 0, len = handlers.length; i < len; i++) {\n var handler = handlers[i];\n var handlerResult = handler(notice);\n if (handlerResult === false) {\n result = false;\n }\n results.push(handlerResult);\n }\n return {\n results: results,\n result: result\n };\n}\nexports.runBeforeNotifyHandlers = runBeforeNotifyHandlers;\nfunction runAfterNotifyHandlers(notice, handlers, error) {\n if (notice && notice.afterNotify) {\n notice.afterNotify(error, notice);\n }\n for (var i = 0, len = handlers.length; i < len; i++) {\n handlers[i](error, notice);\n }\n return true;\n}\nexports.runAfterNotifyHandlers = runAfterNotifyHandlers;\n// Returns a new object with properties from other object.\nfunction shallowClone(obj) {\n if (typeof (obj) !== 'object' || obj === null) {\n return {};\n }\n var result = {};\n for (var k in obj) {\n result[k] = obj[k];\n }\n return result;\n}\nexports.shallowClone = shallowClone;\nfunction sanitize(obj, maxDepth) {\n if (maxDepth === void 0) { maxDepth = 8; }\n var seenObjects = [];\n function seen(obj) {\n if (!obj || typeof (obj) !== 'object') {\n return false;\n }\n for (var i = 0; i < seenObjects.length; i++) {\n var value = seenObjects[i];\n if (value === obj) {\n return true;\n }\n }\n seenObjects.push(obj);\n return false;\n }\n function canSerialize(obj) {\n var typeOfObj = typeof obj;\n // Functions are TMI\n if (/function/.test(typeOfObj)) {\n // Let special toJSON method pass as it's used by JSON.stringify (#722)\n return obj.name === 'toJSON';\n }\n // Symbols can't convert to strings.\n if (/symbol/.test(typeOfObj)) {\n return false;\n }\n if (obj === null) {\n return false;\n }\n // No prototype, likely created with `Object.create(null)`.\n if (typeof obj === 'object' && typeof obj.hasOwnProperty === 'undefined') {\n return false;\n }\n return true;\n }\n function serialize(obj, depth) {\n if (depth === void 0) { depth = 0; }\n if (depth >= maxDepth) {\n return '[DEPTH]';\n }\n // Inspect invalid types\n if (!canSerialize(obj)) {\n return Object.prototype.toString.call(obj);\n }\n // Halt circular references\n if (seen(obj)) {\n return '[RECURSION]';\n }\n // Serialize inside arrays\n if (Array.isArray(obj)) {\n return obj.map(function (o) { return safeSerialize(o, depth + 1); });\n }\n // Serialize inside objects\n if (typeof (obj) === 'object') {\n var ret = {};\n for (var k in obj) {\n var v = obj[k];\n if (Object.prototype.hasOwnProperty.call(obj, k) && (k != null) && (v != null)) {\n ret[k] = safeSerialize(v, depth + 1);\n }\n }\n return ret;\n }\n // Return everything else untouched\n return obj;\n }\n function safeSerialize(obj, depth) {\n if (depth === void 0) { depth = 0; }\n try {\n return serialize(obj, depth);\n }\n catch (e) {\n return \"[ERROR] \".concat(e);\n }\n }\n return safeSerialize(obj);\n}\nexports.sanitize = sanitize;\nfunction logger(client) {\n var log = function (method) {\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 (method === 'debug') {\n if (!client.config.debug) {\n return;\n }\n // Log at default level so that you don't need to also enable verbose\n // logging in Chrome.\n method = 'log';\n }\n args.unshift('[Honeybadger]');\n (_a = client.config.logger)[method].apply(_a, args);\n };\n };\n return {\n log: log('log'),\n info: log('info'),\n debug: log('debug'),\n warn: log('warn'),\n error: log('error')\n };\n}\nexports.logger = logger;\n/**\n * Converts any object into a notice object (which at minimum has the same\n * properties as Error, but supports additional Honeybadger properties.)\n */\nfunction makeNotice(thing) {\n var notice;\n if (!thing) {\n notice = {};\n }\n else if (isErrorObject(thing)) {\n var e = thing;\n notice = merge(thing, { name: e.name, message: e.message, stack: e.stack, cause: e.cause });\n }\n else if (typeof thing === 'object') {\n notice = shallowClone(thing);\n }\n else {\n var m = String(thing);\n notice = { message: m };\n }\n return notice;\n}\nexports.makeNotice = makeNotice;\nfunction isErrorObject(thing) {\n return thing instanceof Error\n || Object.prototype.toString.call(thing) === '[object Error]'; // Important for cross-realm objects\n}\nexports.isErrorObject = isErrorObject;\n/**\n * Instrument an existing function inside an object (usually global).\n * @param {!Object} object\n * @param {!String} name\n * @param {!Function} replacement\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction instrument(object, name, replacement) {\n if (!object || !name || !replacement || !(name in object)) {\n return;\n }\n try {\n var original = object[name];\n while (original && original.__hb_original) {\n original = original.__hb_original;\n }\n object[name] = replacement(original);\n object[name].__hb_original = original;\n }\n catch (_e) {\n // Ignores errors where \"original\" is a restricted object (see #1001)\n // Uncaught Error: Permission denied to access property \"__hb_original\"\n // Also ignores:\n // Error: TypeError: Cannot set property onunhandledrejection of [object Object] which has only a getter\n // User-Agent: Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-G960F) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/12.1 Chrome/79.0.3945.136 Mobile Safari/537.36\n }\n}\nexports.instrument = instrument;\nvar _consoleAlreadyInstrumented = false;\nvar listeners = [];\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction instrumentConsole(_window, handler) {\n if (!_window || !_window.console || !handler) {\n return;\n }\n listeners.push(handler);\n if (_consoleAlreadyInstrumented) {\n return;\n }\n _consoleAlreadyInstrumented = true;\n ['debug', 'info', 'warn', 'error', 'log'].forEach(function (level) {\n instrument(_window.console, level, function hbLogger(original) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n listeners.forEach(function (listener) {\n try {\n listener(level, args);\n }\n catch (_e) {\n // ignore\n // should never reach here because instrument method already wraps with try/catch block\n }\n });\n if (typeof original === 'function') {\n Function.prototype.apply.call(original, _window.console, arguments);\n }\n };\n });\n });\n}\nexports.instrumentConsole = instrumentConsole;\nfunction endpoint(base, path) {\n var endpoint = base.trim().replace(/\\/$/, '');\n path = path.trim().replace(/(^\\/|\\/$)/g, '');\n return \"\".concat(endpoint, \"/\").concat(path);\n}\nexports.endpoint = endpoint;\nfunction generateStackTrace() {\n try {\n throw new Error('');\n }\n catch (e) {\n if (e.stack) {\n return e.stack;\n }\n }\n var maxStackSize = 10;\n var stack = [];\n var curr = arguments.callee;\n while (curr && stack.length < maxStackSize) {\n if (/function(?:\\s+([\\w$]+))+\\s*\\(/.test(curr.toString())) {\n stack.push(RegExp.$1 || '');\n }\n else {\n stack.push('');\n }\n try {\n curr = curr.caller;\n }\n catch (e) {\n break;\n }\n }\n return stack.join('\\n');\n}\nexports.generateStackTrace = generateStackTrace;\nfunction filter(obj, filters) {\n if (!is('Object', obj)) {\n return;\n }\n if (!is('Array', filters)) {\n filters = [];\n }\n var seen = [];\n function filter(obj) {\n var k, newObj;\n if (is('Object', obj) || is('Array', obj)) {\n if (seen.indexOf(obj) !== -1) {\n return '[CIRCULAR DATA STRUCTURE]';\n }\n seen.push(obj);\n }\n if (is('Object', obj)) {\n newObj = {};\n for (k in obj) {\n if (filterMatch(k, filters)) {\n newObj[k] = '[FILTERED]';\n }\n else {\n newObj[k] = filter(obj[k]);\n }\n }\n return newObj;\n }\n if (is('Array', obj)) {\n return obj.map(function (v) {\n return filter(v);\n });\n }\n if (is('Function', obj)) {\n return '[FUNC]';\n }\n return obj;\n }\n return filter(obj);\n}\nexports.filter = filter;\nfunction filterMatch(key, filters) {\n for (var i = 0; i < filters.length; i++) {\n if (key.toLowerCase().indexOf(filters[i].toLowerCase()) !== -1) {\n return true;\n }\n }\n return false;\n}\nfunction is(type, obj) {\n var klass = Object.prototype.toString.call(obj).slice(8, -1);\n return obj !== undefined && obj !== null && klass === type;\n}\nfunction filterUrl(url, filters) {\n if (!filters) {\n return url;\n }\n if (typeof url !== 'string') {\n return url;\n }\n var query = url.split(/\\?/, 2)[1];\n if (!query) {\n return url;\n }\n var result = url;\n query.split(/[&]\\s?/).forEach(function (pair) {\n var _a = pair.split('=', 2), key = _a[0], value = _a[1];\n if (filterMatch(key, filters)) {\n result = result.replace(\"\".concat(key, \"=\").concat(value), \"\".concat(key, \"=[FILTERED]\"));\n }\n });\n return result;\n}\nexports.filterUrl = filterUrl;\nfunction formatCGIData(vars, prefix) {\n if (prefix === void 0) { prefix = ''; }\n var formattedVars = {};\n Object.keys(vars).forEach(function (key) {\n var formattedKey = prefix + key.replace(/\\W/g, '_').toUpperCase();\n formattedVars[formattedKey] = vars[key];\n });\n return formattedVars;\n}\nexports.formatCGIData = formatCGIData;\nfunction clone(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\nexports.clone = clone;\nfunction getSourceCodeSnippet(fileData, lineNumber, sourceRadius) {\n if (sourceRadius === void 0) { sourceRadius = 2; }\n if (!fileData) {\n return null;\n }\n var lines = fileData.split('\\n');\n // add one empty line because array index starts from 0, but error line number is counted from 1\n lines.unshift('');\n var start = lineNumber - sourceRadius;\n var end = lineNumber + sourceRadius;\n var result = {};\n for (var i = start; i <= end; i++) {\n var line = lines[i];\n if (typeof line === 'string') {\n result[i] = line;\n }\n }\n return result;\n}\nfunction isBrowserConfig(config) {\n return config.async !== undefined;\n}\nexports.isBrowserConfig = isBrowserConfig;\n/** globalThis has fairly good support. But just in case, lets check its defined.\n * @see {https://caniuse.com/?search=globalThis}\n */\nfunction globalThisOrWindow() {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n return window;\n}\nexports.globalThisOrWindow = globalThisOrWindow;\nvar _deprecatedMethodCalls = {};\n/**\n * Logs a deprecation warning, every X calls to the method.\n */\nfunction logDeprecatedMethod(logger, oldMethod, newMethod, callCountThreshold) {\n if (callCountThreshold === void 0) { callCountThreshold = 100; }\n var key = \"\".concat(oldMethod, \"-\").concat(newMethod);\n if (typeof _deprecatedMethodCalls[key] === 'undefined') {\n _deprecatedMethodCalls[key] = 0;\n }\n if (_deprecatedMethodCalls[key] % callCountThreshold !== 0) {\n _deprecatedMethodCalls[key]++;\n return;\n }\n var msg = \"Deprecation warning: \".concat(oldMethod, \" has been deprecated; please use \").concat(newMethod, \" instead.\");\n logger.warn(msg);\n _deprecatedMethodCalls[key]++;\n}\nexports.logDeprecatedMethod = logDeprecatedMethod;\n//# sourceMappingURL=util.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar util_1 = require(\"../util\");\nfunction default_1(_window) {\n if (_window === void 0) { _window = (0, util_1.globalThisOrWindow)(); }\n return {\n shouldReloadOnConfigure: false,\n load: function (client) {\n function sendEventsToInsights() {\n return client.config.eventsEnabled;\n }\n if (!sendEventsToInsights()) {\n return;\n }\n (0, util_1.instrumentConsole)(_window, function (level, args) {\n if (!sendEventsToInsights()) {\n return;\n }\n if (args.length === 0) {\n return;\n }\n var data = {\n severity: level,\n };\n if (typeof args[0] === 'string') {\n data.message = args[0];\n data.args = args.slice(1);\n }\n else {\n data.args = args;\n }\n client.event('log', data);\n });\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=events.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.GlobalStore = void 0;\nvar util_1 = require(\"./util\");\nvar GlobalStore = /** @class */ (function () {\n function GlobalStore(contents, breadcrumbsLimit) {\n this.contents = contents;\n this.breadcrumbsLimit = breadcrumbsLimit;\n }\n GlobalStore.create = function (contents, breadcrumbsLimit) {\n return new GlobalStore(contents, breadcrumbsLimit);\n };\n GlobalStore.prototype.available = function () {\n return true;\n };\n GlobalStore.prototype.getContents = function (key) {\n var value = key ? this.contents[key] : this.contents;\n return JSON.parse(JSON.stringify(value));\n };\n GlobalStore.prototype.setContext = function (context) {\n this.contents.context = (0, util_1.merge)(this.contents.context, context || {});\n };\n GlobalStore.prototype.addBreadcrumb = function (breadcrumb) {\n if (this.contents.breadcrumbs.length == this.breadcrumbsLimit) {\n this.contents.breadcrumbs.shift();\n }\n this.contents.breadcrumbs.push(breadcrumb);\n };\n GlobalStore.prototype.clear = function () {\n this.contents.context = {};\n this.contents.breadcrumbs = [];\n };\n GlobalStore.prototype.run = function (callback) {\n return callback();\n };\n return GlobalStore;\n}());\nexports.GlobalStore = GlobalStore;\n//# sourceMappingURL=store.js.map", "export class NdJson {\n static parse(data) {\n const lines = data.trim().split('\\n');\n return lines.map(line => JSON.parse(line));\n }\n static stringify(data) {\n return data.map(item => JSON.stringify(item)).join('\\n');\n }\n}\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CONFIG = void 0;\nexports.CONFIG = {\n apiKey: null,\n endpoint: 'https://api.honeybadger.io',\n environment: null,\n hostname: null,\n projectRoot: null,\n component: null,\n action: null,\n revision: null,\n reportData: null,\n breadcrumbsEnabled: true,\n // we could decide the value of eventsEnabled based on `env` and `developmentEnvironments`\n eventsEnabled: false,\n maxBreadcrumbs: 40,\n maxObjectDepth: 8,\n logger: console,\n developmentEnvironments: ['dev', 'development', 'test'],\n debug: false,\n tags: null,\n enableUncaught: true,\n enableUnhandledRejection: true,\n afterUncaught: function () { return true; },\n filters: ['creditcard', 'password'],\n __plugins: [],\n};\n//# sourceMappingURL=defaults.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};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ThrottledEventsLogger = void 0;\nvar json_nd_1 = require(\"json-nd\");\nvar util_1 = require(\"./util\");\nvar defaults_1 = require(\"./defaults\");\nvar ThrottledEventsLogger = /** @class */ (function () {\n function ThrottledEventsLogger(config, transport) {\n this.config = config;\n this.transport = transport;\n this.queue = [];\n this.isProcessing = false;\n this.config = __assign(__assign({}, defaults_1.CONFIG), config);\n this.logger = this.originalLogger();\n }\n ThrottledEventsLogger.prototype.configure = function (opts) {\n for (var k in opts) {\n this.config[k] = opts[k];\n }\n };\n ThrottledEventsLogger.prototype.log = function (payload) {\n this.queue.push(payload);\n if (!this.isProcessing) {\n this.processQueue();\n }\n };\n ThrottledEventsLogger.prototype.processQueue = function () {\n var _this = this;\n if (this.queue.length === 0 || this.isProcessing) {\n return;\n }\n this.isProcessing = true;\n var eventsData = this.queue.slice();\n this.queue = [];\n var data = json_nd_1.NdJson.stringify(eventsData);\n this.makeHttpRequest(data)\n .then(function () {\n setTimeout(function () {\n _this.isProcessing = false;\n _this.processQueue();\n }, 50);\n })\n .catch(function (error) {\n _this.logger.error('[Honeybadger] Error making HTTP request:', error);\n // Continue processing the queue even if there's an error\n setTimeout(function () {\n _this.isProcessing = false;\n _this.processQueue();\n }, 50);\n });\n };\n ThrottledEventsLogger.prototype.makeHttpRequest = function (data) {\n return __awaiter(this, void 0, void 0, function () {\n var _this = this;\n return __generator(this, function (_a) {\n return [2 /*return*/, this.transport\n .send({\n headers: {\n 'X-API-Key': this.config.apiKey,\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n endpoint: (0, util_1.endpoint)(this.config.endpoint, '/v1/events'),\n maxObjectDepth: this.config.maxObjectDepth,\n logger: this.logger,\n }, data)\n .then(function () {\n if (_this.config.debug) {\n _this.logger.debug('[Honeybadger] Events sent successfully');\n }\n })\n .catch(function (err) {\n _this.logger.error(\"[Honeybadger] Error sending events: \".concat(err.message));\n })];\n });\n });\n };\n /**\n * todo: improve this\n *\n * The EventsLogger overrides the console methods to enable automatic instrumentation\n * of console logs to the Honeybadger API.\n * So if we want to log something in here we need to use the original methods.\n */\n ThrottledEventsLogger.prototype.originalLogger = function () {\n var _a, _b, _c, _d, _e;\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n log: (_a = console.log.__hb_original) !== null && _a !== void 0 ? _a : console.log,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n info: (_b = console.info.__hb_original) !== null && _b !== void 0 ? _b : console.info,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n debug: (_c = console.debug.__hb_original) !== null && _c !== void 0 ? _c : console.debug,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n warn: (_d = console.warn.__hb_original) !== null && _d !== void 0 ? _d : console.warn,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n error: (_e = console.error.__hb_original) !== null && _e !== void 0 ? _e : console.error,\n };\n };\n return ThrottledEventsLogger;\n}());\nexports.ThrottledEventsLogger = ThrottledEventsLogger;\n//# sourceMappingURL=throttled_events_logger.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};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Client = void 0;\nvar util_1 = require(\"./util\");\nvar store_1 = require(\"./store\");\nvar throttled_events_logger_1 = require(\"./throttled_events_logger\");\nvar defaults_1 = require(\"./defaults\");\n// Split at commas and spaces\nvar TAG_SEPARATOR = /,|\\s+/;\n// Checks for non-blank characters\nvar NOT_BLANK = /\\S/;\nvar Client = /** @class */ (function () {\n function Client(opts, transport) {\n if (opts === void 0) { opts = {}; }\n this.__pluginsLoaded = false;\n this.__store = null;\n this.__beforeNotifyHandlers = [];\n this.__afterNotifyHandlers = [];\n this.__notifier = {\n name: '@honeybadger-io/core',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',\n version: '__VERSION__'\n };\n this.config = __assign(__assign({}, defaults_1.CONFIG), opts);\n this.__initStore();\n this.__transport = transport;\n this.__eventsLogger = new throttled_events_logger_1.ThrottledEventsLogger(this.config, this.__transport);\n this.logger = (0, util_1.logger)(this);\n }\n Client.prototype.getVersion = function () {\n return this.__notifier.version;\n };\n Client.prototype.getNotifier = function () {\n return this.__notifier;\n };\n /**\n * CAREFUL: When adding a new notifier or updating the name of an existing notifier,\n * the Honeybadger rails project may need its mappings updated.\n * See https://github.com/honeybadger-io/honeybadger/blob/master/app/presenters/breadcrumbs_presenter.rb\n * https://github.com/honeybadger-io/honeybadger/blob/master/app/models/parser/java_script.rb\n * https://github.com/honeybadger-io/honeybadger/blob/master/app/models/language.rb\n **/\n Client.prototype.setNotifier = function (notifier) {\n this.__notifier = notifier;\n };\n Client.prototype.configure = function (opts) {\n if (opts === void 0) { opts = {}; }\n for (var k in opts) {\n this.config[k] = opts[k];\n }\n this.__eventsLogger.configure(this.config);\n this.loadPlugins();\n return this;\n };\n Client.prototype.loadPlugins = function () {\n var _this = this;\n var pluginsToLoad = this.__pluginsLoaded\n ? this.config.__plugins.filter(function (plugin) { return plugin.shouldReloadOnConfigure; })\n : this.config.__plugins;\n pluginsToLoad.forEach(function (plugin) { return plugin.load(_this); });\n this.__pluginsLoaded = true;\n };\n Client.prototype.__initStore = function () {\n this.__store = new store_1.GlobalStore({ context: {}, breadcrumbs: [] }, this.config.maxBreadcrumbs);\n };\n Client.prototype.beforeNotify = function (handler) {\n this.__beforeNotifyHandlers.push(handler);\n return this;\n };\n Client.prototype.afterNotify = function (handler) {\n this.__afterNotifyHandlers.push(handler);\n return this;\n };\n Client.prototype.setContext = function (context) {\n if (typeof context === 'object' && context != null) {\n this.__store.setContext(context);\n }\n return this;\n };\n Client.prototype.resetContext = function (context) {\n this.logger.warn('Deprecation warning: `Honeybadger.resetContext()` has been deprecated; please use `Honeybadger.clear()` instead.');\n this.__store.clear();\n if (typeof context === 'object' && context !== null) {\n this.__store.setContext(context);\n }\n return this;\n };\n Client.prototype.clear = function () {\n this.__store.clear();\n return this;\n };\n Client.prototype.notify = function (noticeable, name, extra) {\n var _this = this;\n if (name === void 0) { name = undefined; }\n if (extra === void 0) { extra = undefined; }\n var notice = this.makeNotice(noticeable, name, extra);\n // we need to have the source file data before the beforeNotifyHandlers,\n // in case they modify them\n var sourceCodeData = notice && notice.backtrace ? notice.backtrace.map(function (trace) { return (0, util_1.shallowClone)(trace); }) : null;\n var preConditionsResult = this.__runPreconditions(notice);\n if (preConditionsResult instanceof Error) {\n (0, util_1.runAfterNotifyHandlers)(notice, this.__afterNotifyHandlers, preConditionsResult);\n return false;\n }\n if (preConditionsResult instanceof Promise) {\n preConditionsResult.then(function (result) {\n if (result instanceof Error) {\n (0, util_1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, result);\n return false;\n }\n return _this.__send(notice, sourceCodeData);\n });\n return true;\n }\n this.__send(notice, sourceCodeData).catch(function (_err) { });\n return true;\n };\n /**\n * An async version of {@link notify} that resolves only after the notice has been reported to Honeybadger.\n * Implemented using the {@link afterNotify} hook.\n * Rejects if for any reason the report failed to be reported.\n * Useful in serverless environments (AWS Lambda).\n */\n Client.prototype.notifyAsync = function (noticeable, name, extra) {\n var _this = this;\n if (name === void 0) { name = undefined; }\n if (extra === void 0) { extra = undefined; }\n return new Promise(function (resolve, reject) {\n var applyAfterNotify = function (partialNotice) {\n var originalAfterNotify = partialNotice.afterNotify;\n partialNotice.afterNotify = function (err) {\n originalAfterNotify === null || originalAfterNotify === void 0 ? void 0 : originalAfterNotify.call(_this, err);\n if (err) {\n return reject(err);\n }\n resolve();\n };\n };\n // We have to respect any afterNotify hooks that come from the arguments\n var objectToOverride;\n if (noticeable.afterNotify) {\n objectToOverride = noticeable;\n }\n else if (name && name.afterNotify) {\n objectToOverride = name;\n }\n else if (extra && extra.afterNotify) {\n objectToOverride = extra;\n }\n else if (name && typeof name === 'object') {\n objectToOverride = name;\n }\n else if (extra) {\n objectToOverride = extra;\n }\n else {\n objectToOverride = name = {};\n }\n applyAfterNotify(objectToOverride);\n _this.notify(noticeable, name, extra);\n });\n };\n Client.prototype.makeNotice = function (noticeable, name, extra) {\n if (name === void 0) { name = undefined; }\n if (extra === void 0) { extra = undefined; }\n var notice = (0, util_1.makeNotice)(noticeable);\n if (name && !(typeof name === 'object')) {\n var n = String(name);\n name = { name: n };\n }\n if (name) {\n notice = (0, util_1.mergeNotice)(notice, name);\n }\n if (typeof extra === 'object' && extra !== null) {\n notice = (0, util_1.mergeNotice)(notice, extra);\n }\n if ((0, util_1.objectIsEmpty)(notice)) {\n return null;\n }\n var context = this.__store.getContents('context');\n var noticeTags = this.__constructTags(notice.tags);\n var contextTags = this.__constructTags(context['tags']);\n var configTags = this.__constructTags(this.config.tags);\n // Turning into a Set will remove duplicates\n var tags = noticeTags.concat(contextTags).concat(configTags);\n var uniqueTags = tags.filter(function (item, index) { return tags.indexOf(item) === index; });\n notice = (0, util_1.merge)(notice, {\n name: notice.name || 'Error',\n context: (0, util_1.merge)(context, notice.context),\n projectRoot: notice.projectRoot || this.config.projectRoot,\n environment: notice.environment || this.config.environment,\n component: notice.component || this.config.component,\n action: notice.action || this.config.action,\n revision: notice.revision || this.config.revision,\n tags: uniqueTags,\n });\n // If we're passed a custom backtrace array, use it\n // Otherwise we make one.\n if (!Array.isArray(notice.backtrace) || !notice.backtrace.length) {\n if (typeof notice.stack !== 'string' || !notice.stack.trim()) {\n notice.stack = (0, util_1.generateStackTrace)();\n notice.backtrace = (0, util_1.makeBacktrace)(notice.stack, true, this.logger);\n }\n else {\n notice.backtrace = (0, util_1.makeBacktrace)(notice.stack, false, this.logger);\n }\n }\n return notice;\n };\n Client.prototype.addBreadcrumb = function (message, opts) {\n if (!this.config.breadcrumbsEnabled) {\n return;\n }\n opts = opts || {};\n var metadata = (0, util_1.shallowClone)(opts.metadata);\n var category = opts.category || 'custom';\n var timestamp = new Date().toISOString();\n this.__store.addBreadcrumb({\n category: category,\n message: message,\n metadata: metadata,\n timestamp: timestamp\n });\n return this;\n };\n /**\n * @deprecated Use {@link event} instead.\n */\n Client.prototype.logEvent = function (data) {\n (0, util_1.logDeprecatedMethod)(this.logger, 'Honeybadger.logEvent', 'Honeybadger.event');\n this.event('log', data);\n };\n Client.prototype.event = function (type, data) {\n var _a;\n if (typeof type === 'object') {\n data = type;\n type = (_a = type['event_type']) !== null && _a !== void 0 ? _a : undefined;\n }\n this.__eventsLogger.log(__assign({ event_type: type, ts: new Date().toISOString() }, data));\n };\n Client.prototype.__getBreadcrumbs = function () {\n return this.__store.getContents('breadcrumbs').slice();\n };\n Client.prototype.__getContext = function () {\n return this.__store.getContents('context');\n };\n Client.prototype.__developmentMode = function () {\n if (this.config.reportData === true) {\n return false;\n }\n return (this.config.environment && this.config.developmentEnvironments.includes(this.config.environment));\n };\n Client.prototype.__buildPayload = function (notice) {\n var headers = (0, util_1.filter)(notice.headers, this.config.filters) || {};\n var cgiData = (0, util_1.filter)(__assign(__assign({}, notice.cgiData), (0, util_1.formatCGIData)(headers, 'HTTP_')), this.config.filters);\n return {\n notifier: this.__notifier,\n breadcrumbs: {\n enabled: !!this.config.breadcrumbsEnabled,\n trail: notice.__breadcrumbs || []\n },\n error: {\n class: notice.name,\n message: notice.message,\n backtrace: notice.backtrace,\n fingerprint: notice.fingerprint,\n tags: notice.tags,\n causes: (0, util_1.getCauses)(notice, this.logger),\n },\n request: {\n url: (0, util_1.filterUrl)(notice.url, this.config.filters),\n component: notice.component,\n action: notice.action,\n context: notice.context,\n cgi_data: cgiData,\n params: (0, util_1.filter)(notice.params, this.config.filters) || {},\n session: (0, util_1.filter)(notice.session, this.config.filters) || {}\n },\n server: {\n project_root: notice.projectRoot,\n environment_name: notice.environment,\n revision: notice.revision,\n hostname: this.config.hostname,\n time: new Date().toUTCString()\n },\n details: notice.details || {}\n };\n };\n Client.prototype.__constructTags = function (tags) {\n if (!tags) {\n return [];\n }\n return tags.toString().split(TAG_SEPARATOR).filter(function (tag) { return NOT_BLANK.test(tag); });\n };\n Client.prototype.__runPreconditions = function (notice) {\n var _this = this;\n var preConditionError = null;\n if (!notice) {\n this.logger.debug('failed to build error report');\n preConditionError = new Error('failed to build error report');\n }\n if (this.config.reportData === false) {\n this.logger.debug('skipping error report: honeybadger.js is disabled', notice);\n preConditionError = new Error('honeybadger.js is disabled');\n }\n if (this.__developmentMode()) {\n this.logger.log('honeybadger.js is in development mode; the following error report will be sent in production.', notice);\n preConditionError = new Error('honeybadger.js is in development mode');\n }\n if (!this.config.apiKey) {\n this.logger.warn('could not send error report: no API key has been configured', notice);\n preConditionError = new Error('missing API key');\n }\n var beforeNotifyResult = (0, util_1.runBeforeNotifyHandlers)(notice, this.__beforeNotifyHandlers);\n if (!preConditionError && !beforeNotifyResult.result) {\n this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);\n preConditionError = new Error('beforeNotify handlers returned false');\n }\n if (beforeNotifyResult.results.length && beforeNotifyResult.results.some(function (result) { return result instanceof Promise; })) {\n return Promise.allSettled(beforeNotifyResult.results)\n .then(function (results) {\n if (!preConditionError && (results.some(function (result) { return result.status === 'rejected' || result.value === false; }))) {\n _this.logger.debug('skipping error report: one or more beforeNotify handlers returned false', notice);\n preConditionError = new Error('beforeNotify handlers (async) returned false');\n }\n if (preConditionError) {\n return preConditionError;\n }\n });\n }\n return preConditionError;\n };\n Client.prototype.__send = function (notice, originalBacktrace) {\n var _this = this;\n if (this.config.breadcrumbsEnabled) {\n this.addBreadcrumb('Honeybadger Notice', {\n category: 'notice',\n metadata: {\n message: notice.message,\n name: notice.name,\n stack: notice.stack\n }\n });\n notice.__breadcrumbs = this.__store.getContents('breadcrumbs');\n }\n else {\n notice.__breadcrumbs = [];\n }\n return (0, util_1.getSourceForBacktrace)(originalBacktrace, this.__getSourceFileHandler)\n .then(function (sourcePerTrace) { return __awaiter(_this, void 0, void 0, function () {\n var payload;\n return __generator(this, function (_a) {\n sourcePerTrace.forEach(function (source, index) {\n notice.backtrace[index].source = source;\n });\n payload = this.__buildPayload(notice);\n return [2 /*return*/, this.__transport\n .send({\n headers: {\n 'X-API-Key': this.config.apiKey,\n 'Content-Type': 'application/json',\n 'Accept': 'text/json, application/json'\n },\n method: 'POST',\n endpoint: (0, util_1.endpoint)(this.config.endpoint, '/v1/notices/js'),\n maxObjectDepth: this.config.maxObjectDepth,\n logger: this.logger,\n }, payload)];\n });\n }); })\n .then(function (res) {\n if (res.statusCode !== 201) {\n (0, util_1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, new Error(\"Bad HTTP response: \".concat(res.statusCode)));\n _this.logger.warn(\"Error report failed: unknown response from server. code=\".concat(res.statusCode));\n return false;\n }\n var uuid = JSON.parse(res.body).id;\n (0, util_1.runAfterNotifyHandlers)((0, util_1.merge)(notice, {\n id: uuid\n }), _this.__afterNotifyHandlers);\n _this.logger.info(\"Error report sent \\u26A1 https://app.honeybadger.io/notice/\".concat(uuid));\n return true;\n })\n .catch(function (err) {\n _this.logger.error('Error report failed: an unknown error occurred.', \"message=\".concat(err.message));\n (0, util_1.runAfterNotifyHandlers)(notice, _this.__afterNotifyHandlers, err);\n return false;\n });\n };\n return Client;\n}());\nexports.Client = Client;\n//# sourceMappingURL=client.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=types.js.map", "\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Plugins = exports.Util = exports.Types = exports.Client = void 0;\nvar events_1 = __importDefault(require(\"./plugins/events\"));\nvar client_1 = require(\"./client\");\nObject.defineProperty(exports, \"Client\", { enumerable: true, get: function () { return client_1.Client; } });\n__exportStar(require(\"./store\"), exports);\nexports.Types = __importStar(require(\"./types\"));\nexports.Util = __importStar(require(\"./util\"));\nexports.Plugins = {\n events: events_1.default\n};\n//# sourceMappingURL=index.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.preferCatch = exports.encodeCookie = exports.decodeCookie = exports.localURLPathname = exports.parseURL = exports.nativeFetch = exports.stringTextOfElement = exports.stringSelectorOfElement = exports.stringNameOfElement = void 0;\nvar core_1 = require(\"@honeybadger-io/core\");\nvar globalThisOrWindow = core_1.Util.globalThisOrWindow;\n/**\n * Converts an HTMLElement into a human-readable string.\n * @param {!HTMLElement} element\n * @return {string}\n */\nfunction stringNameOfElement(element) {\n if (!element || !element.tagName) {\n return '';\n }\n var name = element.tagName.toLowerCase();\n // Ignore the root element in selectors and events.\n if (name === 'html') {\n return '';\n }\n if (element.id) {\n name += \"#\".concat(element.id);\n }\n var stringClassNames = element.getAttribute('class');\n if (stringClassNames) {\n stringClassNames.split(/\\s+/).forEach(function (className) {\n name += \".\".concat(className);\n });\n }\n ['alt', 'name', 'title', 'type'].forEach(function (attrName) {\n var attr = element.getAttribute(attrName);\n if (attr) {\n name += \"[\".concat(attrName, \"=\\\"\").concat(attr, \"\\\"]\");\n }\n });\n var siblings = getSiblings(element);\n if (siblings.length > 1) {\n name += \":nth-child(\".concat(Array.prototype.indexOf.call(siblings, element) + 1, \")\");\n }\n return name;\n}\nexports.stringNameOfElement = stringNameOfElement;\nfunction stringSelectorOfElement(element) {\n var name = stringNameOfElement(element);\n if (element.parentNode && element.parentNode.tagName) {\n var parentName = stringSelectorOfElement(element.parentNode);\n if (parentName.length > 0) {\n return \"\".concat(parentName, \" > \").concat(name);\n }\n }\n return name;\n}\nexports.stringSelectorOfElement = stringSelectorOfElement;\nfunction stringTextOfElement(element) {\n var text = element.textContent || element.innerText || '';\n if (!text && (element.type === 'submit' || element.type === 'button')) {\n text = element.value;\n }\n return truncate(text.trim(), 300);\n}\nexports.stringTextOfElement = stringTextOfElement;\nfunction nativeFetch() {\n var global = globalThisOrWindow();\n if (!global.fetch) {\n return false;\n }\n if (isNative(global.fetch)) {\n return true;\n }\n if (typeof document === 'undefined') {\n return false;\n }\n // If fetch isn't native, it may be wrapped by someone else. Try to get\n // a pristine function from an iframe.\n try {\n var sandbox = document.createElement('iframe');\n sandbox.style.display = 'none';\n document.head.appendChild(sandbox);\n var result = sandbox.contentWindow.fetch && isNative(sandbox.contentWindow.fetch);\n document.head.removeChild(sandbox);\n return result;\n }\n catch (err) {\n if (console && console.warn) {\n console.warn('failed to detect native fetch via iframe: ' + err);\n }\n }\n return false;\n}\nexports.nativeFetch = nativeFetch;\nfunction isNative(func) {\n return func.toString().indexOf('native') !== -1;\n}\nfunction parseURL(url) {\n // Regexp: https://tools.ietf.org/html/rfc3986#appendix-B\n var match = url.match(/^(([^:/?#]+):)?(\\/\\/([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$/) || {};\n return {\n protocol: match[2],\n host: match[4],\n pathname: match[5]\n };\n}\nexports.parseURL = parseURL;\nfunction localURLPathname(url) {\n var parsed = parseURL(url);\n var parsedDocURL = parseURL(document.URL);\n // URL must be relative\n if (!parsed.host || !parsed.protocol) {\n return parsed.pathname;\n }\n // Same domain\n if (parsed.protocol === parsedDocURL.protocol && parsed.host === parsedDocURL.host) {\n return parsed.pathname;\n }\n // x-domain\n return \"\".concat(parsed.protocol, \"://\").concat(parsed.host).concat(parsed.pathname);\n}\nexports.localURLPathname = localURLPathname;\nfunction decodeCookie(string) {\n var result = {};\n string.split(/[;,]\\s?/).forEach(function (pair) {\n var _a = pair.split('=', 2), key = _a[0], value = _a[1];\n result[key] = value;\n });\n return result;\n}\nexports.decodeCookie = decodeCookie;\nfunction encodeCookie(object) {\n if (typeof object !== 'object') {\n return undefined;\n }\n var cookies = [];\n for (var k in object) {\n cookies.push(k + '=' + object[k]);\n }\n return cookies.join(';');\n}\nexports.encodeCookie = encodeCookie;\n// Helpers\nfunction getSiblings(element) {\n try {\n var nodes = element.parentNode.childNodes;\n var siblings_1 = [];\n Array.prototype.forEach.call(nodes, function (node) {\n if (node.tagName && node.tagName === element.tagName) {\n siblings_1.push(node);\n }\n });\n return siblings_1;\n }\n catch (e) {\n return [];\n }\n}\nfunction truncate(string, length) {\n if (string.length > length) {\n string = string.substr(0, length) + '...';\n }\n return string;\n}\n// Used to decide which error handling method to use when wrapping async\n// handlers: try/catch, or `window.onerror`. When available, `window.onerror`\n// will provide more information in modern browsers.\nexports.preferCatch = (function () {\n var preferCatch = true;\n // In case we're in an environment without access to \"window\", lets make sure theres a window.\n if (typeof window === 'undefined')\n return preferCatch;\n // IE < 10\n if (!window.atob) {\n preferCatch = false;\n }\n // Modern browsers support the full ErrorEvent API\n // See https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n if (window.ErrorEvent) {\n try {\n if ((new window.ErrorEvent('')).colno === 0) {\n preferCatch = false;\n }\n // eslint-disable-next-line no-empty\n }\n catch (_e) { }\n }\n return preferCatch;\n})();\n//# sourceMappingURL=util.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onError = exports.ignoreNextOnError = void 0;\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar instrument = core_1.Util.instrument, makeNotice = core_1.Util.makeNotice, globalThisOrWindow = core_1.Util.globalThisOrWindow;\nvar ignoreOnError = 0;\nvar currentTimeout;\nfunction ignoreNextOnError() {\n ignoreOnError += 1;\n clearTimeout(currentTimeout);\n currentTimeout = setTimeout(function () {\n ignoreOnError = 0;\n });\n}\nexports.ignoreNextOnError = ignoreNextOnError;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction onError(_window) {\n if (_window === void 0) { _window = globalThisOrWindow(); }\n return {\n load: function (client) {\n instrument(_window, 'onerror', function (original) {\n var onerror = function (msg, url, line, col, err) {\n client.logger.debug('window.onerror callback invoked', arguments);\n if (ignoreOnError > 0) {\n client.logger.debug('Ignoring window.onerror (error likely reported earlier)', arguments);\n ignoreOnError -= 1;\n return;\n }\n // See https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers/onerror#Notes\n if (line === 0 && /Script error\\.?/.test(msg)) {\n if (client.config.enableUncaught) {\n // Log only if the user wants to report uncaught errors\n client.logger.warn('Ignoring cross-domain script error: enable CORS to track these types of errors', arguments);\n }\n return;\n }\n var notice = makeNotice(err);\n if (!notice.name) {\n notice.name = 'window.onerror';\n }\n if (!notice.message) {\n notice.message = msg;\n }\n if (!notice.stack) {\n // Simulate v8 stack\n notice.stack = [notice.message, '\\n at ? (', url || 'unknown', ':', line || 0, ':', col || 0, ')'].join('');\n }\n client.addBreadcrumb((notice.name === 'window.onerror' || !notice.name) ? 'window.onerror' : \"window.onerror: \".concat(notice.name), {\n category: 'error',\n metadata: {\n name: notice.name,\n message: notice.message,\n stack: notice.stack\n }\n });\n if (client.config.enableUncaught) {\n client.notify(notice);\n }\n };\n return function (msg, url, line, col, err) {\n onerror(msg, url, line, col, err);\n if (typeof original === 'function') {\n return original.apply(_window, arguments);\n }\n return false;\n };\n });\n }\n };\n}\nexports.onError = onError;\n//# sourceMappingURL=onerror.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar instrument = core_1.Util.instrument, globalThisOrWindow = core_1.Util.globalThisOrWindow;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction default_1(_window) {\n if (_window === void 0) { _window = globalThisOrWindow(); }\n return {\n load: function (client) {\n if (!client.config.enableUnhandledRejection) {\n return;\n }\n instrument(_window, 'onunhandledrejection', function (original) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event\n function onunhandledrejection(promiseRejectionEvent) {\n var _a;\n client.logger.debug('window.onunhandledrejection callback invoked', arguments);\n if (!client.config.enableUnhandledRejection) {\n return;\n }\n var reason = promiseRejectionEvent.reason;\n if (reason instanceof Error) {\n // simulate v8 stack\n // const fileName = reason.fileName || 'unknown'\n // const lineNumber = reason.lineNumber || 0\n var fileName = 'unknown';\n var lineNumber = 0;\n var stackFallback = \"\".concat(reason.message, \"\\n at ? (\").concat(fileName, \":\").concat(lineNumber, \")\");\n var stack = reason.stack || stackFallback;\n var err = {\n name: reason.name,\n message: \"UnhandledPromiseRejectionWarning: \".concat(reason),\n stack: stack\n };\n client.addBreadcrumb(\"window.onunhandledrejection: \".concat(err.name), {\n category: 'error',\n metadata: err\n });\n client.notify(err);\n return;\n }\n var message = typeof reason === 'string' ? reason : ((_a = JSON.stringify(reason)) !== null && _a !== void 0 ? _a : 'Unspecified reason');\n client.notify({\n name: 'window.onunhandledrejection',\n message: \"UnhandledPromiseRejectionWarning: \".concat(message)\n });\n }\n return function (promiseRejectionEvent) {\n onunhandledrejection(promiseRejectionEvent);\n if (typeof original === 'function') {\n original.apply(this, arguments);\n }\n };\n });\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=onunhandledrejection.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"../util\");\nvar sanitize = core_1.Util.sanitize, instrument = core_1.Util.instrument, instrumentConsole = core_1.Util.instrumentConsole, globalThisOrWindow = core_1.Util.globalThisOrWindow;\nfunction default_1(_window) {\n if (_window === void 0) { _window = globalThisOrWindow(); }\n return {\n load: function (client) {\n function breadcrumbsEnabled(type) {\n if (client.config.breadcrumbsEnabled === true) {\n return true;\n }\n if (type) {\n return client.config.breadcrumbsEnabled[type] === true;\n }\n return client.config.breadcrumbsEnabled !== false;\n }\n // Breadcrumbs: instrument console\n (function () {\n if (!breadcrumbsEnabled('console')) {\n return;\n }\n function inspectArray(obj) {\n if (!Array.isArray(obj)) {\n return '';\n }\n return obj.map(function (value) {\n try {\n return String(value);\n }\n catch (e) {\n return '[unknown]';\n }\n }).join(' ');\n }\n instrumentConsole(_window, function (level, args) {\n var message = inspectArray(args);\n var opts = {\n category: 'log',\n metadata: {\n level: level,\n arguments: sanitize(args, 3)\n }\n };\n client.addBreadcrumb(message, opts);\n });\n })();\n // Breadcrumbs: instrument click events\n (function () {\n if (!breadcrumbsEnabled('dom')) {\n return;\n }\n if (typeof _window.addEventListener !== 'function') {\n return;\n }\n _window.addEventListener('click', function (event) {\n var message, selector, text;\n try {\n message = (0, util_1.stringNameOfElement)(event.target);\n selector = (0, util_1.stringSelectorOfElement)(event.target);\n text = (0, util_1.stringTextOfElement)(event.target);\n }\n catch (e) {\n message = 'UI Click';\n selector = '[unknown]';\n text = '[unknown]';\n }\n // There's nothing to display\n if (message.length === 0) {\n return;\n }\n client.addBreadcrumb(message, {\n category: 'ui.click',\n metadata: {\n selector: selector,\n text: text,\n event: event\n }\n });\n }, _window.location ? true : false); // In CloudFlare workers useCapture must be false. window.location is a hacky way to detect it.\n })();\n // Breadcrumbs: instrument XMLHttpRequest\n (function () {\n if (!breadcrumbsEnabled('network')) {\n return;\n }\n // Some environments may not support XMLHttpRequest.\n if (typeof XMLHttpRequest === 'undefined') {\n return;\n }\n // -- On xhr.open: capture initial metadata\n instrument(XMLHttpRequest.prototype, 'open', function (original) {\n return function () {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var xhr = this;\n var rawUrl = arguments[1];\n // in case of url being URL object (which is valid input) we need to stringify it\n var url = typeof rawUrl === 'string' ? rawUrl : String(rawUrl);\n var method = typeof arguments[0] === 'string' ? arguments[0].toUpperCase() : arguments[0];\n var message = \"\".concat(method, \" \").concat((0, util_1.localURLPathname)(url));\n this.__hb_xhr = {\n type: 'xhr',\n method: method,\n url: url,\n message: message\n };\n if (typeof original === 'function') {\n original.apply(xhr, arguments);\n }\n };\n });\n // -- On xhr.send: set up xhr.onreadystatechange to report breadcrumb\n instrument(XMLHttpRequest.prototype, 'send', function (original) {\n return function () {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var xhr = this;\n function onreadystatechangeHandler() {\n if (xhr.readyState === 4) {\n var message = void 0;\n if (xhr.__hb_xhr) {\n xhr.__hb_xhr.status_code = xhr.status;\n message = xhr.__hb_xhr.message;\n delete xhr.__hb_xhr.message;\n }\n client.addBreadcrumb(message || 'XMLHttpRequest', {\n category: 'request',\n metadata: xhr.__hb_xhr\n });\n }\n }\n if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') {\n instrument(xhr, 'onreadystatechange', function (original) {\n return function () {\n onreadystatechangeHandler();\n if (typeof original === 'function') {\n // eslint-disable-next-line prefer-rest-params\n original.apply(this, arguments);\n }\n };\n });\n }\n else {\n xhr.onreadystatechange = onreadystatechangeHandler;\n }\n if (typeof original === 'function') {\n // eslint-disable-next-line prefer-rest-params\n original.apply(xhr, arguments);\n }\n };\n });\n })();\n // Breadcrumbs: instrument fetch\n (function () {\n if (!breadcrumbsEnabled('network')) {\n return;\n }\n if (!(0, util_1.nativeFetch)()) {\n // Polyfills use XHR.\n return;\n }\n instrument(_window, 'fetch', function (original) {\n return function () {\n // eslint-disable-next-line prefer-rest-params\n var input = arguments[0];\n var method = 'GET';\n var url;\n if (typeof input === 'string') {\n url = input;\n }\n else if ('Request' in _window && input instanceof Request) {\n url = input.url;\n if (input.method) {\n method = input.method;\n }\n }\n else {\n url = String(input);\n }\n if (arguments[1] && arguments[1].method) {\n method = arguments[1].method;\n }\n if (typeof method === 'string') {\n method = method.toUpperCase();\n }\n // localURLPathname cant be constructed for CF workers due to reliance on \"document\".\n var message = \"\".concat(method, \" \").concat(typeof document === 'undefined' ? url : (0, util_1.localURLPathname)(url));\n var metadata = {\n type: 'fetch',\n method: method,\n url: url\n };\n return original\n .apply(this, arguments)\n .then(function (response) {\n metadata['status_code'] = response.status;\n client.addBreadcrumb(message, {\n category: 'request',\n metadata: metadata\n });\n return response;\n })\n .catch(function (error) {\n client.addBreadcrumb('fetch error', {\n category: 'error',\n metadata: metadata\n });\n throw error;\n });\n };\n });\n })();\n // Breadcrumbs: instrument navigation\n (function () {\n if (!breadcrumbsEnabled('navigation')) {\n return;\n }\n if (_window.location == null) {\n // Most likely in a CF worker, we should be listening to fetch requests instead.\n return;\n }\n // The last known href of the current page\n var lastHref = _window.location.href;\n function recordUrlChange(from, to) {\n lastHref = to;\n client.addBreadcrumb('Page changed', {\n category: 'navigation',\n metadata: {\n from: from,\n to: to\n }\n });\n }\n if (typeof addEventListener === 'function') {\n addEventListener('popstate', function (_event) {\n recordUrlChange(lastHref, _window.location.href);\n });\n }\n if (typeof _window.history === 'undefined') {\n return;\n }\n // https://developer.mozilla.org/en-US/docs/Web/API/History/pushState\n // https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState\n function historyWrapper(original) {\n return function () {\n var url = arguments.length > 2 ? arguments[2] : undefined;\n if (url) {\n recordUrlChange(lastHref, String(url));\n }\n return original.apply(this, arguments);\n };\n }\n instrument(_window.history, 'pushState', historyWrapper);\n instrument(_window.history, 'replaceState', historyWrapper);\n })();\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=breadcrumbs.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/* eslint-disable prefer-rest-params */\nvar core_1 = require(\"@honeybadger-io/core\");\nvar instrument = core_1.Util.instrument, globalThisOrWindow = core_1.Util.globalThisOrWindow;\nfunction default_1(_window) {\n if (_window === void 0) { _window = globalThisOrWindow(); }\n return {\n load: function (client) {\n // Wrap timers\n (function () {\n function instrumentTimer(wrapOpts) {\n return function (original) {\n // See https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout\n return function (func, delay) {\n if (typeof func === 'function') {\n var args_1 = Array.prototype.slice.call(arguments, 2);\n func = client.__wrap(func, wrapOpts);\n return original(function () {\n func.apply(void 0, args_1);\n }, delay);\n }\n else {\n return original(func, delay);\n }\n };\n };\n }\n instrument(_window, 'setTimeout', instrumentTimer({ component: 'setTimeout' }));\n instrument(_window, 'setInterval', instrumentTimer({ component: 'setInterval' }));\n })();\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=timers.js.map", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar core_1 = require(\"@honeybadger-io/core\");\nvar instrument = core_1.Util.instrument, globalThisOrWindow = core_1.Util.globalThisOrWindow;\nfunction default_1(_window) {\n if (_window === void 0) { _window = globalThisOrWindow(); }\n return {\n load: function (client) {\n // Wrap event listeners\n // Event targets borrowed from bugsnag-js:\n // See https://github.com/bugsnag/bugsnag-js/blob/d55af916a4d3c7757f979d887f9533fe1a04cc93/src/bugsnag.js#L542\n var targets = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];\n targets.forEach(function (prop) {\n var prototype = _window[prop] && _window[prop].prototype;\n if (prototype && Object.prototype.hasOwnProperty.call(prototype, 'addEventListener')) {\n instrument(prototype, 'addEventListener', function (original) {\n var wrapOpts = { component: \"\".concat(prop, \".prototype.addEventListener\") };\n // See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\n return function (type, listener, useCapture, wantsUntrusted) {\n try {\n if (listener && listener.handleEvent != null) {\n listener.handleEvent = client.__wrap(listener.handleEvent, wrapOpts);\n }\n }\n catch (e) {\n // Ignore 'Permission denied to access property \"handleEvent\"' errors.\n client.logger.error(e);\n }\n return original.call(this, type, client.__wrap(listener, wrapOpts), useCapture, wantsUntrusted);\n };\n });\n instrument(prototype, 'removeEventListener', function (original) {\n return function (type, listener, useCapture, wantsUntrusted) {\n original.call(this, type, listener, useCapture, wantsUntrusted);\n return original.call(this, type, client.__wrap(listener), useCapture, wantsUntrusted);\n };\n });\n }\n });\n }\n };\n}\nexports.default = default_1;\n//# sourceMappingURL=event_listeners.js.map", "\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BrowserTransport = void 0;\nvar core_1 = require(\"@honeybadger-io/core\");\nvar sanitize = core_1.Util.sanitize, globalThisOrWindow = core_1.Util.globalThisOrWindow;\n/**\n * Helper function to get typesafe Object.entries()\n * https://twitter.com/mattpocockuk/status/1502264005251018754?lang=en\n */\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nvar BrowserTransport = /** @class */ (function () {\n function BrowserTransport(headers) {\n if (headers === void 0) { headers = {}; }\n this.headers = {};\n this.headers = headers;\n }\n BrowserTransport.prototype.defaultHeaders = function () {\n return this.headers;\n };\n BrowserTransport.prototype.send = function (options, payload) {\n return __awaiter(this, void 0, void 0, function () {\n var headerArray, headers, requestInit, response, body;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n headerArray = options.headers ? objectEntries(options.headers) : [];\n headers = this.defaultHeaders();\n headerArray.forEach(function (_a) {\n var key = _a[0], value = _a[1];\n if (key != null && value != null) {\n headers[String(key)] = String(value);\n }\n });\n requestInit = {\n method: options.method,\n headers: headers\n };\n // GET methods cannot have a body.\n if (options.method === 'POST' && payload) {\n requestInit.body = typeof payload === 'string' ? payload : JSON.stringify(sanitize(payload, options.maxObjectDepth));\n }\n return [4 /*yield*/, globalThisOrWindow().fetch(options.endpoint, requestInit)];\n case 1:\n response = _a.sent();\n return [4 /*yield*/, response.text()];\n case 2:\n body = _a.sent();\n return [2 /*return*/, Promise.resolve({ statusCode: response.status, body: body })];\n }\n });\n });\n };\n return BrowserTransport;\n}());\nexports.BrowserTransport = BrowserTransport;\n//# sourceMappingURL=transport.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.BrowserFeedbackForm = void 0;\nvar core_1 = require(\"@honeybadger-io/core\");\nvar globalThisOrWindow = core_1.Util.globalThisOrWindow;\nvar BrowserFeedbackForm = /** @class */ (function () {\n function BrowserFeedbackForm(config, logger, scriptUrl) {\n this.config = config;\n this.logger = logger;\n this.scriptUrl = scriptUrl;\n }\n /* ROLLUP_STRIP_CODE_CHROME_EXTENSION_START */\n BrowserFeedbackForm.prototype.appendUserFeedbackTag = function (window, options) {\n if (options === void 0) { options = {}; }\n var script = window.document.createElement('script');\n script.setAttribute('src', this.scriptUrl);\n script.setAttribute('async', 'true');\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n (global.document.head || global.document.body).appendChild(script);\n };\n BrowserFeedbackForm.prototype.isUserFeedbackUrlAlreadyVisible = function () {\n var global = globalThisOrWindow();\n var feedbackScriptUrl = this.scriptUrl;\n for (var i = 0; i < global.document.scripts.length; i++) {\n var script = global.document.scripts[i];\n if (script.src === feedbackScriptUrl) {\n return true;\n }\n }\n return false;\n };\n /* ROLLUP_STRIP_CODE_CHROME_EXTENSION_END */\n BrowserFeedbackForm.prototype.show = function (lastNoticeId, options) {\n if (options === void 0) { options = {}; }\n if (typeof (this.appendUserFeedbackTag) !== 'function') {\n this.logger.debug('Feedback form is not available in this environment');\n return;\n }\n if (!this.config || !this.config.apiKey) {\n this.logger.debug('Client not initialized');\n return;\n }\n if (!lastNoticeId) {\n this.logger.debug(\"Can't show user feedback form without a notice already reported\");\n return;\n }\n var global = globalThisOrWindow();\n if (typeof global.document === 'undefined') {\n this.logger.debug('global.document is undefined. Cannot attach script');\n return;\n }\n if (this.isUserFeedbackUrlAlreadyVisible()) {\n this.logger.debug('User feedback form is already visible');\n return;\n }\n global['honeybadgerUserFeedbackOptions'] = __assign(__assign({}, options), { apiKey: this.config.apiKey, endpoint: this.config.userFeedbackEndpoint, noticeId: lastNoticeId });\n this.appendUserFeedbackTag(global, options);\n };\n return BrowserFeedbackForm;\n}());\nexports.BrowserFeedbackForm = BrowserFeedbackForm;\n//# sourceMappingURL=feedback-form.js.map", "\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\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};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\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;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Types = exports.getUserFeedbackScriptUrl = void 0;\nvar core_1 = require(\"@honeybadger-io/core\");\nvar util_1 = require(\"./browser/util\");\nvar onerror_1 = require(\"./browser/integrations/onerror\");\nvar onunhandledrejection_1 = __importDefault(require(\"./browser/integrations/onunhandledrejection\"));\nvar breadcrumbs_1 = __importDefault(require(\"./browser/integrations/breadcrumbs\"));\nvar timers_1 = __importDefault(require(\"./browser/integrations/timers\"));\nvar event_listeners_1 = __importDefault(require(\"./browser/integrations/event_listeners\"));\nvar transport_1 = require(\"./browser/transport\");\nvar feedback_form_1 = require(\"./browser/feedback-form\");\nvar merge = core_1.Util.merge, filter = core_1.Util.filter, objectIsExtensible = core_1.Util.objectIsExtensible, globalThisOrWindow = core_1.Util.globalThisOrWindow;\nvar getProjectRoot = function () {\n var global = globalThisOrWindow();\n var projectRoot = '';\n // Cloudflare workers do not have access to location API.\n if (global.location != null) {\n projectRoot = global.location.protocol + '//' + global.location.host;\n }\n return projectRoot;\n};\nvar getUserFeedbackScriptUrl = function (version) {\n var majorMinorVersion = version.split('.').slice(0, 2).join('.');\n return \"https://js.honeybadger.io/v\".concat(majorMinorVersion, \"/honeybadger-feedback-form.js\");\n};\nexports.getUserFeedbackScriptUrl = getUserFeedbackScriptUrl;\nvar Honeybadger = /** @class */ (function (_super) {\n __extends(Honeybadger, _super);\n function Honeybadger(opts) {\n if (opts === void 0) { opts = {}; }\n var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({\n 'User-Agent': userAgent(),\n })) || this;\n /** @internal */\n _this.__errorsSent = 0;\n /** @internal */\n _this.__lastWrapErr = undefined;\n /** @internal */\n _this.__lastNoticeId = undefined;\n /** @internal */\n _this.__beforeNotifyHandlers = [\n function (notice) {\n if (_this.__exceedsMaxErrors()) {\n _this.logger.debug('Dropping notice: max errors exceeded', notice);\n return false;\n }\n if (notice && !notice.url && typeof document !== 'undefined') {\n notice.url = document.URL;\n }\n _this.__incrementErrorsCount();\n return true;\n }\n ];\n _this.__afterNotifyHandlers = [\n function (_error, notice) {\n if (notice) {\n _this.__lastNoticeId = notice.id;\n }\n }\n ];\n return _this;\n }\n Honeybadger.prototype.configure = function (opts) {\n if (opts === void 0) { opts = {}; }\n return _super.prototype.configure.call(this, opts);\n };\n Honeybadger.prototype.resetMaxErrors = function () {\n return (this.__errorsSent = 0);\n };\n Honeybadger.prototype.factory = function (opts) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n var clone = new Honeybadger(opts);\n clone.setNotifier(this.getNotifier());\n return clone;\n };\n Honeybadger.prototype.checkIn = function (_id) {\n throw new Error('Honeybadger.checkIn() is not supported on the browser');\n };\n Honeybadger.prototype.showUserFeedbackForm = function (options) {\n if (options === void 0) { options = {}; }\n return __awaiter(this, void 0, void 0, function () {\n var form;\n return __generator(this, function (_a) {\n form = new feedback_form_1.BrowserFeedbackForm(this.config, this.logger, this.getUserFeedbackSubmitUrl());\n form.show(this.__lastNoticeId, options);\n return [2 /*return*/];\n });\n });\n };\n Honeybadger.prototype.getUserFeedbackSubmitUrl = function () {\n return (0, exports.getUserFeedbackScriptUrl)(this.getVersion());\n };\n /** @internal */\n Honeybadger.prototype.__buildPayload = function (notice) {\n var cgiData = {\n HTTP_USER_AGENT: undefined,\n HTTP_REFERER: undefined,\n HTTP_COOKIE: undefined\n };\n if (typeof navigator !== 'undefined' && navigator.userAgent) {\n cgiData.HTTP_USER_AGENT = navigator.userAgent;\n }\n if (typeof document !== 'undefined' && document.referrer.match(/\\S/)) {\n cgiData.HTTP_REFERER = document.referrer;\n }\n var cookiesObject;\n if (typeof notice.cookies === 'string') {\n cookiesObject = (0, util_1.decodeCookie)(notice.cookies);\n }\n else {\n cookiesObject = notice.cookies;\n }\n if (cookiesObject) {\n cgiData.HTTP_COOKIE = (0, util_1.encodeCookie)(filter(cookiesObject, this.config.filters));\n }\n var payload = _super.prototype.__buildPayload.call(this, notice);\n payload.request.cgi_data = merge(cgiData, payload.request.cgi_data);\n return payload;\n };\n /**\n * wrap always returns the same function so that callbacks can be removed via\n * removeEventListener.\n * @internal\n */\n Honeybadger.prototype.__wrap = function (f, opts) {\n if (opts === void 0) { opts = {}; }\n var func = f;\n if (!opts) {\n opts = {};\n }\n try {\n if (typeof func !== 'function') {\n return func;\n }\n if (!objectIsExtensible(func)) {\n return func;\n }\n if (!func.___hb) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var client_1 = this;\n func.___hb = function () {\n if (util_1.preferCatch) {\n try {\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n catch (err) {\n if (client_1.__lastWrapErr === err) {\n throw (err);\n }\n client_1.__lastWrapErr = err;\n (0, onerror_1.ignoreNextOnError)();\n client_1.addBreadcrumb(opts.component ? \"\".concat(opts.component, \": \").concat(err.name) : err.name, {\n category: 'error',\n metadata: {\n message: err.message,\n name: err.name,\n stack: err.stack\n }\n });\n if (client_1.config.enableUncaught) {\n client_1.notify(err);\n }\n throw (err);\n }\n }\n else {\n // eslint-disable-next-line prefer-rest-params\n return func.apply(this, arguments);\n }\n };\n }\n func.___hb.___hb = func.___hb;\n return func.___hb;\n }\n catch (_e) {\n return func;\n }\n };\n /** @internal */\n Honeybadger.prototype.__incrementErrorsCount = function () {\n return this.__errorsSent++;\n };\n /** @internal */\n Honeybadger.prototype.__exceedsMaxErrors = function () {\n return this.config.maxErrors && this.__errorsSent >= this.config.maxErrors;\n };\n return Honeybadger;\n}(core_1.Client));\nvar NOTIFIER = {\n name: '@honeybadger-io/js',\n url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',\n version: '__VERSION__'\n};\nvar userAgent = function () {\n if (typeof navigator !== 'undefined') {\n return \"Honeybadger JS Browser Client \".concat(NOTIFIER.version, \"; \").concat(navigator.userAgent);\n }\n return \"Honeybadger JS Browser Client \".concat(NOTIFIER.version, \"; n/a; n/a\");\n};\nvar singleton = new Honeybadger({\n __plugins: [\n (0, onerror_1.onError)(),\n (0, onunhandledrejection_1.default)(),\n (0, timers_1.default)(),\n (0, event_listeners_1.default)(),\n (0, breadcrumbs_1.default)(),\n core_1.Plugins.events(),\n ]\n});\nsingleton.setNotifier(NOTIFIER);\nvar core_2 = require(\"@honeybadger-io/core\");\nObject.defineProperty(exports, \"Types\", { enumerable: true, get: function () { return core_2.Types; } });\nexports.default = singleton;\n//# sourceMappingURL=browser.js.map", "/**\n * MicroEvent - to make any js object an event emitter\n *\n * - pure javascript - server compatible, browser compatible\n * - dont rely on the browser doms\n * - super simple - you get it immediatly, no mistery, no magic involved\n *\n * @author Jerome Etienne (https://github.com/jeromeetienne)\n */\n\ntype TCallback = (...args:any) => any;\n\n/**\n * Execute callback for each event in space separated list of event names\n *\n */\nfunction forEvents(events:string,callback:(event:string)=>any){\n\tevents.split(/\\s+/).forEach((event) =>{\n\t\tcallback(event);\n\t});\n}\n\nexport default class MicroEvent{\n\n\tpublic _events: {[key:string]:TCallback[]};\n\n\tconstructor(){\n\t\tthis._events = {};\n\t}\n\n\ton(events:string, fct:TCallback){\n\t\tforEvents(events,(event) => {\n\t\t\tconst event_array = this._events[event] || [];\n\t\t\tevent_array.push(fct);\n\t\t\tthis._events[event] = event_array;\n\t\t});\n\t}\n\n\toff(events:string, fct:TCallback){\n\t\tvar n = arguments.length;\n\t\tif( n === 0 ){\n\t\t\tthis._events = {};\n\t\t\treturn;\n\t\t}\n\n\t\tforEvents(events,(event) => {\n\n\t\t\tif (n === 1){\n\t\t\t\tdelete this._events[event];\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst event_array = this._events[event];\n\t\t\tif( event_array === undefined ) return;\n\n\t\t\tevent_array.splice(event_array.indexOf(fct), 1);\n\t\t\tthis._events[event] = event_array;\n\t\t});\n\t}\n\n\ttrigger(events:string, ...args:any){\n\t\tvar self = this;\n\n\t\tforEvents(events,(event) => {\n\t\t\tconst event_array = self._events[event];\n\t\t\tif( event_array === undefined ) return;\n\t\t\tevent_array.forEach(fct => {\n\t\t\t\tfct.apply(self, args );\n\t\t\t});\n\n\t\t});\n\t}\n};\n", "/**\n * microplugin.js\n * Copyright (c) 2013 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis \n */\n\ntype TSettings = {\n\t[key:string]:any\n}\n\ntype TPlugins = {\n\tnames: string[],\n\tsettings: TSettings,\n\trequested: {[key:string]:boolean},\n\tloaded: {[key:string]:any}\n};\n\nexport type TPluginItem = {name:string,options:{}};\nexport type TPluginHash = {[key:string]:{}};\n\n\n\n\nexport default function MicroPlugin(Interface: any ){\n\n\tInterface.plugins = {};\n\n\treturn class extends Interface{\n\n\t\tpublic plugins:TPlugins = {\n\t\t\tnames : [],\n\t\t\tsettings : {},\n\t\t\trequested : {},\n\t\t\tloaded : {}\n\t\t};\n\n\t\t/**\n\t\t * Registers a plugin.\n\t\t *\n\t\t * @param {function} fn\n\t\t */\n\t\tstatic define(name:string, fn:(this:any,settings:TSettings)=>any){\n\t\t\tInterface.plugins[name] = {\n\t\t\t\t'name' : name,\n\t\t\t\t'fn' : fn\n\t\t\t};\n\t\t}\n\n\n\t\t/**\n\t\t * Initializes the listed plugins (with options).\n\t\t * Acceptable formats:\n\t\t *\n\t\t * List (without options):\n\t\t * ['a', 'b', 'c']\n\t\t *\n\t\t * List (with options):\n\t\t * [{'name': 'a', options: {}}, {'name': 'b', options: {}}]\n\t\t *\n\t\t * Hash (with options):\n\t\t * {'a': { ... }, 'b': { ... }, 'c': { ... }}\n\t\t *\n\t\t * @param {array|object} plugins\n\t\t */\n\t\tinitializePlugins(plugins:string[]|TPluginItem[]|TPluginHash) {\n\t\t\tvar key, name;\n\t\t\tconst self = this;\n\t\t\tconst queue:string[] = [];\n\n\t\t\tif (Array.isArray(plugins)) {\n\t\t\t\tplugins.forEach((plugin:string|TPluginItem)=>{\n\t\t\t\t\tif (typeof plugin === 'string') {\n\t\t\t\t\t\tqueue.push(plugin);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.plugins.settings[plugin.name] = plugin.options;\n\t\t\t\t\t\tqueue.push(plugin.name);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (plugins) {\n\t\t\t\tfor (key in plugins) {\n\t\t\t\t\tif (plugins.hasOwnProperty(key)) {\n\t\t\t\t\t\tself.plugins.settings[key] = plugins[key];\n\t\t\t\t\t\tqueue.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile( name = queue.shift() ){\n\t\t\t\tself.require(name);\n\t\t\t}\n\t\t}\n\n\t\tloadPlugin(name:string) {\n\t\t\tvar self = this;\n\t\t\tvar plugins = self.plugins;\n\t\t\tvar plugin = Interface.plugins[name];\n\n\t\t\tif (!Interface.plugins.hasOwnProperty(name)) {\n\t\t\t\tthrow new Error('Unable to find \"' + name + '\" plugin');\n\t\t\t}\n\n\t\t\tplugins.requested[name] = true;\n\t\t\tplugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);\n\t\t\tplugins.names.push(name);\n\t\t}\n\n\t\t/**\n\t\t * Initializes a plugin.\n\t\t *\n\t\t */\n\t\trequire(name:string) {\n\t\t\tvar self = this;\n\t\t\tvar plugins = self.plugins;\n\n\t\t\tif (!self.plugins.loaded.hasOwnProperty(name)) {\n\t\t\t\tif (plugins.requested[name]) {\n\t\t\t\t\tthrow new Error('Plugin has circular dependency (\"' + name + '\")');\n\t\t\t\t}\n\t\t\t\tself.loadPlugin(name);\n\t\t\t}\n\n\t\t\treturn plugins.loaded[name];\n\t\t}\n\n\t};\n\n}\n", "/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\n/**\n * Convert array of strings to a regular expression\n *\tex ['ab','a'] => (?:ab|a)\n * \tex ['a','b'] => [ab]\n * @param {string[]} chars\n * @return {string}\n */\nconst arrayToPattern = chars => {\n chars = chars.filter(Boolean);\n\n if (chars.length < 2) {\n return chars[0] || '';\n }\n\n return maxValueLength(chars) == 1 ? '[' + chars.join('') + ']' : '(?:' + chars.join('|') + ')';\n};\n/**\n * @param {string[]} array\n * @return {string}\n */\n\nconst sequencePattern = array => {\n if (!hasDuplicates(array)) {\n return array.join('');\n }\n\n let pattern = '';\n let prev_char_count = 0;\n\n const prev_pattern = () => {\n if (prev_char_count > 1) {\n pattern += '{' + prev_char_count + '}';\n }\n };\n\n array.forEach((char, i) => {\n if (char === array[i - 1]) {\n prev_char_count++;\n return;\n }\n\n prev_pattern();\n pattern += char;\n prev_char_count = 1;\n });\n prev_pattern();\n return pattern;\n};\n/**\n * Convert array of strings to a regular expression\n *\tex ['ab','a'] => (?:ab|a)\n * \tex ['a','b'] => [ab]\n * @param {Set} chars\n * @return {string}\n */\n\nconst setToPattern = chars => {\n let array = toArray(chars);\n return arrayToPattern(array);\n};\n/**\n *\n * https://stackoverflow.com/questions/7376598/in-javascript-how-do-i-check-if-an-array-has-duplicate-values\n * @param {any[]} array\n */\n\nconst hasDuplicates = array => {\n return new Set(array).size !== array.length;\n};\n/**\n * https://stackoverflow.com/questions/63006601/why-does-u-throw-an-invalid-escape-error\n * @param {string} str\n * @return {string}\n */\n\nconst escape_regex = str => {\n return (str + '').replace(/([\\$\\(\\)\\*\\+\\.\\?\\[\\]\\^\\{\\|\\}\\\\])/gu, '\\\\$1');\n};\n/**\n * Return the max length of array values\n * @param {string[]} array\n *\n */\n\nconst maxValueLength = array => {\n return array.reduce((longest, value) => Math.max(longest, unicodeLength(value)), 0);\n};\n/**\n * @param {string} str\n */\n\nconst unicodeLength = str => {\n return toArray(str).length;\n};\n/**\n * @param {any} p\n * @return {any[]}\n */\n\nconst toArray = p => Array.from(p);\n\nexport { arrayToPattern, escape_regex, hasDuplicates, maxValueLength, sequencePattern, setToPattern, toArray, unicodeLength };\n//# sourceMappingURL=regex.js.map\n", "/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\n/**\n * Get all possible combinations of substrings that add up to the given string\n * https://stackoverflow.com/questions/30169587/find-all-the-combination-of-substrings-that-add-up-to-the-given-string\n * @param {string} input\n * @return {string[][]}\n */\nconst allSubstrings = input => {\n if (input.length === 1) return [[input]];\n /** @type {string[][]} */\n\n let result = [];\n const start = input.substring(1);\n const suba = allSubstrings(start);\n suba.forEach(function (subresult) {\n let tmp = subresult.slice(0);\n tmp[0] = input.charAt(0) + tmp[0];\n result.push(tmp);\n tmp = subresult.slice(0);\n tmp.unshift(input.charAt(0));\n result.push(tmp);\n });\n return result;\n};\n\nexport { allSubstrings };\n//# sourceMappingURL=strings.js.map\n", "/*! @orchidjs/unicode-variants | https://github.com/orchidjs/unicode-variants | Apache License (v2) */\nimport { toArray, setToPattern, escape_regex, arrayToPattern, sequencePattern } from './regex.js';\nexport { escape_regex } from './regex.js';\nimport { allSubstrings } from './strings.js';\n\n/**\n * @typedef {{[key:string]:string}} TUnicodeMap\n * @typedef {{[key:string]:Set}} TUnicodeSets\n * @typedef {[[number,number]]} TCodePoints\n * @typedef {{folded:string,composed:string,code_point:number}} TCodePointObj\n * @typedef {{start:number,end:number,length:number,substr:string}} TSequencePart\n */\n/** @type {TCodePoints} */\n\nconst code_points = [[0, 65535]];\nconst accent_pat = '[\\u0300-\\u036F\\u{b7}\\u{2be}\\u{2bc}]';\n/** @type {TUnicodeMap} */\n\nlet unicode_map;\n/** @type {RegExp} */\n\nlet multi_char_reg;\nconst max_char_length = 3;\n/** @type {TUnicodeMap} */\n\nconst latin_convert = {};\n/** @type {TUnicodeMap} */\n\nconst latin_condensed = {\n '/': '⁄∕',\n '0': '߀',\n \"a\": \"ⱥɐɑ\",\n \"aa\": \"ꜳ\",\n \"ae\": \"æǽǣ\",\n \"ao\": \"ꜵ\",\n \"au\": \"ꜷ\",\n \"av\": \"ꜹꜻ\",\n \"ay\": \"ꜽ\",\n \"b\": \"ƀɓƃ\",\n \"c\": \"ꜿƈȼↄ\",\n \"d\": \"đɗɖᴅƌꮷԁɦ\",\n \"e\": \"ɛǝᴇɇ\",\n \"f\": \"ꝼƒ\",\n \"g\": \"ǥɠꞡᵹꝿɢ\",\n \"h\": \"ħⱨⱶɥ\",\n \"i\": \"ɨı\",\n \"j\": \"ɉȷ\",\n \"k\": \"ƙⱪꝁꝃꝅꞣ\",\n \"l\": \"łƚɫⱡꝉꝇꞁɭ\",\n \"m\": \"ɱɯϻ\",\n \"n\": \"ꞥƞɲꞑᴎлԉ\",\n \"o\": \"øǿɔɵꝋꝍᴑ\",\n \"oe\": \"œ\",\n \"oi\": \"ƣ\",\n \"oo\": \"ꝏ\",\n \"ou\": \"ȣ\",\n \"p\": \"ƥᵽꝑꝓꝕρ\",\n \"q\": \"ꝗꝙɋ\",\n \"r\": \"ɍɽꝛꞧꞃ\",\n \"s\": \"ßȿꞩꞅʂ\",\n \"t\": \"ŧƭʈⱦꞇ\",\n \"th\": \"þ\",\n \"tz\": \"ꜩ\",\n \"u\": \"ʉ\",\n \"v\": \"ʋꝟʌ\",\n \"vy\": \"ꝡ\",\n \"w\": \"ⱳ\",\n \"y\": \"ƴɏỿ\",\n \"z\": \"ƶȥɀⱬꝣ\",\n \"hv\": \"ƕ\"\n};\n\nfor (let latin in latin_condensed) {\n let unicode = latin_condensed[latin] || '';\n\n for (let i = 0; i < unicode.length; i++) {\n let char = unicode.substring(i, i + 1);\n latin_convert[char] = latin;\n }\n}\n\nconst convert_pat = new RegExp(Object.keys(latin_convert).join('|') + '|' + accent_pat, 'gu');\n/**\n * Initialize the unicode_map from the give code point ranges\n *\n * @param {TCodePoints=} _code_points\n */\n\nconst initialize = _code_points => {\n if (unicode_map !== undefined) return;\n unicode_map = generateMap(_code_points || code_points);\n};\n/**\n * Helper method for normalize a string\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize\n * @param {string} str\n * @param {string} form\n */\n\nconst normalize = (str, form = 'NFKD') => str.normalize(form);\n/**\n * Remove accents without reordering string\n * calling str.normalize('NFKD') on \\u{594}\\u{595}\\u{596} becomes \\u{596}\\u{594}\\u{595}\n * via https://github.com/krisk/Fuse/issues/133#issuecomment-318692703\n * @param {string} str\n * @return {string}\n */\n\nconst asciifold = str => {\n return toArray(str).reduce(\n /**\n * @param {string} result\n * @param {string} char\n */\n (result, char) => {\n return result + _asciifold(char);\n }, '');\n};\n/**\n * @param {string} str\n * @return {string}\n */\n\nconst _asciifold = str => {\n str = normalize(str).toLowerCase().replace(convert_pat, (\n /** @type {string} */\n char) => {\n return latin_convert[char] || '';\n }); //return str;\n\n return normalize(str, 'NFC');\n};\n/**\n * Generate a list of unicode variants from the list of code points\n * @param {TCodePoints} code_points\n * @yield {TCodePointObj}\n */\n\nfunction* generator(code_points) {\n for (const [code_point_min, code_point_max] of code_points) {\n for (let i = code_point_min; i <= code_point_max; i++) {\n let composed = String.fromCharCode(i);\n let folded = asciifold(composed);\n\n if (folded == composed.toLowerCase()) {\n continue;\n } // skip when folded is a string longer than 3 characters long\n // bc the resulting regex patterns will be long\n // eg:\n // folded صلى الله عليه وسلم length 18 code point 65018\n // folded جل جلاله length 8 code point 65019\n\n\n if (folded.length > max_char_length) {\n continue;\n }\n\n if (folded.length == 0) {\n continue;\n }\n\n yield {\n folded: folded,\n composed: composed,\n code_point: i\n };\n }\n }\n}\n/**\n * Generate a unicode map from the list of code points\n * @param {TCodePoints} code_points\n * @return {TUnicodeSets}\n */\n\nconst generateSets = code_points => {\n /** @type {{[key:string]:Set}} */\n const unicode_sets = {};\n /**\n * @param {string} folded\n * @param {string} to_add\n */\n\n const addMatching = (folded, to_add) => {\n /** @type {Set} */\n const folded_set = unicode_sets[folded] || new Set();\n const patt = new RegExp('^' + setToPattern(folded_set) + '$', 'iu');\n\n if (to_add.match(patt)) {\n return;\n }\n\n folded_set.add(escape_regex(to_add));\n unicode_sets[folded] = folded_set;\n };\n\n for (let value of generator(code_points)) {\n addMatching(value.folded, value.folded);\n addMatching(value.folded, value.composed);\n }\n\n return unicode_sets;\n};\n/**\n * Generate a unicode map from the list of code points\n * ae => (?:(?:ae|Æ|Ǽ|Ǣ)|(?:A|Ⓐ|A...)(?:E|ɛ|Ⓔ...))\n *\n * @param {TCodePoints} code_points\n * @return {TUnicodeMap}\n */\n\nconst generateMap = code_points => {\n /** @type {TUnicodeSets} */\n const unicode_sets = generateSets(code_points);\n /** @type {TUnicodeMap} */\n\n const unicode_map = {};\n /** @type {string[]} */\n\n let multi_char = [];\n\n for (let folded in unicode_sets) {\n let set = unicode_sets[folded];\n\n if (set) {\n unicode_map[folded] = setToPattern(set);\n }\n\n if (folded.length > 1) {\n multi_char.push(escape_regex(folded));\n }\n }\n\n multi_char.sort((a, b) => b.length - a.length);\n const multi_char_patt = arrayToPattern(multi_char);\n multi_char_reg = new RegExp('^' + multi_char_patt, 'u');\n return unicode_map;\n};\n/**\n * Map each element of an array from it's folded value to all possible unicode matches\n * @param {string[]} strings\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst mapSequence = (strings, min_replacement = 1) => {\n let chars_replaced = 0;\n strings = strings.map(str => {\n if (unicode_map[str]) {\n chars_replaced += str.length;\n }\n\n return unicode_map[str] || str;\n });\n\n if (chars_replaced >= min_replacement) {\n return sequencePattern(strings);\n }\n\n return '';\n};\n/**\n * Convert a short string and split it into all possible patterns\n * Keep a pattern only if min_replacement is met\n *\n * 'abc'\n * \t\t=> [['abc'],['ab','c'],['a','bc'],['a','b','c']]\n *\t\t=> ['abc-pattern','ab-c-pattern'...]\n *\n *\n * @param {string} str\n * @param {number} min_replacement\n * @return {string}\n */\n\nconst substringsToPattern = (str, min_replacement = 1) => {\n min_replacement = Math.max(min_replacement, str.length - 1);\n return arrayToPattern(allSubstrings(str).map(sub_pat => {\n return mapSequence(sub_pat, min_replacement);\n }));\n};\n/**\n * Convert an array of sequences into a pattern\n * [{start:0,end:3,length:3,substr:'iii'}...] => (?:iii...)\n *\n * @param {Sequence[]} sequences\n * @param {boolean} all\n */\n\nconst sequencesToPattern = (sequences, all = true) => {\n let min_replacement = sequences.length > 1 ? 1 : 0;\n return arrayToPattern(sequences.map(sequence => {\n let seq = [];\n const len = all ? sequence.length() : sequence.length() - 1;\n\n for (let j = 0; j < len; j++) {\n seq.push(substringsToPattern(sequence.substrs[j] || '', min_replacement));\n }\n\n return sequencePattern(seq);\n }));\n};\n/**\n * Return true if the sequence is already in the sequences\n * @param {Sequence} needle_seq\n * @param {Sequence[]} sequences\n */\n\n\nconst inSequences = (needle_seq, sequences) => {\n for (const seq of sequences) {\n if (seq.start != needle_seq.start || seq.end != needle_seq.end) {\n continue;\n }\n\n if (seq.substrs.join('') !== needle_seq.substrs.join('')) {\n continue;\n }\n\n let needle_parts = needle_seq.parts;\n /**\n * @param {TSequencePart} part\n */\n\n const filter = part => {\n for (const needle_part of needle_parts) {\n if (needle_part.start === part.start && needle_part.substr === part.substr) {\n return false;\n }\n\n if (part.length == 1 || needle_part.length == 1) {\n continue;\n } // check for overlapping parts\n // a = ['::=','==']\n // b = ['::','===']\n // a = ['r','sm']\n // b = ['rs','m']\n\n\n if (part.start < needle_part.start && part.end > needle_part.start) {\n return true;\n }\n\n if (needle_part.start < part.start && needle_part.end > part.start) {\n return true;\n }\n }\n\n return false;\n };\n\n let filtered = seq.parts.filter(filter);\n\n if (filtered.length > 0) {\n continue;\n }\n\n return true;\n }\n\n return false;\n};\n\nclass Sequence {\n constructor() {\n /** @type {TSequencePart[]} */\n this.parts = [];\n /** @type {string[]} */\n\n this.substrs = [];\n this.start = 0;\n this.end = 0;\n }\n /**\n * @param {TSequencePart|undefined} part\n */\n\n\n add(part) {\n if (part) {\n this.parts.push(part);\n this.substrs.push(part.substr);\n this.start = Math.min(part.start, this.start);\n this.end = Math.max(part.end, this.end);\n }\n }\n\n last() {\n return this.parts[this.parts.length - 1];\n }\n\n length() {\n return this.parts.length;\n }\n /**\n * @param {number} position\n * @param {TSequencePart} last_piece\n */\n\n\n clone(position, last_piece) {\n let clone = new Sequence();\n let parts = JSON.parse(JSON.stringify(this.parts));\n let last_part = parts.pop();\n\n for (const part of parts) {\n clone.add(part);\n }\n\n let last_substr = last_piece.substr.substring(0, position - last_part.start);\n let clone_last_len = last_substr.length;\n clone.add({\n start: last_part.start,\n end: last_part.start + clone_last_len,\n length: clone_last_len,\n substr: last_substr\n });\n return clone;\n }\n\n}\n/**\n * Expand a regular expression pattern to include unicode variants\n * \teg /a/ becomes /aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑAⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ/\n *\n * Issue:\n * ﺊﺋ [ 'ﺊ = \\\\u{fe8a}', 'ﺋ = \\\\u{fe8b}' ]\n *\tbecomes:\tئئ [ 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}', 'ي = \\\\u{64a}', 'ٔ = \\\\u{654}' ]\n *\n *\tİIJ = IIJ = ⅡJ\n *\n * \t1/2/4\n *\n * @param {string} str\n * @return {string|undefined}\n */\n\n\nconst getPattern = str => {\n initialize();\n str = asciifold(str);\n let pattern = '';\n let sequences = [new Sequence()];\n\n for (let i = 0; i < str.length; i++) {\n let substr = str.substring(i);\n let match = substr.match(multi_char_reg);\n const char = str.substring(i, i + 1);\n const match_str = match ? match[0] : null; // loop through sequences\n // add either the char or multi_match\n\n let overlapping = [];\n let added_types = new Set();\n\n for (const sequence of sequences) {\n const last_piece = sequence.last();\n\n if (!last_piece || last_piece.length == 1 || last_piece.end <= i) {\n // if we have a multi match\n if (match_str) {\n const len = match_str.length;\n sequence.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n added_types.add('1');\n } else {\n sequence.add({\n start: i,\n end: i + 1,\n length: 1,\n substr: char\n });\n added_types.add('2');\n }\n } else if (match_str) {\n let clone = sequence.clone(i, last_piece);\n const len = match_str.length;\n clone.add({\n start: i,\n end: i + len,\n length: len,\n substr: match_str\n });\n overlapping.push(clone);\n } else {\n // don't add char\n // adding would create invalid patterns: 234 => [2,34,4]\n added_types.add('3');\n }\n } // if we have overlapping\n\n\n if (overlapping.length > 0) {\n // ['ii','iii'] before ['i','i','iii']\n overlapping = overlapping.sort((a, b) => {\n return a.length() - b.length();\n });\n\n for (let clone of overlapping) {\n // don't add if we already have an equivalent sequence\n if (inSequences(clone, sequences)) {\n continue;\n }\n\n sequences.push(clone);\n }\n\n continue;\n } // if we haven't done anything unique\n // clean up the patterns\n // helps keep patterns smaller\n // if str = 'r₨㎧aarss', pattern will be 446 instead of 655\n\n\n if (i > 0 && added_types.size == 1 && !added_types.has('3')) {\n pattern += sequencesToPattern(sequences, false);\n let new_seq = new Sequence();\n const old_seq = sequences[0];\n\n if (old_seq) {\n new_seq.add(old_seq.last());\n }\n\n sequences = [new_seq];\n }\n }\n\n pattern += sequencesToPattern(sequences, true);\n return pattern;\n};\n\nexport { _asciifold, asciifold, code_points, generateMap, generateSets, generator, getPattern, initialize, mapSequence, normalize, substringsToPattern, unicode_map };\n//# sourceMappingURL=index.js.map\n", "/*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */\nimport { asciifold } from '@orchidjs/unicode-variants';\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nconst getAttr = (obj, name) => {\n if (!obj) return;\n return obj[name];\n};\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\n\nconst getAttrNesting = (obj, name) => {\n if (!obj) return;\n var part,\n names = name.split(\".\");\n\n while ((part = names.shift()) && (obj = obj[part]));\n\n return obj;\n};\n/**\n * Calculates how close of a match the\n * given value is against a search token.\n *\n */\n\nconst scoreValue = (value, token, weight) => {\n var score, pos;\n if (!value) return 0;\n value = value + '';\n if (token.regex == null) return 0;\n pos = value.search(token.regex);\n if (pos === -1) return 0;\n score = token.string.length / value.length;\n if (pos === 0) score += 0.5;\n return score * weight;\n};\n/**\n * Cast object property to an array if it exists and has a value\n *\n */\n\nconst propToArray = (obj, key) => {\n var value = obj[key];\n if (typeof value == 'function') return value;\n\n if (value && !Array.isArray(value)) {\n obj[key] = [value];\n }\n};\n/**\n * Iterates over arrays and hashes.\n *\n * ```\n * iterate(this.items, function(item, id) {\n * // invoked for each item\n * });\n * ```\n *\n */\n\nconst iterate = (object, callback) => {\n if (Array.isArray(object)) {\n object.forEach(callback);\n } else {\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n callback(object[key], key);\n }\n }\n }\n};\nconst cmp = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a > b ? 1 : a < b ? -1 : 0;\n }\n\n a = asciifold(a + '').toLowerCase();\n b = asciifold(b + '').toLowerCase();\n if (a > b) return 1;\n if (b > a) return -1;\n return 0;\n};\n\nexport { cmp, getAttr, getAttrNesting, iterate, propToArray, scoreValue };\n//# sourceMappingURL=utils.js.map\n", "/*! sifter.js | https://github.com/orchidjs/sifter.js | Apache License (v2) */\nimport { iterate, cmp, propToArray, getAttrNesting, getAttr, scoreValue } from './utils.js';\nexport { cmp, getAttr, getAttrNesting, iterate, propToArray, scoreValue } from './utils.js';\nimport { escape_regex, getPattern } from '@orchidjs/unicode-variants';\nexport { getPattern } from '@orchidjs/unicode-variants';\n\n/**\n * sifter.js\n * Copyright (c) 2013–2020 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis \n */\n\nclass Sifter {\n // []|{};\n\n /**\n * Textually searches arrays and hashes of objects\n * by property (or multiple properties). Designed\n * specifically for autocomplete.\n *\n */\n constructor(items, settings) {\n this.items = void 0;\n this.settings = void 0;\n this.items = items;\n this.settings = settings || {\n diacritics: true\n };\n }\n\n /**\n * Splits a search string into an array of individual\n * regexps to be used to match results.\n *\n */\n tokenize(query, respect_word_boundaries, weights) {\n if (!query || !query.length) return [];\n const tokens = [];\n const words = query.split(/\\s+/);\n var field_regex;\n\n if (weights) {\n field_regex = new RegExp('^(' + Object.keys(weights).map(escape_regex).join('|') + ')\\:(.*)$');\n }\n\n words.forEach(word => {\n let field_match;\n let field = null;\n let regex = null; // look for \"field:query\" tokens\n\n if (field_regex && (field_match = word.match(field_regex))) {\n field = field_match[1];\n word = field_match[2];\n }\n\n if (word.length > 0) {\n if (this.settings.diacritics) {\n regex = getPattern(word) || null;\n } else {\n regex = escape_regex(word);\n }\n\n if (regex && respect_word_boundaries) regex = \"\\\\b\" + regex;\n }\n\n tokens.push({\n string: word,\n regex: regex ? new RegExp(regex, 'iu') : null,\n field: field\n });\n });\n return tokens;\n }\n\n /**\n * Returns a function to be used to score individual results.\n *\n * Good matches will have a higher score than poor matches.\n * If an item is not a match, 0 will be returned by the function.\n *\n * @returns {T.ScoreFn}\n */\n getScoreFunction(query, options) {\n var search = this.prepareSearch(query, options);\n return this._getScoreFunction(search);\n }\n /**\n * @returns {T.ScoreFn}\n *\n */\n\n\n _getScoreFunction(search) {\n const tokens = search.tokens,\n token_count = tokens.length;\n\n if (!token_count) {\n return function () {\n return 0;\n };\n }\n\n const fields = search.options.fields,\n weights = search.weights,\n field_count = fields.length,\n getAttrFn = search.getAttrFn;\n\n if (!field_count) {\n return function () {\n return 1;\n };\n }\n /**\n * Calculates the score of an object\n * against the search query.\n *\n */\n\n\n const scoreObject = function () {\n if (field_count === 1) {\n return function (token, data) {\n const field = fields[0].field;\n return scoreValue(getAttrFn(data, field), token, weights[field] || 1);\n };\n }\n\n return function (token, data) {\n var sum = 0; // is the token specific to a field?\n\n if (token.field) {\n const value = getAttrFn(data, token.field);\n\n if (!token.regex && value) {\n sum += 1 / field_count;\n } else {\n sum += scoreValue(value, token, 1);\n }\n } else {\n iterate(weights, (weight, field) => {\n sum += scoreValue(getAttrFn(data, field), token, weight);\n });\n }\n\n return sum / field_count;\n };\n }();\n\n if (token_count === 1) {\n return function (data) {\n return scoreObject(tokens[0], data);\n };\n }\n\n if (search.options.conjunction === 'and') {\n return function (data) {\n var score,\n sum = 0;\n\n for (let token of tokens) {\n score = scoreObject(token, data);\n if (score <= 0) return 0;\n sum += score;\n }\n\n return sum / token_count;\n };\n } else {\n return function (data) {\n var sum = 0;\n iterate(tokens, token => {\n sum += scoreObject(token, data);\n });\n return sum / token_count;\n };\n }\n }\n\n /**\n * Returns a function that can be used to compare two\n * results, for sorting purposes. If no sorting should\n * be performed, `null` will be returned.\n *\n * @return function(a,b)\n */\n getSortFunction(query, options) {\n var search = this.prepareSearch(query, options);\n return this._getSortFunction(search);\n }\n\n _getSortFunction(search) {\n var implicit_score,\n sort_flds = [];\n const self = this,\n options = search.options,\n sort = !search.query && options.sort_empty ? options.sort_empty : options.sort;\n\n if (typeof sort == 'function') {\n return sort.bind(this);\n }\n /**\n * Fetches the specified sort field value\n * from a search result item.\n *\n */\n\n\n const get_field = function get_field(name, result) {\n if (name === '$score') return result.score;\n return search.getAttrFn(self.items[result.id], name);\n }; // parse options\n\n\n if (sort) {\n for (let s of sort) {\n if (search.query || s.field !== '$score') {\n sort_flds.push(s);\n }\n }\n } // the \"$score\" field is implied to be the primary\n // sort field, unless it's manually specified\n\n\n if (search.query) {\n implicit_score = true;\n\n for (let fld of sort_flds) {\n if (fld.field === '$score') {\n implicit_score = false;\n break;\n }\n }\n\n if (implicit_score) {\n sort_flds.unshift({\n field: '$score',\n direction: 'desc'\n });\n } // without a search.query, all items will have the same score\n\n } else {\n sort_flds = sort_flds.filter(fld => fld.field !== '$score');\n } // build function\n\n\n const sort_flds_count = sort_flds.length;\n\n if (!sort_flds_count) {\n return null;\n }\n\n return function (a, b) {\n var result, field;\n\n for (let sort_fld of sort_flds) {\n field = sort_fld.field;\n let multiplier = sort_fld.direction === 'desc' ? -1 : 1;\n result = multiplier * cmp(get_field(field, a), get_field(field, b));\n if (result) return result;\n }\n\n return 0;\n };\n }\n\n /**\n * Parses a search query and returns an object\n * with tokens and fields ready to be populated\n * with results.\n *\n */\n prepareSearch(query, optsUser) {\n const weights = {};\n var options = Object.assign({}, optsUser);\n propToArray(options, 'sort');\n propToArray(options, 'sort_empty'); // convert fields to new format\n\n if (options.fields) {\n propToArray(options, 'fields');\n const fields = [];\n options.fields.forEach(field => {\n if (typeof field == 'string') {\n field = {\n field: field,\n weight: 1\n };\n }\n\n fields.push(field);\n weights[field.field] = 'weight' in field ? field.weight : 1;\n });\n options.fields = fields;\n }\n\n return {\n options: options,\n query: query.toLowerCase().trim(),\n tokens: this.tokenize(query, options.respect_word_boundaries, weights),\n total: 0,\n items: [],\n weights: weights,\n getAttrFn: options.nesting ? getAttrNesting : getAttr\n };\n }\n\n /**\n * Searches through all items and returns a sorted array of matches.\n *\n */\n search(query, options) {\n var self = this,\n score,\n search;\n search = this.prepareSearch(query, options);\n options = search.options;\n query = search.query; // generate result scoring function\n\n const fn_score = options.score || self._getScoreFunction(search); // perform search and sort\n\n\n if (query.length) {\n iterate(self.items, (item, id) => {\n score = fn_score(item);\n\n if (options.filter === false || score > 0) {\n search.items.push({\n 'score': score,\n 'id': id\n });\n }\n });\n } else {\n iterate(self.items, (_, id) => {\n search.items.push({\n 'score': 1,\n 'id': id\n });\n });\n }\n\n const fn_sort = self._getSortFunction(search);\n\n if (fn_sort) search.items.sort(fn_sort); // apply limits\n\n search.total = search.items.length;\n\n if (typeof options.limit === 'number') {\n search.items = search.items.slice(0, options.limit);\n }\n\n return search;\n }\n\n}\n\nexport { Sifter };\n//# sourceMappingURL=sifter.js.map\n", "\nimport { asciifold } from '@orchidjs/unicode-variants';\nimport * as T from './types';\n\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttr = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n return obj[name];\n};\n\n/**\n * A property getter resolving dot-notation\n * @param {Object} obj The root object to fetch property on\n * @param {String} name The optionally dotted property name to fetch\n * @return {Object} The resolved property value\n */\nexport const getAttrNesting = (obj:{[key:string]:any}, name:string ) => {\n if (!obj ) return;\n var part, names = name.split(\".\");\n\twhile( (part = names.shift()) && (obj = obj[part]));\n return obj;\n};\n\n/**\n * Calculates how close of a match the\n * given value is against a search token.\n *\n */\nexport const scoreValue = (value:string, token:T.Token, weight:number ):number => {\n\tvar score, pos;\n\n\tif (!value) return 0;\n\n\tvalue = value + '';\n\tif( token.regex == null ) return 0;\n\tpos = value.search(token.regex);\n\tif (pos === -1) return 0;\n\n\tscore = token.string.length / value.length;\n\tif (pos === 0) score += 0.5;\n\n\treturn score * weight;\n};\n\n\n/**\n * Cast object property to an array if it exists and has a value\n *\n */\nexport const propToArray = (obj:{[key:string]:any}, key:string) => {\n\tvar value = obj[key];\n\n\tif( typeof value == 'function' ) return value;\n\n\tif( value && !Array.isArray(value) ){\n\t\tobj[key] = [value];\n\t}\n}\n\n\n/**\n * Iterates over arrays and hashes.\n *\n * ```\n * iterate(this.items, function(item, id) {\n * // invoked for each item\n * });\n * ```\n *\n */\nexport const iterate = (object:[]|{[key:string]:any}, callback:(value:any,key:any)=>any) => {\n\n\tif ( Array.isArray(object)) {\n\t\tobject.forEach(callback);\n\n\t}else{\n\n\t\tfor (var key in object) {\n\t\t\tif (object.hasOwnProperty(key)) {\n\t\t\t\tcallback(object[key], key);\n\t\t\t}\n\t\t}\n\t}\n};\n\n\n\nexport const cmp = (a:number|string, b:number|string) => {\n\tif (typeof a === 'number' && typeof b === 'number') {\n\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t}\n\ta = asciifold(a + '').toLowerCase();\n\tb = asciifold(b + '').toLowerCase();\n\tif (a > b) return 1;\n\tif (b > a) return -1;\n\treturn 0;\n};\n", "\nimport { iterate } from '@orchidjs/sifter/lib/utils';\n\n/**\n * Return a dom element from either a dom query string, jQuery object, a dom element or html string\n * https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518\n *\n * param query should be {}\n */\nexport const getDom = ( query:any ):HTMLElement => {\n\n\tif( query.jquery ){\n\t\treturn query[0];\n\t}\n\n\tif( query instanceof HTMLElement ){\n\t\treturn query;\n\t}\n\n\tif( isHtmlString(query) ){\n\t\tvar tpl = document.createElement('template');\n\t\ttpl.innerHTML = query.trim(); // Never return a text node of whitespace as the result\n\t\treturn tpl.content.firstChild as HTMLElement;\n\t}\n\n\treturn document.querySelector(query);\n};\n\nexport const isHtmlString = (arg:any): boolean => {\n\tif( typeof arg === 'string' && arg.indexOf('<') > -1 ){\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport const escapeQuery = (query:string):string => {\n\treturn query.replace(/['\"\\\\]/g, '\\\\$&');\n}\n\n/**\n * Dispatch an event\n *\n */\nexport const triggerEvent = ( dom_el:HTMLElement, event_name:string ):void => {\n\tvar event = document.createEvent('HTMLEvents');\n\tevent.initEvent(event_name, true, false);\n\tdom_el.dispatchEvent(event)\n};\n\n/**\n * Apply CSS rules to a dom element\n *\n */\nexport const applyCSS = ( dom_el:HTMLElement, css:{ [key: string]: string|number }):void => {\n\tObject.assign(dom_el.style, css);\n}\n\n\n/**\n * Add css classes\n *\n */\nexport const addClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n\tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map( cls => {\n\t\t\tel.classList.add( cls );\n\t\t});\n\t});\n}\n\n/**\n * Remove css classes\n *\n */\n export const removeClasses = ( elmts:HTMLElement|HTMLElement[], ...classes:string[]|string[][] ) => {\n\n \tvar norm_classes \t= classesArray(classes);\n\telmts\t\t\t\t= castAsArray(elmts);\n\n\telmts.map( el => {\n\t\tnorm_classes.map(cls => {\n\t \t\tel.classList.remove( cls );\n\t\t});\n \t});\n }\n\n\n/**\n * Return arguments\n *\n */\nexport const classesArray = (args:string[]|string[][]):string[] => {\n\tvar classes:string[] = [];\n\titerate( args, (_classes) =>{\n\t\tif( typeof _classes === 'string' ){\n\t\t\t_classes = _classes.trim().split(/[\\11\\12\\14\\15\\40]/);\n\t\t}\n\t\tif( Array.isArray(_classes) ){\n\t\t\tclasses = classes.concat(_classes);\n\t\t}\n\t});\n\n\treturn classes.filter(Boolean);\n}\n\n\n/**\n * Create an array from arg if it's not already an array\n *\n */\nexport const castAsArray = (arg:any):Array => {\n\tif( !Array.isArray(arg) ){\n \t\targ = [arg];\n \t}\n\treturn arg;\n}\n\n\n/**\n * Get the closest node to the evt.target matching the selector\n * Stops at wrapper\n *\n */\nexport const parentMatch = ( target:null|HTMLElement, selector:string, wrapper?:HTMLElement ):HTMLElement|void => {\n\n\tif( wrapper && !wrapper.contains(target) ){\n\t\treturn;\n\t}\n\n\twhile( target && target.matches ){\n\n\t\tif( target.matches(selector) ){\n\t\t\treturn target;\n\t\t}\n\n\t\ttarget = target.parentNode as HTMLElement;\n\t}\n}\n\n\n/**\n * Get the first or last item from an array\n *\n * > 0 - right (last)\n * <= 0 - left (first)\n *\n */\nexport const getTail = ( list:Array|NodeList, direction:number=0 ):any => {\n\n\tif( direction > 0 ){\n\t\treturn list[list.length-1];\n\t}\n\n\treturn list[0];\n}\n\n/**\n * Return true if an object is empty\n *\n */\nexport const isEmptyObject = (obj:object):boolean => {\n\treturn (Object.keys(obj).length === 0);\n}\n\n\n/**\n * Get the index of an element amongst sibling nodes of the same type\n *\n */\nexport const nodeIndex = ( el:null|Element, amongst?:string ):number => {\n\tif (!el) return -1;\n\n\tamongst = amongst || el.nodeName;\n\n\tvar i = 0;\n\twhile( el = el.previousElementSibling ){\n\n\t\tif( el.matches(amongst) ){\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}\n\n\n/**\n * Set attributes of an element\n *\n */\nexport const setAttr = (el:Element,attrs:{ [key: string]: null|string|number }) => {\n\titerate( attrs,(val,attr) => {\n\t\tif( val == null ){\n\t\t\tel.removeAttribute(attr as string);\n\t\t}else{\n\t\t\tel.setAttribute(attr as string, ''+val);\n\t\t}\n\t});\n}\n\n\n/**\n * Replace a node\n */\nexport const replaceNode = ( existing:Node, replacement:Node ) => {\n\tif( existing.parentNode ) existing.parentNode.replaceChild(replacement, existing);\n}\n", "/**\n * highlight v3 | MIT license | Johann Burkard \n * Highlights arbitrary terms in a node.\n *\n * - Modified by Marshal 2011-6-24 (added regex)\n * - Modified by Brian Reavis 2012-8-27 (cleanup)\n */\n\nimport {replaceNode} from '../vanilla';\n\n\nexport const highlight = (element:HTMLElement, regex:string|RegExp) => {\n\n\tif( regex === null ) return;\n\n\t// convet string to regex\n\tif( typeof regex === 'string' ){\n\n\t\tif( !regex.length ) return;\n\t\tregex = new RegExp(regex, 'i');\n\t}\n\n\n\t// Wrap matching part of text node with highlighting , e.g.\n\t// Soccer -> Soccer for regex = /soc/i\n\tconst highlightText = ( node:Text ):number => {\n\n\t\tvar match = node.data.match(regex);\n\t\tif( match && node.data.length > 0 ){\n\t\t\tvar spannode\t\t= document.createElement('span');\n\t\t\tspannode.className\t= 'highlight';\n\t\t\tvar middlebit\t\t= node.splitText(match.index as number);\n\n\t\t\tmiddlebit.splitText(match[0]!.length);\n\t\t\tvar middleclone\t\t= middlebit.cloneNode(true);\n\n\t\t\tspannode.appendChild(middleclone);\n\t\t\treplaceNode(middlebit, spannode);\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\n\t// Recurse element node, looking for child text nodes to highlight, unless element\n\t// is childless,