{"version":3,"sources":["node_modules/@angular/animations/fesm2022/animations.mjs","node_modules/ngx-toastr/fesm2022/ngx-toastr.mjs","node_modules/@microsoft/signalr/dist/esm/Errors.js","node_modules/@microsoft/signalr/dist/esm/HttpClient.js","node_modules/@microsoft/signalr/dist/esm/ILogger.js","node_modules/@microsoft/signalr/dist/esm/Loggers.js","node_modules/@microsoft/signalr/dist/esm/Utils.js","node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js","node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/Subject.js","node_modules/@microsoft/signalr/dist/esm/HubConnection.js","node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","node_modules/@microsoft/signalr/src/HeaderNames.ts","node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js","node_modules/@microsoft/signalr/dist/esm/ITransport.js","node_modules/@microsoft/signalr/dist/esm/AbortController.js","node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","src/app/_services/message-hub.service.ts","src/app/shared/confirm-dialog/confirm-dialog.component.ts","src/app/shared/confirm-dialog/confirm-dialog.component.html","src/app/shared/confirm-dialog/_models/confirm-config.ts","src/app/shared/confirm.service.ts","src/app/_models/preferences/site-theme.ts","src/app/_services/theme.service.ts","src/app/_services/account.service.ts"],"sourcesContent":["/**\n * @license Angular v17.0.4\n * (c) 2010-2022 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { inject, Injectable, ANIMATION_MODULE_TYPE, ViewEncapsulation, ɵRuntimeError, Inject } from '@angular/core';\n\n/**\n * Specifies automatic styling.\n *\n * @publicApi\n */\nconst AUTO_STYLE = '*';\n/**\n * Creates a named animation trigger, containing a list of [`state()`](api/animations/state)\n * and `transition()` entries to be evaluated when the expression\n * bound to the trigger changes.\n *\n * @param name An identifying string.\n * @param definitions An animation definition object, containing an array of\n * [`state()`](api/animations/state) and `transition()` declarations.\n *\n * @return An object that encapsulates the trigger data.\n *\n * @usageNotes\n * Define an animation trigger in the `animations` section of `@Component` metadata.\n * In the template, reference the trigger by name and bind it to a trigger expression that\n * evaluates to a defined animation state, using the following format:\n *\n * `[@triggerName]=\"expression\"`\n *\n * Animation trigger bindings convert all values to strings, and then match the\n * previous and current values against any linked transitions.\n * Booleans can be specified as `1` or `true` and `0` or `false`.\n *\n * ### Usage Example\n *\n * The following example creates an animation trigger reference based on the provided\n * name value.\n * The provided animation value is expected to be an array consisting of state and\n * transition declarations.\n *\n * ```typescript\n * @Component({\n * selector: \"my-component\",\n * templateUrl: \"my-component-tpl.html\",\n * animations: [\n * trigger(\"myAnimationTrigger\", [\n * state(...),\n * state(...),\n * transition(...),\n * transition(...)\n * ])\n * ]\n * })\n * class MyComponent {\n * myStatusExp = \"something\";\n * }\n * ```\n *\n * The template associated with this component makes use of the defined trigger\n * by binding to an element within its template code.\n *\n * ```html\n * \n *
...
\n * ```\n *\n * ### Using an inline function\n * The `transition` animation method also supports reading an inline function which can decide\n * if its associated animation should be run.\n *\n * ```typescript\n * // this method is run each time the `myAnimationTrigger` trigger value changes.\n * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:\n string]: any}): boolean {\n * // notice that `element` and `params` are also available here\n * return toState == 'yes-please-animate';\n * }\n *\n * @Component({\n * selector: 'my-component',\n * templateUrl: 'my-component-tpl.html',\n * animations: [\n * trigger('myAnimationTrigger', [\n * transition(myInlineMatcherFn, [\n * // the animation sequence code\n * ]),\n * ])\n * ]\n * })\n * class MyComponent {\n * myStatusExp = \"yes-please-animate\";\n * }\n * ```\n *\n * ### Disabling Animations\n * When true, the special animation control binding `@.disabled` binding prevents\n * all animations from rendering.\n * Place the `@.disabled` binding on an element to disable\n * animations on the element itself, as well as any inner animation triggers\n * within the element.\n *\n * The following example shows how to use this feature:\n *\n * ```typescript\n * @Component({\n * selector: 'my-component',\n * template: `\n *
\n *
\n *
\n * `,\n * animations: [\n * trigger(\"childAnimation\", [\n * // ...\n * ])\n * ]\n * })\n * class MyComponent {\n * isDisabled = true;\n * exp = '...';\n * }\n * ```\n *\n * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,\n * along with any inner animations.\n *\n * ### Disable animations application-wide\n * When an area of the template is set to have animations disabled,\n * **all** inner components have their animations disabled as well.\n * This means that you can disable all animations for an app\n * by placing a host binding set on `@.disabled` on the topmost Angular component.\n *\n * ```typescript\n * import {Component, HostBinding} from '@angular/core';\n *\n * @Component({\n * selector: 'app-component',\n * templateUrl: 'app.component.html',\n * })\n * class AppComponent {\n * @HostBinding('@.disabled')\n * public animationsDisabled = true;\n * }\n * ```\n *\n * ### Overriding disablement of inner animations\n * Despite inner animations being disabled, a parent animation can `query()`\n * for inner elements located in disabled areas of the template and still animate\n * them if needed. This is also the case for when a sub animation is\n * queried by a parent and then later animated using `animateChild()`.\n *\n * ### Detecting when an animation is disabled\n * If a region of the DOM (or the entire application) has its animations disabled, the animation\n * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides\n * an instance of an `AnimationEvent`. If animations are disabled,\n * the `.disabled` flag on the event is true.\n *\n * @publicApi\n */\nfunction trigger(name, definitions) {\n return {\n type: 7 /* AnimationMetadataType.Trigger */,\n name,\n definitions,\n options: {}\n };\n}\n/**\n * Defines an animation step that combines styling information with timing information.\n *\n * @param timings Sets `AnimateTimings` for the parent animation.\n * A string in the format \"duration [delay] [easing]\".\n * - Duration and delay are expressed as a number and optional time unit,\n * such as \"1s\" or \"10ms\" for one second and 10 milliseconds, respectively.\n * The default unit is milliseconds.\n * - The easing value controls how the animation accelerates and decelerates\n * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,\n * `ease-in-out`, or a `cubic-bezier()` function call.\n * If not supplied, no easing is applied.\n *\n * For example, the string \"1s 100ms ease-out\" specifies a duration of\n * 1000 milliseconds, and delay of 100 ms, and the \"ease-out\" easing style,\n * which decelerates near the end of the duration.\n * @param styles Sets AnimationStyles for the parent animation.\n * A function call to either `style()` or `keyframes()`\n * that returns a collection of CSS style entries to be applied to the parent animation.\n * When null, uses the styles from the destination state.\n * This is useful when describing an animation step that will complete an animation;\n * see \"Animating to the final state\" in `transitions()`.\n * @returns An object that encapsulates the animation step.\n *\n * @usageNotes\n * Call within an animation `sequence()`, `{@link animations/group group()}`, or\n * `transition()` call to specify an animation step\n * that applies given style data to the parent animation for a given amount of time.\n *\n * ### Syntax Examples\n * **Timing examples**\n *\n * The following examples show various `timings` specifications.\n * - `animate(500)` : Duration is 500 milliseconds.\n * - `animate(\"1s\")` : Duration is 1000 milliseconds.\n * - `animate(\"100ms 0.5s\")` : Duration is 100 milliseconds, delay is 500 milliseconds.\n * - `animate(\"5s ease-in\")` : Duration is 5000 milliseconds, easing in.\n * - `animate(\"5s 10ms cubic-bezier(.17,.67,.88,.1)\")` : Duration is 5000 milliseconds, delay is 10\n * milliseconds, easing according to a bezier curve.\n *\n * **Style examples**\n *\n * The following example calls `style()` to set a single CSS style.\n * ```typescript\n * animate(500, style({ background: \"red\" }))\n * ```\n * The following example calls `keyframes()` to set a CSS style\n * to different values for successive keyframes.\n * ```typescript\n * animate(500, keyframes(\n * [\n * style({ background: \"blue\" }),\n * style({ background: \"red\" })\n * ])\n * ```\n *\n * @publicApi\n */\nfunction animate(timings, styles = null) {\n return {\n type: 4 /* AnimationMetadataType.Animate */,\n styles,\n timings\n };\n}\n/**\n * @description Defines a list of animation steps to be run in parallel.\n *\n * @param steps An array of animation step objects.\n * - When steps are defined by `style()` or `animate()`\n * function calls, each call within the group is executed instantly.\n * - To specify offset styles to be applied at a later time, define steps with\n * `keyframes()`, or use `animate()` calls with a delay value.\n * For example:\n *\n * ```typescript\n * group([\n * animate(\"1s\", style({ background: \"black\" })),\n * animate(\"2s\", style({ color: \"white\" }))\n * ])\n * ```\n *\n * @param options An options object containing a delay and\n * developer-defined parameters that provide styling defaults and\n * can be overridden on invocation.\n *\n * @return An object that encapsulates the group data.\n *\n * @usageNotes\n * Grouped animations are useful when a series of styles must be\n * animated at different starting times and closed off at different ending times.\n *\n * When called within a `sequence()` or a\n * `transition()` call, does not continue to the next\n * instruction until all of the inner animation steps have completed.\n *\n * @publicApi\n */\nfunction group(steps, options = null) {\n return {\n type: 3 /* AnimationMetadataType.Group */,\n steps,\n options\n };\n}\n/**\n * Defines a list of animation steps to be run sequentially, one by one.\n *\n * @param steps An array of animation step objects.\n * - Steps defined by `style()` calls apply the styling data immediately.\n * - Steps defined by `animate()` calls apply the styling data over time\n * as specified by the timing data.\n *\n * ```typescript\n * sequence([\n * style({ opacity: 0 }),\n * animate(\"1s\", style({ opacity: 1 }))\n * ])\n * ```\n *\n * @param options An options object containing a delay and\n * developer-defined parameters that provide styling defaults and\n * can be overridden on invocation.\n *\n * @return An object that encapsulates the sequence data.\n *\n * @usageNotes\n * When you pass an array of steps to a\n * `transition()` call, the steps run sequentially by default.\n * Compare this to the `{@link animations/group group()}` call, which runs animation steps in\n *parallel.\n *\n * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,\n * execution continues to the next instruction only after each of the inner animation\n * steps have completed.\n *\n * @publicApi\n **/\nfunction sequence(steps, options = null) {\n return {\n type: 2 /* AnimationMetadataType.Sequence */,\n steps,\n options\n };\n}\n/**\n * Declares a key/value object containing CSS properties/styles that\n * can then be used for an animation [`state`](api/animations/state), within an animation\n *`sequence`, or as styling data for calls to `animate()` and `keyframes()`.\n *\n * @param tokens A set of CSS styles or HTML styles associated with an animation state.\n * The value can be any of the following:\n * - A key-value style pair associating a CSS property with a value.\n * - An array of key-value style pairs.\n * - An asterisk (*), to use auto-styling, where styles are derived from the element\n * being animated and applied to the animation when it starts.\n *\n * Auto-styling can be used to define a state that depends on layout or other\n * environmental factors.\n *\n * @return An object that encapsulates the style data.\n *\n * @usageNotes\n * The following examples create animation styles that collect a set of\n * CSS property values:\n *\n * ```typescript\n * // string values for CSS properties\n * style({ background: \"red\", color: \"blue\" })\n *\n * // numerical pixel values\n * style({ width: 100, height: 0 })\n * ```\n *\n * The following example uses auto-styling to allow an element to animate from\n * a height of 0 up to its full height:\n *\n * ```\n * style({ height: 0 }),\n * animate(\"1s\", style({ height: \"*\" }))\n * ```\n *\n * @publicApi\n **/\nfunction style(tokens) {\n return {\n type: 6 /* AnimationMetadataType.Style */,\n styles: tokens,\n offset: null\n };\n}\n/**\n * Declares an animation state within a trigger attached to an element.\n *\n * @param name One or more names for the defined state in a comma-separated string.\n * The following reserved state names can be supplied to define a style for specific use\n * cases:\n *\n * - `void` You can associate styles with this name to be used when\n * the element is detached from the application. For example, when an `ngIf` evaluates\n * to false, the state of the associated element is void.\n * - `*` (asterisk) Indicates the default state. You can associate styles with this name\n * to be used as the fallback when the state that is being animated is not declared\n * within the trigger.\n *\n * @param styles A set of CSS styles associated with this state, created using the\n * `style()` function.\n * This set of styles persists on the element once the state has been reached.\n * @param options Parameters that can be passed to the state when it is invoked.\n * 0 or more key-value pairs.\n * @return An object that encapsulates the new state data.\n *\n * @usageNotes\n * Use the `trigger()` function to register states to an animation trigger.\n * Use the `transition()` function to animate between states.\n * When a state is active within a component, its associated styles persist on the element,\n * even when the animation ends.\n *\n * @publicApi\n **/\nfunction state(name, styles, options) {\n return {\n type: 0 /* AnimationMetadataType.State */,\n name,\n styles,\n options\n };\n}\n/**\n * Defines a set of animation styles, associating each style with an optional `offset` value.\n *\n * @param steps A set of animation styles with optional offset data.\n * The optional `offset` value for a style specifies a percentage of the total animation\n * time at which that style is applied.\n * @returns An object that encapsulates the keyframes data.\n *\n * @usageNotes\n * Use with the `animate()` call. Instead of applying animations\n * from the current state\n * to the destination state, keyframes describe how each style entry is applied and at what point\n * within the animation arc.\n * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).\n *\n * ### Usage\n *\n * In the following example, the offset values describe\n * when each `backgroundColor` value is applied. The color is red at the start, and changes to\n * blue when 20% of the total time has elapsed.\n *\n * ```typescript\n * // the provided offset values\n * animate(\"5s\", keyframes([\n * style({ backgroundColor: \"red\", offset: 0 }),\n * style({ backgroundColor: \"blue\", offset: 0.2 }),\n * style({ backgroundColor: \"orange\", offset: 0.3 }),\n * style({ backgroundColor: \"black\", offset: 1 })\n * ]))\n * ```\n *\n * If there are no `offset` values specified in the style entries, the offsets\n * are calculated automatically.\n *\n * ```typescript\n * animate(\"5s\", keyframes([\n * style({ backgroundColor: \"red\" }) // offset = 0\n * style({ backgroundColor: \"blue\" }) // offset = 0.33\n * style({ backgroundColor: \"orange\" }) // offset = 0.66\n * style({ backgroundColor: \"black\" }) // offset = 1\n * ]))\n *```\n\n * @publicApi\n */\nfunction keyframes(steps) {\n return {\n type: 5 /* AnimationMetadataType.Keyframes */,\n steps\n };\n}\n/**\n * Declares an animation transition which is played when a certain specified condition is met.\n *\n * @param stateChangeExpr A string with a specific format or a function that specifies when the\n * animation transition should occur (see [State Change Expression](#state-change-expression)).\n *\n * @param steps One or more animation objects that represent the animation's instructions.\n *\n * @param options An options object that can be used to specify a delay for the animation or provide\n * custom parameters for it.\n *\n * @returns An object that encapsulates the transition data.\n *\n * @usageNotes\n *\n * ### State Change Expression\n *\n * The State Change Expression instructs Angular when to run the transition's animations, it can\n *either be\n * - a string with a specific syntax\n * - or a function that compares the previous and current state (value of the expression bound to\n * the element's trigger) and returns `true` if the transition should occur or `false` otherwise\n *\n * The string format can be:\n * - `fromState => toState`, which indicates that the transition's animations should occur then the\n * expression bound to the trigger's element goes from `fromState` to `toState`\n *\n * _Example:_\n * ```typescript\n * transition('open => closed', animate('.5s ease-out', style({ height: 0 }) ))\n * ```\n *\n * - `fromState <=> toState`, which indicates that the transition's animations should occur then\n * the expression bound to the trigger's element goes from `fromState` to `toState` or vice versa\n *\n * _Example:_\n * ```typescript\n * transition('enabled <=> disabled', animate('1s cubic-bezier(0.8,0.3,0,1)'))\n * ```\n *\n * - `:enter`/`:leave`, which indicates that the transition's animations should occur when the\n * element enters or exists the DOM\n *\n * _Example:_\n * ```typescript\n * transition(':enter', [\n * style({ opacity: 0 }),\n * animate('500ms', style({ opacity: 1 }))\n * ])\n * ```\n *\n * - `:increment`/`:decrement`, which indicates that the transition's animations should occur when\n * the numerical expression bound to the trigger's element has increased in value or decreased\n *\n * _Example:_\n * ```typescript\n * transition(':increment', query('@counter', animateChild()))\n * ```\n *\n * - a sequence of any of the above divided by commas, which indicates that transition's animations\n * should occur whenever one of the state change expressions matches\n *\n * _Example:_\n * ```typescript\n * transition(':increment, * => enabled, :enter', animate('1s ease', keyframes([\n * style({ transform: 'scale(1)', offset: 0}),\n * style({ transform: 'scale(1.1)', offset: 0.7}),\n * style({ transform: 'scale(1)', offset: 1})\n * ]))),\n * ```\n *\n * Also note that in such context:\n * - `void` can be used to indicate the absence of the element\n * - asterisks can be used as wildcards that match any state\n * - (as a consequence of the above, `void => *` is equivalent to `:enter` and `* => void` is\n * equivalent to `:leave`)\n * - `true` and `false` also match expression values of `1` and `0` respectively (but do not match\n * _truthy_ and _falsy_ values)\n *\n *
\n *\n * Be careful about entering end leaving elements as their transitions present a common\n * pitfall for developers.\n *\n * Note that when an element with a trigger enters the DOM its `:enter` transition always\n * gets executed, but its `:leave` transition will not be executed if the element is removed\n * alongside its parent (as it will be removed \"without warning\" before its transition has\n * a chance to be executed, the only way that such transition can occur is if the element\n * is exiting the DOM on its own).\n *\n *\n *
\n *\n * ### Animating to a Final State\n *\n * If the final step in a transition is a call to `animate()` that uses a timing value\n * with no `style` data, that step is automatically considered the final animation arc,\n * for the element to reach the final state, in such case Angular automatically adds or removes\n * CSS styles to ensure that the element is in the correct final state.\n *\n *\n * ### Usage Examples\n *\n * - Transition animations applied based on\n * the trigger's expression value\n *\n * ```HTML\n *
\n * ...\n *
\n * ```\n *\n * ```typescript\n * trigger(\"myAnimationTrigger\", [\n * ..., // states\n * transition(\"on => off, open => closed\", animate(500)),\n * transition(\"* <=> error\", query('.indicator', animateChild()))\n * ])\n * ```\n *\n * - Transition animations applied based on custom logic dependent\n * on the trigger's expression value and provided parameters\n *\n * ```HTML\n *
\n * ...\n *
\n * ```\n *\n * ```typescript\n * trigger(\"myAnimationTrigger\", [\n * ..., // states\n * transition(\n * (fromState, toState, _element, params) =>\n * ['firststep', 'laststep'].includes(fromState.toLowerCase())\n * && toState === params?.['target'],\n * animate('1s')\n * )\n * ])\n * ```\n *\n * @publicApi\n **/\nfunction transition(stateChangeExpr, steps, options = null) {\n return {\n type: 1 /* AnimationMetadataType.Transition */,\n expr: stateChangeExpr,\n animation: steps,\n options\n };\n}\n/**\n * Produces a reusable animation that can be invoked in another animation or sequence,\n * by calling the `useAnimation()` function.\n *\n * @param steps One or more animation objects, as returned by the `animate()`\n * or `sequence()` function, that form a transformation from one state to another.\n * A sequence is used by default when you pass an array.\n * @param options An options object that can contain a delay value for the start of the\n * animation, and additional developer-defined parameters.\n * Provided values for additional parameters are used as defaults,\n * and override values can be passed to the caller on invocation.\n * @returns An object that encapsulates the animation data.\n *\n * @usageNotes\n * The following example defines a reusable animation, providing some default parameter\n * values.\n *\n * ```typescript\n * var fadeAnimation = animation([\n * style({ opacity: '{{ start }}' }),\n * animate('{{ time }}',\n * style({ opacity: '{{ end }}'}))\n * ],\n * { params: { time: '1000ms', start: 0, end: 1 }});\n * ```\n *\n * The following invokes the defined animation with a call to `useAnimation()`,\n * passing in override parameter values.\n *\n * ```js\n * useAnimation(fadeAnimation, {\n * params: {\n * time: '2s',\n * start: 1,\n * end: 0\n * }\n * })\n * ```\n *\n * If any of the passed-in parameter values are missing from this call,\n * the default values are used. If one or more parameter values are missing before a step is\n * animated, `useAnimation()` throws an error.\n *\n * @publicApi\n */\nfunction animation(steps, options = null) {\n return {\n type: 8 /* AnimationMetadataType.Reference */,\n animation: steps,\n options\n };\n}\n/**\n * Executes a queried inner animation element within an animation sequence.\n *\n * @param options An options object that can contain a delay value for the start of the\n * animation, and additional override values for developer-defined parameters.\n * @return An object that encapsulates the child animation data.\n *\n * @usageNotes\n * Each time an animation is triggered in Angular, the parent animation\n * has priority and any child animations are blocked. In order\n * for a child animation to run, the parent animation must query each of the elements\n * containing child animations, and run them using this function.\n *\n * Note that this feature is designed to be used with `query()` and it will only work\n * with animations that are assigned using the Angular animation library. CSS keyframes\n * and transitions are not handled by this API.\n *\n * @publicApi\n */\nfunction animateChild(options = null) {\n return {\n type: 9 /* AnimationMetadataType.AnimateChild */,\n options\n };\n}\n/**\n * Starts a reusable animation that is created using the `animation()` function.\n *\n * @param animation The reusable animation to start.\n * @param options An options object that can contain a delay value for the start of\n * the animation, and additional override values for developer-defined parameters.\n * @return An object that contains the animation parameters.\n *\n * @publicApi\n */\nfunction useAnimation(animation, options = null) {\n return {\n type: 10 /* AnimationMetadataType.AnimateRef */,\n animation,\n options\n };\n}\n/**\n * Finds one or more inner elements within the current element that is\n * being animated within a sequence. Use with `animate()`.\n *\n * @param selector The element to query, or a set of elements that contain Angular-specific\n * characteristics, specified with one or more of the following tokens.\n * - `query(\":enter\")` or `query(\":leave\")` : Query for newly inserted/removed elements (not\n * all elements can be queried via these tokens, see\n * [Entering and Leaving Elements](#entering-and-leaving-elements))\n * - `query(\":animating\")` : Query all currently animating elements.\n * - `query(\"@triggerName\")` : Query elements that contain an animation trigger.\n * - `query(\"@*\")` : Query all elements that contain an animation triggers.\n * - `query(\":self\")` : Include the current element into the animation sequence.\n *\n * @param animation One or more animation steps to apply to the queried element or elements.\n * An array is treated as an animation sequence.\n * @param options An options object. Use the 'limit' field to limit the total number of\n * items to collect.\n * @return An object that encapsulates the query data.\n *\n * @usageNotes\n *\n * ### Multiple Tokens\n *\n * Tokens can be merged into a combined query selector string. For example:\n *\n * ```typescript\n * query(':self, .record:enter, .record:leave, @subTrigger', [...])\n * ```\n *\n * The `query()` function collects multiple elements and works internally by using\n * `element.querySelectorAll`. Use the `limit` field of an options object to limit\n * the total number of items to be collected. For example:\n *\n * ```js\n * query('div', [\n * animate(...),\n * animate(...)\n * ], { limit: 1 })\n * ```\n *\n * By default, throws an error when zero items are found. Set the\n * `optional` flag to ignore this error. For example:\n *\n * ```js\n * query('.some-element-that-may-not-be-there', [\n * animate(...),\n * animate(...)\n * ], { optional: true })\n * ```\n *\n * ### Entering and Leaving Elements\n *\n * Not all elements can be queried via the `:enter` and `:leave` tokens, the only ones\n * that can are those that Angular assumes can enter/leave based on their own logic\n * (if their insertion/removal is simply a consequence of that of their parent they\n * should be queried via a different token in their parent's `:enter`/`:leave` transitions).\n *\n * The only elements Angular assumes can enter/leave based on their own logic (thus the only\n * ones that can be queried via the `:enter` and `:leave` tokens) are:\n * - Those inserted dynamically (via `ViewContainerRef`)\n * - Those that have a structural directive (which, under the hood, are a subset of the above ones)\n *\n *
\n *\n * Note that elements will be successfully queried via `:enter`/`:leave` even if their\n * insertion/removal is not done manually via `ViewContainerRef`or caused by their structural\n * directive (e.g. they enter/exit alongside their parent).\n *\n *
\n *\n *
\n *\n * There is an exception to what previously mentioned, besides elements entering/leaving based on\n * their own logic, elements with an animation trigger can always be queried via `:leave` when\n * their parent is also leaving.\n *\n *
\n *\n * ### Usage Example\n *\n * The following example queries for inner elements and animates them\n * individually using `animate()`.\n *\n * ```typescript\n * @Component({\n * selector: 'inner',\n * template: `\n *
\n *

Title

\n *
\n * Blah blah blah\n *
\n *
\n * `,\n * animations: [\n * trigger('queryAnimation', [\n * transition('* => goAnimate', [\n * // hide the inner elements\n * query('h1', style({ opacity: 0 })),\n * query('.content', style({ opacity: 0 })),\n *\n * // animate the inner elements in, one by one\n * query('h1', animate(1000, style({ opacity: 1 }))),\n * query('.content', animate(1000, style({ opacity: 1 }))),\n * ])\n * ])\n * ]\n * })\n * class Cmp {\n * exp = '';\n *\n * goAnimate() {\n * this.exp = 'goAnimate';\n * }\n * }\n * ```\n *\n * @publicApi\n */\nfunction query(selector, animation, options = null) {\n return {\n type: 11 /* AnimationMetadataType.Query */,\n selector,\n animation,\n options\n };\n}\n/**\n * Use within an animation `query()` call to issue a timing gap after\n * each queried item is animated.\n *\n * @param timings A delay value.\n * @param animation One ore more animation steps.\n * @returns An object that encapsulates the stagger data.\n *\n * @usageNotes\n * In the following example, a container element wraps a list of items stamped out\n * by an `ngFor`. The container element contains an animation trigger that will later be set\n * to query for each of the inner items.\n *\n * Each time items are added, the opacity fade-in animation runs,\n * and each removed item is faded out.\n * When either of these animations occur, the stagger effect is\n * applied after each item's animation is started.\n *\n * ```html\n * \n * \n *
\n *
\n *
\n * {{ item }}\n *
\n *
\n * ```\n *\n * Here is the component code:\n *\n * ```typescript\n * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';\n * @Component({\n * templateUrl: 'list.component.html',\n * animations: [\n * trigger('listAnimation', [\n * ...\n * ])\n * ]\n * })\n * class ListComponent {\n * items = [];\n *\n * showItems() {\n * this.items = [0,1,2,3,4];\n * }\n *\n * hideItems() {\n * this.items = [];\n * }\n *\n * toggle() {\n * this.items.length ? this.hideItems() : this.showItems();\n * }\n * }\n * ```\n *\n * Here is the animation trigger code:\n *\n * ```typescript\n * trigger('listAnimation', [\n * transition('* => *', [ // each time the binding value changes\n * query(':leave', [\n * stagger(100, [\n * animate('0.5s', style({ opacity: 0 }))\n * ])\n * ]),\n * query(':enter', [\n * style({ opacity: 0 }),\n * stagger(100, [\n * animate('0.5s', style({ opacity: 1 }))\n * ])\n * ])\n * ])\n * ])\n * ```\n *\n * @publicApi\n */\nfunction stagger(timings, animation) {\n return {\n type: 12 /* AnimationMetadataType.Stagger */,\n timings,\n animation\n };\n}\n\n/**\n * An injectable service that produces an animation sequence programmatically within an\n * Angular component or directive.\n * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.\n *\n * @usageNotes\n *\n * To use this service, add it to your component or directive as a dependency.\n * The service is instantiated along with your component.\n *\n * Apps do not typically need to create their own animation players, but if you\n * do need to, follow these steps:\n *\n * 1. Use the [AnimationBuilder.build](api/animations/AnimationBuilder#build)() method\n * to create a programmatic animation. The method returns an `AnimationFactory` instance.\n *\n * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.\n *\n * 3. Use the player object to control the animation programmatically.\n *\n * For example:\n *\n * ```ts\n * // import the service from BrowserAnimationsModule\n * import {AnimationBuilder} from '@angular/animations';\n * // require the service as a dependency\n * class MyCmp {\n * constructor(private _builder: AnimationBuilder) {}\n *\n * makeAnimation(element: any) {\n * // first define a reusable animation\n * const myAnimation = this._builder.build([\n * style({ width: 0 }),\n * animate(1000, style({ width: '100px' }))\n * ]);\n *\n * // use the returned factory object to create a player\n * const player = myAnimation.create(element);\n *\n * player.play();\n * }\n * }\n * ```\n *\n * @publicApi\n */\nlet AnimationBuilder = /*#__PURE__*/(() => {\n class AnimationBuilder {\n static {\n this.ɵfac = function AnimationBuilder_Factory(t) {\n return new (t || AnimationBuilder)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AnimationBuilder,\n factory: () => (() => inject(BrowserAnimationBuilder))(),\n providedIn: 'root'\n });\n }\n }\n return AnimationBuilder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * A factory object returned from the\n * [AnimationBuilder.build](api/animations/AnimationBuilder#build)()\n * method.\n *\n * @publicApi\n */\nclass AnimationFactory {}\nlet BrowserAnimationBuilder = /*#__PURE__*/(() => {\n class BrowserAnimationBuilder extends AnimationBuilder {\n constructor(rootRenderer, doc) {\n super();\n this.animationModuleType = inject(ANIMATION_MODULE_TYPE, {\n optional: true\n });\n this._nextAnimationId = 0;\n const typeData = {\n id: '0',\n encapsulation: ViewEncapsulation.None,\n styles: [],\n data: {\n animation: []\n }\n };\n this._renderer = rootRenderer.createRenderer(doc.body, typeData);\n if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {\n // We only support AnimationRenderer & DynamicDelegationRenderer for this AnimationBuilder\n throw new ɵRuntimeError(3600 /* RuntimeErrorCode.BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' + 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.');\n }\n }\n build(animation) {\n const id = this._nextAnimationId;\n this._nextAnimationId++;\n const entry = Array.isArray(animation) ? sequence(animation) : animation;\n issueAnimationCommand(this._renderer, null, id, 'register', [entry]);\n return new BrowserAnimationFactory(id, this._renderer);\n }\n static {\n this.ɵfac = function BrowserAnimationBuilder_Factory(t) {\n return new (t || BrowserAnimationBuilder)(i0.ɵɵinject(i0.RendererFactory2), i0.ɵɵinject(DOCUMENT));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: BrowserAnimationBuilder,\n factory: BrowserAnimationBuilder.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return BrowserAnimationBuilder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass BrowserAnimationFactory extends AnimationFactory {\n constructor(_id, _renderer) {\n super();\n this._id = _id;\n this._renderer = _renderer;\n }\n create(element, options) {\n return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);\n }\n}\nclass RendererAnimationPlayer {\n constructor(id, element, options, _renderer) {\n this.id = id;\n this.element = element;\n this._renderer = _renderer;\n this.parentPlayer = null;\n this._started = false;\n this.totalTime = 0;\n this._command('create', options);\n }\n _listen(eventName, callback) {\n return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);\n }\n _command(command, ...args) {\n issueAnimationCommand(this._renderer, this.element, this.id, command, args);\n }\n onDone(fn) {\n this._listen('done', fn);\n }\n onStart(fn) {\n this._listen('start', fn);\n }\n onDestroy(fn) {\n this._listen('destroy', fn);\n }\n init() {\n this._command('init');\n }\n hasStarted() {\n return this._started;\n }\n play() {\n this._command('play');\n this._started = true;\n }\n pause() {\n this._command('pause');\n }\n restart() {\n this._command('restart');\n }\n finish() {\n this._command('finish');\n }\n destroy() {\n this._command('destroy');\n }\n reset() {\n this._command('reset');\n this._started = false;\n }\n setPosition(p) {\n this._command('setPosition', p);\n }\n getPosition() {\n return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;\n }\n}\nfunction issueAnimationCommand(renderer, element, id, command, args) {\n renderer.setProperty(element, `@@${id}:${command}`, args);\n}\n/**\n * The following 2 methods cannot reference their correct types (AnimationRenderer &\n * DynamicDelegationRenderer) since this would introduce a import cycle.\n */\nfunction unwrapAnimationRenderer(renderer) {\n const type = renderer.ɵtype;\n if (type === 0 /* AnimationRendererType.Regular */) {\n return renderer;\n } else if (type === 1 /* AnimationRendererType.Delegated */) {\n return renderer.animationRenderer;\n }\n return null;\n}\nfunction isAnimationRenderer(renderer) {\n const type = renderer.ɵtype;\n return type === 0 /* AnimationRendererType.Regular */ || type === 1 /* AnimationRendererType.Delegated */;\n}\n\n/**\n * An empty programmatic controller for reusable animations.\n * Used internally when animations are disabled, to avoid\n * checking for the null case when an animation player is expected.\n *\n * @see {@link animate}\n * @see {@link AnimationPlayer}\n * @see {@link ɵAnimationGroupPlayer AnimationGroupPlayer}\n *\n * @publicApi\n */\nclass NoopAnimationPlayer {\n constructor(duration = 0, delay = 0) {\n this._onDoneFns = [];\n this._onStartFns = [];\n this._onDestroyFns = [];\n this._originalOnDoneFns = [];\n this._originalOnStartFns = [];\n this._started = false;\n this._destroyed = false;\n this._finished = false;\n this._position = 0;\n this.parentPlayer = null;\n this.totalTime = duration + delay;\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach(fn => fn());\n this._onDoneFns = [];\n }\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 hasStarted() {\n return this._started;\n }\n init() {}\n play() {\n if (!this.hasStarted()) {\n this._onStart();\n this.triggerMicrotask();\n }\n this._started = true;\n }\n /** @internal */\n triggerMicrotask() {\n queueMicrotask(() => this._onFinish());\n }\n _onStart() {\n this._onStartFns.forEach(fn => fn());\n this._onStartFns = [];\n }\n pause() {}\n restart() {}\n finish() {\n this._onFinish();\n }\n destroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n if (!this.hasStarted()) {\n this._onStart();\n }\n this.finish();\n this._onDestroyFns.forEach(fn => fn());\n this._onDestroyFns = [];\n }\n }\n reset() {\n this._started = false;\n this._finished = false;\n this._onStartFns = this._originalOnStartFns;\n this._onDoneFns = this._originalOnDoneFns;\n }\n setPosition(position) {\n this._position = this.totalTime ? position * this.totalTime : 1;\n }\n getPosition() {\n return this.totalTime ? this._position / this.totalTime : 1;\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}\n\n/**\n * A programmatic controller for a group of reusable animations.\n * Used internally to control animations.\n *\n * @see {@link AnimationPlayer}\n * @see {@link animations/group group}\n *\n */\nclass AnimationGroupPlayer {\n constructor(_players) {\n this._onDoneFns = [];\n this._onStartFns = [];\n this._finished = false;\n this._started = false;\n this._destroyed = false;\n this._onDestroyFns = [];\n this.parentPlayer = null;\n this.totalTime = 0;\n this.players = _players;\n let doneCount = 0;\n let destroyCount = 0;\n let startCount = 0;\n const total = this.players.length;\n if (total == 0) {\n queueMicrotask(() => this._onFinish());\n } else {\n this.players.forEach(player => {\n player.onDone(() => {\n if (++doneCount == total) {\n this._onFinish();\n }\n });\n player.onDestroy(() => {\n if (++destroyCount == total) {\n this._onDestroy();\n }\n });\n player.onStart(() => {\n if (++startCount == total) {\n this._onStart();\n }\n });\n });\n }\n this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0);\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.players.forEach(player => player.init());\n }\n onStart(fn) {\n this._onStartFns.push(fn);\n }\n _onStart() {\n if (!this.hasStarted()) {\n this._started = true;\n this._onStartFns.forEach(fn => fn());\n this._onStartFns = [];\n }\n }\n onDone(fn) {\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n hasStarted() {\n return this._started;\n }\n play() {\n if (!this.parentPlayer) {\n this.init();\n }\n this._onStart();\n this.players.forEach(player => player.play());\n }\n pause() {\n this.players.forEach(player => player.pause());\n }\n restart() {\n this.players.forEach(player => player.restart());\n }\n finish() {\n this._onFinish();\n this.players.forEach(player => player.finish());\n }\n destroy() {\n this._onDestroy();\n }\n _onDestroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n this._onFinish();\n this.players.forEach(player => player.destroy());\n this._onDestroyFns.forEach(fn => fn());\n this._onDestroyFns = [];\n }\n }\n reset() {\n this.players.forEach(player => player.reset());\n this._destroyed = false;\n this._finished = false;\n this._started = false;\n }\n setPosition(p) {\n const timeAtPosition = p * this.totalTime;\n this.players.forEach(player => {\n const position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;\n player.setPosition(position);\n });\n }\n getPosition() {\n const longestPlayer = this.players.reduce((longestSoFar, player) => {\n const newPlayerIsLongest = longestSoFar === null || player.totalTime > longestSoFar.totalTime;\n return newPlayerIsLongest ? player : longestSoFar;\n }, null);\n return longestPlayer != null ? longestPlayer.getPosition() : 0;\n }\n beforeDestroy() {\n this.players.forEach(player => {\n if (player.beforeDestroy) {\n player.beforeDestroy();\n }\n });\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}\nconst ɵPRE_STYLE = '!';\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation 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 { AUTO_STYLE, AnimationBuilder, AnimationFactory, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, AnimationGroupPlayer as ɵAnimationGroupPlayer, BrowserAnimationBuilder as ɵBrowserAnimationBuilder, ɵPRE_STYLE };\n","import * as i0 from '@angular/core';\nimport { Directive, InjectionToken, inject, Injectable, ComponentFactoryResolver, ApplicationRef, SecurityContext, Injector, Inject, Component, HostBinding, HostListener, makeEnvironmentProviders, NgModule } from '@angular/core';\nimport { style, state, animate, transition, trigger } from '@angular/animations';\nimport { DOCUMENT, NgIf } from '@angular/common';\nimport { Subject } from 'rxjs';\nimport * as i2 from '@angular/platform-browser';\nconst _c0 = [\"toast-component\", \"\"];\nfunction Toast_button_0_Template(rf, ctx) {\n if (rf & 1) {\n const _r6 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"button\", 5);\n i0.ɵɵlistener(\"click\", function Toast_button_0_Template_button_click_0_listener() {\n i0.ɵɵrestoreView(_r6);\n const ctx_r5 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r5.remove());\n });\n i0.ɵɵelementStart(1, \"span\", 6);\n i0.ɵɵtext(2, \"\\xD7\");\n i0.ɵɵelementEnd()();\n }\n}\nfunction Toast_div_1_ng_container_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtext(1);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r7 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\"[\", ctx_r7.duplicatesCount + 1, \"]\");\n }\n}\nfunction Toast_div_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵtext(1);\n i0.ɵɵtemplate(2, Toast_div_1_ng_container_2_Template, 2, 1, \"ng-container\", 4);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.titleClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r1.title);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.title, \" \");\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx_r1.duplicatesCount);\n }\n}\nfunction Toast_div_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 7);\n }\n if (rf & 2) {\n const ctx_r2 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r2.options.messageClass);\n i0.ɵɵproperty(\"innerHTML\", ctx_r2.message, i0.ɵɵsanitizeHtml);\n }\n}\nfunction Toast_div_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 8);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r3.options.messageClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r3.message);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r3.message, \" \");\n }\n}\nfunction Toast_div_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵelement(1, \"div\", 9);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r4 = i0.ɵɵnextContext();\n i0.ɵɵadvance(1);\n i0.ɵɵstyleProp(\"width\", ctx_r4.width + \"%\");\n }\n}\nfunction ToastNoAnimation_button_0_Template(rf, ctx) {\n if (rf & 1) {\n const _r6 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"button\", 5);\n i0.ɵɵlistener(\"click\", function ToastNoAnimation_button_0_Template_button_click_0_listener() {\n i0.ɵɵrestoreView(_r6);\n const ctx_r5 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r5.remove());\n });\n i0.ɵɵelementStart(1, \"span\", 6);\n i0.ɵɵtext(2, \"\\xD7\");\n i0.ɵɵelementEnd()();\n }\n}\nfunction ToastNoAnimation_div_1_ng_container_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtext(1);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r7 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\"[\", ctx_r7.duplicatesCount + 1, \"]\");\n }\n}\nfunction ToastNoAnimation_div_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵtext(1);\n i0.ɵɵtemplate(2, ToastNoAnimation_div_1_ng_container_2_Template, 2, 1, \"ng-container\", 4);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.titleClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r1.title);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.title, \" \");\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx_r1.duplicatesCount);\n }\n}\nfunction ToastNoAnimation_div_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 7);\n }\n if (rf & 2) {\n const ctx_r2 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r2.options.messageClass);\n i0.ɵɵproperty(\"innerHTML\", ctx_r2.message, i0.ɵɵsanitizeHtml);\n }\n}\nfunction ToastNoAnimation_div_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 8);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r3.options.messageClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r3.message);\n i0.ɵɵadvance(1);\n i0.ɵɵtextInterpolate1(\" \", ctx_r3.message, \" \");\n }\n}\nfunction ToastNoAnimation_div_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵelement(1, \"div\", 9);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r4 = i0.ɵɵnextContext();\n i0.ɵɵadvance(1);\n i0.ɵɵstyleProp(\"width\", ctx_r4.width + \"%\");\n }\n}\nlet ToastContainerDirective = /*#__PURE__*/(() => {\n class ToastContainerDirective {\n el;\n constructor(el) {\n this.el = el;\n }\n getContainerElement() {\n return this.el.nativeElement;\n }\n static ɵfac = function ToastContainerDirective_Factory(t) {\n return new (t || ToastContainerDirective)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: ToastContainerDirective,\n selectors: [[\"\", \"toastContainer\", \"\"]],\n exportAs: [\"toastContainer\"],\n standalone: true\n });\n }\n return ToastContainerDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * A `ComponentPortal` is a portal that instantiates some Component upon attachment.\n */\nclass ComponentPortal {\n _attachedHost;\n /** The type of the component that will be instantiated for attachment. */\n component;\n /**\n * [Optional] Where the attached component should live in Angular's *logical* component tree.\n * This is different from where the component *renders*, which is determined by the PortalHost.\n * The origin necessary when the host is outside of the Angular application context.\n */\n viewContainerRef;\n /** Injector used for the instantiation of the component. */\n injector;\n constructor(component, injector) {\n this.component = component;\n this.injector = injector;\n }\n /** Attach this portal to a host. */\n attach(host, newestOnTop) {\n this._attachedHost = host;\n return host.attach(this, newestOnTop);\n }\n /** Detach this portal from its host */\n detach() {\n const host = this._attachedHost;\n if (host) {\n this._attachedHost = undefined;\n return host.detach();\n }\n }\n /** Whether this portal is attached to a host. */\n get isAttached() {\n return this._attachedHost != null;\n }\n /**\n * Sets the PortalHost reference without performing `attach()`. This is used directly by\n * the PortalHost when it is performing an `attach()` or `detach()`.\n */\n setAttachedHost(host) {\n this._attachedHost = host;\n }\n}\n/**\n * Partial implementation of PortalHost that only deals with attaching a\n * ComponentPortal\n */\nclass BasePortalHost {\n /** The portal currently attached to the host. */\n _attachedPortal;\n /** A function that will permanently dispose this host. */\n _disposeFn;\n attach(portal, newestOnTop) {\n this._attachedPortal = portal;\n return this.attachComponentPortal(portal, newestOnTop);\n }\n detach() {\n if (this._attachedPortal) {\n this._attachedPortal.setAttachedHost();\n }\n this._attachedPortal = undefined;\n if (this._disposeFn) {\n this._disposeFn();\n this._disposeFn = undefined;\n }\n }\n setDisposeFn(fn) {\n this._disposeFn = fn;\n }\n}\n\n/**\n * Reference to a toast opened via the Toastr service.\n */\nclass ToastRef {\n _overlayRef;\n /** The instance of component opened into the toast. */\n componentInstance;\n /** Count of duplicates of this toast */\n duplicatesCount = 0;\n /** Subject for notifying the user that the toast has finished closing. */\n _afterClosed = new Subject();\n /** triggered when toast is activated */\n _activate = new Subject();\n /** notifies the toast that it should close before the timeout */\n _manualClose = new Subject();\n /** notifies the toast that it should reset the timeouts */\n _resetTimeout = new Subject();\n /** notifies the toast that it should count a duplicate toast */\n _countDuplicate = new Subject();\n constructor(_overlayRef) {\n this._overlayRef = _overlayRef;\n }\n manualClose() {\n this._manualClose.next();\n this._manualClose.complete();\n }\n manualClosed() {\n return this._manualClose.asObservable();\n }\n timeoutReset() {\n return this._resetTimeout.asObservable();\n }\n countDuplicate() {\n return this._countDuplicate.asObservable();\n }\n /**\n * Close the toast.\n */\n close() {\n this._overlayRef.detach();\n this._afterClosed.next();\n this._manualClose.next();\n this._afterClosed.complete();\n this._manualClose.complete();\n this._activate.complete();\n this._resetTimeout.complete();\n this._countDuplicate.complete();\n }\n /** Gets an observable that is notified when the toast is finished closing. */\n afterClosed() {\n return this._afterClosed.asObservable();\n }\n isInactive() {\n return this._activate.isStopped;\n }\n activate() {\n this._activate.next();\n this._activate.complete();\n }\n /** Gets an observable that is notified when the toast has started opening. */\n afterActivate() {\n return this._activate.asObservable();\n }\n /** Reset the toast timouts and count duplicates */\n onDuplicate(resetTimeout, countDuplicate) {\n if (resetTimeout) {\n this._resetTimeout.next();\n }\n if (countDuplicate) {\n this._countDuplicate.next(++this.duplicatesCount);\n }\n }\n}\n\n/**\n * Everything a toast needs to launch\n */\nclass ToastPackage {\n toastId;\n config;\n message;\n title;\n toastType;\n toastRef;\n _onTap = new Subject();\n _onAction = new Subject();\n constructor(toastId, config, message, title, toastType, toastRef) {\n this.toastId = toastId;\n this.config = config;\n this.message = message;\n this.title = title;\n this.toastType = toastType;\n this.toastRef = toastRef;\n this.toastRef.afterClosed().subscribe(() => {\n this._onAction.complete();\n this._onTap.complete();\n });\n }\n /** Fired on click */\n triggerTap() {\n this._onTap.next();\n if (this.config.tapToDismiss) {\n this._onTap.complete();\n }\n }\n onTap() {\n return this._onTap.asObservable();\n }\n /** available for use in custom toast */\n triggerAction(action) {\n this._onAction.next(action);\n }\n onAction() {\n return this._onAction.asObservable();\n }\n}\nconst DefaultNoComponentGlobalConfig = {\n maxOpened: 0,\n autoDismiss: false,\n newestOnTop: true,\n preventDuplicates: false,\n countDuplicates: false,\n resetTimeoutOnDuplicate: false,\n includeTitleDuplicates: false,\n iconClasses: {\n error: 'toast-error',\n info: 'toast-info',\n success: 'toast-success',\n warning: 'toast-warning'\n },\n // Individual\n closeButton: false,\n disableTimeOut: false,\n timeOut: 5000,\n extendedTimeOut: 1000,\n enableHtml: false,\n progressBar: false,\n toastClass: 'ngx-toastr',\n positionClass: 'toast-top-right',\n titleClass: 'toast-title',\n messageClass: 'toast-message',\n easing: 'ease-in',\n easeTime: 300,\n tapToDismiss: true,\n onActivateTick: false,\n progressAnimation: 'decreasing'\n};\nconst TOAST_CONFIG = new InjectionToken('ToastConfig');\n\n/**\n * A PortalHost for attaching portals to an arbitrary DOM element outside of the Angular\n * application context.\n *\n * This is the only part of the portal core that directly touches the DOM.\n */\nclass DomPortalHost extends BasePortalHost {\n _hostDomElement;\n _componentFactoryResolver;\n _appRef;\n constructor(_hostDomElement, _componentFactoryResolver, _appRef) {\n super();\n this._hostDomElement = _hostDomElement;\n this._componentFactoryResolver = _componentFactoryResolver;\n this._appRef = _appRef;\n }\n /**\n * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.\n * @param portal Portal to be attached\n */\n attachComponentPortal(portal, newestOnTop) {\n const componentFactory = this._componentFactoryResolver.resolveComponentFactory(portal.component);\n let componentRef;\n // If the portal specifies a ViewContainerRef, we will use that as the attachment point\n // for the component (in terms of Angular's component tree, not rendering).\n // When the ViewContainerRef is missing, we use the factory to create the component directly\n // and then manually attach the ChangeDetector for that component to the application (which\n // happens automatically when using a ViewContainer).\n componentRef = componentFactory.create(portal.injector);\n // When creating a component outside of a ViewContainer, we need to manually register\n // its ChangeDetector with the application. This API is unfortunately not yet published\n // in Angular core. The change detector must also be deregistered when the component\n // is destroyed to prevent memory leaks.\n this._appRef.attachView(componentRef.hostView);\n this.setDisposeFn(() => {\n this._appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n });\n // At this point the component has been instantiated, so we move it to the location in the DOM\n // where we want it to be rendered.\n if (newestOnTop) {\n this._hostDomElement.insertBefore(this._getComponentRootNode(componentRef), this._hostDomElement.firstChild);\n } else {\n this._hostDomElement.appendChild(this._getComponentRootNode(componentRef));\n }\n return componentRef;\n }\n /** Gets the root HTMLElement for an instantiated component. */\n _getComponentRootNode(componentRef) {\n return componentRef.hostView.rootNodes[0];\n }\n}\n\n/** Container inside which all toasts will render. */\nlet OverlayContainer = /*#__PURE__*/(() => {\n class OverlayContainer {\n _document = inject(DOCUMENT);\n _containerElement;\n ngOnDestroy() {\n if (this._containerElement && this._containerElement.parentNode) {\n this._containerElement.parentNode.removeChild(this._containerElement);\n }\n }\n /**\n * This method returns the overlay container element. It will lazily\n * create the element the first time it is called to facilitate using\n * the container in non-browser environments.\n * @returns the container element\n */\n getContainerElement() {\n if (!this._containerElement) {\n this._createContainer();\n }\n return this._containerElement;\n }\n /**\n * Create the overlay container element, which is simply a div\n * with the 'cdk-overlay-container' class on the document body\n * and 'aria-live=\"polite\"'\n */\n _createContainer() {\n const container = this._document.createElement('div');\n container.classList.add('overlay-container');\n container.setAttribute('aria-live', 'polite');\n this._document.body.appendChild(container);\n this._containerElement = container;\n }\n static ɵfac = function OverlayContainer_Factory(t) {\n return new (t || OverlayContainer)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: OverlayContainer,\n factory: OverlayContainer.ɵfac,\n providedIn: 'root'\n });\n }\n return OverlayContainer;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Reference to an overlay that has been created with the Overlay service.\n * Used to manipulate or dispose of said overlay.\n */\nclass OverlayRef {\n _portalHost;\n constructor(_portalHost) {\n this._portalHost = _portalHost;\n }\n attach(portal, newestOnTop = true) {\n return this._portalHost.attach(portal, newestOnTop);\n }\n /**\n * Detaches an overlay from a portal.\n * @returns Resolves when the overlay has been detached.\n */\n detach() {\n return this._portalHost.detach();\n }\n}\n\n/**\n * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be\n * used as a low-level building building block for other components. Dialogs, tooltips, menus,\n * selects, etc. can all be built using overlays. The service should primarily be used by authors\n * of re-usable components rather than developers building end-user applications.\n *\n * An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.\n */\nlet Overlay = /*#__PURE__*/(() => {\n class Overlay {\n _overlayContainer = inject(OverlayContainer);\n _componentFactoryResolver = inject(ComponentFactoryResolver);\n _appRef = inject(ApplicationRef);\n _document = inject(DOCUMENT);\n // Namespace panes by overlay container\n _paneElements = new Map();\n /**\n * Creates an overlay.\n * @returns A reference to the created overlay.\n */\n create(positionClass, overlayContainer) {\n // get existing pane if possible\n return this._createOverlayRef(this.getPaneElement(positionClass, overlayContainer));\n }\n getPaneElement(positionClass = '', overlayContainer) {\n if (!this._paneElements.get(overlayContainer)) {\n this._paneElements.set(overlayContainer, {});\n }\n if (!this._paneElements.get(overlayContainer)[positionClass]) {\n this._paneElements.get(overlayContainer)[positionClass] = this._createPaneElement(positionClass, overlayContainer);\n }\n return this._paneElements.get(overlayContainer)[positionClass];\n }\n /**\n * Creates the DOM element for an overlay and appends it to the overlay container.\n * @returns Newly-created pane element\n */\n _createPaneElement(positionClass, overlayContainer) {\n const pane = this._document.createElement('div');\n pane.id = 'toast-container';\n pane.classList.add(positionClass);\n pane.classList.add('toast-container');\n if (!overlayContainer) {\n this._overlayContainer.getContainerElement().appendChild(pane);\n } else {\n overlayContainer.getContainerElement().appendChild(pane);\n }\n return pane;\n }\n /**\n * Create a DomPortalHost into which the overlay content can be loaded.\n * @param pane The DOM element to turn into a portal host.\n * @returns A portal host for the given DOM element.\n */\n _createPortalHost(pane) {\n return new DomPortalHost(pane, this._componentFactoryResolver, this._appRef);\n }\n /**\n * Creates an OverlayRef for an overlay in the given DOM element.\n * @param pane DOM element for the overlay\n */\n _createOverlayRef(pane) {\n return new OverlayRef(this._createPortalHost(pane));\n }\n static ɵfac = function Overlay_Factory(t) {\n return new (t || Overlay)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Overlay,\n factory: Overlay.ɵfac,\n providedIn: 'root'\n });\n }\n return Overlay;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ToastrService = /*#__PURE__*/(() => {\n class ToastrService {\n overlay;\n _injector;\n sanitizer;\n ngZone;\n toastrConfig;\n currentlyActive = 0;\n toasts = [];\n overlayContainer;\n previousToastMessage;\n index = 0;\n constructor(token, overlay, _injector, sanitizer, ngZone) {\n this.overlay = overlay;\n this._injector = _injector;\n this.sanitizer = sanitizer;\n this.ngZone = ngZone;\n this.toastrConfig = {\n ...token.default,\n ...token.config\n };\n if (token.config.iconClasses) {\n this.toastrConfig.iconClasses = {\n ...token.default.iconClasses,\n ...token.config.iconClasses\n };\n }\n }\n /** show toast */\n show(message, title, override = {}, type = '') {\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show successful toast */\n success(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.success || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show error toast */\n error(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.error || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show info toast */\n info(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.info || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show warning toast */\n warning(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.warning || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /**\n * Remove all or a single toast by id\n */\n clear(toastId) {\n // Call every toastRef manualClose function\n for (const toast of this.toasts) {\n if (toastId !== undefined) {\n if (toast.toastId === toastId) {\n toast.toastRef.manualClose();\n return;\n }\n } else {\n toast.toastRef.manualClose();\n }\n }\n }\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId) {\n const found = this._findToast(toastId);\n if (!found) {\n return false;\n }\n found.activeToast.toastRef.close();\n this.toasts.splice(found.index, 1);\n this.currentlyActive = this.currentlyActive - 1;\n if (!this.toastrConfig.maxOpened || !this.toasts.length) {\n return false;\n }\n if (this.currentlyActive < this.toastrConfig.maxOpened && this.toasts[this.currentlyActive]) {\n const p = this.toasts[this.currentlyActive].toastRef;\n if (!p.isInactive()) {\n this.currentlyActive = this.currentlyActive + 1;\n p.activate();\n }\n }\n return true;\n }\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(title = '', message = '', resetOnDuplicate, countDuplicates) {\n const {\n includeTitleDuplicates\n } = this.toastrConfig;\n for (const toast of this.toasts) {\n const hasDuplicateTitle = includeTitleDuplicates && toast.title === title;\n if ((!includeTitleDuplicates || hasDuplicateTitle) && toast.message === message) {\n toast.toastRef.onDuplicate(resetOnDuplicate, countDuplicates);\n return toast;\n }\n }\n return null;\n }\n /** create a clone of global config and apply individual settings */\n applyConfig(override = {}) {\n return {\n ...this.toastrConfig,\n ...override\n };\n }\n /**\n * Find toast object by id\n */\n _findToast(toastId) {\n for (let i = 0; i < this.toasts.length; i++) {\n if (this.toasts[i].toastId === toastId) {\n return {\n index: i,\n activeToast: this.toasts[i]\n };\n }\n }\n return null;\n }\n /**\n * Determines the need to run inside angular's zone then builds the toast\n */\n _preBuildNotification(toastType, message, title, config) {\n if (config.onActivateTick) {\n return this.ngZone.run(() => this._buildNotification(toastType, message, title, config));\n }\n return this._buildNotification(toastType, message, title, config);\n }\n /**\n * Creates and attaches toast data to component\n * returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast.\n */\n _buildNotification(toastType, message, title, config) {\n if (!config.toastComponent) {\n throw new Error('toastComponent required');\n }\n // max opened and auto dismiss = true\n // if timeout = 0 resetting it would result in setting this.hideTime = Date.now(). Hence, we only want to reset timeout if there is\n // a timeout at all\n const duplicate = this.findDuplicate(title, message, this.toastrConfig.resetTimeoutOnDuplicate && config.timeOut > 0, this.toastrConfig.countDuplicates);\n if ((this.toastrConfig.includeTitleDuplicates && title || message) && this.toastrConfig.preventDuplicates && duplicate !== null) {\n return duplicate;\n }\n this.previousToastMessage = message;\n let keepInactive = false;\n if (this.toastrConfig.maxOpened && this.currentlyActive >= this.toastrConfig.maxOpened) {\n keepInactive = true;\n if (this.toastrConfig.autoDismiss) {\n this.clear(this.toasts[0].toastId);\n }\n }\n const overlayRef = this.overlay.create(config.positionClass, this.overlayContainer);\n this.index = this.index + 1;\n let sanitizedMessage = message;\n if (message && config.enableHtml) {\n sanitizedMessage = this.sanitizer.sanitize(SecurityContext.HTML, message);\n }\n const toastRef = new ToastRef(overlayRef);\n const toastPackage = new ToastPackage(this.index, config, sanitizedMessage, title, toastType, toastRef);\n /** New injector that contains an instance of `ToastPackage`. */\n const providers = [{\n provide: ToastPackage,\n useValue: toastPackage\n }];\n const toastInjector = Injector.create({\n providers,\n parent: this._injector\n });\n const component = new ComponentPortal(config.toastComponent, toastInjector);\n const portal = overlayRef.attach(component, config.newestOnTop);\n toastRef.componentInstance = portal.instance;\n const ins = {\n toastId: this.index,\n title: title || '',\n message: message || '',\n toastRef,\n onShown: toastRef.afterActivate(),\n onHidden: toastRef.afterClosed(),\n onTap: toastPackage.onTap(),\n onAction: toastPackage.onAction(),\n portal\n };\n if (!keepInactive) {\n this.currentlyActive = this.currentlyActive + 1;\n setTimeout(() => {\n ins.toastRef.activate();\n });\n }\n this.toasts.push(ins);\n return ins;\n }\n static ɵfac = function ToastrService_Factory(t) {\n return new (t || ToastrService)(i0.ɵɵinject(TOAST_CONFIG), i0.ɵɵinject(Overlay), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i2.DomSanitizer), i0.ɵɵinject(i0.NgZone));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ToastrService,\n factory: ToastrService.ɵfac,\n providedIn: 'root'\n });\n }\n return ToastrService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Toast = /*#__PURE__*/(() => {\n class Toast {\n toastrService;\n toastPackage;\n ngZone;\n message;\n title;\n options;\n duplicatesCount;\n originalTimeout;\n /** width of progress bar */\n width = -1;\n /** a combination of toast type and options.toastClass */\n toastClasses = '';\n /** controls animation */\n state;\n /** hides component when waiting to be displayed */\n get displayStyle() {\n if (this.state.value === 'inactive') {\n return 'none';\n }\n return;\n }\n timeout;\n intervalId;\n hideTime;\n sub;\n sub1;\n sub2;\n sub3;\n constructor(toastrService, toastPackage, ngZone) {\n this.toastrService = toastrService;\n this.toastPackage = toastPackage;\n this.ngZone = ngZone;\n this.message = toastPackage.message;\n this.title = toastPackage.title;\n this.options = toastPackage.config;\n this.originalTimeout = toastPackage.config.timeOut;\n this.toastClasses = `${toastPackage.toastType} ${toastPackage.config.toastClass}`;\n this.sub = toastPackage.toastRef.afterActivate().subscribe(() => {\n this.activateToast();\n });\n this.sub1 = toastPackage.toastRef.manualClosed().subscribe(() => {\n this.remove();\n });\n this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(() => {\n this.resetTimeout();\n });\n this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {\n this.duplicatesCount = count;\n });\n this.state = {\n value: 'inactive',\n params: {\n easeTime: this.toastPackage.config.easeTime,\n easing: 'ease-in'\n }\n };\n }\n ngOnDestroy() {\n this.sub.unsubscribe();\n this.sub1.unsubscribe();\n this.sub2.unsubscribe();\n this.sub3.unsubscribe();\n clearInterval(this.intervalId);\n clearTimeout(this.timeout);\n }\n /**\n * activates toast and sets timeout\n */\n activateToast() {\n this.state = {\n ...this.state,\n value: 'active'\n };\n if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {\n this.outsideTimeout(() => this.remove(), this.options.timeOut);\n this.hideTime = new Date().getTime() + this.options.timeOut;\n if (this.options.progressBar) {\n this.outsideInterval(() => this.updateProgress(), 10);\n }\n }\n }\n /**\n * updates progress bar width\n */\n updateProgress() {\n if (this.width === 0 || this.width === 100 || !this.options.timeOut) {\n return;\n }\n const now = new Date().getTime();\n const remaining = this.hideTime - now;\n this.width = remaining / this.options.timeOut * 100;\n if (this.options.progressAnimation === 'increasing') {\n this.width = 100 - this.width;\n }\n if (this.width <= 0) {\n this.width = 0;\n }\n if (this.width >= 100) {\n this.width = 100;\n }\n }\n resetTimeout() {\n clearTimeout(this.timeout);\n clearInterval(this.intervalId);\n this.state = {\n ...this.state,\n value: 'active'\n };\n this.outsideTimeout(() => this.remove(), this.originalTimeout);\n this.options.timeOut = this.originalTimeout;\n this.hideTime = new Date().getTime() + (this.options.timeOut || 0);\n this.width = -1;\n if (this.options.progressBar) {\n this.outsideInterval(() => this.updateProgress(), 10);\n }\n }\n /**\n * tells toastrService to remove this toast after animation time\n */\n remove() {\n if (this.state.value === 'removed') {\n return;\n }\n clearTimeout(this.timeout);\n this.state = {\n ...this.state,\n value: 'removed'\n };\n this.outsideTimeout(() => this.toastrService.remove(this.toastPackage.toastId), +this.toastPackage.config.easeTime);\n }\n tapToast() {\n if (this.state.value === 'removed') {\n return;\n }\n this.toastPackage.triggerTap();\n if (this.options.tapToDismiss) {\n this.remove();\n }\n }\n stickAround() {\n if (this.state.value === 'removed') {\n return;\n }\n if (this.options.disableTimeOut !== 'extendedTimeOut') {\n clearTimeout(this.timeout);\n this.options.timeOut = 0;\n this.hideTime = 0;\n // disable progressBar\n clearInterval(this.intervalId);\n this.width = 0;\n }\n }\n delayedHideToast() {\n if (this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut' || this.options.extendedTimeOut === 0 || this.state.value === 'removed') {\n return;\n }\n this.outsideTimeout(() => this.remove(), this.options.extendedTimeOut);\n this.options.timeOut = this.options.extendedTimeOut;\n this.hideTime = new Date().getTime() + (this.options.timeOut || 0);\n this.width = -1;\n if (this.options.progressBar) {\n this.outsideInterval(() => this.updateProgress(), 10);\n }\n }\n outsideTimeout(func, timeout) {\n if (this.ngZone) {\n this.ngZone.runOutsideAngular(() => this.timeout = setTimeout(() => this.runInsideAngular(func), timeout));\n } else {\n this.timeout = setTimeout(() => func(), timeout);\n }\n }\n outsideInterval(func, timeout) {\n if (this.ngZone) {\n this.ngZone.runOutsideAngular(() => this.intervalId = setInterval(() => this.runInsideAngular(func), timeout));\n } else {\n this.intervalId = setInterval(() => func(), timeout);\n }\n }\n runInsideAngular(func) {\n if (this.ngZone) {\n this.ngZone.run(() => func());\n } else {\n func();\n }\n }\n static ɵfac = function Toast_Factory(t) {\n return new (t || Toast)(i0.ɵɵdirectiveInject(ToastrService), i0.ɵɵdirectiveInject(ToastPackage), i0.ɵɵdirectiveInject(i0.NgZone));\n };\n static ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: Toast,\n selectors: [[\"\", \"toast-component\", \"\"]],\n hostVars: 5,\n hostBindings: function Toast_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function Toast_click_HostBindingHandler() {\n return ctx.tapToast();\n })(\"mouseenter\", function Toast_mouseenter_HostBindingHandler() {\n return ctx.stickAround();\n })(\"mouseleave\", function Toast_mouseleave_HostBindingHandler() {\n return ctx.delayedHideToast();\n });\n }\n if (rf & 2) {\n i0.ɵɵsyntheticHostProperty(\"@flyInOut\", ctx.state);\n i0.ɵɵclassMap(ctx.toastClasses);\n i0.ɵɵstyleProp(\"display\", ctx.displayStyle);\n }\n },\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n attrs: _c0,\n decls: 5,\n vars: 5,\n consts: [[\"type\", \"button\", \"class\", \"toast-close-button\", \"aria-label\", \"Close\", 3, \"click\", 4, \"ngIf\"], [3, \"class\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", \"innerHTML\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", 4, \"ngIf\"], [4, \"ngIf\"], [\"type\", \"button\", \"aria-label\", \"Close\", 1, \"toast-close-button\", 3, \"click\"], [\"aria-hidden\", \"true\"], [\"role\", \"alert\", 3, \"innerHTML\"], [\"role\", \"alert\"], [1, \"toast-progress\"]],\n template: function Toast_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, Toast_button_0_Template, 3, 0, \"button\", 0)(1, Toast_div_1_Template, 3, 5, \"div\", 1)(2, Toast_div_2_Template, 1, 3, \"div\", 2)(3, Toast_div_3_Template, 2, 4, \"div\", 3)(4, Toast_div_4_Template, 2, 2, \"div\", 4);\n }\n if (rf & 2) {\n i0.ɵɵproperty(\"ngIf\", ctx.options.closeButton);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.title);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.message && ctx.options.enableHtml);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.message && !ctx.options.enableHtml);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.options.progressBar);\n }\n },\n dependencies: [NgIf],\n encapsulation: 2,\n data: {\n animation: [trigger('flyInOut', [state('inactive', style({\n opacity: 0\n })), state('active', style({\n opacity: 1\n })), state('removed', style({\n opacity: 0\n })), transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')), transition('active => removed', animate('{{ easeTime }}ms {{ easing }}'))])]\n }\n });\n }\n return Toast;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DefaultGlobalConfig = {\n ...DefaultNoComponentGlobalConfig,\n toastComponent: Toast\n};\n/**\n * @description\n * Provides the `TOAST_CONFIG` token with the given config.\n *\n * @param config The config to configure toastr.\n * @returns The environment providers.\n *\n * @example\n * ```ts\n * import { provideToastr } from 'ngx-toastr';\n *\n * bootstrap(AppComponent, {\n * providers: [\n * provideToastr({\n * timeOut: 2000,\n * positionClass: 'toast-top-right',\n * }),\n * ],\n * })\n */\nconst provideToastr = (config = {}) => {\n const providers = [{\n provide: TOAST_CONFIG,\n useValue: {\n default: DefaultGlobalConfig,\n config\n }\n }];\n return makeEnvironmentProviders(providers);\n};\nlet ToastrModule = /*#__PURE__*/(() => {\n class ToastrModule {\n static forRoot(config = {}) {\n return {\n ngModule: ToastrModule,\n providers: [provideToastr(config)]\n };\n }\n static ɵfac = function ToastrModule_Factory(t) {\n return new (t || ToastrModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ToastrModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return ToastrModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ToastrComponentlessModule = /*#__PURE__*/(() => {\n class ToastrComponentlessModule {\n static forRoot(config = {}) {\n return {\n ngModule: ToastrModule,\n providers: [{\n provide: TOAST_CONFIG,\n useValue: {\n default: DefaultNoComponentGlobalConfig,\n config\n }\n }]\n };\n }\n static ɵfac = function ToastrComponentlessModule_Factory(t) {\n return new (t || ToastrComponentlessModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ToastrComponentlessModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return ToastrComponentlessModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ToastNoAnimation = /*#__PURE__*/(() => {\n class ToastNoAnimation {\n toastrService;\n toastPackage;\n appRef;\n message;\n title;\n options;\n duplicatesCount;\n originalTimeout;\n /** width of progress bar */\n width = -1;\n /** a combination of toast type and options.toastClass */\n toastClasses = '';\n /** hides component when waiting to be displayed */\n get displayStyle() {\n if (this.state === 'inactive') {\n return 'none';\n }\n return null;\n }\n /** controls animation */\n state = 'inactive';\n timeout;\n intervalId;\n hideTime;\n sub;\n sub1;\n sub2;\n sub3;\n constructor(toastrService, toastPackage, appRef) {\n this.toastrService = toastrService;\n this.toastPackage = toastPackage;\n this.appRef = appRef;\n this.message = toastPackage.message;\n this.title = toastPackage.title;\n this.options = toastPackage.config;\n this.originalTimeout = toastPackage.config.timeOut;\n this.toastClasses = `${toastPackage.toastType} ${toastPackage.config.toastClass}`;\n this.sub = toastPackage.toastRef.afterActivate().subscribe(() => {\n this.activateToast();\n });\n this.sub1 = toastPackage.toastRef.manualClosed().subscribe(() => {\n this.remove();\n });\n this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(() => {\n this.resetTimeout();\n });\n this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {\n this.duplicatesCount = count;\n });\n }\n ngOnDestroy() {\n this.sub.unsubscribe();\n this.sub1.unsubscribe();\n this.sub2.unsubscribe();\n this.sub3.unsubscribe();\n clearInterval(this.intervalId);\n clearTimeout(this.timeout);\n }\n /**\n * activates toast and sets timeout\n */\n activateToast() {\n this.state = 'active';\n if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {\n this.timeout = setTimeout(() => {\n this.remove();\n }, this.options.timeOut);\n this.hideTime = new Date().getTime() + this.options.timeOut;\n if (this.options.progressBar) {\n this.intervalId = setInterval(() => this.updateProgress(), 10);\n }\n }\n if (this.options.onActivateTick) {\n this.appRef.tick();\n }\n }\n /**\n * updates progress bar width\n */\n updateProgress() {\n if (this.width === 0 || this.width === 100 || !this.options.timeOut) {\n return;\n }\n const now = new Date().getTime();\n const remaining = this.hideTime - now;\n this.width = remaining / this.options.timeOut * 100;\n if (this.options.progressAnimation === 'increasing') {\n this.width = 100 - this.width;\n }\n if (this.width <= 0) {\n this.width = 0;\n }\n if (this.width >= 100) {\n this.width = 100;\n }\n }\n resetTimeout() {\n clearTimeout(this.timeout);\n clearInterval(this.intervalId);\n this.state = 'active';\n this.options.timeOut = this.originalTimeout;\n this.timeout = setTimeout(() => this.remove(), this.originalTimeout);\n this.hideTime = new Date().getTime() + (this.originalTimeout || 0);\n this.width = -1;\n if (this.options.progressBar) {\n this.intervalId = setInterval(() => this.updateProgress(), 10);\n }\n }\n /**\n * tells toastrService to remove this toast after animation time\n */\n remove() {\n if (this.state === 'removed') {\n return;\n }\n clearTimeout(this.timeout);\n this.state = 'removed';\n this.timeout = setTimeout(() => this.toastrService.remove(this.toastPackage.toastId));\n }\n tapToast() {\n if (this.state === 'removed') {\n return;\n }\n this.toastPackage.triggerTap();\n if (this.options.tapToDismiss) {\n this.remove();\n }\n }\n stickAround() {\n if (this.state === 'removed') {\n return;\n }\n clearTimeout(this.timeout);\n this.options.timeOut = 0;\n this.hideTime = 0;\n // disable progressBar\n clearInterval(this.intervalId);\n this.width = 0;\n }\n delayedHideToast() {\n if (this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut' || this.options.extendedTimeOut === 0 || this.state === 'removed') {\n return;\n }\n this.timeout = setTimeout(() => this.remove(), this.options.extendedTimeOut);\n this.options.timeOut = this.options.extendedTimeOut;\n this.hideTime = new Date().getTime() + (this.options.timeOut || 0);\n this.width = -1;\n if (this.options.progressBar) {\n this.intervalId = setInterval(() => this.updateProgress(), 10);\n }\n }\n static ɵfac = function ToastNoAnimation_Factory(t) {\n return new (t || ToastNoAnimation)(i0.ɵɵdirectiveInject(ToastrService), i0.ɵɵdirectiveInject(ToastPackage), i0.ɵɵdirectiveInject(i0.ApplicationRef));\n };\n static ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: ToastNoAnimation,\n selectors: [[\"\", \"toast-component\", \"\"]],\n hostVars: 4,\n hostBindings: function ToastNoAnimation_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function ToastNoAnimation_click_HostBindingHandler() {\n return ctx.tapToast();\n })(\"mouseenter\", function ToastNoAnimation_mouseenter_HostBindingHandler() {\n return ctx.stickAround();\n })(\"mouseleave\", function ToastNoAnimation_mouseleave_HostBindingHandler() {\n return ctx.delayedHideToast();\n });\n }\n if (rf & 2) {\n i0.ɵɵclassMap(ctx.toastClasses);\n i0.ɵɵstyleProp(\"display\", ctx.displayStyle);\n }\n },\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n attrs: _c0,\n decls: 5,\n vars: 5,\n consts: [[\"type\", \"button\", \"class\", \"toast-close-button\", \"aria-label\", \"Close\", 3, \"click\", 4, \"ngIf\"], [3, \"class\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", \"innerHTML\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", 4, \"ngIf\"], [4, \"ngIf\"], [\"type\", \"button\", \"aria-label\", \"Close\", 1, \"toast-close-button\", 3, \"click\"], [\"aria-hidden\", \"true\"], [\"role\", \"alert\", 3, \"innerHTML\"], [\"role\", \"alert\"], [1, \"toast-progress\"]],\n template: function ToastNoAnimation_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, ToastNoAnimation_button_0_Template, 3, 0, \"button\", 0)(1, ToastNoAnimation_div_1_Template, 3, 5, \"div\", 1)(2, ToastNoAnimation_div_2_Template, 1, 3, \"div\", 2)(3, ToastNoAnimation_div_3_Template, 2, 4, \"div\", 3)(4, ToastNoAnimation_div_4_Template, 2, 2, \"div\", 4);\n }\n if (rf & 2) {\n i0.ɵɵproperty(\"ngIf\", ctx.options.closeButton);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.title);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.message && ctx.options.enableHtml);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.message && !ctx.options.enableHtml);\n i0.ɵɵadvance(1);\n i0.ɵɵproperty(\"ngIf\", ctx.options.progressBar);\n }\n },\n dependencies: [NgIf],\n encapsulation: 2\n });\n }\n return ToastNoAnimation;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DefaultNoAnimationsGlobalConfig = {\n ...DefaultNoComponentGlobalConfig,\n toastComponent: ToastNoAnimation\n};\nlet ToastNoAnimationModule = /*#__PURE__*/(() => {\n class ToastNoAnimationModule {\n static forRoot(config = {}) {\n return {\n ngModule: ToastNoAnimationModule,\n providers: [{\n provide: TOAST_CONFIG,\n useValue: {\n default: DefaultNoAnimationsGlobalConfig,\n config\n }\n }]\n };\n }\n static ɵfac = function ToastNoAnimationModule_Factory(t) {\n return new (t || ToastNoAnimationModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ToastNoAnimationModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return ToastNoAnimationModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BasePortalHost, ComponentPortal, DefaultGlobalConfig, DefaultNoAnimationsGlobalConfig, DefaultNoComponentGlobalConfig, Overlay, OverlayContainer, OverlayRef, TOAST_CONFIG, Toast, ToastContainerDirective, ToastNoAnimation, ToastNoAnimationModule, ToastPackage, ToastRef, ToastrComponentlessModule, ToastrModule, ToastrService, provideToastr };\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** Error thrown when an HTTP request fails. */\nexport class HttpError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\n constructor(errorMessage, statusCode) {\n const trueProto = new.target.prototype;\n super(`${errorMessage}: Status code '${statusCode}'`);\n this.statusCode = statusCode;\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when a timeout elapses. */\nexport class TimeoutError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\n constructor(errorMessage = \"A timeout occurred.\") {\n const trueProto = new.target.prototype;\n super(errorMessage);\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when an action is aborted. */\nexport class AbortError extends Error {\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\n constructor(errorMessage = \"An abort occurred.\") {\n const trueProto = new.target.prototype;\n super(errorMessage);\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the selected transport is unsupported by the browser. */\n/** @private */\nexport class UnsupportedTransportError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\n constructor(message, transport) {\n const trueProto = new.target.prototype;\n super(message);\n this.transport = transport;\n this.errorType = 'UnsupportedTransportError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the selected transport is disabled by the browser. */\n/** @private */\nexport class DisabledTransportError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\n constructor(message, transport) {\n const trueProto = new.target.prototype;\n super(message);\n this.transport = transport;\n this.errorType = 'DisabledTransportError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the selected transport cannot be started. */\n/** @private */\nexport class FailedToStartTransportError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.\r\n */\n constructor(message, transport) {\n const trueProto = new.target.prototype;\n super(message);\n this.transport = transport;\n this.errorType = 'FailedToStartTransportError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when the negotiation with the server failed to complete. */\n/** @private */\nexport class FailedToNegotiateWithServerError extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n */\n constructor(message) {\n const trueProto = new.target.prototype;\n super(message);\n this.errorType = 'FailedToNegotiateWithServerError';\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n/** Error thrown when multiple errors have occurred. */\n/** @private */\nexport class AggregateErrors extends Error {\n /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.\r\n *\r\n * @param {string} message A descriptive error message.\r\n * @param {Error[]} innerErrors The collection of errors this error is aggregating.\r\n */\n constructor(message, innerErrors) {\n const trueProto = new.target.prototype;\n super(message);\n this.innerErrors = innerErrors;\n // Workaround issue in Typescript compiler\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\n this.__proto__ = trueProto;\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** Represents an HTTP response. */\nexport class HttpResponse {\n constructor(statusCode, statusText, content) {\n this.statusCode = statusCode;\n this.statusText = statusText;\n this.content = content;\n }\n}\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\nexport class HttpClient {\n get(url, options) {\n return this.send({\n ...options,\n method: \"GET\",\n url\n });\n }\n post(url, options) {\n return this.send({\n ...options,\n method: \"POST\",\n url\n });\n }\n delete(url, options) {\n return this.send({\n ...options,\n method: \"DELETE\",\n url\n });\n }\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\n // @ts-ignore\n getCookieString(url) {\n return \"\";\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\nexport var LogLevel = /*#__PURE__*/function (LogLevel) {\n /** Log level for very low severity diagnostic messages. */\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\n /** Log level for low severity diagnostic messages. */\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\n /** Log level for informational diagnostic messages. */\n LogLevel[LogLevel[\"Information\"] = 2] = \"Information\";\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\n LogLevel[LogLevel[\"None\"] = 6] = \"None\";\n return LogLevel;\n}(LogLevel || {});\n\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** A logger that does nothing when log messages are sent to it. */\nexport class NullLogger {\n constructor() {}\n /** @inheritDoc */\n // eslint-disable-next-line\n log(_logLevel, _message) {}\n}\n/** The singleton instance of the {@link @microsoft/signalr.NullLogger}. */\nNullLogger.instance = new NullLogger();\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { LogLevel } from \"./ILogger\";\nimport { NullLogger } from \"./Loggers\";\n// Version token that will be replaced by the prepack command\n/** The version of the SignalR client. */\nexport const VERSION = \"7.0.12\";\n/** @private */\nexport class Arg {\n static isRequired(val, name) {\n if (val === null || val === undefined) {\n throw new Error(`The '${name}' argument is required.`);\n }\n }\n static isNotEmpty(val, name) {\n if (!val || val.match(/^\\s*$/)) {\n throw new Error(`The '${name}' argument should not be empty.`);\n }\n }\n static isIn(val, values, name) {\n // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.\n if (!(val in values)) {\n throw new Error(`Unknown ${name} value: ${val}.`);\n }\n }\n}\n/** @private */\nexport class Platform {\n // react-native has a window but no document so we should check both\n static get isBrowser() {\n return typeof window === \"object\" && typeof window.document === \"object\";\n }\n // WebWorkers don't have a window object so the isBrowser check would fail\n static get isWebWorker() {\n return typeof self === \"object\" && \"importScripts\" in self;\n }\n // react-native has a window but no document\n static get isReactNative() {\n return typeof window === \"object\" && typeof window.document === \"undefined\";\n }\n // Node apps shouldn't have a window object, but WebWorkers don't either\n // so we need to check for both WebWorker and window\n static get isNode() {\n return !this.isBrowser && !this.isWebWorker && !this.isReactNative;\n }\n}\n/** @private */\nexport function getDataDetail(data, includeContent) {\n let detail = \"\";\n if (isArrayBuffer(data)) {\n detail = `Binary data of length ${data.byteLength}`;\n if (includeContent) {\n detail += `. Content: '${formatArrayBuffer(data)}'`;\n }\n } else if (typeof data === \"string\") {\n detail = `String data of length ${data.length}`;\n if (includeContent) {\n detail += `. Content: '${data}'`;\n }\n }\n return detail;\n}\n/** @private */\nexport function formatArrayBuffer(data) {\n const view = new Uint8Array(data);\n // Uint8Array.map only supports returning another Uint8Array?\n let str = \"\";\n view.forEach(num => {\n const pad = num < 16 ? \"0\" : \"\";\n str += `0x${pad}${num.toString(16)} `;\n });\n // Trim of trailing space.\n return str.substr(0, str.length - 1);\n}\n// Also in signalr-protocol-msgpack/Utils.ts\n/** @private */\nexport function isArrayBuffer(val) {\n return val && typeof ArrayBuffer !== \"undefined\" && (val instanceof ArrayBuffer ||\n // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof\n val.constructor && val.constructor.name === \"ArrayBuffer\");\n}\n/** @private */\nexport async function sendMessage(logger, transportName, httpClient, url, content, options) {\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n logger.log(LogLevel.Trace, `(${transportName} transport) sending data. ${getDataDetail(content, options.logMessageContent)}.`);\n const responseType = isArrayBuffer(content) ? \"arraybuffer\" : \"text\";\n const response = await httpClient.post(url, {\n content,\n headers: {\n ...headers,\n ...options.headers\n },\n responseType,\n timeout: options.timeout,\n withCredentials: options.withCredentials\n });\n logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);\n}\n/** @private */\nexport function createLogger(logger) {\n if (logger === undefined) {\n return new ConsoleLogger(LogLevel.Information);\n }\n if (logger === null) {\n return NullLogger.instance;\n }\n if (logger.log !== undefined) {\n return logger;\n }\n return new ConsoleLogger(logger);\n}\n/** @private */\nexport class SubjectSubscription {\n constructor(subject, observer) {\n this._subject = subject;\n this._observer = observer;\n }\n dispose() {\n const index = this._subject.observers.indexOf(this._observer);\n if (index > -1) {\n this._subject.observers.splice(index, 1);\n }\n if (this._subject.observers.length === 0 && this._subject.cancelCallback) {\n this._subject.cancelCallback().catch(_ => {});\n }\n }\n}\n/** @private */\nexport class ConsoleLogger {\n constructor(minimumLogLevel) {\n this._minLevel = minimumLogLevel;\n this.out = console;\n }\n log(logLevel, message) {\n if (logLevel >= this._minLevel) {\n const msg = `[${new Date().toISOString()}] ${LogLevel[logLevel]}: ${message}`;\n switch (logLevel) {\n case LogLevel.Critical:\n case LogLevel.Error:\n this.out.error(msg);\n break;\n case LogLevel.Warning:\n this.out.warn(msg);\n break;\n case LogLevel.Information:\n this.out.info(msg);\n break;\n default:\n // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug\n this.out.log(msg);\n break;\n }\n }\n }\n}\n/** @private */\nexport function getUserAgentHeader() {\n let userAgentHeaderName = \"X-SignalR-User-Agent\";\n if (Platform.isNode) {\n userAgentHeaderName = \"User-Agent\";\n }\n return [userAgentHeaderName, constructUserAgent(VERSION, getOsName(), getRuntime(), getRuntimeVersion())];\n}\n/** @private */\nexport function constructUserAgent(version, os, runtime, runtimeVersion) {\n // Microsoft SignalR/[Version] ([Detailed Version]; [Operating System]; [Runtime]; [Runtime Version])\n let userAgent = \"Microsoft SignalR/\";\n const majorAndMinor = version.split(\".\");\n userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;\n userAgent += ` (${version}; `;\n if (os && os !== \"\") {\n userAgent += `${os}; `;\n } else {\n userAgent += \"Unknown OS; \";\n }\n userAgent += `${runtime}`;\n if (runtimeVersion) {\n userAgent += `; ${runtimeVersion}`;\n } else {\n userAgent += \"; Unknown Runtime Version\";\n }\n userAgent += \")\";\n return userAgent;\n}\n// eslint-disable-next-line spaced-comment\n/*#__PURE__*/\nfunction getOsName() {\n if (Platform.isNode) {\n switch (process.platform) {\n case \"win32\":\n return \"Windows NT\";\n case \"darwin\":\n return \"macOS\";\n case \"linux\":\n return \"Linux\";\n default:\n return process.platform;\n }\n } else {\n return \"\";\n }\n}\n// eslint-disable-next-line spaced-comment\n/*#__PURE__*/\nfunction getRuntimeVersion() {\n if (Platform.isNode) {\n return process.versions.node;\n }\n return undefined;\n}\nfunction getRuntime() {\n if (Platform.isNode) {\n return \"NodeJS\";\n } else {\n return \"Browser\";\n }\n}\n/** @private */\nexport function getErrorString(e) {\n if (e.stack) {\n return e.stack;\n } else if (e.message) {\n return e.message;\n }\n return `${e}`;\n}\n/** @private */\nexport function getGlobalThis() {\n // globalThis is semi-new and not available in Node until v12\n if (typeof globalThis !== \"undefined\") {\n return globalThis;\n }\n if (typeof self !== \"undefined\") {\n return self;\n }\n if (typeof window !== \"undefined\") {\n return window;\n }\n if (typeof global !== \"undefined\") {\n return global;\n }\n throw new Error(\"could not find global\");\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\nimport { LogLevel } from \"./ILogger\";\nimport { Platform, getGlobalThis, isArrayBuffer } from \"./Utils\";\nexport class FetchHttpClient extends HttpClient {\n constructor(logger) {\n super();\n this._logger = logger;\n if (typeof fetch === \"undefined\") {\n // In order to ignore the dynamic require in webpack builds we need to do this magic\n // @ts-ignore: TS doesn't know about these names\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\n // Cookies aren't automatically handled in Node so we need to add a CookieJar to preserve cookies across requests\n this._jar = new (requireFunc(\"tough-cookie\").CookieJar)();\n this._fetchType = requireFunc(\"node-fetch\");\n // node-fetch doesn't have a nice API for getting and setting cookies\n // fetch-cookie will wrap a fetch implementation with a default CookieJar or a provided one\n this._fetchType = requireFunc(\"fetch-cookie\")(this._fetchType, this._jar);\n } else {\n this._fetchType = fetch.bind(getGlobalThis());\n }\n if (typeof AbortController === \"undefined\") {\n // In order to ignore the dynamic require in webpack builds we need to do this magic\n // @ts-ignore: TS doesn't know about these names\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\n // Node needs EventListener methods on AbortController which our custom polyfill doesn't provide\n this._abortControllerType = requireFunc(\"abort-controller\");\n } else {\n this._abortControllerType = AbortController;\n }\n }\n /** @inheritDoc */\n async send(request) {\n // Check that abort was not signaled before calling send\n if (request.abortSignal && request.abortSignal.aborted) {\n throw new AbortError();\n }\n if (!request.method) {\n throw new Error(\"No method defined.\");\n }\n if (!request.url) {\n throw new Error(\"No url defined.\");\n }\n const abortController = new this._abortControllerType();\n let error;\n // Hook our abortSignal into the abort controller\n if (request.abortSignal) {\n request.abortSignal.onabort = () => {\n abortController.abort();\n error = new AbortError();\n };\n }\n // If a timeout has been passed in, setup a timeout to call abort\n // Type needs to be any to fit window.setTimeout and NodeJS.setTimeout\n let timeoutId = null;\n if (request.timeout) {\n const msTimeout = request.timeout;\n timeoutId = setTimeout(() => {\n abortController.abort();\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\n error = new TimeoutError();\n }, msTimeout);\n }\n if (request.content === \"\") {\n request.content = undefined;\n }\n if (request.content) {\n // Explicitly setting the Content-Type header for React Native on Android platform.\n request.headers = request.headers || {};\n if (isArrayBuffer(request.content)) {\n request.headers[\"Content-Type\"] = \"application/octet-stream\";\n } else {\n request.headers[\"Content-Type\"] = \"text/plain;charset=UTF-8\";\n }\n }\n let response;\n try {\n response = await this._fetchType(request.url, {\n body: request.content,\n cache: \"no-cache\",\n credentials: request.withCredentials === true ? \"include\" : \"same-origin\",\n headers: {\n \"X-Requested-With\": \"XMLHttpRequest\",\n ...request.headers\n },\n method: request.method,\n mode: \"cors\",\n redirect: \"follow\",\n signal: abortController.signal\n });\n } catch (e) {\n if (error) {\n throw error;\n }\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${e}.`);\n throw e;\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (request.abortSignal) {\n request.abortSignal.onabort = null;\n }\n }\n if (!response.ok) {\n const errorMessage = await deserializeContent(response, \"text\");\n throw new HttpError(errorMessage || response.statusText, response.status);\n }\n const content = deserializeContent(response, request.responseType);\n const payload = await content;\n return new HttpResponse(response.status, response.statusText, payload);\n }\n getCookieString(url) {\n let cookies = \"\";\n if (Platform.isNode && this._jar) {\n // @ts-ignore: unused variable\n this._jar.getCookies(url, (e, c) => cookies = c.join(\"; \"));\n }\n return cookies;\n }\n}\nfunction deserializeContent(response, responseType) {\n let content;\n switch (responseType) {\n case \"arraybuffer\":\n content = response.arrayBuffer();\n break;\n case \"text\":\n content = response.text();\n break;\n case \"blob\":\n case \"document\":\n case \"json\":\n throw new Error(`${responseType} is not supported.`);\n default:\n content = response.text();\n break;\n }\n return content;\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortError, HttpError, TimeoutError } from \"./Errors\";\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\nimport { LogLevel } from \"./ILogger\";\nimport { isArrayBuffer } from \"./Utils\";\nexport class XhrHttpClient extends HttpClient {\n constructor(logger) {\n super();\n this._logger = logger;\n }\n /** @inheritDoc */\n send(request) {\n // Check that abort was not signaled before calling send\n if (request.abortSignal && request.abortSignal.aborted) {\n return Promise.reject(new AbortError());\n }\n if (!request.method) {\n return Promise.reject(new Error(\"No method defined.\"));\n }\n if (!request.url) {\n return Promise.reject(new Error(\"No url defined.\"));\n }\n return new Promise((resolve, reject) => {\n const xhr = new XMLHttpRequest();\n xhr.open(request.method, request.url, true);\n xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n if (request.content === \"\") {\n request.content = undefined;\n }\n if (request.content) {\n // Explicitly setting the Content-Type header for React Native on Android platform.\n if (isArrayBuffer(request.content)) {\n xhr.setRequestHeader(\"Content-Type\", \"application/octet-stream\");\n } else {\n xhr.setRequestHeader(\"Content-Type\", \"text/plain;charset=UTF-8\");\n }\n }\n const headers = request.headers;\n if (headers) {\n Object.keys(headers).forEach(header => {\n xhr.setRequestHeader(header, headers[header]);\n });\n }\n if (request.responseType) {\n xhr.responseType = request.responseType;\n }\n if (request.abortSignal) {\n request.abortSignal.onabort = () => {\n xhr.abort();\n reject(new AbortError());\n };\n }\n if (request.timeout) {\n xhr.timeout = request.timeout;\n }\n xhr.onload = () => {\n if (request.abortSignal) {\n request.abortSignal.onabort = null;\n }\n if (xhr.status >= 200 && xhr.status < 300) {\n resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));\n } else {\n reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));\n }\n };\n xhr.onerror = () => {\n this._logger.log(LogLevel.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);\n reject(new HttpError(xhr.statusText, xhr.status));\n };\n xhr.ontimeout = () => {\n this._logger.log(LogLevel.Warning, `Timeout from HTTP request.`);\n reject(new TimeoutError());\n };\n xhr.send(request.content);\n });\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortError } from \"./Errors\";\nimport { FetchHttpClient } from \"./FetchHttpClient\";\nimport { HttpClient } from \"./HttpClient\";\nimport { Platform } from \"./Utils\";\nimport { XhrHttpClient } from \"./XhrHttpClient\";\n/** Default implementation of {@link @microsoft/signalr.HttpClient}. */\nexport class DefaultHttpClient extends HttpClient {\n /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */\n constructor(logger) {\n super();\n if (typeof fetch !== \"undefined\" || Platform.isNode) {\n this._httpClient = new FetchHttpClient(logger);\n } else if (typeof XMLHttpRequest !== \"undefined\") {\n this._httpClient = new XhrHttpClient(logger);\n } else {\n throw new Error(\"No usable HttpClient found.\");\n }\n }\n /** @inheritDoc */\n send(request) {\n // Check that abort was not signaled before calling send\n if (request.abortSignal && request.abortSignal.aborted) {\n return Promise.reject(new AbortError());\n }\n if (!request.method) {\n return Promise.reject(new Error(\"No method defined.\"));\n }\n if (!request.url) {\n return Promise.reject(new Error(\"No url defined.\"));\n }\n return this._httpClient.send(request);\n }\n getCookieString(url) {\n return this._httpClient.getCookieString(url);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// Not exported from index\n/** @private */\nexport class TextMessageFormat {\n static write(output) {\n return `${output}${TextMessageFormat.RecordSeparator}`;\n }\n static parse(input) {\n if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {\n throw new Error(\"Message is incomplete.\");\n }\n const messages = input.split(TextMessageFormat.RecordSeparator);\n messages.pop();\n return messages;\n }\n}\nTextMessageFormat.RecordSeparatorCode = 0x1e;\nTextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { TextMessageFormat } from \"./TextMessageFormat\";\nimport { isArrayBuffer } from \"./Utils\";\n/** @private */\nexport class HandshakeProtocol {\n // Handshake request is always JSON\n writeHandshakeRequest(handshakeRequest) {\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\n }\n parseHandshakeResponse(data) {\n let messageData;\n let remainingData;\n if (isArrayBuffer(data)) {\n // Format is binary but still need to read JSON text from handshake response\n const binaryData = new Uint8Array(data);\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\n if (separatorIndex === -1) {\n throw new Error(\"Message is incomplete.\");\n }\n // content before separator is handshake response\n // optional content after is additional messages\n const responseLength = separatorIndex + 1;\n messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));\n remainingData = binaryData.byteLength > responseLength ? binaryData.slice(responseLength).buffer : null;\n } else {\n const textData = data;\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\n if (separatorIndex === -1) {\n throw new Error(\"Message is incomplete.\");\n }\n // content before separator is handshake response\n // optional content after is additional messages\n const responseLength = separatorIndex + 1;\n messageData = textData.substring(0, responseLength);\n remainingData = textData.length > responseLength ? textData.substring(responseLength) : null;\n }\n // At this point we should have just the single handshake message\n const messages = TextMessageFormat.parse(messageData);\n const response = JSON.parse(messages[0]);\n if (response.type) {\n throw new Error(\"Expected a handshake response from the server.\");\n }\n const responseMessage = response;\n // multiple messages could have arrived with handshake\n // return additional data to be parsed as usual, or null if all parsed\n return [remainingData, responseMessage];\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n/** Defines the type of a Hub Message. */\nexport var MessageType = /*#__PURE__*/function (MessageType) {\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\n MessageType[MessageType[\"Invocation\"] = 1] = \"Invocation\";\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\n MessageType[MessageType[\"StreamItem\"] = 2] = \"StreamItem\";\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\n MessageType[MessageType[\"Completion\"] = 3] = \"Completion\";\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\n MessageType[MessageType[\"StreamInvocation\"] = 4] = \"StreamInvocation\";\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\n MessageType[MessageType[\"CancelInvocation\"] = 5] = \"CancelInvocation\";\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\n MessageType[MessageType[\"Ping\"] = 6] = \"Ping\";\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\n MessageType[MessageType[\"Close\"] = 7] = \"Close\";\n return MessageType;\n}(MessageType || {});\n\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { SubjectSubscription } from \"./Utils\";\n/** Stream implementation to stream items to the server. */\nexport class Subject {\n constructor() {\n this.observers = [];\n }\n next(item) {\n for (const observer of this.observers) {\n observer.next(item);\n }\n }\n error(err) {\n for (const observer of this.observers) {\n if (observer.error) {\n observer.error(err);\n }\n }\n }\n complete() {\n for (const observer of this.observers) {\n if (observer.complete) {\n observer.complete();\n }\n }\n }\n subscribe(observer) {\n this.observers.push(observer);\n return new SubjectSubscription(this, observer);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { HandshakeProtocol } from \"./HandshakeProtocol\";\nimport { AbortError } from \"./Errors\";\nimport { MessageType } from \"./IHubProtocol\";\nimport { LogLevel } from \"./ILogger\";\nimport { Subject } from \"./Subject\";\nimport { Arg, getErrorString, Platform } from \"./Utils\";\nconst DEFAULT_TIMEOUT_IN_MS = 30 * 1000;\nconst DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;\n/** Describes the current state of the {@link HubConnection} to the server. */\nexport var HubConnectionState = /*#__PURE__*/function (HubConnectionState) {\n /** The hub connection is disconnected. */\n HubConnectionState[\"Disconnected\"] = \"Disconnected\";\n /** The hub connection is connecting. */\n HubConnectionState[\"Connecting\"] = \"Connecting\";\n /** The hub connection is connected. */\n HubConnectionState[\"Connected\"] = \"Connected\";\n /** The hub connection is disconnecting. */\n HubConnectionState[\"Disconnecting\"] = \"Disconnecting\";\n /** The hub connection is reconnecting. */\n HubConnectionState[\"Reconnecting\"] = \"Reconnecting\";\n return HubConnectionState;\n}(HubConnectionState || {});\n/** Represents a connection to a SignalR Hub. */\nexport class HubConnection {\n constructor(connection, logger, protocol, reconnectPolicy) {\n this._nextKeepAlive = 0;\n this._freezeEventListener = () => {\n this._logger.log(LogLevel.Warning, \"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep\");\n };\n Arg.isRequired(connection, \"connection\");\n Arg.isRequired(logger, \"logger\");\n Arg.isRequired(protocol, \"protocol\");\n this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;\n this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;\n this._logger = logger;\n this._protocol = protocol;\n this.connection = connection;\n this._reconnectPolicy = reconnectPolicy;\n this._handshakeProtocol = new HandshakeProtocol();\n this.connection.onreceive = data => this._processIncomingData(data);\n this.connection.onclose = error => this._connectionClosed(error);\n this._callbacks = {};\n this._methods = {};\n this._closedCallbacks = [];\n this._reconnectingCallbacks = [];\n this._reconnectedCallbacks = [];\n this._invocationId = 0;\n this._receivedHandshakeResponse = false;\n this._connectionState = HubConnectionState.Disconnected;\n this._connectionStarted = false;\n this._cachedPingMessage = this._protocol.writeMessage({\n type: MessageType.Ping\n });\n }\n /** @internal */\n // Using a public static factory method means we can have a private constructor and an _internal_\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\n // public parameter-less constructor.\n static create(connection, logger, protocol, reconnectPolicy) {\n return new HubConnection(connection, logger, protocol, reconnectPolicy);\n }\n /** Indicates the state of the {@link HubConnection} to the server. */\n get state() {\n return this._connectionState;\n }\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\n get connectionId() {\n return this.connection ? this.connection.connectionId || null : null;\n }\n /** Indicates the url of the {@link HubConnection} to the server. */\n get baseUrl() {\n return this.connection.baseUrl || \"\";\n }\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\n set baseUrl(url) {\n if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\n }\n if (!url) {\n throw new Error(\"The HubConnection url must be a valid url.\");\n }\n this.connection.baseUrl = url;\n }\n /** Starts the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\n start() {\n this._startPromise = this._startWithStateTransitions();\n return this._startPromise;\n }\n async _startWithStateTransitions() {\n if (this._connectionState !== HubConnectionState.Disconnected) {\n return Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"));\n }\n this._connectionState = HubConnectionState.Connecting;\n this._logger.log(LogLevel.Debug, \"Starting HubConnection.\");\n try {\n await this._startInternal();\n if (Platform.isBrowser) {\n // Log when the browser freezes the tab so users know why their connection unexpectedly stopped working\n window.document.addEventListener(\"freeze\", this._freezeEventListener);\n }\n this._connectionState = HubConnectionState.Connected;\n this._connectionStarted = true;\n this._logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\n } catch (e) {\n this._connectionState = HubConnectionState.Disconnected;\n this._logger.log(LogLevel.Debug, `HubConnection failed to start successfully because of error '${e}'.`);\n return Promise.reject(e);\n }\n }\n async _startInternal() {\n this._stopDuringStartError = undefined;\n this._receivedHandshakeResponse = false;\n // Set up the promise before any connection is (re)started otherwise it could race with received messages\n const handshakePromise = new Promise((resolve, reject) => {\n this._handshakeResolver = resolve;\n this._handshakeRejecter = reject;\n });\n await this.connection.start(this._protocol.transferFormat);\n try {\n const handshakeRequest = {\n protocol: this._protocol.name,\n version: this._protocol.version\n };\n this._logger.log(LogLevel.Debug, \"Sending handshake request.\");\n await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));\n this._logger.log(LogLevel.Information, `Using HubProtocol '${this._protocol.name}'.`);\n // defensively cleanup timeout in case we receive a message from the server before we finish start\n this._cleanupTimeout();\n this._resetTimeoutPeriod();\n this._resetKeepAliveInterval();\n await handshakePromise;\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\n // being rejected on close, because this continuation can run after both the handshake completed successfully\n // and the connection was closed.\n if (this._stopDuringStartError) {\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\n // will cause the calling continuation to get scheduled to run later.\n // eslint-disable-next-line @typescript-eslint/no-throw-literal\n throw this._stopDuringStartError;\n }\n if (!this.connection.features.inherentKeepAlive) {\n await this._sendMessage(this._cachedPingMessage);\n }\n } catch (e) {\n this._logger.log(LogLevel.Debug, `Hub handshake failed with error '${e}' during start(). Stopping HubConnection.`);\n this._cleanupTimeout();\n this._cleanupPingTimer();\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\n await this.connection.stop(e);\n throw e;\n }\n }\n /** Stops the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\n async stop() {\n // Capture the start promise before the connection might be restarted in an onclose callback.\n const startPromise = this._startPromise;\n this._stopPromise = this._stopInternal();\n await this._stopPromise;\n try {\n // Awaiting undefined continues immediately\n await startPromise;\n } catch (e) {\n // This exception is returned to the user as a rejected Promise from the start method.\n }\n }\n _stopInternal(error) {\n if (this._connectionState === HubConnectionState.Disconnected) {\n this._logger.log(LogLevel.Debug, `Call to HubConnection.stop(${error}) ignored because it is already in the disconnected state.`);\n return Promise.resolve();\n }\n if (this._connectionState === HubConnectionState.Disconnecting) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\n return this._stopPromise;\n }\n this._connectionState = HubConnectionState.Disconnecting;\n this._logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\n if (this._reconnectDelayHandle) {\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\n // fire the onclose callbacks.\n this._logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\n clearTimeout(this._reconnectDelayHandle);\n this._reconnectDelayHandle = undefined;\n this._completeClose();\n return Promise.resolve();\n }\n this._cleanupTimeout();\n this._cleanupPingTimer();\n this._stopDuringStartError = error || new AbortError(\"The connection was stopped before the hub handshake could complete.\");\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\n // to the disconnected state if need be before HttpConnection.stop() completes.\n return this.connection.stop(error);\n }\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult} An object that yields results from the server as they are received.\r\n */\n stream(methodName, ...args) {\n const [streams, streamIds] = this._replaceStreamingParams(args);\n const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);\n // eslint-disable-next-line prefer-const\n let promiseQueue;\n const subject = new Subject();\n subject.cancelCallback = () => {\n const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);\n delete this._callbacks[invocationDescriptor.invocationId];\n return promiseQueue.then(() => {\n return this._sendWithProtocol(cancelInvocation);\n });\n };\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\n if (error) {\n subject.error(error);\n return;\n } else if (invocationEvent) {\n // invocationEvent will not be null when an error is not passed to the callback\n if (invocationEvent.type === MessageType.Completion) {\n if (invocationEvent.error) {\n subject.error(new Error(invocationEvent.error));\n } else {\n subject.complete();\n }\n } else {\n subject.next(invocationEvent.item);\n }\n }\n };\n promiseQueue = this._sendWithProtocol(invocationDescriptor).catch(e => {\n subject.error(e);\n delete this._callbacks[invocationDescriptor.invocationId];\n });\n this._launchStreams(streams, promiseQueue);\n return subject;\n }\n _sendMessage(message) {\n this._resetKeepAliveInterval();\n return this.connection.send(message);\n }\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\n _sendWithProtocol(message) {\n return this._sendMessage(this._protocol.writeMessage(message));\n }\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\n send(methodName, ...args) {\n const [streams, streamIds] = this._replaceStreamingParams(args);\n const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));\n this._launchStreams(streams, sendPromise);\n return sendPromise;\n }\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\n invoke(methodName, ...args) {\n const [streams, streamIds] = this._replaceStreamingParams(args);\n const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);\n const p = new Promise((resolve, reject) => {\n // invocationId will always have a value for a non-blocking invocation\n this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error) => {\n if (error) {\n reject(error);\n return;\n } else if (invocationEvent) {\n // invocationEvent will not be null when an error is not passed to the callback\n if (invocationEvent.type === MessageType.Completion) {\n if (invocationEvent.error) {\n reject(new Error(invocationEvent.error));\n } else {\n resolve(invocationEvent.result);\n }\n } else {\n reject(new Error(`Unexpected message type: ${invocationEvent.type}`));\n }\n }\n };\n const promiseQueue = this._sendWithProtocol(invocationDescriptor).catch(e => {\n reject(e);\n // invocationId will always have a value for a non-blocking invocation\n delete this._callbacks[invocationDescriptor.invocationId];\n });\n this._launchStreams(streams, promiseQueue);\n });\n return p;\n }\n on(methodName, newMethod) {\n if (!methodName || !newMethod) {\n return;\n }\n methodName = methodName.toLowerCase();\n if (!this._methods[methodName]) {\n this._methods[methodName] = [];\n }\n // Preventing adding the same handler multiple times.\n if (this._methods[methodName].indexOf(newMethod) !== -1) {\n return;\n }\n this._methods[methodName].push(newMethod);\n }\n off(methodName, method) {\n if (!methodName) {\n return;\n }\n methodName = methodName.toLowerCase();\n const handlers = this._methods[methodName];\n if (!handlers) {\n return;\n }\n if (method) {\n const removeIdx = handlers.indexOf(method);\n if (removeIdx !== -1) {\n handlers.splice(removeIdx, 1);\n if (handlers.length === 0) {\n delete this._methods[methodName];\n }\n }\n } else {\n delete this._methods[methodName];\n }\n }\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\n onclose(callback) {\n if (callback) {\n this._closedCallbacks.push(callback);\n }\n }\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\n onreconnecting(callback) {\n if (callback) {\n this._reconnectingCallbacks.push(callback);\n }\n }\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\n onreconnected(callback) {\n if (callback) {\n this._reconnectedCallbacks.push(callback);\n }\n }\n _processIncomingData(data) {\n this._cleanupTimeout();\n if (!this._receivedHandshakeResponse) {\n data = this._processHandshakeResponse(data);\n this._receivedHandshakeResponse = true;\n }\n // Data may have all been read when processing handshake response\n if (data) {\n // Parse the messages\n const messages = this._protocol.parseMessages(data, this._logger);\n for (const message of messages) {\n switch (message.type) {\n case MessageType.Invocation:\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._invokeClientMethod(message);\n break;\n case MessageType.StreamItem:\n case MessageType.Completion:\n {\n const callback = this._callbacks[message.invocationId];\n if (callback) {\n if (message.type === MessageType.Completion) {\n delete this._callbacks[message.invocationId];\n }\n try {\n callback(message);\n } catch (e) {\n this._logger.log(LogLevel.Error, `Stream callback threw error: ${getErrorString(e)}`);\n }\n }\n break;\n }\n case MessageType.Ping:\n // Don't care about pings\n break;\n case MessageType.Close:\n {\n this._logger.log(LogLevel.Information, \"Close message received from server.\");\n const error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\n if (message.allowReconnect === true) {\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.connection.stop(error);\n } else {\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\n this._stopPromise = this._stopInternal(error);\n }\n break;\n }\n default:\n this._logger.log(LogLevel.Warning, `Invalid message type: ${message.type}.`);\n break;\n }\n }\n }\n this._resetTimeoutPeriod();\n }\n _processHandshakeResponse(data) {\n let responseMessage;\n let remainingData;\n try {\n [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);\n } catch (e) {\n const message = \"Error parsing handshake response: \" + e;\n this._logger.log(LogLevel.Error, message);\n const error = new Error(message);\n this._handshakeRejecter(error);\n throw error;\n }\n if (responseMessage.error) {\n const message = \"Server returned handshake error: \" + responseMessage.error;\n this._logger.log(LogLevel.Error, message);\n const error = new Error(message);\n this._handshakeRejecter(error);\n throw error;\n } else {\n this._logger.log(LogLevel.Debug, \"Server handshake complete.\");\n }\n this._handshakeResolver();\n return remainingData;\n }\n _resetKeepAliveInterval() {\n if (this.connection.features.inherentKeepAlive) {\n return;\n }\n // Set the time we want the next keep alive to be sent\n // Timer will be setup on next message receive\n this._nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\n this._cleanupPingTimer();\n }\n _resetTimeoutPeriod() {\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\n // Set the timeout timer\n this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);\n // Set keepAlive timer if there isn't one\n if (this._pingServerHandle === undefined) {\n let nextPing = this._nextKeepAlive - new Date().getTime();\n if (nextPing < 0) {\n nextPing = 0;\n }\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\n this._pingServerHandle = setTimeout(async () => {\n if (this._connectionState === HubConnectionState.Connected) {\n try {\n await this._sendMessage(this._cachedPingMessage);\n } catch {\n // We don't care about the error. It should be seen elsewhere in the client.\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\n this._cleanupPingTimer();\n }\n }\n }, nextPing);\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n serverTimeout() {\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\n }\n async _invokeClientMethod(invocationMessage) {\n const methodName = invocationMessage.target.toLowerCase();\n const methods = this._methods[methodName];\n if (!methods) {\n this._logger.log(LogLevel.Warning, `No client method with the name '${methodName}' found.`);\n // No handlers provided by client but the server is expecting a response still, so we send an error\n if (invocationMessage.invocationId) {\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\n await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null));\n }\n return;\n }\n // Avoid issues with handlers removing themselves thus modifying the list while iterating through it\n const methodsCopy = methods.slice();\n // Server expects a response\n const expectsResponse = invocationMessage.invocationId ? true : false;\n // We preserve the last result or exception but still call all handlers\n let res;\n let exception;\n let completionMessage;\n for (const m of methodsCopy) {\n try {\n const prevRes = res;\n res = await m.apply(this, invocationMessage.arguments);\n if (expectsResponse && res && prevRes) {\n this._logger.log(LogLevel.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);\n }\n // Ignore exception if we got a result after, the exception will be logged\n exception = undefined;\n } catch (e) {\n exception = e;\n this._logger.log(LogLevel.Error, `A callback for the method '${methodName}' threw error '${e}'.`);\n }\n }\n if (completionMessage) {\n await this._sendWithProtocol(completionMessage);\n } else if (expectsResponse) {\n // If there is an exception that means either no result was given or a handler after a result threw\n if (exception) {\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);\n } else if (res !== undefined) {\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);\n } else {\n this._logger.log(LogLevel.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);\n // Client didn't provide a result or throw from a handler, server expects a response so we send an error\n completionMessage = this._createCompletionMessage(invocationMessage.invocationId, \"Client didn't provide a result.\", null);\n }\n await this._sendWithProtocol(completionMessage);\n } else {\n if (res) {\n this._logger.log(LogLevel.Error, `Result given for '${methodName}' method but server is not expecting a result.`);\n }\n }\n }\n _connectionClosed(error) {\n this._logger.log(LogLevel.Debug, `HubConnection.connectionClosed(${error}) called while in state ${this._connectionState}.`);\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\n this._stopDuringStartError = this._stopDuringStartError || error || new AbortError(\"The underlying connection was closed before the hub handshake could complete.\");\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\n // If it has already completed, this should just noop.\n if (this._handshakeResolver) {\n this._handshakeResolver();\n }\n this._cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\n this._cleanupTimeout();\n this._cleanupPingTimer();\n if (this._connectionState === HubConnectionState.Disconnecting) {\n this._completeClose(error);\n } else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this._reconnect(error);\n } else if (this._connectionState === HubConnectionState.Connected) {\n this._completeClose(error);\n }\n // If none of the above if conditions were true were called the HubConnection must be in either:\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\n // and potentially continue the reconnect() loop.\n // 3. The Disconnected state in which case we're already done.\n }\n\n _completeClose(error) {\n if (this._connectionStarted) {\n this._connectionState = HubConnectionState.Disconnected;\n this._connectionStarted = false;\n if (Platform.isBrowser) {\n window.document.removeEventListener(\"freeze\", this._freezeEventListener);\n }\n try {\n this._closedCallbacks.forEach(c => c.apply(this, [error]));\n } catch (e) {\n this._logger.log(LogLevel.Error, `An onclose callback called with error '${error}' threw error '${e}'.`);\n }\n }\n }\n async _reconnect(error) {\n const reconnectStartTime = Date.now();\n let previousReconnectAttempts = 0;\n let retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\n let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\n if (nextRetryDelay === null) {\n this._logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\n this._completeClose(error);\n return;\n }\n this._connectionState = HubConnectionState.Reconnecting;\n if (error) {\n this._logger.log(LogLevel.Information, `Connection reconnecting because of error '${error}'.`);\n } else {\n this._logger.log(LogLevel.Information, \"Connection reconnecting.\");\n }\n if (this._reconnectingCallbacks.length !== 0) {\n try {\n this._reconnectingCallbacks.forEach(c => c.apply(this, [error]));\n } catch (e) {\n this._logger.log(LogLevel.Error, `An onreconnecting callback called with error '${error}' threw error '${e}'.`);\n }\n // Exit early if an onreconnecting callback called connection.stop().\n if (this._connectionState !== HubConnectionState.Reconnecting) {\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\n return;\n }\n }\n while (nextRetryDelay !== null) {\n this._logger.log(LogLevel.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);\n await new Promise(resolve => {\n this._reconnectDelayHandle = setTimeout(resolve, nextRetryDelay);\n });\n this._reconnectDelayHandle = undefined;\n if (this._connectionState !== HubConnectionState.Reconnecting) {\n this._logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\n return;\n }\n try {\n await this._startInternal();\n this._connectionState = HubConnectionState.Connected;\n this._logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\n if (this._reconnectedCallbacks.length !== 0) {\n try {\n this._reconnectedCallbacks.forEach(c => c.apply(this, [this.connection.connectionId]));\n } catch (e) {\n this._logger.log(LogLevel.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e}'.`);\n }\n }\n return;\n } catch (e) {\n this._logger.log(LogLevel.Information, `Reconnect attempt failed because of error '${e}'.`);\n if (this._connectionState !== HubConnectionState.Reconnecting) {\n this._logger.log(LogLevel.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\n if (this._connectionState === HubConnectionState.Disconnecting) {\n this._completeClose();\n }\n return;\n }\n retryError = e instanceof Error ? e : new Error(e.toString());\n nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\n }\n }\n this._logger.log(LogLevel.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);\n this._completeClose();\n }\n _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {\n try {\n return this._reconnectPolicy.nextRetryDelayInMilliseconds({\n elapsedMilliseconds,\n previousRetryCount,\n retryReason\n });\n } catch (e) {\n this._logger.log(LogLevel.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e}'.`);\n return null;\n }\n }\n _cancelCallbacksWithError(error) {\n const callbacks = this._callbacks;\n this._callbacks = {};\n Object.keys(callbacks).forEach(key => {\n const callback = callbacks[key];\n try {\n callback(null, error);\n } catch (e) {\n this._logger.log(LogLevel.Error, `Stream 'error' callback called with '${error}' threw error: ${getErrorString(e)}`);\n }\n });\n }\n _cleanupPingTimer() {\n if (this._pingServerHandle) {\n clearTimeout(this._pingServerHandle);\n this._pingServerHandle = undefined;\n }\n }\n _cleanupTimeout() {\n if (this._timeoutHandle) {\n clearTimeout(this._timeoutHandle);\n }\n }\n _createInvocation(methodName, args, nonblocking, streamIds) {\n if (nonblocking) {\n if (streamIds.length !== 0) {\n return {\n arguments: args,\n streamIds,\n target: methodName,\n type: MessageType.Invocation\n };\n } else {\n return {\n arguments: args,\n target: methodName,\n type: MessageType.Invocation\n };\n }\n } else {\n const invocationId = this._invocationId;\n this._invocationId++;\n if (streamIds.length !== 0) {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n streamIds,\n target: methodName,\n type: MessageType.Invocation\n };\n } else {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n target: methodName,\n type: MessageType.Invocation\n };\n }\n }\n }\n _launchStreams(streams, promiseQueue) {\n if (streams.length === 0) {\n return;\n }\n // Synchronize stream data so they arrive in-order on the server\n if (!promiseQueue) {\n promiseQueue = Promise.resolve();\n }\n // We want to iterate over the keys, since the keys are the stream ids\n // eslint-disable-next-line guard-for-in\n for (const streamId in streams) {\n streams[streamId].subscribe({\n complete: () => {\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));\n },\n error: err => {\n let message;\n if (err instanceof Error) {\n message = err.message;\n } else if (err && err.toString) {\n message = err.toString();\n } else {\n message = \"Unknown error\";\n }\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));\n },\n next: item => {\n promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));\n }\n });\n }\n }\n _replaceStreamingParams(args) {\n const streams = [];\n const streamIds = [];\n for (let i = 0; i < args.length; i++) {\n const argument = args[i];\n if (this._isObservable(argument)) {\n const streamId = this._invocationId;\n this._invocationId++;\n // Store the stream for later use\n streams[streamId] = argument;\n streamIds.push(streamId.toString());\n // remove stream from args\n args.splice(i, 1);\n }\n }\n return [streams, streamIds];\n }\n _isObservable(arg) {\n // This allows other stream implementations to just work (like rxjs)\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\n }\n _createStreamInvocation(methodName, args, streamIds) {\n const invocationId = this._invocationId;\n this._invocationId++;\n if (streamIds.length !== 0) {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n streamIds,\n target: methodName,\n type: MessageType.StreamInvocation\n };\n } else {\n return {\n arguments: args,\n invocationId: invocationId.toString(),\n target: methodName,\n type: MessageType.StreamInvocation\n };\n }\n }\n _createCancelInvocation(id) {\n return {\n invocationId: id,\n type: MessageType.CancelInvocation\n };\n }\n _createStreamItemMessage(id, item) {\n return {\n invocationId: id,\n item,\n type: MessageType.StreamItem\n };\n }\n _createCompletionMessage(id, error, result) {\n if (error) {\n return {\n error,\n invocationId: id,\n type: MessageType.Completion\n };\n }\n return {\n invocationId: id,\n result,\n type: MessageType.Completion\n };\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// 0, 2, 10, 30 second delays before reconnect attempts.\nconst DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null];\n/** @private */\nexport class DefaultReconnectPolicy {\n constructor(retryDelays) {\n this._retryDelays = retryDelays !== undefined ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;\n }\n nextRetryDelayInMilliseconds(retryContext) {\n return this._retryDelays[retryContext.previousRetryCount];\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\r\n// The .NET Foundation licenses this file to you under the MIT license.\r\n\r\nexport abstract class HeaderNames {\r\n static readonly Authorization = \"Authorization\";\r\n static readonly Cookie = \"Cookie\";\r\n}\r\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { HeaderNames } from \"./HeaderNames\";\nimport { HttpClient } from \"./HttpClient\";\n/** @private */\nexport class AccessTokenHttpClient extends HttpClient {\n constructor(innerClient, accessTokenFactory) {\n super();\n this._innerClient = innerClient;\n this._accessTokenFactory = accessTokenFactory;\n }\n async send(request) {\n let allowRetry = true;\n if (this._accessTokenFactory && (!this._accessToken || request.url && request.url.indexOf(\"/negotiate?\") > 0)) {\n // don't retry if the request is a negotiate or if we just got a potentially new token from the access token factory\n allowRetry = false;\n this._accessToken = await this._accessTokenFactory();\n }\n this._setAuthorizationHeader(request);\n const response = await this._innerClient.send(request);\n if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {\n this._accessToken = await this._accessTokenFactory();\n this._setAuthorizationHeader(request);\n return await this._innerClient.send(request);\n }\n return response;\n }\n _setAuthorizationHeader(request) {\n if (!request.headers) {\n request.headers = {};\n }\n if (this._accessToken) {\n request.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;\n }\n // don't remove the header if there isn't an access token factory, the user manually added the header in this case\n else if (this._accessTokenFactory) {\n if (request.headers[HeaderNames.Authorization]) {\n delete request.headers[HeaderNames.Authorization];\n }\n }\n }\n getCookieString(url) {\n return this._innerClient.getCookieString(url);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\n/** Specifies a specific HTTP transport type. */\nexport var HttpTransportType = /*#__PURE__*/function (HttpTransportType) {\n /** Specifies no transport preference. */\n HttpTransportType[HttpTransportType[\"None\"] = 0] = \"None\";\n /** Specifies the WebSockets transport. */\n HttpTransportType[HttpTransportType[\"WebSockets\"] = 1] = \"WebSockets\";\n /** Specifies the Server-Sent Events transport. */\n HttpTransportType[HttpTransportType[\"ServerSentEvents\"] = 2] = \"ServerSentEvents\";\n /** Specifies the Long Polling transport. */\n HttpTransportType[HttpTransportType[\"LongPolling\"] = 4] = \"LongPolling\";\n return HttpTransportType;\n}(HttpTransportType || {});\n/** Specifies the transfer format for a connection. */\nexport var TransferFormat = /*#__PURE__*/function (TransferFormat) {\n /** Specifies that only text data will be transmitted over the connection. */\n TransferFormat[TransferFormat[\"Text\"] = 1] = \"Text\";\n /** Specifies that binary data will be transmitted over the connection. */\n TransferFormat[TransferFormat[\"Binary\"] = 2] = \"Binary\";\n return TransferFormat;\n}(TransferFormat || {});\n\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\n// it's a very new API right now.\n// Not exported from index.\n/** @private */\nexport class AbortController {\n constructor() {\n this._isAborted = false;\n this.onabort = null;\n }\n abort() {\n if (!this._isAborted) {\n this._isAborted = true;\n if (this.onabort) {\n this.onabort();\n }\n }\n }\n get signal() {\n return this;\n }\n get aborted() {\n return this._isAborted;\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AbortController } from \"./AbortController\";\nimport { HttpError, TimeoutError } from \"./Errors\";\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { Arg, getDataDetail, getUserAgentHeader, sendMessage } from \"./Utils\";\n// Not exported from 'index', this type is internal.\n/** @private */\nexport class LongPollingTransport {\n constructor(httpClient, logger, options) {\n this._httpClient = httpClient;\n this._logger = logger;\n this._pollAbort = new AbortController();\n this._options = options;\n this._running = false;\n this.onreceive = null;\n this.onclose = null;\n }\n // This is an internal type, not exported from 'index' so this is really just internal.\n get pollAborted() {\n return this._pollAbort.aborted;\n }\n async connect(url, transferFormat) {\n Arg.isRequired(url, \"url\");\n Arg.isRequired(transferFormat, \"transferFormat\");\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._url = url;\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\n if (transferFormat === TransferFormat.Binary && typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\") {\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\n }\n const [name, value] = getUserAgentHeader();\n const headers = {\n [name]: value,\n ...this._options.headers\n };\n const pollOptions = {\n abortSignal: this._pollAbort.signal,\n headers,\n timeout: 100000,\n withCredentials: this._options.withCredentials\n };\n if (transferFormat === TransferFormat.Binary) {\n pollOptions.responseType = \"arraybuffer\";\n }\n // Make initial long polling request\n // Server uses first long polling request to finish initializing connection and it returns without data\n const pollUrl = `${url}&_=${Date.now()}`;\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\n const response = await this._httpClient.get(pollUrl, pollOptions);\n if (response.statusCode !== 200) {\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\n // Mark running as false so that the poll immediately ends and runs the close logic\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\n this._running = false;\n } else {\n this._running = true;\n }\n this._receiving = this._poll(this._url, pollOptions);\n }\n async _poll(url, pollOptions) {\n try {\n while (this._running) {\n try {\n const pollUrl = `${url}&_=${Date.now()}`;\n this._logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\n const response = await this._httpClient.get(pollUrl, pollOptions);\n if (response.statusCode === 204) {\n this._logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\n this._running = false;\n } else if (response.statusCode !== 200) {\n this._logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\n // Unexpected status code\n this._closeError = new HttpError(response.statusText || \"\", response.statusCode);\n this._running = false;\n } else {\n // Process the response\n if (response.content) {\n this._logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);\n if (this.onreceive) {\n this.onreceive(response.content);\n }\n } else {\n // This is another way timeout manifest.\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\n }\n }\n } catch (e) {\n if (!this._running) {\n // Log but disregard errors that occur after stopping\n this._logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\n } else {\n if (e instanceof TimeoutError) {\n // Ignore timeouts and reissue the poll.\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\n } else {\n // Close the connection with the error as the result.\n this._closeError = e;\n this._running = false;\n }\n }\n }\n }\n } finally {\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\n if (!this.pollAborted) {\n this._raiseOnClose();\n }\n }\n }\n async send(data) {\n if (!this._running) {\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\n }\n return sendMessage(this._logger, \"LongPolling\", this._httpClient, this._url, data, this._options);\n }\n async stop() {\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\n this._running = false;\n this._pollAbort.abort();\n try {\n await this._receiving;\n // Send DELETE to clean up long polling on the server\n this._logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n const deleteOptions = {\n headers: {\n ...headers,\n ...this._options.headers\n },\n timeout: this._options.timeout,\n withCredentials: this._options.withCredentials\n };\n await this._httpClient.delete(this._url, deleteOptions);\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request sent.\");\n } finally {\n this._logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\n // Raise close event here instead of in polling\n // It needs to happen after the DELETE request is sent\n this._raiseOnClose();\n }\n }\n _raiseOnClose() {\n if (this.onclose) {\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\n if (this._closeError) {\n logMessage += \" Error: \" + this._closeError;\n }\n this._logger.log(LogLevel.Trace, logMessage);\n this.onclose(this._closeError);\n }\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { Arg, getDataDetail, getUserAgentHeader, Platform, sendMessage } from \"./Utils\";\n/** @private */\nexport class ServerSentEventsTransport {\n constructor(httpClient, accessToken, logger, options) {\n this._httpClient = httpClient;\n this._accessToken = accessToken;\n this._logger = logger;\n this._options = options;\n this.onreceive = null;\n this.onclose = null;\n }\n async connect(url, transferFormat) {\n Arg.isRequired(url, \"url\");\n Arg.isRequired(transferFormat, \"transferFormat\");\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._logger.log(LogLevel.Trace, \"(SSE transport) Connecting.\");\n // set url before accessTokenFactory because this._url is only for send and we set the auth header instead of the query string for send\n this._url = url;\n if (this._accessToken) {\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(this._accessToken)}`;\n }\n return new Promise((resolve, reject) => {\n let opened = false;\n if (transferFormat !== TransferFormat.Text) {\n reject(new Error(\"The Server-Sent Events transport only supports the 'Text' transfer format\"));\n return;\n }\n let eventSource;\n if (Platform.isBrowser || Platform.isWebWorker) {\n eventSource = new this._options.EventSource(url, {\n withCredentials: this._options.withCredentials\n });\n } else {\n // Non-browser passes cookies via the dictionary\n const cookies = this._httpClient.getCookieString(url);\n const headers = {};\n headers.Cookie = cookies;\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n eventSource = new this._options.EventSource(url, {\n withCredentials: this._options.withCredentials,\n headers: {\n ...headers,\n ...this._options.headers\n }\n });\n }\n try {\n eventSource.onmessage = e => {\n if (this.onreceive) {\n try {\n this._logger.log(LogLevel.Trace, `(SSE transport) data received. ${getDataDetail(e.data, this._options.logMessageContent)}.`);\n this.onreceive(e.data);\n } catch (error) {\n this._close(error);\n return;\n }\n }\n };\n // @ts-ignore: not using event on purpose\n eventSource.onerror = e => {\n // EventSource doesn't give any useful information about server side closes.\n if (opened) {\n this._close();\n } else {\n reject(new Error(\"EventSource failed to connect. The connection could not be found on the server,\" + \" either the connection ID is not present on the server, or a proxy is refusing/buffering the connection.\" + \" If you have multiple servers check that sticky sessions are enabled.\"));\n }\n };\n eventSource.onopen = () => {\n this._logger.log(LogLevel.Information, `SSE connected to ${this._url}`);\n this._eventSource = eventSource;\n opened = true;\n resolve();\n };\n } catch (e) {\n reject(e);\n return;\n }\n });\n }\n async send(data) {\n if (!this._eventSource) {\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\n }\n return sendMessage(this._logger, \"SSE\", this._httpClient, this._url, data, this._options);\n }\n stop() {\n this._close();\n return Promise.resolve();\n }\n _close(e) {\n if (this._eventSource) {\n this._eventSource.close();\n this._eventSource = undefined;\n if (this.onclose) {\n this.onclose(e);\n }\n }\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { HeaderNames } from \"./HeaderNames\";\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { Arg, getDataDetail, getUserAgentHeader, Platform } from \"./Utils\";\n/** @private */\nexport class WebSocketTransport {\n constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {\n this._logger = logger;\n this._accessTokenFactory = accessTokenFactory;\n this._logMessageContent = logMessageContent;\n this._webSocketConstructor = webSocketConstructor;\n this._httpClient = httpClient;\n this.onreceive = null;\n this.onclose = null;\n this._headers = headers;\n }\n async connect(url, transferFormat) {\n Arg.isRequired(url, \"url\");\n Arg.isRequired(transferFormat, \"transferFormat\");\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) Connecting.\");\n let token;\n if (this._accessTokenFactory) {\n token = await this._accessTokenFactory();\n }\n return new Promise((resolve, reject) => {\n url = url.replace(/^http/, \"ws\");\n let webSocket;\n const cookies = this._httpClient.getCookieString(url);\n let opened = false;\n if (Platform.isNode || Platform.isReactNative) {\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n if (token) {\n headers[HeaderNames.Authorization] = `Bearer ${token}`;\n }\n if (cookies) {\n headers[HeaderNames.Cookie] = cookies;\n }\n // Only pass headers when in non-browser environments\n webSocket = new this._webSocketConstructor(url, undefined, {\n headers: {\n ...headers,\n ...this._headers\n }\n });\n } else {\n if (token) {\n url += (url.indexOf(\"?\") < 0 ? \"?\" : \"&\") + `access_token=${encodeURIComponent(token)}`;\n }\n }\n if (!webSocket) {\n // Chrome is not happy with passing 'undefined' as protocol\n webSocket = new this._webSocketConstructor(url);\n }\n if (transferFormat === TransferFormat.Binary) {\n webSocket.binaryType = \"arraybuffer\";\n }\n webSocket.onopen = _event => {\n this._logger.log(LogLevel.Information, `WebSocket connected to ${url}.`);\n this._webSocket = webSocket;\n opened = true;\n resolve();\n };\n webSocket.onerror = event => {\n let error = null;\n // ErrorEvent is a browser only type we need to check if the type exists before using it\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\n error = event.error;\n } else {\n error = \"There was an error with the transport\";\n }\n this._logger.log(LogLevel.Information, `(WebSockets transport) ${error}.`);\n };\n webSocket.onmessage = message => {\n this._logger.log(LogLevel.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);\n if (this.onreceive) {\n try {\n this.onreceive(message.data);\n } catch (error) {\n this._close(error);\n return;\n }\n }\n };\n webSocket.onclose = event => {\n // Don't call close handler if connection was never established\n // We'll reject the connect call instead\n if (opened) {\n this._close(event);\n } else {\n let error = null;\n // ErrorEvent is a browser only type we need to check if the type exists before using it\n if (typeof ErrorEvent !== \"undefined\" && event instanceof ErrorEvent) {\n error = event.error;\n } else {\n error = \"WebSocket failed to connect. The connection could not be found on the server,\" + \" either the endpoint may not be a SignalR endpoint,\" + \" the connection ID is not present on the server, or there is a proxy blocking WebSockets.\" + \" If you have multiple servers check that sticky sessions are enabled.\";\n }\n reject(new Error(error));\n }\n };\n });\n }\n send(data) {\n if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {\n this._logger.log(LogLevel.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);\n this._webSocket.send(data);\n return Promise.resolve();\n }\n return Promise.reject(\"WebSocket is not in the OPEN state\");\n }\n stop() {\n if (this._webSocket) {\n // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning\n // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects\n this._close(undefined);\n }\n return Promise.resolve();\n }\n _close(event) {\n // webSocket will be null if the transport did not start successfully\n if (this._webSocket) {\n // Clear websocket handlers because we are considering the socket closed now\n this._webSocket.onclose = () => {};\n this._webSocket.onmessage = () => {};\n this._webSocket.onerror = () => {};\n this._webSocket.close();\n this._webSocket = undefined;\n }\n this._logger.log(LogLevel.Trace, \"(WebSockets transport) socket closed.\");\n if (this.onclose) {\n if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {\n this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || \"no reason given\"}).`));\n } else if (event instanceof Error) {\n this.onclose(event);\n } else {\n this.onclose();\n }\n }\n }\n _isCloseEvent(event) {\n return event && typeof event.wasClean === \"boolean\" && typeof event.code === \"number\";\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { AccessTokenHttpClient } from \"./AccessTokenHttpClient\";\nimport { DefaultHttpClient } from \"./DefaultHttpClient\";\nimport { AggregateErrors, DisabledTransportError, FailedToNegotiateWithServerError, FailedToStartTransportError, HttpError, UnsupportedTransportError, AbortError } from \"./Errors\";\nimport { LogLevel } from \"./ILogger\";\nimport { HttpTransportType, TransferFormat } from \"./ITransport\";\nimport { LongPollingTransport } from \"./LongPollingTransport\";\nimport { ServerSentEventsTransport } from \"./ServerSentEventsTransport\";\nimport { Arg, createLogger, getUserAgentHeader, Platform } from \"./Utils\";\nimport { WebSocketTransport } from \"./WebSocketTransport\";\nconst MAX_REDIRECTS = 100;\n/** @private */\nexport class HttpConnection {\n constructor(url, options = {}) {\n this._stopPromiseResolver = () => {};\n this.features = {};\n this._negotiateVersion = 1;\n Arg.isRequired(url, \"url\");\n this._logger = createLogger(options.logger);\n this.baseUrl = this._resolveUrl(url);\n options = options || {};\n options.logMessageContent = options.logMessageContent === undefined ? false : options.logMessageContent;\n if (typeof options.withCredentials === \"boolean\" || options.withCredentials === undefined) {\n options.withCredentials = options.withCredentials === undefined ? true : options.withCredentials;\n } else {\n throw new Error(\"withCredentials option was not a 'boolean' or 'undefined' value\");\n }\n options.timeout = options.timeout === undefined ? 100 * 1000 : options.timeout;\n let webSocketModule = null;\n let eventSourceModule = null;\n if (Platform.isNode && typeof require !== \"undefined\") {\n // In order to ignore the dynamic require in webpack builds we need to do this magic\n // @ts-ignore: TS doesn't know about these names\n const requireFunc = typeof __webpack_require__ === \"function\" ? __non_webpack_require__ : require;\n webSocketModule = requireFunc(\"ws\");\n eventSourceModule = requireFunc(\"eventsource\");\n }\n if (!Platform.isNode && typeof WebSocket !== \"undefined\" && !options.WebSocket) {\n options.WebSocket = WebSocket;\n } else if (Platform.isNode && !options.WebSocket) {\n if (webSocketModule) {\n options.WebSocket = webSocketModule;\n }\n }\n if (!Platform.isNode && typeof EventSource !== \"undefined\" && !options.EventSource) {\n options.EventSource = EventSource;\n } else if (Platform.isNode && !options.EventSource) {\n if (typeof eventSourceModule !== \"undefined\") {\n options.EventSource = eventSourceModule;\n }\n }\n this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);\n this._connectionState = \"Disconnected\" /* Disconnected */;\n this._connectionStarted = false;\n this._options = options;\n this.onreceive = null;\n this.onclose = null;\n }\n async start(transferFormat) {\n transferFormat = transferFormat || TransferFormat.Binary;\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\n this._logger.log(LogLevel.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);\n if (this._connectionState !== \"Disconnected\" /* Disconnected */) {\n return Promise.reject(new Error(\"Cannot start an HttpConnection that is not in the 'Disconnected' state.\"));\n }\n this._connectionState = \"Connecting\" /* Connecting */;\n this._startInternalPromise = this._startInternal(transferFormat);\n await this._startInternalPromise;\n // The TypeScript compiler thinks that connectionState must be Connecting here. The TypeScript compiler is wrong.\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\n // stop() was called and transitioned the client into the Disconnecting state.\n const message = \"Failed to start the HttpConnection before stop() was called.\";\n this._logger.log(LogLevel.Error, message);\n // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise.\n await this._stopPromise;\n return Promise.reject(new AbortError(message));\n } else if (this._connectionState !== \"Connected\" /* Connected */) {\n // stop() was called and transitioned the client into the Disconnecting state.\n const message = \"HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!\";\n this._logger.log(LogLevel.Error, message);\n return Promise.reject(new AbortError(message));\n }\n this._connectionStarted = true;\n }\n send(data) {\n if (this._connectionState !== \"Connected\" /* Connected */) {\n return Promise.reject(new Error(\"Cannot send data if the connection is not in the 'Connected' State.\"));\n }\n if (!this._sendQueue) {\n this._sendQueue = new TransportSendQueue(this.transport);\n }\n // Transport will not be null if state is connected\n return this._sendQueue.send(data);\n }\n async stop(error) {\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnected state.`);\n return Promise.resolve();\n }\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stop(${error}) ignored because the connection is already in the disconnecting state.`);\n return this._stopPromise;\n }\n this._connectionState = \"Disconnecting\" /* Disconnecting */;\n this._stopPromise = new Promise(resolve => {\n // Don't complete stop() until stopConnection() completes.\n this._stopPromiseResolver = resolve;\n });\n // stopInternal should never throw so just observe it.\n await this._stopInternal(error);\n await this._stopPromise;\n }\n async _stopInternal(error) {\n // Set error as soon as possible otherwise there is a race between\n // the transport closing and providing an error and the error from a close message\n // We would prefer the close message error.\n this._stopError = error;\n try {\n await this._startInternalPromise;\n } catch (e) {\n // This exception is returned to the user as a rejected Promise from the start method.\n }\n // The transport's onclose will trigger stopConnection which will run our onclose event.\n // The transport should always be set if currently connected. If it wasn't set, it's likely because\n // stop was called during start() and start() failed.\n if (this.transport) {\n try {\n await this.transport.stop();\n } catch (e) {\n this._logger.log(LogLevel.Error, `HttpConnection.transport.stop() threw error '${e}'.`);\n this._stopConnection();\n }\n this.transport = undefined;\n } else {\n this._logger.log(LogLevel.Debug, \"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.\");\n }\n }\n async _startInternal(transferFormat) {\n // Store the original base url and the access token factory since they may change\n // as part of negotiating\n let url = this.baseUrl;\n this._accessTokenFactory = this._options.accessTokenFactory;\n this._httpClient._accessTokenFactory = this._accessTokenFactory;\n try {\n if (this._options.skipNegotiation) {\n if (this._options.transport === HttpTransportType.WebSockets) {\n // No need to add a connection ID in this case\n this.transport = this._constructTransport(HttpTransportType.WebSockets);\n // We should just call connect directly in this case.\n // No fallback or negotiate in this case.\n await this._startTransport(url, transferFormat);\n } else {\n throw new Error(\"Negotiation can only be skipped when using the WebSocket transport directly.\");\n }\n } else {\n let negotiateResponse = null;\n let redirects = 0;\n do {\n negotiateResponse = await this._getNegotiationResponse(url);\n // the user tries to stop the connection when it is being started\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */ || this._connectionState === \"Disconnected\" /* Disconnected */) {\n throw new AbortError(\"The connection was stopped during negotiation.\");\n }\n if (negotiateResponse.error) {\n throw new Error(negotiateResponse.error);\n }\n if (negotiateResponse.ProtocolVersion) {\n throw new Error(\"Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.\");\n }\n if (negotiateResponse.url) {\n url = negotiateResponse.url;\n }\n if (negotiateResponse.accessToken) {\n // Replace the current access token factory with one that uses\n // the returned access token\n const accessToken = negotiateResponse.accessToken;\n this._accessTokenFactory = () => accessToken;\n // set the factory to undefined so the AccessTokenHttpClient won't retry with the same token, since we know it won't change until a connection restart\n this._httpClient._accessToken = accessToken;\n this._httpClient._accessTokenFactory = undefined;\n }\n redirects++;\n } while (negotiateResponse.url && redirects < MAX_REDIRECTS);\n if (redirects === MAX_REDIRECTS && negotiateResponse.url) {\n throw new Error(\"Negotiate redirection limit exceeded.\");\n }\n await this._createTransport(url, this._options.transport, negotiateResponse, transferFormat);\n }\n if (this.transport instanceof LongPollingTransport) {\n this.features.inherentKeepAlive = true;\n }\n if (this._connectionState === \"Connecting\" /* Connecting */) {\n // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise.\n // start() will handle the case when stop was called and startInternal exits still in the disconnecting state.\n this._logger.log(LogLevel.Debug, \"The HttpConnection connected successfully.\");\n this._connectionState = \"Connected\" /* Connected */;\n }\n // stop() is waiting on us via this.startInternalPromise so keep this.transport around so it can clean up.\n // This is the only case startInternal can exit in neither the connected nor disconnected state because stopConnection()\n // will transition to the disconnected state. start() will wait for the transition using the stopPromise.\n } catch (e) {\n this._logger.log(LogLevel.Error, \"Failed to start the connection: \" + e);\n this._connectionState = \"Disconnected\" /* Disconnected */;\n this.transport = undefined;\n // if start fails, any active calls to stop assume that start will complete the stop promise\n this._stopPromiseResolver();\n return Promise.reject(e);\n }\n }\n async _getNegotiationResponse(url) {\n const headers = {};\n const [name, value] = getUserAgentHeader();\n headers[name] = value;\n const negotiateUrl = this._resolveNegotiateUrl(url);\n this._logger.log(LogLevel.Debug, `Sending negotiation request: ${negotiateUrl}.`);\n try {\n const response = await this._httpClient.post(negotiateUrl, {\n content: \"\",\n headers: {\n ...headers,\n ...this._options.headers\n },\n timeout: this._options.timeout,\n withCredentials: this._options.withCredentials\n });\n if (response.statusCode !== 200) {\n return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));\n }\n const negotiateResponse = JSON.parse(response.content);\n if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {\n // Negotiate version 0 doesn't use connectionToken\n // So we set it equal to connectionId so all our logic can use connectionToken without being aware of the negotiate version\n negotiateResponse.connectionToken = negotiateResponse.connectionId;\n }\n return negotiateResponse;\n } catch (e) {\n let errorMessage = \"Failed to complete negotiation with the server: \" + e;\n if (e instanceof HttpError) {\n if (e.statusCode === 404) {\n errorMessage = errorMessage + \" Either this is not a SignalR endpoint or there is a proxy blocking the connection.\";\n }\n }\n this._logger.log(LogLevel.Error, errorMessage);\n return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));\n }\n }\n _createConnectUrl(url, connectionToken) {\n if (!connectionToken) {\n return url;\n }\n return url + (url.indexOf(\"?\") === -1 ? \"?\" : \"&\") + `id=${connectionToken}`;\n }\n async _createTransport(url, requestedTransport, negotiateResponse, requestedTransferFormat) {\n let connectUrl = this._createConnectUrl(url, negotiateResponse.connectionToken);\n if (this._isITransport(requestedTransport)) {\n this._logger.log(LogLevel.Debug, \"Connection was provided an instance of ITransport, using that directly.\");\n this.transport = requestedTransport;\n await this._startTransport(connectUrl, requestedTransferFormat);\n this.connectionId = negotiateResponse.connectionId;\n return;\n }\n const transportExceptions = [];\n const transports = negotiateResponse.availableTransports || [];\n let negotiate = negotiateResponse;\n for (const endpoint of transports) {\n const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);\n if (transportOrError instanceof Error) {\n // Store the error and continue, we don't want to cause a re-negotiate in these cases\n transportExceptions.push(`${endpoint.transport} failed:`);\n transportExceptions.push(transportOrError);\n } else if (this._isITransport(transportOrError)) {\n this.transport = transportOrError;\n if (!negotiate) {\n try {\n negotiate = await this._getNegotiationResponse(url);\n } catch (ex) {\n return Promise.reject(ex);\n }\n connectUrl = this._createConnectUrl(url, negotiate.connectionToken);\n }\n try {\n await this._startTransport(connectUrl, requestedTransferFormat);\n this.connectionId = negotiate.connectionId;\n return;\n } catch (ex) {\n this._logger.log(LogLevel.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);\n negotiate = undefined;\n transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));\n if (this._connectionState !== \"Connecting\" /* Connecting */) {\n const message = \"Failed to select transport before stop() was called.\";\n this._logger.log(LogLevel.Debug, message);\n return Promise.reject(new AbortError(message));\n }\n }\n }\n }\n if (transportExceptions.length > 0) {\n return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(\" \")}`, transportExceptions));\n }\n return Promise.reject(new Error(\"None of the transports supported by the client are supported by the server.\"));\n }\n _constructTransport(transport) {\n switch (transport) {\n case HttpTransportType.WebSockets:\n if (!this._options.WebSocket) {\n throw new Error(\"'WebSocket' is not supported in your environment.\");\n }\n return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});\n case HttpTransportType.ServerSentEvents:\n if (!this._options.EventSource) {\n throw new Error(\"'EventSource' is not supported in your environment.\");\n }\n return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);\n case HttpTransportType.LongPolling:\n return new LongPollingTransport(this._httpClient, this._logger, this._options);\n default:\n throw new Error(`Unknown transport: ${transport}.`);\n }\n }\n _startTransport(url, transferFormat) {\n this.transport.onreceive = this.onreceive;\n this.transport.onclose = e => this._stopConnection(e);\n return this.transport.connect(url, transferFormat);\n }\n _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat) {\n const transport = HttpTransportType[endpoint.transport];\n if (transport === null || transport === undefined) {\n this._logger.log(LogLevel.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\n return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);\n } else {\n if (transportMatches(requestedTransport, transport)) {\n const transferFormats = endpoint.transferFormats.map(s => TransferFormat[s]);\n if (transferFormats.indexOf(requestedTransferFormat) >= 0) {\n if (transport === HttpTransportType.WebSockets && !this._options.WebSocket || transport === HttpTransportType.ServerSentEvents && !this._options.EventSource) {\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);\n return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);\n } else {\n this._logger.log(LogLevel.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);\n try {\n return this._constructTransport(transport);\n } catch (ex) {\n return ex;\n }\n }\n } else {\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);\n return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);\n }\n } else {\n this._logger.log(LogLevel.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);\n return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);\n }\n }\n }\n _isITransport(transport) {\n return transport && typeof transport === \"object\" && \"connect\" in transport;\n }\n _stopConnection(error) {\n this._logger.log(LogLevel.Debug, `HttpConnection.stopConnection(${error}) called while in state ${this._connectionState}.`);\n this.transport = undefined;\n // If we have a stopError, it takes precedence over the error from the transport\n error = this._stopError || error;\n this._stopError = undefined;\n if (this._connectionState === \"Disconnected\" /* Disconnected */) {\n this._logger.log(LogLevel.Debug, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is already in the disconnected state.`);\n return;\n }\n if (this._connectionState === \"Connecting\" /* Connecting */) {\n this._logger.log(LogLevel.Warning, `Call to HttpConnection.stopConnection(${error}) was ignored because the connection is still in the connecting state.`);\n throw new Error(`HttpConnection.stopConnection(${error}) was called while the connection is still in the connecting state.`);\n }\n if (this._connectionState === \"Disconnecting\" /* Disconnecting */) {\n // A call to stop() induced this call to stopConnection and needs to be completed.\n // Any stop() awaiters will be scheduled to continue after the onclose callback fires.\n this._stopPromiseResolver();\n }\n if (error) {\n this._logger.log(LogLevel.Error, `Connection disconnected with error '${error}'.`);\n } else {\n this._logger.log(LogLevel.Information, \"Connection disconnected.\");\n }\n if (this._sendQueue) {\n this._sendQueue.stop().catch(e => {\n this._logger.log(LogLevel.Error, `TransportSendQueue.stop() threw error '${e}'.`);\n });\n this._sendQueue = undefined;\n }\n this.connectionId = undefined;\n this._connectionState = \"Disconnected\" /* Disconnected */;\n if (this._connectionStarted) {\n this._connectionStarted = false;\n try {\n if (this.onclose) {\n this.onclose(error);\n }\n } catch (e) {\n this._logger.log(LogLevel.Error, `HttpConnection.onclose(${error}) threw error '${e}'.`);\n }\n }\n }\n _resolveUrl(url) {\n // startsWith is not supported in IE\n if (url.lastIndexOf(\"https://\", 0) === 0 || url.lastIndexOf(\"http://\", 0) === 0) {\n return url;\n }\n if (!Platform.isBrowser) {\n throw new Error(`Cannot resolve '${url}'.`);\n }\n // Setting the url to the href propery of an anchor tag handles normalization\n // for us. There are 3 main cases.\n // 1. Relative path normalization e.g \"b\" -> \"http://localhost:5000/a/b\"\n // 2. Absolute path normalization e.g \"/a/b\" -> \"http://localhost:5000/a/b\"\n // 3. Networkpath reference normalization e.g \"//localhost:5000/a/b\" -> \"http://localhost:5000/a/b\"\n const aTag = window.document.createElement(\"a\");\n aTag.href = url;\n this._logger.log(LogLevel.Information, `Normalizing '${url}' to '${aTag.href}'.`);\n return aTag.href;\n }\n _resolveNegotiateUrl(url) {\n const index = url.indexOf(\"?\");\n let negotiateUrl = url.substring(0, index === -1 ? url.length : index);\n if (negotiateUrl[negotiateUrl.length - 1] !== \"/\") {\n negotiateUrl += \"/\";\n }\n negotiateUrl += \"negotiate\";\n negotiateUrl += index === -1 ? \"\" : url.substring(index);\n if (negotiateUrl.indexOf(\"negotiateVersion\") === -1) {\n negotiateUrl += index === -1 ? \"?\" : \"&\";\n negotiateUrl += \"negotiateVersion=\" + this._negotiateVersion;\n }\n return negotiateUrl;\n }\n}\nfunction transportMatches(requestedTransport, actualTransport) {\n return !requestedTransport || (actualTransport & requestedTransport) !== 0;\n}\n/** @private */\nexport class TransportSendQueue {\n constructor(_transport) {\n this._transport = _transport;\n this._buffer = [];\n this._executing = true;\n this._sendBufferedData = new PromiseSource();\n this._transportResult = new PromiseSource();\n this._sendLoopPromise = this._sendLoop();\n }\n send(data) {\n this._bufferData(data);\n if (!this._transportResult) {\n this._transportResult = new PromiseSource();\n }\n return this._transportResult.promise;\n }\n stop() {\n this._executing = false;\n this._sendBufferedData.resolve();\n return this._sendLoopPromise;\n }\n _bufferData(data) {\n if (this._buffer.length && typeof this._buffer[0] !== typeof data) {\n throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof data}`);\n }\n this._buffer.push(data);\n this._sendBufferedData.resolve();\n }\n async _sendLoop() {\n while (true) {\n await this._sendBufferedData.promise;\n if (!this._executing) {\n if (this._transportResult) {\n this._transportResult.reject(\"Connection stopped.\");\n }\n break;\n }\n this._sendBufferedData = new PromiseSource();\n const transportResult = this._transportResult;\n this._transportResult = undefined;\n const data = typeof this._buffer[0] === \"string\" ? this._buffer.join(\"\") : TransportSendQueue._concatBuffers(this._buffer);\n this._buffer.length = 0;\n try {\n await this._transport.send(data);\n transportResult.resolve();\n } catch (error) {\n transportResult.reject(error);\n }\n }\n }\n static _concatBuffers(arrayBuffers) {\n const totalLength = arrayBuffers.map(b => b.byteLength).reduce((a, b) => a + b);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n for (const item of arrayBuffers) {\n result.set(new Uint8Array(item), offset);\n offset += item.byteLength;\n }\n return result.buffer;\n }\n}\nclass PromiseSource {\n constructor() {\n this.promise = new Promise((resolve, reject) => [this._resolver, this._rejecter] = [resolve, reject]);\n }\n resolve() {\n this._resolver();\n }\n reject(reason) {\n this._rejecter(reason);\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { MessageType } from \"./IHubProtocol\";\nimport { LogLevel } from \"./ILogger\";\nimport { TransferFormat } from \"./ITransport\";\nimport { NullLogger } from \"./Loggers\";\nimport { TextMessageFormat } from \"./TextMessageFormat\";\nconst JSON_HUB_PROTOCOL_NAME = \"json\";\n/** Implements the JSON Hub Protocol. */\nexport class JsonHubProtocol {\n constructor() {\n /** @inheritDoc */\n this.name = JSON_HUB_PROTOCOL_NAME;\n /** @inheritDoc */\n this.version = 1;\n /** @inheritDoc */\n this.transferFormat = TransferFormat.Text;\n }\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\n parseMessages(input, logger) {\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\n if (typeof input !== \"string\") {\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\n }\n if (!input) {\n return [];\n }\n if (logger === null) {\n logger = NullLogger.instance;\n }\n // Parse the messages\n const messages = TextMessageFormat.parse(input);\n const hubMessages = [];\n for (const message of messages) {\n const parsedMessage = JSON.parse(message);\n if (typeof parsedMessage.type !== \"number\") {\n throw new Error(\"Invalid payload.\");\n }\n switch (parsedMessage.type) {\n case MessageType.Invocation:\n this._isInvocationMessage(parsedMessage);\n break;\n case MessageType.StreamItem:\n this._isStreamItemMessage(parsedMessage);\n break;\n case MessageType.Completion:\n this._isCompletionMessage(parsedMessage);\n break;\n case MessageType.Ping:\n // Single value, no need to validate\n break;\n case MessageType.Close:\n // All optional values, no need to validate\n break;\n default:\n // Future protocol changes can add message types, old clients can ignore them\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\n continue;\n }\n hubMessages.push(parsedMessage);\n }\n return hubMessages;\n }\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\n writeMessage(message) {\n return TextMessageFormat.write(JSON.stringify(message));\n }\n _isInvocationMessage(message) {\n this._assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\n if (message.invocationId !== undefined) {\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\n }\n }\n _isStreamItemMessage(message) {\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\n if (message.item === undefined) {\n throw new Error(\"Invalid payload for StreamItem message.\");\n }\n }\n _isCompletionMessage(message) {\n if (message.result && message.error) {\n throw new Error(\"Invalid payload for Completion message.\");\n }\n if (!message.result && message.error) {\n this._assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\n }\n this._assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\n }\n _assertNotEmptyString(value, errorMessage) {\n if (typeof value !== \"string\" || value === \"\") {\n throw new Error(errorMessage);\n }\n }\n}\n","// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\nimport { HttpConnection } from \"./HttpConnection\";\nimport { HubConnection } from \"./HubConnection\";\nimport { LogLevel } from \"./ILogger\";\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\nimport { NullLogger } from \"./Loggers\";\nimport { Arg, ConsoleLogger } from \"./Utils\";\nconst LogLevelNameMapping = {\n trace: LogLevel.Trace,\n debug: LogLevel.Debug,\n info: LogLevel.Information,\n information: LogLevel.Information,\n warn: LogLevel.Warning,\n warning: LogLevel.Warning,\n error: LogLevel.Error,\n critical: LogLevel.Critical,\n none: LogLevel.None\n};\nfunction parseLogLevel(name) {\n // Case-insensitive matching via lower-casing\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\n const mapping = LogLevelNameMapping[name.toLowerCase()];\n if (typeof mapping !== \"undefined\") {\n return mapping;\n } else {\n throw new Error(`Unknown log level: ${name}`);\n }\n}\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\nexport class HubConnectionBuilder {\n configureLogging(logging) {\n Arg.isRequired(logging, \"logging\");\n if (isLogger(logging)) {\n this.logger = logging;\n } else if (typeof logging === \"string\") {\n const logLevel = parseLogLevel(logging);\n this.logger = new ConsoleLogger(logLevel);\n } else {\n this.logger = new ConsoleLogger(logging);\n }\n return this;\n }\n withUrl(url, transportTypeOrOptions) {\n Arg.isRequired(url, \"url\");\n Arg.isNotEmpty(url, \"url\");\n this.url = url;\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\n if (typeof transportTypeOrOptions === \"object\") {\n this.httpConnectionOptions = {\n ...this.httpConnectionOptions,\n ...transportTypeOrOptions\n };\n } else {\n this.httpConnectionOptions = {\n ...this.httpConnectionOptions,\n transport: transportTypeOrOptions\n };\n }\n return this;\n }\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\n withHubProtocol(protocol) {\n Arg.isRequired(protocol, \"protocol\");\n this.protocol = protocol;\n return this;\n }\n withAutomaticReconnect(retryDelaysOrReconnectPolicy) {\n if (this.reconnectPolicy) {\n throw new Error(\"A reconnectPolicy has already been set.\");\n }\n if (!retryDelaysOrReconnectPolicy) {\n this.reconnectPolicy = new DefaultReconnectPolicy();\n } else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\n } else {\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\n }\n return this;\n }\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\n build() {\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\n // provided to configureLogger\n const httpConnectionOptions = this.httpConnectionOptions || {};\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\n if (httpConnectionOptions.logger === undefined) {\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\n httpConnectionOptions.logger = this.logger;\n }\n // Now create the connection\n if (!this.url) {\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\n }\n const connection = new HttpConnection(this.url, httpConnectionOptions);\n return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);\n }\n}\nfunction isLogger(logger) {\n return logger.log !== undefined;\n}\n","import { Injectable } from '@angular/core';\r\nimport { HubConnection, HubConnectionBuilder } from '@microsoft/signalr';\r\nimport { BehaviorSubject, ReplaySubject } from 'rxjs';\r\nimport { environment } from 'src/environments/environment';\r\nimport { LibraryModifiedEvent } from '../_models/events/library-modified-event';\r\nimport { NotificationProgressEvent } from '../_models/events/notification-progress-event';\r\nimport { ThemeProgressEvent } from '../_models/events/theme-progress-event';\r\nimport { UserUpdateEvent } from '../_models/events/user-update-event';\r\nimport { User } from '../_models/user';\r\nimport {DashboardUpdateEvent} from \"../_models/events/dashboard-update-event\";\r\nimport {SideNavUpdateEvent} from \"../_models/events/sidenav-update-event\";\r\n\r\nexport enum EVENTS {\r\n UpdateAvailable = 'UpdateAvailable',\r\n ScanSeries = 'ScanSeries',\r\n SeriesAdded = 'SeriesAdded',\r\n SeriesRemoved = 'SeriesRemoved',\r\n ScanLibraryProgress = 'ScanLibraryProgress',\r\n OnlineUsers = 'OnlineUsers',\r\n SeriesAddedToCollection = 'SeriesAddedToCollection',\r\n /**\r\n * A generic error that occurs during operations on the server\r\n */\r\n Error = 'Error',\r\n BackupDatabaseProgress = 'BackupDatabaseProgress',\r\n /**\r\n * A subtype of NotificationProgress that represents maintenance cleanup on server-owned resources\r\n */\r\n CleanupProgress = 'CleanupProgress',\r\n /**\r\n * A subtype of NotificationProgress that represnts a user downloading a file or group of files.\r\n * Note: In v0.5.5, this is being replaced by an inbrowser experience. The message is changed and this will be moved to dashboard view once built\r\n */\r\n DownloadProgress = 'DownloadProgress',\r\n /**\r\n * A generic progress event\r\n */\r\n NotificationProgress = 'NotificationProgress',\r\n /**\r\n * A subtype of NotificationProgress that represents the underlying file being processed during a scan\r\n */\r\n FileScanProgress = 'FileScanProgress',\r\n /**\r\n * A custom user site theme is added or removed during a scan\r\n */\r\n SiteThemeProgress = 'SiteThemeProgress',\r\n /**\r\n * A cover is updated\r\n */\r\n CoverUpdate = 'CoverUpdate',\r\n /**\r\n * A subtype of NotificationProgress that represents a file being processed for cover image extraction\r\n */\r\n CoverUpdateProgress = 'CoverUpdateProgress',\r\n /**\r\n * A library is created or removed from the instance\r\n */\r\n LibraryModified = 'LibraryModified',\r\n /**\r\n * A user updates an entities read progress\r\n */\r\n UserProgressUpdate = 'UserProgressUpdate',\r\n /**\r\n * A user updates account or preferences\r\n */\r\n UserUpdate = 'UserUpdate',\r\n /**\r\n * When bulk bookmarks are being converted\r\n */\r\n ConvertBookmarksProgress = 'ConvertBookmarksProgress',\r\n /**\r\n * When files are being scanned to calculate word count\r\n */\r\n WordCountAnalyzerProgress = 'WordCountAnalyzerProgress',\r\n /**\r\n * When the user needs to be informed, but it's not a big deal\r\n */\r\n Info = 'Info',\r\n /**\r\n * A user is sending files to their device\r\n */\r\n SendingToDevice = 'SendingToDevice',\r\n /**\r\n * A scrobbling token has expired\r\n */\r\n ScrobblingKeyExpired = 'ScrobblingKeyExpired',\r\n /**\r\n * User's dashboard needs to be re-rendered\r\n */\r\n DashboardUpdate = 'DashboardUpdate',\r\n /**\r\n * User's sidenav needs to be re-rendered\r\n */\r\n SideNavUpdate = 'SideNavUpdate'\r\n}\r\n\r\nexport interface Message {\r\n event: EVENTS;\r\n payload: T;\r\n}\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class MessageHubService {\r\n hubUrl = environment.hubUrl;\r\n private hubConnection!: HubConnection;\r\n\r\n private messagesSource = new ReplaySubject>(1);\r\n private onlineUsersSource = new BehaviorSubject([]); // UserNames\r\n\r\n /**\r\n * Any events that come from the backend\r\n */\r\n public messages$ = this.messagesSource.asObservable();\r\n /**\r\n * Users that are online\r\n */\r\n public onlineUsers$ = this.onlineUsersSource.asObservable();\r\n\r\n constructor() {}\r\n\r\n /**\r\n * Tests that an event is of the type passed\r\n * @param event\r\n * @param eventType\r\n * @returns\r\n */\r\n public isEventType(event: Message, eventType: EVENTS) {\r\n if (event.event == EVENTS.NotificationProgress) {\r\n const notification = event.payload as NotificationProgressEvent;\r\n return notification.eventType.toLowerCase() == eventType.toLowerCase();\r\n }\r\n return event.event === eventType;\r\n }\r\n\r\n createHubConnection(user: User) {\r\n this.hubConnection = new HubConnectionBuilder()\r\n .withUrl(this.hubUrl + 'messages', {\r\n accessTokenFactory: () => user.token\r\n })\r\n .withAutomaticReconnect()\r\n .build();\r\n\r\n this.hubConnection\r\n .start()\r\n .catch(err => console.error(err));\r\n\r\n this.hubConnection.on(EVENTS.OnlineUsers, (usernames: string[]) => {\r\n this.onlineUsersSource.next(usernames);\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ScanSeries, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ScanSeries,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ScanLibraryProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ScanLibraryProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ConvertBookmarksProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ConvertBookmarksProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.WordCountAnalyzerProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.WordCountAnalyzerProgress,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.LibraryModified, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.LibraryModified,\r\n payload: resp.body as LibraryModifiedEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.DashboardUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.DashboardUpdate,\r\n payload: resp.body as DashboardUpdateEvent\r\n });\r\n });\r\n this.hubConnection.on(EVENTS.SideNavUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SideNavUpdate,\r\n payload: resp.body as SideNavUpdateEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.NotificationProgress, (resp: NotificationProgressEvent) => {\r\n this.messagesSource.next({\r\n event: EVENTS.NotificationProgress,\r\n payload: resp\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SiteThemeProgress, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SiteThemeProgress,\r\n payload: resp.body as ThemeProgressEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SeriesAddedToCollection, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SeriesAddedToCollection,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.UserProgressUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.UserProgressUpdate,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.UserUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.UserUpdate,\r\n payload: resp.body as UserUpdateEvent\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.Error, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.Error,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.Info, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.Info,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SeriesAdded, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SeriesAdded,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SeriesRemoved, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SeriesRemoved,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.CoverUpdate, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.CoverUpdate,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.UpdateAvailable, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.UpdateAvailable,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.SendingToDevice, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.SendingToDevice,\r\n payload: resp.body\r\n });\r\n });\r\n\r\n this.hubConnection.on(EVENTS.ScrobblingKeyExpired, resp => {\r\n this.messagesSource.next({\r\n event: EVENTS.ScrobblingKeyExpired,\r\n payload: resp.body\r\n });\r\n });\r\n }\r\n\r\n stopHubConnection() {\r\n if (this.hubConnection) {\r\n this.hubConnection.stop().catch(err => console.error(err));\r\n }\r\n }\r\n\r\n sendMessage(methodName: string, body?: any) {\r\n return this.hubConnection.invoke(methodName, body);\r\n }\r\n\r\n}\r\n","import { Component, OnInit } from '@angular/core';\r\nimport { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';\r\nimport { ConfirmButton } from './_models/confirm-button';\r\nimport { ConfirmConfig } from './_models/confirm-config';\r\nimport {CommonModule} from \"@angular/common\";\r\nimport {SafeHtmlPipe} from \"../../_pipes/safe-html.pipe\";\r\nimport {TranslocoDirective} from \"@ngneat/transloco\";\r\n\r\n@Component({\r\n selector: 'app-confirm-dialog',\r\n standalone: true,\r\n imports: [CommonModule, SafeHtmlPipe, TranslocoDirective],\r\n templateUrl: './confirm-dialog.component.html',\r\n styleUrls: ['./confirm-dialog.component.scss']\r\n})\r\nexport class ConfirmDialogComponent implements OnInit {\r\n\r\n config!: ConfirmConfig;\r\n\r\n constructor(public modal: NgbActiveModal) {}\r\n\r\n ngOnInit(): void {\r\n if (this.config) {\r\n this.config.buttons.sort(this._button_sort);\r\n }\r\n }\r\n\r\n private _button_sort(x: ConfirmButton, y: ConfirmButton) {\r\n const xIsSecondary = x.type === 'secondary';\r\n const yIsSecondary = y.type === 'secondary';\r\n if (xIsSecondary && !yIsSecondary) {\r\n return -1;\r\n } else if (!xIsSecondary && yIsSecondary) {\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\n clickButton(button: ConfirmButton) {\r\n this.modal.close(button.type === 'primary');\r\n }\r\n\r\n close() {\r\n this.modal.close(false);\r\n }\r\n\r\n}\r\n","\r\n
\r\n

{{config.header}}

\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n","import { ConfirmButton } from './confirm-button';\r\n\r\nexport class ConfirmConfig {\r\n _type: string = 'confirm'; // internal only: confirm or alert (todo: use enum)\r\n header: string = 'Confirm';\r\n content: string = '';\r\n buttons: Array = [];\r\n /**\r\n * If the close button shouldn't be rendered\r\n */\r\n disableEscape: boolean = false;\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\r\nimport { take } from 'rxjs/operators';\r\nimport { ConfirmDialogComponent } from './confirm-dialog/confirm-dialog.component';\r\nimport { ConfirmConfig } from './confirm-dialog/_models/confirm-config';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ConfirmService {\r\n\r\n defaultConfirm = new ConfirmConfig();\r\n defaultAlert = new ConfirmConfig();\r\n\r\n constructor(private modalService: NgbModal) {\r\n this.defaultConfirm.buttons.push({text: 'Cancel', type: 'secondary'});\r\n this.defaultConfirm.buttons.push({text: 'Confirm', type: 'primary'});\r\n\r\n this.defaultAlert._type = 'alert';\r\n this.defaultAlert.header = 'Alert';\r\n this.defaultAlert.buttons.push({text: 'Ok', type: 'primary'});\r\n\r\n }\r\n\r\n public async confirm(content?: string, config?: ConfirmConfig): Promise {\r\n\r\n return new Promise((resolve, reject) => {\r\n if (content === undefined && config === undefined) {\r\n console.error('Confirm must have either text or a config object passed');\r\n return reject(false);\r\n }\r\n\r\n if (content !== undefined && config === undefined) {\r\n config = this.defaultConfirm;\r\n config.content = content;\r\n }\r\n if (content !== undefined && content !== '' && config!.content === '') {\r\n config!.content = content;\r\n }\r\n\r\n const modalRef = this.modalService.open(ConfirmDialogComponent);\r\n modalRef.componentInstance.config = config;\r\n modalRef.closed.pipe(take(1)).subscribe(result => {\r\n return resolve(result);\r\n });\r\n modalRef.dismissed.pipe(take(1)).subscribe(() => {\r\n return resolve(false);\r\n });\r\n });\r\n\r\n }\r\n\r\n public async alert(content?: string, config?: ConfirmConfig): Promise {\r\n return new Promise((resolve, reject) => {\r\n if (content === undefined && config === undefined) {\r\n console.error('Alert must have either text or a config object passed');\r\n return reject(false);\r\n }\r\n\r\n if (content !== undefined && config === undefined) {\r\n config = this.defaultConfirm;\r\n config.content = content;\r\n }\r\n\r\n const modalRef = this.modalService.open(ConfirmDialogComponent);\r\n modalRef.componentInstance.config = config;\r\n modalRef.closed.pipe(take(1)).subscribe(result => {\r\n return resolve(result);\r\n });\r\n modalRef.dismissed.pipe(take(1)).subscribe(() => {\r\n return resolve(false);\r\n });\r\n })\r\n }\r\n}\r\n","/**\r\n * Where does the theme come from\r\n */\r\n export enum ThemeProvider {\r\n System = 1,\r\n User = 2\r\n }\r\n \r\n /**\r\n * Theme for the whole instance\r\n */\r\n export interface SiteTheme {\r\n id: number;\r\n name: string;\r\n normalizedName: string;\r\n filePath: string;\r\n isDefault: boolean;\r\n provider: ThemeProvider;\r\n /**\r\n * The actual class the root is defined against. It is generated at the backend.\r\n */\r\n selector: string;\r\n }","import { DOCUMENT } from '@angular/common';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport {\r\n DestroyRef,\r\n inject,\r\n Inject,\r\n Injectable,\r\n Renderer2,\r\n RendererFactory2,\r\n SecurityContext\r\n} from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { ToastrService } from 'ngx-toastr';\r\nimport { map, ReplaySubject, take } from 'rxjs';\r\nimport { environment } from 'src/environments/environment';\r\nimport { ConfirmService } from '../shared/confirm.service';\r\nimport { NotificationProgressEvent } from '../_models/events/notification-progress-event';\r\nimport { SiteTheme, ThemeProvider } from '../_models/preferences/site-theme';\r\nimport { TextResonse } from '../_types/text-response';\r\nimport { EVENTS, MessageHubService } from './message-hub.service';\r\nimport {takeUntilDestroyed} from \"@angular/core/rxjs-interop\";\r\nimport {translate} from \"@ngneat/transloco\";\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ThemeService {\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n public defaultTheme: string = 'dark';\r\n public defaultBookTheme: string = 'Dark';\r\n\r\n private currentThemeSource = new ReplaySubject(1);\r\n public currentTheme$ = this.currentThemeSource.asObservable();\r\n\r\n private themesSource = new ReplaySubject(1);\r\n public themes$ = this.themesSource.asObservable();\r\n\r\n /**\r\n * Maintain a cache of themes. SignalR will inform us if we need to refresh cache\r\n */\r\n private themeCache: Array = [];\r\n\r\n private renderer: Renderer2;\r\n private baseUrl = environment.apiUrl;\r\n\r\n\r\n constructor(rendererFactory: RendererFactory2, @Inject(DOCUMENT) private document: Document, private httpClient: HttpClient,\r\n messageHub: MessageHubService, private domSanitizer: DomSanitizer, private confirmService: ConfirmService, private toastr: ToastrService) {\r\n this.renderer = rendererFactory.createRenderer(null, null);\r\n\r\n messageHub.messages$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(message => {\r\n\r\n if (message.event !== EVENTS.NotificationProgress) return;\r\n const notificationEvent = (message.payload as NotificationProgressEvent);\r\n if (notificationEvent.name !== EVENTS.SiteThemeProgress) return;\r\n\r\n if (notificationEvent.eventType === 'ended') {\r\n if (notificationEvent.name === EVENTS.SiteThemeProgress) this.getThemes().subscribe(() => {\r\n\r\n });\r\n }\r\n });\r\n }\r\n\r\n getColorScheme() {\r\n return getComputedStyle(this.document.body).getPropertyValue('--color-scheme').trim();\r\n }\r\n\r\n /**\r\n * --theme-color from theme. Updates the meta tag\r\n * @returns\r\n */\r\n getThemeColor() {\r\n return getComputedStyle(this.document.body).getPropertyValue('--theme-color').trim();\r\n }\r\n\r\n /**\r\n * --msapplication-TileColor from theme. Updates the meta tag\r\n * @returns\r\n */\r\n getTileColor() {\r\n return getComputedStyle(this.document.body).getPropertyValue('--title-color').trim();\r\n }\r\n\r\n getCssVariable(variable: string) {\r\n return getComputedStyle(this.document.body).getPropertyValue(variable).trim();\r\n }\r\n\r\n isDarkTheme() {\r\n return this.getColorScheme().toLowerCase() === 'dark';\r\n }\r\n\r\n getThemes() {\r\n return this.httpClient.get(this.baseUrl + 'theme').pipe(map(themes => {\r\n this.themeCache = themes;\r\n this.themesSource.next(themes);\r\n this.currentTheme$.pipe(take(1)).subscribe(theme => {\r\n if (themes.filter(t => t.id === theme.id).length === 0) {\r\n this.setTheme(this.defaultTheme);\r\n this.toastr.info(translate('toasts.theme-missing'));\r\n }\r\n });\r\n return themes;\r\n }));\r\n }\r\n\r\n /**\r\n * Used in book reader to remove all themes so book reader can provide custom theming options\r\n */\r\n clearThemes() {\r\n this.unsetThemes();\r\n }\r\n\r\n setDefault(themeId: number) {\r\n return this.httpClient.post(this.baseUrl + 'theme/update-default', {themeId: themeId}).pipe(map(() => {\r\n // Refresh the cache when a default state is changed\r\n this.getThemes().subscribe(() => {});\r\n }));\r\n }\r\n\r\n scan() {\r\n return this.httpClient.post(this.baseUrl + 'theme/scan', {});\r\n }\r\n\r\n /**\r\n * Sets the book theme on the body tag so css variable overrides can take place\r\n * @param selector brtheme- prefixed string\r\n */\r\n setBookTheme(selector: string) {\r\n this.unsetBookThemes();\r\n this.renderer.addClass(this.document.querySelector('body'), selector);\r\n }\r\n\r\n clearBookTheme() {\r\n this.unsetBookThemes();\r\n }\r\n\r\n\r\n /**\r\n * Sets the theme as active. Will inject a style tag into document to load a custom theme and apply the selector to the body\r\n * @param themeName\r\n */\r\n setTheme(themeName: string) {\r\n const theme = this.themeCache.find(t => t.name.toLowerCase() === themeName.toLowerCase());\r\n if (theme) {\r\n this.unsetThemes();\r\n this.renderer.addClass(this.document.querySelector('body'), theme.selector);\r\n\r\n if (theme.provider === ThemeProvider.User && !this.hasThemeInHead(theme.name)) {\r\n // We need to load the styles into the browser\r\n this.fetchThemeContent(theme.id).subscribe(async (content) => {\r\n if (content === null) {\r\n await this.confirmService.alert(translate('toasts.alert-bad-theme'));\r\n this.setTheme('dark');\r\n return;\r\n }\r\n const styleElem = this.document.createElement('style');\r\n styleElem.id = 'theme-' + theme.name;\r\n styleElem.appendChild(this.document.createTextNode(content));\r\n\r\n this.renderer.appendChild(this.document.head, styleElem);\r\n\r\n // Check if the theme has --theme-color and apply it to meta tag\r\n const themeColor = this.getThemeColor();\r\n if (themeColor) {\r\n this.document.querySelector('meta[name=\"theme-color\"]')?.setAttribute('content', themeColor);\r\n this.document.querySelector('meta[name=\"apple-mobile-web-app-status-bar-style\"]')?.setAttribute('content', themeColor);\r\n }\r\n\r\n const tileColor = this.getTileColor();\r\n if (tileColor) {\r\n this.document.querySelector('meta[name=\"msapplication-TileColor\"]')?.setAttribute('content', themeColor);\r\n }\r\n\r\n const colorScheme = this.getColorScheme();\r\n if (colorScheme) {\r\n this.document.querySelector('body')?.setAttribute('theme', colorScheme);\r\n }\r\n\r\n this.currentThemeSource.next(theme);\r\n });\r\n } else {\r\n this.currentThemeSource.next(theme);\r\n }\r\n } else {\r\n // Only time themes isn't already loaded is on first load\r\n this.getThemes().subscribe(themes => {\r\n this.setTheme(themeName);\r\n });\r\n }\r\n }\r\n\r\n private hasThemeInHead(themeName: string) {\r\n const id = 'theme-' + themeName.toLowerCase();\r\n return Array.from(this.document.head.children).filter(el => el.tagName === 'STYLE' && el.id.toLowerCase() === id).length > 0;\r\n }\r\n\r\n private fetchThemeContent(themeId: number) {\r\n return this.httpClient.get(this.baseUrl + 'theme/download-content?themeId=' + themeId, TextResonse).pipe(map(encodedCss => {\r\n return this.domSanitizer.sanitize(SecurityContext.STYLE, encodedCss);\r\n }));\r\n }\r\n\r\n private unsetThemes() {\r\n this.themeCache.forEach(theme => this.document.body.classList.remove(theme.selector));\r\n }\r\n\r\n private unsetBookThemes() {\r\n Array.from(this.document.body.classList).filter(cls => cls.startsWith('brtheme-')).forEach(c => this.document.body.classList.remove(c));\r\n }\r\n\r\n\r\n}\r\n","import { HttpClient } from '@angular/common/http';\r\nimport {DestroyRef, inject, Injectable } from '@angular/core';\r\nimport {catchError, of, ReplaySubject, throwError} from 'rxjs';\r\nimport {filter, map, switchMap, tap} from 'rxjs/operators';\r\nimport { environment } from 'src/environments/environment';\r\nimport { Preferences } from '../_models/preferences/preferences';\r\nimport { User } from '../_models/user';\r\nimport { Router } from '@angular/router';\r\nimport { EVENTS, MessageHubService } from './message-hub.service';\r\nimport { ThemeService } from './theme.service';\r\nimport { InviteUserResponse } from '../_models/auth/invite-user-response';\r\nimport { UserUpdateEvent } from '../_models/events/user-update-event';\r\nimport { UpdateEmailResponse } from '../_models/auth/update-email-response';\r\nimport { AgeRating } from '../_models/metadata/age-rating';\r\nimport { AgeRestriction } from '../_models/metadata/age-restriction';\r\nimport { TextResonse } from '../_types/text-response';\r\nimport {takeUntilDestroyed} from \"@angular/core/rxjs-interop\";\r\n\r\nexport enum Role {\r\n Admin = 'Admin',\r\n ChangePassword = 'Change Password',\r\n Bookmark = 'Bookmark',\r\n Download = 'Download',\r\n ChangeRestriction = 'Change Restriction'\r\n}\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AccountService {\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n baseUrl = environment.apiUrl;\r\n userKey = 'kavita-user';\r\n public static lastLoginKey = 'kavita-lastlogin';\r\n public static localeKey = 'kavita-locale';\r\n private currentUser: User | undefined;\r\n\r\n // Stores values, when someone subscribes gives (1) of last values seen.\r\n private currentUserSource = new ReplaySubject(1);\r\n public currentUser$ = this.currentUserSource.asObservable();\r\n\r\n private hasValidLicenseSource = new ReplaySubject(1);\r\n /**\r\n * Does the user have an active license\r\n */\r\n public hasValidLicense$ = this.hasValidLicenseSource.asObservable();\r\n\r\n /**\r\n * SetTimeout handler for keeping track of refresh token call\r\n */\r\n private refreshTokenTimeout: ReturnType | undefined;\r\n\r\n constructor(private httpClient: HttpClient, private router: Router,\r\n private messageHub: MessageHubService, private themeService: ThemeService) {\r\n messageHub.messages$.pipe(filter(evt => evt.event === EVENTS.UserUpdate),\r\n map(evt => evt.payload as UserUpdateEvent),\r\n filter(userUpdateEvent => userUpdateEvent.userName === this.currentUser?.username),\r\n switchMap(() => this.refreshAccount()))\r\n .subscribe(() => {});\r\n }\r\n\r\n hasAdminRole(user: User) {\r\n return user && user.roles.includes(Role.Admin);\r\n }\r\n\r\n hasChangePasswordRole(user: User) {\r\n return user && user.roles.includes(Role.ChangePassword);\r\n }\r\n\r\n hasChangeAgeRestrictionRole(user: User) {\r\n return user && user.roles.includes(Role.ChangeRestriction);\r\n }\r\n\r\n hasDownloadRole(user: User) {\r\n return user && user.roles.includes(Role.Download);\r\n }\r\n\r\n hasBookmarkRole(user: User) {\r\n return user && user.roles.includes(Role.Bookmark);\r\n }\r\n\r\n getRoles() {\r\n return this.httpClient.get(this.baseUrl + 'account/roles');\r\n }\r\n\r\n deleteLicense() {\r\n return this.httpClient.delete(this.baseUrl + 'license', TextResonse);\r\n }\r\n\r\n hasValidLicense(forceCheck: boolean = false) {\r\n return this.httpClient.get(this.baseUrl + 'license/valid-license?forceCheck=' + forceCheck, TextResonse)\r\n .pipe(\r\n map(res => res === \"true\"),\r\n tap(res => {\r\n this.hasValidLicenseSource.next(res)\r\n }),\r\n catchError(error => {\r\n this.hasValidLicenseSource.next(false);\r\n return throwError(error); // Rethrow the error to propagate it further\r\n })\r\n );\r\n }\r\n\r\n hasAnyLicense() {\r\n return this.httpClient.get(this.baseUrl + 'license/has-license', TextResonse)\r\n .pipe(\r\n map(res => res === \"true\"),\r\n );\r\n }\r\n\r\n updateUserLicense(license: string, email: string) {\r\n return this.httpClient.post(this.baseUrl + 'license', {license, email}, TextResonse)\r\n .pipe(map(res => res === \"true\"));\r\n }\r\n\r\n login(model: {username: string, password: string, apiKey?: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/login', model).pipe(\r\n map((response: User) => {\r\n const user = response;\r\n if (user) {\r\n this.setCurrentUser(user);\r\n }\r\n }),\r\n takeUntilDestroyed(this.destroyRef)\r\n );\r\n }\r\n\r\n setCurrentUser(user?: User) {\r\n if (user) {\r\n user.roles = [];\r\n const roles = this.getDecodedToken(user.token).role;\r\n Array.isArray(roles) ? user.roles = roles : user.roles.push(roles);\r\n\r\n localStorage.setItem(this.userKey, JSON.stringify(user));\r\n localStorage.setItem(AccountService.lastLoginKey, user.username);\r\n if (user.preferences && user.preferences.theme) {\r\n this.themeService.setTheme(user.preferences.theme.name);\r\n } else {\r\n this.themeService.setTheme(this.themeService.defaultTheme);\r\n }\r\n } else {\r\n this.themeService.setTheme(this.themeService.defaultTheme);\r\n }\r\n\r\n this.currentUser = user;\r\n this.currentUserSource.next(user);\r\n\r\n this.stopRefreshTokenTimer();\r\n\r\n if (this.currentUser) {\r\n this.messageHub.stopHubConnection();\r\n this.messageHub.createHubConnection(this.currentUser);\r\n this.hasValidLicense().subscribe();\r\n this.startRefreshTokenTimer();\r\n }\r\n }\r\n\r\n logout() {\r\n localStorage.removeItem(this.userKey);\r\n this.currentUserSource.next(undefined);\r\n this.currentUser = undefined;\r\n this.stopRefreshTokenTimer();\r\n this.messageHub.stopHubConnection();\r\n // Upon logout, perform redirection\r\n this.router.navigateByUrl('/login');\r\n }\r\n\r\n\r\n /**\r\n * Registers the first admin on the account. Only used for that. All other registrations must occur through invite\r\n * @param model\r\n * @returns\r\n */\r\n register(model: {username: string, password: string, email: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/register', model).pipe(\r\n map((user: User) => {\r\n return user;\r\n }),\r\n takeUntilDestroyed(this.destroyRef)\r\n );\r\n }\r\n\r\n isEmailConfirmed() {\r\n return this.httpClient.get(this.baseUrl + 'account/email-confirmed');\r\n }\r\n\r\n migrateUser(model: {email: string, username: string, password: string, sendEmail: boolean}) {\r\n return this.httpClient.post(this.baseUrl + 'account/migrate-email', model, TextResonse);\r\n }\r\n\r\n confirmMigrationEmail(model: {email: string, token: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-migration-email', model);\r\n }\r\n\r\n resendConfirmationEmail(userId: number) {\r\n return this.httpClient.post(this.baseUrl + 'account/resend-confirmation-email?userId=' + userId, {}, TextResonse);\r\n }\r\n\r\n inviteUser(model: {email: string, roles: Array, libraries: Array, ageRestriction: AgeRestriction}) {\r\n return this.httpClient.post(this.baseUrl + 'account/invite', model);\r\n }\r\n\r\n confirmEmail(model: {email: string, username: string, password: string, token: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-email', model);\r\n }\r\n\r\n confirmEmailUpdate(model: {email: string, token: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-email-update', model);\r\n }\r\n\r\n /**\r\n * Given a user id, returns a full url for setting up the user account\r\n * @param userId\r\n * @param withBaseUrl Should base url be included in invite url\r\n * @returns\r\n */\r\n getInviteUrl(userId: number, withBaseUrl: boolean = true) {\r\n return this.httpClient.get(this.baseUrl + 'account/invite-url?userId=' + userId + '&withBaseUrl=' + withBaseUrl, TextResonse);\r\n }\r\n\r\n getDecodedToken(token: string) {\r\n return JSON.parse(atob(token.split('.')[1]));\r\n }\r\n\r\n requestResetPasswordEmail(email: string) {\r\n return this.httpClient.post(this.baseUrl + 'account/forgot-password?email=' + encodeURIComponent(email), {}, TextResonse);\r\n }\r\n\r\n confirmResetPasswordEmail(model: {email: string, token: string, password: string}) {\r\n return this.httpClient.post(this.baseUrl + 'account/confirm-password-reset', model, TextResonse);\r\n }\r\n\r\n resetPassword(username: string, password: string, oldPassword: string) {\r\n return this.httpClient.post(this.baseUrl + 'account/reset-password', {username, password, oldPassword}, TextResonse);\r\n }\r\n\r\n update(model: {email: string, roles: Array, libraries: Array, userId: number, ageRestriction: AgeRestriction}) {\r\n return this.httpClient.post(this.baseUrl + 'account/update', model);\r\n }\r\n\r\n updateEmail(email: string, password: string) {\r\n return this.httpClient.post(this.baseUrl + 'account/update/email', {email, password});\r\n }\r\n\r\n updateAgeRestriction(ageRating: AgeRating, includeUnknowns: boolean) {\r\n return this.httpClient.post(this.baseUrl + 'account/update/age-restriction', {ageRating, includeUnknowns});\r\n }\r\n\r\n /**\r\n * This will get latest preferences for a user and cache them into user store\r\n * @returns\r\n */\r\n getPreferences() {\r\n return this.httpClient.get(this.baseUrl + 'users/get-preferences').pipe(map(pref => {\r\n if (this.currentUser !== undefined && this.currentUser !== null) {\r\n this.currentUser.preferences = pref;\r\n this.setCurrentUser(this.currentUser);\r\n }\r\n return pref;\r\n }), takeUntilDestroyed(this.destroyRef));\r\n }\r\n\r\n updatePreferences(userPreferences: Preferences) {\r\n return this.httpClient.post(this.baseUrl + 'users/update-preferences', userPreferences).pipe(map(settings => {\r\n if (this.currentUser !== undefined && this.currentUser !== null) {\r\n this.currentUser.preferences = settings;\r\n this.setCurrentUser(this.currentUser);\r\n\r\n // Update the locale on disk (for logout and compact-number pipe)\r\n localStorage.setItem(AccountService.localeKey, this.currentUser.preferences.locale);\r\n }\r\n return settings;\r\n }), takeUntilDestroyed(this.destroyRef));\r\n }\r\n\r\n getUserFromLocalStorage(): User | undefined {\r\n\r\n const userString = localStorage.getItem(this.userKey);\r\n\r\n if (userString) {\r\n return JSON.parse(userString)\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n resetApiKey() {\r\n return this.httpClient.post(this.baseUrl + 'account/reset-api-key', {}, TextResonse).pipe(map(key => {\r\n const user = this.getUserFromLocalStorage();\r\n if (user) {\r\n user.apiKey = key;\r\n\r\n localStorage.setItem(this.userKey, JSON.stringify(user));\r\n\r\n this.currentUserSource.next(user);\r\n this.currentUser = user;\r\n }\r\n return key;\r\n }));\r\n }\r\n\r\n getOpdsUrl() {\r\n return this.httpClient.get(this.baseUrl + 'account/opds-url', TextResonse);\r\n }\r\n\r\n\r\n private refreshAccount() {\r\n if (this.currentUser === null || this.currentUser === undefined) return of();\r\n return this.httpClient.get(this.baseUrl + 'account/refresh-account').pipe(map((user: User) => {\r\n if (user) {\r\n this.currentUser = {...user};\r\n }\r\n\r\n this.setCurrentUser(this.currentUser);\r\n return user;\r\n }));\r\n }\r\n\r\n\r\n private refreshToken() {\r\n if (this.currentUser === null || this.currentUser === undefined) return of();\r\n return this.httpClient.post<{token: string, refreshToken: string}>(this.baseUrl + 'account/refresh-token',\r\n {token: this.currentUser.token, refreshToken: this.currentUser.refreshToken}).pipe(map(user => {\r\n if (this.currentUser) {\r\n this.currentUser.token = user.token;\r\n this.currentUser.refreshToken = user.refreshToken;\r\n }\r\n\r\n this.setCurrentUser(this.currentUser);\r\n return user;\r\n }));\r\n }\r\n\r\n /**\r\n * Every 10 mins refresh the token\r\n */\r\n private startRefreshTokenTimer() {\r\n if (this.currentUser === null || this.currentUser === undefined) {\r\n this.stopRefreshTokenTimer();\r\n return;\r\n }\r\n\r\n this.stopRefreshTokenTimer();\r\n\r\n this.refreshTokenTimeout = setInterval(() => this.refreshToken().subscribe(() => {}), (60 * 10_000));\r\n }\r\n\r\n private stopRefreshTokenTimer() {\r\n if (this.refreshTokenTimeout !== undefined) {\r\n clearInterval(this.refreshTokenTimeout);\r\n }\r\n }\r\n\r\n}\r\n"],"mappings":"wpBAeA,IAAMA,GAAa,IAqJnB,SAASC,GAAQC,EAAMC,EAAa,CAClC,MAAO,CACL,KAAM,EACN,KAAAD,EACA,YAAAC,EACA,QAAS,CAAC,CACZ,CACF,CA2DA,SAASC,GAAQC,EAASC,EAAS,KAAM,CACvC,MAAO,CACL,KAAM,EACN,OAAAA,EACA,QAAAD,CACF,CACF,CA0EA,SAASE,GAASC,EAAOC,EAAU,KAAM,CACvC,MAAO,CACL,KAAM,EACN,MAAAD,EACA,QAAAC,CACF,CAC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AcmJ,UAAAC,WAFb,MAAM,CAAA,EAEd,IAAOpJ,EAAP4I,SAAO5I,CAAc,GAAA","names":["AUTO_STYLE","trigger","name","definitions","animate","timings","styles","sequence","steps","options","style","tokens","state","name","styles","transition","stateChangeExpr","steps","options","query","selector","animation","options","stagger","timings","NoopAnimationPlayer","duration","delay","fn","position","phaseName","methods","AnimationGroupPlayer","_players","doneCount","destroyCount","startCount","total","player","time","p","timeAtPosition","longestPlayer","longestSoFar","ɵPRE_STYLE","_c0","Toast_button_0_Template","rf","ctx","_r6","ɵɵgetCurrentView","ɵɵelementStart","ɵɵlistener","ɵɵrestoreView","ctx_r5","ɵɵnextContext","ɵɵresetView","ɵɵtext","ɵɵelementEnd","Toast_div_1_ng_container_2_Template","ɵɵelementContainerStart","ɵɵelementContainerEnd","ctx_r7","ɵɵadvance","ɵɵtextInterpolate1","Toast_div_1_Template","ɵɵtemplate","ctx_r1","ɵɵclassMap","ɵɵattribute","ɵɵproperty","Toast_div_2_Template","ɵɵelement","ctx_r2","ɵɵsanitizeHtml","Toast_div_3_Template","ctx_r3","Toast_div_4_Template","ctx_r4","ɵɵstyleProp","ToastNoAnimation_button_0_Template","ToastNoAnimation_div_1_ng_container_2_Template","ToastNoAnimation_div_1_Template","ToastNoAnimation_div_2_Template","ToastNoAnimation_div_3_Template","ToastNoAnimation_div_4_Template","ComponentPortal","component","injector","host","newestOnTop","BasePortalHost","portal","fn","ToastRef","Subject","_overlayRef","resetTimeout","countDuplicate","ToastPackage","toastId","config","message","title","toastType","toastRef","action","DefaultNoComponentGlobalConfig","TOAST_CONFIG","InjectionToken","DomPortalHost","_hostDomElement","_componentFactoryResolver","_appRef","componentFactory","componentRef","OverlayContainer","inject","DOCUMENT","container","t","ɵɵdefineInjectable","OverlayRef","_portalHost","Overlay","ComponentFactoryResolver$1","ApplicationRef","positionClass","overlayContainer","pane","ToastrService","token","overlay","_injector","sanitizer","ngZone","__spreadValues","override","type","toast","found","p","resetOnDuplicate","countDuplicates","includeTitleDuplicates","hasDuplicateTitle","i","duplicate","keepInactive","overlayRef","sanitizedMessage","SecurityContext","toastPackage","providers","toastInjector","Injector","ins","ɵɵinject","DomSanitizer","NgZone","Toast","toastrService","count","__spreadProps","now","remaining","func","timeout","ɵɵdirectiveInject","ɵɵdefineComponent","rf","ctx","ɵɵlistener","ɵɵsyntheticHostProperty","ɵɵclassMap","ɵɵstyleProp","ɵɵStandaloneFeature","_c0","ɵɵtemplate","Toast_button_0_Template","Toast_div_1_Template","Toast_div_2_Template","Toast_div_3_Template","Toast_div_4_Template","ɵɵproperty","ɵɵadvance","NgIf","trigger","state","style","transition","animate","DefaultGlobalConfig","provideToastr","makeEnvironmentProviders","ToastrModule","ɵɵdefineNgModule","ɵɵdefineInjector","ToastNoAnimation","toastrService","toastPackage","appRef","count","now","remaining","t","ɵɵdirectiveInject","ToastrService","ToastPackage","ApplicationRef","ɵɵdefineComponent","rf","ctx","ɵɵlistener","ɵɵclassMap","ɵɵstyleProp","ɵɵStandaloneFeature","_c0","ɵɵtemplate","ToastNoAnimation_button_0_Template","ToastNoAnimation_div_1_Template","ToastNoAnimation_div_2_Template","ToastNoAnimation_div_3_Template","ToastNoAnimation_div_4_Template","ɵɵproperty","ɵɵadvance","NgIf","DefaultNoAnimationsGlobalConfig","__spreadProps","__spreadValues","DefaultNoComponentGlobalConfig","HttpError","errorMessage","statusCode","trueProto","TimeoutError","AbortError","UnsupportedTransportError","message","transport","DisabledTransportError","FailedToStartTransportError","FailedToNegotiateWithServerError","AggregateErrors","innerErrors","HttpResponse","statusCode","statusText","content","HttpClient","url","options","__spreadProps","__spreadValues","LogLevel","NullLogger","_logLevel","_message","VERSION","Arg","val","name","values","Platform","getDataDetail","data","includeContent","detail","isArrayBuffer","formatArrayBuffer","view","str","num","pad","sendMessage","logger","transportName","httpClient","url","content","options","__async","headers","value","getUserAgentHeader","LogLevel","responseType","response","__spreadValues","createLogger","ConsoleLogger","NullLogger","SubjectSubscription","subject","observer","index","_","minimumLogLevel","logLevel","message","msg","userAgentHeaderName","constructUserAgent","getOsName","getRuntime","getRuntimeVersion","version","os","runtime","runtimeVersion","userAgent","majorAndMinor","getErrorString","e","getGlobalThis","FetchHttpClient","HttpClient","logger","requireFunc","__require","getGlobalThis","request","__async","AbortError","abortController","error","timeoutId","msTimeout","LogLevel","TimeoutError","isArrayBuffer","response","__spreadValues","e","errorMessage","deserializeContent","HttpError","payload","HttpResponse","url","cookies","Platform","c","responseType","content","XhrHttpClient","HttpClient","logger","request","AbortError","resolve","reject","xhr","isArrayBuffer","headers","header","HttpResponse","HttpError","LogLevel","TimeoutError","DefaultHttpClient","HttpClient","logger","Platform","FetchHttpClient","XhrHttpClient","request","AbortError","url","TextMessageFormat","_TextMessageFormat","output","input","messages","HandshakeProtocol","handshakeRequest","TextMessageFormat","data","messageData","remainingData","isArrayBuffer","binaryData","separatorIndex","responseLength","textData","messages","response","MessageType","Subject","item","observer","err","SubjectSubscription","DEFAULT_TIMEOUT_IN_MS","DEFAULT_PING_INTERVAL_IN_MS","HubConnectionState","HubConnection","_HubConnection","connection","logger","protocol","reconnectPolicy","LogLevel","Arg","HandshakeProtocol","data","error","MessageType","url","__async","Platform","e","handshakePromise","resolve","reject","handshakeRequest","startPromise","AbortError","methodName","args","streams","streamIds","invocationDescriptor","promiseQueue","subject","Subject","cancelInvocation","invocationEvent","message","sendPromise","newMethod","method","handlers","removeIdx","callback","messages","getErrorString","responseMessage","remainingData","nextPing","invocationMessage","methods","methodsCopy","expectsResponse","res","exception","completionMessage","m","prevRes","c","reconnectStartTime","previousReconnectAttempts","retryError","nextRetryDelay","previousRetryCount","elapsedMilliseconds","retryReason","callbacks","key","nonblocking","invocationId","streamId","err","item","i","argument","arg","id","result","DEFAULT_RETRY_DELAYS_IN_MILLISECONDS","DefaultReconnectPolicy","retryDelays","retryContext","HeaderNames","AccessTokenHttpClient","HttpClient","innerClient","accessTokenFactory","request","__async","allowRetry","response","HeaderNames","url","HttpTransportType","TransferFormat","AbortController","LongPollingTransport","httpClient","logger","options","AbortController","url","transferFormat","__async","Arg","TransferFormat","LogLevel","name","value","getUserAgentHeader","headers","__spreadValues","pollOptions","pollUrl","response","HttpError","getDataDetail","TimeoutError","data","sendMessage","deleteOptions","logMessage","ServerSentEventsTransport","httpClient","accessToken","logger","options","url","transferFormat","__async","Arg","TransferFormat","LogLevel","resolve","reject","opened","eventSource","Platform","cookies","headers","name","value","getUserAgentHeader","__spreadValues","e","getDataDetail","error","data","sendMessage","WebSocketTransport","httpClient","accessTokenFactory","logger","logMessageContent","webSocketConstructor","headers","url","transferFormat","__async","Arg","TransferFormat","LogLevel","token","resolve","reject","webSocket","cookies","opened","Platform","name","value","getUserAgentHeader","HeaderNames","__spreadValues","_event","event","error","message","getDataDetail","data","MAX_REDIRECTS","HttpConnection","url","options","Arg","createLogger","webSocketModule","eventSourceModule","Platform","__require","requireFunc","AccessTokenHttpClient","DefaultHttpClient","transferFormat","__async","TransferFormat","LogLevel","message","AbortError","data","TransportSendQueue","error","resolve","e","HttpTransportType","negotiateResponse","redirects","accessToken","LongPollingTransport","headers","name","value","getUserAgentHeader","negotiateUrl","response","__spreadValues","errorMessage","HttpError","FailedToNegotiateWithServerError","connectionToken","requestedTransport","requestedTransferFormat","connectUrl","transportExceptions","transports","negotiate","endpoint","transportOrError","ex","FailedToStartTransportError","AggregateErrors","transport","WebSocketTransport","ServerSentEventsTransport","transportMatches","s","UnsupportedTransportError","DisabledTransportError","aTag","index","actualTransport","_TransportSendQueue","_transport","PromiseSource","transportResult","arrayBuffers","totalLength","b","a","result","offset","item","reject","reason","JSON_HUB_PROTOCOL_NAME","JsonHubProtocol","TransferFormat","input","logger","NullLogger","messages","TextMessageFormat","hubMessages","message","parsedMessage","MessageType","LogLevel","value","errorMessage","LogLevelNameMapping","LogLevel","parseLogLevel","name","mapping","HubConnectionBuilder","logging","Arg","isLogger","logLevel","ConsoleLogger","url","transportTypeOrOptions","__spreadValues","__spreadProps","protocol","retryDelaysOrReconnectPolicy","DefaultReconnectPolicy","httpConnectionOptions","connection","HttpConnection","HubConnection","NullLogger","JsonHubProtocol","logger","EVENTS","MessageHubService","constructor","hubUrl","environment","messagesSource","ReplaySubject","onlineUsersSource","BehaviorSubject","messages$","asObservable","onlineUsers$","isEventType","event","eventType","NotificationProgress","payload","toLowerCase","createHubConnection","user","hubConnection","HubConnectionBuilder","withUrl","accessTokenFactory","token","withAutomaticReconnect","build","start","catch","err","console","error","on","OnlineUsers","usernames","next","ScanSeries","resp","body","ScanLibraryProgress","ConvertBookmarksProgress","WordCountAnalyzerProgress","LibraryModified","DashboardUpdate","SideNavUpdate","SiteThemeProgress","SeriesAddedToCollection","UserProgressUpdate","UserUpdate","Error","Info","SeriesAdded","SeriesRemoved","CoverUpdate","UpdateAvailable","SendingToDevice","ScrobblingKeyExpired","stopHubConnection","stop","sendMessage","methodName","invoke","factory","ɵfac","providedIn","_MessageHubService","ɵɵelementStart","ɵɵlistener","ɵɵrestoreView","_r5","ctx_r4","ɵɵnextContext","ɵɵresetView","close","ɵɵelementEnd","ɵɵattribute","t_r1","btn_r7","_r9","$implicit","ctx_r8","clickButton","ɵɵtext","ɵɵadvance","ɵɵclassMapInterpolate1","type","ɵɵtextInterpolate","text","ɵɵelementContainerStart","ɵɵtemplate","ConfirmDialogComponent_ng_container_0_button_4_Template","ɵɵelement","ConfirmDialogComponent_ng_container_0_div_8_Template","ɵɵelementContainerEnd","ctx_r0","config","header","ɵɵproperty","disableEscape","ɵɵpipeBind1","content","ɵɵsanitizeHtml","buttons","ConfirmDialogComponent","constructor","modal","ngOnInit","sort","_button_sort","x","y","xIsSecondary","yIsSecondary","button","ɵɵdirectiveInject","NgbActiveModal","selectors","standalone","features","ɵɵStandaloneFeature","decls","vars","consts","template","rf","ctx","ConfirmDialogComponent_ng_container_0_Template","CommonModule","NgForOf","NgIf","SafeHtmlPipe","TranslocoDirective","styles","_ConfirmDialogComponent","ConfirmConfig","constructor","_type","header","content","buttons","disableEscape","ConfirmService","constructor","modalService","defaultConfirm","ConfirmConfig","defaultAlert","buttons","push","text","type","_type","header","confirm","content","config","__async","Promise","resolve","reject","undefined","console","error","modalRef","open","ConfirmDialogComponent","componentInstance","closed","pipe","take","subscribe","result","dismissed","alert","ɵɵinject","NgbModal","factory","ɵfac","providedIn","_ConfirmService","ThemeProvider","ThemeService","constructor","rendererFactory","document","httpClient","messageHub","domSanitizer","confirmService","toastr","destroyRef","inject","DestroyRef","defaultTheme","defaultBookTheme","currentThemeSource","ReplaySubject","currentTheme$","asObservable","themesSource","themes$","themeCache","baseUrl","environment","apiUrl","renderer","createRenderer","messages$","pipe","takeUntilDestroyed","subscribe","message","event","EVENTS","NotificationProgress","notificationEvent","payload","name","SiteThemeProgress","eventType","getThemes","getColorScheme","getComputedStyle","body","getPropertyValue","trim","getThemeColor","getTileColor","getCssVariable","variable","isDarkTheme","toLowerCase","get","map","themes","next","take","theme","filter","t","id","length","setTheme","info","translate","clearThemes","unsetThemes","setDefault","themeId","post","scan","setBookTheme","selector","unsetBookThemes","addClass","querySelector","clearBookTheme","themeName","find","provider","ThemeProvider","User","hasThemeInHead","fetchThemeContent","content","__async","alert","styleElem","createElement","appendChild","createTextNode","head","themeColor","setAttribute","colorScheme","Array","from","children","el","tagName","TextResonse","encodedCss","sanitize","SecurityContext","STYLE","forEach","classList","remove","cls","startsWith","c","ɵɵinject","RendererFactory2","DOCUMENT","HttpClient","MessageHubService","DomSanitizer","ConfirmService","ToastrService","factory","ɵfac","providedIn","_ThemeService","Role","AccountService","constructor","httpClient","router","messageHub","themeService","destroyRef","inject","DestroyRef","baseUrl","environment","apiUrl","userKey","currentUserSource","ReplaySubject","currentUser$","asObservable","hasValidLicenseSource","hasValidLicense$","messages$","pipe","filter","evt","event","EVENTS","UserUpdate","map","payload","userUpdateEvent","userName","currentUser","username","switchMap","refreshAccount","subscribe","hasAdminRole","user","roles","includes","Admin","hasChangePasswordRole","ChangePassword","hasChangeAgeRestrictionRole","ChangeRestriction","hasDownloadRole","Download","hasBookmarkRole","Bookmark","getRoles","get","deleteLicense","delete","TextResonse","hasValidLicense","forceCheck","res","tap","next","catchError","error","throwError","hasAnyLicense","updateUserLicense","license","email","post","login","model","response","setCurrentUser","takeUntilDestroyed","getDecodedToken","token","role","Array","isArray","push","localStorage","setItem","JSON","stringify","lastLoginKey","preferences","theme","setTheme","name","defaultTheme","stopRefreshTokenTimer","stopHubConnection","createHubConnection","startRefreshTokenTimer","logout","removeItem","undefined","navigateByUrl","register","isEmailConfirmed","migrateUser","confirmMigrationEmail","resendConfirmationEmail","userId","inviteUser","confirmEmail","confirmEmailUpdate","getInviteUrl","withBaseUrl","parse","atob","split","requestResetPasswordEmail","encodeURIComponent","confirmResetPasswordEmail","resetPassword","password","oldPassword","update","updateEmail","updateAgeRestriction","ageRating","includeUnknowns","getPreferences","pref","updatePreferences","userPreferences","settings","localeKey","locale","getUserFromLocalStorage","userString","getItem","resetApiKey","key","apiKey","getOpdsUrl","of","__spreadValues","refreshToken","refreshTokenTimeout","setInterval","clearInterval","_AccountService","ɵɵinject","HttpClient","Router","MessageHubService","ThemeService","factory","ɵfac","providedIn"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}