{"version":3,"sources":["webpack:///./node_modules/@segment/analytics-next/dist/pkg/lib/is-plan-event-enabled.js","webpack:///./node_modules/@segment/analytics-next/dist/pkg/plugins/ajs-destination/loader.js","webpack:///./node_modules/@segment/analytics-next/dist/pkg/plugins/ajs-destination/utils.js","webpack:///./node_modules/@segment/analytics-next/dist/pkg/plugins/ajs-destination/index.js"],"names":["isPlanEventEnabled","plan","planEvent","_a","_b","enabled","__default","normalizeName","name","toLowerCase","replace","obfuscatePathName","pathName","obfuscate","btoa","undefined","loadIntegration","ctx","version","this","obfuscatedPathName","path","fullPath","err_1","deps","label","concat","trys","push","sent","metric","window","performance","getEntriesByName","stats","gauge","Math","round","duration","_","recordLoadMetrics","Promise","all","map","dep","isInstallableIntegration","integrationSettings","type","bundlingStatus","versionSettings","deviceMode","componentTypes","includes","startsWith","isDisabledIntegration","integrationName","globalIntegrations","allDisableAndNotDefined","All","flushQueue","xt","queue","failedQueue","_this","length","result","pop","failed","pushWithBackoff","LegacyDestination","writeKey","settings","options","integrationSource","middleware","initializePromise","flushing","disableAutoISOConversion","promise","then","isInitialized","_initialized","buffer","disableClientPersistence","scheduleFlush","prototype","isLoaded","_ready","ready","onReady","resolve","load","analyticsInstance","_c","integration","integrationCtr","user","addIntegration","Integration","analytics","buildIntegration","once","on","methodName","initialize","error","didError","unload","_ctx","_analyticsInstance","unloadIntegration","addMiddleware","fn","_i","arguments","apply","shouldBuffer","event","send","clz","eventType","ev","afterMiddleware","track","updateEvent","integrations","cancel","retry","reason","traverse","invoke","call","page","_assumesPageview","identify","alias","group","setTimeout","todo","random","ajsDestinations","routingMiddleware","legacyIntegrationSources","routingRules","middlewareSettings","remoteIntegrationsConfig","localIntegrationsConfig","integrationOptions","adhocIntegrationSources","reduce","acc","resolveIntegrationNameFromSource","installableIntegrations","Set","Object","keys","filter","Array","from","integrationConfig","_d","override","resolveVersion","destination","rule","destinationName"],"mappings":"2FAMO,SAASA,EAAmBC,EAAMC,GACvC,IAAIC,EAAIC,EAG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AAOC,KAAKV,GAA0BW,QAAO,SAAUpJ,GAC3H,OAAOqC,EAAyBrC,EAAMyI,EAAyBzI,GACjE,KAAI,GAAOkJ,OAAOC,KAAKP,GAA2B,CAAC,GAAGQ,QAAO,SAAUpJ,GACrE,OAAO,YAAcyI,EAAyBzI,KAAU,YAA0C,OAA5B0I,QAAgE,IAA5BA,OAAqC,EAASA,EAAwB1I,GAClL,KAAI,IACJ,OAAOqJ,MAAMC,KAAKN,GAAyBI,QAAO,SAAUpJ,GAC1D,OAAQ,EAAsBA,EAAMgD,EACtC,IAAGb,KAAI,SAAUnC,GACf,IACIU,EFtXD,SAAwB6I,GAC7B,IAAI5J,EAAIC,EAAIyF,EAAImE,EAEhB,OAAyX,QAAjXA,EAAgL,QAA1K5J,EAAwH,QAAlHD,EAA2B,OAAtB4J,QAAoD,IAAtBA,OAA+B,EAASA,EAAkB9G,uBAAoC,IAAP9C,OAAgB,EAASA,EAAG8J,gBAA6B,IAAP7J,EAAgBA,EAAwH,QAAlHyF,EAA2B,OAAtBkE,QAAoD,IAAtBA,OAA+B,EAASA,EAAkB9G,uBAAoC,IAAP4C,OAAgB,EAASA,EAAG3E,eAA4B,IAAP8I,EAAgBA,EAAK,QACxZ,CEkXkBE,CADYjB,EAAyBzI,IAE/C2J,EAAc,IAAI,EAAkB3J,EAAMU,EAASoD,EAAU6E,EAAmB3I,GAAOgE,EAAqC,OAA5B4E,QAAgE,IAA5BA,OAAqC,EAASA,EAAwB5I,IAS9M,OARcuI,EAAaa,QAAO,SAAUQ,GAC1C,OAAOA,EAAKC,kBAAoB7J,CAClC,IAEYwD,OAAS,GAAK6E,GACxBsB,EAAYpD,cAAc8B,GAGrBsB,CACT,GACF,C","file":"js/ajs-destination-526eb927e7126ffa46ea.chunk.js","sourcesContent":["/**\n * Determines whether a track event is allowed to be sent based on the\n * user's tracking plan.\n * If the user does not have a tracking plan or the event is allowed based\n * on the tracking plan configuration, returns true.\n */\nexport function isPlanEventEnabled(plan, planEvent) {\n var _a, _b; // Always prioritize the event's `enabled` status\n\n\n if (typeof (planEvent === null || planEvent === void 0 ? void 0 : planEvent.enabled) === 'boolean') {\n return planEvent.enabled;\n } // Assume absence of a tracking plan means events are enabled\n\n\n return (_b = (_a = plan === null || plan === void 0 ? void 0 : plan.__default) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : true;\n}","import { __awaiter, __generator, __spreadArray } from \"tslib\";\nimport { getNextIntegrationsURL } from '../../lib/parse-cdn';\nimport { loadScript, unloadScript } from '../../lib/load-script';\n\nfunction normalizeName(name) {\n return name.toLowerCase().replace('.', '').replace(/\\s+/g, '-');\n}\n\nfunction obfuscatePathName(pathName, obfuscate) {\n if (obfuscate === void 0) {\n obfuscate = false;\n }\n\n return obfuscate ? btoa(pathName).replace(/=/g, '') : undefined;\n}\n\nexport function resolveIntegrationNameFromSource(integrationSource) {\n return ('Integration' in integrationSource ? integrationSource.Integration : integrationSource).prototype.name;\n}\n\nfunction recordLoadMetrics(fullPath, ctx, name) {\n var _a, _b;\n\n try {\n var metric = ((_b = (_a = window === null || window === void 0 ? void 0 : window.performance) === null || _a === void 0 ? void 0 : _a.getEntriesByName(fullPath, 'resource')) !== null && _b !== void 0 ? _b : [])[0]; // we assume everything that took under 100ms is cached\n\n metric && ctx.stats.gauge('legacy_destination_time', Math.round(metric.duration), __spreadArray([name], metric.duration < 100 ? ['cached'] : [], true));\n } catch (_) {// not available\n }\n}\n\nexport function buildIntegration(integrationSource, integrationSettings, analyticsInstance) {\n var integrationCtr; // GA and Appcues use a different interface to instantiating integrations\n\n if ('Integration' in integrationSource) {\n var analyticsStub = {\n user: function user() {\n return analyticsInstance.user();\n },\n addIntegration: function addIntegration() {}\n };\n integrationSource(analyticsStub);\n integrationCtr = integrationSource.Integration;\n } else {\n integrationCtr = integrationSource;\n }\n\n var integration = new integrationCtr(integrationSettings);\n integration.analytics = analyticsInstance;\n return integration;\n}\nexport function loadIntegration(ctx, name, version, obfuscate) {\n return __awaiter(this, void 0, void 0, function () {\n var pathName, obfuscatedPathName, path, fullPath, err_1, deps;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n pathName = normalizeName(name);\n obfuscatedPathName = obfuscatePathName(pathName, obfuscate);\n path = getNextIntegrationsURL();\n fullPath = \"\".concat(path, \"/integrations/\").concat(obfuscatedPathName !== null && obfuscatedPathName !== void 0 ? obfuscatedPathName : pathName, \"/\").concat(version, \"/\").concat(obfuscatedPathName !== null && obfuscatedPathName !== void 0 ? obfuscatedPathName : pathName, \".dynamic.js.gz\");\n _a.label = 1;\n\n case 1:\n _a.trys.push([1, 3,, 4]);\n\n return [4\n /*yield*/\n , loadScript(fullPath)];\n\n case 2:\n _a.sent();\n\n recordLoadMetrics(fullPath, ctx, name);\n return [3\n /*break*/\n , 4];\n\n case 3:\n err_1 = _a.sent();\n ctx.stats.gauge('legacy_destination_time', -1, [\"plugin:\".concat(name), \"failed\"]);\n throw err_1;\n\n case 4:\n deps = window[\"\".concat(pathName, \"Deps\")];\n return [4\n /*yield*/\n , Promise.all(deps.map(function (dep) {\n return loadScript(path + dep + '.gz');\n })) // @ts-ignore\n ];\n\n case 5:\n _a.sent(); // @ts-ignore\n\n\n window[\"\".concat(pathName, \"Loader\")]();\n return [2\n /*return*/\n , window[// @ts-ignore\n \"\".concat(pathName, \"Integration\")]];\n }\n });\n });\n}\nexport function unloadIntegration(name, version, obfuscate) {\n return __awaiter(this, void 0, void 0, function () {\n var path, pathName, obfuscatedPathName, fullPath;\n return __generator(this, function (_a) {\n path = getNextIntegrationsURL();\n pathName = normalizeName(name);\n obfuscatedPathName = obfuscatePathName(name, obfuscate);\n fullPath = \"\".concat(path, \"/integrations/\").concat(obfuscatedPathName !== null && obfuscatedPathName !== void 0 ? obfuscatedPathName : pathName, \"/\").concat(version, \"/\").concat(obfuscatedPathName !== null && obfuscatedPathName !== void 0 ? obfuscatedPathName : pathName, \".dynamic.js.gz\");\n return [2\n /*return*/\n , unloadScript(fullPath)];\n });\n });\n}\nexport function resolveVersion(integrationConfig) {\n var _a, _b, _c, _d;\n\n return (_d = (_b = (_a = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.versionSettings) === null || _a === void 0 ? void 0 : _a.override) !== null && _b !== void 0 ? _b : (_c = integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.versionSettings) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : 'latest';\n}","export var isInstallableIntegration = function isInstallableIntegration(name, integrationSettings) {\n var _a;\n\n var type = integrationSettings.type,\n bundlingStatus = integrationSettings.bundlingStatus,\n versionSettings = integrationSettings.versionSettings; // We use `!== 'unbundled'` (versus `=== 'bundled'`) to be inclusive of\n // destinations without a defined value for `bundlingStatus`\n\n var deviceMode = bundlingStatus !== 'unbundled' && (type === 'browser' || ((_a = versionSettings === null || versionSettings === void 0 ? void 0 : versionSettings.componentTypes) === null || _a === void 0 ? void 0 : _a.includes('browser'))); // checking for iterable is a quick fix we need in place to prevent\n // errors showing Iterable as a failed destiantion. Ideally, we should\n // fix the Iterable metadata instead, but that's a longer process.\n\n return !name.startsWith('Segment') && name !== 'Iterable' && deviceMode;\n};\nexport var isDisabledIntegration = function isDisabledIntegration(integrationName, globalIntegrations) {\n var allDisableAndNotDefined = globalIntegrations.All === false && globalIntegrations[integrationName] === undefined;\n return globalIntegrations[integrationName] === false || allDisableAndNotDefined;\n};","import { __assign, __awaiter, __generator, __spreadArray } from \"tslib\";\nimport { Alias, Group, Identify, Page, Track } from '@segment/facade';\nimport { isOffline, isOnline } from '../../core/connection';\nimport { Context, ContextCancelation } from '../../core/context';\nimport { isServer } from '../../core/environment';\nimport { attempt } from '@segment/analytics-core';\nimport { isPlanEventEnabled } from '../../lib/is-plan-event-enabled';\nimport { mergedOptions } from '../../lib/merged-options';\nimport { pWhile } from '../../lib/p-while';\nimport { PriorityQueue } from '../../lib/priority-queue';\nimport { PersistedPriorityQueue } from '../../lib/priority-queue/persisted';\nimport { applyDestinationMiddleware } from '../middleware';\nimport { buildIntegration, loadIntegration, resolveIntegrationNameFromSource, resolveVersion, unloadIntegration } from './loader';\nimport { isPlainObject } from '@segment/analytics-core';\nimport { isDisabledIntegration as shouldSkipIntegration, isInstallableIntegration } from './utils';\nimport { recordIntegrationMetric } from '../../core/stats/metric-helpers';\nimport { createDeferred } from '@segment/analytics-generic-utils';\n\nfunction flushQueue(xt, queue) {\n return __awaiter(this, void 0, void 0, function () {\n var failedQueue;\n\n var _this = this;\n\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n failedQueue = [];\n\n if (isOffline()) {\n return [2\n /*return*/\n , queue];\n }\n\n return [4\n /*yield*/\n , pWhile(function () {\n return queue.length > 0 && isOnline();\n }, function () {\n return __awaiter(_this, void 0, void 0, function () {\n var ctx, result, success;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n ctx = queue.pop();\n\n if (!ctx) {\n return [2\n /*return*/\n ];\n }\n\n return [4\n /*yield*/\n , attempt(ctx, xt)];\n\n case 1:\n result = _a.sent();\n success = result instanceof Context;\n\n if (!success) {\n failedQueue.push(ctx);\n }\n\n return [2\n /*return*/\n ];\n }\n });\n });\n }) // re-add failed tasks\n ];\n\n case 1:\n _a.sent(); // re-add failed tasks\n\n\n failedQueue.map(function (failed) {\n return queue.pushWithBackoff(failed);\n });\n return [2\n /*return*/\n , queue];\n }\n });\n });\n}\n\nvar LegacyDestination = function () {\n function LegacyDestination(name, version, writeKey, settings, options, integrationSource) {\n if (settings === void 0) {\n settings = {};\n }\n\n var _this = this;\n\n this.options = {};\n this.type = 'destination';\n this.middleware = [];\n this.initializePromise = createDeferred();\n this.flushing = false;\n this.name = name;\n this.version = version;\n this.settings = __assign({}, settings);\n this.disableAutoISOConversion = options.disableAutoISOConversion || false;\n this.integrationSource = integrationSource; // AJS-Renderer sets an extraneous `type` setting that clobbers\n // existing type defaults. We need to remove it if it's present\n\n if (this.settings['type'] && this.settings['type'] === 'browser') {\n delete this.settings['type'];\n }\n\n this.initializePromise.promise.then(function (isInitialized) {\n return _this._initialized = isInitialized;\n }, function () {});\n this.options = options;\n this.buffer = options.disableClientPersistence ? new PriorityQueue(4, []) : new PersistedPriorityQueue(4, \"\".concat(writeKey, \":dest-\").concat(name));\n this.scheduleFlush();\n }\n\n LegacyDestination.prototype.isLoaded = function () {\n return !!this._ready;\n };\n\n LegacyDestination.prototype.ready = function () {\n var _this = this;\n\n return this.initializePromise.promise.then(function () {\n var _a;\n\n return (_a = _this.onReady) !== null && _a !== void 0 ? _a : Promise.resolve();\n });\n };\n\n LegacyDestination.prototype.load = function (ctx, analyticsInstance) {\n var _a;\n\n return __awaiter(this, void 0, void 0, function () {\n var integrationSource, _b;\n\n var _this = this;\n\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (this._ready || this.onReady !== undefined) {\n return [2\n /*return*/\n ];\n }\n\n if (!((_a = this.integrationSource) !== null && _a !== void 0)) return [3\n /*break*/\n , 1];\n _b = _a;\n return [3\n /*break*/\n , 3];\n\n case 1:\n return [4\n /*yield*/\n , loadIntegration(ctx, this.name, this.version, this.options.obfuscate)];\n\n case 2:\n _b = _c.sent();\n _c.label = 3;\n\n case 3:\n integrationSource = _b;\n this.integration = buildIntegration(integrationSource, this.settings, analyticsInstance);\n this.onReady = new Promise(function (resolve) {\n var onReadyFn = function onReadyFn() {\n _this._ready = true;\n resolve(true);\n };\n\n _this.integration.once('ready', onReadyFn);\n });\n this.integration.on('initialize', function () {\n _this.initializePromise.resolve(true);\n });\n\n try {\n recordIntegrationMetric(ctx, {\n integrationName: this.name,\n methodName: 'initialize',\n type: 'classic'\n });\n this.integration.initialize();\n } catch (error) {\n recordIntegrationMetric(ctx, {\n integrationName: this.name,\n methodName: 'initialize',\n type: 'classic',\n didError: true\n });\n this.initializePromise.resolve(false);\n throw error;\n }\n\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n LegacyDestination.prototype.unload = function (_ctx, _analyticsInstance) {\n return unloadIntegration(this.name, this.version, this.options.obfuscate);\n };\n\n LegacyDestination.prototype.addMiddleware = function () {\n var _a;\n\n var fn = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n fn[_i] = arguments[_i];\n }\n\n this.middleware = (_a = this.middleware).concat.apply(_a, fn);\n };\n\n LegacyDestination.prototype.shouldBuffer = function (ctx) {\n return (// page events can't be buffered because of destinations that automatically add page views\n ctx.event.type !== 'page' && (isOffline() || this._ready !== true || this._initialized !== true)\n );\n };\n\n LegacyDestination.prototype.send = function (ctx, clz, eventType) {\n var _a, _b;\n\n return __awaiter(this, void 0, void 0, function () {\n var plan, ev, planEvent, afterMiddleware, event, err_1;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n if (this.shouldBuffer(ctx)) {\n this.buffer.push(ctx);\n this.scheduleFlush();\n return [2\n /*return*/\n , ctx];\n }\n\n plan = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.plan) === null || _b === void 0 ? void 0 : _b.track;\n ev = ctx.event.event;\n\n if (plan && ev && this.name !== 'Segment.io') {\n planEvent = plan[ev];\n\n if (!isPlanEventEnabled(plan, planEvent)) {\n ctx.updateEvent('integrations', __assign(__assign({}, ctx.event.integrations), {\n All: false,\n 'Segment.io': true\n }));\n ctx.cancel(new ContextCancelation({\n retry: false,\n reason: \"Event \".concat(ev, \" disabled for integration \").concat(this.name, \" in tracking plan\"),\n type: 'Dropped by plan'\n }));\n } else {\n ctx.updateEvent('integrations', __assign(__assign({}, ctx.event.integrations), planEvent === null || planEvent === void 0 ? void 0 : planEvent.integrations));\n }\n\n if ((planEvent === null || planEvent === void 0 ? void 0 : planEvent.enabled) && (planEvent === null || planEvent === void 0 ? void 0 : planEvent.integrations[this.name]) === false) {\n ctx.cancel(new ContextCancelation({\n retry: false,\n reason: \"Event \".concat(ev, \" disabled for integration \").concat(this.name, \" in tracking plan\"),\n type: 'Dropped by plan'\n }));\n }\n }\n\n return [4\n /*yield*/\n , applyDestinationMiddleware(this.name, ctx.event, this.middleware)];\n\n case 1:\n afterMiddleware = _c.sent();\n\n if (afterMiddleware === null) {\n return [2\n /*return*/\n , ctx];\n }\n\n event = new clz(afterMiddleware, {\n traverse: !this.disableAutoISOConversion\n });\n recordIntegrationMetric(ctx, {\n integrationName: this.name,\n methodName: eventType,\n type: 'classic'\n });\n _c.label = 2;\n\n case 2:\n _c.trys.push([2, 5,, 6]);\n\n if (!this.integration) return [3\n /*break*/\n , 4];\n return [4\n /*yield*/\n , this.integration.invoke.call(this.integration, eventType, event)];\n\n case 3:\n _c.sent();\n\n _c.label = 4;\n\n case 4:\n return [3\n /*break*/\n , 6];\n\n case 5:\n err_1 = _c.sent();\n recordIntegrationMetric(ctx, {\n integrationName: this.name,\n methodName: eventType,\n type: 'classic',\n didError: true\n });\n throw err_1;\n\n case 6:\n return [2\n /*return*/\n , ctx];\n }\n });\n });\n };\n\n LegacyDestination.prototype.track = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , this.send(ctx, Track, 'track')];\n });\n });\n };\n\n LegacyDestination.prototype.page = function (ctx) {\n var _a;\n\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (((_a = this.integration) === null || _a === void 0 ? void 0 : _a._assumesPageview) && !this._initialized) {\n this.integration.initialize();\n }\n\n return [4\n /*yield*/\n , this.initializePromise.promise];\n\n case 1:\n _b.sent();\n\n return [2\n /*return*/\n , this.send(ctx, Page, 'page')];\n }\n });\n });\n };\n\n LegacyDestination.prototype.identify = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , this.send(ctx, Identify, 'identify')];\n });\n });\n };\n\n LegacyDestination.prototype.alias = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , this.send(ctx, Alias, 'alias')];\n });\n });\n };\n\n LegacyDestination.prototype.group = function (ctx) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2\n /*return*/\n , this.send(ctx, Group, 'group')];\n });\n });\n };\n\n LegacyDestination.prototype.scheduleFlush = function () {\n var _this = this;\n\n if (this.flushing) {\n return;\n } // eslint-disable-next-line @typescript-eslint/no-misused-promises\n\n\n setTimeout(function () {\n return __awaiter(_this, void 0, void 0, function () {\n var _a;\n\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n if (isOffline() || this._ready !== true || this._initialized !== true) {\n this.scheduleFlush();\n return [2\n /*return*/\n ];\n }\n\n this.flushing = true;\n _a = this;\n return [4\n /*yield*/\n , flushQueue(this, this.buffer)];\n\n case 1:\n _a.buffer = _b.sent();\n this.flushing = false;\n\n if (this.buffer.todo > 0) {\n this.scheduleFlush();\n }\n\n return [2\n /*return*/\n ];\n }\n });\n });\n }, Math.random() * 5000);\n };\n\n return LegacyDestination;\n}();\n\nexport { LegacyDestination };\nexport function ajsDestinations(writeKey, settings, globalIntegrations, options, routingMiddleware, legacyIntegrationSources) {\n var _a, _b;\n\n if (globalIntegrations === void 0) {\n globalIntegrations = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n if (isServer()) {\n return [];\n }\n\n if (settings.plan) {\n options = options !== null && options !== void 0 ? options : {};\n options.plan = settings.plan;\n }\n\n var routingRules = (_b = (_a = settings.middlewareSettings) === null || _a === void 0 ? void 0 : _a.routingRules) !== null && _b !== void 0 ? _b : [];\n var remoteIntegrationsConfig = settings.integrations;\n var localIntegrationsConfig = options.integrations; // merged remote CDN settings with user provided options\n\n var integrationOptions = mergedOptions(settings, options !== null && options !== void 0 ? options : {});\n var adhocIntegrationSources = legacyIntegrationSources === null || legacyIntegrationSources === void 0 ? void 0 : legacyIntegrationSources.reduce(function (acc, integrationSource) {\n var _a;\n\n return __assign(__assign({}, acc), (_a = {}, _a[resolveIntegrationNameFromSource(integrationSource)] = integrationSource, _a));\n }, {});\n var installableIntegrations = new Set(__spreadArray(__spreadArray([], Object.keys(remoteIntegrationsConfig).filter(function (name) {\n return isInstallableIntegration(name, remoteIntegrationsConfig[name]);\n }), true), Object.keys(adhocIntegrationSources || {}).filter(function (name) {\n return isPlainObject(remoteIntegrationsConfig[name]) || isPlainObject(localIntegrationsConfig === null || localIntegrationsConfig === void 0 ? void 0 : localIntegrationsConfig[name]);\n }), true));\n return Array.from(installableIntegrations).filter(function (name) {\n return !shouldSkipIntegration(name, globalIntegrations);\n }).map(function (name) {\n var integrationSettings = remoteIntegrationsConfig[name];\n var version = resolveVersion(integrationSettings);\n var destination = new LegacyDestination(name, version, writeKey, integrationOptions[name], options, adhocIntegrationSources === null || adhocIntegrationSources === void 0 ? void 0 : adhocIntegrationSources[name]);\n var routing = routingRules.filter(function (rule) {\n return rule.destinationName === name;\n });\n\n if (routing.length > 0 && routingMiddleware) {\n destination.addMiddleware(routingMiddleware);\n }\n\n return destination;\n });\n}"],"sourceRoot":""}