@cuby-ui/core 0.0.569 → 0.0.571

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/esm2022/editor/components/editor-attaches-tool/editor-attaches-tool.component.mjs +2 -2
  2. package/esm2022/index.mjs +2 -1
  3. package/esm2022/interceptors/auth-error.interceptor.mjs +14 -0
  4. package/esm2022/interceptors/index.mjs +2 -1
  5. package/esm2022/pipes/file-size.pipe.mjs +25 -0
  6. package/esm2022/pipes/index.mjs +2 -1
  7. package/esm2022/providers/auth.options.mjs +1 -1
  8. package/esm2022/providers/auth.provider.mjs +10 -2
  9. package/esm2022/services/auth.service.mjs +10 -2
  10. package/esm2022/services/browser-login-strategy.service.mjs +18 -0
  11. package/esm2022/services/index.mjs +2 -1
  12. package/esm2022/tokens/auth-login-strategy.mjs +3 -0
  13. package/esm2022/tokens/index.mjs +2 -1
  14. package/esm2022/utils/check-auth-failure-event.mjs +14 -0
  15. package/esm2022/utils/index.mjs +2 -1
  16. package/fesm2022/cuby-ui-core.mjs +230 -176
  17. package/fesm2022/cuby-ui-core.mjs.map +1 -1
  18. package/index.d.ts +1 -0
  19. package/interceptors/auth-error.interceptor.d.ts +2 -0
  20. package/interceptors/index.d.ts +1 -0
  21. package/package.json +4 -4
  22. package/pipes/index.d.ts +1 -0
  23. package/providers/auth.options.d.ts +3 -0
  24. package/providers/auth.provider.d.ts +1 -1
  25. package/services/auth.service.d.ts +1 -0
  26. package/services/browser-login-strategy.service.d.ts +8 -0
  27. package/services/index.d.ts +1 -0
  28. package/tokens/auth-login-strategy.d.ts +5 -0
  29. package/tokens/index.d.ts +1 -0
  30. package/utils/check-auth-failure-event.d.ts +2 -0
  31. package/utils/index.d.ts +1 -0
  32. package/esm2022/editor/pipes/file-size.pipe.mjs +0 -25
  33. /package/{editor/pipes → pipes}/file-size.pipe.d.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, inject, Renderer2, input, model, effect, Directive, InjectionToken, Input, HostBinding, ChangeDetectorRef, ViewChild, EventEmitter, Output, NgModule, Injector, Injectable, SkipSelf, Optional, DestroyRef, NgZone, signal, Self, INJECTOR, TemplateRef, forwardRef, ViewEncapsulation, computed, ContentChildren, output, ElementRef, HostListener, ViewContainerRef, booleanAttribute, untracked, Pipe, makeEnvironmentProviders, APP_INITIALIZER, ErrorHandler, viewChild } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, inject, Renderer2, input, model, effect, Directive, InjectionToken, Input, HostBinding, ChangeDetectorRef, ViewChild, EventEmitter, Output, NgModule, Injector, Injectable, SkipSelf, Optional, DestroyRef, NgZone, signal, makeEnvironmentProviders, APP_INITIALIZER, ErrorHandler, Self, INJECTOR, TemplateRef, forwardRef, ViewEncapsulation, computed, ContentChildren, output, ElementRef, HostListener, ViewContainerRef, booleanAttribute, untracked, Pipe, viewChild } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { CommonModule, DOCUMENT, NgForOf, NgIf, NgComponentOutlet, NgTemplateOutlet, NgFor, NgClass, Location, UpperCasePipe, AsyncPipe, KeyValuePipe, LowerCasePipe, TitleCasePipe } from '@angular/common';
4
+ import { CommonModule, DOCUMENT, Location, NgForOf, NgIf, NgComponentOutlet, NgTemplateOutlet, NgFor, NgClass, UpperCasePipe, AsyncPipe, KeyValuePipe, LowerCasePipe, TitleCasePipe } from '@angular/common';
5
5
  import { DomSanitizer } from '@angular/platform-browser';
6
6
  import { cuiIsIcon, CUI_ICONS } from '@cuby-ui/icons';
7
7
  import * as i1$1 from '@cuby-ui/cdk';
@@ -15,6 +15,7 @@ import { CuiExchangeContextApiService, CUI_JTEXT_API_SERVICE, CuiJTextApiService
15
15
  import { HttpErrorResponse } from '@angular/common/http';
16
16
  import * as i4 from '@jsverse/transloco';
17
17
  import { TranslocoService, TranslocoModule, TranslocoDirective, TranslocoPipe } from '@jsverse/transloco';
18
+ import { Router } from '@angular/router';
18
19
  import * as i5 from '@angular/forms';
19
20
  import { Validators, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule, FormControl, NonNullableFormBuilder } from '@angular/forms';
20
21
  import * as i2 from '@taiga-ui/polymorpheus';
@@ -25,7 +26,6 @@ import { MaskitoDirective } from '@maskito/angular';
25
26
  import EditorJS from '@editorjs/editorjs';
26
27
  import Header from '@editorjs/header';
27
28
  import List from '@editorjs/list';
28
- import { Router } from '@angular/router';
29
29
  import { createCustomElement } from '@angular/elements';
30
30
  import { tap as tap$1, finalize as finalize$1, switchMap as switchMap$1 } from 'rxjs/operators';
31
31
 
@@ -1151,6 +1151,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
1151
1151
  }]
1152
1152
  }] });
1153
1153
 
1154
+ function cuiCheckAuthFailureEvent(type) {
1155
+ switch (type) {
1156
+ case 'token_refresh_error':
1157
+ case 'token_validation_error':
1158
+ case 'session_terminated':
1159
+ case 'session_error':
1160
+ case 'silent_refresh_error':
1161
+ case 'silent_refresh_timeout':
1162
+ return true;
1163
+ default:
1164
+ return false;
1165
+ }
1166
+ }
1167
+
1154
1168
  class CuiToken extends OAuthService {
1155
1169
  constructor() {
1156
1170
  super(...arguments);
@@ -1294,6 +1308,13 @@ class CuiAuthBase extends CuiTokenBase {
1294
1308
  this.refreshToken();
1295
1309
  });
1296
1310
  }
1311
+ initAuthFailureEvents(onFailure) {
1312
+ this.events.pipe(filter((event) => event instanceof OAuthErrorEvent)).subscribe((event) => {
1313
+ if (cuiCheckAuthFailureEvent(event.type)) {
1314
+ onFailure();
1315
+ }
1316
+ });
1317
+ }
1297
1318
  }
1298
1319
 
1299
1320
  const CUI_REDUCED_MOTION = cuiCreateTokenFromFactory(() => inject(DOCUMENT).defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false);
@@ -1352,6 +1373,8 @@ const CUI_ERROR_TRANSLATION_PREFIX = new InjectionToken('CUI_ERROR_TRANSLATION_P
1352
1373
 
1353
1374
  const CUI_SHOULD_HANDLE_ERROR = new InjectionToken('CUI_SHOULD_HANDLE_ERROR');
1354
1375
 
1376
+ const CUI_AUTH_LOGIN_STRATEGY = new InjectionToken('CUI_AUTH_LOGIN_STRATEGY');
1377
+
1355
1378
  class CuiErrorResolverFactory {
1356
1379
  constructor() {
1357
1380
  this.nullErrorStrategy = inject(NullErrorStrategy);
@@ -1501,6 +1524,141 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
1501
1524
  }]
1502
1525
  }] });
1503
1526
 
1527
+ const CuiAuthService = new InjectionToken('CUI_AUTH_SERVICE');
1528
+
1529
+ class CuiBrowserAuthService extends CuiAuthBase {
1530
+ constructor() {
1531
+ super(...arguments);
1532
+ this.router = inject(Router);
1533
+ this.location = inject(Location);
1534
+ this.oauthStorage = inject(CuiHybridStorageService);
1535
+ }
1536
+ async initAuth(authConfig) {
1537
+ this.setStorage(this.oauthStorage);
1538
+ this.configure(authConfig);
1539
+ await this.loadDiscoveryDocument();
1540
+ try {
1541
+ await this.tryLogin();
1542
+ }
1543
+ catch (error) {
1544
+ if (!this.hasValidAccessToken()) {
1545
+ throw error;
1546
+ }
1547
+ }
1548
+ const tokenExpiredCallback = authConfig.tokenExpiredCallback?.bind(this) ?? this.initLoginFlow.bind(this);
1549
+ this.initAuthRefreshEvents(tokenExpiredCallback);
1550
+ await this.useCheckTokenFlow(tokenExpiredCallback);
1551
+ this.router.navigateByUrl(this.location.path(false).split('?')[0]);
1552
+ }
1553
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserAuthService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1554
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserAuthService, providedIn: 'root' }); }
1555
+ }
1556
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserAuthService, decorators: [{
1557
+ type: Injectable,
1558
+ args: [{
1559
+ providedIn: 'root'
1560
+ }]
1561
+ }] });
1562
+
1563
+ class CuiMobileAuthService extends CuiAuthBase {
1564
+ constructor() {
1565
+ super(...arguments);
1566
+ this.oauthStorage = inject(CuiHybridStorageService);
1567
+ }
1568
+ async initAuth(authConfig) {
1569
+ this.setStorage(this.oauthStorage);
1570
+ this.configure(authConfig);
1571
+ if (!authConfig.tokenExpiredCallback) {
1572
+ return;
1573
+ }
1574
+ await this.loadDiscoveryDocument();
1575
+ await this.tryLogin();
1576
+ this.initAuthRefreshEvents(authConfig.tokenExpiredCallback.bind(this));
1577
+ await this.useCheckTokenFlow(authConfig.tokenExpiredCallback.bind(this));
1578
+ }
1579
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiMobileAuthService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1580
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiMobileAuthService, providedIn: 'root' }); }
1581
+ }
1582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiMobileAuthService, decorators: [{
1583
+ type: Injectable,
1584
+ args: [{
1585
+ providedIn: 'root'
1586
+ }]
1587
+ }] });
1588
+
1589
+ function provideCuiAuth({ authConfig, moduleConfig, platform = 'browser', loginStrategy = CuiBrowserLoginStrategyService }) {
1590
+ return [
1591
+ provideOAuthClient(moduleConfig),
1592
+ {
1593
+ provide: CuiAuthService,
1594
+ useFactory: () => {
1595
+ if (platform === 'mobile') {
1596
+ return inject(CuiMobileAuthService);
1597
+ }
1598
+ return inject(CuiBrowserAuthService);
1599
+ }
1600
+ },
1601
+ {
1602
+ provide: CUI_AUTH_LOGIN_STRATEGY,
1603
+ useClass: loginStrategy
1604
+ },
1605
+ makeEnvironmentProviders([
1606
+ {
1607
+ provide: APP_INITIALIZER,
1608
+ useValue: () => initAuth(authConfig),
1609
+ multi: true
1610
+ }
1611
+ ])
1612
+ ];
1613
+ }
1614
+ async function initAuth(authConfig) {
1615
+ const authService = inject(CuiAuthService);
1616
+ const loginStrategy = inject(CUI_AUTH_LOGIN_STRATEGY);
1617
+ authService.initAuthFailureEvents(() => loginStrategy.openLogin());
1618
+ return await authService.initAuth(authConfig);
1619
+ }
1620
+
1621
+ function provideCuiErrorHandler({ errorNotificationService, shouldHandleError, translationPrefix = 'BACKEND.' } = {}) {
1622
+ const providers = [
1623
+ {
1624
+ provide: ErrorHandler,
1625
+ useClass: CuiGlobalErrorHandler
1626
+ },
1627
+ {
1628
+ provide: CUI_ERROR_TRANSLATION_PREFIX,
1629
+ useValue: translationPrefix
1630
+ }
1631
+ ];
1632
+ if (errorNotificationService) {
1633
+ providers.push({
1634
+ provide: CUI_ERROR_NOTIFICATION_SERVICE,
1635
+ useClass: errorNotificationService
1636
+ });
1637
+ }
1638
+ if (shouldHandleError) {
1639
+ providers.push({
1640
+ provide: CUI_SHOULD_HANDLE_ERROR,
1641
+ useValue: shouldHandleError
1642
+ });
1643
+ }
1644
+ return providers;
1645
+ }
1646
+
1647
+ class CuiBrowserLoginStrategyService {
1648
+ constructor() {
1649
+ this.authService = inject(CuiAuthService);
1650
+ }
1651
+ openLogin() {
1652
+ this.authService.initLoginFlow();
1653
+ }
1654
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserLoginStrategyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1655
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserLoginStrategyService, providedIn: 'root' }); }
1656
+ }
1657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserLoginStrategyService, decorators: [{
1658
+ type: Injectable,
1659
+ args: [{ providedIn: 'root' }]
1660
+ }] });
1661
+
1504
1662
  function cuiRemoveSpaces(value) {
1505
1663
  return value.replace(/\s+/g, '');
1506
1664
  }
@@ -6248,6 +6406,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
6248
6406
  }]
6249
6407
  }] });
6250
6408
 
6409
+ class CuiTimePipe {
6410
+ constructor() {
6411
+ this.translocoService = inject(TranslocoService);
6412
+ this.FORMAT_TOKEN_REGEX = /HH|MM|SS|'([^']*)'/g;
6413
+ this.lang = toSignal(this.translocoService.langChanges$);
6414
+ }
6415
+ transform(value, format = "HH 'h' MM 'm'", withEmpty = false) {
6416
+ this.lang();
6417
+ const { tokenValues, unitValues } = this.getValues(value, withEmpty);
6418
+ return format
6419
+ .replace(this.FORMAT_TOKEN_REGEX, (match, quoted) => quoted ? (unitValues[quoted] ?? quoted) : tokenValues[match])
6420
+ .replace(/\s{2,}/g, ' ')
6421
+ .trim();
6422
+ }
6423
+ getValues(value, withEmpty = false) {
6424
+ const { hours, minutes, seconds } = this.getTime(value);
6425
+ const tokenValues = {
6426
+ HH: this.getTimeString(hours, withEmpty),
6427
+ MM: this.getTimeString(minutes, withEmpty),
6428
+ SS: this.getTimeString(seconds, withEmpty)
6429
+ };
6430
+ const unitValues = {
6431
+ h: this.getTimeUnit(hours, this.translocoService.translate('TIME_UNITS.H'), withEmpty),
6432
+ m: this.getTimeUnit(minutes, this.translocoService.translate('TIME_UNITS.MIN'), withEmpty),
6433
+ s: this.getTimeUnit(seconds, this.translocoService.translate('TIME_UNITS.S'), withEmpty)
6434
+ };
6435
+ return { tokenValues, unitValues };
6436
+ }
6437
+ getTimeString(value, withEmpty = false) {
6438
+ if (!value || (value === 0 && !withEmpty)) {
6439
+ return '';
6440
+ }
6441
+ return value.toString();
6442
+ }
6443
+ getTimeUnit(value, unit, withEmpty = false) {
6444
+ if (!value || (value === 0 && !withEmpty)) {
6445
+ return '';
6446
+ }
6447
+ return unit;
6448
+ }
6449
+ getTime(value) {
6450
+ if (value instanceof Date) {
6451
+ return { hours: value.getHours(), minutes: value.getMinutes(), seconds: value.getSeconds() };
6452
+ }
6453
+ return CuiTime.fromString(value);
6454
+ }
6455
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
6456
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: CuiTimePipe, isStandalone: true, name: "time", pure: false }); }
6457
+ }
6458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTimePipe, decorators: [{
6459
+ type: Pipe,
6460
+ args: [{
6461
+ name: 'time',
6462
+ pure: false,
6463
+ standalone: true
6464
+ }]
6465
+ }] });
6466
+
6251
6467
  class EditorToolComponent {
6252
6468
  constructor() {
6253
6469
  this.window = inject(CUI_WINDOW);
@@ -6872,120 +7088,6 @@ function checkIsBrTag(input, index) {
6872
7088
  return tag + '>' === BR_TAG;
6873
7089
  }
6874
7090
 
6875
- const CuiAuthService = new InjectionToken('CUI_AUTH_SERVICE');
6876
-
6877
- class CuiBrowserAuthService extends CuiAuthBase {
6878
- constructor() {
6879
- super(...arguments);
6880
- this.router = inject(Router);
6881
- this.location = inject(Location);
6882
- this.oauthStorage = inject(CuiHybridStorageService);
6883
- }
6884
- async initAuth(authConfig) {
6885
- this.setStorage(this.oauthStorage);
6886
- this.configure(authConfig);
6887
- await this.loadDiscoveryDocument();
6888
- try {
6889
- await this.tryLogin();
6890
- }
6891
- catch (error) {
6892
- if (!this.hasValidAccessToken()) {
6893
- throw error;
6894
- }
6895
- }
6896
- const tokenExpiredCallback = authConfig.tokenExpiredCallback?.bind(this) ?? this.initLoginFlow.bind(this);
6897
- this.initAuthRefreshEvents(tokenExpiredCallback);
6898
- await this.useCheckTokenFlow(tokenExpiredCallback);
6899
- this.router.navigateByUrl(this.location.path(false).split('?')[0]);
6900
- }
6901
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserAuthService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
6902
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserAuthService, providedIn: 'root' }); }
6903
- }
6904
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiBrowserAuthService, decorators: [{
6905
- type: Injectable,
6906
- args: [{
6907
- providedIn: 'root'
6908
- }]
6909
- }] });
6910
-
6911
- class CuiMobileAuthService extends CuiAuthBase {
6912
- constructor() {
6913
- super(...arguments);
6914
- this.oauthStorage = inject(CuiHybridStorageService);
6915
- }
6916
- async initAuth(authConfig) {
6917
- this.setStorage(this.oauthStorage);
6918
- this.configure(authConfig);
6919
- if (!authConfig.tokenExpiredCallback) {
6920
- return;
6921
- }
6922
- await this.loadDiscoveryDocument();
6923
- await this.tryLogin();
6924
- this.initAuthRefreshEvents(authConfig.tokenExpiredCallback.bind(this));
6925
- await this.useCheckTokenFlow(authConfig.tokenExpiredCallback.bind(this));
6926
- }
6927
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiMobileAuthService, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
6928
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiMobileAuthService, providedIn: 'root' }); }
6929
- }
6930
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiMobileAuthService, decorators: [{
6931
- type: Injectable,
6932
- args: [{
6933
- providedIn: 'root'
6934
- }]
6935
- }] });
6936
-
6937
- function provideCuiAuth({ authConfig, moduleConfig, platform = 'browser' }) {
6938
- return [
6939
- provideOAuthClient(moduleConfig),
6940
- {
6941
- provide: CuiAuthService,
6942
- useFactory: () => {
6943
- if (platform === 'mobile') {
6944
- return inject(CuiMobileAuthService);
6945
- }
6946
- return inject(CuiBrowserAuthService);
6947
- }
6948
- },
6949
- makeEnvironmentProviders([
6950
- {
6951
- provide: APP_INITIALIZER,
6952
- useValue: () => initAuth(authConfig),
6953
- multi: true
6954
- }
6955
- ])
6956
- ];
6957
- }
6958
- async function initAuth(authConfig) {
6959
- const authService = inject(CuiAuthService);
6960
- return await authService.initAuth(authConfig);
6961
- }
6962
-
6963
- function provideCuiErrorHandler({ errorNotificationService, shouldHandleError, translationPrefix = 'BACKEND.' } = {}) {
6964
- const providers = [
6965
- {
6966
- provide: ErrorHandler,
6967
- useClass: CuiGlobalErrorHandler
6968
- },
6969
- {
6970
- provide: CUI_ERROR_TRANSLATION_PREFIX,
6971
- useValue: translationPrefix
6972
- }
6973
- ];
6974
- if (errorNotificationService) {
6975
- providers.push({
6976
- provide: CUI_ERROR_NOTIFICATION_SERVICE,
6977
- useClass: errorNotificationService
6978
- });
6979
- }
6980
- if (shouldHandleError) {
6981
- providers.push({
6982
- provide: CUI_SHOULD_HANDLE_ERROR,
6983
- useValue: shouldHandleError
6984
- });
6985
- }
6986
- return providers;
6987
- }
6988
-
6989
7091
  function presetConfigToken() {
6990
7092
  const token = inject(CuiAuthService).getAccessToken();
6991
7093
  const additionalRequestHeaders = {
@@ -9132,6 +9234,16 @@ function processChunk(line, observer) {
9132
9234
  }
9133
9235
  }
9134
9236
 
9237
+ const cuiAuthErrorInterceptor = (request, next) => {
9238
+ const loginStrategy = inject(CUI_AUTH_LOGIN_STRATEGY);
9239
+ return next(request).pipe(catchError((error) => {
9240
+ if (error instanceof HttpErrorResponse && (error.status === 401 || error.status === 403)) {
9241
+ loginStrategy.openLogin();
9242
+ }
9243
+ return throwError(() => error);
9244
+ }));
9245
+ };
9246
+
9135
9247
  /**
9136
9248
  * @deprecated Use CuiLoaderComponent with type="circle" instead
9137
9249
  */
@@ -13472,64 +13584,6 @@ function handleError(handler, useDefaultError = true) {
13472
13584
  });
13473
13585
  }
13474
13586
 
13475
- class CuiTimePipe {
13476
- constructor() {
13477
- this.translocoService = inject(TranslocoService);
13478
- this.FORMAT_TOKEN_REGEX = /HH|MM|SS|'([^']*)'/g;
13479
- this.lang = toSignal(this.translocoService.langChanges$);
13480
- }
13481
- transform(value, format = "HH 'h' MM 'm'", withEmpty = false) {
13482
- this.lang();
13483
- const { tokenValues, unitValues } = this.getValues(value, withEmpty);
13484
- return format
13485
- .replace(this.FORMAT_TOKEN_REGEX, (match, quoted) => quoted ? (unitValues[quoted] ?? quoted) : tokenValues[match])
13486
- .replace(/\s{2,}/g, ' ')
13487
- .trim();
13488
- }
13489
- getValues(value, withEmpty = false) {
13490
- const { hours, minutes, seconds } = this.getTime(value);
13491
- const tokenValues = {
13492
- HH: this.getTimeString(hours, withEmpty),
13493
- MM: this.getTimeString(minutes, withEmpty),
13494
- SS: this.getTimeString(seconds, withEmpty)
13495
- };
13496
- const unitValues = {
13497
- h: this.getTimeUnit(hours, this.translocoService.translate('TIME_UNITS.H'), withEmpty),
13498
- m: this.getTimeUnit(minutes, this.translocoService.translate('TIME_UNITS.MIN'), withEmpty),
13499
- s: this.getTimeUnit(seconds, this.translocoService.translate('TIME_UNITS.S'), withEmpty)
13500
- };
13501
- return { tokenValues, unitValues };
13502
- }
13503
- getTimeString(value, withEmpty = false) {
13504
- if (!value || (value === 0 && !withEmpty)) {
13505
- return '';
13506
- }
13507
- return value.toString();
13508
- }
13509
- getTimeUnit(value, unit, withEmpty = false) {
13510
- if (!value || (value === 0 && !withEmpty)) {
13511
- return '';
13512
- }
13513
- return unit;
13514
- }
13515
- getTime(value) {
13516
- if (value instanceof Date) {
13517
- return { hours: value.getHours(), minutes: value.getMinutes(), seconds: value.getSeconds() };
13518
- }
13519
- return CuiTime.fromString(value);
13520
- }
13521
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
13522
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: CuiTimePipe, isStandalone: true, name: "time", pure: false }); }
13523
- }
13524
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: CuiTimePipe, decorators: [{
13525
- type: Pipe,
13526
- args: [{
13527
- name: 'time',
13528
- pure: false,
13529
- standalone: true
13530
- }]
13531
- }] });
13532
-
13533
13587
  const CuiTranslations = {
13534
13588
  en: import('./cuby-ui-core-en-DoKU5zDf.mjs'),
13535
13589
  ru: import('./cuby-ui-core-ru-quLEyA0a.mjs')
@@ -13539,5 +13593,5 @@ const CuiTranslations = {
13539
13593
  * Generated bundle index. Do not edit.
13540
13594
  */
13541
13595
 
13542
- export { AlertHintComponent, AngularOutsideLoaderService, AssigneeRoleItemComponent, AssigneeRolesTabsComponent, ButtonChangeThemeComponent, CUI_ACTIVITY_SERVICE_TOKEN, CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_ANIMATIONS_DEFAULT_DURATION, CUI_BADGE_DEFAULT_OPTIONS, CUI_BADGE_OPTIONS, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_DIALOGS, CUI_DIALOG_CONTEXT, CUI_DIALOG_DEFAULT_OPTIONS, CUI_DIALOG_OPTIONS, CUI_FILTER_BAR_DEFAULT_TRANSLATIONS, CUI_INPUT_TIME_DEFAULT_OPTIONS, CUI_INPUT_TIME_OPTIONS, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_ICONS, CUI_NOTIFICATION_ICON_OPTIONS, CUI_NOTIFICATION_ICON_OPTIONS_DEFAULT_MODE, CUI_NOTIFICATION_ICON_OPTIONS_LIGHT_MODE, CUI_NOTIFICATION_OPTIONS, CUI_RESOURCE_STATE_SERVICE_TOKEN, CUI_ROOT_SELECTOR, CUI_STORAGE_LIST_SERVICE_TOKEN, CUI_SUBJECT_MODAL_SERVICE_TOKEN, CUI_TABS_SERVICE_TOKEN, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, CUI_TOOLTIP_COMPONENT, CUI_TOOLTIP_DEFAULT_OPTIONS, CUI_TOOLTIP_DIRECTIONS, CUI_TOOLTIP_OPTIONS, CUI_TOOLTIP_PROVIDERS, CUI_USED_ELEMENTS_SERVICE_TOKEN, CUI_UTILITY_SERVICE_TOKEN, ContentHeaderComponent, CuiAbstractTabsComponent, CuiAccordionComponent, CuiAccordionDirective, CuiAccordionItemComponent, CuiAccordionModule, CuiActivityBaseService, CuiActivityImplService, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiAttachesTool, CuiAuthBase, CuiAuthService, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCardWrapperComponent, CuiCategoriesComponent, CuiCheckboxComponent, CuiCheckboxModule, CuiChecklistBlockComponent, CuiCircleLoaderComponent, CuiContentWrapperComponent, CuiContextMenuComponent, CuiContextMenuModule, CuiCriterionInfoComponent, CuiCriterionInfoFormComponent, CuiCriterionModalCreateComponent, CuiCriterionReadonlyInfoComponent, CuiDateRangeCalendarComponent, CuiDateRangeCalendarModule, CuiDeleteModalComponent, CuiDialogActionsComponent, CuiDialogComponent, CuiDialogHeaderComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiDropdownDirective, CuiDropdownWrapperComponent, CuiEditorBlockComponent, CuiEditorComponent, CuiEditorModalComponent, CuiEditorReadonlyComponent, CuiEditorTranslations, CuiEmptyStateComponent, CuiFileIconComponent, CuiFileUploader, CuiFileUploaderStatus, CuiFilterBarComponent, CuiFilterBarModule, CuiFormFieldComponent, CuiFormFieldModule, CuiFramerPreviewComponent, CuiGeneralControlErrorHintComponent, CuiGhostInputComponent, CuiGlobalErrorHandler, CuiHeaderTool, CuiHintComponent, CuiHintModule, CuiHybridStorageService, CuiIconButtonComponent, CuiIconButtonModule, CuiImageTool, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiInputTimeComponent, CuiInputTimeModule, CuiInstructionInfoComponent, CuiInstructionInfoFormComponent, CuiInstructionModalCreateComponent, CuiInstructionReadonlyInfoComponent, CuiLabelComponent, CuiLabelModule, CuiLayoutComponent, CuiLetterBoxComponent, CuiLibTranslations, CuiLinearLoaderComponent, CuiLinkMarker, CuiListTool, CuiLoaderComponent, CuiLoaderService, CuiLoadingState, CuiNotificationComponent, CuiNotificationModule, CuiPositionService, CuiPulseLoaderComponent, CuiRadioComponent, CuiRadioModule, CuiReadonlyCriterionModalComponent, CuiReadonlyInstructionModalComponent, CuiReadonlyUtilityModalComponent, CuiRenderDynamicComponentsComponent, CuiRenderDynamicComponentsService, CuiRoleMarker, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModalComponent, CuiSelectModalFolderComponent, CuiSelectModalSearchComponent, CuiSelectModalService, CuiSelectModule, CuiSelectedCategoryService, CuiSidebarContainerComponent, CuiSidebarHeaderComponent, CuiSidebarNavigationComponent, CuiSidebarNavigationContainerComponent, CuiSidebarNavigationItemComponent, CuiSidebarService, CuiSkeleton, CuiStatedLoaderComponent, CuiStorageListComponent, CuiSvgComponent, CuiSvgModule, CuiTabDirective, CuiTabsComponent, CuiTabsServiceImpl, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiTimePipe, CuiToggleComponent, CuiToggleModule, CuiToolMarker, CuiTooltip, CuiTooltipComponent, CuiTooltipDescribe, CuiTooltipDirective, CuiTooltipDriver, CuiTooltipHost, CuiTooltipHover, CuiTooltipManual, CuiTooltipOptionsDirective, CuiTooltipOverflow, CuiTooltipPointer, CuiTooltipPosition, CuiTooltipService, CuiTooltipUnstyled, CuiTooltipUnstyledComponent, CuiTooltips, CuiTranslations, CuiUserActionContextMenuComponent, CuiUtilityModalComponent, CuiUtilityModalCreateComponent, CuiUtilityReadonlyThumbnailComponent, CuiUtilityThumbnailComponent, CuiVideoTool, CuiVisualViewportService, InsertedComponent, ModalDividedSectionComponent, ModalHeaderComponent, ModalHeaderInsertedButtonsComponent, ModalInfoTabComponent, ModalOperationPartComponent, ModalResourcesTabComponent, OptionsButtonComponent, RenderDynamicModalComponent, ResourceStateBaseService, ResourcesBlockComponent, ResourcesBlockPartComponent, ResourcesBlockTabsComponent$1 as ResourcesBlockTabsComponent, ResourcesOptionsComponent, SubjectModalBaseService, UTILITY_MODAL_SERVICE_TOKEN, UsedElementsBaseService, UtilityBaseService, UtilityInfoReadonlyComponent, createEditorTools, cuiAuthInterceptor, cuiCheckFixedPosition, cuiCreateDefaultValidators, cuiErrorHandlerInterceptor, cuiGetDuration, cuiIsObscured, cuiLoaderInterceptor, cuiOverrideOptions, cuiProvideEditor, cuiRemoveSpaces, cuiReplace, cuiToAnimationOptions, cuiTooltipOptionsProvider, cuiXNdjsonInterceptor, handleError, openFileInBrowser, presetConfigToken, provideCuiAuth, provideCuiErrorHandler, provideCuiTabs, setLoading, sseStreamReaderInterceptor };
13596
+ export { AlertHintComponent, AngularOutsideLoaderService, AssigneeRoleItemComponent, AssigneeRolesTabsComponent, ButtonChangeThemeComponent, CUI_ACTIVITY_SERVICE_TOKEN, CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_ANIMATIONS_DEFAULT_DURATION, CUI_BADGE_DEFAULT_OPTIONS, CUI_BADGE_OPTIONS, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_DIALOGS, CUI_DIALOG_CONTEXT, CUI_DIALOG_DEFAULT_OPTIONS, CUI_DIALOG_OPTIONS, CUI_FILTER_BAR_DEFAULT_TRANSLATIONS, CUI_INPUT_TIME_DEFAULT_OPTIONS, CUI_INPUT_TIME_OPTIONS, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_ICONS, CUI_NOTIFICATION_ICON_OPTIONS, CUI_NOTIFICATION_ICON_OPTIONS_DEFAULT_MODE, CUI_NOTIFICATION_ICON_OPTIONS_LIGHT_MODE, CUI_NOTIFICATION_OPTIONS, CUI_RESOURCE_STATE_SERVICE_TOKEN, CUI_ROOT_SELECTOR, CUI_STORAGE_LIST_SERVICE_TOKEN, CUI_SUBJECT_MODAL_SERVICE_TOKEN, CUI_TABS_SERVICE_TOKEN, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, CUI_TOOLTIP_COMPONENT, CUI_TOOLTIP_DEFAULT_OPTIONS, CUI_TOOLTIP_DIRECTIONS, CUI_TOOLTIP_OPTIONS, CUI_TOOLTIP_PROVIDERS, CUI_USED_ELEMENTS_SERVICE_TOKEN, CUI_UTILITY_SERVICE_TOKEN, ContentHeaderComponent, CuiAbstractTabsComponent, CuiAccessor, CuiAccordionComponent, CuiAccordionDirective, CuiAccordionItemComponent, CuiAccordionModule, CuiActivityBaseService, CuiActivityImplService, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiAttachesTool, CuiAuthBase, CuiAuthService, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiBrowserLoginStrategyService, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCardWrapperComponent, CuiCategoriesComponent, CuiCheckboxComponent, CuiCheckboxModule, CuiChecklistBlockComponent, CuiCircleLoaderComponent, CuiContentWrapperComponent, CuiContextMenuComponent, CuiContextMenuModule, CuiCriterionInfoComponent, CuiCriterionInfoFormComponent, CuiCriterionModalCreateComponent, CuiCriterionReadonlyInfoComponent, CuiDateRangeCalendarComponent, CuiDateRangeCalendarModule, CuiDeleteModalComponent, CuiDialogActionsComponent, CuiDialogComponent, CuiDialogHeaderComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiDriver, CuiDriverDirective, CuiDropdownDirective, CuiDropdownWrapperComponent, CuiEditorBlockComponent, CuiEditorComponent, CuiEditorModalComponent, CuiEditorReadonlyComponent, CuiEditorTranslations, CuiEmptyStateComponent, CuiFileIconComponent, CuiFileUploader, CuiFileUploaderStatus, CuiFilterBarComponent, CuiFilterBarModule, CuiFormFieldComponent, CuiFormFieldModule, CuiFramerPreviewComponent, CuiGeneralControlErrorHintComponent, CuiGhostInputComponent, CuiGlobalErrorHandler, CuiHeaderTool, CuiHintComponent, CuiHintModule, CuiHybridStorageService, CuiIconButtonComponent, CuiIconButtonModule, CuiImageTool, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiInputTimeComponent, CuiInputTimeModule, CuiInstructionInfoComponent, CuiInstructionInfoFormComponent, CuiInstructionModalCreateComponent, CuiInstructionReadonlyInfoComponent, CuiLabelComponent, CuiLabelModule, CuiLayoutComponent, CuiLetterBoxComponent, CuiLibTranslations, CuiLinearLoaderComponent, CuiLinkMarker, CuiListTool, CuiLoaderComponent, CuiLoaderService, CuiLoadingState, CuiNotificationComponent, CuiNotificationModule, CuiPositionAccessor, CuiPositionService, CuiPulseLoaderComponent, CuiRadioComponent, CuiRadioModule, CuiReadonlyCriterionModalComponent, CuiReadonlyInstructionModalComponent, CuiReadonlyUtilityModalComponent, CuiRectAccessor, CuiRenderDynamicComponentsComponent, CuiRenderDynamicComponentsService, CuiRoleMarker, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModalComponent, CuiSelectModalFolderComponent, CuiSelectModalSearchComponent, CuiSelectModalService, CuiSelectModule, CuiSelectedCategoryService, CuiSidebarContainerComponent, CuiSidebarHeaderComponent, CuiSidebarNavigationComponent, CuiSidebarNavigationContainerComponent, CuiSidebarNavigationItemComponent, CuiSidebarService, CuiSkeleton, CuiStatedLoaderComponent, CuiStorageListComponent, CuiSvgComponent, CuiSvgModule, CuiTabDirective, CuiTabsComponent, CuiTabsServiceImpl, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiTimePipe, CuiToggleComponent, CuiToggleModule, CuiToolMarker, CuiTooltip, CuiTooltipComponent, CuiTooltipDescribe, CuiTooltipDirective, CuiTooltipDriver, CuiTooltipHost, CuiTooltipHover, CuiTooltipManual, CuiTooltipOptionsDirective, CuiTooltipOverflow, CuiTooltipPointer, CuiTooltipPosition, CuiTooltipService, CuiTooltipUnstyled, CuiTooltipUnstyledComponent, CuiTooltips, CuiTranslations, CuiUserActionContextMenuComponent, CuiUtilityModalComponent, CuiUtilityModalCreateComponent, CuiUtilityReadonlyThumbnailComponent, CuiUtilityThumbnailComponent, CuiVehicle, CuiVideoTool, CuiVisualViewportService, FileSizePipe, InsertedComponent, ModalDividedSectionComponent, ModalHeaderComponent, ModalHeaderInsertedButtonsComponent, ModalInfoTabComponent, ModalOperationPartComponent, ModalResourcesTabComponent, OptionsButtonComponent, RenderDynamicModalComponent, ResourceStateBaseService, ResourcesBlockComponent, ResourcesBlockPartComponent, ResourcesBlockTabsComponent$1 as ResourcesBlockTabsComponent, ResourcesOptionsComponent, SubjectModalBaseService, UTILITY_MODAL_SERVICE_TOKEN, UsedElementsBaseService, UtilityBaseService, UtilityInfoReadonlyComponent, createEditorTools, cuiAsDriver, cuiAsPositionAccessor, cuiAsRectAccessor, cuiAsVehicle, cuiAuthErrorInterceptor, cuiAuthInterceptor, cuiCheckAuthFailureEvent, cuiCheckFixedPosition, cuiCreateDefaultValidators, cuiErrorHandlerInterceptor, cuiFallbackAccessor, cuiGetDuration, cuiIsObscured, cuiLoaderInterceptor, cuiOverrideOptions, cuiPositionAccessorFor, cuiProvideAccessor, cuiProvideEditor, cuiRectAccessorFor, cuiRemoveSpaces, cuiReplace, cuiToAnimationOptions, cuiTooltipOptionsProvider, cuiXNdjsonInterceptor, handleError, openFileInBrowser, presetConfigToken, provideCuiAuth, provideCuiErrorHandler, provideCuiTabs, setLoading, sseStreamReaderInterceptor };
13543
13597
  //# sourceMappingURL=cuby-ui-core.mjs.map