{"version":3,"sources":["node_modules/@angular/animations/fesm2022/browser.mjs","node_modules/@angular/platform-browser/fesm2022/animations.mjs","node_modules/@vendasta/sso/fesm2020/vendasta-sso.mjs","node_modules/@vendasta/iam/fesm2020/vendasta-iam.mjs","node_modules/posthog-js/dist/module.js","libs/product-analytics/src/lib/product-analytics.service.ts","libs/product-analytics/src/lib/product-analytics.module.ts","libs/billing-ui/src/lib/stripe.service.ts","node_modules/ng-recaptcha/fesm2020/ng-recaptcha.mjs","node_modules/@vendasta/address/fesm2020/vendasta-address.mjs","libs/galaxy/provider-default-overrides/src/provider-default-overrides.ts","apps/partner-self-signup-client/src/assets/i18n/en_devel.json","apps/partner-self-signup-client/src/app/constants.ts","apps/partner-self-signup-client/src/app/core/cookie.service.ts","apps/partner-self-signup-client/src/app/core/auth/auth.api.service.ts","apps/partner-self-signup-client/src/app/core/auth/auth.service.ts","apps/partner-self-signup-client/src/app/core/sso-state.ts","apps/partner-self-signup-client/src/app/sign-up-form/sign-up-form.service.ts","apps/partner-self-signup-client/src/app/currentstep.service.ts","apps/partner-self-signup-client/src/app/custom-content.ts","apps/partner-self-signup-client/src/app/next-urls.ts","apps/partner-self-signup-client/src/app/sign-up-form/sign-up-form.component.ts","apps/partner-self-signup-client/src/app/sign-up-form/sign-up-form.component.html","apps/partner-self-signup-client/src/app/app.component.ts","apps/partner-self-signup-client/src/app/app.component.html","apps/partner-self-signup-client/src/app/autocomplete.service.ts","apps/partner-self-signup-client/src/app/core/guards/module-import-guard.ts","apps/partner-self-signup-client/src/app/core/core.module.ts","apps/partner-self-signup-client/src/app/sign-up-form/signup-steps/sign-up-step-one.component.ts","apps/partner-self-signup-client/src/app/sign-up-form/signup-steps/sign-up-step-one.component.html","apps/partner-self-signup-client/src/app/sign-up-form/signup-steps/sign-up-step-two-form.component.ts","apps/partner-self-signup-client/src/app/sign-up-form/signup-steps/sign-up-step-two-form.component.html","apps/partner-self-signup-client/src/app/app.module.ts","apps/partner-self-signup-client/src/globals.ts","apps/partner-self-signup-client/src/main.ts"],"sourcesContent":["/**\n * @license Angular v18.2.0\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { ɵAnimationGroupPlayer, NoopAnimationPlayer, AUTO_STYLE, ɵPRE_STYLE, sequence, AnimationMetadataType, style } from '@angular/animations';\nimport * as i0 from '@angular/core';\nimport { ɵRuntimeError, Injectable } from '@angular/core';\nconst LINE_START = '\\n - ';\nfunction invalidTimingValue(exp) {\n return new ɵRuntimeError(3000 /* RuntimeErrorCode.INVALID_TIMING_VALUE */, ngDevMode && `The provided timing value \"${exp}\" is invalid.`);\n}\nfunction negativeStepValue() {\n return new ɵRuntimeError(3100 /* RuntimeErrorCode.NEGATIVE_STEP_VALUE */, ngDevMode && 'Duration values below 0 are not allowed for this animation step.');\n}\nfunction negativeDelayValue() {\n return new ɵRuntimeError(3101 /* RuntimeErrorCode.NEGATIVE_DELAY_VALUE */, ngDevMode && 'Delay values below 0 are not allowed for this animation step.');\n}\nfunction invalidStyleParams(varName) {\n return new ɵRuntimeError(3001 /* RuntimeErrorCode.INVALID_STYLE_PARAMS */, ngDevMode && `Unable to resolve the local animation param ${varName} in the given list of values`);\n}\nfunction invalidParamValue(varName) {\n return new ɵRuntimeError(3003 /* RuntimeErrorCode.INVALID_PARAM_VALUE */, ngDevMode && `Please provide a value for the animation param ${varName}`);\n}\nfunction invalidNodeType(nodeType) {\n return new ɵRuntimeError(3004 /* RuntimeErrorCode.INVALID_NODE_TYPE */, ngDevMode && `Unable to resolve animation metadata node #${nodeType}`);\n}\nfunction invalidCssUnitValue(userProvidedProperty, value) {\n return new ɵRuntimeError(3005 /* RuntimeErrorCode.INVALID_CSS_UNIT_VALUE */, ngDevMode && `Please provide a CSS unit value for ${userProvidedProperty}:${value}`);\n}\nfunction invalidTrigger() {\n return new ɵRuntimeError(3006 /* RuntimeErrorCode.INVALID_TRIGGER */, ngDevMode && \"animation triggers cannot be prefixed with an `@` sign (e.g. trigger('@foo', [...]))\");\n}\nfunction invalidDefinition() {\n return new ɵRuntimeError(3007 /* RuntimeErrorCode.INVALID_DEFINITION */, ngDevMode && 'only state() and transition() definitions can sit inside of a trigger()');\n}\nfunction invalidState(metadataName, missingSubs) {\n return new ɵRuntimeError(3008 /* RuntimeErrorCode.INVALID_STATE */, ngDevMode && `state(\"${metadataName}\", ...) must define default values for all the following style substitutions: ${missingSubs.join(', ')}`);\n}\nfunction invalidStyleValue(value) {\n return new ɵRuntimeError(3002 /* RuntimeErrorCode.INVALID_STYLE_VALUE */, ngDevMode && `The provided style string value ${value} is not allowed.`);\n}\nfunction invalidProperty(prop) {\n return new ɵRuntimeError(3009 /* RuntimeErrorCode.INVALID_PROPERTY */, ngDevMode && `The provided animation property \"${prop}\" is not a supported CSS property for animations`);\n}\nfunction invalidParallelAnimation(prop, firstStart, firstEnd, secondStart, secondEnd) {\n return new ɵRuntimeError(3010 /* RuntimeErrorCode.INVALID_PARALLEL_ANIMATION */, ngDevMode && `The CSS property \"${prop}\" that exists between the times of \"${firstStart}ms\" and \"${firstEnd}ms\" is also being animated in a parallel animation between the times of \"${secondStart}ms\" and \"${secondEnd}ms\"`);\n}\nfunction invalidKeyframes() {\n return new ɵRuntimeError(3011 /* RuntimeErrorCode.INVALID_KEYFRAMES */, ngDevMode && `keyframes() must be placed inside of a call to animate()`);\n}\nfunction invalidOffset() {\n return new ɵRuntimeError(3012 /* RuntimeErrorCode.INVALID_OFFSET */, ngDevMode && `Please ensure that all keyframe offsets are between 0 and 1`);\n}\nfunction keyframeOffsetsOutOfOrder() {\n return new ɵRuntimeError(3200 /* RuntimeErrorCode.KEYFRAME_OFFSETS_OUT_OF_ORDER */, ngDevMode && `Please ensure that all keyframe offsets are in order`);\n}\nfunction keyframesMissingOffsets() {\n return new ɵRuntimeError(3202 /* RuntimeErrorCode.KEYFRAMES_MISSING_OFFSETS */, ngDevMode && `Not all style() steps within the declared keyframes() contain offsets`);\n}\nfunction invalidStagger() {\n return new ɵRuntimeError(3013 /* RuntimeErrorCode.INVALID_STAGGER */, ngDevMode && `stagger() can only be used inside of query()`);\n}\nfunction invalidQuery(selector) {\n return new ɵRuntimeError(3014 /* RuntimeErrorCode.INVALID_QUERY */, ngDevMode && `\\`query(\"${selector}\")\\` returned zero elements. (Use \\`query(\"${selector}\", { optional: true })\\` if you wish to allow this.)`);\n}\nfunction invalidExpression(expr) {\n return new ɵRuntimeError(3015 /* RuntimeErrorCode.INVALID_EXPRESSION */, ngDevMode && `The provided transition expression \"${expr}\" is not supported`);\n}\nfunction invalidTransitionAlias(alias) {\n return new ɵRuntimeError(3016 /* RuntimeErrorCode.INVALID_TRANSITION_ALIAS */, ngDevMode && `The transition alias value \"${alias}\" is not supported`);\n}\nfunction validationFailed(errors) {\n return new ɵRuntimeError(3500 /* RuntimeErrorCode.VALIDATION_FAILED */, ngDevMode && `animation validation failed:\\n${errors.map(err => err.message).join('\\n')}`);\n}\nfunction buildingFailed(errors) {\n return new ɵRuntimeError(3501 /* RuntimeErrorCode.BUILDING_FAILED */, ngDevMode && `animation building failed:\\n${errors.map(err => err.message).join('\\n')}`);\n}\nfunction triggerBuildFailed(name, errors) {\n return new ɵRuntimeError(3404 /* RuntimeErrorCode.TRIGGER_BUILD_FAILED */, ngDevMode && `The animation trigger \"${name}\" has failed to build due to the following errors:\\n - ${errors.map(err => err.message).join('\\n - ')}`);\n}\nfunction animationFailed(errors) {\n return new ɵRuntimeError(3502 /* RuntimeErrorCode.ANIMATION_FAILED */, ngDevMode && `Unable to animate due to the following errors:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);\n}\nfunction registerFailed(errors) {\n return new ɵRuntimeError(3503 /* RuntimeErrorCode.REGISTRATION_FAILED */, ngDevMode && `Unable to build the animation due to the following errors: ${errors.map(err => err.message).join('\\n')}`);\n}\nfunction missingOrDestroyedAnimation() {\n return new ɵRuntimeError(3300 /* RuntimeErrorCode.MISSING_OR_DESTROYED_ANIMATION */, ngDevMode && \"The requested animation doesn't exist or has already been destroyed\");\n}\nfunction createAnimationFailed(errors) {\n return new ɵRuntimeError(3504 /* RuntimeErrorCode.CREATE_ANIMATION_FAILED */, ngDevMode && `Unable to create the animation due to the following errors:${errors.map(err => err.message).join('\\n')}`);\n}\nfunction missingPlayer(id) {\n return new ɵRuntimeError(3301 /* RuntimeErrorCode.MISSING_PLAYER */, ngDevMode && `Unable to find the timeline player referenced by ${id}`);\n}\nfunction missingTrigger(phase, name) {\n return new ɵRuntimeError(3302 /* RuntimeErrorCode.MISSING_TRIGGER */, ngDevMode && `Unable to listen on the animation trigger event \"${phase}\" because the animation trigger \"${name}\" doesn\\'t exist!`);\n}\nfunction missingEvent(name) {\n return new ɵRuntimeError(3303 /* RuntimeErrorCode.MISSING_EVENT */, ngDevMode && `Unable to listen on the animation trigger \"${name}\" because the provided event is undefined!`);\n}\nfunction unsupportedTriggerEvent(phase, name) {\n return new ɵRuntimeError(3400 /* RuntimeErrorCode.UNSUPPORTED_TRIGGER_EVENT */, ngDevMode && `The provided animation trigger event \"${phase}\" for the animation trigger \"${name}\" is not supported!`);\n}\nfunction unregisteredTrigger(name) {\n return new ɵRuntimeError(3401 /* RuntimeErrorCode.UNREGISTERED_TRIGGER */, ngDevMode && `The provided animation trigger \"${name}\" has not been registered!`);\n}\nfunction triggerTransitionsFailed(errors) {\n return new ɵRuntimeError(3402 /* RuntimeErrorCode.TRIGGER_TRANSITIONS_FAILED */, ngDevMode && `Unable to process animations due to the following failed trigger transitions\\n ${errors.map(err => err.message).join('\\n')}`);\n}\nfunction triggerParsingFailed(name, errors) {\n return new ɵRuntimeError(3403 /* RuntimeErrorCode.TRIGGER_PARSING_FAILED */, ngDevMode && `Animation parsing for the ${name} trigger have failed:${LINE_START}${errors.map(err => err.message).join(LINE_START)}`);\n}\nfunction transitionFailed(name, errors) {\n return new ɵRuntimeError(3505 /* RuntimeErrorCode.TRANSITION_FAILED */, ngDevMode && `@${name} has failed due to:\\n ${errors.map(err => err.message).join('\\n- ')}`);\n}\n\n/**\n * Set of all animatable CSS properties\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties\n */\nconst ANIMATABLE_PROP_SET = /*#__PURE__*/new Set(['-moz-outline-radius', '-moz-outline-radius-bottomleft', '-moz-outline-radius-bottomright', '-moz-outline-radius-topleft', '-moz-outline-radius-topright', '-ms-grid-columns', '-ms-grid-rows', '-webkit-line-clamp', '-webkit-text-fill-color', '-webkit-text-stroke', '-webkit-text-stroke-color', 'accent-color', 'all', 'backdrop-filter', 'background', 'background-color', 'background-position', 'background-size', 'block-size', 'border', 'border-block-end', 'border-block-end-color', 'border-block-end-width', 'border-block-start', 'border-block-start-color', 'border-block-start-width', 'border-bottom', 'border-bottom-color', 'border-bottom-left-radius', 'border-bottom-right-radius', 'border-bottom-width', 'border-color', 'border-end-end-radius', 'border-end-start-radius', 'border-image-outset', 'border-image-slice', 'border-image-width', 'border-inline-end', 'border-inline-end-color', 'border-inline-end-width', 'border-inline-start', 'border-inline-start-color', 'border-inline-start-width', 'border-left', 'border-left-color', 'border-left-width', 'border-radius', 'border-right', 'border-right-color', 'border-right-width', 'border-start-end-radius', 'border-start-start-radius', 'border-top', 'border-top-color', 'border-top-left-radius', 'border-top-right-radius', 'border-top-width', 'border-width', 'bottom', 'box-shadow', 'caret-color', 'clip', 'clip-path', 'color', 'column-count', 'column-gap', 'column-rule', 'column-rule-color', 'column-rule-width', 'column-width', 'columns', 'filter', 'flex', 'flex-basis', 'flex-grow', 'flex-shrink', 'font', 'font-size', 'font-size-adjust', 'font-stretch', 'font-variation-settings', 'font-weight', 'gap', 'grid-column-gap', 'grid-gap', 'grid-row-gap', 'grid-template-columns', 'grid-template-rows', 'height', 'inline-size', 'input-security', 'inset', 'inset-block', 'inset-block-end', 'inset-block-start', 'inset-inline', 'inset-inline-end', 'inset-inline-start', 'left', 'letter-spacing', 'line-clamp', 'line-height', 'margin', 'margin-block-end', 'margin-block-start', 'margin-bottom', 'margin-inline-end', 'margin-inline-start', 'margin-left', 'margin-right', 'margin-top', 'mask', 'mask-border', 'mask-position', 'mask-size', 'max-block-size', 'max-height', 'max-inline-size', 'max-lines', 'max-width', 'min-block-size', 'min-height', 'min-inline-size', 'min-width', 'object-position', 'offset', 'offset-anchor', 'offset-distance', 'offset-path', 'offset-position', 'offset-rotate', 'opacity', 'order', 'outline', 'outline-color', 'outline-offset', 'outline-width', 'padding', 'padding-block-end', 'padding-block-start', 'padding-bottom', 'padding-inline-end', 'padding-inline-start', 'padding-left', 'padding-right', 'padding-top', 'perspective', 'perspective-origin', 'right', 'rotate', 'row-gap', 'scale', 'scroll-margin', 'scroll-margin-block', 'scroll-margin-block-end', 'scroll-margin-block-start', 'scroll-margin-bottom', 'scroll-margin-inline', 'scroll-margin-inline-end', 'scroll-margin-inline-start', 'scroll-margin-left', 'scroll-margin-right', 'scroll-margin-top', 'scroll-padding', 'scroll-padding-block', 'scroll-padding-block-end', 'scroll-padding-block-start', 'scroll-padding-bottom', 'scroll-padding-inline', 'scroll-padding-inline-end', 'scroll-padding-inline-start', 'scroll-padding-left', 'scroll-padding-right', 'scroll-padding-top', 'scroll-snap-coordinate', 'scroll-snap-destination', 'scrollbar-color', 'shape-image-threshold', 'shape-margin', 'shape-outside', 'tab-size', 'text-decoration', 'text-decoration-color', 'text-decoration-thickness', 'text-emphasis', 'text-emphasis-color', 'text-indent', 'text-shadow', 'text-underline-offset', 'top', 'transform', 'transform-origin', 'translate', 'vertical-align', 'visibility', 'width', 'word-spacing', 'z-index', 'zoom']);\nfunction optimizeGroupPlayer(players) {\n switch (players.length) {\n case 0:\n return new NoopAnimationPlayer();\n case 1:\n return players[0];\n default:\n return new ɵAnimationGroupPlayer(players);\n }\n}\nfunction normalizeKeyframes$1(normalizer, keyframes, preStyles = new Map(), postStyles = new Map()) {\n const errors = [];\n const normalizedKeyframes = [];\n let previousOffset = -1;\n let previousKeyframe = null;\n keyframes.forEach(kf => {\n const offset = kf.get('offset');\n const isSameOffset = offset == previousOffset;\n const normalizedKeyframe = isSameOffset && previousKeyframe || new Map();\n kf.forEach((val, prop) => {\n let normalizedProp = prop;\n let normalizedValue = val;\n if (prop !== 'offset') {\n normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors);\n switch (normalizedValue) {\n case ɵPRE_STYLE:\n normalizedValue = preStyles.get(prop);\n break;\n case AUTO_STYLE:\n normalizedValue = postStyles.get(prop);\n break;\n default:\n normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors);\n break;\n }\n }\n normalizedKeyframe.set(normalizedProp, normalizedValue);\n });\n if (!isSameOffset) {\n normalizedKeyframes.push(normalizedKeyframe);\n }\n previousKeyframe = normalizedKeyframe;\n previousOffset = offset;\n });\n if (errors.length) {\n throw animationFailed(errors);\n }\n return normalizedKeyframes;\n}\nfunction listenOnPlayer(player, eventName, event, callback) {\n switch (eventName) {\n case 'start':\n player.onStart(() => callback(event && copyAnimationEvent(event, 'start', player)));\n break;\n case 'done':\n player.onDone(() => callback(event && copyAnimationEvent(event, 'done', player)));\n break;\n case 'destroy':\n player.onDestroy(() => callback(event && copyAnimationEvent(event, 'destroy', player)));\n break;\n }\n}\nfunction copyAnimationEvent(e, phaseName, player) {\n const totalTime = player.totalTime;\n const disabled = player.disabled ? true : false;\n const event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled);\n const data = e['_data'];\n if (data != null) {\n event['_data'] = data;\n }\n return event;\n}\nfunction makeAnimationEvent(element, triggerName, fromState, toState, phaseName = '', totalTime = 0, disabled) {\n return {\n element,\n triggerName,\n fromState,\n toState,\n phaseName,\n totalTime,\n disabled: !!disabled\n };\n}\nfunction getOrSetDefaultValue(map, key, defaultValue) {\n let value = map.get(key);\n if (!value) {\n map.set(key, value = defaultValue);\n }\n return value;\n}\nfunction parseTimelineCommand(command) {\n const separatorPos = command.indexOf(':');\n const id = command.substring(1, separatorPos);\n const action = command.slice(separatorPos + 1);\n return [id, action];\n}\nconst documentElement = /* @__PURE__ */(() => typeof document === 'undefined' ? null : document.documentElement)();\nfunction getParentElement(element) {\n const parent = element.parentNode || element.host || null; // consider host to support shadow DOM\n if (parent === documentElement) {\n return null;\n }\n return parent;\n}\nfunction containsVendorPrefix(prop) {\n // Webkit is the only real popular vendor prefix nowadays\n // cc: http://shouldiprefix.com/\n return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit\n}\nlet _CACHED_BODY = null;\nlet _IS_WEBKIT = false;\nfunction validateStyleProperty(prop) {\n if (!_CACHED_BODY) {\n _CACHED_BODY = getBodyNode() || {};\n _IS_WEBKIT = _CACHED_BODY.style ? 'WebkitAppearance' in _CACHED_BODY.style : false;\n }\n let result = true;\n if (_CACHED_BODY.style && !containsVendorPrefix(prop)) {\n result = prop in _CACHED_BODY.style;\n if (!result && _IS_WEBKIT) {\n const camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.slice(1);\n result = camelProp in _CACHED_BODY.style;\n }\n }\n return result;\n}\nfunction validateWebAnimatableStyleProperty(prop) {\n return ANIMATABLE_PROP_SET.has(prop);\n}\nfunction getBodyNode() {\n if (typeof document != 'undefined') {\n return document.body;\n }\n return null;\n}\nfunction containsElement(elm1, elm2) {\n while (elm2) {\n if (elm2 === elm1) {\n return true;\n }\n elm2 = getParentElement(elm2);\n }\n return false;\n}\nfunction invokeQuery(element, selector, multi) {\n if (multi) {\n return Array.from(element.querySelectorAll(selector));\n }\n const elem = element.querySelector(selector);\n return elem ? [elem] : [];\n}\nfunction hypenatePropsKeys(original) {\n const newMap = new Map();\n original.forEach((val, prop) => {\n const newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2');\n newMap.set(newProp, val);\n });\n return newMap;\n}\n\n/**\n * @publicApi\n *\n * `AnimationDriver` implentation for Noop animations\n */\nlet NoopAnimationDriver = /*#__PURE__*/(() => {\n class NoopAnimationDriver {\n /**\n * @returns Whether `prop` is a valid CSS property\n */\n validateStyleProperty(prop) {\n return validateStyleProperty(prop);\n }\n /**\n *\n * @returns Whether elm1 contains elm2.\n */\n containsElement(elm1, elm2) {\n return containsElement(elm1, elm2);\n }\n /**\n * @returns Rhe parent of the given element or `null` if the element is the `document`\n */\n getParentElement(element) {\n return getParentElement(element);\n }\n /**\n * @returns The result of the query selector on the element. The array will contain up to 1 item\n * if `multi` is `false`.\n */\n query(element, selector, multi) {\n return invokeQuery(element, selector, multi);\n }\n /**\n * @returns The `defaultValue` or empty string\n */\n computeStyle(element, prop, defaultValue) {\n return defaultValue || '';\n }\n /**\n * @returns An `NoopAnimationPlayer`\n */\n animate(element, keyframes, duration, delay, easing, previousPlayers = [], scrubberAccessRequested) {\n return new NoopAnimationPlayer(duration, delay);\n }\n static {\n this.ɵfac = function NoopAnimationDriver_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NoopAnimationDriver)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NoopAnimationDriver,\n factory: NoopAnimationDriver.ɵfac\n });\n }\n }\n return NoopAnimationDriver;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @publicApi\n */\nclass AnimationDriver {\n /**\n * @deprecated Use the NoopAnimationDriver class.\n */\n static {\n this.NOOP = /*#__PURE__*/new NoopAnimationDriver();\n }\n}\nclass AnimationStyleNormalizer {}\nclass NoopAnimationStyleNormalizer {\n normalizePropertyName(propertyName, errors) {\n return propertyName;\n }\n normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {\n return value;\n }\n}\nconst ONE_SECOND = 1000;\nconst SUBSTITUTION_EXPR_START = '{{';\nconst SUBSTITUTION_EXPR_END = '}}';\nconst ENTER_CLASSNAME = 'ng-enter';\nconst LEAVE_CLASSNAME = 'ng-leave';\nconst NG_TRIGGER_CLASSNAME = 'ng-trigger';\nconst NG_TRIGGER_SELECTOR = '.ng-trigger';\nconst NG_ANIMATING_CLASSNAME = 'ng-animating';\nconst NG_ANIMATING_SELECTOR = '.ng-animating';\nfunction resolveTimingValue(value) {\n if (typeof value == 'number') return value;\n const matches = value.match(/^(-?[\\.\\d]+)(m?s)/);\n if (!matches || matches.length < 2) return 0;\n return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);\n}\nfunction _convertTimeValueToMS(value, unit) {\n switch (unit) {\n case 's':\n return value * ONE_SECOND;\n default:\n // ms or something else\n return value;\n }\n}\nfunction resolveTiming(timings, errors, allowNegativeValues) {\n return timings.hasOwnProperty('duration') ? timings : parseTimeExpression(timings, errors, allowNegativeValues);\n}\nfunction parseTimeExpression(exp, errors, allowNegativeValues) {\n const regex = /^(-?[\\.\\d]+)(m?s)(?:\\s+(-?[\\.\\d]+)(m?s))?(?:\\s+([-a-z]+(?:\\(.+?\\))?))?$/i;\n let duration;\n let delay = 0;\n let easing = '';\n if (typeof exp === 'string') {\n const matches = exp.match(regex);\n if (matches === null) {\n errors.push(invalidTimingValue(exp));\n return {\n duration: 0,\n delay: 0,\n easing: ''\n };\n }\n duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);\n const delayMatch = matches[3];\n if (delayMatch != null) {\n delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]);\n }\n const easingVal = matches[5];\n if (easingVal) {\n easing = easingVal;\n }\n } else {\n duration = exp;\n }\n if (!allowNegativeValues) {\n let containsErrors = false;\n let startIndex = errors.length;\n if (duration < 0) {\n errors.push(negativeStepValue());\n containsErrors = true;\n }\n if (delay < 0) {\n errors.push(negativeDelayValue());\n containsErrors = true;\n }\n if (containsErrors) {\n errors.splice(startIndex, 0, invalidTimingValue(exp));\n }\n }\n return {\n duration,\n delay,\n easing\n };\n}\nfunction normalizeKeyframes(keyframes) {\n if (!keyframes.length) {\n return [];\n }\n if (keyframes[0] instanceof Map) {\n return keyframes;\n }\n return keyframes.map(kf => new Map(Object.entries(kf)));\n}\nfunction normalizeStyles(styles) {\n return Array.isArray(styles) ? new Map(...styles) : new Map(styles);\n}\nfunction setStyles(element, styles, formerStyles) {\n styles.forEach((val, prop) => {\n const camelProp = dashCaseToCamelCase(prop);\n if (formerStyles && !formerStyles.has(prop)) {\n formerStyles.set(prop, element.style[camelProp]);\n }\n element.style[camelProp] = val;\n });\n}\nfunction eraseStyles(element, styles) {\n styles.forEach((_, prop) => {\n const camelProp = dashCaseToCamelCase(prop);\n element.style[camelProp] = '';\n });\n}\nfunction normalizeAnimationEntry(steps) {\n if (Array.isArray(steps)) {\n if (steps.length == 1) return steps[0];\n return sequence(steps);\n }\n return steps;\n}\nfunction validateStyleParams(value, options, errors) {\n const params = options.params || {};\n const matches = extractStyleParams(value);\n if (matches.length) {\n matches.forEach(varName => {\n if (!params.hasOwnProperty(varName)) {\n errors.push(invalidStyleParams(varName));\n }\n });\n }\n}\nconst PARAM_REGEX = /*#__PURE__*/new RegExp(`${SUBSTITUTION_EXPR_START}\\\\s*(.+?)\\\\s*${SUBSTITUTION_EXPR_END}`, 'g');\nfunction extractStyleParams(value) {\n let params = [];\n if (typeof value === 'string') {\n let match;\n while (match = PARAM_REGEX.exec(value)) {\n params.push(match[1]);\n }\n PARAM_REGEX.lastIndex = 0;\n }\n return params;\n}\nfunction interpolateParams(value, params, errors) {\n const original = `${value}`;\n const str = original.replace(PARAM_REGEX, (_, varName) => {\n let localVal = params[varName];\n // this means that the value was never overridden by the data passed in by the user\n if (localVal == null) {\n errors.push(invalidParamValue(varName));\n localVal = '';\n }\n return localVal.toString();\n });\n // we do this to assert that numeric values stay as they are\n return str == original ? value : str;\n}\nconst DASH_CASE_REGEXP = /-+([a-z0-9])/g;\nfunction dashCaseToCamelCase(input) {\n return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());\n}\nfunction camelCaseToDashCase(input) {\n return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n}\nfunction allowPreviousPlayerStylesMerge(duration, delay) {\n return duration === 0 || delay === 0;\n}\nfunction balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) {\n if (previousStyles.size && keyframes.length) {\n let startingKeyframe = keyframes[0];\n let missingStyleProps = [];\n previousStyles.forEach((val, prop) => {\n if (!startingKeyframe.has(prop)) {\n missingStyleProps.push(prop);\n }\n startingKeyframe.set(prop, val);\n });\n if (missingStyleProps.length) {\n for (let i = 1; i < keyframes.length; i++) {\n let kf = keyframes[i];\n missingStyleProps.forEach(prop => kf.set(prop, computeStyle(element, prop)));\n }\n }\n }\n return keyframes;\n}\nfunction visitDslNode(visitor, node, context) {\n switch (node.type) {\n case AnimationMetadataType.Trigger:\n return visitor.visitTrigger(node, context);\n case AnimationMetadataType.State:\n return visitor.visitState(node, context);\n case AnimationMetadataType.Transition:\n return visitor.visitTransition(node, context);\n case AnimationMetadataType.Sequence:\n return visitor.visitSequence(node, context);\n case AnimationMetadataType.Group:\n return visitor.visitGroup(node, context);\n case AnimationMetadataType.Animate:\n return visitor.visitAnimate(node, context);\n case AnimationMetadataType.Keyframes:\n return visitor.visitKeyframes(node, context);\n case AnimationMetadataType.Style:\n return visitor.visitStyle(node, context);\n case AnimationMetadataType.Reference:\n return visitor.visitReference(node, context);\n case AnimationMetadataType.AnimateChild:\n return visitor.visitAnimateChild(node, context);\n case AnimationMetadataType.AnimateRef:\n return visitor.visitAnimateRef(node, context);\n case AnimationMetadataType.Query:\n return visitor.visitQuery(node, context);\n case AnimationMetadataType.Stagger:\n return visitor.visitStagger(node, context);\n default:\n throw invalidNodeType(node.type);\n }\n}\nfunction computeStyle(element, prop) {\n return window.getComputedStyle(element)[prop];\n}\nconst DIMENSIONAL_PROP_SET = /*#__PURE__*/new Set(['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight', 'left', 'top', 'bottom', 'right', 'fontSize', 'outlineWidth', 'outlineOffset', 'paddingTop', 'paddingLeft', 'paddingBottom', 'paddingRight', 'marginTop', 'marginLeft', 'marginBottom', 'marginRight', 'borderRadius', 'borderWidth', 'borderTopWidth', 'borderLeftWidth', 'borderRightWidth', 'borderBottomWidth', 'textIndent', 'perspective']);\nclass WebAnimationsStyleNormalizer extends AnimationStyleNormalizer {\n normalizePropertyName(propertyName, errors) {\n return dashCaseToCamelCase(propertyName);\n }\n normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {\n let unit = '';\n const strVal = value.toString().trim();\n if (DIMENSIONAL_PROP_SET.has(normalizedProperty) && value !== 0 && value !== '0') {\n if (typeof value === 'number') {\n unit = 'px';\n } else {\n const valAndSuffixMatch = value.match(/^[+-]?[\\d\\.]+([a-z]*)$/);\n if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {\n errors.push(invalidCssUnitValue(userProvidedProperty, value));\n }\n }\n }\n return strVal + unit;\n }\n}\nfunction createListOfWarnings(warnings) {\n const LINE_START = '\\n - ';\n return `${LINE_START}${warnings.filter(Boolean).map(warning => warning).join(LINE_START)}`;\n}\nfunction warnValidation(warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`animation validation warnings:${createListOfWarnings(warnings)}`);\n}\nfunction warnTriggerBuild(name, warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`The animation trigger \"${name}\" has built with the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction warnRegister(warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`Animation built with the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction triggerParsingWarnings(name, warnings) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && console.warn(`Animation parsing for the ${name} trigger presents the following warnings:${createListOfWarnings(warnings)}`);\n}\nfunction pushUnrecognizedPropertiesWarning(warnings, props) {\n if (props.length) {\n warnings.push(`The following provided properties are not recognized: ${props.join(', ')}`);\n }\n}\nconst ANY_STATE = '*';\nfunction parseTransitionExpr(transitionValue, errors) {\n const expressions = [];\n if (typeof transitionValue == 'string') {\n transitionValue.split(/\\s*,\\s*/).forEach(str => parseInnerTransitionStr(str, expressions, errors));\n } else {\n expressions.push(transitionValue);\n }\n return expressions;\n}\nfunction parseInnerTransitionStr(eventStr, expressions, errors) {\n if (eventStr[0] == ':') {\n const result = parseAnimationAlias(eventStr, errors);\n if (typeof result == 'function') {\n expressions.push(result);\n return;\n }\n eventStr = result;\n }\n const match = eventStr.match(/^(\\*|[-\\w]+)\\s*()\\s*(\\*|[-\\w]+)$/);\n if (match == null || match.length < 4) {\n errors.push(invalidExpression(eventStr));\n return expressions;\n }\n const fromState = match[1];\n const separator = match[2];\n const toState = match[3];\n expressions.push(makeLambdaFromStates(fromState, toState));\n const isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE;\n if (separator[0] == '<' && !isFullAnyStateExpr) {\n expressions.push(makeLambdaFromStates(toState, fromState));\n }\n return;\n}\nfunction parseAnimationAlias(alias, errors) {\n switch (alias) {\n case ':enter':\n return 'void => *';\n case ':leave':\n return '* => void';\n case ':increment':\n return (fromState, toState) => parseFloat(toState) > parseFloat(fromState);\n case ':decrement':\n return (fromState, toState) => parseFloat(toState) < parseFloat(fromState);\n default:\n errors.push(invalidTransitionAlias(alias));\n return '* => *';\n }\n}\n// DO NOT REFACTOR ... keep the follow set instantiations\n// with the values intact (closure compiler for some reason\n// removes follow-up lines that add the values outside of\n// the constructor...\nconst TRUE_BOOLEAN_VALUES = /*#__PURE__*/new Set(['true', '1']);\nconst FALSE_BOOLEAN_VALUES = /*#__PURE__*/new Set(['false', '0']);\nfunction makeLambdaFromStates(lhs, rhs) {\n const LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs);\n const RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs);\n return (fromState, toState) => {\n let lhsMatch = lhs == ANY_STATE || lhs == fromState;\n let rhsMatch = rhs == ANY_STATE || rhs == toState;\n if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') {\n lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs);\n }\n if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') {\n rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs);\n }\n return lhsMatch && rhsMatch;\n };\n}\nconst SELF_TOKEN = ':self';\nconst SELF_TOKEN_REGEX = /*#__PURE__*/new RegExp(`s*${SELF_TOKEN}s*,?`, 'g');\n/*\n * [Validation]\n * The visitor code below will traverse the animation AST generated by the animation verb functions\n * (the output is a tree of objects) and attempt to perform a series of validations on the data. The\n * following corner-cases will be validated:\n *\n * 1. Overlap of animations\n * Given that a CSS property cannot be animated in more than one place at the same time, it's\n * important that this behavior is detected and validated. The way in which this occurs is that\n * each time a style property is examined, a string-map containing the property will be updated with\n * the start and end times for when the property is used within an animation step.\n *\n * If there are two or more parallel animations that are currently running (these are invoked by the\n * group()) on the same element then the validator will throw an error. Since the start/end timing\n * values are collected for each property then if the current animation step is animating the same\n * property and its timing values fall anywhere into the window of time that the property is\n * currently being animated within then this is what causes an error.\n *\n * 2. Timing values\n * The validator will validate to see if a timing value of `duration delay easing` or\n * `durationNumber` is valid or not.\n *\n * (note that upon validation the code below will replace the timing data with an object containing\n * {duration,delay,easing}.\n *\n * 3. Offset Validation\n * Each of the style() calls are allowed to have an offset value when placed inside of keyframes().\n * Offsets within keyframes() are considered valid when:\n *\n * - No offsets are used at all\n * - Each style() entry contains an offset value\n * - Each offset is between 0 and 1\n * - Each offset is greater to or equal than the previous one\n *\n * Otherwise an error will be thrown.\n */\nfunction buildAnimationAst(driver, metadata, errors, warnings) {\n return new AnimationAstBuilderVisitor(driver).build(metadata, errors, warnings);\n}\nconst ROOT_SELECTOR = '';\nclass AnimationAstBuilderVisitor {\n constructor(_driver) {\n this._driver = _driver;\n }\n build(metadata, errors, warnings) {\n const context = new AnimationAstBuilderContext(errors);\n this._resetContextStyleTimingState(context);\n const ast = visitDslNode(this, normalizeAnimationEntry(metadata), context);\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (context.unsupportedCSSPropertiesFound.size) {\n pushUnrecognizedPropertiesWarning(warnings, [...context.unsupportedCSSPropertiesFound.keys()]);\n }\n }\n return ast;\n }\n _resetContextStyleTimingState(context) {\n context.currentQuerySelector = ROOT_SELECTOR;\n context.collectedStyles = new Map();\n context.collectedStyles.set(ROOT_SELECTOR, new Map());\n context.currentTime = 0;\n }\n visitTrigger(metadata, context) {\n let queryCount = context.queryCount = 0;\n let depCount = context.depCount = 0;\n const states = [];\n const transitions = [];\n if (metadata.name.charAt(0) == '@') {\n context.errors.push(invalidTrigger());\n }\n metadata.definitions.forEach(def => {\n this._resetContextStyleTimingState(context);\n if (def.type == AnimationMetadataType.State) {\n const stateDef = def;\n const name = stateDef.name;\n name.toString().split(/\\s*,\\s*/).forEach(n => {\n stateDef.name = n;\n states.push(this.visitState(stateDef, context));\n });\n stateDef.name = name;\n } else if (def.type == AnimationMetadataType.Transition) {\n const transition = this.visitTransition(def, context);\n queryCount += transition.queryCount;\n depCount += transition.depCount;\n transitions.push(transition);\n } else {\n context.errors.push(invalidDefinition());\n }\n });\n return {\n type: AnimationMetadataType.Trigger,\n name: metadata.name,\n states,\n transitions,\n queryCount,\n depCount,\n options: null\n };\n }\n visitState(metadata, context) {\n const styleAst = this.visitStyle(metadata.styles, context);\n const astParams = metadata.options && metadata.options.params || null;\n if (styleAst.containsDynamicStyles) {\n const missingSubs = new Set();\n const params = astParams || {};\n styleAst.styles.forEach(style => {\n if (style instanceof Map) {\n style.forEach(value => {\n extractStyleParams(value).forEach(sub => {\n if (!params.hasOwnProperty(sub)) {\n missingSubs.add(sub);\n }\n });\n });\n }\n });\n if (missingSubs.size) {\n context.errors.push(invalidState(metadata.name, [...missingSubs.values()]));\n }\n }\n return {\n type: AnimationMetadataType.State,\n name: metadata.name,\n style: styleAst,\n options: astParams ? {\n params: astParams\n } : null\n };\n }\n visitTransition(metadata, context) {\n context.queryCount = 0;\n context.depCount = 0;\n const animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);\n const matchers = parseTransitionExpr(metadata.expr, context.errors);\n return {\n type: AnimationMetadataType.Transition,\n matchers,\n animation,\n queryCount: context.queryCount,\n depCount: context.depCount,\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitSequence(metadata, context) {\n return {\n type: AnimationMetadataType.Sequence,\n steps: metadata.steps.map(s => visitDslNode(this, s, context)),\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitGroup(metadata, context) {\n const currentTime = context.currentTime;\n let furthestTime = 0;\n const steps = metadata.steps.map(step => {\n context.currentTime = currentTime;\n const innerAst = visitDslNode(this, step, context);\n furthestTime = Math.max(furthestTime, context.currentTime);\n return innerAst;\n });\n context.currentTime = furthestTime;\n return {\n type: AnimationMetadataType.Group,\n steps,\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitAnimate(metadata, context) {\n const timingAst = constructTimingAst(metadata.timings, context.errors);\n context.currentAnimateTimings = timingAst;\n let styleAst;\n let styleMetadata = metadata.styles ? metadata.styles : style({});\n if (styleMetadata.type == AnimationMetadataType.Keyframes) {\n styleAst = this.visitKeyframes(styleMetadata, context);\n } else {\n let styleMetadata = metadata.styles;\n let isEmpty = false;\n if (!styleMetadata) {\n isEmpty = true;\n const newStyleData = {};\n if (timingAst.easing) {\n newStyleData['easing'] = timingAst.easing;\n }\n styleMetadata = style(newStyleData);\n }\n context.currentTime += timingAst.duration + timingAst.delay;\n const _styleAst = this.visitStyle(styleMetadata, context);\n _styleAst.isEmptyStep = isEmpty;\n styleAst = _styleAst;\n }\n context.currentAnimateTimings = null;\n return {\n type: AnimationMetadataType.Animate,\n timings: timingAst,\n style: styleAst,\n options: null\n };\n }\n visitStyle(metadata, context) {\n const ast = this._makeStyleAst(metadata, context);\n this._validateStyleAst(ast, context);\n return ast;\n }\n _makeStyleAst(metadata, context) {\n const styles = [];\n const metadataStyles = Array.isArray(metadata.styles) ? metadata.styles : [metadata.styles];\n for (let styleTuple of metadataStyles) {\n if (typeof styleTuple === 'string') {\n if (styleTuple === AUTO_STYLE) {\n styles.push(styleTuple);\n } else {\n context.errors.push(invalidStyleValue(styleTuple));\n }\n } else {\n styles.push(new Map(Object.entries(styleTuple)));\n }\n }\n let containsDynamicStyles = false;\n let collectedEasing = null;\n styles.forEach(styleData => {\n if (styleData instanceof Map) {\n if (styleData.has('easing')) {\n collectedEasing = styleData.get('easing');\n styleData.delete('easing');\n }\n if (!containsDynamicStyles) {\n for (let value of styleData.values()) {\n if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) {\n containsDynamicStyles = true;\n break;\n }\n }\n }\n }\n });\n return {\n type: AnimationMetadataType.Style,\n styles,\n easing: collectedEasing,\n offset: metadata.offset,\n containsDynamicStyles,\n options: null\n };\n }\n _validateStyleAst(ast, context) {\n const timings = context.currentAnimateTimings;\n let endTime = context.currentTime;\n let startTime = context.currentTime;\n if (timings && startTime > 0) {\n startTime -= timings.duration + timings.delay;\n }\n ast.styles.forEach(tuple => {\n if (typeof tuple === 'string') return;\n tuple.forEach((value, prop) => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!this._driver.validateStyleProperty(prop)) {\n tuple.delete(prop);\n context.unsupportedCSSPropertiesFound.add(prop);\n return;\n }\n }\n // This is guaranteed to have a defined Map at this querySelector location making it\n // safe to add the assertion here. It is set as a default empty map in prior methods.\n const collectedStyles = context.collectedStyles.get(context.currentQuerySelector);\n const collectedEntry = collectedStyles.get(prop);\n let updateCollectedStyle = true;\n if (collectedEntry) {\n if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) {\n context.errors.push(invalidParallelAnimation(prop, collectedEntry.startTime, collectedEntry.endTime, startTime, endTime));\n updateCollectedStyle = false;\n }\n // we always choose the smaller start time value since we\n // want to have a record of the entire animation window where\n // the style property is being animated in between\n startTime = collectedEntry.startTime;\n }\n if (updateCollectedStyle) {\n collectedStyles.set(prop, {\n startTime,\n endTime\n });\n }\n if (context.options) {\n validateStyleParams(value, context.options, context.errors);\n }\n });\n });\n }\n visitKeyframes(metadata, context) {\n const ast = {\n type: AnimationMetadataType.Keyframes,\n styles: [],\n options: null\n };\n if (!context.currentAnimateTimings) {\n context.errors.push(invalidKeyframes());\n return ast;\n }\n const MAX_KEYFRAME_OFFSET = 1;\n let totalKeyframesWithOffsets = 0;\n const offsets = [];\n let offsetsOutOfOrder = false;\n let keyframesOutOfRange = false;\n let previousOffset = 0;\n const keyframes = metadata.steps.map(styles => {\n const style = this._makeStyleAst(styles, context);\n let offsetVal = style.offset != null ? style.offset : consumeOffset(style.styles);\n let offset = 0;\n if (offsetVal != null) {\n totalKeyframesWithOffsets++;\n offset = style.offset = offsetVal;\n }\n keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1;\n offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset;\n previousOffset = offset;\n offsets.push(offset);\n return style;\n });\n if (keyframesOutOfRange) {\n context.errors.push(invalidOffset());\n }\n if (offsetsOutOfOrder) {\n context.errors.push(keyframeOffsetsOutOfOrder());\n }\n const length = metadata.steps.length;\n let generatedOffset = 0;\n if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) {\n context.errors.push(keyframesMissingOffsets());\n } else if (totalKeyframesWithOffsets == 0) {\n generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1);\n }\n const limit = length - 1;\n const currentTime = context.currentTime;\n const currentAnimateTimings = context.currentAnimateTimings;\n const animateDuration = currentAnimateTimings.duration;\n keyframes.forEach((kf, i) => {\n const offset = generatedOffset > 0 ? i == limit ? 1 : generatedOffset * i : offsets[i];\n const durationUpToThisFrame = offset * animateDuration;\n context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame;\n currentAnimateTimings.duration = durationUpToThisFrame;\n this._validateStyleAst(kf, context);\n kf.offset = offset;\n ast.styles.push(kf);\n });\n return ast;\n }\n visitReference(metadata, context) {\n return {\n type: AnimationMetadataType.Reference,\n animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context),\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitAnimateChild(metadata, context) {\n context.depCount++;\n return {\n type: AnimationMetadataType.AnimateChild,\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitAnimateRef(metadata, context) {\n return {\n type: AnimationMetadataType.AnimateRef,\n animation: this.visitReference(metadata.animation, context),\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitQuery(metadata, context) {\n const parentSelector = context.currentQuerySelector;\n const options = metadata.options || {};\n context.queryCount++;\n context.currentQuery = metadata;\n const [selector, includeSelf] = normalizeSelector(metadata.selector);\n context.currentQuerySelector = parentSelector.length ? parentSelector + ' ' + selector : selector;\n getOrSetDefaultValue(context.collectedStyles, context.currentQuerySelector, new Map());\n const animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);\n context.currentQuery = null;\n context.currentQuerySelector = parentSelector;\n return {\n type: AnimationMetadataType.Query,\n selector,\n limit: options.limit || 0,\n optional: !!options.optional,\n includeSelf,\n animation,\n originalSelector: metadata.selector,\n options: normalizeAnimationOptions(metadata.options)\n };\n }\n visitStagger(metadata, context) {\n if (!context.currentQuery) {\n context.errors.push(invalidStagger());\n }\n const timings = metadata.timings === 'full' ? {\n duration: 0,\n delay: 0,\n easing: 'full'\n } : resolveTiming(metadata.timings, context.errors, true);\n return {\n type: AnimationMetadataType.Stagger,\n animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context),\n timings,\n options: null\n };\n }\n}\nfunction normalizeSelector(selector) {\n const hasAmpersand = selector.split(/\\s*,\\s*/).find(token => token == SELF_TOKEN) ? true : false;\n if (hasAmpersand) {\n selector = selector.replace(SELF_TOKEN_REGEX, '');\n }\n // Note: the :enter and :leave aren't normalized here since those\n // selectors are filled in at runtime during timeline building\n selector = selector.replace(/@\\*/g, NG_TRIGGER_SELECTOR).replace(/@\\w+/g, match => NG_TRIGGER_SELECTOR + '-' + match.slice(1)).replace(/:animating/g, NG_ANIMATING_SELECTOR);\n return [selector, hasAmpersand];\n}\nfunction normalizeParams(obj) {\n return obj ? {\n ...obj\n } : null;\n}\nclass AnimationAstBuilderContext {\n constructor(errors) {\n this.errors = errors;\n this.queryCount = 0;\n this.depCount = 0;\n this.currentTransition = null;\n this.currentQuery = null;\n this.currentQuerySelector = null;\n this.currentAnimateTimings = null;\n this.currentTime = 0;\n this.collectedStyles = new Map();\n this.options = null;\n this.unsupportedCSSPropertiesFound = new Set();\n }\n}\nfunction consumeOffset(styles) {\n if (typeof styles == 'string') return null;\n let offset = null;\n if (Array.isArray(styles)) {\n styles.forEach(styleTuple => {\n if (styleTuple instanceof Map && styleTuple.has('offset')) {\n const obj = styleTuple;\n offset = parseFloat(obj.get('offset'));\n obj.delete('offset');\n }\n });\n } else if (styles instanceof Map && styles.has('offset')) {\n const obj = styles;\n offset = parseFloat(obj.get('offset'));\n obj.delete('offset');\n }\n return offset;\n}\nfunction constructTimingAst(value, errors) {\n if (value.hasOwnProperty('duration')) {\n return value;\n }\n if (typeof value == 'number') {\n const duration = resolveTiming(value, errors).duration;\n return makeTimingAst(duration, 0, '');\n }\n const strValue = value;\n const isDynamic = strValue.split(/\\s+/).some(v => v.charAt(0) == '{' && v.charAt(1) == '{');\n if (isDynamic) {\n const ast = makeTimingAst(0, 0, '');\n ast.dynamic = true;\n ast.strValue = strValue;\n return ast;\n }\n const timings = resolveTiming(strValue, errors);\n return makeTimingAst(timings.duration, timings.delay, timings.easing);\n}\nfunction normalizeAnimationOptions(options) {\n if (options) {\n options = {\n ...options\n };\n if (options['params']) {\n options['params'] = normalizeParams(options['params']);\n }\n } else {\n options = {};\n }\n return options;\n}\nfunction makeTimingAst(duration, delay, easing) {\n return {\n duration,\n delay,\n easing\n };\n}\nfunction createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing = null, subTimeline = false) {\n return {\n type: 1 /* AnimationTransitionInstructionType.TimelineAnimation */,\n element,\n keyframes,\n preStyleProps,\n postStyleProps,\n duration,\n delay,\n totalTime: duration + delay,\n easing,\n subTimeline\n };\n}\nclass ElementInstructionMap {\n constructor() {\n this._map = new Map();\n }\n get(element) {\n return this._map.get(element) || [];\n }\n append(element, instructions) {\n let existingInstructions = this._map.get(element);\n if (!existingInstructions) {\n this._map.set(element, existingInstructions = []);\n }\n existingInstructions.push(...instructions);\n }\n has(element) {\n return this._map.has(element);\n }\n clear() {\n this._map.clear();\n }\n}\nconst ONE_FRAME_IN_MILLISECONDS = 1;\nconst ENTER_TOKEN = ':enter';\nconst ENTER_TOKEN_REGEX = /*#__PURE__*/new RegExp(ENTER_TOKEN, 'g');\nconst LEAVE_TOKEN = ':leave';\nconst LEAVE_TOKEN_REGEX = /*#__PURE__*/new RegExp(LEAVE_TOKEN, 'g');\n/*\n * The code within this file aims to generate web-animations-compatible keyframes from Angular's\n * animation DSL code.\n *\n * The code below will be converted from:\n *\n * ```\n * sequence([\n * style({ opacity: 0 }),\n * animate(1000, style({ opacity: 0 }))\n * ])\n * ```\n *\n * To:\n * ```\n * keyframes = [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }]\n * duration = 1000\n * delay = 0\n * easing = ''\n * ```\n *\n * For this operation to cover the combination of animation verbs (style, animate, group, etc...) a\n * combination of AST traversal and merge-sort-like algorithms are used.\n *\n * [AST Traversal]\n * Each of the animation verbs, when executed, will return an string-map object representing what\n * type of action it is (style, animate, group, etc...) and the data associated with it. This means\n * that when functional composition mix of these functions is evaluated (like in the example above)\n * then it will end up producing a tree of objects representing the animation itself.\n *\n * When this animation object tree is processed by the visitor code below it will visit each of the\n * verb statements within the visitor. And during each visit it will build the context of the\n * animation keyframes by interacting with the `TimelineBuilder`.\n *\n * [TimelineBuilder]\n * This class is responsible for tracking the styles and building a series of keyframe objects for a\n * timeline between a start and end time. The builder starts off with an initial timeline and each\n * time the AST comes across a `group()`, `keyframes()` or a combination of the two within a\n * `sequence()` then it will generate a sub timeline for each step as well as a new one after\n * they are complete.\n *\n * As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub\n * timeline was created (based on one of the cases above) then the parent timeline will attempt to\n * merge the styles used within the sub timelines into itself (only with group() this will happen).\n * This happens with a merge operation (much like how the merge works in mergeSort) and it will only\n * copy the most recently used styles from the sub timelines into the parent timeline. This ensures\n * that if the styles are used later on in another phase of the animation then they will be the most\n * up-to-date values.\n *\n * [How Missing Styles Are Updated]\n * Each timeline has a `backFill` property which is responsible for filling in new styles into\n * already processed keyframes if a new style shows up later within the animation sequence.\n *\n * ```\n * sequence([\n * style({ width: 0 }),\n * animate(1000, style({ width: 100 })),\n * animate(1000, style({ width: 200 })),\n * animate(1000, style({ width: 300 }))\n * animate(1000, style({ width: 400, height: 400 })) // notice how `height` doesn't exist anywhere\n * else\n * ])\n * ```\n *\n * What is happening here is that the `height` value is added later in the sequence, but is missing\n * from all previous animation steps. Therefore when a keyframe is created it would also be missing\n * from all previous keyframes up until where it is first used. For the timeline keyframe generation\n * to properly fill in the style it will place the previous value (the value from the parent\n * timeline) or a default value of `*` into the backFill map.\n *\n * When a sub-timeline is created it will have its own backFill property. This is done so that\n * styles present within the sub-timeline do not accidentally seep into the previous/future timeline\n * keyframes\n *\n * [Validation]\n * The code in this file is not responsible for validation. That functionality happens with within\n * the `AnimationValidatorVisitor` code.\n */\nfunction buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles = new Map(), finalStyles = new Map(), options, subInstructions, errors = []) {\n return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors);\n}\nclass AnimationTimelineBuilderVisitor {\n buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors = []) {\n subInstructions = subInstructions || new ElementInstructionMap();\n const context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []);\n context.options = options;\n const delay = options.delay ? resolveTimingValue(options.delay) : 0;\n context.currentTimeline.delayNextStep(delay);\n context.currentTimeline.setStyles([startingStyles], null, context.errors, options);\n visitDslNode(this, ast, context);\n // this checks to see if an actual animation happened\n const timelines = context.timelines.filter(timeline => timeline.containsAnimation());\n // note: we just want to apply the final styles for the rootElement, so we do not\n // just apply the styles to the last timeline but the last timeline which\n // element is the root one (basically `*`-styles are replaced with the actual\n // state style values only for the root element)\n if (timelines.length && finalStyles.size) {\n let lastRootTimeline;\n for (let i = timelines.length - 1; i >= 0; i--) {\n const timeline = timelines[i];\n if (timeline.element === rootElement) {\n lastRootTimeline = timeline;\n break;\n }\n }\n if (lastRootTimeline && !lastRootTimeline.allowOnlyTimelineStyles()) {\n lastRootTimeline.setStyles([finalStyles], null, context.errors, options);\n }\n }\n return timelines.length ? timelines.map(timeline => timeline.buildKeyframes()) : [createTimelineInstruction(rootElement, [], [], [], 0, delay, '', false)];\n }\n visitTrigger(ast, context) {\n // these values are not visited in this AST\n }\n visitState(ast, context) {\n // these values are not visited in this AST\n }\n visitTransition(ast, context) {\n // these values are not visited in this AST\n }\n visitAnimateChild(ast, context) {\n const elementInstructions = context.subInstructions.get(context.element);\n if (elementInstructions) {\n const innerContext = context.createSubContext(ast.options);\n const startTime = context.currentTimeline.currentTime;\n const endTime = this._visitSubInstructions(elementInstructions, innerContext, innerContext.options);\n if (startTime != endTime) {\n // we do this on the upper context because we created a sub context for\n // the sub child animations\n context.transformIntoNewTimeline(endTime);\n }\n }\n context.previousNode = ast;\n }\n visitAnimateRef(ast, context) {\n const innerContext = context.createSubContext(ast.options);\n innerContext.transformIntoNewTimeline();\n this._applyAnimationRefDelays([ast.options, ast.animation.options], context, innerContext);\n this.visitReference(ast.animation, innerContext);\n context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime);\n context.previousNode = ast;\n }\n _applyAnimationRefDelays(animationsRefsOptions, context, innerContext) {\n for (const animationRefOptions of animationsRefsOptions) {\n const animationDelay = animationRefOptions?.delay;\n if (animationDelay) {\n const animationDelayValue = typeof animationDelay === 'number' ? animationDelay : resolveTimingValue(interpolateParams(animationDelay, animationRefOptions?.params ?? {}, context.errors));\n innerContext.delayNextStep(animationDelayValue);\n }\n }\n }\n _visitSubInstructions(instructions, context, options) {\n const startTime = context.currentTimeline.currentTime;\n let furthestTime = startTime;\n // this is a special-case for when a user wants to skip a sub\n // animation from being fired entirely.\n const duration = options.duration != null ? resolveTimingValue(options.duration) : null;\n const delay = options.delay != null ? resolveTimingValue(options.delay) : null;\n if (duration !== 0) {\n instructions.forEach(instruction => {\n const instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay);\n furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay);\n });\n }\n return furthestTime;\n }\n visitReference(ast, context) {\n context.updateOptions(ast.options, true);\n visitDslNode(this, ast.animation, context);\n context.previousNode = ast;\n }\n visitSequence(ast, context) {\n const subContextCount = context.subContextCount;\n let ctx = context;\n const options = ast.options;\n if (options && (options.params || options.delay)) {\n ctx = context.createSubContext(options);\n ctx.transformIntoNewTimeline();\n if (options.delay != null) {\n if (ctx.previousNode.type == AnimationMetadataType.Style) {\n ctx.currentTimeline.snapshotCurrentStyles();\n ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n }\n const delay = resolveTimingValue(options.delay);\n ctx.delayNextStep(delay);\n }\n }\n if (ast.steps.length) {\n ast.steps.forEach(s => visitDslNode(this, s, ctx));\n // this is here just in case the inner steps only contain or end with a style() call\n ctx.currentTimeline.applyStylesToKeyframe();\n // this means that some animation function within the sequence\n // ended up creating a sub timeline (which means the current\n // timeline cannot overlap with the contents of the sequence)\n if (ctx.subContextCount > subContextCount) {\n ctx.transformIntoNewTimeline();\n }\n }\n context.previousNode = ast;\n }\n visitGroup(ast, context) {\n const innerTimelines = [];\n let furthestTime = context.currentTimeline.currentTime;\n const delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0;\n ast.steps.forEach(s => {\n const innerContext = context.createSubContext(ast.options);\n if (delay) {\n innerContext.delayNextStep(delay);\n }\n visitDslNode(this, s, innerContext);\n furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime);\n innerTimelines.push(innerContext.currentTimeline);\n });\n // this operation is run after the AST loop because otherwise\n // if the parent timeline's collected styles were updated then\n // it would pass in invalid data into the new-to-be forked items\n innerTimelines.forEach(timeline => context.currentTimeline.mergeTimelineCollectedStyles(timeline));\n context.transformIntoNewTimeline(furthestTime);\n context.previousNode = ast;\n }\n _visitTiming(ast, context) {\n if (ast.dynamic) {\n const strValue = ast.strValue;\n const timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue;\n return resolveTiming(timingValue, context.errors);\n } else {\n return {\n duration: ast.duration,\n delay: ast.delay,\n easing: ast.easing\n };\n }\n }\n visitAnimate(ast, context) {\n const timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context);\n const timeline = context.currentTimeline;\n if (timings.delay) {\n context.incrementTime(timings.delay);\n timeline.snapshotCurrentStyles();\n }\n const style = ast.style;\n if (style.type == AnimationMetadataType.Keyframes) {\n this.visitKeyframes(style, context);\n } else {\n context.incrementTime(timings.duration);\n this.visitStyle(style, context);\n timeline.applyStylesToKeyframe();\n }\n context.currentAnimateTimings = null;\n context.previousNode = ast;\n }\n visitStyle(ast, context) {\n const timeline = context.currentTimeline;\n const timings = context.currentAnimateTimings;\n // this is a special case for when a style() call\n // directly follows an animate() call (but not inside of an animate() call)\n if (!timings && timeline.hasCurrentStyleProperties()) {\n timeline.forwardFrame();\n }\n const easing = timings && timings.easing || ast.easing;\n if (ast.isEmptyStep) {\n timeline.applyEmptyStep(easing);\n } else {\n timeline.setStyles(ast.styles, easing, context.errors, context.options);\n }\n context.previousNode = ast;\n }\n visitKeyframes(ast, context) {\n const currentAnimateTimings = context.currentAnimateTimings;\n const startTime = context.currentTimeline.duration;\n const duration = currentAnimateTimings.duration;\n const innerContext = context.createSubContext();\n const innerTimeline = innerContext.currentTimeline;\n innerTimeline.easing = currentAnimateTimings.easing;\n ast.styles.forEach(step => {\n const offset = step.offset || 0;\n innerTimeline.forwardTime(offset * duration);\n innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options);\n innerTimeline.applyStylesToKeyframe();\n });\n // this will ensure that the parent timeline gets all the styles from\n // the child even if the new timeline below is not used\n context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline);\n // we do this because the window between this timeline and the sub timeline\n // should ensure that the styles within are exactly the same as they were before\n context.transformIntoNewTimeline(startTime + duration);\n context.previousNode = ast;\n }\n visitQuery(ast, context) {\n // in the event that the first step before this is a style step we need\n // to ensure the styles are applied before the children are animated\n const startTime = context.currentTimeline.currentTime;\n const options = ast.options || {};\n const delay = options.delay ? resolveTimingValue(options.delay) : 0;\n if (delay && (context.previousNode.type === AnimationMetadataType.Style || startTime == 0 && context.currentTimeline.hasCurrentStyleProperties())) {\n context.currentTimeline.snapshotCurrentStyles();\n context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n }\n let furthestTime = startTime;\n const elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors);\n context.currentQueryTotal = elms.length;\n let sameElementTimeline = null;\n elms.forEach((element, i) => {\n context.currentQueryIndex = i;\n const innerContext = context.createSubContext(ast.options, element);\n if (delay) {\n innerContext.delayNextStep(delay);\n }\n if (element === context.element) {\n sameElementTimeline = innerContext.currentTimeline;\n }\n visitDslNode(this, ast.animation, innerContext);\n // this is here just incase the inner steps only contain or end\n // with a style() call (which is here to signal that this is a preparatory\n // call to style an element before it is animated again)\n innerContext.currentTimeline.applyStylesToKeyframe();\n const endTime = innerContext.currentTimeline.currentTime;\n furthestTime = Math.max(furthestTime, endTime);\n });\n context.currentQueryIndex = 0;\n context.currentQueryTotal = 0;\n context.transformIntoNewTimeline(furthestTime);\n if (sameElementTimeline) {\n context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline);\n context.currentTimeline.snapshotCurrentStyles();\n }\n context.previousNode = ast;\n }\n visitStagger(ast, context) {\n const parentContext = context.parentContext;\n const tl = context.currentTimeline;\n const timings = ast.timings;\n const duration = Math.abs(timings.duration);\n const maxTime = duration * (context.currentQueryTotal - 1);\n let delay = duration * context.currentQueryIndex;\n let staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing;\n switch (staggerTransformer) {\n case 'reverse':\n delay = maxTime - delay;\n break;\n case 'full':\n delay = parentContext.currentStaggerTime;\n break;\n }\n const timeline = context.currentTimeline;\n if (delay) {\n timeline.delayNextStep(delay);\n }\n const startingTime = timeline.currentTime;\n visitDslNode(this, ast.animation, context);\n context.previousNode = ast;\n // time = duration + delay\n // the reason why this computation is so complex is because\n // the inner timeline may either have a delay value or a stretched\n // keyframe depending on if a subtimeline is not used or is used.\n parentContext.currentStaggerTime = tl.currentTime - startingTime + (tl.startTime - parentContext.currentTimeline.startTime);\n }\n}\nconst DEFAULT_NOOP_PREVIOUS_NODE = {};\nclass AnimationTimelineContext {\n constructor(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) {\n this._driver = _driver;\n this.element = element;\n this.subInstructions = subInstructions;\n this._enterClassName = _enterClassName;\n this._leaveClassName = _leaveClassName;\n this.errors = errors;\n this.timelines = timelines;\n this.parentContext = null;\n this.currentAnimateTimings = null;\n this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n this.subContextCount = 0;\n this.options = {};\n this.currentQueryIndex = 0;\n this.currentQueryTotal = 0;\n this.currentStaggerTime = 0;\n this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0);\n timelines.push(this.currentTimeline);\n }\n get params() {\n return this.options.params;\n }\n updateOptions(options, skipIfExists) {\n if (!options) return;\n const newOptions = options;\n let optionsToUpdate = this.options;\n // NOTE: this will get patched up when other animation methods support duration overrides\n if (newOptions.duration != null) {\n optionsToUpdate.duration = resolveTimingValue(newOptions.duration);\n }\n if (newOptions.delay != null) {\n optionsToUpdate.delay = resolveTimingValue(newOptions.delay);\n }\n const newParams = newOptions.params;\n if (newParams) {\n let paramsToUpdate = optionsToUpdate.params;\n if (!paramsToUpdate) {\n paramsToUpdate = this.options.params = {};\n }\n Object.keys(newParams).forEach(name => {\n if (!skipIfExists || !paramsToUpdate.hasOwnProperty(name)) {\n paramsToUpdate[name] = interpolateParams(newParams[name], paramsToUpdate, this.errors);\n }\n });\n }\n }\n _copyOptions() {\n const options = {};\n if (this.options) {\n const oldParams = this.options.params;\n if (oldParams) {\n const params = options['params'] = {};\n Object.keys(oldParams).forEach(name => {\n params[name] = oldParams[name];\n });\n }\n }\n return options;\n }\n createSubContext(options = null, element, newTime) {\n const target = element || this.element;\n const context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0));\n context.previousNode = this.previousNode;\n context.currentAnimateTimings = this.currentAnimateTimings;\n context.options = this._copyOptions();\n context.updateOptions(options);\n context.currentQueryIndex = this.currentQueryIndex;\n context.currentQueryTotal = this.currentQueryTotal;\n context.parentContext = this;\n this.subContextCount++;\n return context;\n }\n transformIntoNewTimeline(newTime) {\n this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;\n this.currentTimeline = this.currentTimeline.fork(this.element, newTime);\n this.timelines.push(this.currentTimeline);\n return this.currentTimeline;\n }\n appendInstructionToTimeline(instruction, duration, delay) {\n const updatedTimings = {\n duration: duration != null ? duration : instruction.duration,\n delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay,\n easing: ''\n };\n const builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe);\n this.timelines.push(builder);\n return updatedTimings;\n }\n incrementTime(time) {\n this.currentTimeline.forwardTime(this.currentTimeline.duration + time);\n }\n delayNextStep(delay) {\n // negative delays are not yet supported\n if (delay > 0) {\n this.currentTimeline.delayNextStep(delay);\n }\n }\n invokeQuery(selector, originalSelector, limit, includeSelf, optional, errors) {\n let results = [];\n if (includeSelf) {\n results.push(this.element);\n }\n if (selector.length > 0) {\n // only if :self is used then the selector can be empty\n selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);\n selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);\n const multi = limit != 1;\n let elements = this._driver.query(this.element, selector, multi);\n if (limit !== 0) {\n elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : elements.slice(0, limit);\n }\n results.push(...elements);\n }\n if (!optional && results.length == 0) {\n errors.push(invalidQuery(originalSelector));\n }\n return results;\n }\n}\nclass TimelineBuilder {\n constructor(_driver, element, startTime, _elementTimelineStylesLookup) {\n this._driver = _driver;\n this.element = element;\n this.startTime = startTime;\n this._elementTimelineStylesLookup = _elementTimelineStylesLookup;\n this.duration = 0;\n this.easing = null;\n this._previousKeyframe = new Map();\n this._currentKeyframe = new Map();\n this._keyframes = new Map();\n this._styleSummary = new Map();\n this._localTimelineStyles = new Map();\n this._pendingStyles = new Map();\n this._backFill = new Map();\n this._currentEmptyStepKeyframe = null;\n if (!this._elementTimelineStylesLookup) {\n this._elementTimelineStylesLookup = new Map();\n }\n this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element);\n if (!this._globalTimelineStyles) {\n this._globalTimelineStyles = this._localTimelineStyles;\n this._elementTimelineStylesLookup.set(element, this._localTimelineStyles);\n }\n this._loadKeyframe();\n }\n containsAnimation() {\n switch (this._keyframes.size) {\n case 0:\n return false;\n case 1:\n return this.hasCurrentStyleProperties();\n default:\n return true;\n }\n }\n hasCurrentStyleProperties() {\n return this._currentKeyframe.size > 0;\n }\n get currentTime() {\n return this.startTime + this.duration;\n }\n delayNextStep(delay) {\n // in the event that a style() step is placed right before a stagger()\n // and that style() step is the very first style() value in the animation\n // then we need to make a copy of the keyframe [0, copy, 1] so that the delay\n // properly applies the style() values to work with the stagger...\n const hasPreStyleStep = this._keyframes.size === 1 && this._pendingStyles.size;\n if (this.duration || hasPreStyleStep) {\n this.forwardTime(this.currentTime + delay);\n if (hasPreStyleStep) {\n this.snapshotCurrentStyles();\n }\n } else {\n this.startTime += delay;\n }\n }\n fork(element, currentTime) {\n this.applyStylesToKeyframe();\n return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup);\n }\n _loadKeyframe() {\n if (this._currentKeyframe) {\n this._previousKeyframe = this._currentKeyframe;\n }\n this._currentKeyframe = this._keyframes.get(this.duration);\n if (!this._currentKeyframe) {\n this._currentKeyframe = new Map();\n this._keyframes.set(this.duration, this._currentKeyframe);\n }\n }\n forwardFrame() {\n this.duration += ONE_FRAME_IN_MILLISECONDS;\n this._loadKeyframe();\n }\n forwardTime(time) {\n this.applyStylesToKeyframe();\n this.duration = time;\n this._loadKeyframe();\n }\n _updateStyle(prop, value) {\n this._localTimelineStyles.set(prop, value);\n this._globalTimelineStyles.set(prop, value);\n this._styleSummary.set(prop, {\n time: this.currentTime,\n value\n });\n }\n allowOnlyTimelineStyles() {\n return this._currentEmptyStepKeyframe !== this._currentKeyframe;\n }\n applyEmptyStep(easing) {\n if (easing) {\n this._previousKeyframe.set('easing', easing);\n }\n // special case for animate(duration):\n // all missing styles are filled with a `*` value then\n // if any destination styles are filled in later on the same\n // keyframe then they will override the overridden styles\n // We use `_globalTimelineStyles` here because there may be\n // styles in previous keyframes that are not present in this timeline\n for (let [prop, value] of this._globalTimelineStyles) {\n this._backFill.set(prop, value || AUTO_STYLE);\n this._currentKeyframe.set(prop, AUTO_STYLE);\n }\n this._currentEmptyStepKeyframe = this._currentKeyframe;\n }\n setStyles(input, easing, errors, options) {\n if (easing) {\n this._previousKeyframe.set('easing', easing);\n }\n const params = options && options.params || {};\n const styles = flattenStyles(input, this._globalTimelineStyles);\n for (let [prop, value] of styles) {\n const val = interpolateParams(value, params, errors);\n this._pendingStyles.set(prop, val);\n if (!this._localTimelineStyles.has(prop)) {\n this._backFill.set(prop, this._globalTimelineStyles.get(prop) ?? AUTO_STYLE);\n }\n this._updateStyle(prop, val);\n }\n }\n applyStylesToKeyframe() {\n if (this._pendingStyles.size == 0) return;\n this._pendingStyles.forEach((val, prop) => {\n this._currentKeyframe.set(prop, val);\n });\n this._pendingStyles.clear();\n this._localTimelineStyles.forEach((val, prop) => {\n if (!this._currentKeyframe.has(prop)) {\n this._currentKeyframe.set(prop, val);\n }\n });\n }\n snapshotCurrentStyles() {\n for (let [prop, val] of this._localTimelineStyles) {\n this._pendingStyles.set(prop, val);\n this._updateStyle(prop, val);\n }\n }\n getFinalKeyframe() {\n return this._keyframes.get(this.duration);\n }\n get properties() {\n const properties = [];\n for (let prop in this._currentKeyframe) {\n properties.push(prop);\n }\n return properties;\n }\n mergeTimelineCollectedStyles(timeline) {\n timeline._styleSummary.forEach((details1, prop) => {\n const details0 = this._styleSummary.get(prop);\n if (!details0 || details1.time > details0.time) {\n this._updateStyle(prop, details1.value);\n }\n });\n }\n buildKeyframes() {\n this.applyStylesToKeyframe();\n const preStyleProps = new Set();\n const postStyleProps = new Set();\n const isEmpty = this._keyframes.size === 1 && this.duration === 0;\n let finalKeyframes = [];\n this._keyframes.forEach((keyframe, time) => {\n const finalKeyframe = new Map([...this._backFill, ...keyframe]);\n finalKeyframe.forEach((value, prop) => {\n if (value === ɵPRE_STYLE) {\n preStyleProps.add(prop);\n } else if (value === AUTO_STYLE) {\n postStyleProps.add(prop);\n }\n });\n if (!isEmpty) {\n finalKeyframe.set('offset', time / this.duration);\n }\n finalKeyframes.push(finalKeyframe);\n });\n const preProps = [...preStyleProps.values()];\n const postProps = [...postStyleProps.values()];\n // special case for a 0-second animation (which is designed just to place styles onscreen)\n if (isEmpty) {\n const kf0 = finalKeyframes[0];\n const kf1 = new Map(kf0);\n kf0.set('offset', 0);\n kf1.set('offset', 1);\n finalKeyframes = [kf0, kf1];\n }\n return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false);\n }\n}\nclass SubTimelineBuilder extends TimelineBuilder {\n constructor(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe = false) {\n super(driver, element, timings.delay);\n this.keyframes = keyframes;\n this.preStyleProps = preStyleProps;\n this.postStyleProps = postStyleProps;\n this._stretchStartingKeyframe = _stretchStartingKeyframe;\n this.timings = {\n duration: timings.duration,\n delay: timings.delay,\n easing: timings.easing\n };\n }\n containsAnimation() {\n return this.keyframes.length > 1;\n }\n buildKeyframes() {\n let keyframes = this.keyframes;\n let {\n delay,\n duration,\n easing\n } = this.timings;\n if (this._stretchStartingKeyframe && delay) {\n const newKeyframes = [];\n const totalTime = duration + delay;\n const startingGap = delay / totalTime;\n // the original starting keyframe now starts once the delay is done\n const newFirstKeyframe = new Map(keyframes[0]);\n newFirstKeyframe.set('offset', 0);\n newKeyframes.push(newFirstKeyframe);\n const oldFirstKeyframe = new Map(keyframes[0]);\n oldFirstKeyframe.set('offset', roundOffset(startingGap));\n newKeyframes.push(oldFirstKeyframe);\n /*\n When the keyframe is stretched then it means that the delay before the animation\n starts is gone. Instead the first keyframe is placed at the start of the animation\n and it is then copied to where it starts when the original delay is over. This basically\n means nothing animates during that delay, but the styles are still rendered. For this\n to work the original offset values that exist in the original keyframes must be \"warped\"\n so that they can take the new keyframe + delay into account.\n delay=1000, duration=1000, keyframes = 0 .5 1\n turns into\n delay=0, duration=2000, keyframes = 0 .33 .66 1\n */\n // offsets between 1 ... n -1 are all warped by the keyframe stretch\n const limit = keyframes.length - 1;\n for (let i = 1; i <= limit; i++) {\n let kf = new Map(keyframes[i]);\n const oldOffset = kf.get('offset');\n const timeAtKeyframe = delay + oldOffset * duration;\n kf.set('offset', roundOffset(timeAtKeyframe / totalTime));\n newKeyframes.push(kf);\n }\n // the new starting keyframe should be added at the start\n duration = totalTime;\n delay = 0;\n easing = '';\n keyframes = newKeyframes;\n }\n return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true);\n }\n}\nfunction roundOffset(offset, decimalPoints = 3) {\n const mult = Math.pow(10, decimalPoints - 1);\n return Math.round(offset * mult) / mult;\n}\nfunction flattenStyles(input, allStyles) {\n const styles = new Map();\n let allProperties;\n input.forEach(token => {\n if (token === '*') {\n allProperties ??= allStyles.keys();\n for (let prop of allProperties) {\n styles.set(prop, AUTO_STYLE);\n }\n } else {\n for (let [prop, val] of token) {\n styles.set(prop, val);\n }\n }\n });\n return styles;\n}\nfunction createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, totalTime, errors) {\n return {\n type: 0 /* AnimationTransitionInstructionType.TransitionAnimation */,\n element,\n triggerName,\n isRemovalTransition,\n fromState,\n fromStyles,\n toState,\n toStyles,\n timelines,\n queriedElements,\n preStyleProps,\n postStyleProps,\n totalTime,\n errors\n };\n}\nconst EMPTY_OBJECT = {};\nclass AnimationTransitionFactory {\n constructor(_triggerName, ast, _stateStyles) {\n this._triggerName = _triggerName;\n this.ast = ast;\n this._stateStyles = _stateStyles;\n }\n match(currentState, nextState, element, params) {\n return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState, element, params);\n }\n buildStyles(stateName, params, errors) {\n let styler = this._stateStyles.get('*');\n if (stateName !== undefined) {\n styler = this._stateStyles.get(stateName?.toString()) || styler;\n }\n return styler ? styler.buildStyles(params, errors) : new Map();\n }\n build(driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) {\n const errors = [];\n const transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT;\n const currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT;\n const currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors);\n const nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT;\n const nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors);\n const queriedElements = new Set();\n const preStyleMap = new Map();\n const postStyleMap = new Map();\n const isRemoval = nextState === 'void';\n const animationOptions = {\n params: applyParamDefaults(nextAnimationParams, transitionAnimationParams),\n delay: this.ast.options?.delay\n };\n const timelines = skipAstBuild ? [] : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors);\n let totalTime = 0;\n timelines.forEach(tl => {\n totalTime = Math.max(tl.duration + tl.delay, totalTime);\n });\n if (errors.length) {\n return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, totalTime, errors);\n }\n timelines.forEach(tl => {\n const elm = tl.element;\n const preProps = getOrSetDefaultValue(preStyleMap, elm, new Set());\n tl.preStyleProps.forEach(prop => preProps.add(prop));\n const postProps = getOrSetDefaultValue(postStyleMap, elm, new Set());\n tl.postStyleProps.forEach(prop => postProps.add(prop));\n if (elm !== element) {\n queriedElements.add(elm);\n }\n });\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n checkNonAnimatableInTimelines(timelines, this._triggerName, driver);\n }\n return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, [...queriedElements.values()], preStyleMap, postStyleMap, totalTime);\n }\n}\n/**\n * Checks inside a set of timelines if they try to animate a css property which is not considered\n * animatable, in that case it prints a warning on the console.\n * Besides that the function doesn't have any other effect.\n *\n * Note: this check is done here after the timelines are built instead of doing on a lower level so\n * that we can make sure that the warning appears only once per instruction (we can aggregate here\n * all the issues instead of finding them separately).\n *\n * @param timelines The built timelines for the current instruction.\n * @param triggerName The name of the trigger for the current instruction.\n * @param driver Animation driver used to perform the check.\n *\n */\nfunction checkNonAnimatableInTimelines(timelines, triggerName, driver) {\n if (!driver.validateAnimatableStyleProperty) {\n return;\n }\n const allowedNonAnimatableProps = new Set([\n // 'easing' is a utility/synthetic prop we use to represent\n // easing functions, it represents a property of the animation\n // which is not animatable but different values can be used\n // in different steps\n 'easing']);\n const invalidNonAnimatableProps = new Set();\n timelines.forEach(({\n keyframes\n }) => {\n const nonAnimatablePropsInitialValues = new Map();\n keyframes.forEach(keyframe => {\n const entriesToCheck = Array.from(keyframe.entries()).filter(([prop]) => !allowedNonAnimatableProps.has(prop));\n for (const [prop, value] of entriesToCheck) {\n if (!driver.validateAnimatableStyleProperty(prop)) {\n if (nonAnimatablePropsInitialValues.has(prop) && !invalidNonAnimatableProps.has(prop)) {\n const propInitialValue = nonAnimatablePropsInitialValues.get(prop);\n if (propInitialValue !== value) {\n invalidNonAnimatableProps.add(prop);\n }\n } else {\n nonAnimatablePropsInitialValues.set(prop, value);\n }\n }\n }\n });\n });\n if (invalidNonAnimatableProps.size > 0) {\n console.warn(`Warning: The animation trigger \"${triggerName}\" is attempting to animate the following` + ' not animatable properties: ' + Array.from(invalidNonAnimatableProps).join(', ') + '\\n' + '(to check the list of all animatable properties visit https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties)');\n }\n}\nfunction oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) {\n return matchFns.some(fn => fn(currentState, nextState, element, params));\n}\nfunction applyParamDefaults(userParams, defaults) {\n const result = {\n ...defaults\n };\n Object.entries(userParams).forEach(([key, value]) => {\n if (value != null) {\n result[key] = value;\n }\n });\n return result;\n}\nclass AnimationStateStyles {\n constructor(styles, defaultParams, normalizer) {\n this.styles = styles;\n this.defaultParams = defaultParams;\n this.normalizer = normalizer;\n }\n buildStyles(params, errors) {\n const finalStyles = new Map();\n const combinedParams = applyParamDefaults(params, this.defaultParams);\n this.styles.styles.forEach(value => {\n if (typeof value !== 'string') {\n value.forEach((val, prop) => {\n if (val) {\n val = interpolateParams(val, combinedParams, errors);\n }\n const normalizedProp = this.normalizer.normalizePropertyName(prop, errors);\n val = this.normalizer.normalizeStyleValue(prop, normalizedProp, val, errors);\n finalStyles.set(prop, val);\n });\n }\n });\n return finalStyles;\n }\n}\nfunction buildTrigger(name, ast, normalizer) {\n return new AnimationTrigger(name, ast, normalizer);\n}\nclass AnimationTrigger {\n constructor(name, ast, _normalizer) {\n this.name = name;\n this.ast = ast;\n this._normalizer = _normalizer;\n this.transitionFactories = [];\n this.states = new Map();\n ast.states.forEach(ast => {\n const defaultParams = ast.options && ast.options.params || {};\n this.states.set(ast.name, new AnimationStateStyles(ast.style, defaultParams, _normalizer));\n });\n balanceProperties(this.states, 'true', '1');\n balanceProperties(this.states, 'false', '0');\n ast.transitions.forEach(ast => {\n this.transitionFactories.push(new AnimationTransitionFactory(name, ast, this.states));\n });\n this.fallbackTransition = createFallbackTransition(name, this.states, this._normalizer);\n }\n get containsQueries() {\n return this.ast.queryCount > 0;\n }\n matchTransition(currentState, nextState, element, params) {\n const entry = this.transitionFactories.find(f => f.match(currentState, nextState, element, params));\n return entry || null;\n }\n matchStyles(currentState, params, errors) {\n return this.fallbackTransition.buildStyles(currentState, params, errors);\n }\n}\nfunction createFallbackTransition(triggerName, states, normalizer) {\n const matchers = [(fromState, toState) => true];\n const animation = {\n type: AnimationMetadataType.Sequence,\n steps: [],\n options: null\n };\n const transition = {\n type: AnimationMetadataType.Transition,\n animation,\n matchers,\n options: null,\n queryCount: 0,\n depCount: 0\n };\n return new AnimationTransitionFactory(triggerName, transition, states);\n}\nfunction balanceProperties(stateMap, key1, key2) {\n if (stateMap.has(key1)) {\n if (!stateMap.has(key2)) {\n stateMap.set(key2, stateMap.get(key1));\n }\n } else if (stateMap.has(key2)) {\n stateMap.set(key1, stateMap.get(key2));\n }\n}\nconst EMPTY_INSTRUCTION_MAP = /*#__PURE__*/new ElementInstructionMap();\nclass TimelineAnimationEngine {\n constructor(bodyNode, _driver, _normalizer) {\n this.bodyNode = bodyNode;\n this._driver = _driver;\n this._normalizer = _normalizer;\n this._animations = new Map();\n this._playersById = new Map();\n this.players = [];\n }\n register(id, metadata) {\n const errors = [];\n const warnings = [];\n const ast = buildAnimationAst(this._driver, metadata, errors, warnings);\n if (errors.length) {\n throw registerFailed(errors);\n } else {\n if (warnings.length) {\n warnRegister(warnings);\n }\n this._animations.set(id, ast);\n }\n }\n _buildPlayer(i, preStyles, postStyles) {\n const element = i.element;\n const keyframes = normalizeKeyframes$1(this._normalizer, i.keyframes, preStyles, postStyles);\n return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, [], true);\n }\n create(id, element, options = {}) {\n const errors = [];\n const ast = this._animations.get(id);\n let instructions;\n const autoStylesMap = new Map();\n if (ast) {\n instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, new Map(), new Map(), options, EMPTY_INSTRUCTION_MAP, errors);\n instructions.forEach(inst => {\n const styles = getOrSetDefaultValue(autoStylesMap, inst.element, new Map());\n inst.postStyleProps.forEach(prop => styles.set(prop, null));\n });\n } else {\n errors.push(missingOrDestroyedAnimation());\n instructions = [];\n }\n if (errors.length) {\n throw createAnimationFailed(errors);\n }\n autoStylesMap.forEach((styles, element) => {\n styles.forEach((_, prop) => {\n styles.set(prop, this._driver.computeStyle(element, prop, AUTO_STYLE));\n });\n });\n const players = instructions.map(i => {\n const styles = autoStylesMap.get(i.element);\n return this._buildPlayer(i, new Map(), styles);\n });\n const player = optimizeGroupPlayer(players);\n this._playersById.set(id, player);\n player.onDestroy(() => this.destroy(id));\n this.players.push(player);\n return player;\n }\n destroy(id) {\n const player = this._getPlayer(id);\n player.destroy();\n this._playersById.delete(id);\n const index = this.players.indexOf(player);\n if (index >= 0) {\n this.players.splice(index, 1);\n }\n }\n _getPlayer(id) {\n const player = this._playersById.get(id);\n if (!player) {\n throw missingPlayer(id);\n }\n return player;\n }\n listen(id, element, eventName, callback) {\n // triggerName, fromState, toState are all ignored for timeline animations\n const baseEvent = makeAnimationEvent(element, '', '', '');\n listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback);\n return () => {};\n }\n command(id, element, command, args) {\n if (command == 'register') {\n this.register(id, args[0]);\n return;\n }\n if (command == 'create') {\n const options = args[0] || {};\n this.create(id, element, options);\n return;\n }\n const player = this._getPlayer(id);\n switch (command) {\n case 'play':\n player.play();\n break;\n case 'pause':\n player.pause();\n break;\n case 'reset':\n player.reset();\n break;\n case 'restart':\n player.restart();\n break;\n case 'finish':\n player.finish();\n break;\n case 'init':\n player.init();\n break;\n case 'setPosition':\n player.setPosition(parseFloat(args[0]));\n break;\n case 'destroy':\n this.destroy(id);\n break;\n }\n }\n}\nconst QUEUED_CLASSNAME = 'ng-animate-queued';\nconst QUEUED_SELECTOR = '.ng-animate-queued';\nconst DISABLED_CLASSNAME = 'ng-animate-disabled';\nconst DISABLED_SELECTOR = '.ng-animate-disabled';\nconst STAR_CLASSNAME = 'ng-star-inserted';\nconst STAR_SELECTOR = '.ng-star-inserted';\nconst EMPTY_PLAYER_ARRAY = [];\nconst NULL_REMOVAL_STATE = {\n namespaceId: '',\n setForRemoval: false,\n setForMove: false,\n hasAnimation: false,\n removedBeforeQueried: false\n};\nconst NULL_REMOVED_QUERIED_STATE = {\n namespaceId: '',\n setForMove: false,\n setForRemoval: false,\n hasAnimation: false,\n removedBeforeQueried: true\n};\nconst REMOVAL_FLAG = '__ng_removed';\nclass StateValue {\n get params() {\n return this.options.params;\n }\n constructor(input, namespaceId = '') {\n this.namespaceId = namespaceId;\n const isObj = input && input.hasOwnProperty('value');\n const value = isObj ? input['value'] : input;\n this.value = normalizeTriggerValue(value);\n if (isObj) {\n // we drop the value property from options.\n const {\n value,\n ...options\n } = input;\n this.options = options;\n } else {\n this.options = {};\n }\n if (!this.options.params) {\n this.options.params = {};\n }\n }\n absorbOptions(options) {\n const newParams = options.params;\n if (newParams) {\n const oldParams = this.options.params;\n Object.keys(newParams).forEach(prop => {\n if (oldParams[prop] == null) {\n oldParams[prop] = newParams[prop];\n }\n });\n }\n }\n}\nconst VOID_VALUE = 'void';\nconst DEFAULT_STATE_VALUE = /*#__PURE__*/new StateValue(VOID_VALUE);\nclass AnimationTransitionNamespace {\n constructor(id, hostElement, _engine) {\n this.id = id;\n this.hostElement = hostElement;\n this._engine = _engine;\n this.players = [];\n this._triggers = new Map();\n this._queue = [];\n this._elementListeners = new Map();\n this._hostClassName = 'ng-tns-' + id;\n addClass(hostElement, this._hostClassName);\n }\n listen(element, name, phase, callback) {\n if (!this._triggers.has(name)) {\n throw missingTrigger(phase, name);\n }\n if (phase == null || phase.length == 0) {\n throw missingEvent(name);\n }\n if (!isTriggerEventValid(phase)) {\n throw unsupportedTriggerEvent(phase, name);\n }\n const listeners = getOrSetDefaultValue(this._elementListeners, element, []);\n const data = {\n name,\n phase,\n callback\n };\n listeners.push(data);\n const triggersWithStates = getOrSetDefaultValue(this._engine.statesByElement, element, new Map());\n if (!triggersWithStates.has(name)) {\n addClass(element, NG_TRIGGER_CLASSNAME);\n addClass(element, NG_TRIGGER_CLASSNAME + '-' + name);\n triggersWithStates.set(name, DEFAULT_STATE_VALUE);\n }\n return () => {\n // the event listener is removed AFTER the flush has occurred such\n // that leave animations callbacks can fire (otherwise if the node\n // is removed in between then the listeners would be deregistered)\n this._engine.afterFlush(() => {\n const index = listeners.indexOf(data);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n if (!this._triggers.has(name)) {\n triggersWithStates.delete(name);\n }\n });\n };\n }\n register(name, ast) {\n if (this._triggers.has(name)) {\n // throw\n return false;\n } else {\n this._triggers.set(name, ast);\n return true;\n }\n }\n _getTrigger(name) {\n const trigger = this._triggers.get(name);\n if (!trigger) {\n throw unregisteredTrigger(name);\n }\n return trigger;\n }\n trigger(element, triggerName, value, defaultToFallback = true) {\n const trigger = this._getTrigger(triggerName);\n const player = new TransitionAnimationPlayer(this.id, triggerName, element);\n let triggersWithStates = this._engine.statesByElement.get(element);\n if (!triggersWithStates) {\n addClass(element, NG_TRIGGER_CLASSNAME);\n addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName);\n this._engine.statesByElement.set(element, triggersWithStates = new Map());\n }\n let fromState = triggersWithStates.get(triggerName);\n const toState = new StateValue(value, this.id);\n const isObj = value && value.hasOwnProperty('value');\n if (!isObj && fromState) {\n toState.absorbOptions(fromState.options);\n }\n triggersWithStates.set(triggerName, toState);\n if (!fromState) {\n fromState = DEFAULT_STATE_VALUE;\n }\n const isRemoval = toState.value === VOID_VALUE;\n // normally this isn't reached by here, however, if an object expression\n // is passed in then it may be a new object each time. Comparing the value\n // is important since that will stay the same despite there being a new object.\n // The removal arc here is special cased because the same element is triggered\n // twice in the event that it contains animations on the outer/inner portions\n // of the host container\n if (!isRemoval && fromState.value === toState.value) {\n // this means that despite the value not changing, some inner params\n // have changed which means that the animation final styles need to be applied\n if (!objEquals(fromState.params, toState.params)) {\n const errors = [];\n const fromStyles = trigger.matchStyles(fromState.value, fromState.params, errors);\n const toStyles = trigger.matchStyles(toState.value, toState.params, errors);\n if (errors.length) {\n this._engine.reportError(errors);\n } else {\n this._engine.afterFlush(() => {\n eraseStyles(element, fromStyles);\n setStyles(element, toStyles);\n });\n }\n }\n return;\n }\n const playersOnElement = getOrSetDefaultValue(this._engine.playersByElement, element, []);\n playersOnElement.forEach(player => {\n // only remove the player if it is queued on the EXACT same trigger/namespace\n // we only also deal with queued players here because if the animation has\n // started then we want to keep the player alive until the flush happens\n // (which is where the previousPlayers are passed into the new player)\n if (player.namespaceId == this.id && player.triggerName == triggerName && player.queued) {\n player.destroy();\n }\n });\n let transition = trigger.matchTransition(fromState.value, toState.value, element, toState.params);\n let isFallbackTransition = false;\n if (!transition) {\n if (!defaultToFallback) return;\n transition = trigger.fallbackTransition;\n isFallbackTransition = true;\n }\n this._engine.totalQueuedPlayers++;\n this._queue.push({\n element,\n triggerName,\n transition,\n fromState,\n toState,\n player,\n isFallbackTransition\n });\n if (!isFallbackTransition) {\n addClass(element, QUEUED_CLASSNAME);\n player.onStart(() => {\n removeClass(element, QUEUED_CLASSNAME);\n });\n }\n player.onDone(() => {\n let index = this.players.indexOf(player);\n if (index >= 0) {\n this.players.splice(index, 1);\n }\n const players = this._engine.playersByElement.get(element);\n if (players) {\n let index = players.indexOf(player);\n if (index >= 0) {\n players.splice(index, 1);\n }\n }\n });\n this.players.push(player);\n playersOnElement.push(player);\n return player;\n }\n deregister(name) {\n this._triggers.delete(name);\n this._engine.statesByElement.forEach(stateMap => stateMap.delete(name));\n this._elementListeners.forEach((listeners, element) => {\n this._elementListeners.set(element, listeners.filter(entry => {\n return entry.name != name;\n }));\n });\n }\n clearElementCache(element) {\n this._engine.statesByElement.delete(element);\n this._elementListeners.delete(element);\n const elementPlayers = this._engine.playersByElement.get(element);\n if (elementPlayers) {\n elementPlayers.forEach(player => player.destroy());\n this._engine.playersByElement.delete(element);\n }\n }\n _signalRemovalForInnerTriggers(rootElement, context) {\n const elements = this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true);\n // emulate a leave animation for all inner nodes within this node.\n // If there are no animations found for any of the nodes then clear the cache\n // for the element.\n elements.forEach(elm => {\n // this means that an inner remove() operation has already kicked off\n // the animation on this element...\n if (elm[REMOVAL_FLAG]) return;\n const namespaces = this._engine.fetchNamespacesByElement(elm);\n if (namespaces.size) {\n namespaces.forEach(ns => ns.triggerLeaveAnimation(elm, context, false, true));\n } else {\n this.clearElementCache(elm);\n }\n });\n // If the child elements were removed along with the parent, their animations might not\n // have completed. Clear all the elements from the cache so we don't end up with a memory leak.\n this._engine.afterFlushAnimationsDone(() => elements.forEach(elm => this.clearElementCache(elm)));\n }\n triggerLeaveAnimation(element, context, destroyAfterComplete, defaultToFallback) {\n const triggerStates = this._engine.statesByElement.get(element);\n const previousTriggersValues = new Map();\n if (triggerStates) {\n const players = [];\n triggerStates.forEach((state, triggerName) => {\n previousTriggersValues.set(triggerName, state.value);\n // this check is here in the event that an element is removed\n // twice (both on the host level and the component level)\n if (this._triggers.has(triggerName)) {\n const player = this.trigger(element, triggerName, VOID_VALUE, defaultToFallback);\n if (player) {\n players.push(player);\n }\n }\n });\n if (players.length) {\n this._engine.markElementAsRemoved(this.id, element, true, context, previousTriggersValues);\n if (destroyAfterComplete) {\n optimizeGroupPlayer(players).onDone(() => this._engine.processLeaveNode(element));\n }\n return true;\n }\n }\n return false;\n }\n prepareLeaveAnimationListeners(element) {\n const listeners = this._elementListeners.get(element);\n const elementStates = this._engine.statesByElement.get(element);\n // if this statement fails then it means that the element was picked up\n // by an earlier flush (or there are no listeners at all to track the leave).\n if (listeners && elementStates) {\n const visitedTriggers = new Set();\n listeners.forEach(listener => {\n const triggerName = listener.name;\n if (visitedTriggers.has(triggerName)) return;\n visitedTriggers.add(triggerName);\n const trigger = this._triggers.get(triggerName);\n const transition = trigger.fallbackTransition;\n const fromState = elementStates.get(triggerName) || DEFAULT_STATE_VALUE;\n const toState = new StateValue(VOID_VALUE);\n const player = new TransitionAnimationPlayer(this.id, triggerName, element);\n this._engine.totalQueuedPlayers++;\n this._queue.push({\n element,\n triggerName,\n transition,\n fromState,\n toState,\n player,\n isFallbackTransition: true\n });\n });\n }\n }\n removeNode(element, context) {\n const engine = this._engine;\n if (element.childElementCount) {\n this._signalRemovalForInnerTriggers(element, context);\n }\n // this means that a * => VOID animation was detected and kicked off\n if (this.triggerLeaveAnimation(element, context, true)) return;\n // find the player that is animating and make sure that the\n // removal is delayed until that player has completed\n let containsPotentialParentTransition = false;\n if (engine.totalAnimations) {\n const currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : [];\n // when this `if statement` does not continue forward it means that\n // a previous animation query has selected the current element and\n // is animating it. In this situation want to continue forwards and\n // allow the element to be queued up for animation later.\n if (currentPlayers && currentPlayers.length) {\n containsPotentialParentTransition = true;\n } else {\n let parent = element;\n while (parent = parent.parentNode) {\n const triggers = engine.statesByElement.get(parent);\n if (triggers) {\n containsPotentialParentTransition = true;\n break;\n }\n }\n }\n }\n // at this stage we know that the element will either get removed\n // during flush or will be picked up by a parent query. Either way\n // we need to fire the listeners for this element when it DOES get\n // removed (once the query parent animation is done or after flush)\n this.prepareLeaveAnimationListeners(element);\n // whether or not a parent has an animation we need to delay the deferral of the leave\n // operation until we have more information (which we do after flush() has been called)\n if (containsPotentialParentTransition) {\n engine.markElementAsRemoved(this.id, element, false, context);\n } else {\n const removalFlag = element[REMOVAL_FLAG];\n if (!removalFlag || removalFlag === NULL_REMOVAL_STATE) {\n // we do this after the flush has occurred such\n // that the callbacks can be fired\n engine.afterFlush(() => this.clearElementCache(element));\n engine.destroyInnerAnimations(element);\n engine._onRemovalComplete(element, context);\n }\n }\n }\n insertNode(element, parent) {\n addClass(element, this._hostClassName);\n }\n drainQueuedTransitions(microtaskId) {\n const instructions = [];\n this._queue.forEach(entry => {\n const player = entry.player;\n if (player.destroyed) return;\n const element = entry.element;\n const listeners = this._elementListeners.get(element);\n if (listeners) {\n listeners.forEach(listener => {\n if (listener.name == entry.triggerName) {\n const baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value);\n baseEvent['_data'] = microtaskId;\n listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback);\n }\n });\n }\n if (player.markedForDestroy) {\n this._engine.afterFlush(() => {\n // now we can destroy the element properly since the event listeners have\n // been bound to the player\n player.destroy();\n });\n } else {\n instructions.push(entry);\n }\n });\n this._queue = [];\n return instructions.sort((a, b) => {\n // if depCount == 0 them move to front\n // otherwise if a contains b then move back\n const d0 = a.transition.ast.depCount;\n const d1 = b.transition.ast.depCount;\n if (d0 == 0 || d1 == 0) {\n return d0 - d1;\n }\n return this._engine.driver.containsElement(a.element, b.element) ? 1 : -1;\n });\n }\n destroy(context) {\n this.players.forEach(p => p.destroy());\n this._signalRemovalForInnerTriggers(this.hostElement, context);\n }\n}\nclass TransitionAnimationEngine {\n /** @internal */\n _onRemovalComplete(element, context) {\n this.onRemovalComplete(element, context);\n }\n constructor(bodyNode, driver, _normalizer) {\n this.bodyNode = bodyNode;\n this.driver = driver;\n this._normalizer = _normalizer;\n this.players = [];\n this.newHostElements = new Map();\n this.playersByElement = new Map();\n this.playersByQueriedElement = new Map();\n this.statesByElement = new Map();\n this.disabledNodes = new Set();\n this.totalAnimations = 0;\n this.totalQueuedPlayers = 0;\n this._namespaceLookup = {};\n this._namespaceList = [];\n this._flushFns = [];\n this._whenQuietFns = [];\n this.namespacesByHostElement = new Map();\n this.collectedEnterElements = [];\n this.collectedLeaveElements = [];\n // this method is designed to be overridden by the code that uses this engine\n this.onRemovalComplete = (element, context) => {};\n }\n get queuedPlayers() {\n const players = [];\n this._namespaceList.forEach(ns => {\n ns.players.forEach(player => {\n if (player.queued) {\n players.push(player);\n }\n });\n });\n return players;\n }\n createNamespace(namespaceId, hostElement) {\n const ns = new AnimationTransitionNamespace(namespaceId, hostElement, this);\n if (this.bodyNode && this.driver.containsElement(this.bodyNode, hostElement)) {\n this._balanceNamespaceList(ns, hostElement);\n } else {\n // defer this later until flush during when the host element has\n // been inserted so that we know exactly where to place it in\n // the namespace list\n this.newHostElements.set(hostElement, ns);\n // given that this host element is a part of the animation code, it\n // may or may not be inserted by a parent node that is of an\n // animation renderer type. If this happens then we can still have\n // access to this item when we query for :enter nodes. If the parent\n // is a renderer then the set data-structure will normalize the entry\n this.collectEnterElement(hostElement);\n }\n return this._namespaceLookup[namespaceId] = ns;\n }\n _balanceNamespaceList(ns, hostElement) {\n const namespaceList = this._namespaceList;\n const namespacesByHostElement = this.namespacesByHostElement;\n const limit = namespaceList.length - 1;\n if (limit >= 0) {\n let found = false;\n // Find the closest ancestor with an existing namespace so we can then insert `ns` after it,\n // establishing a top-down ordering of namespaces in `this._namespaceList`.\n let ancestor = this.driver.getParentElement(hostElement);\n while (ancestor) {\n const ancestorNs = namespacesByHostElement.get(ancestor);\n if (ancestorNs) {\n // An animation namespace has been registered for this ancestor, so we insert `ns`\n // right after it to establish top-down ordering of animation namespaces.\n const index = namespaceList.indexOf(ancestorNs);\n namespaceList.splice(index + 1, 0, ns);\n found = true;\n break;\n }\n ancestor = this.driver.getParentElement(ancestor);\n }\n if (!found) {\n // No namespace exists that is an ancestor of `ns`, so `ns` is inserted at the front to\n // ensure that any existing descendants are ordered after `ns`, retaining the desired\n // top-down ordering.\n namespaceList.unshift(ns);\n }\n } else {\n namespaceList.push(ns);\n }\n namespacesByHostElement.set(hostElement, ns);\n return ns;\n }\n register(namespaceId, hostElement) {\n let ns = this._namespaceLookup[namespaceId];\n if (!ns) {\n ns = this.createNamespace(namespaceId, hostElement);\n }\n return ns;\n }\n registerTrigger(namespaceId, name, trigger) {\n let ns = this._namespaceLookup[namespaceId];\n if (ns && ns.register(name, trigger)) {\n this.totalAnimations++;\n }\n }\n destroy(namespaceId, context) {\n if (!namespaceId) return;\n this.afterFlush(() => {});\n this.afterFlushAnimationsDone(() => {\n const ns = this._fetchNamespace(namespaceId);\n this.namespacesByHostElement.delete(ns.hostElement);\n const index = this._namespaceList.indexOf(ns);\n if (index >= 0) {\n this._namespaceList.splice(index, 1);\n }\n ns.destroy(context);\n delete this._namespaceLookup[namespaceId];\n });\n }\n _fetchNamespace(id) {\n return this._namespaceLookup[id];\n }\n fetchNamespacesByElement(element) {\n // normally there should only be one namespace per element, however\n // if @triggers are placed on both the component element and then\n // its host element (within the component code) then there will be\n // two namespaces returned. We use a set here to simply deduplicate\n // the namespaces in case (for the reason described above) there are multiple triggers\n const namespaces = new Set();\n const elementStates = this.statesByElement.get(element);\n if (elementStates) {\n for (let stateValue of elementStates.values()) {\n if (stateValue.namespaceId) {\n const ns = this._fetchNamespace(stateValue.namespaceId);\n if (ns) {\n namespaces.add(ns);\n }\n }\n }\n }\n return namespaces;\n }\n trigger(namespaceId, element, name, value) {\n if (isElementNode(element)) {\n const ns = this._fetchNamespace(namespaceId);\n if (ns) {\n ns.trigger(element, name, value);\n return true;\n }\n }\n return false;\n }\n insertNode(namespaceId, element, parent, insertBefore) {\n if (!isElementNode(element)) return;\n // special case for when an element is removed and reinserted (move operation)\n // when this occurs we do not want to use the element for deletion later\n const details = element[REMOVAL_FLAG];\n if (details && details.setForRemoval) {\n details.setForRemoval = false;\n details.setForMove = true;\n const index = this.collectedLeaveElements.indexOf(element);\n if (index >= 0) {\n this.collectedLeaveElements.splice(index, 1);\n }\n }\n // in the event that the namespaceId is blank then the caller\n // code does not contain any animation code in it, but it is\n // just being called so that the node is marked as being inserted\n if (namespaceId) {\n const ns = this._fetchNamespace(namespaceId);\n // This if-statement is a workaround for router issue #21947.\n // The router sometimes hits a race condition where while a route\n // is being instantiated a new navigation arrives, triggering leave\n // animation of DOM that has not been fully initialized, until this\n // is resolved, we need to handle the scenario when DOM is not in a\n // consistent state during the animation.\n if (ns) {\n ns.insertNode(element, parent);\n }\n }\n // only *directives and host elements are inserted before\n if (insertBefore) {\n this.collectEnterElement(element);\n }\n }\n collectEnterElement(element) {\n this.collectedEnterElements.push(element);\n }\n markElementAsDisabled(element, value) {\n if (value) {\n if (!this.disabledNodes.has(element)) {\n this.disabledNodes.add(element);\n addClass(element, DISABLED_CLASSNAME);\n }\n } else if (this.disabledNodes.has(element)) {\n this.disabledNodes.delete(element);\n removeClass(element, DISABLED_CLASSNAME);\n }\n }\n removeNode(namespaceId, element, context) {\n if (isElementNode(element)) {\n const ns = namespaceId ? this._fetchNamespace(namespaceId) : null;\n if (ns) {\n ns.removeNode(element, context);\n } else {\n this.markElementAsRemoved(namespaceId, element, false, context);\n }\n const hostNS = this.namespacesByHostElement.get(element);\n if (hostNS && hostNS.id !== namespaceId) {\n hostNS.removeNode(element, context);\n }\n } else {\n this._onRemovalComplete(element, context);\n }\n }\n markElementAsRemoved(namespaceId, element, hasAnimation, context, previousTriggersValues) {\n this.collectedLeaveElements.push(element);\n element[REMOVAL_FLAG] = {\n namespaceId,\n setForRemoval: context,\n hasAnimation,\n removedBeforeQueried: false,\n previousTriggersValues\n };\n }\n listen(namespaceId, element, name, phase, callback) {\n if (isElementNode(element)) {\n return this._fetchNamespace(namespaceId).listen(element, name, phase, callback);\n }\n return () => {};\n }\n _buildInstruction(entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) {\n return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst);\n }\n destroyInnerAnimations(containerElement) {\n let elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true);\n elements.forEach(element => this.destroyActiveAnimationsForElement(element));\n if (this.playersByQueriedElement.size == 0) return;\n elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true);\n elements.forEach(element => this.finishActiveQueriedAnimationOnElement(element));\n }\n destroyActiveAnimationsForElement(element) {\n const players = this.playersByElement.get(element);\n if (players) {\n players.forEach(player => {\n // special case for when an element is set for destruction, but hasn't started.\n // in this situation we want to delay the destruction until the flush occurs\n // so that any event listeners attached to the player are triggered.\n if (player.queued) {\n player.markedForDestroy = true;\n } else {\n player.destroy();\n }\n });\n }\n }\n finishActiveQueriedAnimationOnElement(element) {\n const players = this.playersByQueriedElement.get(element);\n if (players) {\n players.forEach(player => player.finish());\n }\n }\n whenRenderingDone() {\n return new Promise(resolve => {\n if (this.players.length) {\n return optimizeGroupPlayer(this.players).onDone(() => resolve());\n } else {\n resolve();\n }\n });\n }\n processLeaveNode(element) {\n const details = element[REMOVAL_FLAG];\n if (details && details.setForRemoval) {\n // this will prevent it from removing it twice\n element[REMOVAL_FLAG] = NULL_REMOVAL_STATE;\n if (details.namespaceId) {\n this.destroyInnerAnimations(element);\n const ns = this._fetchNamespace(details.namespaceId);\n if (ns) {\n ns.clearElementCache(element);\n }\n }\n this._onRemovalComplete(element, details.setForRemoval);\n }\n if (element.classList?.contains(DISABLED_CLASSNAME)) {\n this.markElementAsDisabled(element, false);\n }\n this.driver.query(element, DISABLED_SELECTOR, true).forEach(node => {\n this.markElementAsDisabled(node, false);\n });\n }\n flush(microtaskId = -1) {\n let players = [];\n if (this.newHostElements.size) {\n this.newHostElements.forEach((ns, element) => this._balanceNamespaceList(ns, element));\n this.newHostElements.clear();\n }\n if (this.totalAnimations && this.collectedEnterElements.length) {\n for (let i = 0; i < this.collectedEnterElements.length; i++) {\n const elm = this.collectedEnterElements[i];\n addClass(elm, STAR_CLASSNAME);\n }\n }\n if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) {\n const cleanupFns = [];\n try {\n players = this._flushAnimations(cleanupFns, microtaskId);\n } finally {\n for (let i = 0; i < cleanupFns.length; i++) {\n cleanupFns[i]();\n }\n }\n } else {\n for (let i = 0; i < this.collectedLeaveElements.length; i++) {\n const element = this.collectedLeaveElements[i];\n this.processLeaveNode(element);\n }\n }\n this.totalQueuedPlayers = 0;\n this.collectedEnterElements.length = 0;\n this.collectedLeaveElements.length = 0;\n this._flushFns.forEach(fn => fn());\n this._flushFns = [];\n if (this._whenQuietFns.length) {\n // we move these over to a variable so that\n // if any new callbacks are registered in another\n // flush they do not populate the existing set\n const quietFns = this._whenQuietFns;\n this._whenQuietFns = [];\n if (players.length) {\n optimizeGroupPlayer(players).onDone(() => {\n quietFns.forEach(fn => fn());\n });\n } else {\n quietFns.forEach(fn => fn());\n }\n }\n }\n reportError(errors) {\n throw triggerTransitionsFailed(errors);\n }\n _flushAnimations(cleanupFns, microtaskId) {\n const subTimelines = new ElementInstructionMap();\n const skippedPlayers = [];\n const skippedPlayersMap = new Map();\n const queuedInstructions = [];\n const queriedElements = new Map();\n const allPreStyleElements = new Map();\n const allPostStyleElements = new Map();\n const disabledElementsSet = new Set();\n this.disabledNodes.forEach(node => {\n disabledElementsSet.add(node);\n const nodesThatAreDisabled = this.driver.query(node, QUEUED_SELECTOR, true);\n for (let i = 0; i < nodesThatAreDisabled.length; i++) {\n disabledElementsSet.add(nodesThatAreDisabled[i]);\n }\n });\n const bodyNode = this.bodyNode;\n const allTriggerElements = Array.from(this.statesByElement.keys());\n const enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements);\n // this must occur before the instructions are built below such that\n // the :enter queries match the elements (since the timeline queries\n // are fired during instruction building).\n const enterNodeMapIds = new Map();\n let i = 0;\n enterNodeMap.forEach((nodes, root) => {\n const className = ENTER_CLASSNAME + i++;\n enterNodeMapIds.set(root, className);\n nodes.forEach(node => addClass(node, className));\n });\n const allLeaveNodes = [];\n const mergedLeaveNodes = new Set();\n const leaveNodesWithoutAnimations = new Set();\n for (let i = 0; i < this.collectedLeaveElements.length; i++) {\n const element = this.collectedLeaveElements[i];\n const details = element[REMOVAL_FLAG];\n if (details && details.setForRemoval) {\n allLeaveNodes.push(element);\n mergedLeaveNodes.add(element);\n if (details.hasAnimation) {\n this.driver.query(element, STAR_SELECTOR, true).forEach(elm => mergedLeaveNodes.add(elm));\n } else {\n leaveNodesWithoutAnimations.add(element);\n }\n }\n }\n const leaveNodeMapIds = new Map();\n const leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes));\n leaveNodeMap.forEach((nodes, root) => {\n const className = LEAVE_CLASSNAME + i++;\n leaveNodeMapIds.set(root, className);\n nodes.forEach(node => addClass(node, className));\n });\n cleanupFns.push(() => {\n enterNodeMap.forEach((nodes, root) => {\n const className = enterNodeMapIds.get(root);\n nodes.forEach(node => removeClass(node, className));\n });\n leaveNodeMap.forEach((nodes, root) => {\n const className = leaveNodeMapIds.get(root);\n nodes.forEach(node => removeClass(node, className));\n });\n allLeaveNodes.forEach(element => {\n this.processLeaveNode(element);\n });\n });\n const allPlayers = [];\n const erroneousTransitions = [];\n for (let i = this._namespaceList.length - 1; i >= 0; i--) {\n const ns = this._namespaceList[i];\n ns.drainQueuedTransitions(microtaskId).forEach(entry => {\n const player = entry.player;\n const element = entry.element;\n allPlayers.push(player);\n if (this.collectedEnterElements.length) {\n const details = element[REMOVAL_FLAG];\n // animations for move operations (elements being removed and reinserted,\n // e.g. when the order of an *ngFor list changes) are currently not supported\n if (details && details.setForMove) {\n if (details.previousTriggersValues && details.previousTriggersValues.has(entry.triggerName)) {\n const previousValue = details.previousTriggersValues.get(entry.triggerName);\n // we need to restore the previous trigger value since the element has\n // only been moved and hasn't actually left the DOM\n const triggersWithStates = this.statesByElement.get(entry.element);\n if (triggersWithStates && triggersWithStates.has(entry.triggerName)) {\n const state = triggersWithStates.get(entry.triggerName);\n state.value = previousValue;\n triggersWithStates.set(entry.triggerName, state);\n }\n }\n player.destroy();\n return;\n }\n }\n const nodeIsOrphaned = !bodyNode || !this.driver.containsElement(bodyNode, element);\n const leaveClassName = leaveNodeMapIds.get(element);\n const enterClassName = enterNodeMapIds.get(element);\n const instruction = this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned);\n if (instruction.errors && instruction.errors.length) {\n erroneousTransitions.push(instruction);\n return;\n }\n // even though the element may not be in the DOM, it may still\n // be added at a later point (due to the mechanics of content\n // projection and/or dynamic component insertion) therefore it's\n // important to still style the element.\n if (nodeIsOrphaned) {\n player.onStart(() => eraseStyles(element, instruction.fromStyles));\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n skippedPlayers.push(player);\n return;\n }\n // if an unmatched transition is queued and ready to go\n // then it SHOULD NOT render an animation and cancel the\n // previously running animations.\n if (entry.isFallbackTransition) {\n player.onStart(() => eraseStyles(element, instruction.fromStyles));\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n skippedPlayers.push(player);\n return;\n }\n // this means that if a parent animation uses this animation as a sub-trigger\n // then it will instruct the timeline builder not to add a player delay, but\n // instead stretch the first keyframe gap until the animation starts. This is\n // important in order to prevent extra initialization styles from being\n // required by the user for the animation.\n const timelines = [];\n instruction.timelines.forEach(tl => {\n tl.stretchStartingKeyframe = true;\n if (!this.disabledNodes.has(tl.element)) {\n timelines.push(tl);\n }\n });\n instruction.timelines = timelines;\n subTimelines.append(element, instruction.timelines);\n const tuple = {\n instruction,\n player,\n element\n };\n queuedInstructions.push(tuple);\n instruction.queriedElements.forEach(element => getOrSetDefaultValue(queriedElements, element, []).push(player));\n instruction.preStyleProps.forEach((stringMap, element) => {\n if (stringMap.size) {\n let setVal = allPreStyleElements.get(element);\n if (!setVal) {\n allPreStyleElements.set(element, setVal = new Set());\n }\n stringMap.forEach((_, prop) => setVal.add(prop));\n }\n });\n instruction.postStyleProps.forEach((stringMap, element) => {\n let setVal = allPostStyleElements.get(element);\n if (!setVal) {\n allPostStyleElements.set(element, setVal = new Set());\n }\n stringMap.forEach((_, prop) => setVal.add(prop));\n });\n });\n }\n if (erroneousTransitions.length) {\n const errors = [];\n erroneousTransitions.forEach(instruction => {\n errors.push(transitionFailed(instruction.triggerName, instruction.errors));\n });\n allPlayers.forEach(player => player.destroy());\n this.reportError(errors);\n }\n const allPreviousPlayersMap = new Map();\n // this map tells us which element in the DOM tree is contained by\n // which animation. Further down this map will get populated once\n // the players are built and in doing so we can use it to efficiently\n // figure out if a sub player is skipped due to a parent player having priority.\n const animationElementMap = new Map();\n queuedInstructions.forEach(entry => {\n const element = entry.element;\n if (subTimelines.has(element)) {\n animationElementMap.set(element, element);\n this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap);\n }\n });\n skippedPlayers.forEach(player => {\n const element = player.element;\n const previousPlayers = this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null);\n previousPlayers.forEach(prevPlayer => {\n getOrSetDefaultValue(allPreviousPlayersMap, element, []).push(prevPlayer);\n prevPlayer.destroy();\n });\n });\n // this is a special case for nodes that will be removed either by\n // having their own leave animations or by being queried in a container\n // that will be removed once a parent animation is complete. The idea\n // here is that * styles must be identical to ! styles because of\n // backwards compatibility (* is also filled in by default in many places).\n // Otherwise * styles will return an empty value or \"auto\" since the element\n // passed to getComputedStyle will not be visible (since * === destination)\n const replaceNodes = allLeaveNodes.filter(node => {\n return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements);\n });\n // POST STAGE: fill the * styles\n const postStylesMap = new Map();\n const allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, AUTO_STYLE);\n allLeaveQueriedNodes.forEach(node => {\n if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) {\n replaceNodes.push(node);\n }\n });\n // PRE STAGE: fill the ! styles\n const preStylesMap = new Map();\n enterNodeMap.forEach((nodes, root) => {\n cloakAndComputeStyles(preStylesMap, this.driver, new Set(nodes), allPreStyleElements, ɵPRE_STYLE);\n });\n replaceNodes.forEach(node => {\n const post = postStylesMap.get(node);\n const pre = preStylesMap.get(node);\n postStylesMap.set(node, new Map([...(post?.entries() ?? []), ...(pre?.entries() ?? [])]));\n });\n const rootPlayers = [];\n const subPlayers = [];\n const NO_PARENT_ANIMATION_ELEMENT_DETECTED = {};\n queuedInstructions.forEach(entry => {\n const {\n element,\n player,\n instruction\n } = entry;\n // this means that it was never consumed by a parent animation which\n // means that it is independent and therefore should be set for animation\n if (subTimelines.has(element)) {\n if (disabledElementsSet.has(element)) {\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n player.disabled = true;\n player.overrideTotalTime(instruction.totalTime);\n skippedPlayers.push(player);\n return;\n }\n // this will flow up the DOM and query the map to figure out\n // if a parent animation has priority over it. In the situation\n // that a parent is detected then it will cancel the loop. If\n // nothing is detected, or it takes a few hops to find a parent,\n // then it will fill in the missing nodes and signal them as having\n // a detected parent (or a NO_PARENT value via a special constant).\n let parentWithAnimation = NO_PARENT_ANIMATION_ELEMENT_DETECTED;\n if (animationElementMap.size > 1) {\n let elm = element;\n const parentsToAdd = [];\n while (elm = elm.parentNode) {\n const detectedParent = animationElementMap.get(elm);\n if (detectedParent) {\n parentWithAnimation = detectedParent;\n break;\n }\n parentsToAdd.push(elm);\n }\n parentsToAdd.forEach(parent => animationElementMap.set(parent, parentWithAnimation));\n }\n const innerPlayer = this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap);\n player.setRealPlayer(innerPlayer);\n if (parentWithAnimation === NO_PARENT_ANIMATION_ELEMENT_DETECTED) {\n rootPlayers.push(player);\n } else {\n const parentPlayers = this.playersByElement.get(parentWithAnimation);\n if (parentPlayers && parentPlayers.length) {\n player.parentPlayer = optimizeGroupPlayer(parentPlayers);\n }\n skippedPlayers.push(player);\n }\n } else {\n eraseStyles(element, instruction.fromStyles);\n player.onDestroy(() => setStyles(element, instruction.toStyles));\n // there still might be a ancestor player animating this\n // element therefore we will still add it as a sub player\n // even if its animation may be disabled\n subPlayers.push(player);\n if (disabledElementsSet.has(element)) {\n skippedPlayers.push(player);\n }\n }\n });\n // find all of the sub players' corresponding inner animation players\n subPlayers.forEach(player => {\n // even if no players are found for a sub animation it\n // will still complete itself after the next tick since it's Noop\n const playersForElement = skippedPlayersMap.get(player.element);\n if (playersForElement && playersForElement.length) {\n const innerPlayer = optimizeGroupPlayer(playersForElement);\n player.setRealPlayer(innerPlayer);\n }\n });\n // the reason why we don't actually play the animation is\n // because all that a skipped player is designed to do is to\n // fire the start/done transition callback events\n skippedPlayers.forEach(player => {\n if (player.parentPlayer) {\n player.syncPlayerEvents(player.parentPlayer);\n } else {\n player.destroy();\n }\n });\n // run through all of the queued removals and see if they\n // were picked up by a query. If not then perform the removal\n // operation right away unless a parent animation is ongoing.\n for (let i = 0; i < allLeaveNodes.length; i++) {\n const element = allLeaveNodes[i];\n const details = element[REMOVAL_FLAG];\n removeClass(element, LEAVE_CLASSNAME);\n // this means the element has a removal animation that is being\n // taken care of and therefore the inner elements will hang around\n // until that animation is over (or the parent queried animation)\n if (details && details.hasAnimation) continue;\n let players = [];\n // if this element is queried or if it contains queried children\n // then we want for the element not to be removed from the page\n // until the queried animations have finished\n if (queriedElements.size) {\n let queriedPlayerResults = queriedElements.get(element);\n if (queriedPlayerResults && queriedPlayerResults.length) {\n players.push(...queriedPlayerResults);\n }\n let queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true);\n for (let j = 0; j < queriedInnerElements.length; j++) {\n let queriedPlayers = queriedElements.get(queriedInnerElements[j]);\n if (queriedPlayers && queriedPlayers.length) {\n players.push(...queriedPlayers);\n }\n }\n }\n const activePlayers = players.filter(p => !p.destroyed);\n if (activePlayers.length) {\n removeNodesAfterAnimationDone(this, element, activePlayers);\n } else {\n this.processLeaveNode(element);\n }\n }\n // this is required so the cleanup method doesn't remove them\n allLeaveNodes.length = 0;\n rootPlayers.forEach(player => {\n this.players.push(player);\n player.onDone(() => {\n player.destroy();\n const index = this.players.indexOf(player);\n this.players.splice(index, 1);\n });\n player.play();\n });\n return rootPlayers;\n }\n afterFlush(callback) {\n this._flushFns.push(callback);\n }\n afterFlushAnimationsDone(callback) {\n this._whenQuietFns.push(callback);\n }\n _getPreviousPlayers(element, isQueriedElement, namespaceId, triggerName, toStateValue) {\n let players = [];\n if (isQueriedElement) {\n const queriedElementPlayers = this.playersByQueriedElement.get(element);\n if (queriedElementPlayers) {\n players = queriedElementPlayers;\n }\n } else {\n const elementPlayers = this.playersByElement.get(element);\n if (elementPlayers) {\n const isRemovalAnimation = !toStateValue || toStateValue == VOID_VALUE;\n elementPlayers.forEach(player => {\n if (player.queued) return;\n if (!isRemovalAnimation && player.triggerName != triggerName) return;\n players.push(player);\n });\n }\n }\n if (namespaceId || triggerName) {\n players = players.filter(player => {\n if (namespaceId && namespaceId != player.namespaceId) return false;\n if (triggerName && triggerName != player.triggerName) return false;\n return true;\n });\n }\n return players;\n }\n _beforeAnimationBuild(namespaceId, instruction, allPreviousPlayersMap) {\n const triggerName = instruction.triggerName;\n const rootElement = instruction.element;\n // when a removal animation occurs, ALL previous players are collected\n // and destroyed (even if they are outside of the current namespace)\n const targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId;\n const targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName;\n for (const timelineInstruction of instruction.timelines) {\n const element = timelineInstruction.element;\n const isQueriedElement = element !== rootElement;\n const players = getOrSetDefaultValue(allPreviousPlayersMap, element, []);\n const previousPlayers = this._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState);\n previousPlayers.forEach(player => {\n const realPlayer = player.getRealPlayer();\n if (realPlayer.beforeDestroy) {\n realPlayer.beforeDestroy();\n }\n player.destroy();\n players.push(player);\n });\n }\n // this needs to be done so that the PRE/POST styles can be\n // computed properly without interfering with the previous animation\n eraseStyles(rootElement, instruction.fromStyles);\n }\n _buildAnimation(namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) {\n const triggerName = instruction.triggerName;\n const rootElement = instruction.element;\n // we first run this so that the previous animation player\n // data can be passed into the successive animation players\n const allQueriedPlayers = [];\n const allConsumedElements = new Set();\n const allSubElements = new Set();\n const allNewPlayers = instruction.timelines.map(timelineInstruction => {\n const element = timelineInstruction.element;\n allConsumedElements.add(element);\n // FIXME (matsko): make sure to-be-removed animations are removed properly\n const details = element[REMOVAL_FLAG];\n if (details && details.removedBeforeQueried) return new NoopAnimationPlayer(timelineInstruction.duration, timelineInstruction.delay);\n const isQueriedElement = element !== rootElement;\n const previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY).map(p => p.getRealPlayer())).filter(p => {\n // the `element` is not apart of the AnimationPlayer definition, but\n // Mock/WebAnimations\n // use the element within their implementation. This will be added in Angular5 to\n // AnimationPlayer\n const pp = p;\n return pp.element ? pp.element === element : false;\n });\n const preStyles = preStylesMap.get(element);\n const postStyles = postStylesMap.get(element);\n const keyframes = normalizeKeyframes$1(this._normalizer, timelineInstruction.keyframes, preStyles, postStyles);\n const player = this._buildPlayer(timelineInstruction, keyframes, previousPlayers);\n // this means that this particular player belongs to a sub trigger. It is\n // important that we match this player up with the corresponding (@trigger.listener)\n if (timelineInstruction.subTimeline && skippedPlayersMap) {\n allSubElements.add(element);\n }\n if (isQueriedElement) {\n const wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element);\n wrappedPlayer.setRealPlayer(player);\n allQueriedPlayers.push(wrappedPlayer);\n }\n return player;\n });\n allQueriedPlayers.forEach(player => {\n getOrSetDefaultValue(this.playersByQueriedElement, player.element, []).push(player);\n player.onDone(() => deleteOrUnsetInMap(this.playersByQueriedElement, player.element, player));\n });\n allConsumedElements.forEach(element => addClass(element, NG_ANIMATING_CLASSNAME));\n const player = optimizeGroupPlayer(allNewPlayers);\n player.onDestroy(() => {\n allConsumedElements.forEach(element => removeClass(element, NG_ANIMATING_CLASSNAME));\n setStyles(rootElement, instruction.toStyles);\n });\n // this basically makes all of the callbacks for sub element animations\n // be dependent on the upper players for when they finish\n allSubElements.forEach(element => {\n getOrSetDefaultValue(skippedPlayersMap, element, []).push(player);\n });\n return player;\n }\n _buildPlayer(instruction, keyframes, previousPlayers) {\n if (keyframes.length > 0) {\n return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers);\n }\n // special case for when an empty transition|definition is provided\n // ... there is no point in rendering an empty animation\n return new NoopAnimationPlayer(instruction.duration, instruction.delay);\n }\n}\nclass TransitionAnimationPlayer {\n constructor(namespaceId, triggerName, element) {\n this.namespaceId = namespaceId;\n this.triggerName = triggerName;\n this.element = element;\n this._player = new NoopAnimationPlayer();\n this._containsRealPlayer = false;\n this._queuedCallbacks = new Map();\n this.destroyed = false;\n this.parentPlayer = null;\n this.markedForDestroy = false;\n this.disabled = false;\n this.queued = true;\n this.totalTime = 0;\n }\n setRealPlayer(player) {\n if (this._containsRealPlayer) return;\n this._player = player;\n this._queuedCallbacks.forEach((callbacks, phase) => {\n callbacks.forEach(callback => listenOnPlayer(player, phase, undefined, callback));\n });\n this._queuedCallbacks.clear();\n this._containsRealPlayer = true;\n this.overrideTotalTime(player.totalTime);\n this.queued = false;\n }\n getRealPlayer() {\n return this._player;\n }\n overrideTotalTime(totalTime) {\n this.totalTime = totalTime;\n }\n syncPlayerEvents(player) {\n const p = this._player;\n if (p.triggerCallback) {\n player.onStart(() => p.triggerCallback('start'));\n }\n player.onDone(() => this.finish());\n player.onDestroy(() => this.destroy());\n }\n _queueEvent(name, callback) {\n getOrSetDefaultValue(this._queuedCallbacks, name, []).push(callback);\n }\n onDone(fn) {\n if (this.queued) {\n this._queueEvent('done', fn);\n }\n this._player.onDone(fn);\n }\n onStart(fn) {\n if (this.queued) {\n this._queueEvent('start', fn);\n }\n this._player.onStart(fn);\n }\n onDestroy(fn) {\n if (this.queued) {\n this._queueEvent('destroy', fn);\n }\n this._player.onDestroy(fn);\n }\n init() {\n this._player.init();\n }\n hasStarted() {\n return this.queued ? false : this._player.hasStarted();\n }\n play() {\n !this.queued && this._player.play();\n }\n pause() {\n !this.queued && this._player.pause();\n }\n restart() {\n !this.queued && this._player.restart();\n }\n finish() {\n this._player.finish();\n }\n destroy() {\n this.destroyed = true;\n this._player.destroy();\n }\n reset() {\n !this.queued && this._player.reset();\n }\n setPosition(p) {\n if (!this.queued) {\n this._player.setPosition(p);\n }\n }\n getPosition() {\n return this.queued ? 0 : this._player.getPosition();\n }\n /** @internal */\n triggerCallback(phaseName) {\n const p = this._player;\n if (p.triggerCallback) {\n p.triggerCallback(phaseName);\n }\n }\n}\nfunction deleteOrUnsetInMap(map, key, value) {\n let currentValues = map.get(key);\n if (currentValues) {\n if (currentValues.length) {\n const index = currentValues.indexOf(value);\n currentValues.splice(index, 1);\n }\n if (currentValues.length == 0) {\n map.delete(key);\n }\n }\n return currentValues;\n}\nfunction normalizeTriggerValue(value) {\n // we use `!= null` here because it's the most simple\n // way to test against a \"falsy\" value without mixing\n // in empty strings or a zero value. DO NOT OPTIMIZE.\n return value != null ? value : null;\n}\nfunction isElementNode(node) {\n return node && node['nodeType'] === 1;\n}\nfunction isTriggerEventValid(eventName) {\n return eventName == 'start' || eventName == 'done';\n}\nfunction cloakElement(element, value) {\n const oldValue = element.style.display;\n element.style.display = value != null ? value : 'none';\n return oldValue;\n}\nfunction cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) {\n const cloakVals = [];\n elements.forEach(element => cloakVals.push(cloakElement(element)));\n const failedElements = [];\n elementPropsMap.forEach((props, element) => {\n const styles = new Map();\n props.forEach(prop => {\n const value = driver.computeStyle(element, prop, defaultStyle);\n styles.set(prop, value);\n // there is no easy way to detect this because a sub element could be removed\n // by a parent animation element being detached.\n if (!value || value.length == 0) {\n element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE;\n failedElements.push(element);\n }\n });\n valuesMap.set(element, styles);\n });\n // we use a index variable here since Set.forEach(a, i) does not return\n // an index value for the closure (but instead just the value)\n let i = 0;\n elements.forEach(element => cloakElement(element, cloakVals[i++]));\n return failedElements;\n}\n/*\nSince the Angular renderer code will return a collection of inserted\nnodes in all areas of a DOM tree, it's up to this algorithm to figure\nout which nodes are roots for each animation @trigger.\n\nBy placing each inserted node into a Set and traversing upwards, it\nis possible to find the @trigger elements and well any direct *star\ninsertion nodes, if a @trigger root is found then the enter element\nis placed into the Map[@trigger] spot.\n */\nfunction buildRootMap(roots, nodes) {\n const rootMap = new Map();\n roots.forEach(root => rootMap.set(root, []));\n if (nodes.length == 0) return rootMap;\n const NULL_NODE = 1;\n const nodeSet = new Set(nodes);\n const localRootMap = new Map();\n function getRoot(node) {\n if (!node) return NULL_NODE;\n let root = localRootMap.get(node);\n if (root) return root;\n const parent = node.parentNode;\n if (rootMap.has(parent)) {\n // ngIf inside @trigger\n root = parent;\n } else if (nodeSet.has(parent)) {\n // ngIf inside ngIf\n root = NULL_NODE;\n } else {\n // recurse upwards\n root = getRoot(parent);\n }\n localRootMap.set(node, root);\n return root;\n }\n nodes.forEach(node => {\n const root = getRoot(node);\n if (root !== NULL_NODE) {\n rootMap.get(root).push(node);\n }\n });\n return rootMap;\n}\nfunction addClass(element, className) {\n element.classList?.add(className);\n}\nfunction removeClass(element, className) {\n element.classList?.remove(className);\n}\nfunction removeNodesAfterAnimationDone(engine, element, players) {\n optimizeGroupPlayer(players).onDone(() => engine.processLeaveNode(element));\n}\nfunction flattenGroupPlayers(players) {\n const finalPlayers = [];\n _flattenGroupPlayersRecur(players, finalPlayers);\n return finalPlayers;\n}\nfunction _flattenGroupPlayersRecur(players, finalPlayers) {\n for (let i = 0; i < players.length; i++) {\n const player = players[i];\n if (player instanceof ɵAnimationGroupPlayer) {\n _flattenGroupPlayersRecur(player.players, finalPlayers);\n } else {\n finalPlayers.push(player);\n }\n }\n}\nfunction objEquals(a, b) {\n const k1 = Object.keys(a);\n const k2 = Object.keys(b);\n if (k1.length != k2.length) return false;\n for (let i = 0; i < k1.length; i++) {\n const prop = k1[i];\n if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) return false;\n }\n return true;\n}\nfunction replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) {\n const postEntry = allPostStyleElements.get(element);\n if (!postEntry) return false;\n let preEntry = allPreStyleElements.get(element);\n if (preEntry) {\n postEntry.forEach(data => preEntry.add(data));\n } else {\n allPreStyleElements.set(element, postEntry);\n }\n allPostStyleElements.delete(element);\n return true;\n}\nclass AnimationEngine {\n constructor(doc, _driver, _normalizer) {\n this._driver = _driver;\n this._normalizer = _normalizer;\n this._triggerCache = {};\n // this method is designed to be overridden by the code that uses this engine\n this.onRemovalComplete = (element, context) => {};\n this._transitionEngine = new TransitionAnimationEngine(doc.body, _driver, _normalizer);\n this._timelineEngine = new TimelineAnimationEngine(doc.body, _driver, _normalizer);\n this._transitionEngine.onRemovalComplete = (element, context) => this.onRemovalComplete(element, context);\n }\n registerTrigger(componentId, namespaceId, hostElement, name, metadata) {\n const cacheKey = componentId + '-' + name;\n let trigger = this._triggerCache[cacheKey];\n if (!trigger) {\n const errors = [];\n const warnings = [];\n const ast = buildAnimationAst(this._driver, metadata, errors, warnings);\n if (errors.length) {\n throw triggerBuildFailed(name, errors);\n }\n if (warnings.length) {\n warnTriggerBuild(name, warnings);\n }\n trigger = buildTrigger(name, ast, this._normalizer);\n this._triggerCache[cacheKey] = trigger;\n }\n this._transitionEngine.registerTrigger(namespaceId, name, trigger);\n }\n register(namespaceId, hostElement) {\n this._transitionEngine.register(namespaceId, hostElement);\n }\n destroy(namespaceId, context) {\n this._transitionEngine.destroy(namespaceId, context);\n }\n onInsert(namespaceId, element, parent, insertBefore) {\n this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore);\n }\n onRemove(namespaceId, element, context) {\n this._transitionEngine.removeNode(namespaceId, element, context);\n }\n disableAnimations(element, disable) {\n this._transitionEngine.markElementAsDisabled(element, disable);\n }\n process(namespaceId, element, property, value) {\n if (property.charAt(0) == '@') {\n const [id, action] = parseTimelineCommand(property);\n const args = value;\n this._timelineEngine.command(id, element, action, args);\n } else {\n this._transitionEngine.trigger(namespaceId, element, property, value);\n }\n }\n listen(namespaceId, element, eventName, eventPhase, callback) {\n // @@listen\n if (eventName.charAt(0) == '@') {\n const [id, action] = parseTimelineCommand(eventName);\n return this._timelineEngine.listen(id, element, action, callback);\n }\n return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback);\n }\n flush(microtaskId = -1) {\n this._transitionEngine.flush(microtaskId);\n }\n get players() {\n return [...this._transitionEngine.players, ...this._timelineEngine.players];\n }\n whenRenderingDone() {\n return this._transitionEngine.whenRenderingDone();\n }\n afterFlushAnimationsDone(cb) {\n this._transitionEngine.afterFlushAnimationsDone(cb);\n }\n}\n\n/**\n * Returns an instance of `SpecialCasedStyles` if and when any special (non animateable) styles are\n * detected.\n *\n * In CSS there exist properties that cannot be animated within a keyframe animation\n * (whether it be via CSS keyframes or web-animations) and the animation implementation\n * will ignore them. This function is designed to detect those special cased styles and\n * return a container that will be executed at the start and end of the animation.\n *\n * @returns an instance of `SpecialCasedStyles` if any special styles are detected otherwise `null`\n */\nfunction packageNonAnimatableStyles(element, styles) {\n let startStyles = null;\n let endStyles = null;\n if (Array.isArray(styles) && styles.length) {\n startStyles = filterNonAnimatableStyles(styles[0]);\n if (styles.length > 1) {\n endStyles = filterNonAnimatableStyles(styles[styles.length - 1]);\n }\n } else if (styles instanceof Map) {\n startStyles = filterNonAnimatableStyles(styles);\n }\n return startStyles || endStyles ? new SpecialCasedStyles(element, startStyles, endStyles) : null;\n}\n/**\n * Designed to be executed during a keyframe-based animation to apply any special-cased styles.\n *\n * When started (when the `start()` method is run) then the provided `startStyles`\n * will be applied. When finished (when the `finish()` method is called) the\n * `endStyles` will be applied as well any any starting styles. Finally when\n * `destroy()` is called then all styles will be removed.\n */\nclass SpecialCasedStyles {\n static {\n this.initialStylesByElement = /*#__PURE__*/new WeakMap();\n }\n constructor(_element, _startStyles, _endStyles) {\n this._element = _element;\n this._startStyles = _startStyles;\n this._endStyles = _endStyles;\n this._state = 0 /* SpecialCasedStylesState.Pending */;\n let initialStyles = SpecialCasedStyles.initialStylesByElement.get(_element);\n if (!initialStyles) {\n SpecialCasedStyles.initialStylesByElement.set(_element, initialStyles = new Map());\n }\n this._initialStyles = initialStyles;\n }\n start() {\n if (this._state < 1 /* SpecialCasedStylesState.Started */) {\n if (this._startStyles) {\n setStyles(this._element, this._startStyles, this._initialStyles);\n }\n this._state = 1 /* SpecialCasedStylesState.Started */;\n }\n }\n finish() {\n this.start();\n if (this._state < 2 /* SpecialCasedStylesState.Finished */) {\n setStyles(this._element, this._initialStyles);\n if (this._endStyles) {\n setStyles(this._element, this._endStyles);\n this._endStyles = null;\n }\n this._state = 1 /* SpecialCasedStylesState.Started */;\n }\n }\n destroy() {\n this.finish();\n if (this._state < 3 /* SpecialCasedStylesState.Destroyed */) {\n SpecialCasedStyles.initialStylesByElement.delete(this._element);\n if (this._startStyles) {\n eraseStyles(this._element, this._startStyles);\n this._endStyles = null;\n }\n if (this._endStyles) {\n eraseStyles(this._element, this._endStyles);\n this._endStyles = null;\n }\n setStyles(this._element, this._initialStyles);\n this._state = 3 /* SpecialCasedStylesState.Destroyed */;\n }\n }\n}\nfunction filterNonAnimatableStyles(styles) {\n let result = null;\n styles.forEach((val, prop) => {\n if (isNonAnimatableStyle(prop)) {\n result = result || new Map();\n result.set(prop, val);\n }\n });\n return result;\n}\nfunction isNonAnimatableStyle(prop) {\n return prop === 'display' || prop === 'position';\n}\nclass WebAnimationsPlayer {\n constructor(element, keyframes, options, _specialStyles) {\n this.element = element;\n this.keyframes = keyframes;\n this.options = options;\n this._specialStyles = _specialStyles;\n this._onDoneFns = [];\n this._onStartFns = [];\n this._onDestroyFns = [];\n this._initialized = false;\n this._finished = false;\n this._started = false;\n this._destroyed = false;\n // the following original fns are persistent copies of the _onStartFns and _onDoneFns\n // and are used to reset the fns to their original values upon reset()\n // (since the _onStartFns and _onDoneFns get deleted after they are called)\n this._originalOnDoneFns = [];\n this._originalOnStartFns = [];\n this.time = 0;\n this.parentPlayer = null;\n this.currentSnapshot = new Map();\n this._duration = options['duration'];\n this._delay = options['delay'] || 0;\n this.time = this._duration + this._delay;\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach(fn => fn());\n this._onDoneFns = [];\n }\n }\n init() {\n this._buildPlayer();\n this._preparePlayerBeforeStart();\n }\n _buildPlayer() {\n if (this._initialized) return;\n this._initialized = true;\n const keyframes = this.keyframes;\n // @ts-expect-error overwriting a readonly property\n this.domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options);\n this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : new Map();\n const onFinish = () => this._onFinish();\n this.domPlayer.addEventListener('finish', onFinish);\n this.onDestroy(() => {\n // We must remove the `finish` event listener once an animation has completed all its\n // iterations. This action is necessary to prevent a memory leak since the listener captures\n // `this`, creating a closure that prevents `this` from being garbage collected.\n this.domPlayer.removeEventListener('finish', onFinish);\n });\n }\n _preparePlayerBeforeStart() {\n // this is required so that the player doesn't start to animate right away\n if (this._delay) {\n this._resetDomPlayerState();\n } else {\n this.domPlayer.pause();\n }\n }\n _convertKeyframesToObject(keyframes) {\n const kfs = [];\n keyframes.forEach(frame => {\n kfs.push(Object.fromEntries(frame));\n });\n return kfs;\n }\n /** @internal */\n _triggerWebAnimation(element, keyframes, options) {\n return element.animate(this._convertKeyframesToObject(keyframes), options);\n }\n onStart(fn) {\n this._originalOnStartFns.push(fn);\n this._onStartFns.push(fn);\n }\n onDone(fn) {\n this._originalOnDoneFns.push(fn);\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n play() {\n this._buildPlayer();\n if (!this.hasStarted()) {\n this._onStartFns.forEach(fn => fn());\n this._onStartFns = [];\n this._started = true;\n if (this._specialStyles) {\n this._specialStyles.start();\n }\n }\n this.domPlayer.play();\n }\n pause() {\n this.init();\n this.domPlayer.pause();\n }\n finish() {\n this.init();\n if (this._specialStyles) {\n this._specialStyles.finish();\n }\n this._onFinish();\n this.domPlayer.finish();\n }\n reset() {\n this._resetDomPlayerState();\n this._destroyed = false;\n this._finished = false;\n this._started = false;\n this._onStartFns = this._originalOnStartFns;\n this._onDoneFns = this._originalOnDoneFns;\n }\n _resetDomPlayerState() {\n if (this.domPlayer) {\n this.domPlayer.cancel();\n }\n }\n restart() {\n this.reset();\n this.play();\n }\n hasStarted() {\n return this._started;\n }\n destroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n this._resetDomPlayerState();\n this._onFinish();\n if (this._specialStyles) {\n this._specialStyles.destroy();\n }\n this._onDestroyFns.forEach(fn => fn());\n this._onDestroyFns = [];\n }\n }\n setPosition(p) {\n if (this.domPlayer === undefined) {\n this.init();\n }\n this.domPlayer.currentTime = p * this.time;\n }\n getPosition() {\n // tsc is complaining with TS2362 without the conversion to number\n return +(this.domPlayer.currentTime ?? 0) / this.time;\n }\n get totalTime() {\n return this._delay + this._duration;\n }\n beforeDestroy() {\n const styles = new Map();\n if (this.hasStarted()) {\n // note: this code is invoked only when the `play` function was called prior to this\n // (thus `hasStarted` returns true), this implies that the code that initializes\n // `_finalKeyframe` has also been executed and the non-null assertion can be safely used here\n const finalKeyframe = this._finalKeyframe;\n finalKeyframe.forEach((val, prop) => {\n if (prop !== 'offset') {\n styles.set(prop, this._finished ? val : computeStyle(this.element, prop));\n }\n });\n }\n this.currentSnapshot = styles;\n }\n /** @internal */\n triggerCallback(phaseName) {\n const methods = phaseName === 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach(fn => fn());\n methods.length = 0;\n }\n}\nclass WebAnimationsDriver {\n validateStyleProperty(prop) {\n // Perform actual validation in dev mode only, in prod mode this check is a noop.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n return validateStyleProperty(prop);\n }\n return true;\n }\n validateAnimatableStyleProperty(prop) {\n // Perform actual validation in dev mode only, in prod mode this check is a noop.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const cssProp = camelCaseToDashCase(prop);\n return validateWebAnimatableStyleProperty(cssProp);\n }\n return true;\n }\n containsElement(elm1, elm2) {\n return containsElement(elm1, elm2);\n }\n getParentElement(element) {\n return getParentElement(element);\n }\n query(element, selector, multi) {\n return invokeQuery(element, selector, multi);\n }\n computeStyle(element, prop, defaultValue) {\n return computeStyle(element, prop);\n }\n animate(element, keyframes, duration, delay, easing, previousPlayers = []) {\n const fill = delay == 0 ? 'both' : 'forwards';\n const playerOptions = {\n duration,\n delay,\n fill\n };\n // we check for this to avoid having a null|undefined value be present\n // for the easing (which results in an error for certain browsers #9752)\n if (easing) {\n playerOptions['easing'] = easing;\n }\n const previousStyles = new Map();\n const previousWebAnimationPlayers = previousPlayers.filter(player => player instanceof WebAnimationsPlayer);\n if (allowPreviousPlayerStylesMerge(duration, delay)) {\n previousWebAnimationPlayers.forEach(player => {\n player.currentSnapshot.forEach((val, prop) => previousStyles.set(prop, val));\n });\n }\n let _keyframes = normalizeKeyframes(keyframes).map(styles => new Map(styles));\n _keyframes = balancePreviousStylesIntoKeyframes(element, _keyframes, previousStyles);\n const specialStyles = packageNonAnimatableStyles(element, _keyframes);\n return new WebAnimationsPlayer(element, _keyframes, playerOptions, specialStyles);\n }\n}\nfunction createEngine(type, doc) {\n // TODO: find a way to make this tree shakable.\n if (type === 'noop') {\n return new AnimationEngine(doc, new NoopAnimationDriver(), new NoopAnimationStyleNormalizer());\n }\n return new AnimationEngine(doc, new WebAnimationsDriver(), new WebAnimationsStyleNormalizer());\n}\nclass Animation {\n constructor(_driver, input) {\n this._driver = _driver;\n const errors = [];\n const warnings = [];\n const ast = buildAnimationAst(_driver, input, errors, warnings);\n if (errors.length) {\n throw validationFailed(errors);\n }\n if (warnings.length) {\n warnValidation(warnings);\n }\n this._animationAst = ast;\n }\n buildTimelines(element, startingStyles, destinationStyles, options, subInstructions) {\n const start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : startingStyles;\n const dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : destinationStyles;\n const errors = [];\n subInstructions = subInstructions || new ElementInstructionMap();\n const result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors);\n if (errors.length) {\n throw buildingFailed(errors);\n }\n return result;\n }\n}\nconst ANIMATION_PREFIX = '@';\nconst DISABLE_ANIMATIONS_FLAG = '@.disabled';\nclass BaseAnimationRenderer {\n constructor(namespaceId, delegate, engine, _onDestroy) {\n this.namespaceId = namespaceId;\n this.delegate = delegate;\n this.engine = engine;\n this._onDestroy = _onDestroy;\n // We need to explicitly type this property because of an api-extractor bug\n // See https://github.com/microsoft/rushstack/issues/4390\n this.ɵtype = 0 /* AnimationRendererType.Regular */;\n }\n get data() {\n return this.delegate.data;\n }\n destroyNode(node) {\n this.delegate.destroyNode?.(node);\n }\n destroy() {\n this.engine.destroy(this.namespaceId, this.delegate);\n this.engine.afterFlushAnimationsDone(() => {\n // Call the renderer destroy method after the animations has finished as otherwise\n // styles will be removed too early which will cause an unstyled animation.\n queueMicrotask(() => {\n this.delegate.destroy();\n });\n });\n this._onDestroy?.();\n }\n createElement(name, namespace) {\n return this.delegate.createElement(name, namespace);\n }\n createComment(value) {\n return this.delegate.createComment(value);\n }\n createText(value) {\n return this.delegate.createText(value);\n }\n appendChild(parent, newChild) {\n this.delegate.appendChild(parent, newChild);\n this.engine.onInsert(this.namespaceId, newChild, parent, false);\n }\n insertBefore(parent, newChild, refChild, isMove = true) {\n this.delegate.insertBefore(parent, newChild, refChild);\n // If `isMove` true than we should animate this insert.\n this.engine.onInsert(this.namespaceId, newChild, parent, isMove);\n }\n removeChild(parent, oldChild, isHostElement) {\n // Prior to the changes in #57203, this method wasn't being called at all by `core` if the child\n // doesn't have a parent. There appears to be some animation-specific downstream logic that\n // depends on the null check happening before the animation engine. This check keeps the old\n // behavior while allowing `core` to not have to check for the parent element anymore.\n if (this.parentNode(oldChild)) {\n this.engine.onRemove(this.namespaceId, oldChild, this.delegate);\n }\n }\n selectRootElement(selectorOrNode, preserveContent) {\n return this.delegate.selectRootElement(selectorOrNode, preserveContent);\n }\n parentNode(node) {\n return this.delegate.parentNode(node);\n }\n nextSibling(node) {\n return this.delegate.nextSibling(node);\n }\n setAttribute(el, name, value, namespace) {\n this.delegate.setAttribute(el, name, value, namespace);\n }\n removeAttribute(el, name, namespace) {\n this.delegate.removeAttribute(el, name, namespace);\n }\n addClass(el, name) {\n this.delegate.addClass(el, name);\n }\n removeClass(el, name) {\n this.delegate.removeClass(el, name);\n }\n setStyle(el, style, value, flags) {\n this.delegate.setStyle(el, style, value, flags);\n }\n removeStyle(el, style, flags) {\n this.delegate.removeStyle(el, style, flags);\n }\n setProperty(el, name, value) {\n if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) {\n this.disableAnimations(el, !!value);\n } else {\n this.delegate.setProperty(el, name, value);\n }\n }\n setValue(node, value) {\n this.delegate.setValue(node, value);\n }\n listen(target, eventName, callback) {\n return this.delegate.listen(target, eventName, callback);\n }\n disableAnimations(element, value) {\n this.engine.disableAnimations(element, value);\n }\n}\nclass AnimationRenderer extends BaseAnimationRenderer {\n constructor(factory, namespaceId, delegate, engine, onDestroy) {\n super(namespaceId, delegate, engine, onDestroy);\n this.factory = factory;\n this.namespaceId = namespaceId;\n }\n setProperty(el, name, value) {\n if (name.charAt(0) == ANIMATION_PREFIX) {\n if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) {\n value = value === undefined ? true : !!value;\n this.disableAnimations(el, value);\n } else {\n this.engine.process(this.namespaceId, el, name.slice(1), value);\n }\n } else {\n this.delegate.setProperty(el, name, value);\n }\n }\n listen(target, eventName, callback) {\n if (eventName.charAt(0) == ANIMATION_PREFIX) {\n const element = resolveElementFromTarget(target);\n let name = eventName.slice(1);\n let phase = '';\n // @listener.phase is for trigger animation callbacks\n // @@listener is for animation builder callbacks\n if (name.charAt(0) != ANIMATION_PREFIX) {\n [name, phase] = parseTriggerCallbackName(name);\n }\n return this.engine.listen(this.namespaceId, element, name, phase, event => {\n const countId = event['_data'] || -1;\n this.factory.scheduleListenerCallback(countId, callback, event);\n });\n }\n return this.delegate.listen(target, eventName, callback);\n }\n}\nfunction resolveElementFromTarget(target) {\n switch (target) {\n case 'body':\n return document.body;\n case 'document':\n return document;\n case 'window':\n return window;\n default:\n return target;\n }\n}\nfunction parseTriggerCallbackName(triggerName) {\n const dotIndex = triggerName.indexOf('.');\n const trigger = triggerName.substring(0, dotIndex);\n const phase = triggerName.slice(dotIndex + 1);\n return [trigger, phase];\n}\nclass AnimationRendererFactory {\n constructor(delegate, engine, _zone) {\n this.delegate = delegate;\n this.engine = engine;\n this._zone = _zone;\n this._currentId = 0;\n this._microtaskId = 1;\n this._animationCallbacksBuffer = [];\n this._rendererCache = new Map();\n this._cdRecurDepth = 0;\n engine.onRemovalComplete = (element, delegate) => {\n delegate?.removeChild(null, element);\n };\n }\n createRenderer(hostElement, type) {\n const EMPTY_NAMESPACE_ID = '';\n // cache the delegates to find out which cached delegate can\n // be used by which cached renderer\n const delegate = this.delegate.createRenderer(hostElement, type);\n if (!hostElement || !type?.data?.['animation']) {\n const cache = this._rendererCache;\n let renderer = cache.get(delegate);\n if (!renderer) {\n // Ensure that the renderer is removed from the cache on destroy\n // since it may contain references to detached DOM nodes.\n const onRendererDestroy = () => cache.delete(delegate);\n renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine, onRendererDestroy);\n // only cache this result when the base renderer is used\n cache.set(delegate, renderer);\n }\n return renderer;\n }\n const componentId = type.id;\n const namespaceId = type.id + '-' + this._currentId;\n this._currentId++;\n this.engine.register(namespaceId, hostElement);\n const registerTrigger = trigger => {\n if (Array.isArray(trigger)) {\n trigger.forEach(registerTrigger);\n } else {\n this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger);\n }\n };\n const animationTriggers = type.data['animation'];\n animationTriggers.forEach(registerTrigger);\n return new AnimationRenderer(this, namespaceId, delegate, this.engine);\n }\n begin() {\n this._cdRecurDepth++;\n if (this.delegate.begin) {\n this.delegate.begin();\n }\n }\n _scheduleCountTask() {\n queueMicrotask(() => {\n this._microtaskId++;\n });\n }\n /** @internal */\n scheduleListenerCallback(count, fn, data) {\n if (count >= 0 && count < this._microtaskId) {\n this._zone.run(() => fn(data));\n return;\n }\n const animationCallbacksBuffer = this._animationCallbacksBuffer;\n if (animationCallbacksBuffer.length == 0) {\n queueMicrotask(() => {\n this._zone.run(() => {\n animationCallbacksBuffer.forEach(tuple => {\n const [fn, data] = tuple;\n fn(data);\n });\n this._animationCallbacksBuffer = [];\n });\n });\n }\n animationCallbacksBuffer.push([fn, data]);\n }\n end() {\n this._cdRecurDepth--;\n // this is to prevent animations from running twice when an inner\n // component does CD when a parent component instead has inserted it\n if (this._cdRecurDepth == 0) {\n this._zone.runOutsideAngular(() => {\n this._scheduleCountTask();\n this.engine.flush(this._microtaskId);\n });\n }\n if (this.delegate.end) {\n this.delegate.end();\n }\n }\n whenRenderingDone() {\n return this.engine.whenRenderingDone();\n }\n}\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation browser package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AnimationDriver, NoopAnimationDriver, Animation as ɵAnimation, AnimationEngine as ɵAnimationEngine, AnimationRenderer as ɵAnimationRenderer, AnimationRendererFactory as ɵAnimationRendererFactory, AnimationStyleNormalizer as ɵAnimationStyleNormalizer, BaseAnimationRenderer as ɵBaseAnimationRenderer, NoopAnimationStyleNormalizer as ɵNoopAnimationStyleNormalizer, WebAnimationsDriver as ɵWebAnimationsDriver, WebAnimationsPlayer as ɵWebAnimationsPlayer, WebAnimationsStyleNormalizer as ɵWebAnimationsStyleNormalizer, allowPreviousPlayerStylesMerge as ɵallowPreviousPlayerStylesMerge, camelCaseToDashCase as ɵcamelCaseToDashCase, containsElement as ɵcontainsElement, createEngine as ɵcreateEngine, getParentElement as ɵgetParentElement, invokeQuery as ɵinvokeQuery, normalizeKeyframes as ɵnormalizeKeyframes, validateStyleProperty as ɵvalidateStyleProperty, validateWebAnimatableStyleProperty as ɵvalidateWebAnimatableStyleProperty };\n","/**\n * @license Angular v18.2.0\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, Inject, RendererFactory2, NgZone, ANIMATION_MODULE_TYPE, NgModule, ɵperformanceMarkFeature } from '@angular/core';\nexport { ANIMATION_MODULE_TYPE } from '@angular/core';\nimport { ɵDomRendererFactory2, BrowserModule } from '@angular/platform-browser';\nimport * as i1 from '@angular/animations/browser';\nimport { ɵAnimationEngine, ɵWebAnimationsStyleNormalizer, ɵAnimationRendererFactory, ɵAnimationStyleNormalizer, AnimationDriver, ɵWebAnimationsDriver, NoopAnimationDriver } from '@angular/animations/browser';\nimport { DOCUMENT } from '@angular/common';\nlet InjectableAnimationEngine = /*#__PURE__*/(() => {\n class InjectableAnimationEngine extends ɵAnimationEngine {\n // The `ApplicationRef` is injected here explicitly to force the dependency ordering.\n // Since the `ApplicationRef` should be created earlier before the `AnimationEngine`, they\n // both have `ngOnDestroy` hooks and `flush()` must be called after all views are destroyed.\n constructor(doc, driver, normalizer) {\n super(doc, driver, normalizer);\n }\n ngOnDestroy() {\n this.flush();\n }\n static {\n this.ɵfac = function InjectableAnimationEngine_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || InjectableAnimationEngine)(i0.ɵɵinject(DOCUMENT), i0.ɵɵinject(i1.AnimationDriver), i0.ɵɵinject(i1.ɵAnimationStyleNormalizer));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InjectableAnimationEngine,\n factory: InjectableAnimationEngine.ɵfac\n });\n }\n }\n return InjectableAnimationEngine;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction instantiateDefaultStyleNormalizer() {\n return new ɵWebAnimationsStyleNormalizer();\n}\nfunction instantiateRendererFactory(renderer, engine, zone) {\n return new ɵAnimationRendererFactory(renderer, engine, zone);\n}\nconst SHARED_ANIMATION_PROVIDERS = [{\n provide: ɵAnimationStyleNormalizer,\n useFactory: instantiateDefaultStyleNormalizer\n}, {\n provide: ɵAnimationEngine,\n useClass: InjectableAnimationEngine\n}, {\n provide: RendererFactory2,\n useFactory: instantiateRendererFactory,\n deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone]\n}];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserModule.\n */\nconst BROWSER_ANIMATIONS_PROVIDERS = [{\n provide: AnimationDriver,\n useFactory: () => new ɵWebAnimationsDriver()\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'BrowserAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserTestingModule.\n */\nconst BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{\n provide: AnimationDriver,\n useClass: NoopAnimationDriver\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'NoopAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n\n/**\n * Exports `BrowserModule` with additional dependency-injection providers\n * for use with animations. See [Animations](guide/animations).\n * @publicApi\n */\nlet BrowserAnimationsModule = /*#__PURE__*/(() => {\n class BrowserAnimationsModule {\n /**\n * Configures the module based on the specified object.\n *\n * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.\n * @see {@link BrowserAnimationsModuleConfig}\n *\n * @usageNotes\n * When registering the `BrowserAnimationsModule`, you can use the `withConfig`\n * function as follows:\n * ```\n * @NgModule({\n * imports: [BrowserAnimationsModule.withConfig(config)]\n * })\n * class MyNgModule {}\n * ```\n */\n static withConfig(config) {\n return {\n ngModule: BrowserAnimationsModule,\n providers: config.disableAnimations ? BROWSER_NOOP_ANIMATIONS_PROVIDERS : BROWSER_ANIMATIONS_PROVIDERS\n };\n }\n static {\n this.ɵfac = function BrowserAnimationsModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || BrowserAnimationsModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: BrowserAnimationsModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n }\n return BrowserAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of dependency-injection providers\n * to enable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to enable animations in an application\n * bootstrapped using the `bootstrapApplication` function. In this scenario there\n * is no need to import the `BrowserAnimationsModule` NgModule at all, just add\n * providers returned by this function to the `providers` list as show below.\n *\n * ```typescript\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideAnimations() {\n ɵperformanceMarkFeature('NgEagerAnimations');\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideAnimations` call results in app code.\n return [...BROWSER_ANIMATIONS_PROVIDERS];\n}\n/**\n * A null player that must be imported to allow disabling of animations.\n * @publicApi\n */\nlet NoopAnimationsModule = /*#__PURE__*/(() => {\n class NoopAnimationsModule {\n static {\n this.ɵfac = function NoopAnimationsModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NoopAnimationsModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: NoopAnimationsModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n }\n return NoopAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of dependency-injection providers\n * to disable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to bootstrap an application using\n * the `bootstrapApplication` function, but you need to disable animations\n * (for example, when running tests).\n *\n * ```typescript\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideNoopAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideNoopAnimations() {\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideNoopAnimations` call results in app code.\n return [...BROWSER_NOOP_ANIMATIONS_PROVIDERS];\n}\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation browser package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BrowserAnimationsModule, NoopAnimationsModule, provideAnimations, provideNoopAnimations, InjectableAnimationEngine as ɵInjectableAnimationEngine };\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map, share } from 'rxjs/operators';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar ServiceProviderType = /*#__PURE__*/function (ServiceProviderType) {\n ServiceProviderType[ServiceProviderType[\"SERVICE_PROVIDER_TYPE_PRODUCT\"] = 0] = \"SERVICE_PROVIDER_TYPE_PRODUCT\";\n ServiceProviderType[ServiceProviderType[\"SERVICE_PROVIDER_TYPE_PLATFORM\"] = 1] = \"SERVICE_PROVIDER_TYPE_PLATFORM\";\n return ServiceProviderType;\n}(ServiceProviderType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$7(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Access {\n static fromProto(proto) {\n let m = new Access();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scope !== 'undefined') {\n toReturn['scope'] = this.scope;\n }\n if (typeof this.public !== 'undefined') {\n toReturn['public'] = this.public;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$6(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass ServiceContextAccount {\n static fromProto(proto) {\n let m = new ServiceContextAccount();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountId !== 'undefined') {\n toReturn['accountId'] = this.accountId;\n }\n return toReturn;\n }\n}\nclass AutoImpersonation {\n static fromProto(proto) {\n let m = new AutoImpersonation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n return toReturn;\n }\n}\nclass ServiceContextBrand {\n static fromProto(proto) {\n let m = new ServiceContextBrand();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.groupPath !== 'undefined') {\n toReturn['groupPath'] = this.groupPath;\n }\n return toReturn;\n }\n}\nclass NoImpersonation {\n static fromProto(proto) {\n let m = new NoImpersonation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n return toReturn;\n }\n}\nclass ServiceContextPartner {\n static fromProto(proto) {\n let m = new ServiceContextPartner();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass ServiceContext {\n static fromProto(proto) {\n let m = new ServiceContext();\n m = Object.assign(m, proto);\n if (proto.account) {\n m.account = ServiceContextAccount.fromProto(proto.account);\n }\n if (proto.partner) {\n m.partner = ServiceContextPartner.fromProto(proto.partner);\n }\n if (proto.superAdmin) {\n m.superAdmin = ServiceContextSuperAdmin.fromProto(proto.superAdmin);\n }\n if (proto.brand) {\n m.brand = ServiceContextBrand.fromProto(proto.brand);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.account !== 'undefined' && this.account !== null) {\n toReturn['account'] = 'toApiJson' in this.account ? this.account.toApiJson() : this.account;\n }\n if (typeof this.partner !== 'undefined' && this.partner !== null) {\n toReturn['partner'] = 'toApiJson' in this.partner ? this.partner.toApiJson() : this.partner;\n }\n if (typeof this.superAdmin !== 'undefined' && this.superAdmin !== null) {\n toReturn['superAdmin'] = 'toApiJson' in this.superAdmin ? this.superAdmin.toApiJson() : this.superAdmin;\n }\n if (typeof this.brand !== 'undefined' && this.brand !== null) {\n toReturn['brand'] = 'toApiJson' in this.brand ? this.brand.toApiJson() : this.brand;\n }\n return toReturn;\n }\n}\nclass ServiceContextSuperAdmin {\n static fromProto(proto) {\n let m = new ServiceContextSuperAdmin();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n return toReturn;\n }\n}\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AcsUrl {\n static fromProto(proto) {\n let m = new AcsUrl();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.binding !== 'undefined') {\n toReturn['binding'] = this.binding;\n }\n if (typeof this.location !== 'undefined') {\n toReturn['location'] = this.location;\n }\n return toReturn;\n }\n}\nclass SamlServiceProviderConfig {\n static fromProto(proto) {\n let m = new SamlServiceProviderConfig();\n m = Object.assign(m, proto);\n if (proto.acsUrls) {\n m.acsUrls = proto.acsUrls.map(AcsUrl.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.entityId !== 'undefined') {\n toReturn['entityId'] = this.entityId;\n }\n if (typeof this.acsUrls !== 'undefined' && this.acsUrls !== null) {\n toReturn['acsUrls'] = 'toApiJson' in this.acsUrls ? this.acsUrls.toApiJson() : this.acsUrls;\n }\n if (typeof this.signedAuthRequest !== 'undefined') {\n toReturn['signedAuthRequest'] = this.signedAuthRequest;\n }\n if (typeof this.wantSignedAssertion !== 'undefined') {\n toReturn['wantSignedAssertion'] = this.wantSignedAssertion;\n }\n if (typeof this.wantEncryptedAssertion !== 'undefined') {\n toReturn['wantEncryptedAssertion'] = this.wantEncryptedAssertion;\n }\n if (typeof this.nameIdFormats !== 'undefined') {\n toReturn['nameIdFormats'] = this.nameIdFormats;\n }\n if (typeof this.signingCertificate !== 'undefined') {\n toReturn['signingCertificate'] = this.signingCertificate;\n }\n if (typeof this.encryptionCertificate !== 'undefined') {\n toReturn['encryptionCertificate'] = this.encryptionCertificate;\n }\n if (typeof this.serviceProviderConfigId !== 'undefined') {\n toReturn['serviceProviderConfigId'] = this.serviceProviderConfigId;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n return toReturn;\n }\n}\nclass ServiceProviderConfig {\n static fromProto(proto) {\n let m = new ServiceProviderConfig();\n m = Object.assign(m, proto);\n if (proto.serviceProviderType) {\n m.serviceProviderType = enumStringToValue$5(ServiceProviderType, proto.serviceProviderType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.entryUrl !== 'undefined') {\n toReturn['entryUrl'] = this.entryUrl;\n }\n if (typeof this.sessionUrl !== 'undefined') {\n toReturn['sessionUrl'] = this.sessionUrl;\n }\n if (typeof this.primaryDomain !== 'undefined') {\n toReturn['primaryDomain'] = this.primaryDomain;\n }\n if (typeof this.alternativeDomains !== 'undefined') {\n toReturn['alternativeDomains'] = this.alternativeDomains;\n }\n if (typeof this.ownedAndOperated !== 'undefined') {\n toReturn['ownedAndOperated'] = this.ownedAndOperated;\n }\n if (typeof this.logoutUrl !== 'undefined') {\n toReturn['logoutUrl'] = this.logoutUrl;\n }\n if (typeof this.serviceProviderType !== 'undefined') {\n toReturn['serviceProviderType'] = this.serviceProviderType;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Oauth2Config {\n static fromProto(proto) {\n let m = new Oauth2Config();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.deleted) {\n m.deleted = new Date(proto.deleted);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.redirectUris !== 'undefined') {\n toReturn['redirectUris'] = this.redirectUris;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.deleted !== 'undefined' && this.deleted !== null) {\n toReturn['deleted'] = 'toApiJson' in this.deleted ? this.deleted.toApiJson() : this.deleted;\n }\n if (typeof this.logoutUri !== 'undefined') {\n toReturn['logoutUri'] = this.logoutUri;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Scope {\n static fromProto(proto) {\n let m = new Scope();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass IdentityProviderConfiguration {\n static fromProto(proto) {\n let m = new IdentityProviderConfiguration();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.openId) {\n m.openId = OpenIDConnectConfiguration.fromProto(proto.openId);\n }\n if (proto.oauth2) {\n m.oauth2 = OAuth2Configuration.fromProto(proto.oauth2);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n if (typeof this.openId !== 'undefined' && this.openId !== null) {\n toReturn['openId'] = 'toApiJson' in this.openId ? this.openId.toApiJson() : this.openId;\n }\n if (typeof this.oauth2 !== 'undefined' && this.oauth2 !== null) {\n toReturn['oauth2'] = 'toApiJson' in this.oauth2 ? this.oauth2.toApiJson() : this.oauth2;\n }\n return toReturn;\n }\n}\nclass OAuth2Configuration {\n static fromProto(proto) {\n let m = new OAuth2Configuration();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.authorizationEndpoint !== 'undefined') {\n toReturn['authorizationEndpoint'] = this.authorizationEndpoint;\n }\n if (typeof this.tokenEndpoint !== 'undefined') {\n toReturn['tokenEndpoint'] = this.tokenEndpoint;\n }\n if (typeof this.userinfoEndpoint !== 'undefined') {\n toReturn['userinfoEndpoint'] = this.userinfoEndpoint;\n }\n return toReturn;\n }\n}\nclass OpenIDConnectConfiguration {\n static fromProto(proto) {\n let m = new OpenIDConnectConfiguration();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.discoveryEndpoint !== 'undefined') {\n toReturn['discoveryEndpoint'] = this.discoveryEndpoint;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass GetMultiConfigResponseConfigContainer {\n static fromProto(proto) {\n let m = new GetMultiConfigResponseConfigContainer();\n m = Object.assign(m, proto);\n if (proto.config) {\n m.config = Oauth2Config.fromProto(proto.config);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.config !== 'undefined' && this.config !== null) {\n toReturn['config'] = 'toApiJson' in this.config ? this.config.toApiJson() : this.config;\n }\n return toReturn;\n }\n}\nclass CreateConfigRequest {\n static fromProto(proto) {\n let m = new CreateConfigRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.redirectUris !== 'undefined') {\n toReturn['redirectUris'] = this.redirectUris;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.logoutUri !== 'undefined') {\n toReturn['logoutUri'] = this.logoutUri;\n }\n return toReturn;\n }\n}\nclass CreateConfigResponse {\n static fromProto(proto) {\n let m = new CreateConfigResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n if (typeof this.clientSecret !== 'undefined') {\n toReturn['clientSecret'] = this.clientSecret;\n }\n return toReturn;\n }\n}\nclass CreateIdentityProviderConfigurationRequest {\n static fromProto(proto) {\n let m = new CreateIdentityProviderConfigurationRequest();\n m = Object.assign(m, proto);\n if (proto.openId) {\n m.openId = OpenIDConnectConfiguration.fromProto(proto.openId);\n }\n if (proto.oauth2) {\n m.oauth2 = OAuth2Configuration.fromProto(proto.oauth2);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n if (typeof this.clientSecret !== 'undefined') {\n toReturn['clientSecret'] = this.clientSecret;\n }\n if (typeof this.openId !== 'undefined' && this.openId !== null) {\n toReturn['openId'] = 'toApiJson' in this.openId ? this.openId.toApiJson() : this.openId;\n }\n if (typeof this.oauth2 !== 'undefined' && this.oauth2 !== null) {\n toReturn['oauth2'] = 'toApiJson' in this.oauth2 ? this.oauth2.toApiJson() : this.oauth2;\n }\n return toReturn;\n }\n}\nclass CreateSamlServiceProviderConfigRequest {\n static fromProto(proto) {\n let m = new CreateSamlServiceProviderConfigRequest();\n m = Object.assign(m, proto);\n if (proto.fields) {\n m.fields = SamlServiceProviderConfig.fromProto(proto.fields);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.fields !== 'undefined' && this.fields !== null) {\n toReturn['fields'] = 'toApiJson' in this.fields ? this.fields.toApiJson() : this.fields;\n }\n if (typeof this.metadataXmlString !== 'undefined') {\n toReturn['metadataXmlString'] = this.metadataXmlString;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n return toReturn;\n }\n}\nclass CreateSamlServiceProviderConfigResponse {\n static fromProto(proto) {\n let m = new CreateSamlServiceProviderConfigResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderConfigId !== 'undefined') {\n toReturn['serviceProviderConfigId'] = this.serviceProviderConfigId;\n }\n return toReturn;\n }\n}\nclass CreateScopeRequest {\n static fromProto(proto) {\n let m = new CreateScopeRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n return toReturn;\n }\n}\nclass CreateServiceProviderRequest {\n static fromProto(proto) {\n let m = new CreateServiceProviderRequest();\n m = Object.assign(m, proto);\n if (proto.serviceProvider) {\n m.serviceProvider = ServiceProviderConfig.fromProto(proto.serviceProvider);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProvider !== 'undefined' && this.serviceProvider !== null) {\n toReturn['serviceProvider'] = 'toApiJson' in this.serviceProvider ? this.serviceProvider.toApiJson() : this.serviceProvider;\n }\n return toReturn;\n }\n}\nclass DeleteConfigRequest {\n static fromProto(proto) {\n let m = new DeleteConfigRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n return toReturn;\n }\n}\nclass DeleteIdentityProviderConfigurationRequest {\n static fromProto(proto) {\n let m = new DeleteIdentityProviderConfigurationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass DeleteSAMLServiceProviderConfigRequest {\n static fromProto(proto) {\n let m = new DeleteSAMLServiceProviderConfigRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderConfigId !== 'undefined') {\n toReturn['serviceProviderConfigId'] = this.serviceProviderConfigId;\n }\n return toReturn;\n }\n}\nclass DeleteScopeRequest {\n static fromProto(proto) {\n let m = new DeleteScopeRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scopeId !== 'undefined') {\n toReturn['scopeId'] = this.scopeId;\n }\n return toReturn;\n }\n}\nclass DeleteServiceProviderRequest {\n static fromProto(proto) {\n let m = new DeleteServiceProviderRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n return toReturn;\n }\n}\nclass GetEntryURLRequest {\n static fromProto(proto) {\n let m = new GetEntryURLRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = ServiceContext.fromProto(proto.context);\n }\n if (proto.autoImpersonation) {\n m.autoImpersonation = AutoImpersonation.fromProto(proto.autoImpersonation);\n }\n if (proto.noImpersonation) {\n m.noImpersonation = NoImpersonation.fromProto(proto.noImpersonation);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.path !== 'undefined') {\n toReturn['path'] = this.path;\n }\n if (typeof this.skipGatewayAuthentication !== 'undefined') {\n toReturn['skipGatewayAuthentication'] = this.skipGatewayAuthentication;\n }\n if (typeof this.impersonateeUserId !== 'undefined') {\n toReturn['impersonateeUserId'] = this.impersonateeUserId;\n }\n if (typeof this.autoImpersonation !== 'undefined' && this.autoImpersonation !== null) {\n toReturn['autoImpersonation'] = 'toApiJson' in this.autoImpersonation ? this.autoImpersonation.toApiJson() : this.autoImpersonation;\n }\n if (typeof this.explicitImpersonateeUserId !== 'undefined') {\n toReturn['explicitImpersonateeUserId'] = this.explicitImpersonateeUserId;\n }\n if (typeof this.noImpersonation !== 'undefined' && this.noImpersonation !== null) {\n toReturn['noImpersonation'] = 'toApiJson' in this.noImpersonation ? this.noImpersonation.toApiJson() : this.noImpersonation;\n }\n return toReturn;\n }\n}\nclass GetEntryURLResponse {\n static fromProto(proto) {\n let m = new GetEntryURLResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.entryUrl !== 'undefined') {\n toReturn['entryUrl'] = this.entryUrl;\n }\n return toReturn;\n }\n}\nclass GetEntryURLWithCodeRequest {\n static fromProto(proto) {\n let m = new GetEntryURLWithCodeRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = ServiceContext.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.sessionId !== 'undefined') {\n toReturn['sessionId'] = this.sessionId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.nextUrl !== 'undefined') {\n toReturn['nextUrl'] = this.nextUrl;\n }\n if (typeof this.backUrl !== 'undefined') {\n toReturn['backUrl'] = this.backUrl;\n }\n if (typeof this.backUrlText !== 'undefined') {\n toReturn['backUrlText'] = this.backUrlText;\n }\n if (typeof this.federatedIdentityProvider !== 'undefined') {\n toReturn['federatedIdentityProvider'] = this.federatedIdentityProvider;\n }\n if (typeof this.impersonatorUserId !== 'undefined') {\n toReturn['impersonatorUserId'] = this.impersonatorUserId;\n }\n return toReturn;\n }\n}\nclass GetEntryURLWithCodeResponse {\n static fromProto(proto) {\n let m = new GetEntryURLWithCodeResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.entryUrl !== 'undefined') {\n toReturn['entryUrl'] = this.entryUrl;\n }\n return toReturn;\n }\n}\nclass GetIdentityProviderConfigurationRequest {\n static fromProto(proto) {\n let m = new GetIdentityProviderConfigurationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass GetIdentityProviderConfigurationResponse {\n static fromProto(proto) {\n let m = new GetIdentityProviderConfigurationResponse();\n m = Object.assign(m, proto);\n if (proto.configuration) {\n m.configuration = IdentityProviderConfiguration.fromProto(proto.configuration);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.configuration !== 'undefined' && this.configuration !== null) {\n toReturn['configuration'] = 'toApiJson' in this.configuration ? this.configuration.toApiJson() : this.configuration;\n }\n return toReturn;\n }\n}\nclass GetLogoutURLRequest {\n static fromProto(proto) {\n let m = new GetLogoutURLRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = ServiceContext.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.sessionId !== 'undefined') {\n toReturn['sessionId'] = this.sessionId;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n return toReturn;\n }\n}\nclass GetLogoutURLResponse {\n static fromProto(proto) {\n let m = new GetLogoutURLResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.logoutUrl !== 'undefined') {\n toReturn['logoutUrl'] = this.logoutUrl;\n }\n return toReturn;\n }\n}\nclass GetMultiConfigRequest {\n static fromProto(proto) {\n let m = new GetMultiConfigRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientIds !== 'undefined') {\n toReturn['clientIds'] = this.clientIds;\n }\n return toReturn;\n }\n}\nclass GetMultiConfigResponse {\n static fromProto(proto) {\n let m = new GetMultiConfigResponse();\n m = Object.assign(m, proto);\n if (proto.configs) {\n m.configs = proto.configs.map(GetMultiConfigResponseConfigContainer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.configs !== 'undefined' && this.configs !== null) {\n toReturn['configs'] = 'toApiJson' in this.configs ? this.configs.toApiJson() : this.configs;\n }\n return toReturn;\n }\n}\nclass GetMultiEntryURLRequest {\n static fromProto(proto) {\n let m = new GetMultiEntryURLRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = ServiceContext.fromProto(proto.context);\n }\n if (proto.autoImpersonation) {\n m.autoImpersonation = AutoImpersonation.fromProto(proto.autoImpersonation);\n }\n if (proto.noImpersonation) {\n m.noImpersonation = NoImpersonation.fromProto(proto.noImpersonation);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderIds !== 'undefined') {\n toReturn['serviceProviderIds'] = this.serviceProviderIds;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.impersonateeUserId !== 'undefined') {\n toReturn['impersonateeUserId'] = this.impersonateeUserId;\n }\n if (typeof this.autoImpersonation !== 'undefined' && this.autoImpersonation !== null) {\n toReturn['autoImpersonation'] = 'toApiJson' in this.autoImpersonation ? this.autoImpersonation.toApiJson() : this.autoImpersonation;\n }\n if (typeof this.explicitImpersonateeUserId !== 'undefined') {\n toReturn['explicitImpersonateeUserId'] = this.explicitImpersonateeUserId;\n }\n if (typeof this.noImpersonation !== 'undefined' && this.noImpersonation !== null) {\n toReturn['noImpersonation'] = 'toApiJson' in this.noImpersonation ? this.noImpersonation.toApiJson() : this.noImpersonation;\n }\n return toReturn;\n }\n}\nclass GetMultiEntryURLResponse {\n static fromProto(proto) {\n let m = new GetMultiEntryURLResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.entryUrls !== 'undefined') {\n toReturn['entryUrls'] = this.entryUrls;\n }\n return toReturn;\n }\n}\nclass GetMultiScopeRequest {\n static fromProto(proto) {\n let m = new GetMultiScopeRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scopeIds !== 'undefined') {\n toReturn['scopeIds'] = this.scopeIds;\n }\n return toReturn;\n }\n}\nclass GetMultiScopeResponse {\n static fromProto(proto) {\n let m = new GetMultiScopeResponse();\n m = Object.assign(m, proto);\n if (proto.scopes) {\n m.scopes = proto.scopes.map(GetMultiScopeResponseScopeContainer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scopes !== 'undefined' && this.scopes !== null) {\n toReturn['scopes'] = 'toApiJson' in this.scopes ? this.scopes.toApiJson() : this.scopes;\n }\n return toReturn;\n }\n}\nclass GetSAMLIdentityProviderMetadataRequest {\n static fromProto(proto) {\n let m = new GetSAMLIdentityProviderMetadataRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderConfigId !== 'undefined') {\n toReturn['serviceProviderConfigId'] = this.serviceProviderConfigId;\n }\n return toReturn;\n }\n}\nclass GetSAMLIdentityProviderMetadataResponse {\n static fromProto(proto) {\n let m = new GetSAMLIdentityProviderMetadataResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.metadata !== 'undefined') {\n toReturn['metadata'] = this.metadata;\n }\n return toReturn;\n }\n}\nclass GetServiceProviderRequest {\n static fromProto(proto) {\n let m = new GetServiceProviderRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n return toReturn;\n }\n}\nclass GetServiceProviderResponse {\n static fromProto(proto) {\n let m = new GetServiceProviderResponse();\n m = Object.assign(m, proto);\n if (proto.serviceProvider) {\n m.serviceProvider = ServiceProviderConfig.fromProto(proto.serviceProvider);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProvider !== 'undefined' && this.serviceProvider !== null) {\n toReturn['serviceProvider'] = 'toApiJson' in this.serviceProvider ? this.serviceProvider.toApiJson() : this.serviceProvider;\n }\n return toReturn;\n }\n}\nclass GetSessionTransferURLRequest {\n static fromProto(proto) {\n let m = new GetSessionTransferURLRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = ServiceContext.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n return toReturn;\n }\n}\nclass GetSessionTransferURLResponse {\n static fromProto(proto) {\n let m = new GetSessionTransferURLResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.sessionTransferUrl !== 'undefined') {\n toReturn['sessionTransferUrl'] = this.sessionTransferUrl;\n }\n return toReturn;\n }\n}\nclass HasCustomIdentityProviderRequest {\n static fromProto(proto) {\n let m = new HasCustomIdentityProviderRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n return toReturn;\n }\n}\nclass HasCustomIdentityProviderResponse {\n static fromProto(proto) {\n let m = new HasCustomIdentityProviderResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.hasCustomIdp !== 'undefined') {\n toReturn['hasCustomIdp'] = this.hasCustomIdp;\n }\n return toReturn;\n }\n}\nclass ListConfigsRequest {\n static fromProto(proto) {\n let m = new ListConfigsRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListConfigsResponse {\n static fromProto(proto) {\n let m = new ListConfigsResponse();\n m = Object.assign(m, proto);\n if (proto.clientConfigurations) {\n m.clientConfigurations = proto.clientConfigurations.map(Oauth2Config.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientConfigurations !== 'undefined' && this.clientConfigurations !== null) {\n toReturn['clientConfigurations'] = 'toApiJson' in this.clientConfigurations ? this.clientConfigurations.toApiJson() : this.clientConfigurations;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass ListSAMLServiceProviderConfigsRequest {\n static fromProto(proto) {\n let m = new ListSAMLServiceProviderConfigsRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListSAMLServiceProviderConfigsResponse {\n static fromProto(proto) {\n let m = new ListSAMLServiceProviderConfigsResponse();\n m = Object.assign(m, proto);\n if (proto.serviceProviderConfigs) {\n m.serviceProviderConfigs = proto.serviceProviderConfigs.map(SamlServiceProviderConfig.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderConfigs !== 'undefined' && this.serviceProviderConfigs !== null) {\n toReturn['serviceProviderConfigs'] = 'toApiJson' in this.serviceProviderConfigs ? this.serviceProviderConfigs.toApiJson() : this.serviceProviderConfigs;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass ListScopesRequest {\n static fromProto(proto) {\n let m = new ListScopesRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListScopesResponse {\n static fromProto(proto) {\n let m = new ListScopesResponse();\n m = Object.assign(m, proto);\n if (proto.scopes) {\n m.scopes = proto.scopes.map(Scope.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scopes !== 'undefined' && this.scopes !== null) {\n toReturn['scopes'] = 'toApiJson' in this.scopes ? this.scopes.toApiJson() : this.scopes;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass ListServiceProvidersRequest {\n static fromProto(proto) {\n let m = new ListServiceProvidersRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListServiceProvidersResponse {\n static fromProto(proto) {\n let m = new ListServiceProvidersResponse();\n m = Object.assign(m, proto);\n if (proto.serviceProviders) {\n m.serviceProviders = proto.serviceProviders.map(ServiceProviderConfig.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviders !== 'undefined' && this.serviceProviders !== null) {\n toReturn['serviceProviders'] = 'toApiJson' in this.serviceProviders ? this.serviceProviders.toApiJson() : this.serviceProviders;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass LogoutRequest {\n static fromProto(proto) {\n let m = new LogoutRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.sessionId !== 'undefined') {\n toReturn['sessionId'] = this.sessionId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass UpdateScopeRequestMutation {\n static fromProto(proto) {\n let m = new UpdateScopeRequestMutation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n return toReturn;\n }\n}\nclass UpdateIdentityProviderConfigurationRequestMutation {\n static fromProto(proto) {\n let m = new UpdateIdentityProviderConfigurationRequestMutation();\n m = Object.assign(m, proto);\n if (proto.openId) {\n m.openId = UpdateIdentityProviderConfigurationRequestMutationOpenIDConnectConfigurationMutation.fromProto(proto.openId);\n }\n if (proto.replaceOpenId) {\n m.replaceOpenId = OpenIDConnectConfiguration.fromProto(proto.replaceOpenId);\n }\n if (proto.oauth2) {\n m.oauth2 = UpdateIdentityProviderConfigurationRequestMutationOAuth2ConfigurationMutation.fromProto(proto.oauth2);\n }\n if (proto.replaceOauth2) {\n m.replaceOauth2 = OAuth2Configuration.fromProto(proto.replaceOauth2);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n if (typeof this.clientSecret !== 'undefined') {\n toReturn['clientSecret'] = this.clientSecret;\n }\n if (typeof this.openId !== 'undefined' && this.openId !== null) {\n toReturn['openId'] = 'toApiJson' in this.openId ? this.openId.toApiJson() : this.openId;\n }\n if (typeof this.replaceOpenId !== 'undefined' && this.replaceOpenId !== null) {\n toReturn['replaceOpenId'] = 'toApiJson' in this.replaceOpenId ? this.replaceOpenId.toApiJson() : this.replaceOpenId;\n }\n if (typeof this.oauth2 !== 'undefined' && this.oauth2 !== null) {\n toReturn['oauth2'] = 'toApiJson' in this.oauth2 ? this.oauth2.toApiJson() : this.oauth2;\n }\n if (typeof this.replaceOauth2 !== 'undefined' && this.replaceOauth2 !== null) {\n toReturn['replaceOauth2'] = 'toApiJson' in this.replaceOauth2 ? this.replaceOauth2.toApiJson() : this.replaceOauth2;\n }\n return toReturn;\n }\n}\nclass UpdateConfigRequestMutation {\n static fromProto(proto) {\n let m = new UpdateConfigRequestMutation();\n m = Object.assign(m, proto);\n if (proto.redirectUris) {\n m.redirectUris = UpdateConfigRequestMutationRepeatedStringMutation.fromProto(proto.redirectUris);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.redirectUris !== 'undefined' && this.redirectUris !== null) {\n toReturn['redirectUris'] = 'toApiJson' in this.redirectUris ? this.redirectUris.toApiJson() : this.redirectUris;\n }\n if (typeof this.logoutUri !== 'undefined') {\n toReturn['logoutUri'] = this.logoutUri;\n }\n return toReturn;\n }\n}\nclass UpdateServiceProviderRequestMutation {\n static fromProto(proto) {\n let m = new UpdateServiceProviderRequestMutation();\n m = Object.assign(m, proto);\n if (proto.alternativeDomains) {\n m.alternativeDomains = UpdateServiceProviderRequestMutationRepeatedStringMutation.fromProto(proto.alternativeDomains);\n }\n if (proto.serviceProviderType) {\n m.serviceProviderType = enumStringToValue$1(ServiceProviderType, proto.serviceProviderType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.entryUrl !== 'undefined') {\n toReturn['entryUrl'] = this.entryUrl;\n }\n if (typeof this.sessionUrl !== 'undefined') {\n toReturn['sessionUrl'] = this.sessionUrl;\n }\n if (typeof this.primaryDomain !== 'undefined') {\n toReturn['primaryDomain'] = this.primaryDomain;\n }\n if (typeof this.alternativeDomains !== 'undefined' && this.alternativeDomains !== null) {\n toReturn['alternativeDomains'] = 'toApiJson' in this.alternativeDomains ? this.alternativeDomains.toApiJson() : this.alternativeDomains;\n }\n if (typeof this.ownedAndOperated !== 'undefined') {\n toReturn['ownedAndOperated'] = this.ownedAndOperated;\n }\n if (typeof this.logoutUrl !== 'undefined') {\n toReturn['logoutUrl'] = this.logoutUrl;\n }\n if (typeof this.serviceProviderType !== 'undefined') {\n toReturn['serviceProviderType'] = this.serviceProviderType;\n }\n return toReturn;\n }\n}\nclass UpdateIdentityProviderConfigurationRequestMutationOAuth2ConfigurationMutation {\n static fromProto(proto) {\n let m = new UpdateIdentityProviderConfigurationRequestMutationOAuth2ConfigurationMutation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.authorizationEndpoint !== 'undefined') {\n toReturn['authorizationEndpoint'] = this.authorizationEndpoint;\n }\n if (typeof this.tokenEndpoint !== 'undefined') {\n toReturn['tokenEndpoint'] = this.tokenEndpoint;\n }\n if (typeof this.userinfoEndpoint !== 'undefined') {\n toReturn['userinfoEndpoint'] = this.userinfoEndpoint;\n }\n return toReturn;\n }\n}\nclass UpdateIdentityProviderConfigurationRequestMutationOpenIDConnectConfigurationMutation {\n static fromProto(proto) {\n let m = new UpdateIdentityProviderConfigurationRequestMutationOpenIDConnectConfigurationMutation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.discoveryEndpoint !== 'undefined') {\n toReturn['discoveryEndpoint'] = this.discoveryEndpoint;\n }\n return toReturn;\n }\n}\nclass RegenerateSAMLServiceProviderConfigCertificateRequest {\n static fromProto(proto) {\n let m = new RegenerateSAMLServiceProviderConfigCertificateRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProviderConfigId !== 'undefined') {\n toReturn['serviceProviderConfigId'] = this.serviceProviderConfigId;\n }\n return toReturn;\n }\n}\nclass RegenerateSAMLServiceProviderConfigCertificateResponse {\n static fromProto(proto) {\n let m = new RegenerateSAMLServiceProviderConfigCertificateResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.certificate !== 'undefined') {\n toReturn['certificate'] = this.certificate;\n }\n return toReturn;\n }\n}\nclass UpdateServiceProviderRequestMutationRepeatedStringMutation {\n static fromProto(proto) {\n let m = new UpdateServiceProviderRequestMutationRepeatedStringMutation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.repeatedString !== 'undefined') {\n toReturn['repeatedString'] = this.repeatedString;\n }\n return toReturn;\n }\n}\nclass UpdateConfigRequestMutationRepeatedStringMutation {\n static fromProto(proto) {\n let m = new UpdateConfigRequestMutationRepeatedStringMutation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.repeatedString !== 'undefined') {\n toReturn['repeatedString'] = this.repeatedString;\n }\n return toReturn;\n }\n}\nclass RevokeGrantRequest {\n static fromProto(proto) {\n let m = new RevokeGrantRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.scopeIds !== 'undefined') {\n toReturn['scopeIds'] = this.scopeIds;\n }\n return toReturn;\n }\n}\nclass GetMultiScopeResponseScopeContainer {\n static fromProto(proto) {\n let m = new GetMultiScopeResponseScopeContainer();\n m = Object.assign(m, proto);\n if (proto.scope) {\n m.scope = Scope.fromProto(proto.scope);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scope !== 'undefined' && this.scope !== null) {\n toReturn['scope'] = 'toApiJson' in this.scope ? this.scope.toApiJson() : this.scope;\n }\n return toReturn;\n }\n}\nclass UpdateConfigRequest {\n static fromProto(proto) {\n let m = new UpdateConfigRequest();\n m = Object.assign(m, proto);\n if (proto.mutations) {\n m.mutations = proto.mutations.map(UpdateConfigRequestMutation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.clientId !== 'undefined') {\n toReturn['clientId'] = this.clientId;\n }\n if (typeof this.mutations !== 'undefined' && this.mutations !== null) {\n toReturn['mutations'] = 'toApiJson' in this.mutations ? this.mutations.toApiJson() : this.mutations;\n }\n return toReturn;\n }\n}\nclass UpdateIdentityProviderConfigurationRequest {\n static fromProto(proto) {\n let m = new UpdateIdentityProviderConfigurationRequest();\n m = Object.assign(m, proto);\n if (proto.mutations) {\n m.mutations = proto.mutations.map(UpdateIdentityProviderConfigurationRequestMutation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.mutations !== 'undefined' && this.mutations !== null) {\n toReturn['mutations'] = 'toApiJson' in this.mutations ? this.mutations.toApiJson() : this.mutations;\n }\n return toReturn;\n }\n}\nclass UpdateSAMLServiceProviderConfigRequest {\n static fromProto(proto) {\n let m = new UpdateSAMLServiceProviderConfigRequest();\n m = Object.assign(m, proto);\n if (proto.fields) {\n m.fields = SamlServiceProviderConfig.fromProto(proto.fields);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.fields !== 'undefined' && this.fields !== null) {\n toReturn['fields'] = 'toApiJson' in this.fields ? this.fields.toApiJson() : this.fields;\n }\n if (typeof this.metadataXmlString !== 'undefined') {\n toReturn['metadataXmlString'] = this.metadataXmlString;\n }\n if (typeof this.serviceProviderConfigId !== 'undefined') {\n toReturn['serviceProviderConfigId'] = this.serviceProviderConfigId;\n }\n return toReturn;\n }\n}\nclass UpdateScopeRequest {\n static fromProto(proto) {\n let m = new UpdateScopeRequest();\n m = Object.assign(m, proto);\n if (proto.mutations) {\n m.mutations = proto.mutations.map(UpdateScopeRequestMutation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scopeId !== 'undefined') {\n toReturn['scopeId'] = this.scopeId;\n }\n if (typeof this.mutations !== 'undefined' && this.mutations !== null) {\n toReturn['mutations'] = 'toApiJson' in this.mutations ? this.mutations.toApiJson() : this.mutations;\n }\n return toReturn;\n }\n}\nclass UpdateServiceProviderRequest {\n static fromProto(proto) {\n let m = new UpdateServiceProviderRequest();\n m = Object.assign(m, proto);\n if (proto.serviceProvider) {\n m.serviceProvider = ServiceProviderConfig.fromProto(proto.serviceProvider);\n }\n if (proto.mutations) {\n m.mutations = proto.mutations.map(UpdateServiceProviderRequestMutation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceProvider !== 'undefined' && this.serviceProvider !== null) {\n toReturn['serviceProvider'] = 'toApiJson' in this.serviceProvider ? this.serviceProvider.toApiJson() : this.serviceProvider;\n }\n if (typeof this.serviceProviderId !== 'undefined') {\n toReturn['serviceProviderId'] = this.serviceProviderId;\n }\n if (typeof this.mutations !== 'undefined' && this.mutations !== null) {\n toReturn['mutations'] = 'toApiJson' in this.mutations ? this.mutations.toApiJson() : this.mutations;\n }\n return toReturn;\n }\n}\nclass ConsumeSingleUseTokenRequest {\n static fromProto(proto) {\n let m = new ConsumeSingleUseTokenRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userID !== 'undefined') {\n toReturn['userID'] = this.userID;\n }\n if (typeof this.otp !== 'undefined') {\n toReturn['otp'] = this.otp;\n }\n if (typeof this.nextUrl !== 'undefined') {\n toReturn['nextUrl'] = this.nextUrl;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': '',\n 'test': '',\n 'demo': 'sso-api-demo.apigateway.co',\n 'prod': 'sso-api-prod.apigateway.co',\n 'production': 'sso-api-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet ConsentApiService = /*#__PURE__*/(() => {\n class ConsentApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n revokeGrant(r) {\n const request = r.toApiJson ? r : new RevokeGrantRequest(r);\n return this.http.post(this._host + \"/sso.v1.Consent/RevokeGrant\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n ConsentApiService.ɵfac = function ConsentApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ConsentApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ConsentApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ConsentApiService,\n factory: ConsentApiService.ɵfac,\n providedIn: 'root'\n });\n return ConsentApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet ConsentAdminApiService = /*#__PURE__*/(() => {\n class ConsentAdminApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createScope(r) {\n const request = r.toApiJson ? r : new CreateScopeRequest(r);\n return this.http.post(this._host + \"/sso.v1.ConsentAdmin/CreateScope\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n updateScope(r) {\n const request = r.toApiJson ? r : new UpdateScopeRequest(r);\n return this.http.post(this._host + \"/sso.v1.ConsentAdmin/UpdateScope\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getMultiScope(r) {\n const request = r.toApiJson ? r : new GetMultiScopeRequest(r);\n return this.http.post(this._host + \"/sso.v1.ConsentAdmin/GetMultiScope\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiScopeResponse.fromProto(resp)));\n }\n listScopes(r) {\n const request = r.toApiJson ? r : new ListScopesRequest(r);\n return this.http.post(this._host + \"/sso.v1.ConsentAdmin/ListScopes\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListScopesResponse.fromProto(resp)));\n }\n deleteScope(r) {\n const request = r.toApiJson ? r : new DeleteScopeRequest(r);\n return this.http.post(this._host + \"/sso.v1.ConsentAdmin/DeleteScope\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n ConsentAdminApiService.ɵfac = function ConsentAdminApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ConsentAdminApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ConsentAdminApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ConsentAdminApiService,\n factory: ConsentAdminApiService.ɵfac,\n providedIn: 'root'\n });\n return ConsentAdminApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet IdentityProviderApiService = /*#__PURE__*/(() => {\n class IdentityProviderApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getEntryUrl(r) {\n const request = r.toApiJson ? r : new GetEntryURLRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProvider/GetEntryURL\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetEntryURLResponse.fromProto(resp)));\n }\n getMultiEntryUrl(r) {\n const request = r.toApiJson ? r : new GetMultiEntryURLRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProvider/GetMultiEntryURL\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiEntryURLResponse.fromProto(resp)));\n }\n getEntryUrlWithCode(r) {\n const request = r.toApiJson ? r : new GetEntryURLWithCodeRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProvider/GetEntryURLWithCode\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetEntryURLWithCodeResponse.fromProto(resp)));\n }\n logout(r) {\n const request = r.toApiJson ? r : new LogoutRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProvider/Logout\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n consumeSingleUseToken(r) {\n const toApiJson = r.toApiJson;\n const request = typeof toApiJson !== 'undefined' ? r : new ConsumeSingleUseTokenRequest(r);\n const params = new URLSearchParams();\n const apiJson = request.toApiJson();\n for (const key in apiJson) {\n if (!apiJson.hasOwnProperty(key)) {\n continue;\n }\n const value = apiJson[key];\n if (value === null) {\n continue;\n }\n params.append(key, value);\n }\n window.location.href = `${this._host}/single-use-token?${params.toString()}`;\n }\n }\n IdentityProviderApiService.ɵfac = function IdentityProviderApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IdentityProviderApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n IdentityProviderApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IdentityProviderApiService,\n factory: IdentityProviderApiService.ɵfac,\n providedIn: 'root'\n });\n return IdentityProviderApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet IdentityProviderAdminApiService = /*#__PURE__*/(() => {\n class IdentityProviderAdminApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createIdentityProvider(r) {\n const request = r.toApiJson ? r : new CreateIdentityProviderConfigurationRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProviderAdmin/CreateIdentityProvider\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n updateIdentityProvider(r) {\n const request = r.toApiJson ? r : new UpdateIdentityProviderConfigurationRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProviderAdmin/UpdateIdentityProvider\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getIdentityProvider(r) {\n const request = r.toApiJson ? r : new GetIdentityProviderConfigurationRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProviderAdmin/GetIdentityProvider\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetIdentityProviderConfigurationResponse.fromProto(resp)));\n }\n deleteIdentityProvider(r) {\n const request = r.toApiJson ? r : new DeleteIdentityProviderConfigurationRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProviderAdmin/DeleteIdentityProvider\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n hasCustomIdentityProvider(r) {\n const request = r.toApiJson ? r : new HasCustomIdentityProviderRequest(r);\n return this.http.post(this._host + \"/sso.v1.IdentityProviderAdmin/HasCustomIdentityProvider\", request.toApiJson(), this.apiOptions()).pipe(map(resp => HasCustomIdentityProviderResponse.fromProto(resp)));\n }\n }\n IdentityProviderAdminApiService.ɵfac = function IdentityProviderAdminApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IdentityProviderAdminApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n IdentityProviderAdminApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IdentityProviderAdminApiService,\n factory: IdentityProviderAdminApiService.ɵfac,\n providedIn: 'root'\n });\n return IdentityProviderAdminApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet ServiceProviderApiService = /*#__PURE__*/(() => {\n class ServiceProviderApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getSessionTransferUrl(r) {\n const request = r.toApiJson ? r : new GetSessionTransferURLRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProvider/GetSessionTransferURL\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSessionTransferURLResponse.fromProto(resp)));\n }\n getLogoutUrl(r) {\n const request = r.toApiJson ? r : new GetLogoutURLRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProvider/GetLogoutURL\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetLogoutURLResponse.fromProto(resp)));\n }\n }\n ServiceProviderApiService.ɵfac = function ServiceProviderApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ServiceProviderApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ServiceProviderApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ServiceProviderApiService,\n factory: ServiceProviderApiService.ɵfac,\n providedIn: 'root'\n });\n return ServiceProviderApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet ServiceProviderAdminApiService = /*#__PURE__*/(() => {\n class ServiceProviderAdminApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createServiceProvider(r) {\n const request = r.toApiJson ? r : new CreateServiceProviderRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/CreateServiceProvider\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getServiceProvider(r) {\n const request = r.toApiJson ? r : new GetServiceProviderRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/GetServiceProvider\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetServiceProviderResponse.fromProto(resp)));\n }\n updateServiceProvider(r) {\n const request = r.toApiJson ? r : new UpdateServiceProviderRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/UpdateServiceProvider\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteServiceProvider(r) {\n const request = r.toApiJson ? r : new DeleteServiceProviderRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/DeleteServiceProvider\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listServiceProviders(r) {\n const request = r.toApiJson ? r : new ListServiceProvidersRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/ListServiceProviders\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListServiceProvidersResponse.fromProto(resp)));\n }\n createConfig(r) {\n const request = r.toApiJson ? r : new CreateConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/CreateConfig\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateConfigResponse.fromProto(resp)));\n }\n getMultiConfig(r) {\n const request = r.toApiJson ? r : new GetMultiConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/GetMultiConfig\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiConfigResponse.fromProto(resp)));\n }\n updateConfig(r) {\n const request = r.toApiJson ? r : new UpdateConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/UpdateConfig\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteConfig(r) {\n const request = r.toApiJson ? r : new DeleteConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/DeleteConfig\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listConfigs(r) {\n const request = r.toApiJson ? r : new ListConfigsRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/ListConfigs\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListConfigsResponse.fromProto(resp)));\n }\n createSamlServiceProviderConfig(r) {\n const request = r.toApiJson ? r : new CreateSamlServiceProviderConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/CreateSamlServiceProviderConfig\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateSamlServiceProviderConfigResponse.fromProto(resp)));\n }\n getSamlIdentityProviderMetadata(r) {\n const request = r.toApiJson ? r : new GetSAMLIdentityProviderMetadataRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/GetSAMLIdentityProviderMetadata\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSAMLIdentityProviderMetadataResponse.fromProto(resp)));\n }\n updateSamlServiceProviderConfig(r) {\n const request = r.toApiJson ? r : new UpdateSAMLServiceProviderConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/UpdateSAMLServiceProviderConfig\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listSamlServiceProviderConfigs(r) {\n const request = r.toApiJson ? r : new ListSAMLServiceProviderConfigsRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/ListSAMLServiceProviderConfigs\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListSAMLServiceProviderConfigsResponse.fromProto(resp)));\n }\n regenerateSamlServiceProviderConfigCertificate(r) {\n const request = r.toApiJson ? r : new RegenerateSAMLServiceProviderConfigCertificateRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/RegenerateSAMLServiceProviderConfigCertificate\", request.toApiJson(), this.apiOptions()).pipe(map(resp => RegenerateSAMLServiceProviderConfigCertificateResponse.fromProto(resp)));\n }\n deleteSamlServiceProviderConfig(r) {\n const request = r.toApiJson ? r : new DeleteSAMLServiceProviderConfigRequest(r);\n return this.http.post(this._host + \"/sso.v1.ServiceProviderAdmin/DeleteSAMLServiceProviderConfig\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n ServiceProviderAdminApiService.ɵfac = function ServiceProviderAdminApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ServiceProviderAdminApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ServiceProviderAdminApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ServiceProviderAdminApiService,\n factory: ServiceProviderAdminApiService.ɵfac,\n providedIn: 'root'\n });\n return ServiceProviderAdminApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\n\nconst ImpersonationTypeNone = 'none';\nconst ImpersonationTypeAuto = 'auto';\nconst serviceGatewayPath = \"/service-gateway\";\nlet SSOService = /*#__PURE__*/(() => {\n class SSOService {\n constructor(identityProviderApiService, consentAdminApiService, serviceProviderApiService, hostService) {\n this.identityProviderApiService = identityProviderApiService;\n this.consentAdminApiService = consentAdminApiService;\n this.serviceProviderApiService = serviceProviderApiService;\n this.hostService = hostService;\n }\n getEntryUrl(serviceProviderId, context, options = {}) {\n const request = new GetEntryURLRequest({\n serviceProviderId: serviceProviderId,\n context: context,\n skipGatewayAuthentication: options.skipGatewayAuthentication,\n path: options.path\n });\n switch (options.impersonation) {\n case 'none':\n request.noImpersonation = new NoImpersonation();\n break;\n case 'auto':\n request.autoImpersonation = new AutoImpersonation();\n break;\n // Use the proto/server default.\n case undefined:\n break;\n case null:\n break;\n default:\n request.explicitImpersonateeUserId = options.impersonation;\n break;\n }\n return this.identityProviderApiService.getEntryUrl(request).pipe(map(resp => resp.entryUrl), share());\n }\n getMultiEntryUrl(serviceProviderIds, context, options = {}) {\n const request = new GetMultiEntryURLRequest({\n serviceProviderIds: serviceProviderIds,\n context: context\n });\n switch (options.impersonation) {\n case 'none':\n request.noImpersonation = new NoImpersonation();\n break;\n case 'auto':\n request.autoImpersonation = new AutoImpersonation();\n break;\n // Use the proto/server default.\n case undefined:\n break;\n case null:\n break;\n default:\n request.explicitImpersonateeUserId = options.impersonation;\n break;\n }\n return this.identityProviderApiService.getMultiEntryUrl(request).pipe(map(resp => resp.entryUrls || []), share());\n }\n getMultiScope(scopeIds) {\n const request = new GetMultiScopeRequest({\n scopeIds: scopeIds\n });\n return this.consentAdminApiService.getMultiScope(request).pipe(map(resp => resp.scopes));\n }\n getSessionTransferURL(serviceProviderId, context) {\n const request = new GetSessionTransferURLRequest({\n serviceProviderId: serviceProviderId,\n context: context\n });\n return this.serviceProviderApiService.getSessionTransferUrl(request);\n }\n consumeSingleUseToken(userID, otp, nextUrl) {\n const request = new ConsumeSingleUseTokenRequest({\n userID: userID,\n otp: otp,\n nextUrl: nextUrl\n });\n this.identityProviderApiService.consumeSingleUseToken(request);\n }\n getServiceGatewayURLForAccount(serviceProviderID, accountID, nextPath) {\n const host = this.hostService.hostWithScheme;\n const query = new URLSearchParams({\n serviceProviderId: serviceProviderID,\n account_id: accountID\n });\n if (nextPath) {\n query.set(\"path\", nextPath);\n }\n return host + serviceGatewayPath + \"?\" + query.toString();\n }\n getServiceGatewayURLForGroupPath(serviceProviderID, groupPath, nextPath) {\n const host = this.hostService.hostWithScheme;\n const query = new URLSearchParams({\n serviceProviderId: serviceProviderID,\n group_path: groupPath\n });\n if (nextPath) {\n query.set(\"path\", nextPath);\n }\n return host + serviceGatewayPath + \"?\" + query.toString();\n }\n }\n SSOService.ɵfac = function SSOService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || SSOService)(i0.ɵɵinject(IdentityProviderApiService), i0.ɵɵinject(ConsentAdminApiService), i0.ɵɵinject(ServiceProviderApiService), i0.ɵɵinject(HostService));\n };\n SSOService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SSOService,\n factory: SSOService.ɵfac,\n providedIn: 'root'\n });\n return SSOService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction newAccountServiceContext(accountId) {\n return new ServiceContext({\n account: new ServiceContextAccount({\n accountId: accountId\n })\n });\n}\nfunction newPartnerServiceContext(partnerId) {\n return new ServiceContext({\n partner: new ServiceContextPartner({\n partnerId: partnerId\n })\n });\n}\nfunction newSuperAdminServiceContext() {\n return new ServiceContext({\n superAdmin: new ServiceContextSuperAdmin()\n });\n}\n\n// DEPRECATED, use ServiceContextPartner\nconst Partner = ServiceContextPartner;\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Access, AcsUrl, AutoImpersonation, ConsentAdminApiService, ConsentApiService, ConsumeSingleUseTokenRequest, CreateConfigRequest, CreateConfigResponse, CreateIdentityProviderConfigurationRequest, CreateSamlServiceProviderConfigRequest, CreateSamlServiceProviderConfigResponse, CreateScopeRequest, CreateServiceProviderRequest, DeleteConfigRequest, DeleteIdentityProviderConfigurationRequest, DeleteSAMLServiceProviderConfigRequest, DeleteScopeRequest, DeleteServiceProviderRequest, FieldMask, GetEntryURLRequest, GetEntryURLResponse, GetEntryURLWithCodeRequest, GetEntryURLWithCodeResponse, GetIdentityProviderConfigurationRequest, GetIdentityProviderConfigurationResponse, GetLogoutURLRequest, GetLogoutURLResponse, GetMultiConfigRequest, GetMultiConfigResponse, GetMultiConfigResponseConfigContainer, GetMultiEntryURLRequest, GetMultiEntryURLResponse, GetMultiScopeRequest, GetMultiScopeResponse, GetMultiScopeResponseScopeContainer, GetSAMLIdentityProviderMetadataRequest, GetSAMLIdentityProviderMetadataResponse, GetServiceProviderRequest, GetServiceProviderResponse, GetSessionTransferURLRequest, GetSessionTransferURLResponse, HasCustomIdentityProviderRequest, HasCustomIdentityProviderResponse, HostService, IdentityProviderAdminApiService, IdentityProviderApiService, IdentityProviderConfiguration, ListConfigsRequest, ListConfigsResponse, ListSAMLServiceProviderConfigsRequest, ListSAMLServiceProviderConfigsResponse, ListScopesRequest, ListScopesResponse, ListServiceProvidersRequest, ListServiceProvidersResponse, LogoutRequest, NoImpersonation, OAuth2Configuration, Oauth2Config, OpenIDConnectConfiguration, Partner, RegenerateSAMLServiceProviderConfigCertificateRequest, RegenerateSAMLServiceProviderConfigCertificateResponse, RevokeGrantRequest, SSOService, SamlServiceProviderConfig, Scope, ServiceContext, ServiceContextAccount, ServiceContextBrand, ServiceContextPartner, ServiceContextSuperAdmin, ServiceProviderAdminApiService, ServiceProviderApiService, ServiceProviderConfig, ServiceProviderType, UpdateConfigRequest, UpdateConfigRequestMutation, UpdateConfigRequestMutationRepeatedStringMutation, UpdateIdentityProviderConfigurationRequest, UpdateIdentityProviderConfigurationRequestMutation, UpdateIdentityProviderConfigurationRequestMutationOAuth2ConfigurationMutation, UpdateIdentityProviderConfigurationRequestMutationOpenIDConnectConfigurationMutation, UpdateSAMLServiceProviderConfigRequest, UpdateScopeRequest, UpdateScopeRequestMutation, UpdateServiceProviderRequest, UpdateServiceProviderRequestMutation, UpdateServiceProviderRequestMutationRepeatedStringMutation, newAccountServiceContext, newPartnerServiceContext, newSuperAdminServiceContext };\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport { map, share } from 'rxjs/operators';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'iam.vendasta-local.com',\n 'test': '',\n 'demo': 'iam-api-demo.apigateway.co',\n 'prod': 'iam-api-prod.apigateway.co',\n 'production': 'iam-api-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass LoginRequest {\n static fromProto(proto) {\n if (!proto) {\n return new LoginRequest();\n }\n let m = new LoginRequest();\n /* eslint-disable @typescript-eslint/no-unsafe-assignment */\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n if (typeof this.namespace === 'undefined' && typeof this.type === 'undefined' && typeof this.email === 'undefined' && typeof this.password === 'undefined' && typeof this.providerIdToken === 'undefined' && typeof this.provider === 'undefined') {\n return {};\n }\n return {\n 'namespace': typeof this.namespace !== 'undefined' ? this.namespace : null,\n 'type': typeof this.type !== 'undefined' ? this.type : null,\n 'email': typeof this.email !== 'undefined' ? this.email : null,\n 'password': typeof this.password !== 'undefined' ? this.password : null,\n 'provider_id_token': typeof this.providerIdToken !== 'undefined' ? this.providerIdToken : null,\n 'provider': typeof this.provider !== 'undefined' ? this.provider : null\n };\n }\n}\nclass LoginResponse {\n static fromProto(proto) {\n /* eslint-disable */\n const m = new LoginResponse();\n m.sessionId = proto['session_id'];\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n if (typeof this.sessionId === 'undefined') {\n return {};\n }\n return {\n 'sessionId': typeof this.sessionId !== 'undefined' ? this.sessionId : null\n };\n }\n}\nclass LogoutResponse {\n static fromProto(proto) {\n let m = new LogoutResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n if (typeof this.success === 'undefined') {\n return {};\n }\n return {\n 'success': typeof this.success !== 'undefined' ? this.success : null\n };\n }\n}\nclass SSOLoginRequest {\n static fromProto(proto) {\n let m = new SSOLoginRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n if (typeof this.nextUrl === 'undefined' && typeof this.namespace === 'undefined' && typeof this.type === 'undefined') {\n return null;\n }\n return {\n 'next_url': typeof this.nextUrl !== 'undefined' ? this.nextUrl : null,\n 'namespace': typeof this.namespace !== 'undefined' ? this.namespace : null,\n 'type': typeof this.type !== 'undefined' ? this.type : null\n };\n }\n}\n\n/* eslint-disable */\nlet IamHttpApiService = /*#__PURE__*/(() => {\n class IamHttpApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions(includeCredentials) {\n if (includeCredentials) {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/x-www-form-urlencoded'\n }),\n withCredentials: true\n };\n }\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/x-www-form-urlencoded'\n })\n };\n }\n login(r) {\n const toApiJson = r.toApiJson;\n const request = typeof toApiJson !== 'undefined' ? r : new LoginRequest(r);\n return this.http.post(this._host + '/_ajax/v1/login', request.toApiJson(), this.apiOptions()).pipe(map(resp => LoginResponse.fromProto(resp)), share());\n }\n logout() {\n return this.http.post(this._host + '/_ajax/v1/logout', {}, this.apiOptions(true)).pipe(map(resp => LogoutResponse.fromProto(resp)), share());\n }\n ssoLogin(r) {\n const toApiJson = r.toApiJson;\n const request = typeof toApiJson !== 'undefined' ? r : new SSOLoginRequest(r);\n const params = new URLSearchParams();\n const apiJson = request.toApiJson();\n for (const key in apiJson) {\n if (!apiJson.hasOwnProperty(key)) {\n continue;\n }\n const value = apiJson[key];\n if (value === null) {\n continue;\n }\n params.append(key, value);\n }\n window.location.href = `${this._host}/sso-login?${params.toString()}`;\n }\n }\n IamHttpApiService.ɵfac = function IamHttpApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IamHttpApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n IamHttpApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IamHttpApiService,\n factory: IamHttpApiService.ɵfac,\n providedIn: 'root'\n });\n return IamHttpApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar PersonaType = /*#__PURE__*/function (PersonaType) {\n PersonaType[\"partner\"] = \"partner\";\n PersonaType[\"partner_app\"] = \"partner_app\";\n PersonaType[\"sales_person\"] = \"sales_person\";\n PersonaType[\"smb\"] = \"smb\";\n PersonaType[\"vendor\"] = \"vendor\";\n PersonaType[\"digital_agent\"] = \"digital_agent\";\n PersonaType[\"developer\"] = \"developer\";\n PersonaType[\"success\"] = \"success\";\n PersonaType[\"account_group\"] = \"account_group\";\n PersonaType[\"crm_role\"] = \"crm_role\";\n return PersonaType;\n}(PersonaType || {});\nclass BasePersona {\n fromPersona(p) {\n const s = p.subject;\n this.subjectId = s.subjectId;\n this.email = s.email;\n this.created = s.created;\n this.updated = s.updated;\n this.lastLogin = s.lastLogin;\n this.userId = s.userId;\n return this.readAttributes(s.structAttributes);\n }\n readAttributes(attributes) {\n if (!attributes) {\n return this;\n }\n /* eslint-disable @typescript-eslint/no-unsafe-assignment */\n const attrs = getValueFromAttribute({\n structAttribute: {\n attributes: attributes.attributes\n }\n });\n Object.assign(this, attrs);\n return this;\n }\n}\nclass TypedPersona extends BasePersona {}\nclass NamespacedPersona extends BasePersona {\n constructor() {\n super(...arguments);\n this.partnerId = '';\n }\n fromPersona(p) {\n this.partnerId = p.context.namespaced.namespace;\n return super.fromPersona(p);\n }\n}\nfunction getValueFromAttribute(attr) {\n if (typeof attr === 'undefined') {\n return null;\n } else if (typeof attr.stringAttribute !== 'undefined') {\n return attr.stringAttribute;\n } else if (typeof attr.intAttribute !== 'undefined') {\n return attr.intAttribute;\n } else if (typeof attr.doubleAttribute !== 'undefined') {\n return attr.doubleAttribute;\n } else if (typeof attr.boolAttribute !== 'undefined') {\n return attr.boolAttribute;\n } else if (typeof attr.listAttribute !== 'undefined') {\n const vals = [];\n /* eslint-disable @typescript-eslint/no-unsafe-return */\n if (typeof attr.listAttribute.attributes === 'undefined') {\n /* eslint-disable @typescript-eslint/no-unsafe-return */\n return vals;\n }\n for (const val of attr.listAttribute.attributes) {\n vals.push(getValueFromAttribute(val));\n }\n return vals;\n } else if (typeof attr.timestampAttribute !== 'undefined') {\n return attr.timestampAttribute;\n } else if (typeof attr.geopointAttribute !== 'undefined') {\n return attr.geopointAttribute;\n } else if (typeof attr.structAttribute !== 'undefined') {\n const result = {};\n for (const a in attr.structAttribute.attributes) {\n if (!attr.structAttribute.attributes.hasOwnProperty(a)) {\n continue;\n }\n /* eslint-disable @typescript-eslint/no-unsafe-member-access */\n result[CamelCase(a)] = getValueFromAttribute(attr.structAttribute.attributes[a]);\n }\n return result;\n }\n}\nfunction CamelCase(str) {\n let result = '';\n for (let i = 0; i < str.length; i++) {\n if (str[i] === '_') {\n result += str[i + 1].toUpperCase();\n i++;\n } else {\n result += str[i];\n }\n }\n return result;\n}\nclass DeveloperPersona extends TypedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.developer;\n }\n}\nclass PartnerPersona extends TypedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.partner;\n this.isSuperAdmin = false;\n this.isAdmin = false;\n this.canCustomizeWhitelabel = false;\n this.canAccessBilling = false;\n this.canAccessAccounts = false;\n this.canAccessMarketing = false;\n this.canAccessSales = false;\n this.canAccessConcierge = false;\n this.canAccessBrands = false;\n this.canAccessDashboard = false;\n this.canAccessOrders = false;\n this.canAccessCompanyProfile = false;\n this.canAccessAutomations = false;\n this.canAccessMarketplace = false;\n this.canEnableApps = false;\n this.canAccessRetailBilling = false;\n }\n}\nclass PartnerAppPersona extends NamespacedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.partner_app;\n }\n}\nconst TitleChoice = {\n PARTNER_FOR_SMB: 'partnerForSmb',\n REP_MAN_FOR_SMB: 'repManForSmb',\n MARKET_FOR_SMB: 'marketForSmb'\n};\nclass SalespersonPersona extends NamespacedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.sales_person;\n this.titleChoice = TitleChoice.PARTNER_FOR_SMB;\n }\n}\nclass SMBPersona extends NamespacedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.smb;\n this.notificationsEnabled = true;\n }\n}\nclass VendorPersona extends TypedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.vendor;\n }\n}\nclass DigitalAgentPersona extends TypedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.digital_agent;\n }\n}\nclass SuccessPersona extends TypedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.success;\n }\n}\nclass AccountGroupPersona extends TypedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.account_group;\n }\n}\nclass CRMRolePersona extends NamespacedPersona {\n constructor() {\n super(...arguments);\n this.type = PersonaType.crm_role;\n }\n}\nfunction fromPersona(persona) {\n const type = getTypeFromContext(persona.context);\n if (type === null) {\n return null;\n }\n const personaCls = getPersonaFromType(type);\n personaCls.fromPersona(persona);\n return personaCls;\n}\nfunction getTypeFromContext(ctx) {\n const type = !!ctx.namespaced ? ctx.namespaced.type : ctx.typed.type;\n switch (type) {\n case 'partner':\n return PersonaType.partner;\n case 'partner_app':\n return PersonaType.partner_app;\n case 'sales_person':\n return PersonaType.sales_person;\n case 'smb':\n return PersonaType.smb;\n case 'vendor':\n return PersonaType.vendor;\n case 'digital_agent':\n return PersonaType.digital_agent;\n case 'developer':\n return PersonaType.developer;\n case 'success':\n return PersonaType.success;\n case 'account_group':\n return PersonaType.account_group;\n case 'crm_role':\n return PersonaType.crm_role;\n }\n return null;\n}\nfunction getPersonaFromType(personaType) {\n return new {\n 'partner': PartnerPersona,\n 'partner_app': PartnerAppPersona,\n 'sales_person': SalespersonPersona,\n 'smb': SMBPersona,\n 'vendor': VendorPersona,\n 'digital_agent': DigitalAgentPersona,\n 'developer': DeveloperPersona,\n 'success': SuccessPersona,\n 'account_group': AccountGroupPersona,\n 'crm_role': CRMRolePersona\n }[personaType]();\n}\nfunction enumStringToValue$8(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$7(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Attribute {\n static fromProto(proto) {\n let m = new Attribute();\n m = Object.assign(m, proto);\n if (proto.intAttribute) {\n m.intAttribute = parseInt(proto.intAttribute, 10);\n }\n if (proto.structAttribute) {\n m.structAttribute = StructAttribute.fromProto(proto.structAttribute);\n }\n if (proto.listAttribute) {\n m.listAttribute = ListAttribute.fromProto(proto.listAttribute);\n }\n if (proto.timestampAttribute) {\n m.timestampAttribute = new Date(proto.timestampAttribute);\n }\n if (proto.geopointAttribute) {\n m.geopointAttribute = GeoPointAttribute.fromProto(proto.geopointAttribute);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.intAttribute !== 'undefined') {\n toReturn['intAttribute'] = this.intAttribute;\n }\n if (typeof this.doubleAttribute !== 'undefined') {\n toReturn['doubleAttribute'] = this.doubleAttribute;\n }\n if (typeof this.stringAttribute !== 'undefined') {\n toReturn['stringAttribute'] = this.stringAttribute;\n }\n if (typeof this.boolAttribute !== 'undefined') {\n toReturn['boolAttribute'] = this.boolAttribute;\n }\n if (typeof this.structAttribute !== 'undefined' && this.structAttribute !== null) {\n toReturn['structAttribute'] = 'toApiJson' in this.structAttribute ? this.structAttribute.toApiJson() : this.structAttribute;\n }\n if (typeof this.listAttribute !== 'undefined' && this.listAttribute !== null) {\n toReturn['listAttribute'] = 'toApiJson' in this.listAttribute ? this.listAttribute.toApiJson() : this.listAttribute;\n }\n if (typeof this.timestampAttribute !== 'undefined' && this.timestampAttribute !== null) {\n toReturn['timestampAttribute'] = 'toApiJson' in this.timestampAttribute ? this.timestampAttribute.toApiJson() : this.timestampAttribute;\n }\n if (typeof this.geopointAttribute !== 'undefined' && this.geopointAttribute !== null) {\n toReturn['geopointAttribute'] = 'toApiJson' in this.geopointAttribute ? this.geopointAttribute.toApiJson() : this.geopointAttribute;\n }\n return toReturn;\n }\n}\nclass StructAttributeAttributesEntry {\n static fromProto(proto) {\n let m = new StructAttributeAttributesEntry();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = Attribute.fromProto(proto.value);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined' && this.value !== null) {\n toReturn['value'] = 'toApiJson' in this.value ? this.value.toApiJson() : this.value;\n }\n return toReturn;\n }\n}\nclass GeoPointAttribute {\n static fromProto(proto) {\n let m = new GeoPointAttribute();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.latitude !== 'undefined') {\n toReturn['latitude'] = this.latitude;\n }\n if (typeof this.longitude !== 'undefined') {\n toReturn['longitude'] = this.longitude;\n }\n return toReturn;\n }\n}\nclass ListAttribute {\n static fromProto(proto) {\n let m = new ListAttribute();\n m = Object.assign(m, proto);\n if (proto.attributes) {\n m.attributes = proto.attributes.map(Attribute.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributes !== 'undefined' && this.attributes !== null) {\n toReturn['attributes'] = 'toApiJson' in this.attributes ? this.attributes.toApiJson() : this.attributes;\n }\n return toReturn;\n }\n}\nclass StructAttribute {\n static fromProto(proto) {\n let m = new StructAttribute();\n m = Object.assign(m, proto);\n if (proto.attributes) {\n m.attributes = Object.keys(proto.attributes).reduce((obj, k) => {\n obj[k] = Attribute.fromProto(proto.attributes[k]);\n return obj;\n }, {});\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributes !== 'undefined' && this.attributes !== null) {\n toReturn['attributes'] = 'toApiJson' in this.attributes ? this.attributes.toApiJson() : this.attributes;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar BooleanOperator = /*#__PURE__*/function (BooleanOperator) {\n BooleanOperator[BooleanOperator[\"AND\"] = 0] = \"AND\";\n BooleanOperator[BooleanOperator[\"OR\"] = 1] = \"OR\";\n BooleanOperator[BooleanOperator[\"NOT\"] = 2] = \"NOT\";\n return BooleanOperator;\n}(BooleanOperator || {});\nvar ForOperator = /*#__PURE__*/function (ForOperator) {\n ForOperator[ForOperator[\"ANY\"] = 0] = \"ANY\";\n ForOperator[ForOperator[\"ALL\"] = 1] = \"ALL\";\n return ForOperator;\n}(ForOperator || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar AccessScope = /*#__PURE__*/function (AccessScope) {\n AccessScope[AccessScope[\"READ\"] = 0] = \"READ\";\n AccessScope[AccessScope[\"WRITE\"] = 1] = \"WRITE\";\n AccessScope[AccessScope[\"DELETE\"] = 2] = \"DELETE\";\n AccessScope[AccessScope[\"LIST\"] = 3] = \"LIST\";\n return AccessScope;\n}(AccessScope || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar AlgorithmType = /*#__PURE__*/function (AlgorithmType) {\n AlgorithmType[AlgorithmType[\"ALGORITHM_TYPE_ES256\"] = 0] = \"ALGORITHM_TYPE_ES256\";\n AlgorithmType[AlgorithmType[\"ALGORITHM_TYPE_RS256\"] = 1] = \"ALGORITHM_TYPE_RS256\";\n return AlgorithmType;\n}(AlgorithmType || {});\nvar OrderByDirection = /*#__PURE__*/function (OrderByDirection) {\n OrderByDirection[OrderByDirection[\"ASCENDING\"] = 0] = \"ASCENDING\";\n OrderByDirection[OrderByDirection[\"DESCENDING\"] = 1] = \"DESCENDING\";\n return OrderByDirection;\n}(OrderByDirection || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar RestrictionType = /*#__PURE__*/function (RestrictionType) {\n RestrictionType[RestrictionType[\"RESTRICTION_TYPE_UNSET\"] = 0] = \"RESTRICTION_TYPE_UNSET\";\n RestrictionType[RestrictionType[\"RESTRICTION_TYPE_RESET_PASSWORD_BEFORE_LOGIN\"] = 1] = \"RESTRICTION_TYPE_RESET_PASSWORD_BEFORE_LOGIN\";\n RestrictionType[RestrictionType[\"RESTRICTION_TYPE_FROZEN\"] = 2] = \"RESTRICTION_TYPE_FROZEN\";\n return RestrictionType;\n}(RestrictionType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar SortDirection = /*#__PURE__*/function (SortDirection) {\n SortDirection[SortDirection[\"SORT_DIRECTION_INVALID\"] = 0] = \"SORT_DIRECTION_INVALID\";\n SortDirection[SortDirection[\"SORT_DIRECTION_ASCENDING\"] = 1] = \"SORT_DIRECTION_ASCENDING\";\n SortDirection[SortDirection[\"SORT_DIRECTION_DESCENDING\"] = 2] = \"SORT_DIRECTION_DESCENDING\";\n return SortDirection;\n}(SortDirection || {});\nvar UserSortField = /*#__PURE__*/function (UserSortField) {\n UserSortField[UserSortField[\"USER_SORT_FIELD_INVALID\"] = 0] = \"USER_SORT_FIELD_INVALID\";\n UserSortField[UserSortField[\"USER_SORT_FIELD_CREATED\"] = 1] = \"USER_SORT_FIELD_CREATED\";\n UserSortField[UserSortField[\"USER_SORT_FIELD_FIRST_NAME\"] = 2] = \"USER_SORT_FIELD_FIRST_NAME\";\n UserSortField[UserSortField[\"USER_SORT_FIELD_LAST_NAME\"] = 3] = \"USER_SORT_FIELD_LAST_NAME\";\n UserSortField[UserSortField[\"USER_SORT_FIELD_EMAIL\"] = 4] = \"USER_SORT_FIELD_EMAIL\";\n UserSortField[UserSortField[\"USER_SORT_FIELD_LAST_LOGIN\"] = 5] = \"USER_SORT_FIELD_LAST_LOGIN\";\n return UserSortField;\n}(UserSortField || {});\n// *********************************\n\n// NOTE: THIS HAS BEEN MANUALLY EDITED. PLEASE SEE THE BELOW COMMENTS TO SEE WHERE IT HAS BEEN EDITED\nfunction enumStringToValue$6(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass IfClause {\n static fromProto(proto) {\n let m = new IfClause();\n m = Object.assign(m, proto);\n if (proto.resourceAttributeValue) {\n m.resourceAttributeValue = Attribute.fromProto(proto.resourceAttributeValue);\n }\n if (proto.thenPolicy) {\n m.thenPolicy = PolicyNode.fromProto(proto.thenPolicy);\n }\n if (proto.elsePolicy) {\n m.elsePolicy = PolicyNode.fromProto(proto.elsePolicy);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.resourceAttributeName !== 'undefined') {\n toReturn['resourceAttributeName'] = this.resourceAttributeName;\n }\n if (typeof this.resourceAttributeValue !== 'undefined' && this.resourceAttributeValue !== null) {\n toReturn['resourceAttributeValue'] = 'toApiJson' in this.resourceAttributeValue ? this.resourceAttributeValue.toApiJson() : this.resourceAttributeValue;\n }\n if (typeof this.thenPolicy !== 'undefined' && this.thenPolicy !== null) {\n toReturn['thenPolicy'] = 'toApiJson' in this.thenPolicy ? this.thenPolicy.toApiJson() : this.thenPolicy;\n }\n if (typeof this.elsePolicy !== 'undefined' && this.elsePolicy !== null) {\n toReturn['elsePolicy'] = 'toApiJson' in this.elsePolicy ? this.elsePolicy.toApiJson() : this.elsePolicy;\n }\n return toReturn;\n }\n}\nclass Operator {\n static fromProto(proto) {\n let m = new Operator();\n m = Object.assign(m, proto);\n // Edited from e.policiesBooleanOperator to e.BooleanOperator\n if (proto.operator) {\n m.operator = enumStringToValue$6(BooleanOperator, proto.operator);\n }\n if (proto.children) {\n m.children = proto.children.map(PolicyNode.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.operator !== 'undefined') {\n toReturn['operator'] = this.operator;\n }\n if (typeof this.children !== 'undefined' && this.children !== null) {\n toReturn['children'] = 'toApiJson' in this.children ? this.children.toApiJson() : this.children;\n }\n return toReturn;\n }\n}\nclass PolicyNode {\n static fromProto(proto) {\n let m = new PolicyNode();\n m = Object.assign(m, proto);\n if (proto.subjectResourceIntersection) {\n m.subjectResourceIntersection = SubjectResourceIntersectionClause.fromProto(proto.subjectResourceIntersection);\n }\n if (proto.operator) {\n m.operator = Operator.fromProto(proto.operator);\n }\n if (proto.subjectValueIntersection) {\n m.subjectValueIntersection = SubjectValueIntersectionClause.fromProto(proto.subjectValueIntersection);\n }\n if (proto.subjectMissingValue) {\n m.subjectMissingValue = SubjectMissingValueClause.fromProto(proto.subjectMissingValue);\n }\n if (proto.subjectResourceSubset) {\n m.subjectResourceSubset = SubjectResourceSubsetClause.fromProto(proto.subjectResourceSubset);\n }\n if (proto.subjectResourceFor) {\n m.subjectResourceFor = SubjectResourceForClause.fromProto(proto.subjectResourceFor);\n }\n if (proto.ifClause) {\n m.ifClause = IfClause.fromProto(proto.ifClause);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjectResourceIntersection !== 'undefined' && this.subjectResourceIntersection !== null) {\n toReturn['subjectResourceIntersection'] = 'toApiJson' in this.subjectResourceIntersection ? this.subjectResourceIntersection.toApiJson() : this.subjectResourceIntersection;\n }\n if (typeof this.operator !== 'undefined' && this.operator !== null) {\n toReturn['operator'] = 'toApiJson' in this.operator ? this.operator.toApiJson() : this.operator;\n }\n if (typeof this.subjectValueIntersection !== 'undefined' && this.subjectValueIntersection !== null) {\n toReturn['subjectValueIntersection'] = 'toApiJson' in this.subjectValueIntersection ? this.subjectValueIntersection.toApiJson() : this.subjectValueIntersection;\n }\n if (typeof this.subjectMissingValue !== 'undefined' && this.subjectMissingValue !== null) {\n toReturn['subjectMissingValue'] = 'toApiJson' in this.subjectMissingValue ? this.subjectMissingValue.toApiJson() : this.subjectMissingValue;\n }\n if (typeof this.subjectResourceSubset !== 'undefined' && this.subjectResourceSubset !== null) {\n toReturn['subjectResourceSubset'] = 'toApiJson' in this.subjectResourceSubset ? this.subjectResourceSubset.toApiJson() : this.subjectResourceSubset;\n }\n if (typeof this.subjectResourceFor !== 'undefined' && this.subjectResourceFor !== null) {\n toReturn['subjectResourceFor'] = 'toApiJson' in this.subjectResourceFor ? this.subjectResourceFor.toApiJson() : this.subjectResourceFor;\n }\n if (typeof this.ifClause !== 'undefined' && this.ifClause !== null) {\n toReturn['ifClause'] = 'toApiJson' in this.ifClause ? this.ifClause.toApiJson() : this.ifClause;\n }\n return toReturn;\n }\n}\nclass SubjectMissingValueClause {\n static fromProto(proto) {\n let m = new SubjectMissingValueClause();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributeName !== 'undefined') {\n toReturn['attributeName'] = this.attributeName;\n }\n return toReturn;\n }\n}\nclass SubjectResourceForClause {\n static fromProto(proto) {\n let m = new SubjectResourceForClause();\n m = Object.assign(m, proto);\n if (proto.operator) {\n m.operator = enumStringToValue$6(ForOperator, proto.operator);\n }\n if (proto.rules) {\n m.rules = PolicyNode.fromProto(proto.rules);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributeName !== 'undefined') {\n toReturn['attributeName'] = this.attributeName;\n }\n if (typeof this.operator !== 'undefined') {\n toReturn['operator'] = this.operator;\n }\n if (typeof this.rules !== 'undefined' && this.rules !== null) {\n toReturn['rules'] = 'toApiJson' in this.rules ? this.rules.toApiJson() : this.rules;\n }\n return toReturn;\n }\n}\nclass SubjectResourceIntersectionClause {\n static fromProto(proto) {\n let m = new SubjectResourceIntersectionClause();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributeName !== 'undefined') {\n toReturn['attributeName'] = this.attributeName;\n }\n if (typeof this.resourceAttributeName !== 'undefined') {\n toReturn['resourceAttributeName'] = this.resourceAttributeName;\n }\n return toReturn;\n }\n}\nclass SubjectResourceSubsetClause {\n static fromProto(proto) {\n let m = new SubjectResourceSubsetClause();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributeName !== 'undefined') {\n toReturn['attributeName'] = this.attributeName;\n }\n if (typeof this.resourceAttributeName !== 'undefined') {\n toReturn['resourceAttributeName'] = this.resourceAttributeName;\n }\n return toReturn;\n }\n}\nclass SubjectValueIntersectionClause {\n static fromProto(proto) {\n let m = new SubjectValueIntersectionClause();\n m = Object.assign(m, proto);\n if (proto.structuredAttributeValue) {\n m.structuredAttributeValue = Attribute.fromProto(proto.structuredAttributeValue);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.attributeName !== 'undefined') {\n toReturn['attributeName'] = this.attributeName;\n }\n if (typeof this.attributeValue !== 'undefined') {\n toReturn['attributeValue'] = this.attributeValue;\n }\n if (typeof this.structuredAttributeValue !== 'undefined' && this.structuredAttributeValue !== null) {\n toReturn['structuredAttributeValue'] = 'toApiJson' in this.structuredAttributeValue ? this.structuredAttributeValue.toApiJson() : this.structuredAttributeValue;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AccessCheckFailures {\n static fromProto(proto) {\n let m = new AccessCheckFailures();\n m = Object.assign(m, proto);\n if (proto.failures) {\n m.failures = proto.failures.map(ResourceIdentifier.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.failures !== 'undefined' && this.failures !== null) {\n toReturn['failures'] = 'toApiJson' in this.failures ? this.failures.toApiJson() : this.failures;\n }\n return toReturn;\n }\n}\nclass ResourceIdentifierIdentifiersEntry {\n static fromProto(proto) {\n let m = new ResourceIdentifierIdentifiersEntry();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = ValueList.fromProto(proto.value);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined' && this.value !== null) {\n toReturn['value'] = 'toApiJson' in this.value ? this.value.toApiJson() : this.value;\n }\n return toReturn;\n }\n}\nclass Policy {\n static fromProto(proto) {\n let m = new Policy();\n m = Object.assign(m, proto);\n if (proto.operations) {\n m.operations = proto.operations.map(v => enumStringToValue$5(AccessScope, v));\n }\n if (proto.policy) {\n m.policy = PolicyNode.fromProto(proto.policy);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n if (typeof this.resourceId !== 'undefined') {\n toReturn['resourceId'] = this.resourceId;\n }\n if (typeof this.policyId !== 'undefined') {\n toReturn['policyId'] = this.policyId;\n }\n if (typeof this.policyName !== 'undefined') {\n toReturn['policyName'] = this.policyName;\n }\n if (typeof this.operations !== 'undefined') {\n toReturn['operations'] = this.operations;\n }\n if (typeof this.actions !== 'undefined') {\n toReturn['actions'] = this.actions;\n }\n if (typeof this.policy !== 'undefined' && this.policy !== null) {\n toReturn['policy'] = 'toApiJson' in this.policy ? this.policy.toApiJson() : this.policy;\n }\n return toReturn;\n }\n}\nclass ResourceIdentifier {\n static fromProto(proto) {\n let m = new ResourceIdentifier();\n m = Object.assign(m, proto);\n if (proto.identifiers) {\n m.identifiers = Object.keys(proto.identifiers).reduce((obj, k) => {\n obj[k] = ValueList.fromProto(proto.identifiers[k]);\n return obj;\n }, {});\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.identifiers !== 'undefined' && this.identifiers !== null) {\n toReturn['identifiers'] = 'toApiJson' in this.identifiers ? this.identifiers.toApiJson() : this.identifiers;\n }\n return toReturn;\n }\n}\nclass ResourceOwner {\n static fromProto(proto) {\n let m = new ResourceOwner();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n if (typeof this.appName !== 'undefined') {\n toReturn['appName'] = this.appName;\n }\n return toReturn;\n }\n}\nclass ValueList {\n static fromProto(proto) {\n let m = new ValueList();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.values !== 'undefined') {\n toReturn['values'] = this.values;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Context {\n static fromProto(proto) {\n let m = new Context();\n m = Object.assign(m, proto);\n if (proto.namespaced) {\n m.namespaced = NamespacedContext.fromProto(proto.namespaced);\n }\n if (proto.typed) {\n m.typed = TypedContext.fromProto(proto.typed);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespaced !== 'undefined' && this.namespaced !== null) {\n toReturn['namespaced'] = 'toApiJson' in this.namespaced ? this.namespaced.toApiJson() : this.namespaced;\n }\n if (typeof this.typed !== 'undefined' && this.typed !== null) {\n toReturn['typed'] = 'toApiJson' in this.typed ? this.typed.toApiJson() : this.typed;\n }\n return toReturn;\n }\n}\nclass MultiValueAttribute {\n static fromProto(proto) {\n let m = new MultiValueAttribute();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.values !== 'undefined') {\n toReturn['values'] = this.values;\n }\n return toReturn;\n }\n}\nclass Mutation {\n static fromProto(proto) {\n let m = new Mutation();\n m = Object.assign(m, proto);\n if (proto.add) {\n m.add = SingleValueAttribute.fromProto(proto.add);\n }\n if (proto.replace) {\n m.replace = MultiValueAttribute.fromProto(proto.replace);\n }\n if (proto.remove) {\n m.remove = SingleValueAttribute.fromProto(proto.remove);\n }\n if (proto.replaceAttributes) {\n m.replaceAttributes = StructAttribute.fromProto(proto.replaceAttributes);\n }\n if (proto.addAttributes) {\n m.addAttributes = StructAttribute.fromProto(proto.addAttributes);\n }\n if (proto.removeAttributes) {\n m.removeAttributes = StructAttribute.fromProto(proto.removeAttributes);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.add !== 'undefined' && this.add !== null) {\n toReturn['add'] = 'toApiJson' in this.add ? this.add.toApiJson() : this.add;\n }\n if (typeof this.replace !== 'undefined' && this.replace !== null) {\n toReturn['replace'] = 'toApiJson' in this.replace ? this.replace.toApiJson() : this.replace;\n }\n if (typeof this.remove !== 'undefined' && this.remove !== null) {\n toReturn['remove'] = 'toApiJson' in this.remove ? this.remove.toApiJson() : this.remove;\n }\n if (typeof this.dropKey !== 'undefined') {\n toReturn['dropKey'] = this.dropKey;\n }\n if (typeof this.replaceAttributes !== 'undefined' && this.replaceAttributes !== null) {\n toReturn['replaceAttributes'] = 'toApiJson' in this.replaceAttributes ? this.replaceAttributes.toApiJson() : this.replaceAttributes;\n }\n if (typeof this.addAttributes !== 'undefined' && this.addAttributes !== null) {\n toReturn['addAttributes'] = 'toApiJson' in this.addAttributes ? this.addAttributes.toApiJson() : this.addAttributes;\n }\n if (typeof this.removeAttributes !== 'undefined' && this.removeAttributes !== null) {\n toReturn['removeAttributes'] = 'toApiJson' in this.removeAttributes ? this.removeAttributes.toApiJson() : this.removeAttributes;\n }\n return toReturn;\n }\n}\nclass NamespacedContext {\n static fromProto(proto) {\n let m = new NamespacedContext();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n return toReturn;\n }\n}\nclass Persona {\n static fromProto(proto) {\n let m = new Persona();\n m = Object.assign(m, proto);\n if (proto.subject) {\n m.subject = Subject.fromProto(proto.subject);\n }\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subject !== 'undefined' && this.subject !== null) {\n toReturn['subject'] = 'toApiJson' in this.subject ? this.subject.toApiJson() : this.subject;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n return toReturn;\n }\n}\nclass PublicKey {\n static fromProto(proto) {\n let m = new PublicKey();\n m = Object.assign(m, proto);\n if (proto.algorithmType) {\n m.algorithmType = enumStringToValue$4(AlgorithmType, proto.algorithmType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.algorithmType !== 'undefined') {\n toReturn['algorithmType'] = this.algorithmType;\n }\n return toReturn;\n }\n}\nclass Query {\n static fromProto(proto) {\n let m = new Query();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.searchTerm !== 'undefined') {\n toReturn['searchTerm'] = this.searchTerm;\n }\n if (typeof this.attributeKeys !== 'undefined') {\n toReturn['attributeKeys'] = this.attributeKeys;\n }\n return toReturn;\n }\n}\nclass SingleValueAttribute {\n static fromProto(proto) {\n let m = new SingleValueAttribute();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass Subject {\n static fromProto(proto) {\n let m = new Subject();\n m = Object.assign(m, proto);\n if (proto.attributes) {\n m.attributes = proto.attributes.map(MultiValueAttribute.fromProto);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.lastLogin) {\n m.lastLogin = new Date(proto.lastLogin);\n }\n if (proto.publicKeys) {\n m.publicKeys = proto.publicKeys.map(PublicKey.fromProto);\n }\n if (proto.structAttributes) {\n m.structAttributes = StructAttribute.fromProto(proto.structAttributes);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.attributes !== 'undefined' && this.attributes !== null) {\n toReturn['attributes'] = 'toApiJson' in this.attributes ? this.attributes.toApiJson() : this.attributes;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.lastLogin !== 'undefined' && this.lastLogin !== null) {\n toReturn['lastLogin'] = 'toApiJson' in this.lastLogin ? this.lastLogin.toApiJson() : this.lastLogin;\n }\n if (typeof this.publicKeys !== 'undefined' && this.publicKeys !== null) {\n toReturn['publicKeys'] = 'toApiJson' in this.publicKeys ? this.publicKeys.toApiJson() : this.publicKeys;\n }\n if (typeof this.structAttributes !== 'undefined' && this.structAttributes !== null) {\n toReturn['structAttributes'] = 'toApiJson' in this.structAttributes ? this.structAttributes.toApiJson() : this.structAttributes;\n }\n return toReturn;\n }\n}\nclass SubjectResult {\n static fromProto(proto) {\n let m = new SubjectResult();\n m = Object.assign(m, proto);\n if (proto.subject) {\n m.subject = Subject.fromProto(proto.subject);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subject !== 'undefined' && this.subject !== null) {\n toReturn['subject'] = 'toApiJson' in this.subject ? this.subject.toApiJson() : this.subject;\n }\n return toReturn;\n }\n}\nclass TypedContext {\n static fromProto(proto) {\n let m = new TypedContext();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass SecurityLog {\n static fromProto(proto) {\n let m = new SecurityLog();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.actionId !== 'undefined') {\n toReturn['actionId'] = this.actionId;\n }\n if (typeof this.logId !== 'undefined') {\n toReturn['logId'] = this.logId;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Identifier {\n static fromProto(proto) {\n let m = new Identifier();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass NamespacedEmail {\n static fromProto(proto) {\n let m = new NamespacedEmail();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n return toReturn;\n }\n}\nclass NamespacedSession {\n static fromProto(proto) {\n let m = new NamespacedSession();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.session !== 'undefined') {\n toReturn['session'] = this.session;\n }\n return toReturn;\n }\n}\nclass TypedExternalIdentifier {\n static fromProto(proto) {\n let m = new TypedExternalIdentifier();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.externalIdType !== 'undefined') {\n toReturn['externalIdType'] = this.externalIdType;\n }\n if (typeof this.externalId !== 'undefined') {\n toReturn['externalId'] = this.externalId;\n }\n return toReturn;\n }\n}\nclass User {\n static fromProto(proto) {\n let m = new User();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.lastLogin) {\n m.lastLogin = new Date(proto.lastLogin);\n }\n if (proto.publicKeys) {\n m.publicKeys = proto.publicKeys.map(PublicKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.greetingName !== 'undefined') {\n toReturn['greetingName'] = this.greetingName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.languageCode !== 'undefined') {\n toReturn['languageCode'] = this.languageCode;\n }\n if (typeof this.emailVerified !== 'undefined') {\n toReturn['emailVerified'] = this.emailVerified;\n }\n if (typeof this.roles !== 'undefined') {\n toReturn['roles'] = this.roles;\n }\n if (typeof this.lastLogin !== 'undefined' && this.lastLogin !== null) {\n toReturn['lastLogin'] = 'toApiJson' in this.lastLogin ? this.lastLogin.toApiJson() : this.lastLogin;\n }\n if (typeof this.publicKeys !== 'undefined' && this.publicKeys !== null) {\n toReturn['publicKeys'] = 'toApiJson' in this.publicKeys ? this.publicKeys.toApiJson() : this.publicKeys;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Access {\n static fromProto(proto) {\n let m = new Access();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scope !== 'undefined') {\n toReturn['scope'] = this.scope;\n }\n if (typeof this.public !== 'undefined') {\n toReturn['public'] = this.public;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AccessResourceRequest {\n static fromProto(proto) {\n let m = new AccessResourceRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.resourceEntityIdentifier) {\n m.resourceEntityIdentifier = Object.keys(proto.resourceEntityIdentifier).reduce((obj, k) => {\n obj[k] = ValueList.fromProto(proto.resourceEntityIdentifier[k]);\n return obj;\n }, {});\n }\n if (proto.accessScope) {\n m.accessScope = proto.accessScope.map(v => enumStringToValue(AccessScope, v));\n }\n if (proto.resourceEntityIdentifiers) {\n m.resourceEntityIdentifiers = proto.resourceEntityIdentifiers.map(ResourceIdentifier.fromProto);\n }\n if (proto.resourceAttributes) {\n m.resourceAttributes = StructAttribute.fromProto(proto.resourceAttributes);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.session !== 'undefined') {\n toReturn['session'] = this.session;\n }\n if (typeof this.ownerId !== 'undefined') {\n toReturn['ownerId'] = this.ownerId;\n }\n if (typeof this.resourceId !== 'undefined') {\n toReturn['resourceId'] = this.resourceId;\n }\n if (typeof this.resourceEntityIdentifier !== 'undefined' && this.resourceEntityIdentifier !== null) {\n toReturn['resourceEntityIdentifier'] = 'toApiJson' in this.resourceEntityIdentifier ? this.resourceEntityIdentifier.toApiJson() : this.resourceEntityIdentifier;\n }\n if (typeof this.accessScope !== 'undefined') {\n toReturn['accessScope'] = this.accessScope;\n }\n if (typeof this.actions !== 'undefined') {\n toReturn['actions'] = this.actions;\n }\n if (typeof this.resourceEntityIdentifiers !== 'undefined' && this.resourceEntityIdentifiers !== null) {\n toReturn['resourceEntityIdentifiers'] = 'toApiJson' in this.resourceEntityIdentifiers ? this.resourceEntityIdentifiers.toApiJson() : this.resourceEntityIdentifiers;\n }\n if (typeof this.resourceAttributes !== 'undefined' && this.resourceAttributes !== null) {\n toReturn['resourceAttributes'] = 'toApiJson' in this.resourceAttributes ? this.resourceAttributes.toApiJson() : this.resourceAttributes;\n }\n return toReturn;\n }\n}\nclass AddKeyRequest {\n static fromProto(proto) {\n let m = new AddKeyRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.algorithmType) {\n m.algorithmType = enumStringToValue(AlgorithmType, proto.algorithmType);\n }\n if (proto.userIdentifier) {\n m.userIdentifier = UserIdentifier.fromProto(proto.userIdentifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.algorithmType !== 'undefined') {\n toReturn['algorithmType'] = this.algorithmType;\n }\n if (typeof this.userIdentifier !== 'undefined' && this.userIdentifier !== null) {\n toReturn['userIdentifier'] = 'toApiJson' in this.userIdentifier ? this.userIdentifier.toApiJson() : this.userIdentifier;\n }\n return toReturn;\n }\n}\nclass AddKeyResponse {\n static fromProto(proto) {\n let m = new AddKeyResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.privateKey !== 'undefined') {\n toReturn['privateKey'] = this.privateKey;\n }\n if (typeof this.keyId !== 'undefined') {\n toReturn['keyId'] = this.keyId;\n }\n return toReturn;\n }\n}\nclass AddMultiUserRestrictionRequest {\n static fromProto(proto) {\n let m = new AddMultiUserRestrictionRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifiers) {\n m.userIdentifiers = proto.userIdentifiers.map(UserIdentifier.fromProto);\n }\n if (proto.restrictionType) {\n m.restrictionType = enumStringToValue(RestrictionType, proto.restrictionType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifiers !== 'undefined' && this.userIdentifiers !== null) {\n toReturn['userIdentifiers'] = 'toApiJson' in this.userIdentifiers ? this.userIdentifiers.toApiJson() : this.userIdentifiers;\n }\n if (typeof this.restrictionType !== 'undefined') {\n toReturn['restrictionType'] = this.restrictionType;\n }\n return toReturn;\n }\n}\nclass AuthenticateSubjectRequest {\n static fromProto(proto) {\n let m = new AuthenticateSubjectRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.password !== 'undefined') {\n toReturn['password'] = this.password;\n }\n return toReturn;\n }\n}\nclass ChangeSubjectEmailRequest {\n static fromProto(proto) {\n let m = new ChangeSubjectEmailRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n if (typeof this.newEmail !== 'undefined') {\n toReturn['newEmail'] = this.newEmail;\n }\n return toReturn;\n }\n}\nclass CreateExternalIDRequest {\n static fromProto(proto) {\n let m = new CreateExternalIDRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifier) {\n m.userIdentifier = UserIdentifier.fromProto(proto.userIdentifier);\n }\n if (proto.typedExternalIdentifier) {\n m.typedExternalIdentifier = TypedExternalIdentifier.fromProto(proto.typedExternalIdentifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifier !== 'undefined' && this.userIdentifier !== null) {\n toReturn['userIdentifier'] = 'toApiJson' in this.userIdentifier ? this.userIdentifier.toApiJson() : this.userIdentifier;\n }\n if (typeof this.typedExternalIdentifier !== 'undefined' && this.typedExternalIdentifier !== null) {\n toReturn['typedExternalIdentifier'] = 'toApiJson' in this.typedExternalIdentifier ? this.typedExternalIdentifier.toApiJson() : this.typedExternalIdentifier;\n }\n return toReturn;\n }\n}\nclass CreateSessionRequest {\n static fromProto(proto) {\n let m = new CreateSessionRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.oauthCredentials) {\n m.oauthCredentials = OAuthCredentials.fromProto(proto.oauthCredentials);\n }\n if (proto.subjectCredentials) {\n m.subjectCredentials = SubjectCredentials.fromProto(proto.subjectCredentials);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.oauthCredentials !== 'undefined' && this.oauthCredentials !== null) {\n toReturn['oauthCredentials'] = 'toApiJson' in this.oauthCredentials ? this.oauthCredentials.toApiJson() : this.oauthCredentials;\n }\n if (typeof this.subjectCredentials !== 'undefined' && this.subjectCredentials !== null) {\n toReturn['subjectCredentials'] = 'toApiJson' in this.subjectCredentials ? this.subjectCredentials.toApiJson() : this.subjectCredentials;\n }\n return toReturn;\n }\n}\nclass CreateSessionResponse {\n static fromProto(proto) {\n let m = new CreateSessionResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.session !== 'undefined') {\n toReturn['session'] = this.session;\n }\n return toReturn;\n }\n}\nclass CreateTemporarySubjectRequest {\n static fromProto(proto) {\n let m = new CreateTemporarySubjectRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.attributes) {\n m.attributes = StructAttribute.fromProto(proto.attributes);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subject !== 'undefined') {\n toReturn['subject'] = this.subject;\n }\n if (typeof this.attributes !== 'undefined' && this.attributes !== null) {\n toReturn['attributes'] = 'toApiJson' in this.attributes ? this.attributes.toApiJson() : this.attributes;\n }\n return toReturn;\n }\n}\nclass CreateTemporarySubjectResponse {\n static fromProto(proto) {\n let m = new CreateTemporarySubjectResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.session !== 'undefined') {\n toReturn['session'] = this.session;\n }\n return toReturn;\n }\n}\nclass DeleteSubjectRequest {\n static fromProto(proto) {\n let m = new DeleteSubjectRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n return toReturn;\n }\n}\nclass DeleteUserRequest {\n static fromProto(proto) {\n let m = new DeleteUserRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifier) {\n m.userIdentifier = UserIdentifier.fromProto(proto.userIdentifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifier !== 'undefined' && this.userIdentifier !== null) {\n toReturn['userIdentifier'] = 'toApiJson' in this.userIdentifier ? this.userIdentifier.toApiJson() : this.userIdentifier;\n }\n return toReturn;\n }\n}\nclass ListSecurityLogsRequestFilters {\n static fromProto(proto) {\n let m = new ListSecurityLogsRequestFilters();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.actionId !== 'undefined') {\n toReturn['actionId'] = this.actionId;\n }\n return toReturn;\n }\n}\nclass GetImpersonationTokenRequest {\n static fromProto(proto) {\n let m = new GetImpersonationTokenRequest();\n m = Object.assign(m, proto);\n if (proto.impersonatee) {\n m.impersonatee = UserIdentifier.fromProto(proto.impersonatee);\n }\n if (proto.impersonator) {\n m.impersonator = UserIdentifier.fromProto(proto.impersonator);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.impersonatee !== 'undefined' && this.impersonatee !== null) {\n toReturn['impersonatee'] = 'toApiJson' in this.impersonatee ? this.impersonatee.toApiJson() : this.impersonatee;\n }\n if (typeof this.impersonator !== 'undefined' && this.impersonator !== null) {\n toReturn['impersonator'] = 'toApiJson' in this.impersonator ? this.impersonator.toApiJson() : this.impersonator;\n }\n return toReturn;\n }\n}\nclass GetImpersonationTokenResponse {\n static fromProto(proto) {\n let m = new GetImpersonationTokenResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n return toReturn;\n }\n}\nclass GetMultiExternalIDRequest {\n static fromProto(proto) {\n let m = new GetMultiExternalIDRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifiers) {\n m.userIdentifiers = proto.userIdentifiers.map(UserIdentifier.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifiers !== 'undefined' && this.userIdentifiers !== null) {\n toReturn['userIdentifiers'] = 'toApiJson' in this.userIdentifiers ? this.userIdentifiers.toApiJson() : this.userIdentifiers;\n }\n if (typeof this.externalIdType !== 'undefined') {\n toReturn['externalIdType'] = this.externalIdType;\n }\n return toReturn;\n }\n}\nclass GetMultiExternalIDResponse {\n static fromProto(proto) {\n let m = new GetMultiExternalIDResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.externalIds !== 'undefined') {\n toReturn['externalIds'] = this.externalIds;\n }\n return toReturn;\n }\n}\nclass GetMultiUsersRequest {\n static fromProto(proto) {\n let m = new GetMultiUsersRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifiers) {\n m.userIdentifiers = proto.userIdentifiers.map(UserIdentifier.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifiers !== 'undefined' && this.userIdentifiers !== null) {\n toReturn['userIdentifiers'] = 'toApiJson' in this.userIdentifiers ? this.userIdentifiers.toApiJson() : this.userIdentifiers;\n }\n return toReturn;\n }\n}\nclass GetMultiUsersResponse {\n static fromProto(proto) {\n let m = new GetMultiUsersResponse();\n m = Object.assign(m, proto);\n if (proto.users) {\n m.users = proto.users.map(GetMultiUsersResponseUserContainer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n return toReturn;\n }\n}\nclass GetResetPasswordTokenRequest {\n static fromProto(proto) {\n let m = new GetResetPasswordTokenRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.userIdentifier) {\n m.userIdentifier = UserIdentifier.fromProto(proto.userIdentifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.userIdentifier !== 'undefined' && this.userIdentifier !== null) {\n toReturn['userIdentifier'] = 'toApiJson' in this.userIdentifier ? this.userIdentifier.toApiJson() : this.userIdentifier;\n }\n return toReturn;\n }\n}\nclass GetSessionTokenRequest {\n static fromProto(proto) {\n let m = new GetSessionTokenRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n return toReturn;\n }\n}\nclass GetShortLivedTokenRequest {\n static fromProto(proto) {\n let m = new GetShortLivedTokenRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n return toReturn;\n }\n}\nclass GetSubjectBySessionRequest {\n static fromProto(proto) {\n let m = new GetSubjectBySessionRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.session !== 'undefined') {\n toReturn['session'] = this.session;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n return toReturn;\n }\n}\nclass GetSubjectContextRequest {\n static fromProto(proto) {\n let m = new GetSubjectContextRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n return toReturn;\n }\n}\nclass GetSubjectContextResponse {\n static fromProto(proto) {\n let m = new GetSubjectContextResponse();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n return toReturn;\n }\n}\nclass GetSubjectResponse {\n static fromProto(proto) {\n let m = new GetSubjectResponse();\n m = Object.assign(m, proto);\n if (proto.subject) {\n m.subject = SubjectResult.fromProto(proto.subject);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subject !== 'undefined' && this.subject !== null) {\n toReturn['subject'] = 'toApiJson' in this.subject ? this.subject.toApiJson() : this.subject;\n }\n return toReturn;\n }\n}\nclass GetSubjectsByEmailRequest {\n static fromProto(proto) {\n let m = new GetSubjectsByEmailRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.emails !== 'undefined') {\n toReturn['emails'] = this.emails;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass GetSubjectsRequest {\n static fromProto(proto) {\n let m = new GetSubjectsRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n if (proto.identifiers) {\n m.identifiers = proto.identifiers.map(Identifier.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subjectIds !== 'undefined') {\n toReturn['subjectIds'] = this.subjectIds;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n if (typeof this.identifiers !== 'undefined' && this.identifiers !== null) {\n toReturn['identifiers'] = 'toApiJson' in this.identifiers ? this.identifiers.toApiJson() : this.identifiers;\n }\n return toReturn;\n }\n}\nclass GetSubjectsResponse {\n static fromProto(proto) {\n let m = new GetSubjectsResponse();\n m = Object.assign(m, proto);\n if (proto.subjects) {\n m.subjects = proto.subjects.map(SubjectResult.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjects !== 'undefined' && this.subjects !== null) {\n toReturn['subjects'] = 'toApiJson' in this.subjects ? this.subjects.toApiJson() : this.subjects;\n }\n return toReturn;\n }\n}\nclass GetTokenRequest {\n static fromProto(proto) {\n let m = new GetTokenRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n return toReturn;\n }\n}\nclass GetTokenResponse {\n static fromProto(proto) {\n let m = new GetTokenResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n return toReturn;\n }\n}\nclass IAMListPersonasRequest {\n static fromProto(proto) {\n let m = new IAMListPersonasRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifier) {\n m.userIdentifier = UserIdentifier.fromProto(proto.userIdentifier);\n }\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifier !== 'undefined' && this.userIdentifier !== null) {\n toReturn['userIdentifier'] = 'toApiJson' in this.userIdentifier ? this.userIdentifier.toApiJson() : this.userIdentifier;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.alwaysIncludeSuperadmin !== 'undefined') {\n toReturn['alwaysIncludeSuperadmin'] = this.alwaysIncludeSuperadmin;\n }\n return toReturn;\n }\n}\nclass ListPersonasByEmailRequest {\n static fromProto(proto) {\n let m = new ListPersonasByEmailRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n return toReturn;\n }\n}\nclass ListPersonasRequest {\n static fromProto(proto) {\n let m = new ListPersonasRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.session !== 'undefined') {\n toReturn['session'] = this.session;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n return toReturn;\n }\n}\nclass ListPersonasResponse {\n static fromProto(proto) {\n let m = new ListPersonasResponse();\n m = Object.assign(m, proto);\n if (proto.personas) {\n m.personas = proto.personas.map(Persona.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.personas !== 'undefined' && this.personas !== null) {\n toReturn['personas'] = 'toApiJson' in this.personas ? this.personas.toApiJson() : this.personas;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass ListSecurityLogsRequest {\n static fromProto(proto) {\n let m = new ListSecurityLogsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListSecurityLogsRequestFilters.fromProto(proto.filters);\n }\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListSecurityLogsResponse {\n static fromProto(proto) {\n let m = new ListSecurityLogsResponse();\n m = Object.assign(m, proto);\n if (proto.logs) {\n m.logs = proto.logs.map(SecurityLog.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.logs !== 'undefined' && this.logs !== null) {\n toReturn['logs'] = 'toApiJson' in this.logs ? this.logs.toApiJson() : this.logs;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass ListUsersRequest {\n static fromProto(proto) {\n let m = new ListUsersRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n if (proto.userFilter) {\n m.userFilter = UserFilter.fromProto(proto.userFilter);\n }\n if (proto.sortOptions) {\n m.sortOptions = proto.sortOptions.map(UserSortOptions.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined') {\n toReturn['namespace'] = this.namespace;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.userFilter !== 'undefined' && this.userFilter !== null) {\n toReturn['userFilter'] = 'toApiJson' in this.userFilter ? this.userFilter.toApiJson() : this.userFilter;\n }\n if (typeof this.sortOptions !== 'undefined' && this.sortOptions !== null) {\n toReturn['sortOptions'] = 'toApiJson' in this.sortOptions ? this.sortOptions.toApiJson() : this.sortOptions;\n }\n return toReturn;\n }\n}\nclass ListUsersResponse {\n static fromProto(proto) {\n let m = new ListUsersResponse();\n m = Object.assign(m, proto);\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass MutateAttributesRequest {\n static fromProto(proto) {\n let m = new MutateAttributesRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.mutations) {\n m.mutations = proto.mutations.map(Mutation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n if (typeof this.mutations !== 'undefined' && this.mutations !== null) {\n toReturn['mutations'] = 'toApiJson' in this.mutations ? this.mutations.toApiJson() : this.mutations;\n }\n return toReturn;\n }\n}\nclass OAuthCredentials {\n static fromProto(proto) {\n let m = new OAuthCredentials();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.provider !== 'undefined') {\n toReturn['provider'] = this.provider;\n }\n if (typeof this.idToken !== 'undefined') {\n toReturn['idToken'] = this.idToken;\n }\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n return toReturn;\n }\n}\nclass UpdateUserRequestOperation {\n static fromProto(proto) {\n let m = new UpdateUserRequestOperation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.greetingName !== 'undefined') {\n toReturn['greetingName'] = this.greetingName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.languageCode !== 'undefined') {\n toReturn['languageCode'] = this.languageCode;\n }\n return toReturn;\n }\n}\nclass RegisterPolicyRequest {\n static fromProto(proto) {\n let m = new RegisterPolicyRequest();\n m = Object.assign(m, proto);\n if (proto.policy) {\n m.policy = Policy.fromProto(proto.policy);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.policy !== 'undefined' && this.policy !== null) {\n toReturn['policy'] = 'toApiJson' in this.policy ? this.policy.toApiJson() : this.policy;\n }\n return toReturn;\n }\n}\nclass RegisterResourceOwnerRequest {\n static fromProto(proto) {\n let m = new RegisterResourceOwnerRequest();\n m = Object.assign(m, proto);\n if (proto.owner) {\n m.owner = ResourceOwner.fromProto(proto.owner);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.owner !== 'undefined' && this.owner !== null) {\n toReturn['owner'] = 'toApiJson' in this.owner ? this.owner.toApiJson() : this.owner;\n }\n return toReturn;\n }\n}\nclass RegisterResourceRequest {\n static fromProto(proto) {\n let m = new RegisterResourceRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n if (typeof this.resourceId !== 'undefined') {\n toReturn['resourceId'] = this.resourceId;\n }\n if (typeof this.resourceName !== 'undefined') {\n toReturn['resourceName'] = this.resourceName;\n }\n if (typeof this.resourceOwnerServiceUrl !== 'undefined') {\n toReturn['resourceOwnerServiceUrl'] = this.resourceOwnerServiceUrl;\n }\n if (typeof this.requiredResourceParams !== 'undefined') {\n toReturn['requiredResourceParams'] = this.requiredResourceParams;\n }\n if (typeof this.resourceOwnerAudience !== 'undefined') {\n toReturn['resourceOwnerAudience'] = this.resourceOwnerAudience;\n }\n return toReturn;\n }\n}\nclass RegisterSubjectRequest {\n static fromProto(proto) {\n let m = new RegisterSubjectRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.attributes) {\n m.attributes = proto.attributes.map(MultiValueAttribute.fromProto);\n }\n if (proto.structAttributes) {\n m.structAttributes = StructAttribute.fromProto(proto.structAttributes);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.password !== 'undefined') {\n toReturn['password'] = this.password;\n }\n if (typeof this.attributes !== 'undefined' && this.attributes !== null) {\n toReturn['attributes'] = 'toApiJson' in this.attributes ? this.attributes.toApiJson() : this.attributes;\n }\n if (typeof this.structAttributes !== 'undefined' && this.structAttributes !== null) {\n toReturn['structAttributes'] = 'toApiJson' in this.structAttributes ? this.structAttributes.toApiJson() : this.structAttributes;\n }\n return toReturn;\n }\n}\nclass RegisterSubjectResponse {\n static fromProto(proto) {\n let m = new RegisterSubjectResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n return toReturn;\n }\n}\nclass RemoveKeyRequest {\n static fromProto(proto) {\n let m = new RemoveKeyRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.userIdentifier) {\n m.userIdentifier = UserIdentifier.fromProto(proto.userIdentifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.keyId !== 'undefined') {\n toReturn['keyId'] = this.keyId;\n }\n if (typeof this.userIdentifier !== 'undefined' && this.userIdentifier !== null) {\n toReturn['userIdentifier'] = 'toApiJson' in this.userIdentifier ? this.userIdentifier.toApiJson() : this.userIdentifier;\n }\n return toReturn;\n }\n}\nclass RemoveMultiUserRestrictionRequest {\n static fromProto(proto) {\n let m = new RemoveMultiUserRestrictionRequest();\n m = Object.assign(m, proto);\n if (proto.userIdentifiers) {\n m.userIdentifiers = proto.userIdentifiers.map(UserIdentifier.fromProto);\n }\n if (proto.restrictionType) {\n m.restrictionType = enumStringToValue(RestrictionType, proto.restrictionType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIdentifiers !== 'undefined' && this.userIdentifiers !== null) {\n toReturn['userIdentifiers'] = 'toApiJson' in this.userIdentifiers ? this.userIdentifiers.toApiJson() : this.userIdentifiers;\n }\n if (typeof this.restrictionType !== 'undefined') {\n toReturn['restrictionType'] = this.restrictionType;\n }\n return toReturn;\n }\n}\nclass ResetPasswordTokenResponse {\n static fromProto(proto) {\n let m = new ResetPasswordTokenResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n return toReturn;\n }\n}\nclass ResetPasswordWithTokenRequest {\n static fromProto(proto) {\n let m = new ResetPasswordWithTokenRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n if (typeof this.password !== 'undefined') {\n toReturn['password'] = this.password;\n }\n return toReturn;\n }\n}\nclass ResetSubjectPasswordRequest {\n static fromProto(proto) {\n let m = new ResetSubjectPasswordRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n if (typeof this.newPassword !== 'undefined') {\n toReturn['newPassword'] = this.newPassword;\n }\n return toReturn;\n }\n}\nclass AccessResourceRequestResourceEntityIdentifierEntry {\n static fromProto(proto) {\n let m = new AccessResourceRequestResourceEntityIdentifierEntry();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = ValueList.fromProto(proto.value);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined' && this.value !== null) {\n toReturn['value'] = 'toApiJson' in this.value ? this.value.toApiJson() : this.value;\n }\n return toReturn;\n }\n}\nclass SearchSubjectRequest {\n static fromProto(proto) {\n let m = new SearchSubjectRequest();\n m = Object.assign(m, proto);\n if (proto.context) {\n m.context = Context.fromProto(proto.context);\n }\n if (proto.query) {\n m.query = Query.fromProto(proto.query);\n }\n if (proto.filters) {\n m.filters = proto.filters.map(SingleValueAttribute.fromProto);\n }\n if (proto.orderByDirection) {\n m.orderByDirection = enumStringToValue(OrderByDirection, proto.orderByDirection);\n }\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.context !== 'undefined' && this.context !== null) {\n toReturn['context'] = 'toApiJson' in this.context ? this.context.toApiJson() : this.context;\n }\n if (typeof this.query !== 'undefined' && this.query !== null) {\n toReturn['query'] = 'toApiJson' in this.query ? this.query.toApiJson() : this.query;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.orderBy !== 'undefined') {\n toReturn['orderBy'] = this.orderBy;\n }\n if (typeof this.orderByDirection !== 'undefined') {\n toReturn['orderByDirection'] = this.orderByDirection;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass SearchSubjectResponse {\n static fromProto(proto) {\n let m = new SearchSubjectResponse();\n m = Object.assign(m, proto);\n if (proto.result) {\n m.result = proto.result.map(SubjectResult.fromProto);\n }\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.result !== 'undefined' && this.result !== null) {\n toReturn['result'] = 'toApiJson' in this.result ? this.result.toApiJson() : this.result;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nclass SendEmailVerificationRequest {\n static fromProto(proto) {\n let m = new SendEmailVerificationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass SubjectCredentials {\n static fromProto(proto) {\n let m = new SubjectCredentials();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.password !== 'undefined') {\n toReturn['password'] = this.password;\n }\n return toReturn;\n }\n}\nclass UpdateUserRequest {\n static fromProto(proto) {\n let m = new UpdateUserRequest();\n m = Object.assign(m, proto);\n if (proto.operations) {\n m.operations = proto.operations.map(UpdateUserRequestOperation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.operations !== 'undefined' && this.operations !== null) {\n toReturn['operations'] = 'toApiJson' in this.operations ? this.operations.toApiJson() : this.operations;\n }\n return toReturn;\n }\n}\nclass GetMultiUsersResponseUserContainer {\n static fromProto(proto) {\n let m = new GetMultiUsersResponseUserContainer();\n m = Object.assign(m, proto);\n if (proto.user) {\n m.user = User.fromProto(proto.user);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.user !== 'undefined' && this.user !== null) {\n toReturn['user'] = 'toApiJson' in this.user ? this.user.toApiJson() : this.user;\n }\n return toReturn;\n }\n}\nclass UserFilter {\n static fromProto(proto) {\n let m = new UserFilter();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.subjectTypes !== 'undefined') {\n toReturn['subjectTypes'] = this.subjectTypes;\n }\n if (typeof this.searchTerms !== 'undefined') {\n toReturn['searchTerms'] = this.searchTerms;\n }\n return toReturn;\n }\n}\nclass UserIdentifier {\n static fromProto(proto) {\n let m = new UserIdentifier();\n m = Object.assign(m, proto);\n if (proto.namespacedEmail) {\n m.namespacedEmail = NamespacedEmail.fromProto(proto.namespacedEmail);\n }\n if (proto.namespacedSession) {\n m.namespacedSession = NamespacedSession.fromProto(proto.namespacedSession);\n }\n if (proto.typedExternalIdentifier) {\n m.typedExternalIdentifier = TypedExternalIdentifier.fromProto(proto.typedExternalIdentifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.namespacedEmail !== 'undefined' && this.namespacedEmail !== null) {\n toReturn['namespacedEmail'] = 'toApiJson' in this.namespacedEmail ? this.namespacedEmail.toApiJson() : this.namespacedEmail;\n }\n if (typeof this.namespacedSession !== 'undefined' && this.namespacedSession !== null) {\n toReturn['namespacedSession'] = 'toApiJson' in this.namespacedSession ? this.namespacedSession.toApiJson() : this.namespacedSession;\n }\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n if (typeof this.typedExternalIdentifier !== 'undefined' && this.typedExternalIdentifier !== null) {\n toReturn['typedExternalIdentifier'] = 'toApiJson' in this.typedExternalIdentifier ? this.typedExternalIdentifier.toApiJson() : this.typedExternalIdentifier;\n }\n if (typeof this.subjectId !== 'undefined') {\n toReturn['subjectId'] = this.subjectId;\n }\n return toReturn;\n }\n}\nclass UserSortOptions {\n static fromProto(proto) {\n let m = new UserSortOptions();\n m = Object.assign(m, proto);\n if (proto.direction) {\n m.direction = enumStringToValue(SortDirection, proto.direction);\n }\n if (proto.field) {\n m.field = enumStringToValue(UserSortField, proto.field);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.direction !== 'undefined') {\n toReturn['direction'] = this.direction;\n }\n if (typeof this.field !== 'undefined') {\n toReturn['field'] = this.field;\n }\n return toReturn;\n }\n}\nclass VerifyEmailRequest {\n static fromProto(proto) {\n let m = new VerifyEmailRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n return toReturn;\n }\n}\n\n// *********************************\n\n// *********************************\nlet IAMApiService = /*#__PURE__*/(() => {\n class IAMApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n registerSubject(r) {\n const request = r.toApiJson ? r : new RegisterSubjectRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/RegisterSubject\", request.toApiJson(), this.apiOptions()).pipe(map(resp => RegisterSubjectResponse.fromProto(resp)));\n }\n authenticateSubject(r) {\n const request = r.toApiJson ? r : new AuthenticateSubjectRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/AuthenticateSubject\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getSubjects(r) {\n const request = r.toApiJson ? r : new GetSubjectsRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetSubjects\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSubjectsResponse.fromProto(resp)));\n }\n getSubjectsByEmail(r) {\n const request = r.toApiJson ? r : new GetSubjectsByEmailRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetSubjectsByEmail\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSubjectsResponse.fromProto(resp)));\n }\n mutateAttributes(r) {\n const request = r.toApiJson ? r : new MutateAttributesRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/MutateAttributes\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n resetSubjectPassword(r) {\n const request = r.toApiJson ? r : new ResetSubjectPasswordRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/ResetSubjectPassword\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n changeSubjectEmail(r) {\n const request = r.toApiJson ? r : new ChangeSubjectEmailRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/ChangeSubjectEmail\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteSubject(r) {\n const request = r.toApiJson ? r : new DeleteSubjectRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/DeleteSubject\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n searchSubject(r) {\n const request = r.toApiJson ? r : new SearchSubjectRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/SearchSubject\", request.toApiJson(), this.apiOptions()).pipe(map(resp => SearchSubjectResponse.fromProto(resp)));\n }\n getSubjectContext(r) {\n const request = r.toApiJson ? r : new GetSubjectContextRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetSubjectContext\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSubjectContextResponse.fromProto(resp)));\n }\n registerResourceOwner(r) {\n const request = r.toApiJson ? r : new RegisterResourceOwnerRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/RegisterResourceOwner\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n registerResource(r) {\n const request = r.toApiJson ? r : new RegisterResourceRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/RegisterResource\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n registerPolicy(r) {\n const request = r.toApiJson ? r : new RegisterPolicyRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/RegisterPolicy\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n accessResource(r) {\n const request = r.toApiJson ? r : new AccessResourceRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/AccessResource\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getShortLivedToken(r) {\n const request = r.toApiJson ? r : new GetShortLivedTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetShortLivedToken\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetTokenResponse.fromProto(resp)));\n }\n getSessionToken(r) {\n const request = r.toApiJson ? r : new GetSessionTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetSessionToken\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetTokenResponse.fromProto(resp)));\n }\n addKey(r) {\n const request = r.toApiJson ? r : new AddKeyRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/AddKey\", request.toApiJson(), this.apiOptions()).pipe(map(resp => AddKeyResponse.fromProto(resp)));\n }\n removeKey(r) {\n const request = r.toApiJson ? r : new RemoveKeyRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/RemoveKey\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n createSession(r) {\n const request = r.toApiJson ? r : new CreateSessionRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/CreateSession\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateSessionResponse.fromProto(resp)));\n }\n getResetPasswordToken(r) {\n const request = r.toApiJson ? r : new GetResetPasswordTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetResetPasswordToken\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ResetPasswordTokenResponse.fromProto(resp)));\n }\n listPersonasByEmail(r) {\n const request = r.toApiJson ? r : new ListPersonasByEmailRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/ListPersonasByEmail\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListPersonasResponse.fromProto(resp)));\n }\n listPersonas(r) {\n const request = r.toApiJson ? r : new IAMListPersonasRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/ListPersonas\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListPersonasResponse.fromProto(resp)));\n }\n createTemporarySubject(r) {\n const request = r.toApiJson ? r : new CreateTemporarySubjectRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/CreateTemporarySubject\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateTemporarySubjectResponse.fromProto(resp)));\n }\n getMultiUsers(r) {\n const request = r.toApiJson ? r : new GetMultiUsersRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetMultiUsers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiUsersResponse.fromProto(resp)));\n }\n listUsers(r) {\n const request = r.toApiJson ? r : new ListUsersRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/ListUsers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUsersResponse.fromProto(resp)));\n }\n updateUser(r) {\n const request = r.toApiJson ? r : new UpdateUserRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/UpdateUser\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteUser(r) {\n const request = r.toApiJson ? r : new DeleteUserRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/DeleteUser\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listSecurityLogs(r) {\n const request = r.toApiJson ? r : new ListSecurityLogsRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/ListSecurityLogs\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListSecurityLogsResponse.fromProto(resp)));\n }\n verifyEmail(r) {\n const request = r.toApiJson ? r : new VerifyEmailRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/VerifyEmail\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n sendEmailVerification(r) {\n const request = r.toApiJson ? r : new SendEmailVerificationRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/SendEmailVerification\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getMultiExternalId(r) {\n const request = r.toApiJson ? r : new GetMultiExternalIDRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/GetMultiExternalID\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiExternalIDResponse.fromProto(resp)));\n }\n createExternalId(r) {\n const request = r.toApiJson ? r : new CreateExternalIDRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/CreateExternalID\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n addMultiUserRestriction(r) {\n const request = r.toApiJson ? r : new AddMultiUserRestrictionRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/AddMultiUserRestriction\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n removeMultiUserRestriction(r) {\n const request = r.toApiJson ? r : new RemoveMultiUserRestrictionRequest(r);\n return this.http.post(this._host + \"/iam.v1.IAM/RemoveMultiUserRestriction\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n IAMApiService.ɵfac = function IAMApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IAMApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n IAMApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IAMApiService,\n factory: IAMApiService.ɵfac,\n providedIn: 'root'\n });\n return IAMApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\nlet UserIAMApiService = /*#__PURE__*/(() => {\n class UserIAMApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getSubjectBySession(r) {\n const request = r.toApiJson ? r : new GetSubjectBySessionRequest(r);\n return this.http.post(this._host + \"/iam.v1.UserIAM/GetSubjectBySession\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSubjectResponse.fromProto(resp)));\n }\n listPersonas(r) {\n const request = r.toApiJson ? r : new ListPersonasRequest(r);\n return this.http.post(this._host + \"/iam.v1.UserIAM/ListPersonas\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListPersonasResponse.fromProto(resp)));\n }\n getToken(r) {\n const request = r.toApiJson ? r : new GetTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.UserIAM/GetToken\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetTokenResponse.fromProto(resp)));\n }\n getSessionToken(r) {\n const request = r.toApiJson ? r : new GetSessionTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.UserIAM/GetSessionToken\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetTokenResponse.fromProto(resp)));\n }\n resetPasswordWithToken(r) {\n const request = r.toApiJson ? r : new ResetPasswordWithTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.UserIAM/ResetPasswordWithToken\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getImpersonationToken(r) {\n const request = r.toApiJson ? r : new GetImpersonationTokenRequest(r);\n return this.http.post(this._host + \"/iam.v1.UserIAM/GetImpersonationToken\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetImpersonationTokenResponse.fromProto(resp)));\n }\n }\n UserIAMApiService.ɵfac = function UserIAMApiService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UserIAMApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n UserIAMApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UserIAMApiService,\n factory: UserIAMApiService.ɵfac,\n providedIn: 'root'\n });\n return UserIAMApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet IAMService = /*#__PURE__*/(() => {\n class IAMService {\n constructor(api, httpApi, iamApi) {\n this.api = api;\n this.httpApi = httpApi;\n this.iamApi = iamApi;\n }\n // Get a subject from the session ID\n getSubjectBySession(sessionId, personaType, partnerId) {\n let context;\n if (!!partnerId) {\n context = new Context({\n namespaced: new NamespacedContext({\n namespace: partnerId,\n type: PersonaType[personaType]\n })\n });\n } else {\n context = new Context({\n typed: new TypedContext({\n type: PersonaType[personaType]\n })\n });\n }\n return this.api.getSubjectBySession({\n session: sessionId,\n context: context\n }).pipe(map(r => fromPersona(new Persona({\n subject: r.subject.subject,\n context: context\n }))));\n }\n // List all available personas for the session. Optionally pass a persona type to filter by that persona.\n listPersonas(sessionId, personaType) {\n return this.api.listPersonas({\n session: sessionId,\n pageSize: 100,\n type: personaType\n }).pipe(map(r => {\n const personas = [];\n if (!r || !r.personas) {\n return [];\n }\n for (const p of r.personas) {\n const persona = fromPersona(p);\n if (!!persona) {\n personas.push(persona);\n }\n }\n return personas;\n }));\n }\n // Get a short lived session token\n getToken() {\n return this.api.getToken({}).pipe(map(r => r.token));\n }\n // Login into a user. Optionally specify the partner and persona type you want to log into\n login(email, password, personaType, partnerId) {\n return this.httpApi.login({\n email: email,\n password: password,\n namespace: partnerId,\n type: personaType\n }).pipe(map(r => r.sessionId || ''));\n }\n // Logout of the current session, returns true if successful\n logout() {\n return this.httpApi.logout().pipe(map(r => r.success));\n }\n // This will redirect the browser to IAM's sso login handler.\n ssoLogin(nextUrl, personaType, partnerId) {\n this.httpApi.ssoLogin({\n nextUrl: nextUrl,\n namespace: partnerId,\n type: personaType\n });\n }\n // getMultiUsers takes an array of user identifiers and calls IAM to convert them into Users\n getMultiUsers(userIdentifiers) {\n return this.iamApi.getMultiUsers({\n userIdentifiers\n }).pipe(map(resp => {\n if (!!resp.users) {\n return resp.users;\n }\n return [];\n }), map(userContainers => userContainers.map(u => u.user)));\n }\n // listSecurityLogs returns security logs for a userId passed in. This is a paged function, but the\n // handling of paged information is left to the implementor (for now).\n listSecurityLogs(userId, cursor, pageSize, actionId = '') {\n const optionalArgs = {};\n if (actionId !== '') {\n optionalArgs.filters = new ListSecurityLogsRequestFilters({\n actionId\n });\n }\n return this.iamApi.listSecurityLogs({\n userId,\n cursor,\n pageSize,\n ...optionalArgs\n });\n }\n // listUsers returns users for a namespace passed in. This is a paged function, but the\n // handling of paged information is left to the implementor (for now).\n // An empty namespace will return users that exist outside of a namespace.\n listUsers(namespace, email, cursor, pageSize, subjectTypes, searchTerms, sortOptions) {\n const userFilter = {};\n if (!!subjectTypes && subjectTypes.length > 0) {\n userFilter.subjectTypes = subjectTypes;\n }\n if (!!searchTerms && searchTerms.length > 0) {\n userFilter.searchTerms = searchTerms;\n }\n return this.iamApi.listUsers({\n namespace: namespace,\n email: email,\n cursor: cursor,\n pageSize: pageSize,\n userFilter: userFilter,\n sortOptions: sortOptions || []\n });\n }\n }\n IAMService.ɵfac = function IAMService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IAMService)(i0.ɵɵinject(UserIAMApiService), i0.ɵɵinject(IamHttpApiService), i0.ɵɵinject(IAMApiService));\n };\n IAMService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IAMService,\n factory: IAMService.ɵfac,\n providedIn: 'root'\n });\n return IAMService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Access, AccessCheckFailures, AccessResourceRequest, AccessResourceRequestResourceEntityIdentifierEntry, AccessScope, AddKeyRequest, AddKeyResponse, AddMultiUserRestrictionRequest, AlgorithmType, Attribute, AuthenticateSubjectRequest, BasePersona, BooleanOperator, CRMRolePersona, ChangeSubjectEmailRequest, Context, CreateExternalIDRequest, CreateSessionRequest, CreateSessionResponse, CreateTemporarySubjectRequest, CreateTemporarySubjectResponse, DeleteSubjectRequest, DeleteUserRequest, DeveloperPersona, DigitalAgentPersona, FieldMask, ForOperator, GeoPointAttribute, GetImpersonationTokenRequest, GetImpersonationTokenResponse, GetMultiExternalIDRequest, GetMultiExternalIDResponse, GetMultiUsersRequest, GetMultiUsersResponse, GetMultiUsersResponseUserContainer, GetResetPasswordTokenRequest, GetSessionTokenRequest, GetShortLivedTokenRequest, GetSubjectBySessionRequest, GetSubjectContextRequest, GetSubjectContextResponse, GetSubjectResponse, GetSubjectsByEmailRequest, GetSubjectsRequest, GetSubjectsResponse, GetTokenRequest, GetTokenResponse, HostService, IAMApiService, IAMListPersonasRequest, IAMService, Identifier, IfClause, ListAttribute, ListPersonasByEmailRequest, ListPersonasRequest, ListPersonasResponse, ListSecurityLogsRequest, ListSecurityLogsRequestFilters, ListSecurityLogsResponse, ListUsersRequest, ListUsersResponse, MultiValueAttribute, MutateAttributesRequest, Mutation, NamespacedContext, NamespacedEmail, NamespacedPersona, NamespacedSession, OAuthCredentials, Operator, OrderByDirection, PartnerAppPersona, PartnerPersona, Persona, PersonaType, Policy, PolicyNode, PublicKey, Query, RegisterPolicyRequest, RegisterResourceOwnerRequest, RegisterResourceRequest, RegisterSubjectRequest, RegisterSubjectResponse, RemoveKeyRequest, RemoveMultiUserRestrictionRequest, ResetPasswordTokenResponse, ResetPasswordWithTokenRequest, ResetSubjectPasswordRequest, ResourceIdentifier, ResourceIdentifierIdentifiersEntry, ResourceOwner, RestrictionType, SMBPersona, SalespersonPersona, SearchSubjectRequest, SearchSubjectResponse, SecurityLog, SendEmailVerificationRequest, SingleValueAttribute, SortDirection, StructAttribute, StructAttributeAttributesEntry, Subject, SubjectCredentials, SubjectMissingValueClause, SubjectResourceForClause, SubjectResourceIntersectionClause, SubjectResourceSubsetClause, SubjectResult, SubjectValueIntersectionClause, TypedContext, TypedExternalIdentifier, TypedPersona, UpdateUserRequest, UpdateUserRequestOperation, User, UserFilter, UserIAMApiService, UserIdentifier, UserSortField, UserSortOptions, ValueList, VendorPersona, VerifyEmailRequest, fromPersona };\n","function e(e, t) {\n var n = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var i = Object.getOwnPropertySymbols(e);\n t && (i = i.filter(function (t) {\n return Object.getOwnPropertyDescriptor(e, t).enumerable;\n })), n.push.apply(n, i);\n }\n return n;\n}\nfunction t(t) {\n for (var n = 1; n < arguments.length; n++) {\n var i = null != arguments[n] ? arguments[n] : {};\n n % 2 ? e(Object(i), !0).forEach(function (e) {\n o(t, e, i[e]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i)) : e(Object(i)).forEach(function (e) {\n Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(i, e));\n });\n }\n return t;\n}\nfunction n(e) {\n return n = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (e) {\n return typeof e;\n } : function (e) {\n return e && \"function\" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? \"symbol\" : typeof e;\n }, n(e);\n}\nfunction i(e, t) {\n if (!(e instanceof t)) throw new TypeError(\"Cannot call a class as a function\");\n}\nfunction r(e, t) {\n for (var n = 0; n < t.length; n++) {\n var i = t[n];\n i.enumerable = i.enumerable || !1, i.configurable = !0, \"value\" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);\n }\n}\nfunction s(e, t, n) {\n return t && r(e.prototype, t), n && r(e, n), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction o(e, t, n) {\n return t in e ? Object.defineProperty(e, t, {\n value: n,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[t] = n, e;\n}\nfunction a(e, t) {\n if (null == e) return {};\n var n,\n i,\n r = function (e, t) {\n if (null == e) return {};\n var n,\n i,\n r = {},\n s = Object.keys(e);\n for (i = 0; i < s.length; i++) n = s[i], t.indexOf(n) >= 0 || (r[n] = e[n]);\n return r;\n }(e, t);\n if (Object.getOwnPropertySymbols) {\n var s = Object.getOwnPropertySymbols(e);\n for (i = 0; i < s.length; i++) n = s[i], t.indexOf(n) >= 0 || Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);\n }\n return r;\n}\nfunction u(e, t) {\n return function (e) {\n if (Array.isArray(e)) return e;\n }(e) || function (e, t) {\n var n = null == e ? null : \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (null == n) return;\n var i,\n r,\n s = [],\n o = !0,\n a = !1;\n try {\n for (n = n.call(e); !(o = (i = n.next()).done) && (s.push(i.value), !t || s.length !== t); o = !0);\n } catch (e) {\n a = !0, r = e;\n } finally {\n try {\n o || null == n.return || n.return();\n } finally {\n if (a) throw r;\n }\n }\n return s;\n }(e, t) || c(e, t) || function () {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n}\nfunction l(e) {\n return function (e) {\n if (Array.isArray(e)) return d(e);\n }(e) || function (e) {\n if (\"undefined\" != typeof Symbol && null != e[Symbol.iterator] || null != e[\"@@iterator\"]) return Array.from(e);\n }(e) || c(e) || function () {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }();\n}\nfunction c(e, t) {\n if (e) {\n if (\"string\" == typeof e) return d(e, t);\n var n = Object.prototype.toString.call(e).slice(8, -1);\n return \"Object\" === n && e.constructor && (n = e.constructor.name), \"Map\" === n || \"Set\" === n ? Array.from(e) : \"Arguments\" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? d(e, t) : void 0;\n }\n}\nfunction d(e, t) {\n (null == t || t > e.length) && (t = e.length);\n for (var n = 0, i = new Array(t); n < t; n++) i[n] = e[n];\n return i;\n}\nfunction h(e, t) {\n var n = \"undefined\" != typeof Symbol && e[Symbol.iterator] || e[\"@@iterator\"];\n if (!n) {\n if (Array.isArray(e) || (n = c(e)) || t && e && \"number\" == typeof e.length) {\n n && (e = n);\n var i = 0,\n r = function () {};\n return {\n s: r,\n n: function () {\n return i >= e.length ? {\n done: !0\n } : {\n done: !1,\n value: e[i++]\n };\n },\n e: function (e) {\n throw e;\n },\n f: r\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var s,\n o = !0,\n a = !1;\n return {\n s: function () {\n n = n.call(e);\n },\n n: function () {\n var e = n.next();\n return o = e.done, e;\n },\n e: function (e) {\n a = !0, s = e;\n },\n f: function () {\n try {\n o || null == n.return || n.return();\n } finally {\n if (a) throw s;\n }\n }\n };\n}\nvar f = {\n DEBUG: !1,\n LIB_VERSION: \"1.154.5\"\n },\n v = Array.isArray,\n p = Object.prototype,\n g = p.hasOwnProperty,\n _ = p.toString,\n m = v || function (e) {\n return \"[object Array]\" === _.call(e);\n },\n y = function (e) {\n return \"function\" == typeof e;\n },\n b = function (e) {\n return e === Object(e) && !m(e);\n },\n k = function (e) {\n if (b(e)) {\n for (var t in e) if (g.call(e, t)) return !1;\n return !0;\n }\n return !1;\n },\n w = function (e) {\n return void 0 === e;\n },\n S = function (e) {\n return \"[object String]\" == _.call(e);\n },\n E = function (e) {\n return S(e) && 0 === e.trim().length;\n },\n R = function (e) {\n return null === e;\n },\n I = function (e) {\n return w(e) || R(e);\n },\n F = function (e) {\n return \"[object Number]\" == _.call(e);\n },\n x = function (e) {\n return \"[object Boolean]\" === _.call(e);\n },\n P = function (e) {\n return e instanceof FormData;\n },\n T = \"undefined\" != typeof window ? window : void 0,\n C = \"undefined\" != typeof globalThis ? globalThis : T,\n $ = Array.prototype,\n O = $.forEach,\n M = $.indexOf,\n A = null == C ? void 0 : C.navigator,\n D = null == C ? void 0 : C.document,\n L = null == C ? void 0 : C.location,\n q = null == C ? void 0 : C.fetch,\n N = null != C && C.XMLHttpRequest && \"withCredentials\" in new C.XMLHttpRequest() ? C.XMLHttpRequest : void 0,\n B = null == C ? void 0 : C.AbortController,\n H = null == A ? void 0 : A.userAgent,\n U = null != T ? T : {},\n j = \"[PostHog.js]\",\n G = {\n _log: function (e) {\n if (T && (f.DEBUG || U.POSTHOG_DEBUG) && !w(T.console) && T.console) {\n for (var t = (\"__rrweb_original__\" in T.console[e]) ? T.console[e].__rrweb_original__ : T.console[e], n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++) i[r - 1] = arguments[r];\n t.apply(void 0, [j].concat(i));\n }\n },\n info: function () {\n for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];\n G._log.apply(G, [\"log\"].concat(t));\n },\n warn: function () {\n for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];\n G._log.apply(G, [\"warn\"].concat(t));\n },\n error: function () {\n for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];\n G._log.apply(G, [\"error\"].concat(t));\n },\n critical: function () {\n for (var e, t = arguments.length, n = new Array(t), i = 0; i < t; i++) n[i] = arguments[i];\n (e = console).error.apply(e, [j].concat(n));\n },\n uninitializedWarning: function (e) {\n G.error(\"You must initialize PostHog before calling \".concat(e));\n }\n },\n W = {},\n z = function (e) {\n return e.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, \"\");\n };\nfunction V(e, t, n) {\n if (m(e)) if (O && e.forEach === O) e.forEach(t, n);else if (\"length\" in e && e.length === +e.length) for (var i = 0, r = e.length; i < r; i++) if (i in e && t.call(n, e[i], i) === W) return;\n}\nfunction Q(e, t, n) {\n if (!I(e)) {\n if (m(e)) return V(e, t, n);\n if (P(e)) {\n var i,\n r = h(e.entries());\n try {\n for (r.s(); !(i = r.n()).done;) {\n var s = i.value;\n if (t.call(n, s[1], s[0]) === W) return;\n }\n } catch (e) {\n r.e(e);\n } finally {\n r.f();\n }\n } else for (var o in e) if (g.call(e, o) && t.call(n, e[o], o) === W) return;\n }\n}\nvar J = function (e) {\n for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) n[i - 1] = arguments[i];\n return V(n, function (t) {\n for (var n in t) void 0 !== t[n] && (e[n] = t[n]);\n }), e;\n};\nfunction Y(e, t) {\n return -1 !== e.indexOf(t);\n}\nfunction X(e) {\n for (var t = Object.keys(e), n = t.length, i = new Array(n); n--;) i[n] = [t[n], e[t[n]]];\n return i;\n}\nvar K = function () {\n return Date.now = Date.now || function () {\n return +new Date();\n }, Date.now();\n },\n Z = function (e) {\n try {\n return e();\n } catch (e) {\n return;\n }\n },\n ee = function (e) {\n return function () {\n try {\n for (var t = arguments.length, n = new Array(t), i = 0; i < t; i++) n[i] = arguments[i];\n return e.apply(this, n);\n } catch (e) {\n G.critical(\"Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.\"), G.critical(e);\n }\n };\n },\n te = function (e) {\n var t = {};\n return Q(e, function (e, n) {\n S(e) && e.length > 0 && (t[n] = e);\n }), t;\n },\n ne = function (e) {\n return e.replace(/^\\$/, \"\");\n };\nfunction ie(e, t) {\n return n = e, i = function (e) {\n return S(e) && !R(t) ? e.slice(0, t) : e;\n }, r = new Set(), function e(t, n) {\n return t !== Object(t) ? i ? i(t, n) : t : r.has(t) ? void 0 : (r.add(t), m(t) ? (s = [], V(t, function (t) {\n s.push(e(t));\n })) : (s = {}, Q(t, function (t, n) {\n r.has(t) || (s[n] = e(t, n));\n })), s);\n var s;\n }(n);\n var n, i, r;\n}\nvar re,\n se = function (e) {\n var t,\n n,\n i,\n r,\n s = \"\";\n for (t = n = 0, i = (e = (e + \"\").replace(/\\r\\n/g, \"\\n\").replace(/\\r/g, \"\\n\")).length, r = 0; r < i; r++) {\n var o = e.charCodeAt(r),\n a = null;\n o < 128 ? n++ : a = o > 127 && o < 2048 ? String.fromCharCode(o >> 6 | 192, 63 & o | 128) : String.fromCharCode(o >> 12 | 224, o >> 6 & 63 | 128, 63 & o | 128), R(a) || (n > t && (s += e.substring(t, n)), s += a, t = n = r + 1);\n }\n return n > t && (s += e.substring(t, e.length)), s;\n },\n oe = function () {\n function e(t) {\n return t && (t.preventDefault = e.preventDefault, t.stopPropagation = e.stopPropagation), t;\n }\n return e.preventDefault = function () {\n this.returnValue = !1;\n }, e.stopPropagation = function () {\n this.cancelBubble = !0;\n }, function (t, n, i, r, s) {\n if (t) {\n if (t.addEventListener && !r) t.addEventListener(n, i, !!s);else {\n var o = \"on\" + n,\n a = t[o];\n t[o] = function (t, n, i) {\n return function (r) {\n if (r = r || e(null == T ? void 0 : T.event)) {\n var s,\n o = !0;\n y(i) && (s = i(r));\n var a = n.call(t, r);\n return !1 !== s && !1 !== a || (o = !1), o;\n }\n };\n }(t, i, a);\n }\n } else G.error(\"No valid element provided to register_event\");\n };\n }();\nfunction ae(e, t) {\n for (var n = 0; n < e.length; n++) if (t(e[n])) return e[n];\n}\n!function (e) {\n e.GZipJS = \"gzip-js\", e.Base64 = \"base64\";\n}(re || (re = {}));\nvar ue = [\"fatal\", \"error\", \"warning\", \"log\", \"info\", \"debug\"],\n le = \"$people_distinct_id\",\n ce = \"__alias\",\n de = \"__timers\",\n he = \"$autocapture_disabled_server_side\",\n fe = \"$heatmaps_enabled_server_side\",\n ve = \"$exception_capture_enabled_server_side\",\n pe = \"$exception_capture_endpoint\",\n ge = \"$web_vitals_enabled_server_side\",\n _e = \"$session_recording_enabled_server_side\",\n me = \"$console_log_recording_enabled_server_side\",\n ye = \"$session_recording_network_payload_capture\",\n be = \"$session_recording_canvas_recording\",\n ke = \"$replay_sample_rate\",\n we = \"$replay_minimum_duration\",\n Se = \"$sesid\",\n Ee = \"$session_is_sampled\",\n Re = \"$enabled_feature_flags\",\n Ie = \"$early_access_features\",\n Fe = \"$stored_person_properties\",\n xe = \"$stored_group_properties\",\n Pe = \"$surveys\",\n Te = \"$surveys_activated\",\n Ce = \"$flag_call_reported\",\n $e = \"$user_state\",\n Oe = \"$client_session_props\",\n Me = \"$capture_rate_limit\",\n Ae = \"$initial_campaign_params\",\n De = \"$initial_referrer_info\",\n Le = \"$initial_person_info\",\n qe = \"$epp\",\n Ne = \"__POSTHOG_TOOLBAR__\",\n Be = [le, ce, \"__cmpns\", de, _e, fe, Se, Re, $e, Ie, xe, Fe, Pe, Ce, Oe, Me, Ae, De, qe],\n He = \"$active_feature_flags\",\n Ue = \"$override_feature_flags\",\n je = \"$feature_flag_payloads\",\n Ge = function (e) {\n var t,\n n = {},\n i = h(X(e || {}));\n try {\n for (i.s(); !(t = i.n()).done;) {\n var r = u(t.value, 2),\n s = r[0],\n o = r[1];\n o && (n[s] = o);\n }\n } catch (e) {\n i.e(e);\n } finally {\n i.f();\n }\n return n;\n },\n We = function () {\n function e(t) {\n i(this, e), this.instance = t, this._override_warning = !1, this.featureFlagEventHandlers = [], this.reloadFeatureFlagsQueued = !1, this.reloadFeatureFlagsInAction = !1;\n }\n return s(e, [{\n key: \"getFlags\",\n value: function () {\n return Object.keys(this.getFlagVariants());\n }\n }, {\n key: \"getFlagVariants\",\n value: function () {\n var e = this.instance.get_property(Re),\n t = this.instance.get_property(Ue);\n if (!t) return e || {};\n for (var n = J({}, e), i = Object.keys(t), r = 0; r < i.length; r++) n[i[r]] = t[i[r]];\n return this._override_warning || (G.warn(\" Overriding feature flags!\", {\n enabledFlags: e,\n overriddenFlags: t,\n finalFlags: n\n }), this._override_warning = !0), n;\n }\n }, {\n key: \"getFlagPayloads\",\n value: function () {\n return this.instance.get_property(je) || {};\n }\n }, {\n key: \"reloadFeatureFlags\",\n value: function () {\n this.reloadFeatureFlagsQueued || (this.reloadFeatureFlagsQueued = !0, this._startReloadTimer());\n }\n }, {\n key: \"setAnonymousDistinctId\",\n value: function (e) {\n this.$anon_distinct_id = e;\n }\n }, {\n key: \"setReloadingPaused\",\n value: function (e) {\n this.reloadFeatureFlagsInAction = e;\n }\n }, {\n key: \"resetRequestQueue\",\n value: function () {\n this.reloadFeatureFlagsQueued = !1;\n }\n }, {\n key: \"_startReloadTimer\",\n value: function () {\n var e = this;\n this.reloadFeatureFlagsQueued && !this.reloadFeatureFlagsInAction && setTimeout(function () {\n !e.reloadFeatureFlagsInAction && e.reloadFeatureFlagsQueued && (e.reloadFeatureFlagsQueued = !1, e._reloadFeatureFlagsRequest());\n }, 5);\n }\n }, {\n key: \"_reloadFeatureFlagsRequest\",\n value: function () {\n var e = this;\n if (!this.instance.config.advanced_disable_feature_flags) {\n this.setReloadingPaused(!0);\n var t = this.instance.config.token,\n n = this.instance.get_property(Fe),\n i = this.instance.get_property(xe),\n r = {\n token: t,\n distinct_id: this.instance.get_distinct_id(),\n groups: this.instance.getGroups(),\n $anon_distinct_id: this.$anon_distinct_id,\n person_properties: n,\n group_properties: i,\n disable_flags: this.instance.config.advanced_disable_feature_flags || void 0\n };\n this.instance._send_request({\n method: \"POST\",\n url: this.instance.requestRouter.endpointFor(\"api\", \"/decide/?v=3\"),\n data: r,\n compression: this.instance.config.disable_compression ? void 0 : re.Base64,\n timeout: this.instance.config.feature_flag_request_timeout_ms,\n callback: function (t) {\n var n;\n e.setReloadingPaused(!1);\n var i = !0;\n 200 === t.statusCode && (e.$anon_distinct_id = void 0, i = !1), e.receivedFeatureFlags(null !== (n = t.json) && void 0 !== n ? n : {}, i), e._startReloadTimer();\n }\n });\n }\n }\n }, {\n key: \"getFeatureFlag\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};\n if (this.instance.decideEndpointWasHit || this.getFlags() && this.getFlags().length > 0) {\n var n,\n i = this.getFlagVariants()[e],\n r = \"\".concat(i),\n s = this.instance.get_property(Ce) || {};\n if (t.send_event || !(\"send_event\" in t)) if (!(e in s) || !s[e].includes(r)) m(s[e]) ? s[e].push(r) : s[e] = [r], null === (n = this.instance.persistence) || void 0 === n || n.register(o({}, Ce, s)), this.instance.capture(\"$feature_flag_called\", {\n $feature_flag: e,\n $feature_flag_response: i\n });\n return i;\n }\n G.warn('getFeatureFlag for key \"' + e + \"\\\" failed. Feature flags didn't load in time.\");\n }\n }, {\n key: \"getFeatureFlagPayload\",\n value: function (e) {\n return this.getFlagPayloads()[e];\n }\n }, {\n key: \"isFeatureEnabled\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};\n if (this.instance.decideEndpointWasHit || this.getFlags() && this.getFlags().length > 0) return !!this.getFeatureFlag(e, t);\n G.warn('isFeatureEnabled for key \"' + e + \"\\\" failed. Feature flags didn't load in time.\");\n }\n }, {\n key: \"addFeatureFlagsHandler\",\n value: function (e) {\n this.featureFlagEventHandlers.push(e);\n }\n }, {\n key: \"removeFeatureFlagsHandler\",\n value: function (e) {\n this.featureFlagEventHandlers = this.featureFlagEventHandlers.filter(function (t) {\n return t !== e;\n });\n }\n }, {\n key: \"receivedFeatureFlags\",\n value: function (e, n) {\n if (this.instance.persistence) {\n this.instance.decideEndpointWasHit = !0;\n var i = this.getFlagVariants(),\n r = this.getFlagPayloads();\n !function (e, n) {\n var i,\n r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},\n s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {},\n a = e.featureFlags,\n u = e.featureFlagPayloads;\n if (a) if (m(a)) {\n var l,\n c = {};\n if (a) for (var d = 0; d < a.length; d++) c[a[d]] = !0;\n n && n.register((o(l = {}, He, a), o(l, Re, c), l));\n } else {\n var h = a,\n f = u;\n e.errorsWhileComputingFlags && (h = t(t({}, r), h), f = t(t({}, s), f)), n && n.register((o(i = {}, He, Object.keys(Ge(h))), o(i, Re, h || {}), o(i, je, f || {}), i));\n }\n }(e, this.instance.persistence, i, r), this._fireFeatureFlagsCallbacks(n);\n }\n }\n }, {\n key: \"override\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n if (!this.instance.__loaded || !this.instance.persistence) return G.uninitializedWarning(\"posthog.feature_flags.override\");\n if (this._override_warning = t, !1 === e) this.instance.persistence.unregister(Ue);else if (m(e)) {\n for (var n = {}, i = 0; i < e.length; i++) n[e[i]] = !0;\n this.instance.persistence.register(o({}, Ue, n));\n } else this.instance.persistence.register(o({}, Ue, e));\n }\n }, {\n key: \"onFeatureFlags\",\n value: function (e) {\n var t = this;\n if (this.addFeatureFlagsHandler(e), this.instance.decideEndpointWasHit) {\n var n = this._prepareFeatureFlagsForCallbacks(),\n i = n.flags,\n r = n.flagVariants;\n e(i, r);\n }\n return function () {\n return t.removeFeatureFlagsHandler(e);\n };\n }\n }, {\n key: \"updateEarlyAccessFeatureEnrollment\",\n value: function (e, n) {\n var i,\n r,\n s = o({}, \"$feature_enrollment/\".concat(e), n);\n this.instance.capture(\"$feature_enrollment_update\", {\n $feature_flag: e,\n $feature_enrollment: n,\n $set: s\n }), this.setPersonPropertiesForFlags(s, !1);\n var a = t(t({}, this.getFlagVariants()), {}, o({}, e, n));\n null === (i = this.instance.persistence) || void 0 === i || i.register((o(r = {}, He, Object.keys(Ge(a))), o(r, Re, a), r)), this._fireFeatureFlagsCallbacks();\n }\n }, {\n key: \"getEarlyAccessFeatures\",\n value: function (e) {\n var t = this,\n n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],\n i = this.instance.get_property(Ie);\n if (i && !n) return e(i);\n this.instance._send_request({\n transport: \"XHR\",\n url: this.instance.requestRouter.endpointFor(\"api\", \"/api/early_access_features/?token=\".concat(this.instance.config.token)),\n method: \"GET\",\n callback: function (n) {\n var i;\n if (n.json) {\n var r = n.json.earlyAccessFeatures;\n return null === (i = t.instance.persistence) || void 0 === i || i.register(o({}, Ie, r)), e(r);\n }\n }\n });\n }\n }, {\n key: \"_prepareFeatureFlagsForCallbacks\",\n value: function () {\n var e = this.getFlags(),\n t = this.getFlagVariants();\n return {\n flags: e.filter(function (e) {\n return t[e];\n }),\n flagVariants: Object.keys(t).filter(function (e) {\n return t[e];\n }).reduce(function (e, n) {\n return e[n] = t[n], e;\n }, {})\n };\n }\n }, {\n key: \"_fireFeatureFlagsCallbacks\",\n value: function (e) {\n var t = this._prepareFeatureFlagsForCallbacks(),\n n = t.flags,\n i = t.flagVariants;\n this.featureFlagEventHandlers.forEach(function (t) {\n return t(n, i, {\n errorsLoading: e\n });\n });\n }\n }, {\n key: \"setPersonPropertiesForFlags\",\n value: function (e) {\n var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],\n i = this.instance.get_property(Fe) || {};\n this.instance.register(o({}, Fe, t(t({}, i), e))), n && this.instance.reloadFeatureFlags();\n }\n }, {\n key: \"resetPersonPropertiesForFlags\",\n value: function () {\n this.instance.unregister(Fe);\n }\n }, {\n key: \"setGroupPropertiesForFlags\",\n value: function (e) {\n var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],\n i = this.instance.get_property(xe) || {};\n 0 !== Object.keys(i).length && Object.keys(i).forEach(function (n) {\n i[n] = t(t({}, i[n]), e[n]), delete e[n];\n }), this.instance.register(o({}, xe, t(t({}, i), e))), n && this.instance.reloadFeatureFlags();\n }\n }, {\n key: \"resetGroupPropertiesForFlags\",\n value: function (e) {\n if (e) {\n var n = this.instance.get_property(xe) || {};\n this.instance.register(o({}, xe, t(t({}, n), {}, o({}, e, {}))));\n } else this.instance.unregister(xe);\n }\n }]), e;\n }();\nMath.trunc || (Math.trunc = function (e) {\n return e < 0 ? Math.ceil(e) : Math.floor(e);\n}), Number.isInteger || (Number.isInteger = function (e) {\n return F(e) && isFinite(e) && Math.floor(e) === e;\n});\nvar ze = \"0123456789abcdef\",\n Ve = function () {\n function e(t) {\n if (i(this, e), this.bytes = t, 16 !== t.length) throw new TypeError(\"not 128-bit length\");\n }\n return s(e, [{\n key: \"toString\",\n value: function () {\n for (var e = \"\", t = 0; t < this.bytes.length; t++) e = e + ze.charAt(this.bytes[t] >>> 4) + ze.charAt(15 & this.bytes[t]), 3 !== t && 5 !== t && 7 !== t && 9 !== t || (e += \"-\");\n if (36 !== e.length) throw new Error(\"Invalid UUIDv7 was generated\");\n return e;\n }\n }, {\n key: \"clone\",\n value: function () {\n return new e(this.bytes.slice(0));\n }\n }, {\n key: \"equals\",\n value: function (e) {\n return 0 === this.compareTo(e);\n }\n }, {\n key: \"compareTo\",\n value: function (e) {\n for (var t = 0; t < 16; t++) {\n var n = this.bytes[t] - e.bytes[t];\n if (0 !== n) return Math.sign(n);\n }\n return 0;\n }\n }], [{\n key: \"fromFieldsV7\",\n value: function (t, n, i, r) {\n if (!Number.isInteger(t) || !Number.isInteger(n) || !Number.isInteger(i) || !Number.isInteger(r) || t < 0 || n < 0 || i < 0 || r < 0 || t > 0xffffffffffff || n > 4095 || i > 1073741823 || r > 4294967295) throw new RangeError(\"invalid field value\");\n var s = new Uint8Array(16);\n return s[0] = t / Math.pow(2, 40), s[1] = t / Math.pow(2, 32), s[2] = t / Math.pow(2, 24), s[3] = t / Math.pow(2, 16), s[4] = t / Math.pow(2, 8), s[5] = t, s[6] = 112 | n >>> 8, s[7] = n, s[8] = 128 | i >>> 24, s[9] = i >>> 16, s[10] = i >>> 8, s[11] = i, s[12] = r >>> 24, s[13] = r >>> 16, s[14] = r >>> 8, s[15] = r, new e(s);\n }\n }]), e;\n }(),\n Qe = function () {\n function e() {\n i(this, e), o(this, \"timestamp\", 0), o(this, \"counter\", 0), o(this, \"random\", new Xe());\n }\n return s(e, [{\n key: \"generate\",\n value: function () {\n var e = this.generateOrAbort();\n if (w(e)) {\n this.timestamp = 0;\n var t = this.generateOrAbort();\n if (w(t)) throw new Error(\"Could not generate UUID after timestamp reset\");\n return t;\n }\n return e;\n }\n }, {\n key: \"generateOrAbort\",\n value: function () {\n var e = Date.now();\n if (e > this.timestamp) this.timestamp = e, this.resetCounter();else {\n if (!(e + 1e4 > this.timestamp)) return;\n this.counter++, this.counter > 4398046511103 && (this.timestamp++, this.resetCounter());\n }\n return Ve.fromFieldsV7(this.timestamp, Math.trunc(this.counter / Math.pow(2, 30)), this.counter & Math.pow(2, 30) - 1, this.random.nextUint32());\n }\n }, {\n key: \"resetCounter\",\n value: function () {\n this.counter = 1024 * this.random.nextUint32() + (1023 & this.random.nextUint32());\n }\n }]), e;\n }(),\n Je = function (e) {\n if (\"undefined\" != typeof UUIDV7_DENY_WEAK_RNG && UUIDV7_DENY_WEAK_RNG) throw new Error(\"no cryptographically strong RNG available\");\n for (var t = 0; t < e.length; t++) e[t] = 65536 * Math.trunc(65536 * Math.random()) + Math.trunc(65536 * Math.random());\n return e;\n };\nT && !w(T.crypto) && crypto.getRandomValues && (Je = function (e) {\n return crypto.getRandomValues(e);\n});\nvar Ye,\n Xe = function () {\n function e() {\n i(this, e), o(this, \"buffer\", new Uint32Array(8)), o(this, \"cursor\", 1 / 0);\n }\n return s(e, [{\n key: \"nextUint32\",\n value: function () {\n return this.cursor >= this.buffer.length && (Je(this.buffer), this.cursor = 0), this.buffer[this.cursor++];\n }\n }]), e;\n }(),\n Ke = function () {\n return Ze().toString();\n },\n Ze = function () {\n return (Ye || (Ye = new Qe())).generate();\n },\n et = \"Thu, 01 Jan 1970 00:00:00 GMT\",\n tt = \"\";\nvar nt = /[a-z0-9][a-z0-9-]+\\.[a-z]{2,}$/i;\nfunction it(e, t) {\n if (t) {\n var n = function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : D;\n if (tt) return tt;\n if (!t) return \"\";\n if ([\"localhost\", \"127.0.0.1\"].includes(e)) return \"\";\n for (var n = e.split(\".\"), i = Math.min(n.length, 8), r = \"dmn_chk_\" + Ke(), s = new RegExp(\"(^|;)\\\\s*\" + r + \"=1\"); !tt && i--;) {\n var o = n.slice(i).join(\".\"),\n a = r + \"=1;domain=.\" + o;\n t.cookie = a, s.test(t.cookie) && (t.cookie = a + \";expires=\" + et, tt = o);\n }\n return tt;\n }(e);\n if (!n) {\n var i = function (e) {\n var t = e.match(nt);\n return t ? t[0] : \"\";\n }(e);\n i !== n && G.info(\"Warning: cookie subdomain discovery mismatch\", i, n), n = i;\n }\n return n ? \"; domain=.\" + n : \"\";\n }\n return \"\";\n}\nvar rt,\n st = {\n is_supported: function () {\n return !!D;\n },\n error: function (e) {\n G.error(\"cookieStore error: \" + e);\n },\n get: function (e) {\n if (D) {\n try {\n for (var t = e + \"=\", n = D.cookie.split(\";\").filter(function (e) {\n return e.length;\n }), i = 0; i < n.length; i++) {\n for (var r = n[i]; \" \" == r.charAt(0);) r = r.substring(1, r.length);\n if (0 === r.indexOf(t)) return decodeURIComponent(r.substring(t.length, r.length));\n }\n } catch (e) {}\n return null;\n }\n },\n parse: function (e) {\n var t;\n try {\n t = JSON.parse(st.get(e)) || {};\n } catch (e) {}\n return t;\n },\n set: function (e, t, n, i, r) {\n if (D) try {\n var s = \"\",\n o = \"\",\n a = it(D.location.hostname, i);\n if (n) {\n var u = new Date();\n u.setTime(u.getTime() + 24 * n * 60 * 60 * 1e3), s = \"; expires=\" + u.toUTCString();\n }\n r && (o = \"; secure\");\n var l = e + \"=\" + encodeURIComponent(JSON.stringify(t)) + s + \"; SameSite=Lax; path=/\" + a + o;\n return l.length > 3686.4 && G.warn(\"cookieStore warning: large cookie, len=\" + l.length), D.cookie = l, l;\n } catch (e) {\n return;\n }\n },\n remove: function (e, t) {\n try {\n st.set(e, \"\", -1, t);\n } catch (e) {\n return;\n }\n }\n },\n ot = null,\n at = {\n is_supported: function () {\n if (!R(ot)) return ot;\n var e = !0;\n if (w(T)) e = !1;else try {\n var t = \"__mplssupport__\";\n at.set(t, \"xyz\"), '\"xyz\"' !== at.get(t) && (e = !1), at.remove(t);\n } catch (t) {\n e = !1;\n }\n return e || G.error(\"localStorage unsupported; falling back to cookie store\"), ot = e, e;\n },\n error: function (e) {\n G.error(\"localStorage error: \" + e);\n },\n get: function (e) {\n try {\n return null == T ? void 0 : T.localStorage.getItem(e);\n } catch (e) {\n at.error(e);\n }\n return null;\n },\n parse: function (e) {\n try {\n return JSON.parse(at.get(e)) || {};\n } catch (e) {}\n return null;\n },\n set: function (e, t) {\n try {\n null == T || T.localStorage.setItem(e, JSON.stringify(t));\n } catch (e) {\n at.error(e);\n }\n },\n remove: function (e) {\n try {\n null == T || T.localStorage.removeItem(e);\n } catch (e) {\n at.error(e);\n }\n }\n },\n ut = [\"distinct_id\", Se, Ee, qe],\n lt = t(t({}, at), {}, {\n parse: function (e) {\n try {\n var t = {};\n try {\n t = st.parse(e) || {};\n } catch (e) {}\n var n = J(t, JSON.parse(at.get(e) || \"{}\"));\n return at.set(e, n), n;\n } catch (e) {}\n return null;\n },\n set: function (e, t, n, i, r, s) {\n try {\n at.set(e, t, void 0, void 0, s);\n var o = {};\n ut.forEach(function (e) {\n t[e] && (o[e] = t[e]);\n }), Object.keys(o).length && st.set(e, o, n, i, r, s);\n } catch (e) {\n at.error(e);\n }\n },\n remove: function (e, t) {\n try {\n null == T || T.localStorage.removeItem(e), st.remove(e, t);\n } catch (e) {\n at.error(e);\n }\n }\n }),\n ct = {},\n dt = {\n is_supported: function () {\n return !0;\n },\n error: function (e) {\n G.error(\"memoryStorage error: \" + e);\n },\n get: function (e) {\n return ct[e] || null;\n },\n parse: function (e) {\n return ct[e] || null;\n },\n set: function (e, t) {\n ct[e] = t;\n },\n remove: function (e) {\n delete ct[e];\n }\n },\n ht = null,\n ft = {\n is_supported: function () {\n if (!R(ht)) return ht;\n if (ht = !0, w(T)) ht = !1;else try {\n var e = \"__support__\";\n ft.set(e, \"xyz\"), '\"xyz\"' !== ft.get(e) && (ht = !1), ft.remove(e);\n } catch (e) {\n ht = !1;\n }\n return ht;\n },\n error: function (e) {\n G.error(\"sessionStorage error: \", e);\n },\n get: function (e) {\n try {\n return null == T ? void 0 : T.sessionStorage.getItem(e);\n } catch (e) {\n ft.error(e);\n }\n return null;\n },\n parse: function (e) {\n try {\n return JSON.parse(ft.get(e)) || null;\n } catch (e) {}\n return null;\n },\n set: function (e, t) {\n try {\n null == T || T.sessionStorage.setItem(e, JSON.stringify(t));\n } catch (e) {\n ft.error(e);\n }\n },\n remove: function (e) {\n try {\n null == T || T.sessionStorage.removeItem(e);\n } catch (e) {\n ft.error(e);\n }\n }\n },\n vt = [\"localhost\", \"127.0.0.1\"],\n pt = function (e) {\n var t = null == D ? void 0 : D.createElement(\"a\");\n return w(t) ? null : (t.href = e, t);\n },\n gt = function (e, t) {\n return !!function (e) {\n try {\n new RegExp(e);\n } catch (e) {\n return !1;\n }\n return !0;\n }(t) && new RegExp(t).test(e);\n },\n _t = function (e) {\n var t,\n n,\n i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : \"&\",\n r = [];\n return Q(e, function (e, i) {\n w(e) || w(i) || \"undefined\" === i || (t = encodeURIComponent(function (e) {\n return e instanceof File;\n }(e) ? e.name : e.toString()), n = encodeURIComponent(i), r[r.length] = n + \"=\" + t);\n }), r.join(i);\n },\n mt = function (e, t) {\n for (var n, i = ((e.split(\"#\")[0] || \"\").split(\"?\")[1] || \"\").split(\"&\"), r = 0; r < i.length; r++) {\n var s = i[r].split(\"=\");\n if (s[0] === t) {\n n = s;\n break;\n }\n }\n if (!m(n) || n.length < 2) return \"\";\n var o = n[1];\n try {\n o = decodeURIComponent(o);\n } catch (e) {\n G.error(\"Skipping decoding for malformed query param: \" + o);\n }\n return o.replace(/\\+/g, \" \");\n },\n yt = function (e, t) {\n var n = e.match(new RegExp(t + \"=([^&]*)\"));\n return n ? n[1] : null;\n },\n bt = \"Mobile\",\n kt = \"iOS\",\n wt = \"Android\",\n St = \"Tablet\",\n Et = wt + \" \" + St,\n Rt = \"iPad\",\n It = \"Apple\",\n Ft = It + \" Watch\",\n xt = \"Safari\",\n Pt = \"BlackBerry\",\n Tt = \"Samsung\",\n Ct = Tt + \"Browser\",\n $t = Tt + \" Internet\",\n Ot = \"Chrome\",\n Mt = Ot + \" OS\",\n At = Ot + \" \" + kt,\n Dt = \"Internet Explorer\",\n Lt = Dt + \" \" + bt,\n qt = \"Opera\",\n Nt = qt + \" Mini\",\n Bt = \"Edge\",\n Ht = \"Microsoft \" + Bt,\n Ut = \"Firefox\",\n jt = Ut + \" \" + kt,\n Gt = \"Nintendo\",\n Wt = \"PlayStation\",\n zt = \"Xbox\",\n Vt = wt + \" \" + bt,\n Qt = bt + \" \" + xt,\n Jt = \"Windows\",\n Yt = Jt + \" Phone\",\n Xt = \"Nokia\",\n Kt = \"Ouya\",\n Zt = \"Generic\",\n en = Zt + \" \" + bt.toLowerCase(),\n tn = Zt + \" \" + St.toLowerCase(),\n nn = \"Konqueror\",\n rn = \"(\\\\d+(\\\\.\\\\d+)?)\",\n sn = new RegExp(\"Version/\" + rn),\n on = new RegExp(zt, \"i\"),\n an = new RegExp(Wt + \" \\\\w+\", \"i\"),\n un = new RegExp(Gt + \" \\\\w+\", \"i\"),\n ln = new RegExp(Pt + \"|PlayBook|BB10\", \"i\"),\n cn = {\n \"NT3.51\": \"NT 3.11\",\n \"NT4.0\": \"NT 4.0\",\n \"5.0\": \"2000\",\n 5.1: \"XP\",\n 5.2: \"XP\",\n \"6.0\": \"Vista\",\n 6.1: \"7\",\n 6.2: \"8\",\n 6.3: \"8.1\",\n 6.4: \"10\",\n \"10.0\": \"10\"\n };\nvar dn = function (e, t) {\n return t && Y(t, It) || function (e) {\n return Y(e, xt) && !Y(e, Ot) && !Y(e, wt);\n }(e);\n },\n hn = function (e, t) {\n return t = t || \"\", Y(e, \" OPR/\") && Y(e, \"Mini\") ? Nt : Y(e, \" OPR/\") ? qt : ln.test(e) ? Pt : Y(e, \"IE\" + bt) || Y(e, \"WPDesktop\") ? Lt : Y(e, Ct) ? $t : Y(e, Bt) || Y(e, \"Edg/\") ? Ht : Y(e, \"FBIOS\") ? \"Facebook \" + bt : Y(e, \"UCWEB\") || Y(e, \"UCBrowser\") ? \"UC Browser\" : Y(e, \"CriOS\") ? At : Y(e, \"CrMo\") ? Ot : Y(e, wt) && Y(e, xt) ? Vt : Y(e, Ot) ? Ot : Y(e, \"FxiOS\") ? jt : Y(e.toLowerCase(), nn.toLowerCase()) ? nn : dn(e, t) ? Y(e, bt) ? Qt : xt : Y(e, Ut) ? Ut : Y(e, \"MSIE\") || Y(e, \"Trident/\") ? Dt : Y(e, \"Gecko\") ? Ut : \"\";\n },\n fn = (o(rt = {}, Lt, [new RegExp(\"rv:\" + rn)]), o(rt, Ht, [new RegExp(Bt + \"?\\\\/\" + rn)]), o(rt, Ot, [new RegExp(\"(\" + Ot + \"|CrMo)\\\\/\" + rn)]), o(rt, At, [new RegExp(\"CriOS\\\\/\" + rn)]), o(rt, \"UC Browser\", [new RegExp(\"(UCBrowser|UCWEB)\\\\/\" + rn)]), o(rt, xt, [sn]), o(rt, Qt, [sn]), o(rt, qt, [new RegExp(\"(Opera|OPR)\\\\/\" + rn)]), o(rt, Ut, [new RegExp(Ut + \"\\\\/\" + rn)]), o(rt, jt, [new RegExp(\"FxiOS\\\\/\" + rn)]), o(rt, nn, [new RegExp(\"Konqueror[:/]?\" + rn, \"i\")]), o(rt, Pt, [new RegExp(Pt + \" \" + rn), sn]), o(rt, Vt, [new RegExp(\"android\\\\s\" + rn, \"i\")]), o(rt, $t, [new RegExp(Ct + \"\\\\/\" + rn)]), o(rt, Dt, [new RegExp(\"(rv:|MSIE )\" + rn)]), o(rt, \"Mozilla\", [new RegExp(\"rv:\" + rn)]), rt),\n vn = [[new RegExp(zt + \"; \" + zt + \" (.*?)[);]\", \"i\"), function (e) {\n return [zt, e && e[1] || \"\"];\n }], [new RegExp(Gt, \"i\"), [Gt, \"\"]], [new RegExp(Wt, \"i\"), [Wt, \"\"]], [ln, [Pt, \"\"]], [new RegExp(Jt, \"i\"), function (e, t) {\n if (/Phone/.test(t) || /WPDesktop/.test(t)) return [Yt, \"\"];\n if (new RegExp(bt).test(t) && !/IEMobile\\b/.test(t)) return [Jt + \" \" + bt, \"\"];\n var n = /Windows NT ([0-9.]+)/i.exec(t);\n if (n && n[1]) {\n var i = n[1],\n r = cn[i] || \"\";\n return /arm/i.test(t) && (r = \"RT\"), [Jt, r];\n }\n return [Jt, \"\"];\n }], [/((iPhone|iPad|iPod).*?OS (\\d+)_(\\d+)_?(\\d+)?|iPhone)/, function (e) {\n if (e && e[3]) {\n var t = [e[3], e[4], e[5] || \"0\"];\n return [kt, t.join(\".\")];\n }\n return [kt, \"\"];\n }], [/(watch.*\\/(\\d+\\.\\d+\\.\\d+)|watch os,(\\d+\\.\\d+),)/i, function (e) {\n var t = \"\";\n return e && e.length >= 3 && (t = w(e[2]) ? e[3] : e[2]), [\"watchOS\", t];\n }], [new RegExp(\"(\" + wt + \" (\\\\d+)\\\\.(\\\\d+)\\\\.?(\\\\d+)?|\" + wt + \")\", \"i\"), function (e) {\n if (e && e[2]) {\n var t = [e[2], e[3], e[4] || \"0\"];\n return [wt, t.join(\".\")];\n }\n return [wt, \"\"];\n }], [/Mac OS X (\\d+)[_.](\\d+)[_.]?(\\d+)?/i, function (e) {\n var t = [\"Mac OS X\", \"\"];\n if (e && e[1]) {\n var n = [e[1], e[2], e[3] || \"0\"];\n t[1] = n.join(\".\");\n }\n return t;\n }], [/Mac/i, [\"Mac OS X\", \"\"]], [/CrOS/, [Mt, \"\"]], [/Linux|debian/i, [\"Linux\", \"\"]]],\n pn = function (e) {\n return un.test(e) ? Gt : an.test(e) ? Wt : on.test(e) ? zt : new RegExp(Kt, \"i\").test(e) ? Kt : new RegExp(\"(\" + Yt + \"|WPDesktop)\", \"i\").test(e) ? Yt : /iPad/.test(e) ? Rt : /iPod/.test(e) ? \"iPod Touch\" : /iPhone/.test(e) ? \"iPhone\" : /(watch)(?: ?os[,/]|\\d,\\d\\/)[\\d.]+/i.test(e) ? Ft : ln.test(e) ? Pt : /(kobo)\\s(ereader|touch)/i.test(e) ? \"Kobo\" : new RegExp(Xt, \"i\").test(e) ? Xt : /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\\))/i.test(e) || /(kf[a-z]+)( bui|\\)).+silk\\//i.test(e) ? \"Kindle Fire\" : /(Android|ZTE)/i.test(e) ? !new RegExp(bt).test(e) || /(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e) ? /pixel[\\daxl ]{1,6}/i.test(e) && !/pixel c/i.test(e) || /(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e) || /lmy47v/i.test(e) && !/QTAQZ3/i.test(e) ? wt : Et : wt : new RegExp(\"(pda|\" + bt + \")\", \"i\").test(e) ? en : new RegExp(St, \"i\").test(e) && !new RegExp(St + \" pc\", \"i\").test(e) ? tn : \"\";\n },\n gn = \"https?://(.*)\",\n _n = [\"utm_source\", \"utm_medium\", \"utm_campaign\", \"utm_content\", \"utm_term\", \"gclid\", \"gad_source\", \"gclsrc\", \"dclid\", \"gbraid\", \"wbraid\", \"fbclid\", \"msclkid\", \"twclid\", \"li_fat_id\", \"mc_cid\", \"igshid\", \"ttclid\", \"rdt_cid\"],\n mn = {\n campaignParams: function (e) {\n return D ? this._campaignParamsFromUrl(D.URL, e) : {};\n },\n _campaignParamsFromUrl: function (e, t) {\n var n = _n.concat(t || []),\n i = {};\n return Q(n, function (t) {\n var n = mt(e, t);\n n && (i[t] = n);\n }), i;\n },\n _searchEngine: function (e) {\n return e ? 0 === e.search(gn + \"google.([^/?]*)\") ? \"google\" : 0 === e.search(gn + \"bing.com\") ? \"bing\" : 0 === e.search(gn + \"yahoo.com\") ? \"yahoo\" : 0 === e.search(gn + \"duckduckgo.com\") ? \"duckduckgo\" : null : null;\n },\n _searchInfoFromReferrer: function (e) {\n var t = mn._searchEngine(e),\n n = \"yahoo\" != t ? \"q\" : \"p\",\n i = {};\n if (!R(t)) {\n i.$search_engine = t;\n var r = D ? mt(D.referrer, n) : \"\";\n r.length && (i.ph_keyword = r);\n }\n return i;\n },\n searchInfo: function () {\n var e = null == D ? void 0 : D.referrer;\n return e ? this._searchInfoFromReferrer(e) : {};\n },\n browser: hn,\n browserVersion: function (e, t) {\n var n = hn(e, t),\n i = fn[n];\n if (w(i)) return null;\n for (var r = 0; r < i.length; r++) {\n var s = i[r],\n o = e.match(s);\n if (o) return parseFloat(o[o.length - 2]);\n }\n return null;\n },\n browserLanguage: function () {\n return navigator.language || navigator.userLanguage;\n },\n os: function (e) {\n for (var t = 0; t < vn.length; t++) {\n var n = u(vn[t], 2),\n i = n[0],\n r = n[1],\n s = i.exec(e),\n o = s && (y(r) ? r(s, e) : r);\n if (o) return o;\n }\n return [\"\", \"\"];\n },\n device: pn,\n deviceType: function (e) {\n var t = pn(e);\n return t === Rt || t === Et || \"Kobo\" === t || \"Kindle Fire\" === t || t === tn ? St : t === Gt || t === zt || t === Wt || t === Kt ? \"Console\" : t === Ft ? \"Wearable\" : t ? bt : \"Desktop\";\n },\n referrer: function () {\n return (null == D ? void 0 : D.referrer) || \"$direct\";\n },\n referringDomain: function () {\n var e;\n return null != D && D.referrer && (null === (e = pt(D.referrer)) || void 0 === e ? void 0 : e.host) || \"$direct\";\n },\n referrerInfo: function () {\n return {\n $referrer: this.referrer(),\n $referring_domain: this.referringDomain()\n };\n },\n initialPersonInfo: function () {\n return {\n r: this.referrer(),\n u: null == L ? void 0 : L.href\n };\n },\n initialPersonPropsFromInfo: function (e) {\n var t,\n n = e.r,\n i = e.u,\n r = {\n $initial_referrer: n,\n $initial_referring_domain: null == n ? void 0 : \"$direct\" == n ? \"$direct\" : null === (t = pt(n)) || void 0 === t ? void 0 : t.host\n };\n if (i) {\n r.$initial_current_url = i;\n var s = pt(i);\n r.$initial_host = null == s ? void 0 : s.host, r.$initial_pathname = null == s ? void 0 : s.pathname, Q(this._campaignParamsFromUrl(i), function (e, t) {\n r[\"$initial_\" + ne(t)] = e;\n });\n }\n n && Q(this._searchInfoFromReferrer(n), function (e, t) {\n r[\"$initial_\" + ne(t)] = e;\n });\n return r;\n },\n properties: function () {\n if (!H) return {};\n var e = u(mn.os(H), 2),\n t = e[0],\n n = e[1];\n return J(te({\n $os: t,\n $os_version: n,\n $browser: mn.browser(H, navigator.vendor),\n $device: mn.device(H),\n $device_type: mn.deviceType(H)\n }), {\n $current_url: null == L ? void 0 : L.href,\n $host: null == L ? void 0 : L.host,\n $pathname: null == L ? void 0 : L.pathname,\n $raw_user_agent: H.length > 1e3 ? H.substring(0, 997) + \"...\" : H,\n $browser_version: mn.browserVersion(H, navigator.vendor),\n $browser_language: mn.browserLanguage(),\n $screen_height: null == T ? void 0 : T.screen.height,\n $screen_width: null == T ? void 0 : T.screen.width,\n $viewport_height: null == T ? void 0 : T.innerHeight,\n $viewport_width: null == T ? void 0 : T.innerWidth,\n $lib: \"web\",\n $lib_version: f.LIB_VERSION,\n $insert_id: Math.random().toString(36).substring(2, 10) + Math.random().toString(36).substring(2, 10),\n $time: K() / 1e3\n });\n },\n people_properties: function () {\n if (!H) return {};\n var e = u(mn.os(H), 2),\n t = e[0],\n n = e[1];\n return J(te({\n $os: t,\n $os_version: n,\n $browser: mn.browser(H, navigator.vendor)\n }), {\n $browser_version: mn.browserVersion(H, navigator.vendor)\n });\n }\n },\n yn = [\"cookie\", \"localstorage\", \"localstorage+cookie\", \"sessionstorage\", \"memory\"],\n bn = function () {\n function e(n) {\n i(this, e), this.config = n, this.props = {}, this.campaign_params_saved = !1, this.name = function (e) {\n var t = \"\";\n return e.token && (t = e.token.replace(/\\+/g, \"PL\").replace(/\\//g, \"SL\").replace(/=/g, \"EQ\")), e.persistence_name ? \"ph_\" + e.persistence_name : \"ph_\" + t + \"_posthog\";\n }(n), this.storage = this.buildStorage(n), this.load(), n.debug && G.info(\"Persistence loaded\", n.persistence, t({}, this.props)), this.update_config(n, n), this.save();\n }\n return s(e, [{\n key: \"buildStorage\",\n value: function (e) {\n -1 === yn.indexOf(e.persistence.toLowerCase()) && (G.critical(\"Unknown persistence type \" + e.persistence + \"; falling back to localStorage+cookie\"), e.persistence = \"localStorage+cookie\");\n var t = e.persistence.toLowerCase();\n return \"localstorage\" === t && at.is_supported() ? at : \"localstorage+cookie\" === t && lt.is_supported() ? lt : \"sessionstorage\" === t && ft.is_supported() ? ft : \"memory\" === t ? dt : \"cookie\" === t ? st : lt.is_supported() ? lt : st;\n }\n }, {\n key: \"properties\",\n value: function () {\n var e = {};\n return Q(this.props, function (t, n) {\n if (n === Re && b(t)) for (var i = Object.keys(t), r = 0; r < i.length; r++) e[\"$feature/\".concat(i[r])] = t[i[r]];else o = n, a = !1, (R(s = Be) ? a : M && s.indexOf === M ? -1 != s.indexOf(o) : (Q(s, function (e) {\n if (a || (a = e === o)) return W;\n }), a)) || (e[n] = t);\n var s, o, a;\n }), e;\n }\n }, {\n key: \"load\",\n value: function () {\n if (!this.disabled) {\n var e = this.storage.parse(this.name);\n e && (this.props = J({}, e));\n }\n }\n }, {\n key: \"save\",\n value: function () {\n this.disabled || this.storage.set(this.name, this.props, this.expire_days, this.cross_subdomain, this.secure, this.config.debug);\n }\n }, {\n key: \"remove\",\n value: function () {\n this.storage.remove(this.name, !1), this.storage.remove(this.name, !0);\n }\n }, {\n key: \"clear\",\n value: function () {\n this.remove(), this.props = {};\n }\n }, {\n key: \"register_once\",\n value: function (e, t, n) {\n var i = this;\n if (b(e)) {\n w(t) && (t = \"None\"), this.expire_days = w(n) ? this.default_expiry : n;\n var r = !1;\n if (Q(e, function (e, n) {\n i.props.hasOwnProperty(n) && i.props[n] !== t || (i.props[n] = e, r = !0);\n }), r) return this.save(), !0;\n }\n return !1;\n }\n }, {\n key: \"register\",\n value: function (e, t) {\n var n = this;\n if (b(e)) {\n this.expire_days = w(t) ? this.default_expiry : t;\n var i = !1;\n if (Q(e, function (t, r) {\n e.hasOwnProperty(r) && n.props[r] !== t && (n.props[r] = t, i = !0);\n }), i) return this.save(), !0;\n }\n return !1;\n }\n }, {\n key: \"unregister\",\n value: function (e) {\n e in this.props && (delete this.props[e], this.save());\n }\n }, {\n key: \"update_campaign_params\",\n value: function () {\n this.campaign_params_saved || (this.register(mn.campaignParams(this.config.custom_campaign_params)), this.campaign_params_saved = !0);\n }\n }, {\n key: \"update_search_keyword\",\n value: function () {\n this.register(mn.searchInfo());\n }\n }, {\n key: \"update_referrer_info\",\n value: function () {\n this.register_once(mn.referrerInfo(), void 0);\n }\n }, {\n key: \"set_initial_person_info\",\n value: function () {\n this.props[Ae] || this.props[De] || this.register_once(o({}, Le, mn.initialPersonInfo()), void 0);\n }\n }, {\n key: \"get_referrer_info\",\n value: function () {\n return te({\n $referrer: this.props.$referrer,\n $referring_domain: this.props.$referring_domain\n });\n }\n }, {\n key: \"get_initial_props\",\n value: function () {\n var e = this,\n t = {};\n Q([De, Ae], function (n) {\n var i = e.props[n];\n i && Q(i, function (e, n) {\n t[\"$initial_\" + ne(n)] = e;\n });\n });\n var n = this.props[Le];\n if (n) {\n var i = mn.initialPersonPropsFromInfo(n);\n J(t, i);\n }\n return t;\n }\n }, {\n key: \"safe_merge\",\n value: function (e) {\n return Q(this.props, function (t, n) {\n n in e || (e[n] = t);\n }), e;\n }\n }, {\n key: \"update_config\",\n value: function (e, t) {\n if (this.default_expiry = this.expire_days = e.cookie_expiration, this.set_disabled(e.disable_persistence), this.set_cross_subdomain(e.cross_subdomain_cookie), this.set_secure(e.secure_cookie), e.persistence !== t.persistence) {\n var n = this.buildStorage(e),\n i = this.props;\n this.clear(), this.storage = n, this.props = i, this.save();\n }\n }\n }, {\n key: \"set_disabled\",\n value: function (e) {\n this.disabled = e, this.disabled ? this.remove() : this.save();\n }\n }, {\n key: \"set_cross_subdomain\",\n value: function (e) {\n e !== this.cross_subdomain && (this.cross_subdomain = e, this.remove(), this.save());\n }\n }, {\n key: \"get_cross_subdomain\",\n value: function () {\n return !!this.cross_subdomain;\n }\n }, {\n key: \"set_secure\",\n value: function (e) {\n e !== this.secure && (this.secure = e, this.remove(), this.save());\n }\n }, {\n key: \"set_event_timer\",\n value: function (e, t) {\n var n = this.props[de] || {};\n n[e] = t, this.props[de] = n, this.save();\n }\n }, {\n key: \"remove_event_timer\",\n value: function (e) {\n var t = (this.props[de] || {})[e];\n return w(t) || (delete this.props[de][e], this.save()), t;\n }\n }, {\n key: \"get_property\",\n value: function (e) {\n return this.props[e];\n }\n }, {\n key: \"set_property\",\n value: function (e, t) {\n this.props[e] = t, this.save();\n }\n }]), e;\n }();\nfunction kn(e) {\n return JSON.stringify(e, (t = [], function (e, n) {\n if (b(n)) {\n for (; t.length > 0 && t.at(-1) !== this;) t.pop();\n return t.includes(n) ? \"[Circular]\" : (t.push(n), n);\n }\n return n;\n })).length;\n var t;\n}\nvar wn = 2,\n Sn = 4;\nfunction En(e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 6606028.8;\n if (e.size >= t && e.data.length > 1) {\n var n = Math.floor(e.data.length / 2),\n i = e.data.slice(0, n),\n r = e.data.slice(n);\n return [En({\n size: kn(i),\n data: i,\n sessionId: e.sessionId,\n windowId: e.windowId\n }), En({\n size: kn(r),\n data: r,\n sessionId: e.sessionId,\n windowId: e.windowId\n })].flatMap(function (e) {\n return e;\n });\n }\n return [e];\n}\nvar Rn = function (e) {\n return e[e.DomContentLoaded = 0] = \"DomContentLoaded\", e[e.Load = 1] = \"Load\", e[e.FullSnapshot = 2] = \"FullSnapshot\", e[e.IncrementalSnapshot = 3] = \"IncrementalSnapshot\", e[e.Meta = 4] = \"Meta\", e[e.Custom = 5] = \"Custom\", e[e.Plugin = 6] = \"Plugin\", e;\n }(Rn || {}),\n In = function (e) {\n return e[e.Mutation = 0] = \"Mutation\", e[e.MouseMove = 1] = \"MouseMove\", e[e.MouseInteraction = 2] = \"MouseInteraction\", e[e.Scroll = 3] = \"Scroll\", e[e.ViewportResize = 4] = \"ViewportResize\", e[e.Input = 5] = \"Input\", e[e.TouchMove = 6] = \"TouchMove\", e[e.MediaInteraction = 7] = \"MediaInteraction\", e[e.StyleSheetRule = 8] = \"StyleSheetRule\", e[e.CanvasMutation = 9] = \"CanvasMutation\", e[e.Font = 10] = \"Font\", e[e.Log = 11] = \"Log\", e[e.Drag = 12] = \"Drag\", e[e.StyleDeclaration = 13] = \"StyleDeclaration\", e[e.Selection = 14] = \"Selection\", e[e.AdoptedStyleSheet = 15] = \"AdoptedStyleSheet\", e[e.CustomElement = 16] = \"CustomElement\", e;\n }(In || {});\nfunction Fn(e) {\n return e ? z(e).split(/\\s+/) : [];\n}\nfunction xn(e) {\n var t = null == T ? void 0 : T.location.href;\n return !!(t && e && e.some(function (e) {\n return t.match(e);\n }));\n}\nfunction Pn(e) {\n var t = \"\";\n switch (n(e.className)) {\n case \"string\":\n t = e.className;\n break;\n case \"object\":\n t = (\"baseVal\" in e.className ? e.className.baseVal : null) || e.getAttribute(\"class\") || \"\";\n break;\n default:\n t = \"\";\n }\n return Fn(t);\n}\nfunction Tn(e) {\n return I(e) ? null : z(e).split(/(\\s+)/).filter(function (e) {\n return Vn(e);\n }).join(\"\").replace(/[\\r\\n]/g, \" \").replace(/[ ]+/g, \" \").substring(0, 255);\n}\nfunction Cn(e) {\n var t = \"\";\n return Nn(e) && !Bn(e) && e.childNodes && e.childNodes.length && Q(e.childNodes, function (e) {\n var n;\n Mn(e) && e.textContent && (t += null !== (n = Tn(e.textContent)) && void 0 !== n ? n : \"\");\n }), z(t);\n}\nfunction $n(e) {\n return !!e && 1 === e.nodeType;\n}\nfunction On(e, t) {\n return !!e && !!e.tagName && e.tagName.toLowerCase() === t.toLowerCase();\n}\nfunction Mn(e) {\n return !!e && 3 === e.nodeType;\n}\nfunction An(e) {\n return !!e && 11 === e.nodeType;\n}\nvar Dn = [\"a\", \"button\", \"form\", \"input\", \"select\", \"textarea\", \"label\"];\nfunction Ln(e) {\n var t = e.parentNode;\n return !(!t || !$n(t)) && t;\n}\nfunction qn(e, t) {\n var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0,\n r = arguments.length > 3 ? arguments[3] : void 0,\n s = arguments.length > 4 ? arguments[4] : void 0;\n if (!T || !e || On(e, \"html\") || !$n(e)) return !1;\n if (null != i && i.url_allowlist && !xn(i.url_allowlist)) return !1;\n if (null != i && i.url_ignorelist && xn(i.url_ignorelist)) return !1;\n if (null != i && i.dom_event_allowlist) {\n var o = i.dom_event_allowlist;\n if (o && !o.some(function (e) {\n return t.type === e;\n })) return !1;\n }\n for (var a = !1, u = [e], l = !0, c = e; c.parentNode && !On(c, \"body\");) if (An(c.parentNode)) u.push(c.parentNode.host), c = c.parentNode.host;else {\n if (!(l = Ln(c))) break;\n if (r || Dn.indexOf(l.tagName.toLowerCase()) > -1) a = !0;else {\n var d = T.getComputedStyle(l);\n d && \"pointer\" === d.getPropertyValue(\"cursor\") && (a = !0);\n }\n u.push(l), c = l;\n }\n if (!function (e, t) {\n var i = null == t ? void 0 : t.element_allowlist;\n if (w(i)) return !0;\n var r,\n s = h(e);\n try {\n var o = function () {\n var e = r.value;\n if (i.some(function (t) {\n return e.tagName.toLowerCase() === t;\n })) return {\n v: !0\n };\n };\n for (s.s(); !(r = s.n()).done;) {\n var a = o();\n if (\"object\" === n(a)) return a.v;\n }\n } catch (e) {\n s.e(e);\n } finally {\n s.f();\n }\n return !1;\n }(u, i)) return !1;\n if (!function (e, t) {\n var i = null == t ? void 0 : t.css_selector_allowlist;\n if (w(i)) return !0;\n var r,\n s = h(e);\n try {\n var o = function () {\n var e = r.value;\n if (i.some(function (t) {\n return e.matches(t);\n })) return {\n v: !0\n };\n };\n for (s.s(); !(r = s.n()).done;) {\n var a = o();\n if (\"object\" === n(a)) return a.v;\n }\n } catch (e) {\n s.e(e);\n } finally {\n s.f();\n }\n return !1;\n }(u, i)) return !1;\n var f = T.getComputedStyle(e);\n if (f && \"pointer\" === f.getPropertyValue(\"cursor\") && \"click\" === t.type) return !0;\n var v = e.tagName.toLowerCase();\n switch (v) {\n case \"html\":\n return !1;\n case \"form\":\n return (s || [\"submit\"]).indexOf(t.type) >= 0;\n case \"input\":\n case \"select\":\n case \"textarea\":\n return (s || [\"change\", \"click\"]).indexOf(t.type) >= 0;\n default:\n return a ? (s || [\"click\"]).indexOf(t.type) >= 0 : (s || [\"click\"]).indexOf(t.type) >= 0 && (Dn.indexOf(v) > -1 || \"true\" === e.getAttribute(\"contenteditable\"));\n }\n}\nfunction Nn(e) {\n for (var t = e; t.parentNode && !On(t, \"body\"); t = t.parentNode) {\n var n = Pn(t);\n if (Y(n, \"ph-sensitive\") || Y(n, \"ph-no-capture\")) return !1;\n }\n if (Y(Pn(e), \"ph-include\")) return !0;\n var i = e.type || \"\";\n if (S(i)) switch (i.toLowerCase()) {\n case \"hidden\":\n case \"password\":\n return !1;\n }\n var r = e.name || e.id || \"\";\n if (S(r)) {\n if (/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g, \"\"))) return !1;\n }\n return !0;\n}\nfunction Bn(e) {\n return !!(On(e, \"input\") && ![\"button\", \"checkbox\", \"submit\", \"reset\"].includes(e.type) || On(e, \"select\") || On(e, \"textarea\") || \"true\" === e.getAttribute(\"contenteditable\"));\n}\nvar Hn = \"(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})\",\n Un = new RegExp(\"^(?:\".concat(Hn, \")$\")),\n jn = new RegExp(Hn),\n Gn = \"\\\\d{3}-?\\\\d{2}-?\\\\d{4}\",\n Wn = new RegExp(\"^(\".concat(Gn, \")$\")),\n zn = new RegExp(\"(\".concat(Gn, \")\"));\nfunction Vn(e) {\n var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];\n if (I(e)) return !1;\n if (S(e)) {\n if (e = z(e), (t ? Un : jn).test((e || \"\").replace(/[- ]/g, \"\"))) return !1;\n if ((t ? Wn : zn).test(e)) return !1;\n }\n return !0;\n}\nfunction Qn(e) {\n var t = Cn(e);\n return Vn(t = \"\".concat(t, \" \").concat(Jn(e)).trim()) ? t : \"\";\n}\nfunction Jn(e) {\n var t = \"\";\n return e && e.childNodes && e.childNodes.length && Q(e.childNodes, function (e) {\n var n;\n if (e && \"span\" === (null === (n = e.tagName) || void 0 === n ? void 0 : n.toLowerCase())) try {\n var i = Cn(e);\n t = \"\".concat(t, \" \").concat(i).trim(), e.childNodes && e.childNodes.length && (t = \"\".concat(t, \" \").concat(Jn(e)).trim());\n } catch (e) {\n G.error(e);\n }\n }), t;\n}\nfunction Yn(e) {\n return function (e) {\n var n = e.map(function (e) {\n var n,\n i,\n r = \"\";\n if (e.tag_name && (r += e.tag_name), e.attr_class) {\n e.attr_class.sort();\n var s,\n o = h(e.attr_class);\n try {\n for (o.s(); !(s = o.n()).done;) {\n var a = s.value;\n r += \".\".concat(a.replace(/\"/g, \"\"));\n }\n } catch (e) {\n o.e(e);\n } finally {\n o.f();\n }\n }\n var l = t(t(t(t({}, e.text ? {\n text: e.text\n } : {}), {}, {\n \"nth-child\": null !== (n = e.nth_child) && void 0 !== n ? n : 0,\n \"nth-of-type\": null !== (i = e.nth_of_type) && void 0 !== i ? i : 0\n }, e.href ? {\n href: e.href\n } : {}), e.attr_id ? {\n attr_id: e.attr_id\n } : {}), e.attributes),\n c = {};\n return X(l).sort(function (e, t) {\n var n = u(e, 1)[0],\n i = u(t, 1)[0];\n return n.localeCompare(i);\n }).forEach(function (e) {\n var t = u(e, 2),\n n = t[0],\n i = t[1];\n return c[Xn(n.toString())] = Xn(i.toString());\n }), r += \":\", r += X(l).map(function (e) {\n var t = u(e, 2),\n n = t[0],\n i = t[1];\n return \"\".concat(n, '=\"').concat(i, '\"');\n }).join(\"\");\n });\n return n.join(\";\");\n }(function (e) {\n return e.map(function (e) {\n var t,\n n,\n i = {\n text: null === (t = e.$el_text) || void 0 === t ? void 0 : t.slice(0, 400),\n tag_name: e.tag_name,\n href: null === (n = e.attr__href) || void 0 === n ? void 0 : n.slice(0, 2048),\n attr_class: Kn(e),\n attr_id: e.attr__id,\n nth_child: e.nth_child,\n nth_of_type: e.nth_of_type,\n attributes: {}\n };\n return X(e).filter(function (e) {\n return 0 === u(e, 1)[0].indexOf(\"attr__\");\n }).forEach(function (e) {\n var t = u(e, 2),\n n = t[0],\n r = t[1];\n return i.attributes[n] = r;\n }), i;\n });\n }(e));\n}\nfunction Xn(e) {\n return e.replace(/\"|\\\\\"/g, '\\\\\"');\n}\nfunction Kn(e) {\n var t = e.attr__class;\n return t ? m(t) ? t : Fn(t) : void 0;\n}\nvar Zn = \"[SessionRecording]\",\n ei = \"redacted\",\n ti = {\n initiatorTypes: [\"audio\", \"beacon\", \"body\", \"css\", \"early-hint\", \"embed\", \"fetch\", \"frame\", \"iframe\", \"icon\", \"image\", \"img\", \"input\", \"link\", \"navigation\", \"object\", \"ping\", \"script\", \"track\", \"video\", \"xmlhttprequest\"],\n maskRequestFn: function (e) {\n return e;\n },\n recordHeaders: !1,\n recordBody: !1,\n recordInitialRequests: !1,\n recordPerformance: !1,\n performanceEntryTypeToObserve: [\"first-input\", \"navigation\", \"paint\", \"resource\"],\n payloadSizeLimitBytes: 1e6,\n payloadHostDenyList: [\".lr-ingest.io\", \".ingest.sentry.io\"]\n },\n ni = [\"authorization\", \"x-forwarded-for\", \"authorization\", \"cookie\", \"set-cookie\", \"x-api-key\", \"x-real-ip\", \"remote-addr\", \"forwarded\", \"proxy-authorization\", \"x-csrf-token\", \"x-csrftoken\", \"x-xsrf-token\"],\n ii = [\"password\", \"secret\", \"passwd\", \"api_key\", \"apikey\", \"auth\", \"credentials\", \"mysql_pwd\", \"privatekey\", \"private_key\", \"token\"],\n ri = [\"/s/\", \"/e/\", \"/i/\"];\nfunction si(e, t, n, i) {\n if (I(e)) return e;\n var r = (null == t ? void 0 : t[\"content-length\"]) || function (e) {\n return new Blob([e]).size;\n }(e);\n return S(r) && (r = parseInt(r)), r > n ? Zn + \" \".concat(i, \" body too large to record (\").concat(r, \" bytes)\") : e;\n}\nfunction oi(e, t) {\n if (I(e)) return e;\n var n = e;\n return Vn(n, !1) || (n = Zn + \" \" + t + \" body \" + ei), Q(ii, function (e) {\n var i, r;\n null !== (i = n) && void 0 !== i && i.length && -1 !== (null === (r = n) || void 0 === r ? void 0 : r.indexOf(e)) && (n = Zn + \" \" + t + \" body \" + ei + \" as might contain: \" + e);\n }), n;\n}\nvar ai,\n ui = function (e, n) {\n var i,\n r,\n s,\n o = {\n payloadSizeLimitBytes: ti.payloadSizeLimitBytes,\n performanceEntryTypeToObserve: l(ti.performanceEntryTypeToObserve),\n payloadHostDenyList: [].concat(l(n.payloadHostDenyList || []), l(ti.payloadHostDenyList))\n },\n a = !1 !== e.session_recording.recordHeaders && n.recordHeaders,\n u = !1 !== e.session_recording.recordBody && n.recordBody,\n c = !1 !== e.capture_performance && n.recordPerformance,\n d = (i = o, s = Math.min(1e6, null !== (r = i.payloadSizeLimitBytes) && void 0 !== r ? r : 1e6), function (e) {\n return null != e && e.requestBody && (e.requestBody = si(e.requestBody, e.requestHeaders, s, \"Request\")), null != e && e.responseBody && (e.responseBody = si(e.responseBody, e.responseHeaders, s, \"Response\")), e;\n }),\n h = function (e) {\n return d(function (e) {\n var t = pt(e.name);\n if (!(t && t.pathname && ri.some(function (e) {\n return 0 === t.pathname.indexOf(e);\n }))) return e;\n }((n = (t = e).requestHeaders, I(n) || Q(Object.keys(null != n ? n : {}), function (e) {\n ni.includes(e.toLowerCase()) && (n[e] = ei);\n }), t)));\n var t, n;\n },\n f = y(e.session_recording.maskNetworkRequestFn);\n return f && y(e.session_recording.maskCapturedNetworkRequestFn) && G.warn(\"Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored.\"), f && (e.session_recording.maskCapturedNetworkRequestFn = function (n) {\n var i = e.session_recording.maskNetworkRequestFn({\n url: n.name\n });\n return t(t({}, n), {}, {\n name: null == i ? void 0 : i.url\n });\n }), o.maskRequestFn = y(e.session_recording.maskCapturedNetworkRequestFn) ? function (t) {\n var n,\n i,\n r,\n s = h(t);\n return s && null !== (n = null === (i = (r = e.session_recording).maskCapturedNetworkRequestFn) || void 0 === i ? void 0 : i.call(r, s)) && void 0 !== n ? n : void 0;\n } : function (e) {\n return function (e) {\n if (!w(e)) return e.requestBody = oi(e.requestBody, \"Request\"), e.responseBody = oi(e.responseBody, \"Response\"), e;\n }(h(e));\n }, t(t(t({}, ti), o), {}, {\n recordHeaders: a,\n recordBody: u,\n recordPerformance: c,\n recordInitialRequests: c\n });\n },\n li = s(function e(t) {\n var n,\n r,\n s = this,\n a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};\n i(this, e), o(this, \"bucketSize\", 100), o(this, \"refillRate\", 10), o(this, \"mutationBuckets\", {}), o(this, \"loggedTracker\", {}), o(this, \"refillBuckets\", function () {\n Object.keys(s.mutationBuckets).forEach(function (e) {\n s.mutationBuckets[e] = s.mutationBuckets[e] + s.refillRate, s.mutationBuckets[e] >= s.bucketSize && delete s.mutationBuckets[e];\n });\n }), o(this, \"getNodeOrRelevantParent\", function (e) {\n var t = s.rrweb.mirror.getNode(e);\n if (\"svg\" !== (null == t ? void 0 : t.nodeName) && t instanceof Element) {\n var n = t.closest(\"svg\");\n if (n) return [s.rrweb.mirror.getId(n), n];\n }\n return [e, t];\n }), o(this, \"numberOfChanges\", function (e) {\n var t, n, i, r, s, o, a, u;\n return (null !== (t = null === (n = e.removes) || void 0 === n ? void 0 : n.length) && void 0 !== t ? t : 0) + (null !== (i = null === (r = e.attributes) || void 0 === r ? void 0 : r.length) && void 0 !== i ? i : 0) + (null !== (s = null === (o = e.texts) || void 0 === o ? void 0 : o.length) && void 0 !== s ? s : 0) + (null !== (a = null === (u = e.adds) || void 0 === u ? void 0 : u.length) && void 0 !== a ? a : 0);\n }), o(this, \"throttleMutations\", function (e) {\n if (3 !== e.type || 0 !== e.data.source) return e;\n var t = e.data,\n n = s.numberOfChanges(t);\n t.attributes && (t.attributes = t.attributes.filter(function (e) {\n var t,\n n,\n i,\n r = u(s.getNodeOrRelevantParent(e.id), 2),\n o = r[0],\n a = r[1];\n if (0 === s.mutationBuckets[o]) return !1;\n (s.mutationBuckets[o] = null !== (t = s.mutationBuckets[o]) && void 0 !== t ? t : s.bucketSize, s.mutationBuckets[o] = Math.max(s.mutationBuckets[o] - 1, 0), 0 === s.mutationBuckets[o]) && (s.loggedTracker[o] || (s.loggedTracker[o] = !0, null === (n = (i = s.options).onBlockedNode) || void 0 === n || n.call(i, o, a)));\n return e;\n }));\n var i = s.numberOfChanges(t);\n return 0 !== i || n === i ? e : void 0;\n }), this.rrweb = t, this.options = a, this.refillRate = null !== (n = this.options.refillRate) && void 0 !== n ? n : this.refillRate, this.bucketSize = null !== (r = this.options.bucketSize) && void 0 !== r ? r : this.bucketSize, setInterval(function () {\n s.refillBuckets();\n }, 1e3);\n }),\n ci = 3e5,\n di = [In.MouseMove, In.MouseInteraction, In.Scroll, In.ViewportResize, In.Input, In.TouchMove, In.MediaInteraction, In.Drag],\n hi = function (e) {\n return {\n rrwebMethod: e,\n enqueuedAt: Date.now(),\n attempt: 1\n };\n },\n fi = \"[SessionRecording]\",\n vi = function () {\n function e(t) {\n var n = this;\n if (i(this, e), o(this, \"queuedRRWebEvents\", []), o(this, \"isIdle\", !1), o(this, \"_linkedFlagSeen\", !1), o(this, \"_lastActivityTimestamp\", Date.now()), o(this, \"_linkedFlag\", null), o(this, \"_forceAllowLocalhostNetworkCapture\", !1), o(this, \"_samplingSessionListener\", null), this.instance = t, this._captureStarted = !1, this._endpoint = \"/s/\", this.stopRrweb = void 0, this.receivedDecide = !1, null == T || T.addEventListener(\"beforeunload\", function () {\n n._flushBuffer();\n }), null == T || T.addEventListener(\"offline\", function () {\n n._tryAddCustomEvent(\"browser offline\", {});\n }), null == T || T.addEventListener(\"online\", function () {\n n._tryAddCustomEvent(\"browser online\", {});\n }), null == T || T.addEventListener(\"visibilitychange\", function () {\n if (null != D && D.visibilityState) {\n var e = \"window \" + D.visibilityState;\n n._tryAddCustomEvent(e, {});\n }\n }), !this.instance.sessionManager) throw G.error(fi + \" started without valid sessionManager\"), new Error(fi + \" started without valid sessionManager. This is a bug.\");\n var r = this.sessionManager.checkAndGetSessionAndWindowId(),\n s = r.sessionId,\n a = r.windowId;\n this.sessionId = s, this.windowId = a, this.buffer = this.clearBuffer(), this._setupSampling();\n }\n return s(e, [{\n key: \"rrwebRecord\",\n get: function () {\n var e;\n return null == U || null === (e = U.rrweb) || void 0 === e ? void 0 : e.record;\n }\n }, {\n key: \"started\",\n get: function () {\n return this._captureStarted;\n }\n }, {\n key: \"sessionManager\",\n get: function () {\n if (!this.instance.sessionManager) throw new Error(fi + \" must be started with a valid sessionManager.\");\n return this.instance.sessionManager;\n }\n }, {\n key: \"fullSnapshotIntervalMillis\",\n get: function () {\n var e;\n return (null === (e = this.instance.config.session_recording) || void 0 === e ? void 0 : e.full_snapshot_interval_millis) || ci;\n }\n }, {\n key: \"isSampled\",\n get: function () {\n var e = this.instance.get_property(Ee);\n return x(e) ? e : null;\n }\n }, {\n key: \"sessionDuration\",\n get: function () {\n var e,\n t,\n n = null === (e = this.buffer) || void 0 === e ? void 0 : e.data[(null === (t = this.buffer) || void 0 === t ? void 0 : t.data.length) - 1],\n i = this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;\n return n ? n.timestamp - i : null;\n }\n }, {\n key: \"isRecordingEnabled\",\n get: function () {\n var e = !!this.instance.get_property(_e),\n t = !this.instance.config.disable_session_recording;\n return T && e && t;\n }\n }, {\n key: \"isConsoleLogCaptureEnabled\",\n get: function () {\n var e = !!this.instance.get_property(me),\n t = this.instance.config.enable_recording_console_log;\n return null != t ? t : e;\n }\n }, {\n key: \"canvasRecording\",\n get: function () {\n var e = this.instance.get_property(be);\n return e && e.fps && e.quality ? {\n enabled: e.enabled,\n fps: e.fps,\n quality: e.quality\n } : void 0;\n }\n }, {\n key: \"networkPayloadCapture\",\n get: function () {\n var e,\n t,\n n = this.instance.get_property(ye),\n i = {\n recordHeaders: null === (e = this.instance.config.session_recording) || void 0 === e ? void 0 : e.recordHeaders,\n recordBody: null === (t = this.instance.config.session_recording) || void 0 === t ? void 0 : t.recordBody\n },\n r = (null == i ? void 0 : i.recordHeaders) || (null == n ? void 0 : n.recordHeaders),\n s = (null == i ? void 0 : i.recordBody) || (null == n ? void 0 : n.recordBody),\n o = b(this.instance.config.capture_performance) ? this.instance.config.capture_performance.network_timing : this.instance.config.capture_performance,\n a = !!(x(o) ? o : null == n ? void 0 : n.capturePerformance);\n return r || s || a ? {\n recordHeaders: r,\n recordBody: s,\n recordPerformance: a\n } : void 0;\n }\n }, {\n key: \"sampleRate\",\n get: function () {\n var e = this.instance.get_property(ke);\n return F(e) ? e : null;\n }\n }, {\n key: \"minimumDuration\",\n get: function () {\n var e = this.instance.get_property(we);\n return F(e) ? e : null;\n }\n }, {\n key: \"status\",\n get: function () {\n return this.receivedDecide ? this.isRecordingEnabled ? I(this._linkedFlag) || this._linkedFlagSeen ? x(this.isSampled) ? this.isSampled ? \"sampled\" : \"disabled\" : \"active\" : \"buffering\" : \"disabled\" : \"buffering\";\n }\n }, {\n key: \"startIfEnabledOrStop\",\n value: function () {\n this.isRecordingEnabled ? (this._startCapture(), G.info(fi + \" started\")) : (this.stopRecording(), this.clearBuffer());\n }\n }, {\n key: \"stopRecording\",\n value: function () {\n this._captureStarted && this.stopRrweb && (this.stopRrweb(), this.stopRrweb = void 0, this._captureStarted = !1, G.info(fi + \" stopped\"));\n }\n }, {\n key: \"makeSamplingDecision\",\n value: function (e) {\n var t,\n n = this.sessionId !== e,\n i = this.sampleRate;\n if (F(i)) {\n var r,\n s = this.isSampled,\n a = n || !x(s);\n if (a) r = Math.random() < i;else r = s;\n !r && a && G.warn(fi + \" Sample rate (\".concat(i, \") has determined that this sessionId (\").concat(e, \") will not be sent to the server.\")), this._tryAddCustomEvent(\"samplingDecisionMade\", {\n sampleRate: i\n }), null === (t = this.instance.persistence) || void 0 === t || t.register(o({}, Ee, r));\n } else {\n var u;\n null === (u = this.instance.persistence) || void 0 === u || u.register(o({}, Ee, null));\n }\n }\n }, {\n key: \"afterDecideResponse\",\n value: function (e) {\n var t,\n n,\n i,\n r = this;\n (this._persistDecideResponse(e), this._linkedFlag = (null === (t = e.sessionRecording) || void 0 === t ? void 0 : t.linkedFlag) || null, null !== (n = e.sessionRecording) && void 0 !== n && n.endpoint) && (this._endpoint = null === (i = e.sessionRecording) || void 0 === i ? void 0 : i.endpoint);\n if (this._setupSampling(), !I(this._linkedFlag)) {\n var s = S(this._linkedFlag) ? this._linkedFlag : this._linkedFlag.flag,\n o = S(this._linkedFlag) ? null : this._linkedFlag.variant;\n this.instance.onFeatureFlags(function (e, t) {\n var n = b(t) && s in t,\n i = o ? t[s] === o : n;\n if (i) {\n var a = {\n linkedFlag: s,\n linkedVariant: o\n },\n u = \"linked flag matched\";\n G.info(fi + \" \" + u, a), r._tryAddCustomEvent(u, a);\n }\n r._linkedFlagSeen = i;\n });\n }\n this.receivedDecide = !0, this.startIfEnabledOrStop();\n }\n }, {\n key: \"_setupSampling\",\n value: function () {\n var e = this;\n F(this.sampleRate) && R(this._samplingSessionListener) && (this._samplingSessionListener = this.sessionManager.onSessionId(function (t) {\n e.makeSamplingDecision(t);\n }));\n }\n }, {\n key: \"_persistDecideResponse\",\n value: function (e) {\n if (this.instance.persistence) {\n var n = this.instance.persistence,\n i = function () {\n var i,\n r,\n s,\n a,\n u,\n l,\n c,\n d,\n h = null === (i = e.sessionRecording) || void 0 === i ? void 0 : i.sampleRate,\n f = I(h) ? null : parseFloat(h),\n v = null === (r = e.sessionRecording) || void 0 === r ? void 0 : r.minimumDurationMilliseconds;\n n.register((o(d = {}, _e, !!e.sessionRecording), o(d, me, null === (s = e.sessionRecording) || void 0 === s ? void 0 : s.consoleLogRecordingEnabled), o(d, ye, t({\n capturePerformance: e.capturePerformance\n }, null === (a = e.sessionRecording) || void 0 === a ? void 0 : a.networkPayloadCapture)), o(d, be, {\n enabled: null === (u = e.sessionRecording) || void 0 === u ? void 0 : u.recordCanvas,\n fps: null === (l = e.sessionRecording) || void 0 === l ? void 0 : l.canvasFps,\n quality: null === (c = e.sessionRecording) || void 0 === c ? void 0 : c.canvasQuality\n }), o(d, ke, f), o(d, we, w(v) ? null : v), d));\n };\n i(), this.sessionManager.onSessionId(i);\n }\n }\n }, {\n key: \"log\",\n value: function (e) {\n var t,\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : \"log\";\n null === (t = this.instance.sessionRecording) || void 0 === t || t.onRRwebEmit({\n type: 6,\n data: {\n plugin: \"rrweb/console@1\",\n payload: {\n level: n,\n trace: [],\n payload: [JSON.stringify(e)]\n }\n },\n timestamp: K()\n });\n }\n }, {\n key: \"_startCapture\",\n value: function () {\n var e = this;\n w(Object.assign) || this._captureStarted || this.instance.config.disable_session_recording || this.instance.consent.isOptedOut() || (this._captureStarted = !0, this.sessionManager.checkAndGetSessionAndWindowId(), this.rrwebRecord ? this._onScriptLoaded() : this.instance.requestRouter.loadScript(\"/static/recorder.js?v=\".concat(f.LIB_VERSION), function (t) {\n if (t) return G.error(fi + \" could not load recorder.js\", t);\n e._onScriptLoaded();\n }));\n }\n }, {\n key: \"isInteractiveEvent\",\n value: function (e) {\n var t;\n return 3 === e.type && -1 !== di.indexOf(null === (t = e.data) || void 0 === t ? void 0 : t.source);\n }\n }, {\n key: \"_updateWindowAndSessionIds\",\n value: function (e) {\n var t = this.isInteractiveEvent(e);\n t || this.isIdle || e.timestamp - this._lastActivityTimestamp > 3e5 && (this.isIdle = !0, clearTimeout(this._fullSnapshotTimer), this._flushBuffer());\n var n = !1;\n if (t && (this._lastActivityTimestamp = e.timestamp, this.isIdle && (this.isIdle = !1, this._tryAddCustomEvent(\"sessionNoLongerIdle\", {\n reason: \"user activity\",\n type: e.type\n }), n = !0)), !this.isIdle) {\n var i = this.sessionManager.checkAndGetSessionAndWindowId(!t, e.timestamp),\n r = i.windowId,\n s = i.sessionId,\n o = this.sessionId !== s,\n a = this.windowId !== r;\n this.windowId = r, this.sessionId = s, (n || -1 === [wn, Sn].indexOf(e.type) && (a || o || w(this._fullSnapshotTimer))) && this._tryTakeFullSnapshot();\n }\n }\n }, {\n key: \"_tryRRWebMethod\",\n value: function (e) {\n try {\n return e.rrwebMethod(), !0;\n } catch (t) {\n return this.queuedRRWebEvents.length < 10 ? this.queuedRRWebEvents.push({\n enqueuedAt: e.enqueuedAt || Date.now(),\n attempt: e.attempt++,\n rrwebMethod: e.rrwebMethod\n }) : G.warn(fi + \" could not emit queued rrweb event.\", t, e), !1;\n }\n }\n }, {\n key: \"_tryAddCustomEvent\",\n value: function (e, t) {\n var n = this;\n return this._tryRRWebMethod(hi(function () {\n return n.rrwebRecord.addCustomEvent(e, t);\n }));\n }\n }, {\n key: \"_tryTakeFullSnapshot\",\n value: function () {\n var e = this;\n return this._tryRRWebMethod(hi(function () {\n return e.rrwebRecord.takeFullSnapshot();\n }));\n }\n }, {\n key: \"_onScriptLoaded\",\n value: function () {\n for (var e, n = this, i = {\n blockClass: \"ph-no-capture\",\n blockSelector: void 0,\n ignoreClass: \"ph-ignore-input\",\n maskTextClass: \"ph-mask\",\n maskTextSelector: void 0,\n maskTextFn: void 0,\n maskAllInputs: !0,\n maskInputOptions: {\n password: !0\n },\n maskInputFn: void 0,\n slimDOMOptions: {},\n collectFonts: !1,\n inlineStylesheet: !0,\n recordCrossOriginIframes: !1\n }, r = this.instance.config.session_recording, s = 0, o = Object.entries(r || {}); s < o.length; s++) {\n var a = u(o[s], 2),\n l = a[0],\n c = a[1];\n l in i && (i[l] = c);\n }\n if (this.canvasRecording && this.canvasRecording.enabled && (i.recordCanvas = !0, i.sampling = {\n canvas: this.canvasRecording.fps\n }, i.dataURLOptions = {\n type: \"image/webp\",\n quality: this.canvasRecording.quality\n }), this.rrwebRecord) {\n this.mutationRateLimiter = null !== (e = this.mutationRateLimiter) && void 0 !== e ? e : new li(this.rrwebRecord, {\n onBlockedNode: function (e, t) {\n var i = \"Too many mutations on node '\".concat(e, \"'. Rate limiting. This could be due to SVG animations or something similar\");\n G.info(i, {\n node: t\n }), n.log(fi + \" \" + i, \"warn\");\n }\n });\n var d = this._gatherRRWebPlugins();\n this.stopRrweb = this.rrwebRecord(t({\n emit: function (e) {\n n.onRRwebEmit(e);\n },\n plugins: d\n }, i)), this.instance._addCaptureHook(function (e) {\n try {\n if (\"$pageview\" === e) {\n var t = T ? n._maskUrl(T.location.href) : \"\";\n if (!t) return;\n n._tryAddCustomEvent(\"$pageview\", {\n href: t\n });\n }\n } catch (e) {\n G.error(\"Could not add $pageview to rrweb session\", e);\n }\n }), this._lastActivityTimestamp = Date.now(), this.isIdle = !1, this._tryAddCustomEvent(\"$session_options\", {\n sessionRecordingOptions: i,\n activePlugins: d.map(function (e) {\n return null == e ? void 0 : e.name;\n })\n }), this._tryAddCustomEvent(\"$posthog_config\", {\n config: this.instance.config\n });\n } else G.error(fi + \"onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.\");\n }\n }, {\n key: \"_scheduleFullSnapshot\",\n value: function () {\n var e = this;\n if (this._fullSnapshotTimer && clearInterval(this._fullSnapshotTimer), !this.isIdle) {\n var t = this.fullSnapshotIntervalMillis;\n t && (this._fullSnapshotTimer = setInterval(function () {\n e._tryTakeFullSnapshot();\n }, t));\n }\n }\n }, {\n key: \"_gatherRRWebPlugins\",\n value: function () {\n var e = [];\n (U.rrwebConsoleRecord && this.isConsoleLogCaptureEnabled && e.push(U.rrwebConsoleRecord.getRecordConsolePlugin()), this.networkPayloadCapture && y(U.getRecordNetworkPlugin)) && (!vt.includes(location.hostname) || this._forceAllowLocalhostNetworkCapture ? e.push(U.getRecordNetworkPlugin(ui(this.instance.config, this.networkPayloadCapture))) : G.info(fi + \" NetworkCapture not started because we are on localhost.\"));\n return e;\n }\n }, {\n key: \"onRRwebEmit\",\n value: function (e) {\n if (this._processQueuedEvents(), e && b(e)) {\n if (e.type === Rn.Meta) {\n var t = this._maskUrl(e.data.href);\n if (this._lastHref = t, !t) return;\n e.data.href = t;\n } else this._pageViewFallBack();\n e.type === Rn.FullSnapshot && this._scheduleFullSnapshot();\n var n = this.mutationRateLimiter ? this.mutationRateLimiter.throttleMutations(e) : e;\n if (n) {\n var i = function (e) {\n var t = e;\n if (t && b(t) && 6 === t.type && b(t.data) && \"rrweb/console@1\" === t.data.plugin) {\n t.data.payload.payload.length > 10 && (t.data.payload.payload = t.data.payload.payload.slice(0, 10), t.data.payload.payload.push(\"...[truncated]\"));\n for (var n = [], i = 0; i < t.data.payload.payload.length; i++) t.data.payload.payload[i] && t.data.payload.payload[i].length > 2e3 ? n.push(t.data.payload.payload[i].slice(0, 2e3) + \"...[truncated]\") : n.push(t.data.payload.payload[i]);\n return t.data.payload.payload = n, e;\n }\n return e;\n }(n),\n r = kn(i);\n if (this._updateWindowAndSessionIds(i), !this.isIdle || i.type === Rn.Custom) {\n var s = {\n $snapshot_bytes: r,\n $snapshot_data: i,\n $session_id: this.sessionId,\n $window_id: this.windowId\n };\n \"disabled\" !== this.status ? this._captureSnapshotBuffered(s) : this.clearBuffer();\n }\n }\n }\n }\n }, {\n key: \"_pageViewFallBack\",\n value: function () {\n if (!this.instance.config.capture_pageview && T) {\n var e = this._maskUrl(T.location.href);\n this._lastHref !== e && (this._tryAddCustomEvent(\"$url_changed\", {\n href: e\n }), this._lastHref = e);\n }\n }\n }, {\n key: \"_processQueuedEvents\",\n value: function () {\n var e = this;\n if (this.queuedRRWebEvents.length) {\n var t = l(this.queuedRRWebEvents);\n this.queuedRRWebEvents = [], t.forEach(function (t) {\n Date.now() - t.enqueuedAt <= 2e3 && e._tryRRWebMethod(t);\n });\n }\n }\n }, {\n key: \"_maskUrl\",\n value: function (e) {\n var t = this.instance.config.session_recording;\n if (t.maskNetworkRequestFn) {\n var n,\n i = {\n url: e\n };\n return null === (n = i = t.maskNetworkRequestFn(i)) || void 0 === n ? void 0 : n.url;\n }\n return e;\n }\n }, {\n key: \"clearBuffer\",\n value: function () {\n return this.buffer = {\n size: 0,\n data: [],\n sessionId: this.sessionId,\n windowId: this.windowId\n }, this.buffer;\n }\n }, {\n key: \"_flushBuffer\",\n value: function () {\n var e = this;\n this.flushBufferTimer && (clearTimeout(this.flushBufferTimer), this.flushBufferTimer = void 0);\n var t = this.minimumDuration,\n n = this.sessionDuration,\n i = F(n) && n >= 0,\n r = F(t) && i && n < t;\n if (\"buffering\" === this.status || r) return this.flushBufferTimer = setTimeout(function () {\n e._flushBuffer();\n }, 2e3), this.buffer;\n this.buffer.data.length > 0 && En(this.buffer).forEach(function (t) {\n e._captureSnapshot({\n $snapshot_bytes: t.size,\n $snapshot_data: t.data,\n $session_id: t.sessionId,\n $window_id: t.windowId\n });\n });\n return this.clearBuffer();\n }\n }, {\n key: \"_captureSnapshotBuffered\",\n value: function (e) {\n var t,\n n = this,\n i = 2 + ((null === (t = this.buffer) || void 0 === t ? void 0 : t.data.length) || 0);\n (this.buffer.size + e.$snapshot_bytes + i > 943718.4 || this.buffer.sessionId !== this.sessionId) && (this.buffer = this._flushBuffer()), this.buffer.size += e.$snapshot_bytes, this.buffer.data.push(e.$snapshot_data), this.flushBufferTimer || (this.flushBufferTimer = setTimeout(function () {\n n._flushBuffer();\n }, 2e3));\n }\n }, {\n key: \"_captureSnapshot\",\n value: function (e) {\n this.instance.capture(\"$snapshot\", e, {\n _url: this.instance.requestRouter.endpointFor(\"api\", this._endpoint),\n _noTruncate: !0,\n _batchKey: \"recordings\"\n });\n }\n }]), e;\n }(),\n pi = function () {\n function e(t) {\n i(this, e), this.instance = t, this.instance.decideEndpointWasHit = this.instance._hasBootstrappedFeatureFlags();\n }\n return s(e, [{\n key: \"call\",\n value: function () {\n var e = this,\n t = {\n token: this.instance.config.token,\n distinct_id: this.instance.get_distinct_id(),\n groups: this.instance.getGroups(),\n person_properties: this.instance.get_property(Fe),\n group_properties: this.instance.get_property(xe),\n disable_flags: this.instance.config.advanced_disable_feature_flags || this.instance.config.advanced_disable_feature_flags_on_first_load || void 0\n };\n this.instance._send_request({\n method: \"POST\",\n url: this.instance.requestRouter.endpointFor(\"api\", \"/decide/?v=3\"),\n data: t,\n compression: this.instance.config.disable_compression ? void 0 : re.Base64,\n timeout: this.instance.config.feature_flag_request_timeout_ms,\n callback: function (t) {\n return e.parseDecideResponse(t.json);\n }\n });\n }\n }, {\n key: \"parseDecideResponse\",\n value: function (e) {\n var t = this;\n this.instance.featureFlags.setReloadingPaused(!1), this.instance.featureFlags._startReloadTimer();\n var n = !e;\n if (this.instance.config.advanced_disable_feature_flags_on_first_load || this.instance.config.advanced_disable_feature_flags || this.instance.featureFlags.receivedFeatureFlags(null != e ? e : {}, n), n) G.error(\"Failed to fetch feature flags from PostHog.\");else {\n if (!D || !D.body) return G.info(\"document not ready yet, trying again in 500 milliseconds...\"), void setTimeout(function () {\n t.parseDecideResponse(e);\n }, 500);\n if (this.instance._afterDecideResponse(e), e.siteApps) if (this.instance.config.opt_in_site_apps) {\n var i,\n r = h(e.siteApps);\n try {\n var s = function () {\n var e = i.value,\n n = e.id,\n r = e.url,\n s = t.instance.requestRouter.endpointFor(\"api\", r);\n U[\"__$$ph_site_app_\".concat(n)] = t.instance, t.instance.requestRouter.loadScript(s, function (e) {\n if (e) return G.error(\"Error while initializing PostHog app with config id \".concat(n), e);\n });\n };\n for (r.s(); !(i = r.n()).done;) s();\n } catch (e) {\n r.e(e);\n } finally {\n r.f();\n }\n } else e.siteApps.length > 0 && G.error('PostHog site apps are disabled. Enable the \"opt_in_site_apps\" config to proceed.');\n }\n }\n }]), e;\n }(),\n gi = null != T && T.location ? yt(T.location.hash, \"__posthog\") || yt(location.hash, \"state\") : null,\n _i = \"_postHogToolbarParams\";\n!function (e) {\n e[e.UNINITIALIZED = 0] = \"UNINITIALIZED\", e[e.LOADING = 1] = \"LOADING\", e[e.LOADED = 2] = \"LOADED\";\n}(ai || (ai = {}));\nvar mi = function () {\n function e(t) {\n i(this, e), this.instance = t;\n }\n return s(e, [{\n key: \"setToolbarState\",\n value: function (e) {\n U.ph_toolbar_state = e;\n }\n }, {\n key: \"getToolbarState\",\n value: function () {\n var e;\n return null !== (e = U.ph_toolbar_state) && void 0 !== e ? e : ai.UNINITIALIZED;\n }\n }, {\n key: \"maybeLoadToolbar\",\n value: function () {\n var e,\n t,\n n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0,\n i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0,\n r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;\n if (!T || !D) return !1;\n n = null !== (e = n) && void 0 !== e ? e : T.location, r = null !== (t = r) && void 0 !== t ? t : T.history;\n try {\n if (!i) {\n try {\n T.localStorage.setItem(\"test\", \"test\"), T.localStorage.removeItem(\"test\");\n } catch (e) {\n return !1;\n }\n i = null == T ? void 0 : T.localStorage;\n }\n var s,\n o = gi || yt(n.hash, \"__posthog\") || yt(n.hash, \"state\"),\n a = o ? Z(function () {\n return JSON.parse(atob(decodeURIComponent(o)));\n }) || Z(function () {\n return JSON.parse(decodeURIComponent(o));\n }) : null;\n return a && \"ph_authorize\" === a.action ? ((s = a).source = \"url\", s && Object.keys(s).length > 0 && (a.desiredHash ? n.hash = a.desiredHash : r ? r.replaceState(r.state, \"\", n.pathname + n.search) : n.hash = \"\")) : ((s = JSON.parse(i.getItem(_i) || \"{}\")).source = \"localstorage\", delete s.userIntent), !(!s.token || this.instance.config.token !== s.token) && (this.loadToolbar(s), !0);\n } catch (e) {\n return !1;\n }\n }\n }, {\n key: \"_callLoadToolbar\",\n value: function (e) {\n (U.ph_load_toolbar || U.ph_load_editor)(e, this.instance);\n }\n }, {\n key: \"loadToolbar\",\n value: function (e) {\n var n = this,\n i = !(null == D || !D.getElementById(Ne));\n if (!T || i) return !1;\n var r = \"custom\" === this.instance.requestRouter.region && this.instance.config.advanced_disable_toolbar_metrics,\n s = t(t({\n token: this.instance.config.token\n }, e), {}, {\n apiURL: this.instance.requestRouter.endpointFor(\"ui\")\n }, r ? {\n instrument: !1\n } : {});\n if (T.localStorage.setItem(_i, JSON.stringify(t(t({}, s), {}, {\n source: void 0\n }))), this.getToolbarState() === ai.LOADED) this._callLoadToolbar(s);else if (this.getToolbarState() === ai.UNINITIALIZED) {\n this.setToolbarState(ai.LOADING);\n var o = 3e5,\n a = Math.floor(Date.now() / o) * o;\n this.instance.requestRouter.loadScript(\"/static/toolbar.js?t=\".concat(a), function (e) {\n if (e) return G.error(\"Failed to load toolbar\", e), void n.setToolbarState(ai.UNINITIALIZED);\n n.setToolbarState(ai.LOADED), n._callLoadToolbar(s);\n }), oe(T, \"turbolinks:load\", function () {\n n.setToolbarState(ai.UNINITIALIZED), n.loadToolbar(s);\n });\n }\n return !0;\n }\n }, {\n key: \"_loadEditor\",\n value: function (e) {\n return this.loadToolbar(e);\n }\n }, {\n key: \"maybeLoadEditor\",\n value: function () {\n var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : void 0,\n t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0,\n n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : void 0;\n return this.maybeLoadToolbar(e, t, n);\n }\n }]), e;\n }(),\n yi = function () {\n function e(t) {\n i(this, e), o(this, \"isPaused\", !0), o(this, \"queue\", []), o(this, \"flushTimeoutMs\", 3e3), this.sendRequest = t;\n }\n return s(e, [{\n key: \"enqueue\",\n value: function (e) {\n this.queue.push(e), this.flushTimeout || this.setFlushTimeout();\n }\n }, {\n key: \"unload\",\n value: function () {\n var e = this;\n this.clearFlushTimeout();\n var n = this.queue.length > 0 ? this.formatQueue() : {},\n i = Object.values(n);\n [].concat(l(i.filter(function (e) {\n return 0 === e.url.indexOf(\"/e\");\n })), l(i.filter(function (e) {\n return 0 !== e.url.indexOf(\"/e\");\n }))).map(function (n) {\n e.sendRequest(t(t({}, n), {}, {\n transport: \"sendBeacon\"\n }));\n });\n }\n }, {\n key: \"enable\",\n value: function () {\n this.isPaused = !1, this.setFlushTimeout();\n }\n }, {\n key: \"setFlushTimeout\",\n value: function () {\n var e = this;\n this.isPaused || (this.flushTimeout = setTimeout(function () {\n if (e.clearFlushTimeout(), e.queue.length > 0) {\n var t = e.formatQueue(),\n n = function (n) {\n var i = t[n],\n r = new Date().getTime();\n i.data && m(i.data) && Q(i.data, function (e) {\n e.offset = Math.abs(e.timestamp - r), delete e.timestamp;\n }), e.sendRequest(i);\n };\n for (var i in t) n(i);\n }\n }, this.flushTimeoutMs));\n }\n }, {\n key: \"clearFlushTimeout\",\n value: function () {\n clearTimeout(this.flushTimeout), this.flushTimeout = void 0;\n }\n }, {\n key: \"formatQueue\",\n value: function () {\n var e = {};\n return Q(this.queue, function (n) {\n var i,\n r = n,\n s = (r ? r.batchKey : null) || r.url;\n w(e[s]) && (e[s] = t(t({}, r), {}, {\n data: []\n })), null === (i = e[s].data) || void 0 === i || i.push(r.data);\n }), this.queue = [], e;\n }\n }]), e;\n }(),\n bi = Uint8Array,\n ki = Uint16Array,\n wi = Uint32Array,\n Si = new bi([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]),\n Ei = new bi([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]),\n Ri = new bi([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]),\n Ii = function (e, t) {\n for (var n = new ki(31), i = 0; i < 31; ++i) n[i] = t += 1 << e[i - 1];\n var r = new wi(n[30]);\n for (i = 1; i < 30; ++i) for (var s = n[i]; s < n[i + 1]; ++s) r[s] = s - n[i] << 5 | i;\n return [n, r];\n },\n Fi = Ii(Si, 2),\n xi = Fi[0],\n Pi = Fi[1];\nxi[28] = 258, Pi[258] = 28;\nfor (var Ti = Ii(Ei, 0)[1], Ci = new ki(32768), $i = 0; $i < 32768; ++$i) {\n var Oi = (43690 & $i) >>> 1 | (21845 & $i) << 1;\n Oi = (61680 & (Oi = (52428 & Oi) >>> 2 | (13107 & Oi) << 2)) >>> 4 | (3855 & Oi) << 4, Ci[$i] = ((65280 & Oi) >>> 8 | (255 & Oi) << 8) >>> 1;\n}\nvar Mi = function (e, t, n) {\n for (var i = e.length, r = 0, s = new ki(t); r < i; ++r) ++s[e[r] - 1];\n var o,\n a = new ki(t);\n for (r = 0; r < t; ++r) a[r] = a[r - 1] + s[r - 1] << 1;\n if (n) {\n o = new ki(1 << t);\n var u = 15 - t;\n for (r = 0; r < i; ++r) if (e[r]) for (var l = r << 4 | e[r], c = t - e[r], d = a[e[r] - 1]++ << c, h = d | (1 << c) - 1; d <= h; ++d) o[Ci[d] >>> u] = l;\n } else for (o = new ki(i), r = 0; r < i; ++r) o[r] = Ci[a[e[r] - 1]++] >>> 15 - e[r];\n return o;\n },\n Ai = new bi(288);\nfor ($i = 0; $i < 144; ++$i) Ai[$i] = 8;\nfor ($i = 144; $i < 256; ++$i) Ai[$i] = 9;\nfor ($i = 256; $i < 280; ++$i) Ai[$i] = 7;\nfor ($i = 280; $i < 288; ++$i) Ai[$i] = 8;\nvar Di = new bi(32);\nfor ($i = 0; $i < 32; ++$i) Di[$i] = 5;\nvar Li = Mi(Ai, 9, 0),\n qi = Mi(Di, 5, 0),\n Ni = function (e) {\n return (e / 8 >> 0) + (7 & e && 1);\n },\n Bi = function (e, t, n) {\n (null == t || t < 0) && (t = 0), (null == n || n > e.length) && (n = e.length);\n var i = new (e instanceof ki ? ki : e instanceof wi ? wi : bi)(n - t);\n return i.set(e.subarray(t, n)), i;\n },\n Hi = function (e, t, n) {\n n <<= 7 & t;\n var i = t / 8 >> 0;\n e[i] |= n, e[i + 1] |= n >>> 8;\n },\n Ui = function (e, t, n) {\n n <<= 7 & t;\n var i = t / 8 >> 0;\n e[i] |= n, e[i + 1] |= n >>> 8, e[i + 2] |= n >>> 16;\n },\n ji = function (e, t) {\n for (var n = [], i = 0; i < e.length; ++i) e[i] && n.push({\n s: i,\n f: e[i]\n });\n var r = n.length,\n s = n.slice();\n if (!r) return [new bi(0), 0];\n if (1 == r) {\n var o = new bi(n[0].s + 1);\n return o[n[0].s] = 1, [o, 1];\n }\n n.sort(function (e, t) {\n return e.f - t.f;\n }), n.push({\n s: -1,\n f: 25001\n });\n var a = n[0],\n u = n[1],\n l = 0,\n c = 1,\n d = 2;\n for (n[0] = {\n s: -1,\n f: a.f + u.f,\n l: a,\n r: u\n }; c != r - 1;) a = n[n[l].f < n[d].f ? l++ : d++], u = n[l != c && n[l].f < n[d].f ? l++ : d++], n[c++] = {\n s: -1,\n f: a.f + u.f,\n l: a,\n r: u\n };\n var h = s[0].s;\n for (i = 1; i < r; ++i) s[i].s > h && (h = s[i].s);\n var f = new ki(h + 1),\n v = Gi(n[c - 1], f, 0);\n if (v > t) {\n i = 0;\n var p = 0,\n g = v - t,\n _ = 1 << g;\n for (s.sort(function (e, t) {\n return f[t.s] - f[e.s] || e.f - t.f;\n }); i < r; ++i) {\n var m = s[i].s;\n if (!(f[m] > t)) break;\n p += _ - (1 << v - f[m]), f[m] = t;\n }\n for (p >>>= g; p > 0;) {\n var y = s[i].s;\n f[y] < t ? p -= 1 << t - f[y]++ - 1 : ++i;\n }\n for (; i >= 0 && p; --i) {\n var b = s[i].s;\n f[b] == t && (--f[b], ++p);\n }\n v = t;\n }\n return [new bi(f), v];\n },\n Gi = function e(t, n, i) {\n return -1 == t.s ? Math.max(e(t.l, n, i + 1), e(t.r, n, i + 1)) : n[t.s] = i;\n },\n Wi = function (e) {\n for (var t = e.length; t && !e[--t];);\n for (var n = new ki(++t), i = 0, r = e[0], s = 1, o = function (e) {\n n[i++] = e;\n }, a = 1; a <= t; ++a) if (e[a] == r && a != t) ++s;else {\n if (!r && s > 2) {\n for (; s > 138; s -= 138) o(32754);\n s > 2 && (o(s > 10 ? s - 11 << 5 | 28690 : s - 3 << 5 | 12305), s = 0);\n } else if (s > 3) {\n for (o(r), --s; s > 6; s -= 6) o(8304);\n s > 2 && (o(s - 3 << 5 | 8208), s = 0);\n }\n for (; s--;) o(r);\n s = 1, r = e[a];\n }\n return [n.subarray(0, i), t];\n },\n zi = function (e, t) {\n for (var n = 0, i = 0; i < t.length; ++i) n += e[i] * t[i];\n return n;\n },\n Vi = function (e, t, n) {\n var i = n.length,\n r = Ni(t + 2);\n e[r] = 255 & i, e[r + 1] = i >>> 8, e[r + 2] = 255 ^ e[r], e[r + 3] = 255 ^ e[r + 1];\n for (var s = 0; s < i; ++s) e[r + s + 4] = n[s];\n return 8 * (r + 4 + i);\n },\n Qi = function (e, t, n, i, r, s, o, a, u, l, c) {\n Hi(t, c++, n), ++r[256];\n for (var d = ji(r, 15), h = d[0], f = d[1], v = ji(s, 15), p = v[0], g = v[1], _ = Wi(h), m = _[0], y = _[1], b = Wi(p), k = b[0], w = b[1], S = new ki(19), E = 0; E < m.length; ++E) S[31 & m[E]]++;\n for (E = 0; E < k.length; ++E) S[31 & k[E]]++;\n for (var R = ji(S, 7), I = R[0], F = R[1], x = 19; x > 4 && !I[Ri[x - 1]]; --x);\n var P,\n T,\n C,\n $,\n O = l + 5 << 3,\n M = zi(r, Ai) + zi(s, Di) + o,\n A = zi(r, h) + zi(s, p) + o + 14 + 3 * x + zi(S, I) + (2 * S[16] + 3 * S[17] + 7 * S[18]);\n if (O <= M && O <= A) return Vi(t, c, e.subarray(u, u + l));\n if (Hi(t, c, 1 + (A < M)), c += 2, A < M) {\n P = Mi(h, f, 0), T = h, C = Mi(p, g, 0), $ = p;\n var D = Mi(I, F, 0);\n Hi(t, c, y - 257), Hi(t, c + 5, w - 1), Hi(t, c + 10, x - 4), c += 14;\n for (E = 0; E < x; ++E) Hi(t, c + 3 * E, I[Ri[E]]);\n c += 3 * x;\n for (var L = [m, k], q = 0; q < 2; ++q) {\n var N = L[q];\n for (E = 0; E < N.length; ++E) {\n var B = 31 & N[E];\n Hi(t, c, D[B]), c += I[B], B > 15 && (Hi(t, c, N[E] >>> 5 & 127), c += N[E] >>> 12);\n }\n }\n } else P = Li, T = Ai, C = qi, $ = Di;\n for (E = 0; E < a; ++E) if (i[E] > 255) {\n B = i[E] >>> 18 & 31;\n Ui(t, c, P[B + 257]), c += T[B + 257], B > 7 && (Hi(t, c, i[E] >>> 23 & 31), c += Si[B]);\n var H = 31 & i[E];\n Ui(t, c, C[H]), c += $[H], H > 3 && (Ui(t, c, i[E] >>> 5 & 8191), c += Ei[H]);\n } else Ui(t, c, P[i[E]]), c += T[i[E]];\n return Ui(t, c, P[256]), c + T[256];\n },\n Ji = new wi([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]),\n Yi = new bi(0),\n Xi = function () {\n for (var e = new wi(256), t = 0; t < 256; ++t) {\n for (var n = t, i = 9; --i;) n = (1 & n && 3988292384) ^ n >>> 1;\n e[t] = n;\n }\n return e;\n }(),\n Ki = function (e, t, n, i, r) {\n return function (e, t, n, i, r, s) {\n var o = e.length,\n a = new bi(i + o + 5 * (1 + Math.floor(o / 7e3)) + r),\n u = a.subarray(i, a.length - r),\n l = 0;\n if (!t || o < 8) for (var c = 0; c <= o; c += 65535) {\n var d = c + 65535;\n d < o ? l = Vi(u, l, e.subarray(c, d)) : (u[c] = s, l = Vi(u, l, e.subarray(c, o)));\n } else {\n for (var h = Ji[t - 1], f = h >>> 13, v = 8191 & h, p = (1 << n) - 1, g = new ki(32768), _ = new ki(p + 1), m = Math.ceil(n / 3), y = 2 * m, b = function (t) {\n return (e[t] ^ e[t + 1] << m ^ e[t + 2] << y) & p;\n }, k = new wi(25e3), w = new ki(288), S = new ki(32), E = 0, R = 0, I = (c = 0, 0), F = 0, x = 0; c < o; ++c) {\n var P = b(c),\n T = 32767 & c,\n C = _[P];\n if (g[T] = C, _[P] = T, F <= c) {\n var $ = o - c;\n if ((E > 7e3 || I > 24576) && $ > 423) {\n l = Qi(e, u, 0, k, w, S, R, I, x, c - x, l), I = E = R = 0, x = c;\n for (var O = 0; O < 286; ++O) w[O] = 0;\n for (O = 0; O < 30; ++O) S[O] = 0;\n }\n var M = 2,\n A = 0,\n D = v,\n L = T - C & 32767;\n if ($ > 2 && P == b(c - L)) for (var q = Math.min(f, $) - 1, N = Math.min(32767, c), B = Math.min(258, $); L <= N && --D && T != C;) {\n if (e[c + M] == e[c + M - L]) {\n for (var H = 0; H < B && e[c + H] == e[c + H - L]; ++H);\n if (H > M) {\n if (M = H, A = L, H > q) break;\n var U = Math.min(L, H - 2),\n j = 0;\n for (O = 0; O < U; ++O) {\n var G = c - L + O + 32768 & 32767,\n W = G - g[G] + 32768 & 32767;\n W > j && (j = W, C = G);\n }\n }\n }\n L += (T = C) - (C = g[T]) + 32768 & 32767;\n }\n if (A) {\n k[I++] = 268435456 | Pi[M] << 18 | Ti[A];\n var z = 31 & Pi[M],\n V = 31 & Ti[A];\n R += Si[z] + Ei[V], ++w[257 + z], ++S[V], F = c + M, ++E;\n } else k[I++] = e[c], ++w[e[c]];\n }\n }\n l = Qi(e, u, s, k, w, S, R, I, x, c - x, l), s || (l = Vi(u, l, Yi));\n }\n return Bi(a, 0, i + Ni(l) + r);\n }(e, null == t.level ? 6 : t.level, null == t.mem ? Math.ceil(1.5 * Math.max(8, Math.min(13, Math.log(e.length)))) : 12 + t.mem, n, i, !r);\n },\n Zi = function (e, t, n) {\n for (; n; ++t) e[t] = n, n >>>= 8;\n };\nfunction er(e, t) {\n void 0 === t && (t = {});\n var n = function () {\n var e = 4294967295;\n return {\n p: function (t) {\n for (var n = e, i = 0; i < t.length; ++i) n = Xi[255 & n ^ t[i]] ^ n >>> 8;\n e = n;\n },\n d: function () {\n return 4294967295 ^ e;\n }\n };\n }(),\n i = e.length;\n n.p(e);\n var r,\n s = Ki(e, t, 10 + ((r = t).filename && r.filename.length + 1 || 0), 8),\n o = s.length;\n return function (e, t) {\n var n = t.filename;\n if (e[0] = 31, e[1] = 139, e[2] = 8, e[8] = t.level < 2 ? 4 : 9 == t.level ? 2 : 0, e[9] = 3, 0 != t.mtime && Zi(e, 4, Math.floor(new Date(t.mtime || Date.now()) / 1e3)), n) {\n e[3] = 8;\n for (var i = 0; i <= n.length; ++i) e[i + 10] = n.charCodeAt(i);\n }\n }(s, t), Zi(s, o - 8, n.d()), Zi(s, o - 4, i), s;\n}\nvar tr = !!N || !!q,\n nr = \"text/plain\",\n ir = function (e, n) {\n var i = u(e.split(\"?\"), 2),\n r = i[0],\n s = i[1],\n o = t({}, n);\n null == s || s.split(\"&\").forEach(function (e) {\n var t = u(e.split(\"=\"), 1)[0];\n delete o[t];\n });\n var a = _t(o);\n return a = a ? (s ? s + \"&\" : \"\") + a : s, \"\".concat(r, \"?\").concat(a);\n },\n rr = function (e) {\n return \"data=\" + encodeURIComponent(\"string\" == typeof e ? e : JSON.stringify(e));\n },\n sr = function (e) {\n var t = e.data,\n n = e.compression;\n if (t) {\n if (n === re.GZipJS) {\n var i = er(function (e, t) {\n var n = e.length;\n if (!t && \"undefined\" != typeof TextEncoder) return new TextEncoder().encode(e);\n for (var i = new bi(e.length + (e.length >>> 1)), r = 0, s = function (e) {\n i[r++] = e;\n }, o = 0; o < n; ++o) {\n if (r + 5 > i.length) {\n var a = new bi(r + 8 + (n - o << 1));\n a.set(i), i = a;\n }\n var u = e.charCodeAt(o);\n u < 128 || t ? s(u) : u < 2048 ? (s(192 | u >>> 6), s(128 | 63 & u)) : u > 55295 && u < 57344 ? (s(240 | (u = 65536 + (1047552 & u) | 1023 & e.charCodeAt(++o)) >>> 18), s(128 | u >>> 12 & 63), s(128 | u >>> 6 & 63), s(128 | 63 & u)) : (s(224 | u >>> 12), s(128 | u >>> 6 & 63), s(128 | 63 & u));\n }\n return Bi(i, 0, r);\n }(JSON.stringify(t)), {\n mtime: 0\n });\n return {\n contentType: nr,\n body: new Blob([i], {\n type: nr\n })\n };\n }\n if (n === re.Base64) {\n var r = function (e) {\n var t,\n n,\n i,\n r,\n s,\n o = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",\n a = 0,\n u = 0,\n l = \"\",\n c = [];\n if (!e) return e;\n e = se(e);\n do {\n t = (s = e.charCodeAt(a++) << 16 | e.charCodeAt(a++) << 8 | e.charCodeAt(a++)) >> 18 & 63, n = s >> 12 & 63, i = s >> 6 & 63, r = 63 & s, c[u++] = o.charAt(t) + o.charAt(n) + o.charAt(i) + o.charAt(r);\n } while (a < e.length);\n switch (l = c.join(\"\"), e.length % 3) {\n case 1:\n l = l.slice(0, -2) + \"==\";\n break;\n case 2:\n l = l.slice(0, -1) + \"=\";\n }\n return l;\n }(JSON.stringify(t));\n return {\n contentType: \"application/x-www-form-urlencoded\",\n body: rr(r)\n };\n }\n return {\n contentType: \"application/json\",\n body: JSON.stringify(t)\n };\n }\n },\n or = [];\nN && or.push({\n transport: \"XHR\",\n method: function (e) {\n var t,\n n = new N();\n n.open(e.method || \"GET\", e.url, !0);\n var i = null !== (t = sr(e)) && void 0 !== t ? t : {},\n r = i.contentType,\n s = i.body;\n Q(e.headers, function (e, t) {\n n.setRequestHeader(t, e);\n }), r && n.setRequestHeader(\"Content-Type\", r), e.timeout && (n.timeout = e.timeout), n.withCredentials = !0, n.onreadystatechange = function () {\n if (4 === n.readyState) {\n var t,\n i = {\n statusCode: n.status,\n text: n.responseText\n };\n if (200 === n.status) try {\n i.json = JSON.parse(n.responseText);\n } catch (e) {}\n null === (t = e.callback) || void 0 === t || t.call(e, i);\n }\n }, n.send(s);\n }\n}), q && or.push({\n transport: \"fetch\",\n method: function (e) {\n var t,\n n,\n i = null !== (t = sr(e)) && void 0 !== t ? t : {},\n r = i.contentType,\n s = i.body,\n o = new Headers();\n Q(o, function (e, t) {\n o.append(t, e);\n }), r && o.append(\"Content-Type\", r);\n var a = e.url,\n u = null;\n if (B) {\n var l = new B();\n u = {\n signal: l.signal,\n timeout: setTimeout(function () {\n return l.abort();\n }, e.timeout)\n };\n }\n q(a, {\n method: (null == e ? void 0 : e.method) || \"GET\",\n headers: o,\n keepalive: \"POST\" === e.method,\n body: s,\n signal: null === (n = u) || void 0 === n ? void 0 : n.signal\n }).then(function (t) {\n return t.text().then(function (n) {\n var i,\n r = {\n statusCode: t.status,\n text: n\n };\n if (200 === t.status) try {\n r.json = JSON.parse(n);\n } catch (e) {\n G.error(e);\n }\n null === (i = e.callback) || void 0 === i || i.call(e, r);\n });\n }).catch(function (t) {\n var n;\n G.error(t), null === (n = e.callback) || void 0 === n || n.call(e, {\n statusCode: 0,\n text: t\n });\n }).finally(function () {\n return u ? clearTimeout(u.timeout) : null;\n });\n }\n}), null != A && A.sendBeacon && or.push({\n transport: \"sendBeacon\",\n method: function (e) {\n var t = ir(e.url, {\n beacon: \"1\"\n });\n try {\n var n,\n i = null !== (n = sr(e)) && void 0 !== n ? n : {},\n r = i.contentType,\n s = i.body,\n o = \"string\" == typeof s ? new Blob([s], {\n type: r\n }) : s;\n A.sendBeacon(t, o);\n } catch (e) {}\n }\n});\nvar ar = [\"retriesPerformedSoFar\"];\nvar ur,\n lr = function () {\n function e(t) {\n var n = this;\n i(this, e), o(this, \"isPolling\", !1), o(this, \"pollIntervalMs\", 3e3), o(this, \"queue\", []), this.instance = t, this.queue = [], this.areWeOnline = !0, !w(T) && \"onLine\" in T.navigator && (this.areWeOnline = T.navigator.onLine, T.addEventListener(\"online\", function () {\n n.areWeOnline = !0, n.flush();\n }), T.addEventListener(\"offline\", function () {\n n.areWeOnline = !1;\n }));\n }\n return s(e, [{\n key: \"retriableRequest\",\n value: function (e) {\n var n = this,\n i = e.retriesPerformedSoFar,\n r = a(e, ar);\n F(i) && i > 0 && (r.url = ir(r.url, {\n retry_count: i\n })), this.instance._send_request(t(t({}, r), {}, {\n callback: function (e) {\n var s;\n 200 !== e.statusCode && (e.statusCode < 400 || e.statusCode >= 500) && (null != i ? i : 0) < 10 ? n.enqueue(t({\n retriesPerformedSoFar: i\n }, r)) : null === (s = r.callback) || void 0 === s || s.call(r, e);\n }\n }));\n }\n }, {\n key: \"enqueue\",\n value: function (e) {\n var t = e.retriesPerformedSoFar || 0;\n e.retriesPerformedSoFar = t + 1;\n var n = function (e) {\n var t = 3e3 * Math.pow(2, e),\n n = t / 2,\n i = Math.min(18e5, t),\n r = (Math.random() - .5) * (i - n);\n return Math.ceil(i + r);\n }(t),\n i = Date.now() + n;\n this.queue.push({\n retryAt: i,\n requestOptions: e\n });\n var r = \"Enqueued failed request for retry in \".concat(n);\n navigator.onLine || (r += \" (Browser is offline)\"), G.warn(r), this.isPolling || (this.isPolling = !0, this.poll());\n }\n }, {\n key: \"poll\",\n value: function () {\n var e = this;\n this.poller && clearTimeout(this.poller), this.poller = setTimeout(function () {\n e.areWeOnline && e.queue.length > 0 && e.flush(), e.poll();\n }, this.pollIntervalMs);\n }\n }, {\n key: \"flush\",\n value: function () {\n var e = Date.now(),\n t = [],\n n = this.queue.filter(function (n) {\n return n.retryAt < e || (t.push(n), !1);\n });\n if (this.queue = t, n.length > 0) {\n var i,\n r = h(n);\n try {\n for (r.s(); !(i = r.n()).done;) {\n var s = i.value.requestOptions;\n this.retriableRequest(s);\n }\n } catch (e) {\n r.e(e);\n } finally {\n r.f();\n }\n }\n }\n }, {\n key: \"unload\",\n value: function () {\n this.poller && (clearTimeout(this.poller), this.poller = void 0);\n var e,\n n = h(this.queue);\n try {\n for (n.s(); !(e = n.n()).done;) {\n var i = e.value.requestOptions;\n try {\n this.instance._send_request(t(t({}, i), {}, {\n transport: \"sendBeacon\"\n }));\n } catch (e) {\n G.error(e);\n }\n }\n } catch (e) {\n n.e(e);\n } finally {\n n.f();\n }\n this.queue = [];\n }\n }]), e;\n }(),\n cr = 1800,\n dr = function () {\n function e(t, n, r, s) {\n var a;\n i(this, e), o(this, \"_sessionIdChangedHandlers\", []), this.config = t, this.persistence = n, this._windowId = void 0, this._sessionId = void 0, this._sessionStartTimestamp = null, this._sessionActivityTimestamp = null, this._sessionIdGenerator = r || Ke, this._windowIdGenerator = s || Ke;\n var u = t.persistence_name || t.token,\n l = t.session_idle_timeout_seconds || cr;\n if (F(l) ? l > cr ? G.warn(\"session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead.\") : l < 60 && G.warn(\"session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead.\") : (G.warn(\"session_idle_timeout_seconds must be a number. Defaulting to 30 minutes.\"), l = cr), this._sessionTimeoutMs = 1e3 * Math.min(Math.max(l, 60), cr), this._window_id_storage_key = \"ph_\" + u + \"_window_id\", this._primary_window_exists_storage_key = \"ph_\" + u + \"_primary_window_exists\", this._canUseSessionStorage()) {\n var c = ft.parse(this._window_id_storage_key),\n d = ft.parse(this._primary_window_exists_storage_key);\n c && !d ? this._windowId = c : ft.remove(this._window_id_storage_key), ft.set(this._primary_window_exists_storage_key, !0);\n }\n if (null !== (a = this.config.bootstrap) && void 0 !== a && a.sessionID) try {\n var h = function (e) {\n var t = e.replace(/-/g, \"\");\n if (32 !== t.length) throw new Error(\"Not a valid UUID\");\n if (\"7\" !== t[12]) throw new Error(\"Not a UUIDv7\");\n return parseInt(t.substring(0, 12), 16);\n }(this.config.bootstrap.sessionID);\n this._setSessionId(this.config.bootstrap.sessionID, new Date().getTime(), h);\n } catch (e) {\n G.error(\"Invalid sessionID in bootstrap\", e);\n }\n this._listenToReloadWindow();\n }\n return s(e, [{\n key: \"onSessionId\",\n value: function (e) {\n var t = this;\n return w(this._sessionIdChangedHandlers) && (this._sessionIdChangedHandlers = []), this._sessionIdChangedHandlers.push(e), this._sessionId && e(this._sessionId, this._windowId), function () {\n t._sessionIdChangedHandlers = t._sessionIdChangedHandlers.filter(function (t) {\n return t !== e;\n });\n };\n }\n }, {\n key: \"_canUseSessionStorage\",\n value: function () {\n return \"memory\" !== this.config.persistence && !this.persistence.disabled && ft.is_supported();\n }\n }, {\n key: \"_setWindowId\",\n value: function (e) {\n e !== this._windowId && (this._windowId = e, this._canUseSessionStorage() && ft.set(this._window_id_storage_key, e));\n }\n }, {\n key: \"_getWindowId\",\n value: function () {\n return this._windowId ? this._windowId : this._canUseSessionStorage() ? ft.parse(this._window_id_storage_key) : null;\n }\n }, {\n key: \"_setSessionId\",\n value: function (e, t, n) {\n e === this._sessionId && t === this._sessionActivityTimestamp && n === this._sessionStartTimestamp || (this._sessionStartTimestamp = n, this._sessionActivityTimestamp = t, this._sessionId = e, this.persistence.register(o({}, Se, [t, e, n])));\n }\n }, {\n key: \"_getSessionId\",\n value: function () {\n if (this._sessionId && this._sessionActivityTimestamp && this._sessionStartTimestamp) return [this._sessionActivityTimestamp, this._sessionId, this._sessionStartTimestamp];\n var e = this.persistence.props[Se];\n return m(e) && 2 === e.length && e.push(e[0]), e || [0, null, 0];\n }\n }, {\n key: \"resetSessionId\",\n value: function () {\n this._setSessionId(null, null, null);\n }\n }, {\n key: \"_listenToReloadWindow\",\n value: function () {\n var e = this;\n null == T || T.addEventListener(\"beforeunload\", function () {\n e._canUseSessionStorage() && ft.remove(e._primary_window_exists_storage_key);\n });\n }\n }, {\n key: \"checkAndGetSessionAndWindowId\",\n value: function () {\n var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],\n t = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null) || new Date().getTime(),\n n = u(this._getSessionId(), 3),\n i = n[0],\n r = n[1],\n s = n[2],\n o = this._getWindowId(),\n a = s && s > 0 && Math.abs(t - s) > 864e5,\n l = !1,\n c = !r,\n d = !e && Math.abs(t - i) > this._sessionTimeoutMs;\n c || d || a ? (r = this._sessionIdGenerator(), o = this._windowIdGenerator(), G.info(\"[SessionId] new session ID generated\", {\n sessionId: r,\n windowId: o,\n changeReason: {\n noSessionId: c,\n activityTimeout: d,\n sessionPastMaximumLength: a\n }\n }), s = t, l = !0) : o || (o = this._windowIdGenerator(), l = !0);\n var h = 0 === i || !e || a ? t : i,\n f = 0 === s ? new Date().getTime() : s;\n return this._setWindowId(o), this._setSessionId(r, h, f), l && this._sessionIdChangedHandlers.forEach(function (e) {\n return e(r, o);\n }), {\n sessionId: r,\n windowId: o,\n sessionStartTimestamp: f\n };\n }\n }]), e;\n }();\n!function (e) {\n e.US = \"us\", e.EU = \"eu\", e.CUSTOM = \"custom\";\n}(ur || (ur = {}));\nvar hr = \"i.posthog.com\",\n fr = function () {\n function e(t) {\n i(this, e), o(this, \"_regionCache\", {}), this.instance = t;\n }\n return s(e, [{\n key: \"apiHost\",\n get: function () {\n return this.instance.config.api_host.trim().replace(/\\/$/, \"\");\n }\n }, {\n key: \"uiHost\",\n get: function () {\n var e,\n t = null === (e = this.instance.config.ui_host) || void 0 === e ? void 0 : e.replace(/\\/$/, \"\");\n return \"https://app.posthog.com\" === t ? \"https://us.posthog.com\" : t;\n }\n }, {\n key: \"region\",\n get: function () {\n return this._regionCache[this.apiHost] || (/https:\\/\\/(app|us|us-assets)(\\.i)?\\.posthog\\.com/i.test(this.apiHost) ? this._regionCache[this.apiHost] = ur.US : /https:\\/\\/(eu|eu-assets)(\\.i)?\\.posthog\\.com/i.test(this.apiHost) ? this._regionCache[this.apiHost] = ur.EU : this._regionCache[this.apiHost] = ur.CUSTOM), this._regionCache[this.apiHost];\n }\n }, {\n key: \"endpointFor\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : \"\";\n if (t && (t = \"/\" === t[0] ? t : \"/\".concat(t)), \"ui\" === e) return (this.uiHost || this.apiHost.replace(\".\".concat(hr), \".posthog.com\")) + t;\n if (this.region === ur.CUSTOM) return this.apiHost + t;\n var n = hr + t;\n switch (e) {\n case \"assets\":\n return \"https://\".concat(this.region, \"-assets.\").concat(n);\n case \"api\":\n return \"https://\".concat(this.region, \".\").concat(n);\n }\n }\n }, {\n key: \"loadScript\",\n value: function (e, t) {\n if (this.instance.config.disable_external_dependency_loading) return G.warn(\"\".concat(e, \" was requested but loading of external scripts is disabled.\")), t(\"Loading of external scripts is disabled\");\n var n = \"/\" === e[0] ? this.endpointFor(\"assets\", e) : e,\n i = function () {\n if (!D) return t(\"document not found\");\n var e = D.createElement(\"script\");\n e.type = \"text/javascript\", e.src = n, e.onload = function (e) {\n return t(void 0, e);\n }, e.onerror = function (e) {\n return t(e);\n };\n var i,\n r = D.querySelectorAll(\"body > script\");\n r.length > 0 ? null === (i = r[0].parentNode) || void 0 === i || i.insertBefore(e, r[0]) : D.body.appendChild(e);\n };\n null != D && D.body ? i() : null == D || D.addEventListener(\"DOMContentLoaded\", i);\n }\n }]), e;\n }(),\n vr = \"/e/\",\n pr = \"[Exception Capture]\",\n gr = function () {\n function e(t) {\n var n,\n r,\n s = this;\n i(this, e), o(this, \"originalOnUnhandledRejectionHandler\", void 0), o(this, \"startCapturing\", function () {\n var e;\n if (T && s.isEnabled && !s.hasHandlers && (null === (e = T.onerror) || void 0 === e || !e.__POSTHOG_INSTRUMENTED__)) {\n var t = T.posthogErrorWrappingFunctions.wrapOnError,\n n = T.posthogErrorWrappingFunctions.wrapUnhandledRejection;\n if (t && n) try {\n s.unwrapOnError = t(s.captureException.bind(s)), s.unwrapUnhandledRejection = n(s.captureException.bind(s));\n } catch (e) {\n G.error(pr + \" failed to start\", e), s.stopCapturing();\n } else G.error(pr + \" failed to load error wrapping functions - cannot start\");\n }\n }), this.instance = t, this.remoteEnabled = !(null === (n = this.instance.persistence) || void 0 === n || !n.props[ve]), this._endpoint = (null === (r = this.instance.persistence) || void 0 === r ? void 0 : r.props[pe]) || vr, this.startIfEnabled();\n }\n return s(e, [{\n key: \"endpoint\",\n get: function () {\n return this._endpoint;\n }\n }, {\n key: \"isEnabled\",\n get: function () {\n var e;\n return null !== (e = this.remoteEnabled) && void 0 !== e && e;\n }\n }, {\n key: \"isCapturing\",\n get: function () {\n var e;\n return !(null == T || null === (e = T.onerror) || void 0 === e || !e.__POSTHOG_INSTRUMENTED__);\n }\n }, {\n key: \"hasHandlers\",\n get: function () {\n return this.originalOnUnhandledRejectionHandler || this.unwrapOnError;\n }\n }, {\n key: \"startIfEnabled\",\n value: function () {\n this.isEnabled && !this.isCapturing && (G.info(pr + \" enabled, starting...\"), this.loadScript(this.startCapturing));\n }\n }, {\n key: \"loadScript\",\n value: function (e) {\n this.hasHandlers && e(), this.instance.requestRouter.loadScript(this.instance.requestRouter.endpointFor(\"assets\", \"/static/exception-autocapture.js?v=\".concat(f.LIB_VERSION)), function (t) {\n if (t) return G.error(pr + \" failed to load script\", t);\n e();\n });\n }\n }, {\n key: \"stopCapturing\",\n value: function () {\n var e, t;\n null === (e = this.unwrapOnError) || void 0 === e || e.call(this), null === (t = this.unwrapUnhandledRejection) || void 0 === t || t.call(this);\n }\n }, {\n key: \"afterDecideResponse\",\n value: function (e) {\n var t = e.autocaptureExceptions;\n this.remoteEnabled = !!t || !1, this._endpoint = b(t) && t.endpoint || vr, this.instance.persistence && (this.instance.persistence.register(o({}, ve, this.remoteEnabled)), this.instance.persistence.register(o({}, pe, this._endpoint))), this.startIfEnabled();\n }\n }, {\n key: \"captureException\",\n value: function (e) {\n var t = this.instance.requestRouter.endpointFor(\"ui\");\n e.$exception_personURL = \"\".concat(t, \"/project/\").concat(this.instance.config.token, \"/person/\").concat(this.instance.get_distinct_id()), this.sendExceptionEvent(e);\n }\n }, {\n key: \"sendExceptionEvent\",\n value: function (e) {\n this.instance.capture(\"$exception\", e, {\n _noTruncate: !0,\n _batchKey: \"exceptionEvent\",\n _url: this.endpoint\n });\n }\n }]), e;\n }(),\n _r = \"posthog-js\";\nfunction mr(e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\n n = t.organization,\n i = t.projectId,\n r = t.prefix,\n s = t.severityAllowList,\n o = void 0 === s ? [\"error\"] : s;\n return function (t) {\n var s, a, u, l, c, d;\n if (!(\"*\" === o || o.includes(t.level)) || !e.__loaded) return t;\n t.tags || (t.tags = {});\n var h = e.requestRouter.endpointFor(\"ui\", \"/project/\".concat(e.config.token, \"/person/\").concat(e.get_distinct_id()));\n t.tags[\"PostHog Person URL\"] = h, e.sessionRecordingStarted() && (t.tags[\"PostHog Recording URL\"] = e.get_session_replay_url({\n withTimestamp: !0\n }));\n var f = (null === (s = t.exception) || void 0 === s ? void 0 : s.values) || [],\n v = {\n $exception_message: (null === (a = f[0]) || void 0 === a ? void 0 : a.value) || t.message,\n $exception_type: null === (u = f[0]) || void 0 === u ? void 0 : u.type,\n $exception_personURL: h,\n $exception_level: t.level,\n $sentry_event_id: t.event_id,\n $sentry_exception: t.exception,\n $sentry_exception_message: (null === (l = f[0]) || void 0 === l ? void 0 : l.value) || t.message,\n $sentry_exception_type: null === (c = f[0]) || void 0 === c ? void 0 : c.type,\n $sentry_tags: t.tags,\n $level: t.level\n };\n return n && i && (v.$sentry_url = (r || \"https://sentry.io/organizations/\") + n + \"/issues/?project=\" + i + \"&query=\" + t.event_id), e.capture(\"$exception\", v, {\n _url: (null === (d = e.exceptionObserver) || void 0 === d ? void 0 : d.endpoint) || vr\n }), t;\n };\n}\nvar yr = s(function e(t, n, r, s, o) {\n i(this, e), this.name = _r, this.setupOnce = function (e) {\n e(mr(t, {\n organization: n,\n projectId: r,\n prefix: s,\n severityAllowList: o\n }));\n };\n});\nfunction br(e, t) {\n var n = e.config.segment;\n if (!n) return t();\n !function (e, t) {\n var n = e.config.segment;\n if (!n) return t();\n var i = function (n) {\n var i = function () {\n return n.anonymousId() || Ke();\n };\n e.config.get_device_id = i, n.id() && (e.register({\n distinct_id: n.id(),\n $device_id: i()\n }), e.persistence.set_property($e, \"identified\")), t();\n },\n r = n.user();\n \"then\" in r && y(r.then) ? r.then(function (e) {\n return i(e);\n }) : i(r);\n }(e, function () {\n n.register(function (e) {\n Promise && Promise.resolve || G.warn(\"This browser does not have Promise support, and can not use the segment integration\");\n var t = function (t, n) {\n var i;\n if (!n) return t;\n t.event.userId || t.event.anonymousId === e.get_distinct_id() || e.reset(), t.event.userId && t.event.userId !== e.get_distinct_id() && (e.register({\n distinct_id: t.event.userId\n }), e.reloadFeatureFlags());\n var r = e._calculate_event_properties(n, null !== (i = t.event.properties) && void 0 !== i ? i : {});\n return t.event.properties = Object.assign({}, r, t.event.properties), t;\n };\n return {\n name: \"PostHog JS\",\n type: \"enrichment\",\n version: \"1.0.0\",\n isLoaded: function () {\n return !0;\n },\n load: function () {\n return Promise.resolve();\n },\n track: function (e) {\n return t(e, e.event.event);\n },\n page: function (e) {\n return t(e, \"$pageview\");\n },\n identify: function (e) {\n return t(e, \"$identify\");\n },\n screen: function (e) {\n return t(e, \"$screen\");\n }\n };\n }(e)).then(function () {\n t();\n });\n });\n}\nvar kr,\n wr,\n Sr,\n Er = function () {\n function e(t) {\n i(this, e), this._instance = t;\n }\n return s(e, [{\n key: \"doPageView\",\n value: function () {\n var e,\n t = this._previousScrollProperties();\n return this._currentPath = null !== (e = null == T ? void 0 : T.location.pathname) && void 0 !== e ? e : \"\", this._instance.scrollManager.resetContext(), t;\n }\n }, {\n key: \"doPageLeave\",\n value: function () {\n return this._previousScrollProperties();\n }\n }, {\n key: \"_previousScrollProperties\",\n value: function () {\n var e = this._currentPath,\n t = this._instance.scrollManager.getContext();\n if (!e || !t) return {};\n var n = t.maxScrollHeight,\n i = t.lastScrollY,\n r = t.maxScrollY,\n s = t.maxContentHeight,\n o = t.lastContentY,\n a = t.maxContentY;\n return w(n) || w(i) || w(r) || w(s) || w(o) || w(a) ? {} : (n = Math.ceil(n), i = Math.ceil(i), r = Math.ceil(r), s = Math.ceil(s), o = Math.ceil(o), a = Math.ceil(a), {\n $prev_pageview_pathname: e,\n $prev_pageview_last_scroll: i,\n $prev_pageview_last_scroll_percentage: n <= 1 ? 1 : Rr(i / n, 0, 1),\n $prev_pageview_max_scroll: r,\n $prev_pageview_max_scroll_percentage: n <= 1 ? 1 : Rr(r / n, 0, 1),\n $prev_pageview_last_content: o,\n $prev_pageview_last_content_percentage: s <= 1 ? 1 : Rr(o / s, 0, 1),\n $prev_pageview_max_content: a,\n $prev_pageview_max_content_percentage: s <= 1 ? 1 : Rr(a / s, 0, 1)\n });\n }\n }]), e;\n }();\nfunction Rr(e, t, n) {\n return Math.max(t, Math.min(e, n));\n}\n!function (e) {\n e.Popover = \"popover\", e.API = \"api\", e.Widget = \"widget\";\n}(kr || (kr = {})), function (e) {\n e.Open = \"open\", e.MultipleChoice = \"multiple_choice\", e.SingleChoice = \"single_choice\", e.Rating = \"rating\", e.Link = \"link\";\n}(wr || (wr = {})), function (e) {\n e.NextQuestion = \"next_question\", e.End = \"end\", e.ResponseBased = \"response_based\", e.SpecificQuestion = \"specific_question\";\n}(Sr || (Sr = {}));\nvar Ir = function () {\n function e() {\n i(this, e), o(this, \"events\", {}), this.events = {};\n }\n return s(e, [{\n key: \"on\",\n value: function (e, t) {\n var n = this;\n return this.events[e] || (this.events[e] = []), this.events[e].push(t), function () {\n n.events[e] = n.events[e].filter(function (e) {\n return e !== t;\n });\n };\n }\n }, {\n key: \"emit\",\n value: function (e, t) {\n var n,\n i = h(this.events[e] || []);\n try {\n for (i.s(); !(n = i.n()).done;) {\n (0, n.value)(t);\n }\n } catch (e) {\n i.e(e);\n } finally {\n i.f();\n }\n var r,\n s = h(this.events[\"*\"] || []);\n try {\n for (s.s(); !(r = s.n()).done;) {\n (0, r.value)(e, t);\n }\n } catch (e) {\n s.e(e);\n } finally {\n s.f();\n }\n }\n }]), e;\n }(),\n Fr = function () {\n function e(t) {\n var n = this;\n i(this, e), o(this, \"_debugEventEmitter\", new Ir()), o(this, \"checkStep\", function (e, t) {\n return n.checkStepEvent(e, t) && n.checkStepUrl(e, t) && n.checkStepElement(e, t);\n }), o(this, \"checkStepEvent\", function (e, t) {\n return null == t || !t.event || (null == e ? void 0 : e.event) === (null == t ? void 0 : t.event);\n }), this.instance = t, this.actionEvents = new Set(), this.actionRegistry = new Set();\n }\n return s(e, [{\n key: \"init\",\n value: function () {\n var e,\n t = this;\n if (!w(null === (e = this.instance) || void 0 === e ? void 0 : e._addCaptureHook)) {\n var n;\n null === (n = this.instance) || void 0 === n || n._addCaptureHook(function (e, n) {\n t.on(e, n);\n });\n }\n }\n }, {\n key: \"register\",\n value: function (e) {\n var t,\n n,\n i = this;\n if (!w(null === (t = this.instance) || void 0 === t ? void 0 : t._addCaptureHook) && (e.forEach(function (e) {\n var t, n;\n null === (t = i.actionRegistry) || void 0 === t || t.add(e), null === (n = e.steps) || void 0 === n || n.forEach(function (e) {\n var t;\n null === (t = i.actionEvents) || void 0 === t || t.add((null == e ? void 0 : e.event) || \"\");\n });\n }), null !== (n = this.instance) && void 0 !== n && n.autocapture)) {\n var r,\n s = new Set();\n e.forEach(function (e) {\n var t;\n null === (t = e.steps) || void 0 === t || t.forEach(function (e) {\n null != e && e.selector && s.add(null == e ? void 0 : e.selector);\n });\n }), null === (r = this.instance) || void 0 === r || r.autocapture.setElementSelectors(s);\n }\n }\n }, {\n key: \"on\",\n value: function (e, t) {\n var n,\n i = this;\n null != t && 0 != e.length && (this.actionEvents.has(e) || this.actionEvents.has(null == t ? void 0 : t.event)) && this.actionRegistry && (null === (n = this.actionRegistry) || void 0 === n ? void 0 : n.size) > 0 && this.actionRegistry.forEach(function (e) {\n i.checkAction(t, e) && i._debugEventEmitter.emit(\"actionCaptured\", e.name);\n });\n }\n }, {\n key: \"_addActionHook\",\n value: function (e) {\n this.onAction(\"actionCaptured\", function (t) {\n return e(t);\n });\n }\n }, {\n key: \"checkAction\",\n value: function (e, t) {\n if (null == (null == t ? void 0 : t.steps)) return !1;\n var n,\n i = h(t.steps);\n try {\n for (i.s(); !(n = i.n()).done;) {\n var r = n.value;\n if (this.checkStep(e, r)) return !0;\n }\n } catch (e) {\n i.e(e);\n } finally {\n i.f();\n }\n return !1;\n }\n }, {\n key: \"onAction\",\n value: function (e, t) {\n return this._debugEventEmitter.on(e, t);\n }\n }, {\n key: \"checkStepUrl\",\n value: function (t, n) {\n if (null != n && n.url) {\n var i,\n r = null == t || null === (i = t.properties) || void 0 === i ? void 0 : i.$current_url;\n if (!r || \"string\" != typeof r) return !1;\n if (!e.matchString(r, null == n ? void 0 : n.url, (null == n ? void 0 : n.url_matching) || \"contains\")) return !1;\n }\n return !0;\n }\n }, {\n key: \"checkStepElement\",\n value: function (t, n) {\n if ((null != n && n.href || null != n && n.tag_name || null != n && n.text) && !this.getElementsList(t).some(function (t) {\n return !(null != n && n.href && !e.matchString(t.href || \"\", null == n ? void 0 : n.href, (null == n ? void 0 : n.href_matching) || \"exact\")) && (null == n || !n.tag_name || t.tag_name === (null == n ? void 0 : n.tag_name)) && !(null != n && n.text && !e.matchString(t.text || \"\", null == n ? void 0 : n.text, (null == n ? void 0 : n.text_matching) || \"exact\") && !e.matchString(t.$el_text || \"\", null == n ? void 0 : n.text, (null == n ? void 0 : n.text_matching) || \"exact\"));\n })) return !1;\n if (null != n && n.selector) {\n var i,\n r = null == t || null === (i = t.properties) || void 0 === i ? void 0 : i.$element_selectors;\n if (!r) return !1;\n if (!r.includes(null == n ? void 0 : n.selector)) return !1;\n }\n return !0;\n }\n }, {\n key: \"getElementsList\",\n value: function (e) {\n return null == (null == e ? void 0 : e.properties.$elements) ? [] : null == e ? void 0 : e.properties.$elements;\n }\n }], [{\n key: \"matchString\",\n value: function (t, n, i) {\n switch (i) {\n case \"regex\":\n return !!T && gt(t, n);\n case \"exact\":\n return n === t;\n case \"contains\":\n var r = e.escapeStringRegexp(n).replace(/_/g, \".\").replace(/%/g, \".*\");\n return gt(t, r);\n default:\n return !1;\n }\n }\n }, {\n key: \"escapeStringRegexp\",\n value: function (e) {\n return e.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\").replace(/-/g, \"\\\\x2d\");\n }\n }]), e;\n }(),\n xr = function () {\n function e(t) {\n i(this, e), this.instance = t, this.eventToSurveys = new Map(), this.actionToSurveys = new Map();\n }\n return s(e, [{\n key: \"register\",\n value: function (e) {\n var t;\n w(null === (t = this.instance) || void 0 === t ? void 0 : t._addCaptureHook) || (this.setupEventBasedSurveys(e), this.setupActionBasedSurveys(e));\n }\n }, {\n key: \"setupActionBasedSurveys\",\n value: function (e) {\n var t = this,\n n = e.filter(function (e) {\n var t, n, i, r;\n return (null === (t = e.conditions) || void 0 === t ? void 0 : t.actions) && (null === (n = e.conditions) || void 0 === n || null === (i = n.actions) || void 0 === i || null === (r = i.values) || void 0 === r ? void 0 : r.length) > 0;\n });\n if (0 !== n.length) {\n if (null == this.actionMatcher) {\n this.actionMatcher = new Fr(this.instance), this.actionMatcher.init();\n this.actionMatcher._addActionHook(function (e) {\n t.onAction(e);\n });\n }\n n.forEach(function (e) {\n var n, i, r, s, o, a, u, l, c, d;\n e.conditions && null !== (n = e.conditions) && void 0 !== n && n.actions && null !== (i = e.conditions) && void 0 !== i && null !== (r = i.actions) && void 0 !== r && r.values && (null === (s = e.conditions) || void 0 === s || null === (o = s.actions) || void 0 === o || null === (a = o.values) || void 0 === a ? void 0 : a.length) > 0 && (null === (u = t.actionMatcher) || void 0 === u || u.register(e.conditions.actions.values), null === (l = e.conditions) || void 0 === l || null === (c = l.actions) || void 0 === c || null === (d = c.values) || void 0 === d || d.forEach(function (n) {\n if (n && n.name) {\n var i = t.actionToSurveys.get(n.name);\n i && i.push(e.id), t.actionToSurveys.set(n.name, i || [e.id]);\n }\n }));\n });\n }\n }\n }, {\n key: \"setupEventBasedSurveys\",\n value: function (e) {\n var t,\n n = this;\n if (0 !== e.filter(function (e) {\n var t, n, i, r;\n return (null === (t = e.conditions) || void 0 === t ? void 0 : t.events) && (null === (n = e.conditions) || void 0 === n || null === (i = n.events) || void 0 === i || null === (r = i.values) || void 0 === r ? void 0 : r.length) > 0;\n }).length) {\n null === (t = this.instance) || void 0 === t || t._addCaptureHook(function (e, t) {\n n.onEvent(e, t);\n }), e.forEach(function (e) {\n var t, i, r;\n null === (t = e.conditions) || void 0 === t || null === (i = t.events) || void 0 === i || null === (r = i.values) || void 0 === r || r.forEach(function (t) {\n if (t && t.name) {\n var i = n.eventToSurveys.get(t.name);\n i && i.push(e.id), n.eventToSurveys.set(t.name, i || [e.id]);\n }\n });\n });\n }\n }\n }, {\n key: \"onEvent\",\n value: function (t, n) {\n var i,\n r,\n s = (null === (i = this.instance) || void 0 === i || null === (r = i.persistence) || void 0 === r ? void 0 : r.props[Te]) || [];\n if (e.SURVEY_SHOWN_EVENT_NAME == t && n && s.length > 0) {\n var o,\n a = null == n || null === (o = n.properties) || void 0 === o ? void 0 : o.$survey_id;\n if (a) {\n var u = s.indexOf(a);\n u >= 0 && (s.splice(u, 1), this._updateActivatedSurveys(s));\n }\n } else this.eventToSurveys.has(t) && this._updateActivatedSurveys(s.concat(this.eventToSurveys.get(t) || []));\n }\n }, {\n key: \"onAction\",\n value: function (e) {\n var t,\n n,\n i = (null === (t = this.instance) || void 0 === t || null === (n = t.persistence) || void 0 === n ? void 0 : n.props[Te]) || [];\n this.actionToSurveys.has(e) && this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(e) || []));\n }\n }, {\n key: \"_updateActivatedSurveys\",\n value: function (e) {\n var t, n;\n null === (t = this.instance) || void 0 === t || null === (n = t.persistence) || void 0 === n || n.register(o({}, Te, l(new Set(e))));\n }\n }, {\n key: \"getSurveys\",\n value: function () {\n var e,\n t,\n n = null === (e = this.instance) || void 0 === e || null === (t = e.persistence) || void 0 === t ? void 0 : t.props[Te];\n return n || [];\n }\n }, {\n key: \"getEventToSurveys\",\n value: function () {\n return this.eventToSurveys;\n }\n }, {\n key: \"_getActionMatcher\",\n value: function () {\n return this.actionMatcher;\n }\n }]), e;\n }();\no(xr, \"SURVEY_SHOWN_EVENT_NAME\", \"survey shown\");\nvar Pr = \"[Surveys]\",\n Tr = {\n icontains: function (e) {\n return !!T && T.location.href.toLowerCase().indexOf(e.toLowerCase()) > -1;\n },\n not_icontains: function (e) {\n return !!T && -1 === T.location.href.toLowerCase().indexOf(e.toLowerCase());\n },\n regex: function (e) {\n return !!T && gt(T.location.href, e);\n },\n not_regex: function (e) {\n return !!T && !gt(T.location.href, e);\n },\n exact: function (e) {\n return (null == T ? void 0 : T.location.href) === e;\n },\n is_not: function (e) {\n return (null == T ? void 0 : T.location.href) !== e;\n }\n };\nvar Cr = function () {\n function e(t) {\n i(this, e), this.instance = t, this._surveyEventReceiver = null;\n }\n return s(e, [{\n key: \"afterDecideResponse\",\n value: function (e) {\n this._decideServerResponse = !!e.surveys, this.loadIfEnabled();\n }\n }, {\n key: \"loadIfEnabled\",\n value: function () {\n var e = this,\n t = null == U ? void 0 : U.extendPostHogWithSurveys;\n this.instance.config.disable_surveys || !this._decideServerResponse || t || (null == this._surveyEventReceiver && (this._surveyEventReceiver = new xr(this.instance)), this.instance.requestRouter.loadScript(\"/static/surveys.js\", function (t) {\n if (t) return G.error(Pr, \"Could not load surveys script\", t);\n e._surveyManager = U.extendPostHogWithSurveys(e.instance);\n }));\n }\n }, {\n key: \"getSurveys\",\n value: function (e) {\n var t = this,\n n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n if (this.instance.config.disable_surveys) return e([]);\n null == this._surveyEventReceiver && (this._surveyEventReceiver = new xr(this.instance));\n var i = this.instance.get_property(Pe);\n if (i && !n) return e(i);\n this.instance._send_request({\n url: this.instance.requestRouter.endpointFor(\"api\", \"/api/surveys/?token=\".concat(this.instance.config.token)),\n method: \"GET\",\n transport: \"XHR\",\n callback: function (n) {\n var i;\n if (200 !== n.statusCode || !n.json) return e([]);\n var r,\n s = n.json.surveys || [],\n a = s.filter(function (e) {\n var t, n, i, r, s, o, a, u, l, c, d, h;\n return (null === (t = e.conditions) || void 0 === t ? void 0 : t.events) && (null === (n = e.conditions) || void 0 === n || null === (i = n.events) || void 0 === i ? void 0 : i.values) && (null === (r = e.conditions) || void 0 === r || null === (s = r.events) || void 0 === s || null === (o = s.values) || void 0 === o ? void 0 : o.length) > 0 || (null === (a = e.conditions) || void 0 === a ? void 0 : a.actions) && (null === (u = e.conditions) || void 0 === u || null === (l = u.actions) || void 0 === l ? void 0 : l.values) && (null === (c = e.conditions) || void 0 === c || null === (d = c.actions) || void 0 === d || null === (h = d.values) || void 0 === h ? void 0 : h.length) > 0;\n });\n a.length > 0 && (null === (r = t._surveyEventReceiver) || void 0 === r || r.register(a));\n return null === (i = t.instance.persistence) || void 0 === i || i.register(o({}, Pe, s)), e(s);\n }\n });\n }\n }, {\n key: \"getActiveMatchingSurveys\",\n value: function (e) {\n var t = this,\n n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n this.getSurveys(function (n) {\n var i,\n r = n.filter(function (e) {\n return !(!e.start_date || e.end_date);\n }).filter(function (e) {\n var t, n, i, r;\n if (!e.conditions) return !0;\n var s = null === (t = e.conditions) || void 0 === t || !t.url || Tr[null !== (n = null === (i = e.conditions) || void 0 === i ? void 0 : i.urlMatchType) && void 0 !== n ? n : \"icontains\"](e.conditions.url),\n o = null === (r = e.conditions) || void 0 === r || !r.selector || (null == D ? void 0 : D.querySelector(e.conditions.selector));\n return s && o;\n }),\n s = null === (i = t._surveyEventReceiver) || void 0 === i ? void 0 : i.getSurveys(),\n o = r.filter(function (e) {\n var n, i, r, o, a, u, l, c, d, h;\n if (!e.linked_flag_key && !e.targeting_flag_key && !e.internal_targeting_flag_key) return !0;\n var f = !e.linked_flag_key || t.instance.featureFlags.isFeatureEnabled(e.linked_flag_key),\n v = !e.targeting_flag_key || t.instance.featureFlags.isFeatureEnabled(e.targeting_flag_key),\n p = (null === (n = e.conditions) || void 0 === n ? void 0 : n.events) && (null === (i = e.conditions) || void 0 === i || null === (r = i.events) || void 0 === r ? void 0 : r.values) && (null === (o = e.conditions) || void 0 === o || null === (a = o.events) || void 0 === a ? void 0 : a.values.length) > 0,\n g = (null === (u = e.conditions) || void 0 === u ? void 0 : u.actions) && (null === (l = e.conditions) || void 0 === l || null === (c = l.actions) || void 0 === c ? void 0 : c.values) && (null === (d = e.conditions) || void 0 === d || null === (h = d.actions) || void 0 === h ? void 0 : h.values.length) > 0,\n _ = !p && !g || (null == s ? void 0 : s.includes(e.id)),\n m = t._canActivateRepeatedly(e),\n y = !(e.internal_targeting_flag_key && !m) || t.instance.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key);\n return f && v && y && _;\n });\n return e(o);\n }, n);\n }\n }, {\n key: \"getNextSurveyStep\",\n value: function (e, t, n) {\n var i,\n r = e.questions[t],\n s = t + 1;\n if (null === (i = r.branching) || void 0 === i || !i.type) return t === e.questions.length - 1 ? Sr.End : s;\n if (r.branching.type === Sr.End) return Sr.End;\n if (r.branching.type === Sr.SpecificQuestion) {\n if (Number.isInteger(r.branching.index)) return r.branching.index;\n } else if (r.branching.type === Sr.ResponseBased) {\n if (r.type === wr.SingleChoice) {\n var o,\n a,\n u = r.choices.indexOf(\"\".concat(n));\n if (null !== (o = r.branching) && void 0 !== o && null !== (a = o.responseValues) && void 0 !== a && a.hasOwnProperty(u)) {\n var l = r.branching.responseValues[u];\n return Number.isInteger(l) ? l : l === Sr.End ? Sr.End : s;\n }\n } else if (r.type === wr.Rating) {\n var c, d;\n if (\"number\" != typeof n || !Number.isInteger(n)) throw new Error(\"The response type must be an integer\");\n var h = function (e, t) {\n if (3 === t) {\n if (e < 1 || e > 3) throw new Error(\"The response must be in range 1-3\");\n return 1 === e ? \"negative\" : 2 === e ? \"neutral\" : \"positive\";\n }\n if (5 === t) {\n if (e < 1 || e > 5) throw new Error(\"The response must be in range 1-5\");\n return e <= 2 ? \"negative\" : 3 === e ? \"neutral\" : \"positive\";\n }\n if (10 === t) {\n if (e < 0 || e > 10) throw new Error(\"The response must be in range 0-10\");\n return e <= 6 ? \"detractors\" : e <= 8 ? \"passives\" : \"promoters\";\n }\n throw new Error(\"The scale must be one of: 3, 5, 10\");\n }(n, r.scale);\n if (null !== (c = r.branching) && void 0 !== c && null !== (d = c.responseValues) && void 0 !== d && d.hasOwnProperty(h)) {\n var f = r.branching.responseValues[h];\n return Number.isInteger(f) ? f : f === Sr.End ? Sr.End : s;\n }\n }\n return s;\n }\n return G.warn(Pr, \"Falling back to next question index due to unexpected branching type\"), s;\n }\n }, {\n key: \"_canActivateRepeatedly\",\n value: function (e) {\n return I(U.__PosthogExtensions__.canActivateRepeatedly) && G.warn(Pr, \"canActivateRepeatedly is not defined, must init before calling\"), U.__PosthogExtensions__.canActivateRepeatedly(e);\n }\n }, {\n key: \"canRenderSurvey\",\n value: function (e) {\n var t = this;\n I(this._surveyManager) ? G.warn(Pr, \"canActivateRepeatedly is not defined, must init before calling\") : this.getSurveys(function (n) {\n var i = n.filter(function (t) {\n return t.id === e;\n })[0];\n t._surveyManager.canRenderSurvey(i);\n });\n }\n }, {\n key: \"renderSurvey\",\n value: function (e, t) {\n var n = this;\n I(this._surveyManager) ? G.warn(Pr, \"canActivateRepeatedly is not defined, must init before calling\") : this.getSurveys(function (i) {\n var r = i.filter(function (t) {\n return t.id === e;\n })[0];\n n._surveyManager.renderSurvey(r, null == D ? void 0 : D.querySelector(t));\n });\n }\n }]), e;\n }(),\n $r = function () {\n function e(t) {\n var n,\n r,\n s = this;\n i(this, e), o(this, \"serverLimits\", {}), o(this, \"lastEventRateLimited\", !1), o(this, \"checkForLimiting\", function (e) {\n var t = e.text;\n if (t && t.length) try {\n (JSON.parse(t).quota_limited || []).forEach(function (e) {\n G.info(\"[RateLimiter] \".concat(e || \"events\", \" is quota limited.\")), s.serverLimits[e] = new Date().getTime() + 6e4;\n });\n } catch (e) {\n return void G.warn('[RateLimiter] could not rate limit - continuing. Error: \"'.concat(null == e ? void 0 : e.message, '\"'), {\n text: t\n });\n }\n }), this.instance = t, this.captureEventsPerSecond = (null === (n = t.config.rate_limiting) || void 0 === n ? void 0 : n.events_per_second) || 10, this.captureEventsBurstLimit = Math.max((null === (r = t.config.rate_limiting) || void 0 === r ? void 0 : r.events_burst_limit) || 10 * this.captureEventsPerSecond, this.captureEventsPerSecond), this.lastEventRateLimited = this.clientRateLimitContext(!0).isRateLimited;\n }\n return s(e, [{\n key: \"clientRateLimitContext\",\n value: function () {\n var e,\n t,\n n,\n i = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],\n r = new Date().getTime(),\n s = null !== (e = null === (t = this.instance.persistence) || void 0 === t ? void 0 : t.get_property(Me)) && void 0 !== e ? e : {\n tokens: this.captureEventsBurstLimit,\n last: r\n };\n s.tokens += (r - s.last) / 1e3 * this.captureEventsPerSecond, s.last = r, s.tokens > this.captureEventsBurstLimit && (s.tokens = this.captureEventsBurstLimit);\n var o = s.tokens < 1;\n return o || i || (s.tokens = Math.max(0, s.tokens - 1)), !o || this.lastEventRateLimited || i || this.instance.capture(\"$$client_ingestion_warning\", {\n $$client_ingestion_warning_message: \"posthog-js client rate limited. Config is set to \".concat(this.captureEventsPerSecond, \" events per second and \").concat(this.captureEventsBurstLimit, \" events burst limit.\")\n }, {\n skip_client_rate_limiting: !0\n }), this.lastEventRateLimited = o, null === (n = this.instance.persistence) || void 0 === n || n.set_property(Me, s), {\n isRateLimited: o,\n remainingTokens: s.tokens\n };\n }\n }, {\n key: \"isServerRateLimited\",\n value: function (e) {\n var t = this.serverLimits[e || \"events\"] || !1;\n return !1 !== t && new Date().getTime() < t;\n }\n }]), e;\n }(),\n Or = function () {\n return t({\n initialPathName: (null == L ? void 0 : L.pathname) || \"\",\n referringDomain: mn.referringDomain()\n }, mn.campaignParams());\n },\n Mr = function () {\n function e(t, n, r) {\n var s = this;\n i(this, e), o(this, \"_onSessionIdCallback\", function (e) {\n var t = s._getStoredProps();\n if (!t || t.sessionId !== e) {\n var n = {\n sessionId: e,\n props: s._sessionSourceParamGenerator()\n };\n s._persistence.register(o({}, Oe, n));\n }\n }), this._sessionIdManager = t, this._persistence = n, this._sessionSourceParamGenerator = r || Or, this._sessionIdManager.onSessionId(this._onSessionIdCallback);\n }\n return s(e, [{\n key: \"_getStoredProps\",\n value: function () {\n return this._persistence.props[Oe];\n }\n }, {\n key: \"getSessionProps\",\n value: function () {\n var e,\n t = null === (e = this._getStoredProps()) || void 0 === e ? void 0 : e.props;\n return t ? {\n $client_session_initial_referring_host: t.referringDomain,\n $client_session_initial_pathname: t.initialPathName,\n $client_session_initial_utm_source: t.utm_source,\n $client_session_initial_utm_campaign: t.utm_campaign,\n $client_session_initial_utm_medium: t.utm_medium,\n $client_session_initial_utm_content: t.utm_content,\n $client_session_initial_utm_term: t.utm_term\n } : {};\n }\n }]), e;\n }(),\n Ar = [\"ahrefsbot\", \"ahrefssiteaudit\", \"applebot\", \"baiduspider\", \"bingbot\", \"bingpreview\", \"bot.htm\", \"bot.php\", \"crawler\", \"deepscan\", \"duckduckbot\", \"facebookexternal\", \"facebookcatalog\", \"gptbot\", \"http://yandex.com/bots\", \"hubspot\", \"ia_archiver\", \"linkedinbot\", \"mj12bot\", \"msnbot\", \"nessus\", \"petalbot\", \"pinterest\", \"prerender\", \"rogerbot\", \"screaming frog\", \"semrushbot\", \"sitebulb\", \"slurp\", \"turnitin\", \"twitterbot\", \"vercelbot\", \"yahoo! slurp\", \"yandexbot\", \"Google-HotelAdsVerifier\", \"adsbot-google\", \"apis-google\", \"duplexweb-google\", \"feedfetcher-google\", \"google favicon\", \"google web preview\", \"google-read-aloud\", \"googlebot\", \"googleweblight\", \"mediapartners-google\", \"storebot-google\", \"Bytespider;\"],\n Dr = function (e, t) {\n if (!e) return !1;\n var n = e.toLowerCase();\n return Ar.concat(t || []).some(function (e) {\n var t = e.toLowerCase();\n return -1 !== n.indexOf(t);\n });\n },\n Lr = function () {\n function e() {\n i(this, e), this.clicks = [];\n }\n return s(e, [{\n key: \"isRageClick\",\n value: function (e, t, n) {\n var i = this.clicks[this.clicks.length - 1];\n if (i && Math.abs(e - i.x) + Math.abs(t - i.y) < 30 && n - i.timestamp < 1e3) {\n if (this.clicks.push({\n x: e,\n y: t,\n timestamp: n\n }), 3 === this.clicks.length) return !0;\n } else this.clicks = [{\n x: e,\n y: t,\n timestamp: n\n }];\n return !1;\n }\n }]), e;\n }();\nfunction qr(e) {\n var t;\n return e.id === Ne || !(null === (t = e.closest) || void 0 === t || !t.call(e, \"#\" + Ne));\n}\nvar Nr = function () {\n function e(t) {\n var n,\n r = this;\n i(this, e), o(this, \"rageclicks\", new Lr()), o(this, \"_enabledServerSide\", !1), o(this, \"_initialized\", !1), o(this, \"_flushInterval\", null), this.instance = t, this._enabledServerSide = !(null === (n = this.instance.persistence) || void 0 === n || !n.props[fe]), null == T || T.addEventListener(\"beforeunload\", function () {\n r.flush();\n });\n }\n return s(e, [{\n key: \"flushIntervalMilliseconds\",\n get: function () {\n var e = 5e3;\n return b(this.instance.config.capture_heatmaps) && this.instance.config.capture_heatmaps.flush_interval_milliseconds && (e = this.instance.config.capture_heatmaps.flush_interval_milliseconds), e;\n }\n }, {\n key: \"isEnabled\",\n get: function () {\n return w(this.instance.config.capture_heatmaps) ? w(this.instance.config.enable_heatmaps) ? this._enabledServerSide : this.instance.config.enable_heatmaps : !1 !== this.instance.config.capture_heatmaps;\n }\n }, {\n key: \"startIfEnabled\",\n value: function () {\n if (this.isEnabled) {\n if (this._initialized) return;\n G.info(\"[heatmaps] starting...\"), this._setupListeners(), this._flushInterval = setInterval(this.flush.bind(this), this.flushIntervalMilliseconds);\n } else {\n var e;\n clearInterval(null !== (e = this._flushInterval) && void 0 !== e ? e : void 0), this.getAndClearBuffer();\n }\n }\n }, {\n key: \"afterDecideResponse\",\n value: function (e) {\n var t = !!e.heatmaps;\n this.instance.persistence && this.instance.persistence.register(o({}, fe, t)), this._enabledServerSide = t, this.startIfEnabled();\n }\n }, {\n key: \"getAndClearBuffer\",\n value: function () {\n var e = this.buffer;\n return this.buffer = void 0, e;\n }\n }, {\n key: \"_setupListeners\",\n value: function () {\n var e = this;\n T && D && (oe(D, \"click\", function (t) {\n return e._onClick(t || (null == T ? void 0 : T.event));\n }, !1, !0), oe(D, \"mousemove\", function (t) {\n return e._onMouseMove(t || (null == T ? void 0 : T.event));\n }, !1, !0), this._initialized = !0);\n }\n }, {\n key: \"_getProperties\",\n value: function (e, t) {\n var n = this.instance.scrollManager.scrollY(),\n i = this.instance.scrollManager.scrollX(),\n r = this.instance.scrollManager.scrollElement(),\n s = function (e, t, n) {\n for (var i = e; i && !On(i, \"body\");) {\n if (i === n) return !1;\n if (Y(t, null == T ? void 0 : T.getComputedStyle(i).position)) return !0;\n i = Ln(i);\n }\n return !1;\n }(e.target, [\"fixed\", \"sticky\"], r);\n return {\n x: e.clientX + (s ? 0 : i),\n y: e.clientY + (s ? 0 : n),\n target_fixed: s,\n type: t\n };\n }\n }, {\n key: \"_onClick\",\n value: function (e) {\n var n;\n if (!qr(e.target)) {\n var i = this._getProperties(e, \"click\");\n null !== (n = this.rageclicks) && void 0 !== n && n.isRageClick(e.clientX, e.clientY, new Date().getTime()) && this._capture(t(t({}, i), {}, {\n type: \"rageclick\"\n })), this._capture(i);\n }\n }\n }, {\n key: \"_onMouseMove\",\n value: function (e) {\n var t = this;\n qr(e.target) || (clearTimeout(this._mouseMoveTimeout), this._mouseMoveTimeout = setTimeout(function () {\n t._capture(t._getProperties(e, \"mousemove\"));\n }, 500));\n }\n }, {\n key: \"_capture\",\n value: function (e) {\n if (T) {\n var t = T.location.href;\n this.buffer = this.buffer || {}, this.buffer[t] || (this.buffer[t] = []), this.buffer[t].push(e);\n }\n }\n }, {\n key: \"flush\",\n value: function () {\n this.buffer && !k(this.buffer) && this.instance.capture(\"$$heatmap\", {\n $heatmap_data: this.getAndClearBuffer()\n });\n }\n }]), e;\n }(),\n Br = function () {\n function e(t) {\n var n = this;\n i(this, e), o(this, \"_updateScrollData\", function () {\n var e, t, i, r;\n n.context || (n.context = {});\n var s = n.scrollElement(),\n o = n.scrollY(),\n a = s ? Math.max(0, s.scrollHeight - s.clientHeight) : 0,\n u = o + ((null == s ? void 0 : s.clientHeight) || 0),\n l = (null == s ? void 0 : s.scrollHeight) || 0;\n n.context.lastScrollY = Math.ceil(o), n.context.maxScrollY = Math.max(o, null !== (e = n.context.maxScrollY) && void 0 !== e ? e : 0), n.context.maxScrollHeight = Math.max(a, null !== (t = n.context.maxScrollHeight) && void 0 !== t ? t : 0), n.context.lastContentY = u, n.context.maxContentY = Math.max(u, null !== (i = n.context.maxContentY) && void 0 !== i ? i : 0), n.context.maxContentHeight = Math.max(l, null !== (r = n.context.maxContentHeight) && void 0 !== r ? r : 0);\n }), this.instance = t;\n }\n return s(e, [{\n key: \"getContext\",\n value: function () {\n return this.context;\n }\n }, {\n key: \"resetContext\",\n value: function () {\n var e = this.context;\n return setTimeout(this._updateScrollData, 0), e;\n }\n }, {\n key: \"startMeasuringScrollPosition\",\n value: function () {\n null == T || T.addEventListener(\"scroll\", this._updateScrollData, !0), null == T || T.addEventListener(\"scrollend\", this._updateScrollData, !0), null == T || T.addEventListener(\"resize\", this._updateScrollData);\n }\n }, {\n key: \"scrollElement\",\n value: function () {\n if (!this.instance.config.scroll_root_selector) return null == T ? void 0 : T.document.documentElement;\n var e,\n t = h(m(this.instance.config.scroll_root_selector) ? this.instance.config.scroll_root_selector : [this.instance.config.scroll_root_selector]);\n try {\n for (t.s(); !(e = t.n()).done;) {\n var n = e.value,\n i = null == T ? void 0 : T.document.querySelector(n);\n if (i) return i;\n }\n } catch (e) {\n t.e(e);\n } finally {\n t.f();\n }\n }\n }, {\n key: \"scrollY\",\n value: function () {\n if (this.instance.config.scroll_root_selector) {\n var e = this.scrollElement();\n return e && e.scrollTop || 0;\n }\n return T && (T.scrollY || T.pageYOffset || T.document.documentElement.scrollTop) || 0;\n }\n }, {\n key: \"scrollX\",\n value: function () {\n if (this.instance.config.scroll_root_selector) {\n var e = this.scrollElement();\n return e && e.scrollLeft || 0;\n }\n return T && (T.scrollX || T.pageXOffset || T.document.documentElement.scrollLeft) || 0;\n }\n }]), e;\n }(),\n Hr = \"$copy_autocapture\";\nfunction Ur(e, t) {\n return t.length > e ? t.slice(0, e) + \"...\" : t;\n}\nvar jr,\n Gr = function () {\n function e(t) {\n i(this, e), o(this, \"_initialized\", !1), o(this, \"_isDisabledServerSide\", null), o(this, \"rageclicks\", new Lr()), o(this, \"_elementsChainAsString\", !1), this.instance = t, this._elementSelectors = null;\n }\n return s(e, [{\n key: \"config\",\n get: function () {\n var e,\n t,\n n = b(this.instance.config.autocapture) ? this.instance.config.autocapture : {};\n return n.url_allowlist = null === (e = n.url_allowlist) || void 0 === e ? void 0 : e.map(function (e) {\n return new RegExp(e);\n }), n.url_ignorelist = null === (t = n.url_ignorelist) || void 0 === t ? void 0 : t.map(function (e) {\n return new RegExp(e);\n }), n;\n }\n }, {\n key: \"_addDomEventHandlers\",\n value: function () {\n var e = this;\n if (this.isBrowserSupported()) {\n if (T && D) {\n var t = function (t) {\n t = t || (null == T ? void 0 : T.event);\n try {\n e._captureEvent(t);\n } catch (e) {\n G.error(\"Failed to capture event\", e);\n }\n },\n n = function (t) {\n t = t || (null == T ? void 0 : T.event), e._captureEvent(t, Hr);\n };\n oe(D, \"submit\", t, !1, !0), oe(D, \"change\", t, !1, !0), oe(D, \"click\", t, !1, !0), this.config.capture_copied_text && (oe(D, \"copy\", n, !1, !0), oe(D, \"cut\", n, !1, !0));\n }\n } else G.info(\"Disabling Automatic Event Collection because this browser is not supported\");\n }\n }, {\n key: \"startIfEnabled\",\n value: function () {\n this.isEnabled && !this._initialized && (this._addDomEventHandlers(), this._initialized = !0);\n }\n }, {\n key: \"afterDecideResponse\",\n value: function (e) {\n e.elementsChainAsString && (this._elementsChainAsString = e.elementsChainAsString), this.instance.persistence && this.instance.persistence.register(o({}, he, !!e.autocapture_opt_out)), this._isDisabledServerSide = !!e.autocapture_opt_out, this.startIfEnabled();\n }\n }, {\n key: \"setElementSelectors\",\n value: function (e) {\n this._elementSelectors = e;\n }\n }, {\n key: \"getElementSelectors\",\n value: function (e) {\n var t,\n n = [];\n return null === (t = this._elementSelectors) || void 0 === t || t.forEach(function (t) {\n var i = null == D ? void 0 : D.querySelectorAll(t);\n null == i || i.forEach(function (i) {\n e === i && n.push(t);\n });\n }), n;\n }\n }, {\n key: \"isEnabled\",\n get: function () {\n var e,\n t,\n n = null === (e = this.instance.persistence) || void 0 === e ? void 0 : e.props[he],\n i = this._isDisabledServerSide;\n if (R(i) && !x(n) && !this.instance.config.advanced_disable_decide) return !1;\n var r = null !== (t = this._isDisabledServerSide) && void 0 !== t ? t : !!n;\n return !!this.instance.config.autocapture && !r;\n }\n }, {\n key: \"_previousElementSibling\",\n value: function (e) {\n if (e.previousElementSibling) return e.previousElementSibling;\n var t = e;\n do {\n t = t.previousSibling;\n } while (t && !$n(t));\n return t;\n }\n }, {\n key: \"_getAugmentPropertiesFromElement\",\n value: function (e) {\n if (!Nn(e)) return {};\n var t = {};\n return Q(e.attributes, function (e) {\n if (e.name && 0 === e.name.indexOf(\"data-ph-capture-attribute\")) {\n var n = e.name.replace(\"data-ph-capture-attribute-\", \"\"),\n i = e.value;\n n && i && Vn(i) && (t[n] = i);\n }\n }), t;\n }\n }, {\n key: \"_getPropertiesFromElement\",\n value: function (e, t, n) {\n var i,\n r = e.tagName.toLowerCase(),\n s = {\n tag_name: r\n };\n Dn.indexOf(r) > -1 && !n && (\"a\" === r.toLowerCase() || \"button\" === r.toLowerCase() ? s.$el_text = Ur(1024, Qn(e)) : s.$el_text = Ur(1024, Cn(e)));\n var o = Pn(e);\n o.length > 0 && (s.classes = o.filter(function (e) {\n return \"\" !== e;\n }));\n var a = null === (i = this.config) || void 0 === i ? void 0 : i.element_attribute_ignorelist;\n Q(e.attributes, function (n) {\n var i;\n if ((!Bn(e) || -1 !== [\"name\", \"id\", \"class\", \"aria-label\"].indexOf(n.name)) && (null == a || !a.includes(n.name)) && !t && Vn(n.value) && (i = n.name, !S(i) || \"_ngcontent\" !== i.substring(0, 10) && \"_nghost\" !== i.substring(0, 7))) {\n var r = n.value;\n \"class\" === n.name && (r = Fn(r).join(\" \")), s[\"attr__\" + n.name] = Ur(1024, r);\n }\n });\n for (var u = 1, l = 1, c = e; c = this._previousElementSibling(c);) u++, c.tagName === e.tagName && l++;\n return s.nth_child = u, s.nth_of_type = l, s;\n }\n }, {\n key: \"_getDefaultProperties\",\n value: function (e) {\n return {\n $event_type: e,\n $ce_version: 1\n };\n }\n }, {\n key: \"_getEventTarget\",\n value: function (e) {\n return w(e.target) ? e.srcElement || null : null !== (t = e.target) && void 0 !== t && t.shadowRoot ? e.composedPath()[0] || null : e.target || null;\n var t;\n }\n }, {\n key: \"_captureEvent\",\n value: function (e) {\n var t = this,\n n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : \"$autocapture\";\n if (this.isEnabled) {\n var i,\n r = this._getEventTarget(e);\n if (Mn(r) && (r = r.parentNode || null), \"$autocapture\" === n && \"click\" === e.type && e instanceof MouseEvent) this.instance.config.rageclick && null !== (i = this.rageclicks) && void 0 !== i && i.isRageClick(e.clientX, e.clientY, new Date().getTime()) && this._captureEvent(e, \"$rageclick\");\n var s = n === Hr;\n if (r && qn(r, e, this.config, s, s ? [\"copy\", \"cut\"] : void 0)) {\n for (var o, a, u = [r], l = r; l.parentNode && !On(l, \"body\");) An(l.parentNode) ? (u.push(l.parentNode.host), l = l.parentNode.host) : (u.push(l.parentNode), l = l.parentNode);\n var c,\n d,\n h = [],\n f = {},\n v = !1;\n if (Q(u, function (e) {\n var n = Nn(e);\n \"a\" === e.tagName.toLowerCase() && (c = e.getAttribute(\"href\"), c = n && Vn(c) && c), Y(Pn(e), \"ph-no-capture\") && (v = !0), h.push(t._getPropertiesFromElement(e, t.instance.config.mask_all_element_attributes, t.instance.config.mask_all_text));\n var i = t._getAugmentPropertiesFromElement(e);\n J(f, i);\n }), this.instance.config.mask_all_text || (\"a\" === r.tagName.toLowerCase() || \"button\" === r.tagName.toLowerCase() ? h[0].$el_text = Qn(r) : h[0].$el_text = Cn(r)), c) {\n var p, g;\n h[0].attr__href = c;\n var _ = null === (p = pt(c)) || void 0 === p ? void 0 : p.host,\n m = null == T || null === (g = T.location) || void 0 === g ? void 0 : g.host;\n _ && m && _ !== m && (d = c);\n }\n if (v) return !1;\n var y = J(this._getDefaultProperties(e.type), this._elementsChainAsString ? {\n $elements_chain: Yn(h)\n } : {\n $elements: h\n }, null !== (o = h[0]) && void 0 !== o && o.$el_text ? {\n $el_text: null === (a = h[0]) || void 0 === a ? void 0 : a.$el_text\n } : {}, d && \"click\" === e.type ? {\n $external_click_url: d\n } : {}, f),\n b = this.getElementSelectors(r);\n if (b && b.length > 0 && (y.$element_selectors = b), n === Hr) {\n var k,\n w = Tn(null == T || null === (k = T.getSelection()) || void 0 === k ? void 0 : k.toString()),\n S = e.type || \"clipboard\";\n if (!w) return !1;\n y.$selected_content = w, y.$copy_type = S;\n }\n return this.instance.capture(n, y), !0;\n }\n }\n }\n }, {\n key: \"isBrowserSupported\",\n value: function () {\n return y(null == D ? void 0 : D.querySelectorAll);\n }\n }]), e;\n }(),\n Wr = function () {\n function e(t) {\n var n = this;\n i(this, e), o(this, \"_restoreXHRPatch\", void 0), o(this, \"_restoreFetchPatch\", void 0), o(this, \"_startCapturing\", function () {\n w(n._restoreXHRPatch) && U.postHogTracingHeadersPatchFns._patchXHR(n.instance.sessionManager), w(n._restoreFetchPatch) && U.postHogTracingHeadersPatchFns._patchFetch(n.instance.sessionManager);\n }), this.instance = t;\n }\n return s(e, [{\n key: \"_loadScript\",\n value: function (e) {\n U.postHogTracingHeadersPatchFns && e(), this.instance.requestRouter.loadScript(\"/static/tracing-headers.js?v=\".concat(f.LIB_VERSION), function (t) {\n if (t) return G.error(\"[TRACING-HEADERS] failed to load script\", t);\n e();\n });\n }\n }, {\n key: \"startIfEnabledOrStop\",\n value: function () {\n var e, t;\n this.instance.config.__add_tracing_headers ? this._loadScript(this._startCapturing) : (null === (e = this._restoreXHRPatch) || void 0 === e || e.call(this), null === (t = this._restoreFetchPatch) || void 0 === t || t.call(this), this._restoreXHRPatch = void 0, this._restoreFetchPatch = void 0);\n }\n }]), e;\n }();\n!function (e) {\n e[e.PENDING = -1] = \"PENDING\", e[e.DENIED = 0] = \"DENIED\", e[e.GRANTED = 1] = \"GRANTED\";\n}(jr || (jr = {}));\nvar zr = function () {\n function e(t) {\n i(this, e), this.instance = t;\n }\n return s(e, [{\n key: \"config\",\n get: function () {\n return this.instance.config;\n }\n }, {\n key: \"consent\",\n get: function () {\n return this.getDnt() ? jr.DENIED : this.storedConsent;\n }\n }, {\n key: \"isOptedOut\",\n value: function () {\n return this.consent === jr.DENIED || this.consent === jr.PENDING && this.config.opt_out_capturing_by_default;\n }\n }, {\n key: \"isOptedIn\",\n value: function () {\n return !this.isOptedOut();\n }\n }, {\n key: \"optInOut\",\n value: function (e) {\n this.storage.set(this.storageKey, e ? 1 : 0, this.config.cookie_expiration, this.config.cross_subdomain_cookie, this.config.secure_cookie);\n }\n }, {\n key: \"reset\",\n value: function () {\n this.storage.remove(this.storageKey, this.config.cross_subdomain_cookie);\n }\n }, {\n key: \"storageKey\",\n get: function () {\n var e = this.instance.config,\n t = e.token;\n return (e.opt_out_capturing_cookie_prefix || \"__ph_opt_in_out_\") + t;\n }\n }, {\n key: \"storedConsent\",\n get: function () {\n var e = this.storage.get(this.storageKey);\n return \"1\" === e ? jr.GRANTED : \"0\" === e ? jr.DENIED : jr.PENDING;\n }\n }, {\n key: \"storage\",\n get: function () {\n if (!this._storage) {\n var e = this.config.opt_out_capturing_persistence_type;\n this._storage = \"localStorage\" === e ? at : st;\n var t = \"localStorage\" === e ? st : at;\n t.get(this.storageKey) && (this._storage.get(this.storageKey) || this.optInOut(\"1\" === t.get(this.storageKey)), t.remove(this.storageKey, this.config.cross_subdomain_cookie));\n }\n return this._storage;\n }\n }, {\n key: \"getDnt\",\n value: function () {\n return !!this.config.respect_dnt && !!ae([null == A ? void 0 : A.doNotTrack, null == A ? void 0 : A.msDoNotTrack, U.doNotTrack], function (e) {\n return Y([!0, 1, \"1\", \"yes\"], e);\n });\n }\n }]), e;\n }(),\n Vr = 9e5,\n Qr = \"[Web Vitals]\",\n Jr = function () {\n function e(n) {\n var r,\n s = this;\n i(this, e), o(this, \"_enabledServerSide\", !1), o(this, \"_initialized\", !1), o(this, \"buffer\", {\n url: void 0,\n metrics: [],\n firstMetricTimestamp: void 0\n }), o(this, \"_flushToCapture\", function () {\n clearTimeout(s._delayedFlushTimer), 0 !== s.buffer.metrics.length && (s.instance.capture(\"$web_vitals\", s.buffer.metrics.reduce(function (e, n) {\n var i;\n return t(t({}, e), {}, (o(i = {}, \"$web_vitals_\".concat(n.name, \"_event\"), t({}, n)), o(i, \"$web_vitals_\".concat(n.name, \"_value\"), n.value), i));\n }, {})), s.buffer = {\n url: void 0,\n metrics: [],\n firstMetricTimestamp: void 0\n });\n }), o(this, \"_addToBuffer\", function (e) {\n var n,\n i = null === (n = s.instance.sessionManager) || void 0 === n ? void 0 : n.checkAndGetSessionAndWindowId(!0);\n if (w(i)) G.error(Qr + \"Could not read session ID. Dropping metrics!\");else {\n s.buffer = s.buffer || {};\n var r = s._currentURL();\n if (!w(r)) if (I(null == e ? void 0 : e.name) || I(null == e ? void 0 : e.value)) G.error(Qr + \"Invalid metric received\", e);else if (s._maxAllowedValue && e.value >= s._maxAllowedValue) G.error(Qr + \"Ignoring metric with value >= \" + s._maxAllowedValue, e);else s.buffer.url !== r && (s._flushToCapture(), s._delayedFlushTimer = setTimeout(s._flushToCapture, 8e3)), w(s.buffer.url) && (s.buffer.url = r), s.buffer.firstMetricTimestamp = w(s.buffer.firstMetricTimestamp) ? Date.now() : s.buffer.firstMetricTimestamp, s.buffer.metrics.push(t(t({}, e), {}, {\n $current_url: r,\n $session_id: i.sessionId,\n $window_id: i.windowId,\n timestamp: Date.now()\n })), 4 === s.buffer.metrics.length && s._flushToCapture();\n }\n }), o(this, \"_startCapturing\", function () {\n var e = U.postHogWebVitalsCallbacks,\n t = e.onLCP,\n n = e.onCLS,\n i = e.onFCP,\n r = e.onINP;\n t && n && i && r ? (t(s._addToBuffer), n(s._addToBuffer), i(s._addToBuffer), r(s._addToBuffer), s._initialized = !0) : G.error(Qr + \"web vitals callbacks not loaded - not starting\");\n }), this.instance = n, this._enabledServerSide = !(null === (r = this.instance.persistence) || void 0 === r || !r.props[ge]), this.startIfEnabled();\n }\n return s(e, [{\n key: \"_maxAllowedValue\",\n get: function () {\n var e = b(this.instance.config.capture_performance) && F(this.instance.config.capture_performance.__web_vitals_max_value) ? this.instance.config.capture_performance.__web_vitals_max_value : Vr;\n return 0 < e && e <= 6e4 ? Vr : e;\n }\n }, {\n key: \"isEnabled\",\n get: function () {\n var e = b(this.instance.config.capture_performance) ? this.instance.config.capture_performance.web_vitals : void 0;\n return x(e) ? e : this._enabledServerSide;\n }\n }, {\n key: \"startIfEnabled\",\n value: function () {\n this.isEnabled && !this._initialized && (G.info(Qr + \" enabled, starting...\"), this.loadScript(this._startCapturing));\n }\n }, {\n key: \"afterDecideResponse\",\n value: function (e) {\n var t = b(e.capturePerformance) && !!e.capturePerformance.web_vitals;\n this.instance.persistence && this.instance.persistence.register(o({}, ge, t)), this._enabledServerSide = t, this.startIfEnabled();\n }\n }, {\n key: \"loadScript\",\n value: function (e) {\n T.postHogWebVitalsCallbacks && e(), this.instance.requestRouter.loadScript(this.instance.requestRouter.endpointFor(\"assets\", \"/static/web-vitals.js?v=\".concat(f.LIB_VERSION)), function (t) {\n t ? G.error(Qr + \" failed to load script\", t) : e();\n });\n }\n }, {\n key: \"_currentURL\",\n value: function () {\n var e = T ? T.location.href : void 0;\n return e || G.error(Qr + \"Could not determine current URL\"), e;\n }\n }]), e;\n }(),\n Yr = {},\n Xr = function () {},\n Kr = \"posthog\",\n Zr = !tr && -1 === (null == H ? void 0 : H.indexOf(\"MSIE\")) && -1 === (null == H ? void 0 : H.indexOf(\"Mozilla\")),\n es = function () {\n var e, t, n;\n return {\n api_host: \"https://us.i.posthog.com\",\n ui_host: null,\n token: \"\",\n autocapture: !0,\n rageclick: !0,\n cross_subdomain_cookie: (t = null == D ? void 0 : D.location, n = null == t ? void 0 : t.hostname, !!S(n) && \"herokuapp.com\" !== n.split(\".\").slice(-2).join(\".\")),\n persistence: \"localStorage+cookie\",\n persistence_name: \"\",\n loaded: Xr,\n store_google: !0,\n custom_campaign_params: [],\n custom_blocked_useragents: [],\n save_referrer: !0,\n capture_pageview: !0,\n capture_pageleave: \"if_capture_pageview\",\n debug: L && S(null == L ? void 0 : L.search) && -1 !== L.search.indexOf(\"__posthog_debug=true\") || !1,\n verbose: !1,\n cookie_expiration: 365,\n upgrade: !1,\n disable_session_recording: !1,\n disable_persistence: !1,\n disable_surveys: !1,\n enable_recording_console_log: void 0,\n secure_cookie: \"https:\" === (null == T || null === (e = T.location) || void 0 === e ? void 0 : e.protocol),\n ip: !0,\n opt_out_capturing_by_default: !1,\n opt_out_persistence_by_default: !1,\n opt_out_useragent_filter: !1,\n opt_out_capturing_persistence_type: \"localStorage\",\n opt_out_capturing_cookie_prefix: null,\n opt_in_site_apps: !1,\n property_denylist: [],\n respect_dnt: !1,\n sanitize_properties: null,\n request_headers: {},\n inapp_protocol: \"//\",\n inapp_link_new_window: !1,\n request_batching: !0,\n properties_string_max_length: 65535,\n session_recording: {},\n mask_all_element_attributes: !1,\n mask_all_text: !1,\n advanced_disable_decide: !1,\n advanced_disable_feature_flags: !1,\n advanced_disable_feature_flags_on_first_load: !1,\n advanced_disable_toolbar_metrics: !1,\n feature_flag_request_timeout_ms: 3e3,\n on_request_error: function (e) {\n var t = \"Bad HTTP status: \" + e.statusCode + \" \" + e.text;\n G.error(t);\n },\n get_device_id: function (e) {\n return e;\n },\n _onCapture: Xr,\n capture_performance: void 0,\n name: \"posthog\",\n bootstrap: {},\n disable_compression: !1,\n session_idle_timeout_seconds: 1800,\n person_profiles: \"always\",\n __add_tracing_headers: !1\n };\n },\n ts = function (e) {\n var t = {};\n w(e.process_person) || (t.person_profiles = e.process_person), w(e.xhr_headers) || (t.request_headers = e.xhr_headers), w(e.cookie_name) || (t.persistence_name = e.cookie_name), w(e.disable_cookie) || (t.disable_persistence = e.disable_cookie);\n var n = J({}, t, e);\n return m(e.property_blacklist) && (w(e.property_denylist) ? n.property_denylist = e.property_blacklist : m(e.property_denylist) ? n.property_denylist = [].concat(l(e.property_blacklist), l(e.property_denylist)) : G.error(\"Invalid value for property_denylist config: \" + e.property_denylist)), n;\n },\n ns = function () {\n function e() {\n i(this, e), o(this, \"__forceAllowLocalhost\", !1);\n }\n return s(e, [{\n key: \"_forceAllowLocalhost\",\n get: function () {\n return this.__forceAllowLocalhost;\n },\n set: function (e) {\n G.error(\"WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`\"), this.__forceAllowLocalhost = e;\n }\n }]), e;\n }(),\n is = function () {\n function e() {\n var t = this;\n i(this, e), o(this, \"webPerformance\", new ns()), o(this, \"_internalEventEmitter\", new Ir()), this.config = es(), this.decideEndpointWasHit = !1, this.SentryIntegration = yr, this.sentryIntegration = function (e) {\n return function (e, t) {\n var n = mr(e, t);\n return {\n name: _r,\n processEvent: function (e) {\n return n(e);\n }\n };\n }(t, e);\n }, this.__request_queue = [], this.__loaded = !1, this.analyticsDefaultEndpoint = \"/e/\", this.featureFlags = new We(this), this.toolbar = new mi(this), this.scrollManager = new Br(this), this.pageViewManager = new Er(this), this.surveys = new Cr(this), this.rateLimiter = new $r(this), this.requestRouter = new fr(this), this.consent = new zr(this), this.people = {\n set: function (e, n, i) {\n var r = S(e) ? o({}, e, n) : e;\n t.setPersonProperties(r), null == i || i({});\n },\n set_once: function (e, n, i) {\n var r = S(e) ? o({}, e, n) : e;\n t.setPersonProperties(void 0, r), null == i || i({});\n }\n }, this.on(\"eventCaptured\", function (e) {\n return G.info(\"send\", e);\n });\n }\n return s(e, [{\n key: \"init\",\n value: function (t, n, i) {\n if (i && i !== Kr) {\n var r,\n s = null !== (r = Yr[i]) && void 0 !== r ? r : new e();\n return s._init(t, n, i), Yr[i] = s, Yr[Kr][i] = s, s;\n }\n return this._init(t, n, i);\n }\n }, {\n key: \"_init\",\n value: function (e) {\n var n,\n i,\n r = this,\n s = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\n o = arguments.length > 2 ? arguments[2] : void 0;\n if (w(e) || E(e)) return G.critical(\"PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()\"), this;\n if (this.__loaded) return G.warn(\"You have already initialized PostHog! Re-initializing is a no-op\"), this;\n this.__loaded = !0, this.config = {}, this._triggered_notifs = [], this.set_config(J({}, es(), ts(s), {\n name: o,\n token: e\n })), this.config.on_xhr_error && G.error(\"[posthog] on_xhr_error is deprecated. Use on_request_error instead\"), this.compression = s.disable_compression ? void 0 : re.Base64, this.persistence = new bn(this.config), this.sessionPersistence = \"sessionStorage\" === this.config.persistence ? this.persistence : new bn(t(t({}, this.config), {}, {\n persistence: \"sessionStorage\"\n }));\n var a = t({}, this.persistence.props),\n u = t({}, this.sessionPersistence.props);\n if (this._requestQueue = new yi(function (e) {\n return r._send_retriable_request(e);\n }), this._retryQueue = new lr(this), this.__request_queue = [], this.sessionManager = new dr(this.config, this.persistence), this.sessionPropsManager = new Mr(this.sessionManager, this.persistence), new Wr(this).startIfEnabledOrStop(), this.sessionRecording = new vi(this), this.sessionRecording.startIfEnabledOrStop(), this.config.disable_scroll_properties || this.scrollManager.startMeasuringScrollPosition(), this.autocapture = new Gr(this), this.autocapture.startIfEnabled(), this.surveys.loadIfEnabled(), this.heatmaps = new Nr(this), this.heatmaps.startIfEnabled(), this.webVitalsAutocapture = new Jr(this), this.exceptionObserver = new gr(this), this.exceptionObserver.startIfEnabled(), f.DEBUG = f.DEBUG || this.config.debug, f.DEBUG && G.info(\"Starting in debug mode\", {\n this: this,\n config: s,\n thisC: t({}, this.config),\n p: a,\n s: u\n }), this._sync_opt_out_with_persistence(), void 0 !== (null === (n = s.bootstrap) || void 0 === n ? void 0 : n.distinctID)) {\n var l,\n c,\n d = this.config.get_device_id(Ke()),\n h = null !== (l = s.bootstrap) && void 0 !== l && l.isIdentifiedID ? d : s.bootstrap.distinctID;\n this.persistence.set_property($e, null !== (c = s.bootstrap) && void 0 !== c && c.isIdentifiedID ? \"identified\" : \"anonymous\"), this.register({\n distinct_id: s.bootstrap.distinctID,\n $device_id: h\n });\n }\n if (this._hasBootstrappedFeatureFlags()) {\n var v,\n p,\n g = Object.keys((null === (v = s.bootstrap) || void 0 === v ? void 0 : v.featureFlags) || {}).filter(function (e) {\n var t, n;\n return !(null === (t = s.bootstrap) || void 0 === t || null === (n = t.featureFlags) || void 0 === n || !n[e]);\n }).reduce(function (e, t) {\n var n, i;\n return e[t] = (null === (n = s.bootstrap) || void 0 === n || null === (i = n.featureFlags) || void 0 === i ? void 0 : i[t]) || !1, e;\n }, {}),\n _ = Object.keys((null === (p = s.bootstrap) || void 0 === p ? void 0 : p.featureFlagPayloads) || {}).filter(function (e) {\n return g[e];\n }).reduce(function (e, t) {\n var n, i, r, o;\n null !== (n = s.bootstrap) && void 0 !== n && null !== (i = n.featureFlagPayloads) && void 0 !== i && i[t] && (e[t] = null === (r = s.bootstrap) || void 0 === r || null === (o = r.featureFlagPayloads) || void 0 === o ? void 0 : o[t]);\n return e;\n }, {});\n this.featureFlags.receivedFeatureFlags({\n featureFlags: g,\n featureFlagPayloads: _\n });\n }\n if (!this.get_distinct_id()) {\n var m = this.config.get_device_id(Ke());\n this.register_once({\n distinct_id: m,\n $device_id: m\n }, \"\"), this.persistence.set_property($e, \"anonymous\");\n }\n return null == T || null === (i = T.addEventListener) || void 0 === i || i.call(T, \"onpagehide\" in self ? \"pagehide\" : \"unload\", this._handle_unload.bind(this)), this.toolbar.maybeLoadToolbar(), s.segment ? br(this, function () {\n return r._loaded();\n }) : this._loaded(), y(this.config._onCapture) && this.on(\"eventCaptured\", function (e) {\n return r.config._onCapture(e.event, e);\n }), this;\n }\n }, {\n key: \"_afterDecideResponse\",\n value: function (e) {\n var t, n, i, r, s, o, a;\n this.compression = void 0, e.supportedCompression && !this.config.disable_compression && (this.compression = Y(e.supportedCompression, re.GZipJS) ? re.GZipJS : Y(e.supportedCompression, re.Base64) ? re.Base64 : void 0), null !== (t = e.analytics) && void 0 !== t && t.endpoint && (this.analyticsDefaultEndpoint = e.analytics.endpoint), null === (n = this.sessionRecording) || void 0 === n || n.afterDecideResponse(e), null === (i = this.autocapture) || void 0 === i || i.afterDecideResponse(e), null === (r = this.heatmaps) || void 0 === r || r.afterDecideResponse(e), null === (s = this.surveys) || void 0 === s || s.afterDecideResponse(e), null === (o = this.webVitalsAutocapture) || void 0 === o || o.afterDecideResponse(e), null === (a = this.exceptionObserver) || void 0 === a || a.afterDecideResponse(e);\n }\n }, {\n key: \"_loaded\",\n value: function () {\n var e = this,\n t = this.config.advanced_disable_decide;\n t || this.featureFlags.setReloadingPaused(!0);\n try {\n this.config.loaded(this);\n } catch (e) {\n G.critical(\"`loaded` function failed\", e);\n }\n this._start_queue_if_opted_in(), this.config.capture_pageview && setTimeout(function () {\n D && e.capture(\"$pageview\", {\n title: D.title\n }, {\n send_instantly: !0\n });\n }, 1), t || (new pi(this).call(), this.featureFlags.resetRequestQueue());\n }\n }, {\n key: \"_start_queue_if_opted_in\",\n value: function () {\n var e;\n this.has_opted_out_capturing() || this.config.request_batching && (null === (e = this._requestQueue) || void 0 === e || e.enable());\n }\n }, {\n key: \"_dom_loaded\",\n value: function () {\n var e = this;\n this.has_opted_out_capturing() || V(this.__request_queue, function (t) {\n return e._send_retriable_request(t);\n }), this.__request_queue = [], this._start_queue_if_opted_in();\n }\n }, {\n key: \"_handle_unload\",\n value: function () {\n var e, t;\n this.config.request_batching ? (this._shouldCapturePageleave() && this.capture(\"$pageleave\"), null === (e = this._requestQueue) || void 0 === e || e.unload(), null === (t = this._retryQueue) || void 0 === t || t.unload()) : this._shouldCapturePageleave() && this.capture(\"$pageleave\", null, {\n transport: \"sendBeacon\"\n });\n }\n }, {\n key: \"_send_request\",\n value: function (e) {\n var n = this;\n this.__loaded && (Zr ? this.__request_queue.push(e) : this.rateLimiter.isServerRateLimited(e.batchKey) || (e.transport = e.transport || this.config.api_transport, e.url = ir(e.url, {\n ip: this.config.ip ? 1 : 0\n }), e.headers = this.config.request_headers, e.compression = \"best-available\" === e.compression ? this.compression : e.compression, function (e) {\n var n,\n i,\n r,\n s = t({}, e);\n s.timeout = s.timeout || 6e4, s.url = ir(s.url, {\n _: new Date().getTime().toString(),\n ver: f.LIB_VERSION,\n compression: s.compression\n });\n var o = null !== (n = s.transport) && void 0 !== n ? n : \"XHR\",\n a = null !== (i = null === (r = ae(or, function (e) {\n return e.transport === o;\n })) || void 0 === r ? void 0 : r.method) && void 0 !== i ? i : or[0].method;\n if (!a) throw new Error(\"No available transport method\");\n a(s);\n }(t(t({}, e), {}, {\n callback: function (t) {\n var i, r, s;\n (n.rateLimiter.checkForLimiting(t), t.statusCode >= 400) && (null === (r = (s = n.config).on_request_error) || void 0 === r || r.call(s, t));\n null === (i = e.callback) || void 0 === i || i.call(e, t);\n }\n }))));\n }\n }, {\n key: \"_send_retriable_request\",\n value: function (e) {\n this._retryQueue ? this._retryQueue.retriableRequest(e) : this._send_request(e);\n }\n }, {\n key: \"_execute_array\",\n value: function (e) {\n var t,\n n = this,\n i = [],\n r = [],\n s = [];\n V(e, function (e) {\n e && (t = e[0], m(t) ? s.push(e) : y(e) ? e.call(n) : m(e) && \"alias\" === t ? i.push(e) : m(e) && -1 !== t.indexOf(\"capture\") && y(n[t]) ? s.push(e) : r.push(e));\n });\n var o = function (e, t) {\n V(e, function (e) {\n if (m(e[0])) {\n var n = t;\n Q(e, function (e) {\n n = n[e[0]].apply(n, e.slice(1));\n });\n } else this[e[0]].apply(this, e.slice(1));\n }, t);\n };\n o(i, this), o(r, this), o(s, this);\n }\n }, {\n key: \"_hasBootstrappedFeatureFlags\",\n value: function () {\n var e, t;\n return (null === (e = this.config.bootstrap) || void 0 === e ? void 0 : e.featureFlags) && Object.keys(null === (t = this.config.bootstrap) || void 0 === t ? void 0 : t.featureFlags).length > 0 || !1;\n }\n }, {\n key: \"push\",\n value: function (e) {\n this._execute_array([e]);\n }\n }, {\n key: \"capture\",\n value: function (e, n, i) {\n var r;\n if (!(this.__loaded && this.persistence && this.sessionPersistence && this._requestQueue)) return G.uninitializedWarning(\"posthog.capture\");\n if (!this.consent.isOptedOut()) if (!w(e) && S(e)) {\n if (!H || this.config.opt_out_useragent_filter || !Dr(H, this.config.custom_blocked_useragents)) {\n var s = null != i && i.skip_client_rate_limiting ? void 0 : this.rateLimiter.clientRateLimitContext();\n if (null == s || !s.isRateLimited) {\n this.sessionPersistence.update_search_keyword(), this.config.store_google && this.sessionPersistence.update_campaign_params(), this.config.save_referrer && this.sessionPersistence.update_referrer_info(), (this.config.store_google || this.config.save_referrer) && this.persistence.set_initial_person_info();\n var o = {\n uuid: Ke(),\n event: e,\n properties: this._calculate_event_properties(e, n || {})\n };\n s && (o.properties.$lib_rate_limit_remaining_tokens = s.remainingTokens), (null == i ? void 0 : i.$set) && (o.$set = null == i ? void 0 : i.$set);\n var a = this._calculate_set_once_properties(null == i ? void 0 : i.$set_once);\n a && (o.$set_once = a), (o = ie(o, null != i && i._noTruncate ? null : this.config.properties_string_max_length)).timestamp = (null == i ? void 0 : i.timestamp) || new Date(), w(null == i ? void 0 : i.timestamp) || (o.properties.$event_time_override_provided = !0, o.properties.$event_time_override_system_time = new Date());\n var u = t(t({}, o.properties.$set), o.$set);\n k(u) || this.setPersonPropertiesForFlags(u), this._internalEventEmitter.emit(\"eventCaptured\", o);\n var l = {\n method: \"POST\",\n url: null !== (r = null == i ? void 0 : i._url) && void 0 !== r ? r : this.requestRouter.endpointFor(\"api\", this.analyticsDefaultEndpoint),\n data: o,\n compression: \"best-available\",\n batchKey: null == i ? void 0 : i._batchKey\n };\n return !this.config.request_batching || i && (null == i || !i._batchKey) || null != i && i.send_instantly ? this._send_retriable_request(l) : this._requestQueue.enqueue(l), o;\n }\n G.critical(\"This capture call is ignored due to client rate limiting.\");\n }\n } else G.error(\"No event name provided to posthog.capture\");\n }\n }, {\n key: \"_addCaptureHook\",\n value: function (e) {\n this.on(\"eventCaptured\", function (t) {\n return e(t.event, t);\n });\n }\n }, {\n key: \"_calculate_event_properties\",\n value: function (e, n) {\n if (!this.persistence || !this.sessionPersistence) return n;\n var i = this.persistence.remove_event_timer(e),\n r = t({}, n);\n if (r.token = this.config.token, \"$snapshot\" === e) {\n var s = t(t({}, this.persistence.properties()), this.sessionPersistence.properties());\n return r.distinct_id = s.distinct_id, (!S(r.distinct_id) && !F(r.distinct_id) || E(r.distinct_id)) && G.error(\"Invalid distinct_id for replay event. This indicates a bug in your implementation\"), r;\n }\n var o = mn.properties();\n if (this.sessionManager) {\n var a = this.sessionManager.checkAndGetSessionAndWindowId(),\n u = a.sessionId,\n l = a.windowId;\n r.$session_id = u, r.$window_id = l;\n }\n if (this.requestRouter.region === ur.CUSTOM && (r.$lib_custom_api_host = this.config.api_host), this.sessionPropsManager && this.config.__preview_send_client_session_params && (\"$pageview\" === e || \"$pageleave\" === e || \"$autocapture\" === e)) {\n var c = this.sessionPropsManager.getSessionProps();\n r = J(r, c);\n }\n if (!this.config.disable_scroll_properties) {\n var d = {};\n \"$pageview\" === e ? d = this.pageViewManager.doPageView() : \"$pageleave\" === e && (d = this.pageViewManager.doPageLeave()), r = J(r, d);\n }\n if (\"$pageview\" === e && D && (r.title = D.title), !w(i)) {\n var h = new Date().getTime() - i;\n r.$duration = parseFloat((h / 1e3).toFixed(3));\n }\n H && this.config.opt_out_useragent_filter && (r.$browser_type = Dr(H, this.config.custom_blocked_useragents) ? \"bot\" : \"browser\"), (r = J({}, o, this.persistence.properties(), this.sessionPersistence.properties(), r)).$is_identified = this._isIdentified(), m(this.config.property_denylist) ? Q(this.config.property_denylist, function (e) {\n delete r[e];\n }) : G.error(\"Invalid value for property_denylist config: \" + this.config.property_denylist + \" or property_blacklist config: \" + this.config.property_blacklist);\n var f = this.config.sanitize_properties;\n return f && (r = f(r, e)), r.$process_person_profile = this._hasPersonProcessing(), r;\n }\n }, {\n key: \"_calculate_set_once_properties\",\n value: function (e) {\n if (!this.persistence || !this._hasPersonProcessing()) return e;\n var t = J({}, this.persistence.get_initial_props(), e || {});\n return k(t) ? void 0 : t;\n }\n }, {\n key: \"register\",\n value: function (e, t) {\n var n;\n null === (n = this.persistence) || void 0 === n || n.register(e, t);\n }\n }, {\n key: \"register_once\",\n value: function (e, t, n) {\n var i;\n null === (i = this.persistence) || void 0 === i || i.register_once(e, t, n);\n }\n }, {\n key: \"register_for_session\",\n value: function (e) {\n var t;\n null === (t = this.sessionPersistence) || void 0 === t || t.register(e);\n }\n }, {\n key: \"unregister\",\n value: function (e) {\n var t;\n null === (t = this.persistence) || void 0 === t || t.unregister(e);\n }\n }, {\n key: \"unregister_for_session\",\n value: function (e) {\n var t;\n null === (t = this.sessionPersistence) || void 0 === t || t.unregister(e);\n }\n }, {\n key: \"_register_single\",\n value: function (e, t) {\n this.register(o({}, e, t));\n }\n }, {\n key: \"getFeatureFlag\",\n value: function (e, t) {\n return this.featureFlags.getFeatureFlag(e, t);\n }\n }, {\n key: \"getFeatureFlagPayload\",\n value: function (e) {\n var t = this.featureFlags.getFeatureFlagPayload(e);\n try {\n return JSON.parse(t);\n } catch (e) {\n return t;\n }\n }\n }, {\n key: \"isFeatureEnabled\",\n value: function (e, t) {\n return this.featureFlags.isFeatureEnabled(e, t);\n }\n }, {\n key: \"reloadFeatureFlags\",\n value: function () {\n this.featureFlags.reloadFeatureFlags();\n }\n }, {\n key: \"updateEarlyAccessFeatureEnrollment\",\n value: function (e, t) {\n this.featureFlags.updateEarlyAccessFeatureEnrollment(e, t);\n }\n }, {\n key: \"getEarlyAccessFeatures\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n return this.featureFlags.getEarlyAccessFeatures(e, t);\n }\n }, {\n key: \"on\",\n value: function (e, t) {\n return this._internalEventEmitter.on(e, t);\n }\n }, {\n key: \"onFeatureFlags\",\n value: function (e) {\n return this.featureFlags.onFeatureFlags(e);\n }\n }, {\n key: \"onSessionId\",\n value: function (e) {\n var t, n;\n return null !== (t = null === (n = this.sessionManager) || void 0 === n ? void 0 : n.onSessionId(e)) && void 0 !== t ? t : function () {};\n }\n }, {\n key: \"getSurveys\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n this.surveys.getSurveys(e, t);\n }\n }, {\n key: \"getActiveMatchingSurveys\",\n value: function (e) {\n var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];\n this.surveys.getActiveMatchingSurveys(e, t);\n }\n }, {\n key: \"renderSurvey\",\n value: function (e, t) {\n this.surveys.renderSurvey(e, t);\n }\n }, {\n key: \"canRenderSurvey\",\n value: function (e) {\n this.surveys.canRenderSurvey(e);\n }\n }, {\n key: \"getNextSurveyStep\",\n value: function (e, t, n) {\n return this.surveys.getNextSurveyStep(e, t, n);\n }\n }, {\n key: \"identify\",\n value: function (e, t, n) {\n if (!this.__loaded || !this.persistence) return G.uninitializedWarning(\"posthog.identify\");\n if (F(e) && (e = e.toString(), G.warn(\"The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.\")), e) {\n if ([\"distinct_id\", \"distinctid\"].includes(e.toLowerCase())) G.critical('The string \"'.concat(e, '\" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if (this._requirePersonProcessing(\"posthog.identify\")) {\n var i = this.get_distinct_id();\n if (this.register({\n $user_id: e\n }), !this.get_property(\"$device_id\")) {\n var r = i;\n this.register_once({\n $had_persisted_distinct_id: !0,\n $device_id: r\n }, \"\");\n }\n e !== i && e !== this.get_property(ce) && (this.unregister(ce), this.register({\n distinct_id: e\n }));\n var s = \"anonymous\" === (this.persistence.get_property($e) || \"anonymous\");\n e !== i && s ? (this.persistence.set_property($e, \"identified\"), this.setPersonPropertiesForFlags(t || {}, !1), this.capture(\"$identify\", {\n distinct_id: e,\n $anon_distinct_id: i\n }, {\n $set: t || {},\n $set_once: n || {}\n }), this.featureFlags.setAnonymousDistinctId(i)) : (t || n) && this.setPersonProperties(t, n), e !== i && (this.reloadFeatureFlags(), this.unregister(Ce));\n }\n } else G.error(\"Unique user id has not been set in posthog.identify\");\n }\n }, {\n key: \"setPersonProperties\",\n value: function (e, t) {\n (e || t) && this._requirePersonProcessing(\"posthog.setPersonProperties\") && (this.setPersonPropertiesForFlags(e || {}), this.capture(\"$set\", {\n $set: e || {},\n $set_once: t || {}\n }));\n }\n }, {\n key: \"group\",\n value: function (e, n, i) {\n if (e && n) {\n if (this._requirePersonProcessing(\"posthog.group\")) {\n var r = this.getGroups();\n r[e] !== n && this.resetGroupPropertiesForFlags(e), this.register({\n $groups: t(t({}, r), {}, o({}, e, n))\n }), i && (this.capture(\"$groupidentify\", {\n $group_type: e,\n $group_key: n,\n $group_set: i\n }), this.setGroupPropertiesForFlags(o({}, e, i))), r[e] === n || i || this.reloadFeatureFlags();\n }\n } else G.error(\"posthog.group requires a group type and group key\");\n }\n }, {\n key: \"resetGroups\",\n value: function () {\n this.register({\n $groups: {}\n }), this.resetGroupPropertiesForFlags(), this.reloadFeatureFlags();\n }\n }, {\n key: \"setPersonPropertiesForFlags\",\n value: function (e) {\n var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];\n this._requirePersonProcessing(\"posthog.setPersonPropertiesForFlags\") && this.featureFlags.setPersonPropertiesForFlags(e, t);\n }\n }, {\n key: \"resetPersonPropertiesForFlags\",\n value: function () {\n this.featureFlags.resetPersonPropertiesForFlags();\n }\n }, {\n key: \"setGroupPropertiesForFlags\",\n value: function (e) {\n var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];\n this._requirePersonProcessing(\"posthog.setGroupPropertiesForFlags\") && this.featureFlags.setGroupPropertiesForFlags(e, t);\n }\n }, {\n key: \"resetGroupPropertiesForFlags\",\n value: function (e) {\n this.featureFlags.resetGroupPropertiesForFlags(e);\n }\n }, {\n key: \"reset\",\n value: function (e) {\n var t, n, i, r;\n if (G.info(\"reset\"), !this.__loaded) return G.uninitializedWarning(\"posthog.reset\");\n var s = this.get_property(\"$device_id\");\n this.consent.reset(), null === (t = this.persistence) || void 0 === t || t.clear(), null === (n = this.sessionPersistence) || void 0 === n || n.clear(), null === (i = this.persistence) || void 0 === i || i.set_property($e, \"anonymous\"), null === (r = this.sessionManager) || void 0 === r || r.resetSessionId();\n var o = this.config.get_device_id(Ke());\n this.register_once({\n distinct_id: o,\n $device_id: e ? o : s\n }, \"\");\n }\n }, {\n key: \"get_distinct_id\",\n value: function () {\n return this.get_property(\"distinct_id\");\n }\n }, {\n key: \"getGroups\",\n value: function () {\n return this.get_property(\"$groups\") || {};\n }\n }, {\n key: \"get_session_id\",\n value: function () {\n var e, t;\n return null !== (e = null === (t = this.sessionManager) || void 0 === t ? void 0 : t.checkAndGetSessionAndWindowId(!0).sessionId) && void 0 !== e ? e : \"\";\n }\n }, {\n key: \"get_session_replay_url\",\n value: function (e) {\n if (!this.sessionManager) return \"\";\n var t = this.sessionManager.checkAndGetSessionAndWindowId(!0),\n n = t.sessionId,\n i = t.sessionStartTimestamp,\n r = this.requestRouter.endpointFor(\"ui\", \"/project/\".concat(this.config.token, \"/replay/\").concat(n));\n if (null != e && e.withTimestamp && i) {\n var s,\n o = null !== (s = e.timestampLookBack) && void 0 !== s ? s : 10;\n if (!i) return r;\n var a = Math.max(Math.floor((new Date().getTime() - i) / 1e3) - o, 0);\n r += \"?t=\".concat(a);\n }\n return r;\n }\n }, {\n key: \"alias\",\n value: function (e, t) {\n return e === this.get_property(le) ? (G.critical(\"Attempting to create alias for existing People user - aborting.\"), -2) : this._requirePersonProcessing(\"posthog.alias\") ? (w(t) && (t = this.get_distinct_id()), e !== t ? (this._register_single(ce, e), this.capture(\"$create_alias\", {\n alias: e,\n distinct_id: t\n })) : (G.warn(\"alias matches current distinct_id - skipping api call.\"), this.identify(e), -1)) : void 0;\n }\n }, {\n key: \"set_config\",\n value: function (e) {\n var n,\n i,\n r,\n s,\n o = t({}, this.config);\n b(e) && (J(this.config, ts(e)), null === (n = this.persistence) || void 0 === n || n.update_config(this.config, o), this.sessionPersistence = \"sessionStorage\" === this.config.persistence ? this.persistence : new bn(t(t({}, this.config), {}, {\n persistence: \"sessionStorage\"\n })), at.is_supported() && \"true\" === at.get(\"ph_debug\") && (this.config.debug = !0), this.config.debug && (f.DEBUG = !0, G.info(\"set_config\", {\n config: e,\n oldConfig: o,\n newConfig: t({}, this.config)\n })), null === (i = this.sessionRecording) || void 0 === i || i.startIfEnabledOrStop(), null === (r = this.autocapture) || void 0 === r || r.startIfEnabled(), null === (s = this.heatmaps) || void 0 === s || s.startIfEnabled(), this.surveys.loadIfEnabled(), this._sync_opt_out_with_persistence());\n }\n }, {\n key: \"startSessionRecording\",\n value: function (e) {\n if (null != e && e.sampling) {\n var t,\n n,\n i = null === (t = this.sessionManager) || void 0 === t ? void 0 : t.checkAndGetSessionAndWindowId();\n null === (n = this.persistence) || void 0 === n || n.register(o({}, Ee, !0)), G.info(\"Session recording started with sampling override for session: \", null == i ? void 0 : i.sessionId);\n }\n this.set_config({\n disable_session_recording: !1\n });\n }\n }, {\n key: \"stopSessionRecording\",\n value: function () {\n this.set_config({\n disable_session_recording: !0\n });\n }\n }, {\n key: \"sessionRecordingStarted\",\n value: function () {\n var e;\n return !(null === (e = this.sessionRecording) || void 0 === e || !e.started);\n }\n }, {\n key: \"loadToolbar\",\n value: function (e) {\n return this.toolbar.loadToolbar(e);\n }\n }, {\n key: \"get_property\",\n value: function (e) {\n var t;\n return null === (t = this.persistence) || void 0 === t ? void 0 : t.props[e];\n }\n }, {\n key: \"getSessionProperty\",\n value: function (e) {\n var t;\n return null === (t = this.sessionPersistence) || void 0 === t ? void 0 : t.props[e];\n }\n }, {\n key: \"toString\",\n value: function () {\n var e,\n t = null !== (e = this.config.name) && void 0 !== e ? e : Kr;\n return t !== Kr && (t = Kr + \".\" + t), t;\n }\n }, {\n key: \"_isIdentified\",\n value: function () {\n var e, t;\n return \"identified\" === (null === (e = this.persistence) || void 0 === e ? void 0 : e.get_property($e)) || \"identified\" === (null === (t = this.sessionPersistence) || void 0 === t ? void 0 : t.get_property($e));\n }\n }, {\n key: \"_hasPersonProcessing\",\n value: function () {\n var e, t, n, i;\n return !(\"never\" === this.config.person_profiles || \"identified_only\" === this.config.person_profiles && !this._isIdentified() && k(this.getGroups()) && (null === (e = this.persistence) || void 0 === e || null === (t = e.props) || void 0 === t || !t[ce]) && (null === (n = this.persistence) || void 0 === n || null === (i = n.props) || void 0 === i || !i[qe]));\n }\n }, {\n key: \"_shouldCapturePageleave\",\n value: function () {\n return !0 === this.config.capture_pageleave || \"if_capture_pageview\" === this.config.capture_pageleave && this.config.capture_pageview;\n }\n }, {\n key: \"createPersonProfile\",\n value: function () {\n this._hasPersonProcessing() || this._requirePersonProcessing(\"posthog.createPersonProfile\") && this.setPersonProperties({}, {});\n }\n }, {\n key: \"_requirePersonProcessing\",\n value: function (e) {\n return \"never\" === this.config.person_profiles ? (G.error(e + ' was called, but process_person is set to \"never\". This call will be ignored.'), !1) : (this._register_single(qe, !0), !0);\n }\n }, {\n key: \"_sync_opt_out_with_persistence\",\n value: function () {\n var e,\n t,\n n,\n i,\n r = this.consent.isOptedOut(),\n s = this.config.opt_out_persistence_by_default,\n o = this.config.disable_persistence || r && !!s;\n (null === (e = this.persistence) || void 0 === e ? void 0 : e.disabled) !== o && (null === (n = this.persistence) || void 0 === n || n.set_disabled(o));\n (null === (t = this.sessionPersistence) || void 0 === t ? void 0 : t.disabled) !== o && (null === (i = this.sessionPersistence) || void 0 === i || i.set_disabled(o));\n }\n }, {\n key: \"opt_in_capturing\",\n value: function (e) {\n var t;\n this.consent.optInOut(!0), this._sync_opt_out_with_persistence(), (w(null == e ? void 0 : e.captureEventName) || null != e && e.captureEventName) && this.capture(null !== (t = null == e ? void 0 : e.captureEventName) && void 0 !== t ? t : \"$opt_in\", null == e ? void 0 : e.captureProperties, {\n send_instantly: !0\n });\n }\n }, {\n key: \"opt_out_capturing\",\n value: function () {\n this.consent.optInOut(!1), this._sync_opt_out_with_persistence();\n }\n }, {\n key: \"has_opted_in_capturing\",\n value: function () {\n return this.consent.isOptedIn();\n }\n }, {\n key: \"has_opted_out_capturing\",\n value: function () {\n return this.consent.isOptedOut();\n }\n }, {\n key: \"clear_opt_in_out_capturing\",\n value: function () {\n this.consent.reset(), this._sync_opt_out_with_persistence();\n }\n }, {\n key: \"debug\",\n value: function (e) {\n !1 === e ? (null == T || T.console.log(\"You've disabled debug mode.\"), localStorage && localStorage.removeItem(\"ph_debug\"), this.set_config({\n debug: !1\n })) : (null == T || T.console.log(\"You're now in debug mode. All calls to PostHog will be logged in your console.\\nYou can disable this with `posthog.debug(false)`.\"), localStorage && localStorage.setItem(\"ph_debug\", \"true\"), this.set_config({\n debug: !0\n }));\n }\n }]), e;\n }();\n!function (e, t) {\n for (var n = 0; n < t.length; n++) e.prototype[t[n]] = ee(e.prototype[t[n]]);\n}(is, [\"identify\"]);\nvar rs,\n ss = (rs = Yr[Kr] = new is(), function () {\n function e() {\n e.done || (e.done = !0, Zr = !1, Q(Yr, function (e) {\n e._dom_loaded();\n }));\n }\n null != D && D.addEventListener && (\"complete\" === D.readyState ? e() : D.addEventListener(\"DOMContentLoaded\", e, !1)), T && oe(T, \"load\", e, !0);\n }(), rs);\nexport { re as Compression, is as PostHog, Sr as SurveyQuestionBranchingType, wr as SurveyQuestionType, kr as SurveyType, ss as default, ss as posthog, ue as severityLevels };\n","import { Injectable } from '@angular/core';\nimport { Event, NavigationEnd, Router, RouterEvent } from '@angular/router';\nimport { Environment, SessionService } from '@galaxy/core';\nimport { IAMService, PartnerPersona, PersonaType } from '@vendasta/iam';\nimport { parseTokenInsecure, TokenData } from '@vendasta/iamv2';\nimport { PostHog, Properties, Property } from 'posthog-js';\nimport { of } from 'rxjs';\nimport { catchError, filter, switchMap, take, withLatestFrom } from 'rxjs/operators';\nimport { Config } from './config';\n\n/**\n * Common properties that can be used for tracking events\n */\nexport enum CommonProperties {\n TOGGLE_STATE = 'toggleState',\n ECOMMERCE = 'Ecommerce',\n}\n\n/**\n * Common actions that can be used for tracking events\n */\nexport enum CommonActions {\n TOGGLE_STATE_ON = 'toggleOn',\n TOGGLE_STATE_OFF = 'toggleOff',\n CLICK = 'click',\n}\n\n/**\n * Posthog's UUID format. If an ID doesn't match this format, it's a vendasta ID.\n * Note that we can't simply use U-* as in some centers emails or business IDs are\n * the only available identifiers (e.g. think an SMB logging in).\n */\nconst POSTHOG_ANONYMOUS_ID_REGEX = '.+?-.+?-.+?-.+?-.+?';\n\n/**\n * The group type if grouping by Partner ID.\n * @private\n */\nconst POSTHOG_GROUP_PARTNER = 'partner';\n\n@Injectable({ providedIn: 'root' })\nexport class ProductAnalyticsService {\n private initialized = false;\n private previousUrl?: string;\n private instance?: PostHog;\n private propertiesQueue: Properties[] = [];\n\n /**\n *\n * @param router Used to monitor page changes.\n * @param sessionService Used to interact with the browser session and stored information e.g. User ID\n * @param iamService Used to interact with the IAM service to get the current user's information\n */\n constructor(\n private readonly router: Router,\n private readonly sessionService: SessionService,\n private readonly iamService: IAMService,\n ) {}\n\n /**\n * Initializes the analytics service.\n * @param config\n */\n initialize(config: Config): void {\n if (this.initialized) {\n return;\n }\n // Check if snowplow should be configured and we have the projects UUID\n if (!!config && !!config.projectUUID) {\n const persona$ = this.sessionService.getSessionId().pipe(\n switchMap((session) => {\n if (session) {\n return this.iamService.getSubjectBySession(session, PersonaType.partner).pipe(catchError(() => of(null)));\n }\n return of(null);\n }),\n );\n\n persona$.pipe(take(1), withLatestFrom(this.sessionService.getSessionId())).subscribe(([persona, session]) => {\n let isSuperAdmin = false;\n if (persona) {\n const partnerSubject = persona as PartnerPersona;\n if (partnerSubject.isSuperAdmin) {\n isSuperAdmin = true;\n }\n }\n\n let token: TokenData | null;\n if (session) {\n // Yes, a null session is stored as the string 'null' in some places.\n if (!!session && session !== 'null') {\n token = parseTokenInsecure(session);\n }\n }\n\n // if post hog analytics has been enabled then also wire it up\n if (config.postHogID) {\n let environmentString = 'demo';\n if (config.environment === Environment.PROD) {\n environmentString = 'production';\n }\n\n // Do the required PostHog configuration\n const posthog = new PostHog();\n this.instance = posthog.init(\n config.postHogID,\n {\n api_host: 'https://pa.apigateway.co',\n opt_in_site_apps: true,\n session_recording: {\n blockSelector: '[data-guru-chunk-id=\"TopFrame\"]',\n },\n\n // Start with session recording disabled.\n // This prevents incompatible browser extensions from fighting with PostHog.\n loaded: (ph) => {\n // If a Vendasta ID has been provided, it means the user has logged in OR a new user has logged in.\n if (token?.userId) {\n // If the user was previously unknown, track them under their Vendasta ID.\n if (ph.get_distinct_id().match(POSTHOG_ANONYMOUS_ID_REGEX)) {\n ph.identify(token.userId);\n }\n // If the user has an ID but it's changed, a logout has occurred.\n else if (ph.get_distinct_id() !== token.userId) {\n ph.reset();\n ph.identify(token.userId);\n }\n }\n\n if (config.partner?.pid) {\n ph.group(POSTHOG_GROUP_PARTNER, config.partner?.pid, {\n name: config.partner?.name || '',\n });\n }\n\n ph.register({\n environment: environmentString,\n projectName: config.projectName,\n projectID: config.projectUUID,\n businessId: config.businessID,\n impersonateeUserId: token?.impersonateeUserId || '',\n isSuperAdmin: isSuperAdmin,\n partnerId: config.partner?.pid,\n platform: config.platform || 'web',\n });\n\n // Register any properties that were queued up before initialization.\n this.propertiesQueue.forEach((properties) => ph.register(properties));\n this.propertiesQueue = [];\n },\n },\n config.projectName,\n );\n\n // Optionally, listen for changes in the PID.\n if (config.partner?.pidChanges$) {\n config.partner.pidChanges$.subscribe((pid) => this.switchPartnerId(pid));\n }\n }\n\n this.initialized = true;\n });\n\n // Track any page views via the router\n this.router.events\n .pipe(filter((event: Event | RouterEvent): event is NavigationEnd => event instanceof NavigationEnd))\n .subscribe((event: NavigationEnd) => {\n // Sometimes NavigationEnd will be fired twice, this limits to only tracking on new events\n if (event.url !== this.previousUrl) {\n this.previousUrl = event.urlAfterRedirects;\n if (config.postHogID) {\n this.instance?.capture('$pageview');\n }\n }\n });\n }\n }\n\n private capture = (\n eventName: string,\n category: string,\n action: string,\n value?: number,\n rawProperties?: Properties,\n ) => {\n // If PostHog not initialized, don't track the event.\n if (!this.initialized) {\n // Useful for local debugging:\n // console.log(`Tracking: ${label}: ${JSON.stringify(properties)}`);\n return;\n }\n\n // Ensure we have an object to work with to make the rest of this method simpler.\n const properties = rawProperties || {};\n\n // set the category, action and value onto the tracked event properties\n properties['event_category'] = category;\n properties['event_action'] = action;\n properties['event_value'] = value;\n\n // Each property passed through the tracker is a custom property. This makes it challenging\n // to bundle the full set of custom event data into a well known schema within the event stream\n // event_metadata becomes the well known property that we place the properties onto\n // https://github.com/vendasta/heimdall/blob/master/internal/event/model/event.go#L40\n const event_metadata: Record = {};\n Object.keys(properties).forEach((key) => {\n if (key !== 'token') {\n event_metadata[key] = properties[key];\n }\n });\n\n // Only place the event_metadata onto the capture call if keys exist\n if (Object.keys(event_metadata).length > 1) {\n properties.event_metadata = event_metadata;\n }\n\n this.instance?.capture(eventName, properties);\n };\n\n /**\n * Tracks a custom event.\n * For example to capture an event named 'Registered' analyticsService.trackEvent('Registered', {'Gender': 'Male', 'Age': 21});\n * @param eventName - The name of the event.\n * @param category - Typically the object that was interacted with (e.g. 'Video')\n * @param action - The type of interaction (e.g. 'play', 'click')\n * @param value - A numeric value associated with the event (e.g. 42)\n * @param properties - A set of properties to include with the event you're sending. These describe the user who did the event or details about the event itself.\n */\n trackEvent(eventName: string, category: string, action: string, value?: number, properties?: Properties): void {\n this.capture(eventName, category, action, value, properties);\n }\n\n /**\n * Tracks the given properties on all events going forward (until changed by a subsequent call to this method).\n * Example: associate subscription tier with all future events: analyticsService.trackProperties({ subscriptionTier: 'basic' });\n * @param rawProperties - The properties to attach to future events (until changed)\n */\n trackProperties(rawProperties: Properties): void {\n const properties = rawProperties || {};\n\n // If PostHog isn't initialized, don't track the property.\n if (!this.initialized) {\n this.propertiesQueue.push(properties);\n return;\n }\n\n // Register the properties.\n this.instance?.register(properties);\n }\n\n /**\n * Tracks the toggling on or off of some control, e.g. toggle switch, checkbox, etc.\n * @param eventName A label for the item being toggled\n * @param toggleState The state of the toggled control, true being \"ON\" and false being \"OFF\"\n * @param properties Optional properties in addition to the toggle state. Any fields matching a key in `CommonProperties` may be overwritten.\n */\n trackToggle(eventName: string, toggleState: boolean, properties?: Properties): void {\n const props = properties || {};\n props[CommonProperties.TOGGLE_STATE] = toggleState;\n\n let action = CommonActions.TOGGLE_STATE_OFF;\n let value = 0;\n if (toggleState) {\n action = CommonActions.TOGGLE_STATE_ON;\n value = 1;\n }\n\n this.capture(eventName, CommonProperties.TOGGLE_STATE, action, value, props);\n }\n\n /**\n * Access the an identifier for the current visitor\n * If the posthog is not initialized or an error occurs, it returns a empty string\n * @returns posthog's distinct_id\n */\n getVisitorId(): string {\n if (!this.initialized) {\n return '';\n }\n\n try {\n return this.instance?.get_distinct_id() || '';\n } catch (e) {\n return '';\n }\n }\n\n /**\n * Get the feature flag for the given feature flag name.\n * @param name\n */\n getFeatureFlag(name: string): boolean | string | undefined {\n return this.instance?.getFeatureFlag(name);\n }\n\n /**\n * Override a feature flag. This will persist until you call override again with the argument false:\n * @param flags\n */\n overrideFeatureFlag(flags: boolean | string[] | Record): void {\n this.instance?.featureFlags.override(flags);\n }\n\n /**\n * Changes the partner ID for all events going forward.\n * Ignores empty PIDs, and uppercases all PIDs provided.\n * @param partnerId\n * @note Since there may be several ways to switch partner ID and partner ID\n * is core to virtually everything in the platform, we wanted a dedicated\n * method for this.\n */\n switchPartnerId(partnerId: string) {\n // Note: PostHog groups are event-based, so once you do this events\n // going forward will have the PID as both the registered PID\n // and the registered group.\n // https://posthog.com/docs/user-guides/group-analytics\n if (!partnerId) {\n return;\n }\n const sanitizedPid = partnerId.toUpperCase();\n this.instance?.group(POSTHOG_GROUP_PARTNER, sanitizedPid);\n this.trackProperties({ partnerId: sanitizedPid });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { TrackEventDirective } from './track-event.directive';\n\nexport const MODULE_DECLARATIONS = [TrackEventDirective];\nexport const MODULE_EXPORTS = [TrackEventDirective];\n\n@NgModule({\n declarations: MODULE_DECLARATIONS,\n exports: MODULE_EXPORTS,\n providers: [],\n})\nexport class ProductAnalyticsModule {}\n","import { Injectable } from '@angular/core';\nimport { Observable, Observer } from 'rxjs';\n\nexport interface Script {\n name: string;\n src: string;\n}\n\n@Injectable()\nexport class StripeService {\n private loaded = false;\n public loadScript(): Observable