PageSourceSearch

https://policystreet.app/chunk-6ZCSGOPL.js

js policystreet.app collected 2026-10-04 00:18:49 UTC 40,957 bytes, 1,027 lines download raw bytes

1import {
2  CdkDialogContainer,
3  Dialog,
4  DialogModule,
5  LoadingService
6} from "./chunk-PYOEWRY6.js";
7import {
8  MatDivider,
9  MatDividerModule,
10  MatToolbar,
11  MatToolbarModule
12} from "./chunk-Z43DJA66.js";
13import {
14  AlertService
15} from "./chunk-2P52J7PL.js";
16import {
17  MatIcon,
18  MatIconModule
19} from "./chunk-GFC47GLM.js";
20import {
21  createBlockScrollStrategy,
22  createGlobalPositionStrategy
23} from "./chunk-DG4DI6ID.js";
24import {
25  ENDPOINTS
26} from "./chunk-RDO232H5.js";
27import {
28  BidiModule,
29  BreakpointObserver,
30  Breakpoints,
31  CdkPortalOutlet,
32  ChangeDetectionStrategy,
33  Component,
34  DefaultValueAccessor,
35  ESCAPE,
36  EventEmitter,
37  FormControl,
38  FormControlName,
39  FormGroup,
40  FormGroupDirective,
41  FormsModule,
42  HttpClient,
43  Inject,
44  Injectable,
45  InjectionToken,
46  Injector,
47  MatError,
48  MatFormField,
49  MatFormFieldModule,
50  MatLabel,
51  MatSuffix,
52  NgControlStatus,
53  NgControlStatusGroup,
54  NgModule,
55  PLATFORM_ID,
56  PortalModule,
57  ReactiveFormsModule,
58  Subject,
59  Validators,
60  ViewEncapsulation,
61  _animationsDisabled,
62  catchError,
63  filter,
64  hasModifierKey,
65  inject,
66  isPlatformBrowser,
67  merge,
68  setClassMetadata,
69  take,
70  tap,
71  throwError,
72  ɵNgNoValidate,
73  ɵsetClassDebugInfo,
74  ɵɵInheritDefinitionFeature,
75  ɵɵadvance,
76  ɵɵattribute,
77  ɵɵclassProp,
78  ɵɵconditional,
79  ɵɵconditionalCreate,
80  ɵɵdefineComponent,
81  ɵɵdefineInjectable,
82  ɵɵdefineInjector,
83  ɵɵdefineNgModule,
84  ɵɵdirectiveInject,
85  ɵɵelement,
86  ɵɵelementEnd,
87  ɵɵelementStart,
88  ɵɵlistener,
89  ɵɵproperty,
90  ɵɵtemplate,
91  ɵɵtext,
92  ɵɵtextInterpolate
93} from "./chunk-RWD57MWX.js";
94import {
95  __spreadProps,
96  __spreadValues
97} from "./chunk-75QO5JQN.js";
98
vendor: 16,534 bytes, lines 99-425
99// node_modules/@angular/material/fesm2022/bottom-sheet.mjs
100function MatBottomSheetContainer_ng_template_0_Template(rf, ctx) {
101}
102var ENTER_ANIMATION = "_mat-bottom-sheet-enter";
103var EXIT_ANIMATION = "_mat-bottom-sheet-exit";
104var MatBottomSheetContainer = class _MatBottomSheetContainer extends CdkDialogContainer {
105  _breakpointSubscription;
106  _animationsDisabled = _animationsDisabled();
107  _animationState = "void";
108  _animationStateChanged = new EventEmitter();
109  _destroyed = false;
110  constructor() {
111    super();
112    const breakpointObserver = inject(BreakpointObserver);
113    this._breakpointSubscription = breakpointObserver.observe([Breakpoints.Medium, Breakpoints.Large, Breakpoints.XLarge]).subscribe(() => {
114      const classList = this._elementRef.nativeElement.classList;
115      classList.toggle("mat-bottom-sheet-container-medium", breakpointObserver.isMatched(Breakpoints.Medium));
116      classList.toggle("mat-bottom-sheet-container-large", breakpointObserver.isMatched(Breakpoints.Large));
117      classList.toggle("mat-bottom-sheet-container-xlarge", breakpointObserver.isMatched(Breakpoints.XLarge));
118    });
119  }
120  enter() {
121    if (!this._destroyed) {
122      this._animationState = "visible";
123      this._changeDetectorRef.markForCheck();
124      this._changeDetectorRef.detectChanges();
125      if (this._animationsDisabled) {
126        this._simulateAnimation(ENTER_ANIMATION);
127      }
128    }
129  }
130  exit() {
131    if (!this._destroyed) {
132      this._elementRef.nativeElement.setAttribute("mat-exit", "");
133      this._animationState = "hidden";
134      this._changeDetectorRef.markForCheck();
135      if (this._animationsDisabled) {
136        this._simulateAnimation(EXIT_ANIMATION);
137      }
138    }
139  }
140  ngOnDestroy() {
141    super.ngOnDestroy();
142    this._breakpointSubscription.unsubscribe();
143    this._destroyed = true;
144  }
145  _simulateAnimation(name) {
146    this._ngZone.run(() => {
147      this._handleAnimationEvent(true, name);
148      setTimeout(() => this._handleAnimationEvent(false, name));
149    });
150  }
151  _trapFocus() {
152    super._trapFocus({
153      preventScroll: true
154    });
155  }
156  _handleAnimationEvent(isStart, animationName) {
157    const isEnter = animationName === ENTER_ANIMATION;
158    const isExit = animationName === EXIT_ANIMATION;
159    if (isEnter || isExit) {
160      this._animationStateChanged.emit({
161        toState: isEnter ? "visible" : "hidden",
162        phase: isStart ? "start" : "done"
163      });
164    }
165  }
166  static \u0275fac = function MatBottomSheetContainer_Factory(__ngFactoryType__) {
167    return new (__ngFactoryType__ || _MatBottomSheetContainer)();
168  };
169  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
170    type: _MatBottomSheetContainer,
171    selectors: [["mat-bottom-sheet-container"]],
172    hostAttrs: ["tabindex", "-1", 1, "mat-bottom-sheet-container"],
173    hostVars: 9,
174    hostBindings: function MatBottomSheetContainer_HostBindings(rf, ctx) {
175      if (rf & 1) {
176        \u0275\u0275listener("animationstart", function MatBottomSheetContainer_animationstart_HostBindingHandler($event) {
177          return ctx._handleAnimationEvent(true, $event.animationName);
178        })("animationend", function MatBottomSheetContainer_animationend_HostBindingHandler($event) {
179          return ctx._handleAnimationEvent(false, $event.animationName);
180        })("animationcancel", function MatBottomSheetContainer_animationcancel_HostBindingHandler($event) {
181          return ctx._handleAnimationEvent(false, $event.animationName);
182        });
183      }
184      if (rf & 2) {
185        \u0275\u0275attribute("role", ctx._config.role)("aria-modal", ctx._config.ariaModal)("aria-label", ctx._config.ariaLabel);
186        \u0275\u0275classProp("mat-bottom-sheet-container-animations-enabled", !ctx._animationsDisabled)("mat-bottom-sheet-container-enter", ctx._animationState === "visible")("mat-bottom-sheet-container-exit", ctx._animationState === "hidden");
187      }
188    },
189    features: [\u0275\u0275InheritDefinitionFeature],
190    decls: 1,
191    vars: 0,
192    consts: [["cdkPortalOutlet", ""]],
193    template: function MatBottomSheetContainer_Template(rf, ctx) {
194      if (rf & 1) {
195        \u0275\u0275template(0, MatBottomSheetContainer_ng_template_0_Template, 0, 0, "ng-template", 0);
196      }
197    },
198    dependencies: [CdkPortalOutlet],
199    styles: ["@keyframes _mat-bottom-sheet-enter {\n  from {\n    transform: translateY(100%);\n  }\n  to {\n    transform: none;\n  }\n}\n@keyframes _mat-bottom-sheet-exit {\n  from {\n    transform: none;\n  }\n  to {\n    transform: translateY(100%);\n  }\n}\n.mat-bottom-sheet-container {\n  box-shadow: 0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);\n  padding: 8px 16px;\n  min-width: 100vw;\n  box-sizing: border-box;\n  display: block;\n  outline: 0;\n  max-height: 80vh;\n  overflow: auto;\n  position: relative;\n  background: var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));\n  color: var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));\n  font-family: var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));\n  font-size: var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));\n  line-height: var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));\n  font-weight: var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));\n  letter-spacing: var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking));\n}\n@media (forced-colors: active) {\n  .mat-bottom-sheet-container {\n    outline: 1px solid;\n  }\n}\n\n.mat-bottom-sheet-container-animations-enabled {\n  transform: translateY(100%);\n}\n.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter {\n  animation: _mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit {\n  animation: _mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards;\n}\n\n.mat-bottom-sheet-container-xlarge, .mat-bottom-sheet-container-large, .mat-bottom-sheet-container-medium {\n  border-top-left-radius: var(--mat-bottom-sheet-container-shape, 28px);\n  border-top-right-radius: var(--mat-bottom-sheet-container-shape, 28px);\n}\n\n.mat-bottom-sheet-container-medium {\n  min-width: 384px;\n  max-width: calc(100vw - 128px);\n}\n\n.mat-bottom-sheet-container-large {\n  min-width: 512px;\n  max-width: calc(100vw - 256px);\n}\n\n.mat-bottom-sheet-container-xlarge {\n  min-width: 576px;\n  max-width: calc(100vw - 384px);\n}\n"],
200    encapsulation: 2
201  });
202};
203(() => {
204  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatBottomSheetContainer, [{
205    type: Component,
206    args: [{
207      selector: "mat-bottom-sheet-container",
208      changeDetection: ChangeDetectionStrategy.Default,
209      encapsulation: ViewEncapsulation.None,
210      host: {
211        "class": "mat-bottom-sheet-container",
212        "[class.mat-bottom-sheet-container-animations-enabled]": "!_animationsDisabled",
213        "[class.mat-bottom-sheet-container-enter]": '_animationState === "visible"',
214        "[class.mat-bottom-sheet-container-exit]": '_animationState === "hidden"',
215        "tabindex": "-1",
216        "[attr.role]": "_config.role",
217        "[attr.aria-modal]": "_config.ariaModal",
218        "[attr.aria-label]": "_config.ariaLabel",
219        "(animationstart)": "_handleAnimationEvent(true, $event.animationName)",
220        "(animationend)": "_handleAnimationEvent(false, $event.animationName)",
221        "(animationcancel)": "_handleAnimationEvent(false, $event.animationName)"
222      },
223      imports: [CdkPortalOutlet],
224      template: "<ng-template cdkPortalOutlet></ng-template>\r\n",
225      styles: ["@keyframes _mat-bottom-sheet-enter {\n  from {\n    transform: translateY(100%);\n  }\n  to {\n    transform: none;\n  }\n}\n@keyframes _mat-bottom-sheet-exit {\n  from {\n    transform: none;\n  }\n  to {\n    transform: translateY(100%);\n  }\n}\n.mat-bottom-sheet-container {\n  box-shadow: 0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);\n  padding: 8px 16px;\n  min-width: 100vw;\n  box-sizing: border-box;\n  display: block;\n  outline: 0;\n  max-height: 80vh;\n  overflow: auto;\n  position: relative;\n  background: var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));\n  color: var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));\n  font-family: var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));\n  font-size: var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));\n  line-height: var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));\n  font-weight: var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));\n  letter-spacing: var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking));\n}\n@media (forced-colors: active) {\n  .mat-bottom-sheet-container {\n    outline: 1px solid;\n  }\n}\n\n.mat-bottom-sheet-container-animations-enabled {\n  transform: translateY(100%);\n}\n.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter {\n  animation: _mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards;\n}\n.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit {\n  animation: _mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards;\n}\n\n.mat-bottom-sheet-container-xlarge, .mat-bottom-sheet-container-large, .mat-bottom-sheet-container-medium {\n  border-top-left-radius: var(--mat-bottom-sheet-container-shape, 28px);\n  border-top-right-radius: var(--mat-bottom-sheet-container-shape, 28px);\n}\n\n.mat-bottom-sheet-container-medium {\n  min-width: 384px;\n  max-width: calc(100vw - 128px);\n}\n\n.mat-bottom-sheet-container-large {\n  min-width: 512px;\n  max-width: calc(100vw - 256px);\n}\n\n.mat-bottom-sheet-container-xlarge {\n  min-width: 576px;\n  max-width: calc(100vw - 384px);\n}\n"]
226    }]
227  }], () => [], null);
228})();
229var MAT_BOTTOM_SHEET_DATA = new InjectionToken("MatBottomSheetData");
230var MatBottomSheetConfig = class {
231  viewContainerRef;
232  injector;
233  panelClass;
234  direction;
235  data = null;
236  hasBackdrop = true;
237  backdropClass;
238  disableClose = false;
239  ariaLabel = null;
240  ariaModal = false;
241  closeOnNavigation = true;
242  autoFocus = "first-tabbable";
243  restoreFocus = true;
244  scrollStrategy;
245  height = "";
246  minHeight;
247  maxHeight;
248};
249var MatBottomSheetRef = class {
250  _ref;
251  get instance() {
252    return this._ref.componentInstance;
253  }
254  get componentRef() {
255    return this._ref.componentRef;
256  }
257  containerInstance;
258  disableClose;
259  _afterOpened = new Subject();
260  _result;
261  _closeFallbackTimeout;
262  constructor(_ref, config, containerInstance) {
263    this._ref = _ref;
264    this.containerInstance = containerInstance;
265    this.disableClose = config.disableClose;
266    containerInstance._animationStateChanged.pipe(filter((event) => event.phase === "done" && event.toState === "visible"), take(1)).subscribe(() => {
267      this._afterOpened.next();
268      this._afterOpened.complete();
269    });
270    containerInstance._animationStateChanged.pipe(filter((event) => event.phase === "done" && event.toState === "hidden"), take(1)).subscribe(() => {
271      clearTimeout(this._closeFallbackTimeout);
272      this._ref.close(this._result);
273    });
274    _ref.overlayRef.detachments().subscribe(() => {
275      this._ref.close(this._result);
276    });
277    merge(this.backdropClick(), this.keydownEvents().pipe(filter((event) => event.keyCode === ESCAPE))).subscribe((event) => {
278      if (!this.disableClose && (event.type !== "keydown" || !hasModifierKey(event))) {
279        event.preventDefault();
280        this.dismiss();
281      }
282    });
283  }
284  dismiss(result) {
285    if (!this.containerInstance) {
286      return;
287    }
288    this.containerInstance._animationStateChanged.pipe(filter((event) => event.phase === "start"), take(1)).subscribe(() => {
289      this._closeFallbackTimeout = setTimeout(() => this._ref.close(this._result), 500);
290      this._ref.overlayRef.detachBackdrop();
291    });
292    this._result = result;
293    this.containerInstance.exit();
294    this.containerInstance = null;
295  }
296  afterDismissed() {
297    return this._ref.closed;
298  }
299  afterOpened() {
300    return this._afterOpened;
301  }
302  backdropClick() {
303    return this._ref.backdropClick;
304  }
305  keydownEvents() {
306    return this._ref.keydownEvents;
307  }
308};
309var MAT_BOTTOM_SHEET_DEFAULT_OPTIONS = new InjectionToken("mat-bottom-sheet-default-options");
310var MatBottomSheet = class _MatBottomSheet {
311  _injector = inject(Injector);
312  _parentBottomSheet = inject(_MatBottomSheet, {
313    optional: true,
314    skipSelf: true
315  });
316  _animationsDisabled = _animationsDisabled();
317  _defaultOptions = inject(MAT_BOTTOM_SHEET_DEFAULT_OPTIONS, {
318    optional: true
319  });
320  _bottomSheetRefAtThisLevel = null;
321  _dialog = inject(Dialog);
322  get _openedBottomSheetRef() {
323    const parent = this._parentBottomSheet;
324    return parent ? parent._openedBottomSheetRef : this._bottomSheetRefAtThisLevel;
325  }
326  set _openedBottomSheetRef(value) {
327    if (this._parentBottomSheet) {
328      this._parentBottomSheet._openedBottomSheetRef = value;
329    } else {
330      this._bottomSheetRefAtThisLevel = value;
331    }
332  }
333  constructor() {
334  }
335  open(componentOrTemplateRef, config) {
336    const _config = __spreadValues(__spreadValues({}, this._defaultOptions || new MatBottomSheetConfig()), config);
337    let ref;
338    this._dialog.open(componentOrTemplateRef, __spreadProps(__spreadValues({}, _config), {
339      disableClose: true,
340      closeOnOverlayDetachments: false,
341      maxWidth: "100%",
342      container: MatBottomSheetContainer,
343      scrollStrategy: _config.scrollStrategy || createBlockScrollStrategy(this._injector),
344      positionStrategy: createGlobalPositionStrategy(this._injector).centerHorizontally().bottom("0"),
345      disableAnimations: this._animationsDisabled,
346      templateContext: () => ({
347        bottomSheetRef: ref
348      }),
349      providers: (cdkRef, _cdkConfig, container) => {
350        ref = new MatBottomSheetRef(cdkRef, _config, container);
351        return [{
352          provide: MatBottomSheetRef,
353          useValue: ref
354        }, {
355          provide: MAT_BOTTOM_SHEET_DATA,
356          useValue: _config.data
357        }];
358      }
359    }));
360    ref.afterDismissed().subscribe(() => {
361      if (this._openedBottomSheetRef === ref) {
362        this._openedBottomSheetRef = null;
363      }
364    });
365    if (this._openedBottomSheetRef) {
366      this._openedBottomSheetRef.afterDismissed().subscribe(() => ref.containerInstance?.enter());
367      this._openedBottomSheetRef.dismiss();
368    } else {
369      ref.containerInstance.enter();
370    }
371    this._openedBottomSheetRef = ref;
372    return ref;
373  }
374  dismiss(result) {
375    if (this._openedBottomSheetRef) {
376      this._openedBottomSheetRef.dismiss(result);
377    }
378  }
379  ngOnDestroy() {
380    if (this._bottomSheetRefAtThisLevel) {
381      this._bottomSheetRefAtThisLevel.dismiss();
382    }
383  }
384  static \u0275fac = function MatBottomSheet_Factory(__ngFactoryType__) {
385    return new (__ngFactoryType__ || _MatBottomSheet)();
386  };
387  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
388    token: _MatBottomSheet,
389    factory: _MatBottomSheet.\u0275fac,
390    providedIn: "root"
391  });
392};
393(() => {
394  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatBottomSheet, [{
395    type: Injectable,
396    args: [{
397      providedIn: "root"
398    }]
399  }], () => [], null);
400})();
401var MatBottomSheetModule = class _MatBottomSheetModule {
402  static \u0275fac = function MatBottomSheetModule_Factory(__ngFactoryType__) {
403    return new (__ngFactoryType__ || _MatBottomSheetModule)();
404  };
405  static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
406    type: _MatBottomSheetModule,
407    imports: [DialogModule, PortalModule, MatBottomSheetContainer],
408    exports: [MatBottomSheetContainer, BidiModule]
409  });
410  static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
411    providers: [MatBottomSheet],
412    imports: [DialogModule, PortalModule, BidiModule]
413  });
414};
415(() => {
416  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MatBottomSheetModule, [{
417    type: NgModule,
418    args: [{
419      imports: [DialogModule, PortalModule, MatBottomSheetContainer],
420      exports: [MatBottomSheetContainer, BidiModule],
421      providers: [MatBottomSheet]
422    }]
423  }], null, null);
424})();
425
426// src/app/authentication/_services/user.service.ts
427var UserService = class _UserService {
428  constructor() {
429    this.http = inject(HttpClient);
430    this.alertService = inject(AlertService);
431  }
432  login(email, password) {
433    return this.http.post(ENDPOINTS.user.login, { email, password }, { responseType: "text" }).pipe(catchError((err) => {
434      const message = "Failed to login";
435      console.error(message, err);
436      this.alertService.openSnackBar(message);
437      return throwError(() => err);
438    }));
439  }
440  getProfile() {
441    return this.http.get(ENDPOINTS.user.getProfile).pipe(tap((res) => {
442      this.user = res;
443    })).pipe(catchError((err) => {
444      const message = "Failed to get user info";
445      console.error(message, err);
446      this.alertService.openSnackBar(message);
447      return throwError(() => err);
448    }));
449  }
450  static {
451    this.\u0275fac = function UserService_Factory(__ngFactoryType__) {
452      return new (__ngFactoryType__ || _UserService)();
453    };
454  }
455  static {
456    this.\u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _UserService, factory: _UserService.\u0275fac, providedIn: "root" });
457  }
458};
459(() => {
460  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UserService, [{
461    type: Injectable,
462    args: [{
463      providedIn: "root"
464    }]
465  }], null, null);
466})();
467
vendor: 1,575 bytes, lines 468-523
468// node_modules/jwt-decode/build/esm/index.js
469var InvalidTokenError = class extends Error {
470};
471InvalidTokenError.prototype.name = "InvalidTokenError";
472function b64DecodeUnicode(str) {
473  return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
474    let code = p.charCodeAt(0).toString(16).toUpperCase();
475    if (code.length < 2) {
476      code = "0" + code;
477    }
478    return "%" + code;
479  }));
480}
481function base64UrlDecode(str) {
482  let output = str.replace(/-/g, "+").replace(/_/g, "/");
483  switch (output.length % 4) {
484    case 0:
485      break;
486    case 2:
487      output += "==";
488      break;
489    case 3:
490      output += "=";
491      break;
492    default:
493      throw new Error("base64 string is not of the correct length");
494  }
495  try {
496    return b64DecodeUnicode(output);
497  } catch (err) {
498    return atob(output);
499  }
500}
501function jwtDecode(token, options) {
502  if (typeof token !== "string") {
503    throw new InvalidTokenError("Invalid token specified: must be a string");
504  }
505  options || (options = {});
506  const pos = options.header === true ? 0 : 1;
507  const part = token.split(".")[pos];
508  if (typeof part !== "string") {
509    throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
510  }
511  let decoded;
512  try {
513    decoded = base64UrlDecode(part);
514  } catch (e) {
515    throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
516  }
517  try {
518    return JSON.parse(decoded);
519  } catch (e) {
520    throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
521  }
522}
523
524// src/app/share/utils/validators/reset-password-validators.ts
525var ResetPasswordValidators = class {
526  constructor() {
527  }
528  static patternValidator(regex, error) {
529    return (control) => {
530      if (!control.value) {
531        return null;
532      }
533      const valid = regex.test(control.value);
534      return valid ? null : error;
535    };
536  }
537  static MatchValidator(control) {
538    const password = control.get("newPassword").value;
539    const confirmPassword = control.get("repeatNewPassword").value;
540    if (!confirmPassword?.length) {
541      return null;
542    }
543    if (confirmPassword.length < 8) {
544      control.get("repeatNewPassword").setErrors({ minLength: true });
545      return;
546    } else {
547      return null;
548    }
549  }
550};
551
552// src/app/share/components/dialogs/change-password/change-password.component.ts
553function ChangePasswordComponent_Conditional_27_Template(rf, ctx) {
554  if (rf & 1) {
555    \u0275\u0275elementStart(0, "mat-error");
556    \u0275\u0275text(1, "New password is required");
557    \u0275\u0275elementEnd();
558  }
559}
560function ChangePasswordComponent_Conditional_37_Template(rf, ctx) {
561  if (rf & 1) {
562    \u0275\u0275elementStart(0, "mat-error", 11);
563    \u0275\u0275text(1, " Your new password must be an alphanumeric. ");
564    \u0275\u0275elementEnd();
565  }
566}
567function ChangePasswordComponent_Conditional_38_Template(rf, ctx) {
568  if (rf & 1) {
569    \u0275\u0275elementStart(0, "mat-error", 11);
570    \u0275\u0275text(1, " Your new password must be at least 8 characters long. ");
571    \u0275\u0275elementEnd();
572  }
573}
574function ChangePasswordComponent_Conditional_39_Template(rf, ctx) {
575  if (rf & 1) {
576    \u0275\u0275elementStart(0, "mat-error", 11);
577    \u0275\u0275text(1, " Your new password must contain at least one special character. ");
578    \u0275\u0275elementEnd();
579  }
580}
581function ChangePasswordComponent_Conditional_40_Template(rf, ctx) {
582  if (rf & 1) {
583    \u0275\u0275elementStart(0, "mat-error", 11);
584    \u0275\u0275text(1, " Confirm your password ");
585    \u0275\u0275elementEnd();
586  }
587}
588var ChangePasswordComponent = class _ChangePasswordComponent {
589  constructor(bottomSheetRef, loadingService, alertService, userDataService, data) {
590    this.bottomSheetRef = bottomSheetRef;
591    this.loadingService = loadingService;
592    this.alertService = alertService;
593    this.userDataService = userDataService;
594    this.hide = true;
595    this.submitted = false;
596    this.newPassLength = false;
597    this.repeatNewPassLength = false;
598  }
599  ngOnInit() {
600    this.formGroup = new FormGroup({
601      currentPassword: new FormControl(null, [Validators.required]),
602      newPassword: new FormControl(null, Validators.compose([
603        Validators.required,
604        Validators.minLength(8),
605        ResetPasswordValidators.patternValidator(new RegExp("(?=.*[0-9])"), {
606          requiresDigit: true
607        }),
608        ResetPasswordValidators.patternValidator(new RegExp("(?=.*[a-z])"), {
609          requiresLowercase: true
610        }),
611        ResetPasswordValidators.patternValidator(new RegExp("(?=.*[$@^!%*?&])"), {
612          requiresSpecialChars: true
613        })
614      ])),
615      repeatNewPassword: new FormControl(null, [
616        Validators.required,
617        Validators.minLength(8)
618      ])
619    }, {
620      validators: ResetPasswordValidators.MatchValidator
621    });
622  }
623  submit() {
624    this.loadingService.loadingOn(true);
625    this.submitted = true;
626    let obj = {
627      oldPassword: this.formGroup.value.currentPassword,
628      newPassword: this.formGroup.value.newPassword,
629      confirmNewPassword: this.formGroup.value.repeatNewPassword
630    };
631  }
632  close(event) {
633    this.bottomSheetRef.dismiss();
634    event.preventDefault();
635  }
636  get f() {
637    return this.formGroup.controls;
638  }
639  get requiredValid() {
640    return !this.formGroup.controls["newPassword"].hasError("required");
641  }
642  getNewPasswordLength(value) {
643    if (value.length < 8) {
644      this.newPassLength = false;
645    } else {
646      this.newPassLength = true;
647    }
648  }
649  getRepeatNewPasswordLength(value) {
650    if (value.length < 8) {
651      this.repeatNewPassLength = false;
652    } else {
653      this.repeatNewPassLength = true;
654    }
655  }
656  static {
657    this.\u0275fac = function ChangePasswordComponent_Factory(__ngFactoryType__) {
658      return new (__ngFactoryType__ || _ChangePasswordComponent)(\u0275\u0275directiveInject(MatBottomSheetRef), \u0275\u0275directiveInject(LoadingService), \u0275\u0275directiveInject(AlertService), \u0275\u0275directiveInject(UserService), \u0275\u0275directiveInject(MAT_BOTTOM_SHEET_DATA));
659    };
660  }
661  static {
662    this.\u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ChangePasswordComponent, selectors: [["app-change-password"]], decls: 43, vars: 19, consts: [[1, "sidenav-header"], [1, "menu-container"], ["mat-icon-button", "", "mat-dialog-close", "", 1, "pg-header-btn", 3, "click"], [1, "pg-title"], ["fxFlex", ""], [3, "ngSubmit", "formGroup"], [1, "form-field"], ["formControlName", "currentPassword", "matInput", "", 3, "type"], ["type", "button", "mat-icon-button", "", "matSuffix", "", 3, "click"], ["formControlName", "newPassword", "matInput", "", 3, "ngModelChange", "type"], ["formControlName", "repeatNewPassword", "matInput", "", 3, "ngModelChange", "type"], ["translate", ""], ["mat-raised-button", "", "color", "primary", 1, "full-width", "mt-md", 3, "disabled"]], template: function ChangePasswordComponent_Template(rf, ctx) {
663      if (rf & 1) {
664        \u0275\u0275elementStart(0, "mat-toolbar", 0)(1, "div", 1)(2, "button", 2);
665        \u0275\u0275listener("click", function ChangePasswordComponent_Template_button_click_2_listener($event) {
666          return ctx.close($event);
667        });
668        \u0275\u0275elementStart(3, "mat-icon");
669        \u0275\u0275text(4, "close");
670        \u0275\u0275elementEnd()();
671        \u0275\u0275elementStart(5, "div", 3);
672        \u0275\u0275text(6, "Change password");
673        \u0275\u0275elementEnd();
674        \u0275\u0275element(7, "span", 4);
675        \u0275\u0275elementEnd()();
676        \u0275\u0275element(8, "mat-divider");
677        \u0275\u0275elementStart(9, "form", 5);
678        \u0275\u0275listener("ngSubmit", function ChangePasswordComponent_Template_form_ngSubmit_9_listener() {
679          return ctx.submit();
680        });
681        \u0275\u0275elementStart(10, "div", 6)(11, "mat-form-field")(12, "mat-label");
682        \u0275\u0275text(13, "Current password");
683        \u0275\u0275elementEnd();
684        \u0275\u0275element(14, "input", 7);
685        \u0275\u0275elementStart(15, "button", 8);
686        \u0275\u0275listener("click", function ChangePasswordComponent_Template_button_click_15_listener() {
687          return ctx.hide = !ctx.hide;
688        });
689        \u0275\u0275elementStart(16, "mat-icon");
690        \u0275\u0275text(17);
691        \u0275\u0275elementEnd()();
692        \u0275\u0275elementStart(18, "mat-error");
693        \u0275\u0275text(19, "Current password is required");
694        \u0275\u0275elementEnd()();
695        \u0275\u0275elementStart(20, "mat-form-field")(21, "mat-label");
696        \u0275\u0275text(22, "New password");
697        \u0275\u0275elementEnd();
698        \u0275\u0275elementStart(23, "input", 9);
699        \u0275\u0275listener("ngModelChange", function ChangePasswordComponent_Template_input_ngModelChange_23_listener($event) {
700          return ctx.getNewPasswordLength($event);
701        });
702        \u0275\u0275elementEnd();
703        \u0275\u0275elementStart(24, "button", 8);
704        \u0275\u0275listener("click", function ChangePasswordComponent_Template_button_click_24_listener() {
705          return ctx.hide = !ctx.hide;
706        });
707        \u0275\u0275elementStart(25, "mat-icon");
708        \u0275\u0275text(26);
709        \u0275\u0275elementEnd()();
710        \u0275\u0275conditionalCreate(27, ChangePasswordComponent_Conditional_27_Template, 2, 0, "mat-error");
711        \u0275\u0275elementEnd();
712        \u0275\u0275elementStart(28, "mat-form-field")(29, "mat-label");
713        \u0275\u0275text(30, "Repeat new password");
714        \u0275\u0275elementEnd();
715        \u0275\u0275elementStart(31, "input", 10);
716        \u0275\u0275listener("ngModelChange", function ChangePasswordComponent_Template_input_ngModelChange_31_listener($event) {
717          return ctx.getRepeatNewPasswordLength($event);
718        });
719        \u0275\u0275elementEnd();
720        \u0275\u0275elementStart(32, "button", 8);
721        \u0275\u0275listener("click", function ChangePasswordComponent_Template_button_click_32_listener() {
722          return ctx.hide = !ctx.hide;
723        });
724        \u0275\u0275elementStart(33, "mat-icon");
725        \u0275\u0275text(34);
726        \u0275\u0275elementEnd()();
727        \u0275\u0275elementStart(35, "mat-error");
728        \u0275\u0275text(36, "Repeat new password is required");
729        \u0275\u0275elementEnd()();
730        \u0275\u0275conditionalCreate(37, ChangePasswordComponent_Conditional_37_Template, 2, 0, "mat-error", 11);
731        \u0275\u0275conditionalCreate(38, ChangePasswordComponent_Conditional_38_Template, 2, 0, "mat-error", 11);
732        \u0275\u0275conditionalCreate(39, ChangePasswordComponent_Conditional_39_Template, 2, 0, "mat-error", 11);
733        \u0275\u0275conditionalCreate(40, ChangePasswordComponent_Conditional_40_Template, 2, 0, "mat-error", 11);
734        \u0275\u0275elementStart(41, "button", 12);
735        \u0275\u0275text(42, " Update ");
736        \u0275\u0275elementEnd()()();
737      }
738      if (rf & 2) {
739        \u0275\u0275advance(9);
740        \u0275\u0275property("formGroup", ctx.formGroup);
741        \u0275\u0275advance(5);
742        \u0275\u0275property("type", ctx.hide ? "password" : "text");
743        \u0275\u0275advance();
744        \u0275\u0275attribute("aria-label", "Hide password")("aria-pressed", ctx.hide);
745        \u0275\u0275advance(2);
746        \u0275\u0275textInterpolate(ctx.hide ? "visibility_off" : "visibility");
747        \u0275\u0275advance(6);
748        \u0275\u0275property("type", ctx.hide ? "password" : "text");
749        \u0275\u0275advance();
750        \u0275\u0275attribute("aria-label", "Hide password")("aria-pressed", ctx.hide);
751        \u0275\u0275advance(2);
752        \u0275\u0275textInterpolate(ctx.hide ? "visibility_off" : "visibility");
753        \u0275\u0275advance();
754        \u0275\u0275conditional((ctx.f.newPassword.dirty || ctx.submitted) && !ctx.requiredValid ? 27 : -1);
755        \u0275\u0275advance(4);
756        \u0275\u0275property("type", ctx.hide ? "password" : "text");
757        \u0275\u0275advance();
758        \u0275\u0275attribute("aria-label", "Hide password")("aria-pressed", ctx.hide);
759        \u0275\u0275advance(2);
760        \u0275\u0275textInterpolate(ctx.hide ? "visibility_off" : "visibility");
761        \u0275\u0275advance(3);
762        \u0275\u0275conditional(ctx.f.newPassword.dirty && ctx.f.newPassword.errors && ctx.f.newPassword.errors.requiresDigit || ctx.f.newPassword.dirty && ctx.f.newPassword.errors && ctx.f.newPassword.errors.requiresLowercase || ctx.f.newPassword.dirty && ctx.f.newPassword.errors && ctx.f.newPassword.errors.requiresSpecialChars ? 37 : -1);
763        \u0275\u0275advance();
764        \u0275\u0275conditional(ctx.f.newPassword.dirty && !ctx.newPassLength || ctx.f.repeatNewPassword.dirty && !ctx.repeatNewPassLength ? 38 : -1);
765        \u0275\u0275advance();
766        \u0275\u0275conditional(ctx.f.newPassword.dirty && ctx.f.newPassword.errors && ctx.f.newPassword.errors.requiresSpecialChars ? 39 : -1);
767        \u0275\u0275advance();
768        \u0275\u0275conditional((ctx.submitted || ctx.f.repeatNewPassword.dirty) && ctx.f.repeatNewPassword.errors && ctx.f.repeatNewPassword.errors.required ? 40 : -1);
769        \u0275\u0275advance();
770        \u0275\u0275property("disabled", ctx.formGroup.invalid);
771      }
772    }, dependencies: [MatIconModule, MatIcon, MatFormFieldModule, MatFormField, MatLabel, MatError, MatSuffix, MatDividerModule, MatDivider, FormsModule, \u0275NgNoValidate, DefaultValueAccessor, NgControlStatus, NgControlStatusGroup, ReactiveFormsModule, FormGroupDirective, FormControlName, MatToolbarModule, MatToolbar], encapsulation: 2 });
773  }
774};
775(() => {
776  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ChangePasswordComponent, [{
777    type: Component,
778    args: [{ selector: "app-change-password", standalone: true, imports: [
779      MatIconModule,
780      MatFormFieldModule,
781      MatDividerModule,
782      FormsModule,
783      ReactiveFormsModule,
784      MatToolbarModule
785    ], template: `<mat-toolbar class="sidenav-header">
786  <div class="menu-container">
787    <button
788      mat-icon-button
789      class="pg-header-btn"
790      mat-dialog-close
791      (click)="close($event)"
792      >
793      <mat-icon>close</mat-icon>
794    </button>
795    <div class="pg-title">Change password</div>
796    <span fxFlex></span>
797  </div>
798</mat-toolbar>
799<mat-divider></mat-divider>
800<form [formGroup]="formGroup" (ngSubmit)="submit()">
801  <div class="form-field">
802    <mat-form-field>
803      <mat-label>Current password</mat-label>
804      <input
805        formControlName="currentPassword"
806        matInput
807        [type]="hide ? 'password' : 'text'"
808        />
809        <button
810          type="button"
811          mat-icon-button
812          matSuffix
813          (click)="hide = !hide"
814          [attr.aria-label]="'Hide password'"
815          [attr.aria-pressed]="hide"
816          >
817          <mat-icon>{{ hide ? "visibility_off" : "visibility" }}</mat-icon>
818        </button>
819        <mat-error>Current password is required</mat-error>
820      </mat-form-field>
821      <mat-form-field>
822        <mat-label>New password</mat-label>
823        <input
824          formControlName="newPassword"
825          (ngModelChange)="getNewPasswordLength($event)"
826          matInput
827          [type]="hide ? 'password' : 'text'"
828          />
829          <button
830            type="button"
831            mat-icon-button
832            matSuffix
833            (click)="hide = !hide"
834            [attr.aria-label]="'Hide password'"
835            [attr.aria-pressed]="hide"
836            >
837            <mat-icon>{{ hide ? "visibility_off" : "visibility" }}</mat-icon>
838          </button>
839          @if ((f.newPassword.dirty || submitted) && !requiredValid) {
840            <mat-error
841              >New password is required</mat-error
842              >
843          }
844        </mat-form-field>
845        <mat-form-field>
846          <mat-label>Repeat new password</mat-label>
847          <input
848            formControlName="repeatNewPassword"
849            (ngModelChange)="getRepeatNewPasswordLength($event)"
850            matInput
851            [type]="hide ? 'password' : 'text'"
852            />
853            <button
854              type="button"
855              mat-icon-button
856              matSuffix
857              (click)="hide = !hide"
858              [attr.aria-label]="'Hide password'"
859              [attr.aria-pressed]="hide"
860              >
861              <mat-icon>{{ hide ? "visibility_off" : "visibility" }}</mat-icon>
862            </button>
863            <mat-error>Repeat new password is required</mat-error>
864          </mat-form-field>
865          @if (
866            (f.newPassword.dirty &&
867            f.newPassword.errors &&
868            f.newPassword.errors.requiresDigit) ||
869            (f.newPassword.dirty &&
870            f.newPassword.errors &&
871            f.newPassword.errors.requiresLowercase) ||
872            (f.newPassword.dirty &&
873            f.newPassword.errors &&
874            f.newPassword.errors.requiresSpecialChars)
875            ) {
876            <mat-error
877              translate
878              >
879              Your new password must be an alphanumeric.
880            </mat-error>
881          }
882          @if (
883            (f.newPassword.dirty && !newPassLength) ||
884            (f.repeatNewPassword.dirty && !repeatNewPassLength)
885            ) {
886            <mat-error
887              translate
888              >
889              Your new password must be at least 8 characters long.
890            </mat-error>
891          }
892          @if (
893            f.newPassword.dirty &&
894            f.newPassword.errors &&
895            f.newPassword.errors.requiresSpecialChars
896            ) {
897            <mat-error
898              translate
899              >
900              Your new password must contain at least one special character.
901            </mat-error>
902          }
903          @if (
904            (submitted || f.repeatNewPassword.dirty) &&
905            f.repeatNewPassword.errors &&
906            f.repeatNewPassword.errors.required
907            ) {
908            <mat-error
909              translate
910              >
911              Confirm your password
912            </mat-error>
913          }
914          <!-- <mat-error
915      *ngIf="
916        (submitted || f.repeatNewPassword.dirty) &&
917        f.repeatNewPassword.errors &&
918        f.repeatNewPassword.errors.mismatch
919      "
920          translate
921          >
922          Passwords do not match
923        </mat-error> -->
924        <button
925          mat-raised-button
926          color="primary"
927          class="full-width mt-md"
928          [disabled]="formGroup.invalid"
929          >
930          Update
931        </button>
932      </div>
933    </form>
934` }]
935  }], () => [{ type: MatBottomSheetRef }, { type: LoadingService }, { type: AlertService }, { type: UserService }, { type: void 0, decorators: [{
936    type: Inject,
937    args: [MAT_BOTTOM_SHEET_DATA]
938  }] }], null);
939})();
940(() => {
941  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ChangePasswordComponent, { className: "ChangePasswordComponent", filePath: "src/app/share/components/dialogs/change-password/change-password.component.ts", lineNumber: 31 });
942})();
943
944// src/app/authentication/_services/auth.service.ts
945var TOKEN_KEY = "token";
946var AuthService = class _AuthService {
947  constructor() {
948    this.bottomSheet = inject(MatBottomSheet);
949    this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
950  }
951  setToken(token) {
952    document.cookie = `${TOKEN_KEY}=${token};path=/;`;
953  }
954  getToken() {
955    return this.getCookie(TOKEN_KEY);
956  }
957  getUserId() {
958    const token = this.getToken();
959    const decoded = jwtDecode(token);
960    return decoded["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"];
961  }
962  isTokenExpired() {
963    const token = this.getToken();
964    if (!token)
965      return false;
966    const decoded = jwtDecode(token);
967    const expireTime = new Date(decoded["exp"] * 1e3);
968    return expireTime < /* @__PURE__ */ new Date();
969  }
970  isLoggedIn() {
971    const token = this.getToken();
972    const isTokenExpired = this.isTokenExpired();
973    return token && !isTokenExpired ? true : false;
974  }
975  logout() {
976    document.cookie = `${TOKEN_KEY}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
977    window.location.reload();
978  }
979  changePassword() {
980    const dialog = this.bottomSheet.open(ChangePasswordComponent, {
981      backdropClass: "sidenav-container"
982      // data: {
983      // },
984    });
985    dialog.afterDismissed().subscribe((x) => {
986      if (x) {
987      }
988    });
989  }
990  getCookie(cname) {
991    if (!this.isBrowser)
992      return null;
993    const name = `${cname}=`;
994    const decodedCookie = decodeURIComponent(document.cookie);
995    const cookieValues = decodedCookie.split(";");
996    for (const cookieValue of cookieValues) {
997      const trimmedValue = cookieValue.trim();
998      if (trimmedValue.startsWith(name)) {
999        return trimmedValue.substring(name.length);
1000      }
1001    }
1002    return null;
1003  }
1004  static {
1005    this.\u0275fac = function AuthService_Factory(__ngFactoryType__) {
1006      return new (__ngFactoryType__ || _AuthService)();
1007    };
1008  }
1009  static {
1010    this.\u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _AuthService, factory: _AuthService.\u0275fac, providedIn: "root" });
1011  }
1012};
1013(() => {
1014  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AuthService, [{
1015    type: Injectable,
1016    args: [{
1017      providedIn: "root"
1018    }]
1019  }], null, null);
1020})();
1021
1022export {
1023  MatBottomSheetModule,
1024  UserService,
1025  AuthService
1026};
1027//# sourceMappingURL=chunk-6ZCSGOPL.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.