@seniorsistemas/angular-components 17.26.5 → 17.26.7

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 (62) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +278 -170
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/bignumber-input/{number-input.directive.d.ts → bignumber-input.directive.d.ts} +3 -1
  6. package/components/bignumber-input/index.d.ts +2 -2
  7. package/components/card/card.component.d.ts +5 -2
  8. package/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.d.ts +7 -6
  9. package/components/dynamic-form/configurations/fields/text-area-ia-field.d.ts +4 -6
  10. package/components/number-input/number-input.directive.d.ts +11 -9
  11. package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +3 -8
  12. package/components/speech-recognition/speech-recognition.service.d.ts +1 -0
  13. package/components/speech-recognition/text-to-speech.service.d.ts +1 -0
  14. package/components/text-area/text-area/text-area.component.d.ts +9 -2
  15. package/components/text-area-ia/text-area-ia.component.d.ts +4 -1
  16. package/esm2015/components/bignumber-input/bignumber-input.directive.js +150 -0
  17. package/esm2015/components/bignumber-input/bignumber-input.module.js +15 -0
  18. package/esm2015/components/bignumber-input/index.js +3 -3
  19. package/esm2015/components/card/card.component.js +22 -7
  20. package/esm2015/components/dynamic-form/components/fields/bignumber/bignumber-field.module.js +2 -2
  21. package/esm2015/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
  22. package/esm2015/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +15 -13
  23. package/esm2015/components/dynamic-form/configurations/fields/text-area-ia-field.js +7 -2
  24. package/esm2015/components/dynamic-form/dynamic-form.module.js +2 -2
  25. package/esm2015/components/inline-edit/inline-edit.module.js +2 -2
  26. package/esm2015/components/number-input/number-input.directive.js +41 -21
  27. package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +9 -25
  28. package/esm2015/components/speech-recognition/speech-recognition.service.js +8 -3
  29. package/esm2015/components/speech-recognition/text-to-speech.service.js +13 -4
  30. package/esm2015/components/text-area/text-area/text-area.component.js +33 -5
  31. package/esm2015/components/text-area-ia/text-area-ia.component.js +13 -5
  32. package/esm2015/components/text-area-ia/text-area-ia.module.js +3 -3
  33. package/esm2015/locale/fallback.js +4 -4
  34. package/esm5/components/bignumber-input/bignumber-input.directive.js +155 -0
  35. package/esm5/components/bignumber-input/bignumber-input.module.js +18 -0
  36. package/esm5/components/bignumber-input/index.js +3 -3
  37. package/esm5/components/card/card.component.js +26 -7
  38. package/esm5/components/dynamic-form/components/fields/bignumber/bignumber-field.module.js +2 -2
  39. package/esm5/components/dynamic-form/components/fields/text-area/text-area-field.component.js +2 -2
  40. package/esm5/components/dynamic-form/components/fields/text-area-ia/text-area-ia-field.component.js +15 -13
  41. package/esm5/components/dynamic-form/configurations/fields/text-area-ia-field.js +8 -3
  42. package/esm5/components/dynamic-form/dynamic-form.module.js +2 -2
  43. package/esm5/components/inline-edit/inline-edit.module.js +2 -2
  44. package/esm5/components/number-input/number-input.directive.js +42 -22
  45. package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +13 -26
  46. package/esm5/components/speech-recognition/speech-recognition.service.js +9 -3
  47. package/esm5/components/speech-recognition/text-to-speech.service.js +13 -4
  48. package/esm5/components/text-area/text-area/text-area.component.js +42 -6
  49. package/esm5/components/text-area-ia/text-area-ia.component.js +13 -5
  50. package/esm5/components/text-area-ia/text-area-ia.module.js +3 -3
  51. package/esm5/locale/fallback.js +4 -4
  52. package/fesm2015/seniorsistemas-angular-components.js +260 -168
  53. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  54. package/fesm5/seniorsistemas-angular-components.js +280 -172
  55. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  56. package/package.json +1 -1
  57. package/seniorsistemas-angular-components.metadata.json +1 -1
  58. package/esm2015/components/bignumber-input/number-input.directive.js +0 -132
  59. package/esm2015/components/bignumber-input/number-input.module.js +0 -15
  60. package/esm5/components/bignumber-input/number-input.directive.js +0 -137
  61. package/esm5/components/bignumber-input/number-input.module.js +0 -18
  62. /package/components/bignumber-input/{number-input.module.d.ts → bignumber-input.module.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __awaiter, __param, __rest } from 'tslib';
2
- import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, KeyValueDiffers, HostBinding, ChangeDetectorRef, ViewChildren, Pipe, ɵɵinject, InjectionToken, Inject, PLATFORM_ID, ViewEncapsulation, INJECTOR, ContentChild, NgZone, Optional } from '@angular/core';
2
+ import { EventEmitter, Input, Output, Component, ContentChildren, ViewChild, HostListener, forwardRef, NgModule, ɵɵdefineInjectable, Injectable, ElementRef, ApplicationRef, ComponentFactoryResolver, Injector, Renderer2, Directive, TemplateRef, ViewContainerRef, KeyValueDiffers, HostBinding, ChangeDetectorRef, ViewChildren, Pipe, ɵɵinject, InjectionToken, Inject, PLATFORM_ID, ViewEncapsulation, INJECTOR, NgZone, ContentChild, Optional } from '@angular/core';
3
3
  import { trigger, transition, style as style$7, animate, state, group, query, animateChild } from '@angular/animations';
4
4
  import { Subject, of, from, ReplaySubject, throwError, fromEvent, forkJoin, pipe } from 'rxjs';
5
5
  import { takeUntil, tap, map, switchMap, catchError, first, filter, take, delay, debounceTime, repeat, finalize } from 'rxjs/operators';
@@ -1215,6 +1215,7 @@ let BignumberInputDirective = BignumberInputDirective_1 = class BignumberInputDi
1215
1215
  this.scale = 0;
1216
1216
  this.alignTo = AlignmentOptions.LEFT;
1217
1217
  this.allowNegative = true;
1218
+ this.pasteRejected = new EventEmitter();
1218
1219
  this.onLocaleService();
1219
1220
  }
1220
1221
  ngOnInit() {
@@ -1235,6 +1236,17 @@ let BignumberInputDirective = BignumberInputDirective_1 = class BignumberInputDi
1235
1236
  this.updateVariables();
1236
1237
  }
1237
1238
  }
1239
+ onPaste(event) {
1240
+ var _a, _b;
1241
+ const pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
1242
+ const numericText = pastedText.replace(new RegExp(`\\${this.thousandsSeparator}`, "g"), "").replace(this.decimalSeparator, ".");
1243
+ const [intPart, decimalPart = ""] = numericText.split(".");
1244
+ const totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
1245
+ if (totalDigits > this.precision) {
1246
+ event.preventDefault();
1247
+ this.pasteRejected.emit(pastedText);
1248
+ }
1249
+ }
1238
1250
  onKeypress(event) {
1239
1251
  const code = event.code;
1240
1252
  if (code === "Minus" || code === "NumpadSubtract") {
@@ -1315,6 +1327,12 @@ __decorate([
1315
1327
  __decorate([
1316
1328
  HostBinding("attr.maxLength")
1317
1329
  ], BignumberInputDirective.prototype, "maxLength", void 0);
1330
+ __decorate([
1331
+ Output()
1332
+ ], BignumberInputDirective.prototype, "pasteRejected", void 0);
1333
+ __decorate([
1334
+ HostListener("paste", ["$event"])
1335
+ ], BignumberInputDirective.prototype, "onPaste", null);
1318
1336
  __decorate([
1319
1337
  HostListener("keypress", ["$event"])
1320
1338
  ], BignumberInputDirective.prototype, "onKeypress", null);
@@ -3032,12 +3050,19 @@ var CardTemplateTypes;
3032
3050
  let CardComponent = class CardComponent {
3033
3051
  constructor() {
3034
3052
  this.fullWidth = false;
3053
+ this.title = '';
3054
+ this.subtitle = '';
3055
+ this.icon = '';
3035
3056
  this.showBanner = false;
3036
- this.hasCustomTemplates = false;
3037
3057
  }
3038
3058
  ngAfterContentInit() {
3039
3059
  this._getTemplates();
3040
- this._testLoadImage();
3060
+ this._loadImage();
3061
+ }
3062
+ get hasHeader() {
3063
+ const headerTemplate = !!this.headerTemplate;
3064
+ const hasHeaderAttributes = this.title || this.subtitle || this.icon;
3065
+ return headerTemplate || hasHeaderAttributes;
3041
3066
  }
3042
3067
  _getHeaderTemplate() {
3043
3068
  return this._getCustomTemplate(CardTemplateTypes.Header);
@@ -3056,9 +3081,8 @@ let CardComponent = class CardComponent {
3056
3081
  this.headerTemplate = this._getHeaderTemplate();
3057
3082
  this.bodyTemplate = this._getBodyTemplate();
3058
3083
  this.footerTemplate = this._getFooterTemplate();
3059
- this.hasCustomTemplates = !!(this.headerTemplate || this.bodyTemplate || this.footerTemplate);
3060
3084
  }
3061
- _testLoadImage() {
3085
+ _loadImage() {
3062
3086
  const img = new Image();
3063
3087
  img.src = this.bannerImage;
3064
3088
  img.onload = () => (this.showBanner = true);
@@ -3071,14 +3095,23 @@ __decorate([
3071
3095
  __decorate([
3072
3096
  Input()
3073
3097
  ], CardComponent.prototype, "fullWidth", void 0);
3098
+ __decorate([
3099
+ Input()
3100
+ ], CardComponent.prototype, "title", void 0);
3101
+ __decorate([
3102
+ Input()
3103
+ ], CardComponent.prototype, "subtitle", void 0);
3104
+ __decorate([
3105
+ Input()
3106
+ ], CardComponent.prototype, "icon", void 0);
3074
3107
  __decorate([
3075
3108
  ContentChildren(TemplateDirective)
3076
3109
  ], CardComponent.prototype, "templates", void 0);
3077
3110
  CardComponent = __decorate([
3078
3111
  Component({
3079
3112
  selector: "s-card",
3080
- template: "<div class=\"card\" [ngClass]=\"{ 'card--full-width': fullWidth }\">\n <div\n *ngIf=\"showBanner\"\n class=\"banner\"\n [ngStyle]=\"{'background-image': 'url(' + bannerImage + ')'}\">\n </div>\n\n <ng-container *ngIf=\"hasCustomTemplates; then customTemplates; else contentTemplate\"> </ng-container>\n\n <ng-template #customTemplates>\n <div *ngIf=\"headerTemplate\" class=\"header\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </div>\n <div *ngIf=\"bodyTemplate\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n </ng-template>\n\n <ng-template #contentTemplate>\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n </ng-template>\n</div>\n",
3081
- styles: [".card{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border-radius:4px;box-shadow:0 1px 5px 0 #00000040;overflow:hidden}.card--full-width{width:100%}.card .banner{background-repeat:no-repeat;background-size:cover;height:150px;width:100%}.card .header{padding:16px 12px}.card .body,.card .footer{padding:16px}.card .body+.footer,.card .header+.body{border-top:1px solid #c1c1cc}"]
3113
+ template: "<div class=\"card\" [ngClass]=\"{ 'card--full-width': fullWidth }\">\n <div\n *ngIf=\"showBanner\"\n class=\"banner\"\n [ngStyle]=\"{'background-image': 'url(' + bannerImage + ')'}\">\n </div>\n\n <ng-container *ngIf=\"hasHeader\">\n <div class=\"header\">\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n <ng-container *ngIf=\"!headerTemplate\">\n <div class=\"header-content\">\n <div class=\"header-icon\" *ngIf=\"icon\">\n <i [class]=\"icon\"></i>\n </div>\n <div>\n <div class=\"header-title\" *ngIf=\"title\">\n {{ title }}\n </div>\n <div class=\"header-subtitle\" *ngIf=\"subtitle\">\n {{ subtitle }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div *ngIf=\"bodyTemplate\" class=\"body\">\n <ng-container *ngTemplateOutlet=\"bodyTemplate\"></ng-container>\n </div>\n <ng-container *ngIf=\"!bodyTemplate\">\n <div class=\"body\">\n <ng-content></ng-content>\n </div>\n </ng-container>\n <div *ngIf=\"footerTemplate\" class=\"footer\">\n <ng-container *ngTemplateOutlet=\"footerTemplate\"></ng-container>\n </div>\n</div>\n",
3114
+ styles: [".card{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:#fff;border-radius:4px;box-shadow:0 1px 5px 0 #00000040;overflow:hidden}.card--full-width{width:100%}.card .banner{background-repeat:no-repeat;background-size:cover;height:150px;width:100%}.card .header{padding:16px 12px}.card .header-content{display:-ms-flexbox;display:flex;gap:12px}.card .header-title{color:#212533;font-size:14px;font-style:normal;font-weight:700}.card .header-subtitle{color:#6e7280;font-size:14px;font-style:normal;font-weight:400}.card .header-icon{border-radius:50%;background-color:#dedce5;width:3em;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-height:3em}.card .body,.card .footer{padding:16px}.card .body+.footer,.card .header+.body{border-top:1px solid #c1c1cc}"]
3082
3115
  })
3083
3116
  ], CardComponent);
3084
3117
 
@@ -6290,19 +6323,24 @@ var NumberAlignmentOption;
6290
6323
  * @deprecated Should use BigNumberInput directive instead
6291
6324
  */
6292
6325
  let NumberInputDirective = NumberInputDirective_1 = class NumberInputDirective extends CurrencyMaskDirective$1 {
6293
- constructor(_elementRef, _keyValueDiffers, localeService) {
6326
+ constructor(_keyValueDiffers, _elementRef, localeService) {
6294
6327
  super(null, _elementRef, _keyValueDiffers);
6328
+ this._elementRef = _elementRef;
6295
6329
  this.localeService = localeService;
6296
6330
  this.precision = 15;
6297
6331
  this.scale = 0;
6298
6332
  this.alignTo = NumberAlignmentOption.LEFT;
6299
6333
  this.allowNegative = true;
6300
- this.regex = /\d/;
6334
+ this.pasteRejected = new EventEmitter();
6301
6335
  this.onLocaleService();
6302
6336
  }
6303
6337
  ngOnInit() {
6304
6338
  this.updateVariables();
6305
6339
  super.ngOnInit();
6340
+ this.pasteListener = this._onPaste.bind(this);
6341
+ this._elementRef.nativeElement.addEventListener("paste", this.pasteListener);
6342
+ this.keypressListener = this._onKeypress.bind(this);
6343
+ this._elementRef.nativeElement.addEventListener("keypress", this.keypressListener);
6306
6344
  }
6307
6345
  ngOnChanges(changes) {
6308
6346
  const placeholderChange = changes.placeholder && changes.placeholder.currentValue;
@@ -6317,6 +6355,33 @@ let NumberInputDirective = NumberInputDirective_1 = class NumberInputDirective e
6317
6355
  this.updateVariables();
6318
6356
  }
6319
6357
  }
6358
+ ngOnDestroy() {
6359
+ this._elementRef.nativeElement.removeEventListener("paste", this.pasteListener);
6360
+ this._elementRef.nativeElement.removeEventListener("keypress", this.keypressListener);
6361
+ }
6362
+ _onPaste(event) {
6363
+ var _a, _b;
6364
+ const pastedText = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
6365
+ const numericText = pastedText.replace(new RegExp(`\\${this.thousandsSeparator}`, "g"), "").replace(this.decimalSeparator, ".");
6366
+ const [intPart, decimalPart = ""] = numericText.split(".");
6367
+ const totalDigits = intPart.replace(/\D/g, "").length + decimalPart.slice(0, this.scale).length;
6368
+ if (totalDigits > this.precision) {
6369
+ event.preventDefault();
6370
+ event.stopPropagation();
6371
+ this.pasteRejected.emit(pastedText);
6372
+ }
6373
+ }
6374
+ _onKeypress(event) {
6375
+ const code = event.code;
6376
+ if (code === "Minus" || code === "NumpadSubtract") {
6377
+ if (this.allowNegative) {
6378
+ this.maxLength = this._maxLength + 1;
6379
+ }
6380
+ }
6381
+ else if (code === "Equal" || code === "NumpadAdd") {
6382
+ this.maxLength = this._maxLength;
6383
+ }
6384
+ }
6320
6385
  /**
6321
6386
  * Update the options values according to the directive input values.
6322
6387
  */
@@ -6340,24 +6405,9 @@ let NumberInputDirective = NumberInputDirective_1 = class NumberInputDirective e
6340
6405
  const thoSepLength = this.thousandsSeparator.length;
6341
6406
  let maxLength = this.precision + (this.scale ? decSepLength : 0);
6342
6407
  maxLength += Math.ceil((this.precision - (this.scale ? this.scale : 0)) / 3 - 1) * thoSepLength;
6408
+ this._maxLength = maxLength;
6343
6409
  this.maxLength = maxLength;
6344
6410
  }
6345
- /**
6346
- * Prevents the default CurrencyMask behavior when typed a incorrect value.
6347
- * By default the CurrencyMask inputs the mask value to the component value when typed a incorrect value.
6348
- */
6349
- handleKeypress(event) {
6350
- const negativeOperator = "-";
6351
- const { key } = event;
6352
- if (this.thousandsSeparator.includes(key) ||
6353
- this.decimalSeparator.includes(key) ||
6354
- negativeOperator.includes(key) ||
6355
- this.regex.test(key) ||
6356
- "Enter".toUpperCase() === key.toUpperCase())
6357
- super.handleKeypress(event);
6358
- else
6359
- event.preventDefault();
6360
- }
6361
6411
  onLocaleService() {
6362
6412
  this.localeService
6363
6413
  .getLocale()
@@ -6370,8 +6420,8 @@ let NumberInputDirective = NumberInputDirective_1 = class NumberInputDirective e
6370
6420
  }
6371
6421
  };
6372
6422
  NumberInputDirective.ctorParameters = () => [
6373
- { type: ElementRef },
6374
6423
  { type: KeyValueDiffers },
6424
+ { type: ElementRef },
6375
6425
  { type: LocaleService }
6376
6426
  ];
6377
6427
  __decorate([
@@ -6399,6 +6449,9 @@ __decorate([
6399
6449
  __decorate([
6400
6450
  HostBinding("attr.maxLength")
6401
6451
  ], NumberInputDirective.prototype, "maxLength", void 0);
6452
+ __decorate([
6453
+ Output()
6454
+ ], NumberInputDirective.prototype, "pasteRejected", void 0);
6402
6455
  NumberInputDirective = NumberInputDirective_1 = __decorate([
6403
6456
  Directive({
6404
6457
  selector: "input[sNumberInput]",
@@ -6596,13 +6649,18 @@ class TextAreaField extends Field {
6596
6649
 
6597
6650
  class TextAreaIAField extends Field {
6598
6651
  constructor(config) {
6652
+ var _a;
6599
6653
  super(config);
6654
+ this.style = {
6655
+ resize: 'vertical'
6656
+ };
6600
6657
  this.cols = config.cols;
6601
6658
  this.rows = config.rows;
6602
6659
  this.keyFilter = config.keyFilter;
6603
- this.style = config.style;
6660
+ this.style = Object.assign(Object.assign({}, config.style), this.style);
6604
6661
  this.prompt = config.prompt;
6605
6662
  this.readonly = config.readonly;
6663
+ this.speechRecognition = (_a = config.speechRecognition) !== null && _a !== void 0 ? _a : false;
6606
6664
  }
6607
6665
  }
6608
6666
 
@@ -10550,11 +10608,112 @@ SliderFieldComponent = __decorate([
10550
10608
  })
10551
10609
  ], SliderFieldComponent);
10552
10610
 
10611
+ let SpeechRecognitionService = class SpeechRecognitionService {
10612
+ constructor(localeService, ngZone) {
10613
+ this.localeService = localeService;
10614
+ this.ngZone = ngZone;
10615
+ this.hasSupportSpeechRecognition = false;
10616
+ this.isListening = false;
10617
+ this.TIMEOUT_NO_MESSAGE = 3000;
10618
+ this.setRecognition();
10619
+ }
10620
+ listen() {
10621
+ if (this.isListening) {
10622
+ return;
10623
+ }
10624
+ const speechSubject = new Subject();
10625
+ this.isListening = true;
10626
+ this.recognition.continuous = true;
10627
+ this.recognition.interimResults = true;
10628
+ this.recognition.maxAlternatives = 1;
10629
+ let silenceTimer;
10630
+ const restartSilenceTimer = () => {
10631
+ if (silenceTimer !== undefined) {
10632
+ clearTimeout(silenceTimer);
10633
+ }
10634
+ silenceTimer = setTimeout(() => {
10635
+ this.recognition.stop();
10636
+ }, this.TIMEOUT_NO_MESSAGE);
10637
+ };
10638
+ let fullTranscript = '';
10639
+ let interimTranscript = '';
10640
+ this.recognition.onresult = (event) => {
10641
+ this.ngZone.run(() => {
10642
+ restartSilenceTimer();
10643
+ let interimTranscript = '';
10644
+ for (let i = event.resultIndex; i < event.results.length; ++i) {
10645
+ const transcript = event.results[i][0].transcript;
10646
+ if (event.results[i].isFinal) {
10647
+ fullTranscript += transcript + '\n';
10648
+ }
10649
+ else {
10650
+ interimTranscript += transcript;
10651
+ }
10652
+ }
10653
+ interimTranscript = interimTranscript;
10654
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
10655
+ });
10656
+ };
10657
+ this.recognition.onerror = () => {
10658
+ this.ngZone.run(() => {
10659
+ if (silenceTimer !== undefined) {
10660
+ clearTimeout(silenceTimer);
10661
+ }
10662
+ this.isListening = false;
10663
+ speechSubject.next({
10664
+ isFinal: true,
10665
+ text: ''
10666
+ });
10667
+ });
10668
+ };
10669
+ this.recognition.onend = () => {
10670
+ this.ngZone.run(() => {
10671
+ if (silenceTimer !== undefined) {
10672
+ clearTimeout(silenceTimer);
10673
+ }
10674
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
10675
+ this.isListening = false;
10676
+ speechSubject.complete();
10677
+ });
10678
+ };
10679
+ this.recognition.start();
10680
+ return speechSubject;
10681
+ }
10682
+ stop() {
10683
+ this.recognition.stop();
10684
+ }
10685
+ setRecognition() {
10686
+ var _a;
10687
+ const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
10688
+ if (!SpeechRecognitionConstructor) {
10689
+ console.warn('Speech recognition is not supported in this browser.');
10690
+ return;
10691
+ }
10692
+ this.hasSupportSpeechRecognition = true;
10693
+ this.recognition = new SpeechRecognitionConstructor();
10694
+ this.recognition.lang = ((_a = this.localeService.getLocaleOptions()) === null || _a === void 0 ? void 0 : _a.locale) || 'pt-BR';
10695
+ this.recognition.interimResults = false;
10696
+ this.recognition.maxAlternatives = 1;
10697
+ this.localeService.getLocale().subscribe(locale => this.recognition.lang = locale);
10698
+ }
10699
+ };
10700
+ SpeechRecognitionService.ctorParameters = () => [
10701
+ { type: LocaleService },
10702
+ { type: NgZone }
10703
+ ];
10704
+ SpeechRecognitionService.ɵprov = ɵɵdefineInjectable({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(ɵɵinject(LocaleService), ɵɵinject(NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
10705
+ SpeechRecognitionService = __decorate([
10706
+ Injectable({
10707
+ providedIn: 'root'
10708
+ })
10709
+ ], SpeechRecognitionService);
10710
+
10553
10711
  let TextAreaIAFieldComponent = class TextAreaIAFieldComponent {
10554
- constructor(_iassistService, _formBuilder, _translateService) {
10712
+ constructor(_iassistService, _formBuilder, _translateService, speechRecognitionService) {
10555
10713
  this._iassistService = _iassistService;
10556
10714
  this._formBuilder = _formBuilder;
10557
10715
  this._translateService = _translateService;
10716
+ this.speechRecognitionService = speechRecognitionService;
10558
10717
  this.isVisible = false;
10559
10718
  this.isLoading = false;
10560
10719
  }
@@ -10592,12 +10751,14 @@ let TextAreaIAFieldComponent = class TextAreaIAFieldComponent {
10592
10751
  this.hideDialog();
10593
10752
  }
10594
10753
  _createDialogFields() {
10754
+ var _a;
10595
10755
  this.fields = [
10596
10756
  new FormField({
10597
10757
  name: "context",
10598
10758
  type: FieldType.Text,
10599
10759
  label: this._translateService.instant("platform.angular_components.context"),
10600
10760
  size: { sm: 12, md: 12, lg: 12, xl: 12 },
10761
+ speechRecognition: (_a = this.field.speechRecognition) !== null && _a !== void 0 ? _a : false
10601
10762
  }),
10602
10763
  ];
10603
10764
  }
@@ -10610,7 +10771,8 @@ let TextAreaIAFieldComponent = class TextAreaIAFieldComponent {
10610
10771
  TextAreaIAFieldComponent.ctorParameters = () => [
10611
10772
  { type: IAssistService },
10612
10773
  { type: FormBuilder },
10613
- { type: TranslateService }
10774
+ { type: TranslateService },
10775
+ { type: SpeechRecognitionService }
10614
10776
  ];
10615
10777
  __decorate([
10616
10778
  Input()
@@ -10618,13 +10780,10 @@ __decorate([
10618
10780
  __decorate([
10619
10781
  Input()
10620
10782
  ], TextAreaIAFieldComponent.prototype, "formControl", void 0);
10621
- __decorate([
10622
- ViewChild('inputRef')
10623
- ], TextAreaIAFieldComponent.prototype, "inputRef", void 0);
10624
10783
  TextAreaIAFieldComponent = __decorate([
10625
10784
  Component({
10626
- template: "<s-field-label [field]=\"field\"\n [fieldContainerRef]=\"inputRef?.nativeElement\"></s-field-label>\n\n<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\"> \n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <textarea #inputRef\n [id]=\"(field.id || field.name)\"\n pInputTextarea\n [rows]=\"field.rows\"\n [cols]=\"field.cols\"\n [formControl]=\"formControl\"\n style=\"resize: vertical;\"\n [ngStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\">\n </textarea>\n <button\n class=\"iassist-button\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>",
10627
- styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}"]
10785
+ template: "<s-field-label [field]=\"field\"\n *ngIf=\"textArea.renderTextArea\"\n [fieldContainerRef]=\"textArea.textAreaElement?.nativeElement\"></s-field-label>\n\n<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\">\n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <s-textarea\n #textArea\n [inputId]=\"(field.id || field.name)\"\n [rows]=\"field.rows\"\n [formControl]=\"formControl\"\n [inputStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n [speechRecognition]=\"field.speechRecognition\"\n [placeholder]=\"field.placeholder\"\n ></s-textarea>\n <button\n class=\"iassist-button\"\n [class.speech-recognition]=\"field.speechRecognition && speechRecognitionService.hasSupportSpeechRecognition\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>\n",
10786
+ styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.textarea-ia s-textarea{width:100%}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}.speech-recognition{margin-bottom:12.5px}"]
10628
10787
  })
10629
10788
  ], TextAreaIAFieldComponent);
10630
10789
 
@@ -10650,7 +10809,7 @@ __decorate([
10650
10809
  ], TextAreaFieldComponent.prototype, "inputRef", void 0);
10651
10810
  TextAreaFieldComponent = __decorate([
10652
10811
  Component({
10653
- template: "<s-field-label *ngIf=\"textArea\" [field]=\"field\"\n [fieldContainerRef]=\"textArea.textAreaElement?.nativeElement\"></s-field-label>\n\n<s-textarea\n #textArea\n [inputId]=\"(field.id || field.name)\"\n [rows]=\"field.rows\"\n [formControl]=\"formControl\"\n style=\"resize: vertical;\"\n [inputStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n [keyFilter]=\"field.keyFilter\"\n [speechRecognition]=\"field.speechRecognition\">\n</s-textarea>\n"
10812
+ template: "<s-field-label *ngIf=\"textArea\" [field]=\"field\"\n [fieldContainerRef]=\"textArea.textAreaElement?.nativeElement\"></s-field-label>\n\n<s-textarea\n #textArea\n [inputId]=\"(field.id || field.name)\"\n [rows]=\"field.rows\"\n [formControl]=\"formControl\"\n [inputStyle]=\"field.style\"\n [readOnly]=\"field.readonly ? field.readonly() : false\"\n [keyFilter]=\"field.keyFilter\"\n [placeholder]=\"field.placeholder\"\n [speechRecognition]=\"field.speechRecognition\">\n</s-textarea>\n"
10654
10813
  })
10655
10814
  ], TextAreaFieldComponent);
10656
10815
 
@@ -12428,7 +12587,8 @@ TextFieldModule = __decorate([
12428
12587
 
12429
12588
  var TextAreaComponent_1;
12430
12589
  let TextAreaComponent = TextAreaComponent_1 = class TextAreaComponent {
12431
- constructor() {
12590
+ constructor(cdr) {
12591
+ this.cdr = cdr;
12432
12592
  this.onChange = () => { };
12433
12593
  this.onTouched = () => { };
12434
12594
  this.disabled = false;
@@ -12436,6 +12596,9 @@ let TextAreaComponent = TextAreaComponent_1 = class TextAreaComponent {
12436
12596
  this.inputId = `textarea-${Math.random()}`;
12437
12597
  this.rows = 5;
12438
12598
  this.speechRecognition = false;
12599
+ this._inputStyle = {
12600
+ resize: 'vertical'
12601
+ };
12439
12602
  this.readOnly = false;
12440
12603
  this.renderTextArea = false;
12441
12604
  }
@@ -12446,8 +12609,26 @@ let TextAreaComponent = TextAreaComponent_1 = class TextAreaComponent {
12446
12609
  this._textAreaElement = value;
12447
12610
  setTimeout(() => {
12448
12611
  this.renderTextArea = true;
12612
+ this.cdr.detectChanges();
12449
12613
  });
12450
12614
  }
12615
+ get placeholder() {
12616
+ return this._placeholder;
12617
+ }
12618
+ set placeholder(value) {
12619
+ if (value) {
12620
+ this._placeholder = value;
12621
+ }
12622
+ else {
12623
+ this._placeholder = '';
12624
+ }
12625
+ }
12626
+ get inputStyle() {
12627
+ return this._inputStyle;
12628
+ }
12629
+ set inputStyle(value) {
12630
+ this._inputStyle = Object.assign(Object.assign({}, value), this._inputStyle);
12631
+ }
12451
12632
  writeValue(obj) {
12452
12633
  this.value = obj;
12453
12634
  }
@@ -12473,6 +12654,9 @@ let TextAreaComponent = TextAreaComponent_1 = class TextAreaComponent {
12473
12654
  this.setValue(recognizedText);
12474
12655
  }
12475
12656
  };
12657
+ TextAreaComponent.ctorParameters = () => [
12658
+ { type: ChangeDetectorRef }
12659
+ ];
12476
12660
  __decorate([
12477
12661
  ViewChild('textArea', { read: ElementRef })
12478
12662
  ], TextAreaComponent.prototype, "textAreaElement", null);
@@ -12490,14 +12674,17 @@ __decorate([
12490
12674
  ], TextAreaComponent.prototype, "keyFilter", void 0);
12491
12675
  __decorate([
12492
12676
  Input()
12493
- ], TextAreaComponent.prototype, "inputStyle", void 0);
12677
+ ], TextAreaComponent.prototype, "placeholder", null);
12678
+ __decorate([
12679
+ Input()
12680
+ ], TextAreaComponent.prototype, "inputStyle", null);
12494
12681
  __decorate([
12495
12682
  Input()
12496
12683
  ], TextAreaComponent.prototype, "readOnly", void 0);
12497
12684
  TextAreaComponent = TextAreaComponent_1 = __decorate([
12498
12685
  Component({
12499
12686
  selector: 's-textarea',
12500
- template: "<textarea\n *ngIf=\"keyFilter\"\n #textArea\n class=\"textarea\"\n [pKeyFilter]=\"keyFilter\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<textarea\n *ngIf=\"!keyFilter\"\n #textArea\n class=\"textarea\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<s-speech-recognition\n *ngIf=\"speechRecognition && renderTextArea\"\n [textAreaElement]=\"textAreaElement.nativeElement\"\n (recognizedText)=\"handleRecognizedText($event)\">\n</s-speech-recognition>\n",
12687
+ template: "<textarea\n *ngIf=\"keyFilter\"\n #textArea\n class=\"textarea\"\n [pKeyFilter]=\"keyFilter\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<textarea\n *ngIf=\"!keyFilter\"\n #textArea\n class=\"textarea\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<s-speech-recognition\n *ngIf=\"speechRecognition && renderTextArea\"\n [textAreaElement]=\"textAreaElement.nativeElement\"\n (recognizedText)=\"handleRecognizedText($event)\">\n</s-speech-recognition>\n",
12501
12688
  providers: [
12502
12689
  {
12503
12690
  provide: NG_VALUE_ACCESSOR,
@@ -12509,101 +12696,6 @@ TextAreaComponent = TextAreaComponent_1 = __decorate([
12509
12696
  })
12510
12697
  ], TextAreaComponent);
12511
12698
 
12512
- let SpeechRecognitionService = class SpeechRecognitionService {
12513
- constructor(localeService, ngZone) {
12514
- this.localeService = localeService;
12515
- this.ngZone = ngZone;
12516
- this.isListening = false;
12517
- this.TIMEOUT_NO_MESSAGE = 3000;
12518
- this.setRecognition();
12519
- }
12520
- listen() {
12521
- if (this.isListening) {
12522
- return;
12523
- }
12524
- const speechSubject = new Subject();
12525
- this.isListening = true;
12526
- this.recognition.continuous = true;
12527
- this.recognition.interimResults = true;
12528
- this.recognition.maxAlternatives = 1;
12529
- let silenceTimer;
12530
- const restartSilenceTimer = () => {
12531
- if (silenceTimer !== undefined) {
12532
- clearTimeout(silenceTimer);
12533
- }
12534
- silenceTimer = setTimeout(() => {
12535
- this.recognition.stop();
12536
- }, this.TIMEOUT_NO_MESSAGE);
12537
- };
12538
- let fullTranscript = '';
12539
- let interimTranscript = '';
12540
- this.recognition.onresult = (event) => {
12541
- this.ngZone.run(() => {
12542
- restartSilenceTimer();
12543
- let interimTranscript = '';
12544
- for (let i = event.resultIndex; i < event.results.length; ++i) {
12545
- const transcript = event.results[i][0].transcript;
12546
- if (event.results[i].isFinal) {
12547
- fullTranscript += transcript + '\n';
12548
- }
12549
- else {
12550
- interimTranscript += transcript;
12551
- }
12552
- }
12553
- interimTranscript = interimTranscript;
12554
- speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
12555
- });
12556
- };
12557
- this.recognition.onerror = () => {
12558
- this.ngZone.run(() => {
12559
- if (silenceTimer !== undefined) {
12560
- clearTimeout(silenceTimer);
12561
- }
12562
- this.isListening = false;
12563
- speechSubject.next({
12564
- isFinal: true,
12565
- text: ''
12566
- });
12567
- });
12568
- };
12569
- this.recognition.onend = () => {
12570
- this.ngZone.run(() => {
12571
- if (silenceTimer !== undefined) {
12572
- clearTimeout(silenceTimer);
12573
- }
12574
- speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
12575
- this.isListening = false;
12576
- speechSubject.complete();
12577
- });
12578
- };
12579
- this.recognition.start();
12580
- return speechSubject;
12581
- }
12582
- stop() {
12583
- this.recognition.stop();
12584
- }
12585
- setRecognition() {
12586
- const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
12587
- if (!SpeechRecognitionConstructor) {
12588
- throw new Error('Speech recognition is not supported in this browser.');
12589
- }
12590
- this.recognition = new SpeechRecognitionConstructor();
12591
- this.recognition.lang = this.localeService.getLocaleOptions().locale || 'pt-BR';
12592
- this.recognition.interimResults = false;
12593
- this.recognition.maxAlternatives = 1;
12594
- }
12595
- };
12596
- SpeechRecognitionService.ctorParameters = () => [
12597
- { type: LocaleService },
12598
- { type: NgZone }
12599
- ];
12600
- SpeechRecognitionService.ɵprov = ɵɵdefineInjectable({ factory: function SpeechRecognitionService_Factory() { return new SpeechRecognitionService(ɵɵinject(LocaleService), ɵɵinject(NgZone)); }, token: SpeechRecognitionService, providedIn: "root" });
12601
- SpeechRecognitionService = __decorate([
12602
- Injectable({
12603
- providedIn: 'root'
12604
- })
12605
- ], SpeechRecognitionService);
12606
-
12607
12699
  let TextToSpeechService = class TextToSpeechService {
12608
12700
  constructor(locale, ngZone) {
12609
12701
  this.locale = locale;
@@ -12617,10 +12709,13 @@ let TextToSpeechService = class TextToSpeechService {
12617
12709
  if (!_voices.length) {
12618
12710
  speechSynthesis.onvoiceschanged = () => {
12619
12711
  this.ngZone.run(() => {
12712
+ var _a;
12620
12713
  _voices = speechSynthesis.getVoices();
12621
- const currentLang = this.locale.getLocaleOptions().locale || 'pt-BR';
12622
- this.voices = _voices.filter((voice) => voice.lang === currentLang);
12623
- this.activeVoice = this.voices[0];
12714
+ const currentLang = ((_a = this.locale.getLocaleOptions()) === null || _a === void 0 ? void 0 : _a.locale) || 'pt-BR';
12715
+ this.setActiveVoice(_voices, currentLang);
12716
+ this.locale.getLocale().subscribe((locale) => {
12717
+ this.setActiveVoice(_voices, locale);
12718
+ });
12624
12719
  });
12625
12720
  };
12626
12721
  }
@@ -12661,6 +12756,12 @@ let TextToSpeechService = class TextToSpeechService {
12661
12756
  get hasVoice() {
12662
12757
  return !!this.activeVoice;
12663
12758
  }
12759
+ setActiveVoice(voices, lang) {
12760
+ const _voice = voices.find((voice) => voice.lang === lang);
12761
+ if (_voice) {
12762
+ this.activeVoice = _voice;
12763
+ }
12764
+ }
12664
12765
  };
12665
12766
  TextToSpeechService.ctorParameters = () => [
12666
12767
  { type: LocaleService },
@@ -12683,19 +12784,11 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12683
12784
  this.isDoneSpeaking = false;
12684
12785
  this.onDestroy$ = new Subject();
12685
12786
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
12686
- this.SPEECH_RECOGNITION_MARGIN_OFFSET = 13;
12687
12787
  this.keydownEventListener = (event) => {
12688
12788
  if (this.disabled) {
12689
12789
  event.preventDefault();
12690
12790
  }
12691
12791
  };
12692
- this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER = new MutationObserver(() => {
12693
- this.SPEECH_CONTAINER_WIDTH_CALLBACK();
12694
- });
12695
- this.SPEECH_CONTAINER_WIDTH_CALLBACK = () => {
12696
- this.setSpeechContainerWidth();
12697
- };
12698
- this.speechRecognitionContainerWidth = 0;
12699
12792
  this.disabled = false;
12700
12793
  this.isSpeaking = false;
12701
12794
  this.voiceSpeed = 1;
@@ -12710,19 +12803,14 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12710
12803
  this.recognizedText = new EventEmitter();
12711
12804
  }
12712
12805
  ngOnInit() {
12806
+ if (!this.hasSpeechRecognitionBrowserApi) {
12807
+ return;
12808
+ }
12713
12809
  if (!this.textAreaElement) {
12714
12810
  throw new Error('textAreaElement is required');
12715
12811
  }
12716
12812
  this.textAreaElement.placeholder = this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
12717
12813
  this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
12718
- const config = { attributes: true, childList: true, subtree: true };
12719
- this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.observe(this.textAreaElement, config);
12720
- window.addEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
12721
- }
12722
- ngAfterViewInit() {
12723
- setTimeout(() => {
12724
- this.setSpeechContainerWidth();
12725
- });
12726
12814
  }
12727
12815
  onListen() {
12728
12816
  if (this.isDisabledMicrophone || this.isListening) {
@@ -12794,9 +12882,6 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12794
12882
  ngOnDestroy() {
12795
12883
  this.onDestroy$.next();
12796
12884
  this.onDestroy$.complete();
12797
- this.textAreaElement.removeEventListener('keydown', this.keydownEventListener);
12798
- window.removeEventListener('resize', this.SPEECH_CONTAINER_WIDTH_CALLBACK);
12799
- this.TEXT_AREA_ELEMENT_MUTATION_OBSERVER.disconnect();
12800
12885
  }
12801
12886
  toggleTextToSpeech() {
12802
12887
  if (this.isPlayingTextToSpeech) {
@@ -12830,6 +12915,9 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12830
12915
  get isListening() {
12831
12916
  return this.speechRecognitionService.isListening;
12832
12917
  }
12918
+ get hasSpeechRecognitionBrowserApi() {
12919
+ return this.speechRecognitionService.hasSupportSpeechRecognition;
12920
+ }
12833
12921
  get isDisabledTextToSpeech() {
12834
12922
  const hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
12835
12923
  return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
@@ -12844,9 +12932,6 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12844
12932
  this.isDoneSpeaking = true;
12845
12933
  });
12846
12934
  }
12847
- setSpeechContainerWidth() {
12848
- this.speechRecognitionContainerWidth = this.textAreaElement.getBoundingClientRect().width - this.SPEECH_RECOGNITION_MARGIN_OFFSET;
12849
- }
12850
12935
  };
12851
12936
  SpeechRecognitionComponent.ctorParameters = () => [
12852
12937
  { type: SpeechRecognitionService },
@@ -12862,8 +12947,8 @@ __decorate([
12862
12947
  SpeechRecognitionComponent = __decorate([
12863
12948
  Component({
12864
12949
  selector: 's-speech-recognition',
12865
- template: "<section class=\"speech-recognition\" [style.width.px]=\"speechRecognitionContainerWidth\" *ngIf=\"speechRecognitionContainerWidth\">\n <div class=\"speech-recognition-text\">\n <ng-container *ngIf=\"canRenderMicrophone\">\n {{ 'platform.angular_components.text_area_before_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"isSpeaking\">\n {{ 'platform.angular_components.text_area_while_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"canRenderAprove && canRenderDiscard\">\n {{ 'platform.angular_components.text_area_end_speech' | translate }}\n </ng-container>\n </div>\n <div class=\"speech-recognition-buttons\">\n <span\n *ngIf=\"canRenderListeningText\"\n (click)=\"stopListening()\"\n class=\"speech-recognition-item speech-recognition-item-regular\">\n <i class=\"far fa-ellipsis-h\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderMicrophone\"\n (click)=\"onListen()\"\n class=\"speech-recognition-item speech-recognition-item-microphone\"\n [class.speech-recognition-item-disabled]=\"isDisabledMicrophone || isListening || disabled\">\n <i class=\"fas fa-microphone\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderAprove\"\n (click)=\"onAprove()\"\n class=\"speech-recognition-item speech-recognition-item-aprove\">\n <i class=\"fas fa-check\"></i>\n </span>\n\n <span *ngIf=\"canRenderDiscard\"\n (click)=\"onDiscard()\"\n class=\"speech-recognition-item speech-recognition-item-discard\">\n <i class=\"fas fa-times\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeech\"\n (click)=\"onOpenToolbar()\"\n class=\"speech-recognition-item speech-recognition-item-regular\"\n [class.speech-recognition-item-disabled]=\"isDisabledTextToSpeech\">\n <i class=\"fas fa-volume-down\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeechToolbar\"\n class=\"speech-recognition-item-toolbar\">\n <i class=\"fas\" [class.fa-pause]=\"isPlayingTextToSpeech\" [class.fa-play]=\"!isPlayingTextToSpeech\"\n (click)=\"toggleTextToSpeech()\"></i>\n <i class=\"fas fa-backward\" (click)=\"restartTextToSpeech()\"></i>\n <span (click)=\"updateVoiceSpeed()\">\n {{ voiceSpeed }}x\n </span>\n <i class=\"fas fa-times\" (click)=\"onCloseToolbar()\"></i>\n </span>\n </div>\n</section>\n",
12866
- styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px}.speech-recognition-item{display:-ms-inline-flexbox;display:inline-flex;height:25px;padding:4px 12px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;gap:8px;border-radius:15px;cursor:pointer;transition:background .1s ease-in}.speech-recognition-item i,.speech-recognition-item span{color:#fff}.speech-recognition-item-disabled{cursor:default!important}.speech-recognition-item-disabled *{opacity:.5}.speech-recognition-item-microphone{background:#428bca}.speech-recognition-item-microphone:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-regular{background:#7892a1}.speech-recognition-item-regular:not(.speech-recognition-item-disabled):hover{background:#697882}.speech-recognition-item-aprove{background:#0c9348}.speech-recognition-item-aprove:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-discard{background:#c13018}.speech-recognition-item-discard:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-toolbar{background:#7892a1;display:-ms-flexbox;display:flex;border-radius:15px;-ms-flex-align:center;align-items:center;color:#fff}.speech-recognition-item-toolbar i,.speech-recognition-item-toolbar span{cursor:pointer}.speech-recognition-item-toolbar i:not(:first-child),.speech-recognition-item-toolbar i:not(:last-child){padding:6px}.speech-recognition-item-toolbar i:first-child{padding-left:10px}.speech-recognition-item-toolbar i:last-child{padding-right:10px}.speech-recognition-item-toolbar span{height:25px}.speech-recognition-text{color:#212533;font-size:12px;font-style:normal;font-weight:400;word-break:break-word}"]
12950
+ template: "<section class=\"speech-recognition\" *ngIf=\"hasSpeechRecognitionBrowserApi\">\n <div class=\"speech-recognition-text\">\n <ng-container *ngIf=\"canRenderMicrophone\">\n {{ 'platform.angular_components.text_area_before_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"isSpeaking\">\n {{ 'platform.angular_components.text_area_while_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"canRenderAprove && canRenderDiscard\">\n {{ 'platform.angular_components.text_area_end_speech' | translate }}\n </ng-container>\n </div>\n <div class=\"speech-recognition-buttons\">\n <span\n *ngIf=\"canRenderListeningText\"\n (click)=\"stopListening()\"\n class=\"speech-recognition-item speech-recognition-item-regular\">\n <i class=\"far fa-ellipsis-h\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderMicrophone\"\n (click)=\"onListen()\"\n class=\"speech-recognition-item speech-recognition-item-microphone\"\n [class.speech-recognition-item-disabled]=\"isDisabledMicrophone || isListening || disabled\">\n <i class=\"fas fa-microphone\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderAprove\"\n (click)=\"onAprove()\"\n class=\"speech-recognition-item speech-recognition-item-aprove\">\n <i class=\"fas fa-check\"></i>\n </span>\n\n <span *ngIf=\"canRenderDiscard\"\n (click)=\"onDiscard()\"\n class=\"speech-recognition-item speech-recognition-item-discard\">\n <i class=\"fas fa-times\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeech\"\n (click)=\"onOpenToolbar()\"\n class=\"speech-recognition-item speech-recognition-item-regular\"\n [class.speech-recognition-item-disabled]=\"isDisabledTextToSpeech\">\n <i class=\"fas fa-volume-down\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeechToolbar\"\n class=\"speech-recognition-item-toolbar\">\n <i class=\"fas\" [class.fa-pause]=\"isPlayingTextToSpeech\" [class.fa-play]=\"!isPlayingTextToSpeech\"\n (click)=\"toggleTextToSpeech()\"></i>\n <i class=\"fas fa-backward\" (click)=\"restartTextToSpeech()\"></i>\n <span (click)=\"updateVoiceSpeed()\">\n {{ voiceSpeed }}x\n </span>\n <i class=\"fas fa-times\" (click)=\"onCloseToolbar()\"></i>\n </span>\n </div>\n</section>\n",
12951
+ styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between;width:100%}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px;margin-right:16px}.speech-recognition-item{display:-ms-inline-flexbox;display:inline-flex;height:25px;padding:4px 12px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;gap:8px;border-radius:15px;cursor:pointer;transition:background .1s ease-in}.speech-recognition-item i,.speech-recognition-item span{color:#fff}.speech-recognition-item-disabled{cursor:default!important}.speech-recognition-item-disabled *{opacity:.5}.speech-recognition-item-microphone{background:#428bca}.speech-recognition-item-microphone:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-regular{background:#7892a1}.speech-recognition-item-regular:not(.speech-recognition-item-disabled):hover{background:#697882}.speech-recognition-item-aprove{background:#0c9348}.speech-recognition-item-aprove:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-discard{background:#c13018}.speech-recognition-item-discard:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-toolbar{background:#7892a1;display:-ms-flexbox;display:flex;border-radius:15px;-ms-flex-align:center;align-items:center;color:#fff}.speech-recognition-item-toolbar i,.speech-recognition-item-toolbar span{cursor:pointer}.speech-recognition-item-toolbar i:not(:first-child),.speech-recognition-item-toolbar i:not(:last-child){padding:6px}.speech-recognition-item-toolbar i:first-child{padding-left:10px}.speech-recognition-item-toolbar i:last-child{padding-right:10px}.speech-recognition-item-toolbar span{height:25px}.speech-recognition-text{color:#212533;font-size:12px;font-style:normal;font-weight:400;word-break:break-word}"]
12867
12952
  })
12868
12953
  ], SpeechRecognitionComponent);
12869
12954
 
@@ -16492,10 +16577,12 @@ InlineEditComponent = __decorate([
16492
16577
  var TextAreaIAComponent_1;
16493
16578
  let TextAreaIAComponent = TextAreaIAComponent_1 = class TextAreaIAComponent {
16494
16579
  constructor(_iassistService, // Mover pra uma pasta global
16495
- _formBuilder, _translateService) {
16580
+ _formBuilder, _translateService, speechRecognitionService) {
16496
16581
  this._iassistService = _iassistService;
16497
16582
  this._formBuilder = _formBuilder;
16498
16583
  this._translateService = _translateService;
16584
+ this.speechRecognitionService = speechRecognitionService;
16585
+ this.speechRecognition = false;
16499
16586
  this.isVisible = false;
16500
16587
  this.isLoading = false;
16501
16588
  }
@@ -16558,6 +16645,7 @@ let TextAreaIAComponent = TextAreaIAComponent_1 = class TextAreaIAComponent {
16558
16645
  type: FieldType.Text,
16559
16646
  label: this._translateService.instant("platform.angular_components.context"),
16560
16647
  size: { sm: 12, md: 12, lg: 12, xl: 12 },
16648
+ speechRecognition: this.speechRecognition
16561
16649
  }),
16562
16650
  ];
16563
16651
  }
@@ -16570,7 +16658,8 @@ let TextAreaIAComponent = TextAreaIAComponent_1 = class TextAreaIAComponent {
16570
16658
  TextAreaIAComponent.ctorParameters = () => [
16571
16659
  { type: IAssistService },
16572
16660
  { type: FormBuilder },
16573
- { type: TranslateService }
16661
+ { type: TranslateService },
16662
+ { type: SpeechRecognitionService }
16574
16663
  ];
16575
16664
  __decorate([
16576
16665
  Input()
@@ -16593,10 +16682,13 @@ __decorate([
16593
16682
  __decorate([
16594
16683
  Input()
16595
16684
  ], TextAreaIAComponent.prototype, "cols", void 0);
16685
+ __decorate([
16686
+ Input()
16687
+ ], TextAreaIAComponent.prototype, "speechRecognition", void 0);
16596
16688
  TextAreaIAComponent = TextAreaIAComponent_1 = __decorate([
16597
16689
  Component({
16598
16690
  selector: "s-text-area-ia",
16599
- template: "<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\"> \n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <textarea\n [id]=\"id\"\n class=\"textarea-input\"\n pInputTextarea\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [rows]=\"rows\"\n [cols]=\"cols\"\n [readOnly]=\"readonly\">\n </textarea>\n <button\n class=\"iassist-button\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>",
16691
+ template: "<s-loading-state\n [loading]=\"isLoading\"\n [blockWindow]=\"true\">\n</s-loading-state>\n\n<p-dialog\n [(visible)]=\"isVisible\"\n [modal]=\"true\"\n [style]=\"{ width: '50vw' }\"\n [draggable]=\"false\"\n [resizable]=\"false\"\n (onHide)=\"onHideDialog()\">\n <p-header>\n <div class=\"dialog-header\">\n <span class=\"iassist-icon\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </span>\n IAssist - Content Generator\n </div>\n </p-header>\n <s-dynamic-form\n [fields]=\"fields\"\n [form]=\"formGroup\">\n </s-dynamic-form>\n <p-footer>\n <div class=\"footer-content\">\n <s-button\n id=\"-submit-button\"\n type=\"button\"\n [label]=\"'platform.angular_components.generate_text' | translate\"\n (onClick)=\"submitContext()\"\n sTooltip=\"(ALT + SHIFT + S)\"\n showDelay=\"500\">\n </s-button>\n <s-button\n id=\"-cancel-button\"\n type=\"button\"\n priority=\"link\"\n [label]=\"'platform.angular_components.cancel' | translate\"\n (onClick)=\"hideDialog()\"\n sTooltip=\"(ALT + SHIFT + C)\"\n showDelay=\"500\">\n </s-button>\n </div>\n </p-footer>\n</p-dialog>\n\n<div class=\"textarea-ia\">\n <s-textarea\n [inputId]=\"id\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n [readOnly]=\"readonly\"\n [placeholder]=\"placeholder\"\n [speechRecognition]=\"speechRecognition\"\n ></s-textarea>\n <button\n class=\"iassist-button\"\n [class.speech-recognition]=\"speechRecognition && speechRecognitionService.hasSupportSpeechRecognition\"\n (click)=\"showDialog()\"\n sTooltip=\"IAssist - Content Generator\">\n <ng-container [ngTemplateOutlet]=\"iassistIcon\"></ng-container>\n </button>\n</div>\n\n<ng-template #iassistIcon>\n <svg style=\"width: 100%; height: 100%;\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.81451 18.1054L5.99593 17.6059L7.52166 13.4099L7.60877 13.1726L7.61277 13.1614L7.94285 12.2543L8.01159 12.0648L8.05394 11.949L5.2998 8.52426L5.02726 8.18379C5.00569 8.15821 4.9881 8.13104 4.97292 8.10226C4.90099 7.9632 4.85063 7.81294 4.82186 7.6531C4.73075 7.1344 4.90418 6.60771 5.28382 6.24326C5.29421 6.23447 5.3038 6.22567 5.31419 6.21688L5.47164 6.0914L9.3439 3.00238L9.5469 2.84094L9.57088 2.82096L10.4101 2.15041L11.8007 1.04188C11.2181 0.925188 10.6163 0.863647 10.0001 0.863647C4.95374 0.863647 0.863281 4.9541 0.863281 9.99963C0.863281 13.5346 2.87254 16.5989 5.80971 18.1182\" fill=\"#0FA389\"/>\n <path d=\"M14.099 1.83472L13.9495 2.24632L11.997 7.61074L11.9427 7.7594L11.9003 7.87369L14.7448 11.4103C14.7463 11.4127 14.7479 11.4143 14.7495 11.4167L14.9414 11.654C14.9541 11.67 14.9661 11.6868 14.9765 11.7044C15.0764 11.8698 15.1444 12.0505 15.1779 12.2431C15.273 12.7826 15.0812 13.3284 14.676 13.6897C14.656 13.7129 14.6345 13.7344 14.6105 13.7536L11.8563 15.9507L11.6789 16.0922L11.6022 16.1537L10.7406 16.8402V16.841L10.3937 17.1176L9.85747 17.5452L9.39951 17.9112L8.11035 18.9398C8.72016 19.0677 9.35155 19.1364 9.99973 19.1364C15.0461 19.1364 19.1365 15.046 19.1365 9.99964C19.1365 6.42789 17.0857 3.33727 14.099 1.83472Z\" fill=\"#0FA389\"/>\n <path d=\"M14.7287 12.3222C14.7047 12.1832 14.6551 12.0545 14.5864 11.941L14.3954 11.7036C14.3954 11.7036 14.3946 11.7028 14.3938 11.7028L11.3839 7.96005L10.5031 6.86511L10.4256 6.7676L9.03255 5.03487L8.83674 4.79191C8.79278 4.71678 8.75681 4.63446 8.73204 4.54814C8.72085 4.51058 8.71286 4.47222 8.70566 4.43465C8.68568 4.32196 8.68408 4.21007 8.69847 4.10217L8.62334 4.16291L8.44511 4.30438L5.75731 6.44871L5.60066 6.57339C5.34011 6.82275 5.20584 7.19279 5.27218 7.57482C5.29296 7.68751 5.32892 7.79541 5.37927 7.89292C5.37927 7.89292 5.37927 7.89292 5.38007 7.89371L5.6566 8.23818L8.57139 11.8627L8.63293 11.9394L9.53047 13.0559L9.59041 13.1303L9.98363 13.6186L11.0178 14.9046C11.0186 14.9054 11.0194 14.9069 11.0202 14.9077L11.1361 15.0516V15.0524C11.2184 15.1755 11.2768 15.317 11.3048 15.4728C11.3239 15.5807 11.3263 15.6878 11.3143 15.7925L11.3175 15.7965L11.3943 15.735L11.5717 15.5935L14.3266 13.3964L14.3218 13.3908C14.6335 13.1438 14.8022 12.7394 14.7287 12.3222Z\" fill=\"#F3F3F5\"/>\n <path d=\"M10.6822 15.0082C10.6814 15.0074 10.6806 15.0058 10.6806 15.005L10.5672 14.8643L10.3809 14.6325L10.3282 14.567L10.2211 14.4335L9.40028 13.4129L9.32835 13.3242L8.77289 12.6345L8.68098 12.5194L8.44121 12.2205L8.37168 12.4099L8.04159 13.317L8.0376 13.329L7.95128 13.5664L6.42475 17.7623L6.24333 18.2618L5.90605 19.1881L5.73262 19.6645C5.73182 19.6661 5.73102 19.6677 5.73102 19.6685C5.72863 19.6749 5.72703 19.6821 5.72543 19.6885C5.71584 19.7228 5.71424 19.758 5.72063 19.7948C5.74461 19.929 5.87329 20.0193 6.00836 19.9962C6.04112 19.9898 6.07229 19.9778 6.09867 19.9602C6.09867 19.9602 6.09947 19.9602 6.10027 19.9594L6.14103 19.9266L7.39422 18.9268L9.11496 17.5537L9.57292 17.1877L10.1092 16.7601L10.4561 16.4827L10.4537 16.4811C10.7582 16.2382 10.9236 15.8402 10.8509 15.4294C10.8237 15.2735 10.7654 15.1313 10.6822 15.0082Z\" fill=\"#0C847B\"/>\n <path d=\"M9.17644 4.56325C9.2124 4.68713 9.26915 4.80062 9.34268 4.90053C9.34348 4.90053 9.34428 4.90213 9.34428 4.90213L9.40342 4.97645C9.40502 4.97805 9.40582 4.97885 9.40662 4.98045L9.56806 5.17946L9.64878 5.28096L9.67915 5.31932L9.8414 5.51993L10.5559 6.40947L10.7054 6.59569L11.2169 7.23188L11.5142 7.60192L11.5693 7.45247L13.5202 2.08964L14.1596 0.332135C14.1596 0.330536 14.1604 0.328139 14.1612 0.32654C14.174 0.288177 14.1772 0.246617 14.17 0.205058C14.1468 0.0699879 14.0182 -0.0195258 13.8823 0.00365186C13.8407 0.0116442 13.8024 0.028428 13.7712 0.0540033L12.578 1.00589L12.498 1.06982L10.6958 2.50844L9.85658 3.17819L9.8326 3.19737L9.6296 3.35961L9.45297 3.50028C9.2116 3.73925 9.08692 4.08931 9.15006 4.44976C9.15726 4.48813 9.16525 4.52649 9.17644 4.56325Z\" fill=\"#0C847B\"/>\n </svg>\n</ng-template>\n",
16600
16692
  providers: [
16601
16693
  {
16602
16694
  provide: NG_VALUE_ACCESSOR,
@@ -16604,7 +16696,7 @@ TextAreaIAComponent = TextAreaIAComponent_1 = __decorate([
16604
16696
  multi: true,
16605
16697
  },
16606
16698
  ],
16607
- styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.textarea-ia .textarea-input{resize:vertical;width:100%}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}"]
16699
+ styles: [".footer-content{display:-ms-flexbox;display:flex;-ms-flex-positive:0;flex-grow:0}.textarea-ia{display:-ms-flexbox;display:flex;-ms-flex-align:end;align-items:flex-end;gap:8px}.textarea-ia s-textarea{width:100%}.iassist-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;border:none;border-radius:50%;box-shadow:none;cursor:pointer;height:32px;width:32px}.dialog-header{display:-ms-flexbox;display:flex;gap:12px}.dialog-header .iassist-icon{display:block;height:24px;width:24px}.speech-recognition{margin-bottom:12.5px}"]
16608
16700
  })
16609
16701
  ], TextAreaIAComponent);
16610
16702
 
@@ -16618,10 +16710,10 @@ TextAreaIAModule = __decorate([
16618
16710
  ReactiveFormsModule,
16619
16711
  TranslateModule,
16620
16712
  DialogModule,
16621
- InputTextareaModule,
16622
16713
  ButtonModule,
16623
16714
  DynamicFormModule,
16624
16715
  LoadingStateModule,
16716
+ TextAreaModule
16625
16717
  ],
16626
16718
  declarations: [TextAreaIAComponent],
16627
16719
  exports: [TextAreaIAComponent],
@@ -21453,9 +21545,9 @@ const fallback = {
21453
21545
  "platform.angular_components.remove_all": "Remover todos",
21454
21546
  "platform.angular_components.country_name_gb": "Reino Unido",
21455
21547
  "platform.angular_components.insight_footer": "Conteúdo gerado por inteligência artificial. Sujeito a imprecisões.",
21456
- "platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo, com pelo menos, uma frase",
21457
- "platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos Ícones",
21458
- "platform.angular_components.text_area_while_speech": "Clique novamente no Ícone para finalizar",
21548
+ "platform.angular_components.text_area_speech_recognition_placeholder": "Preencha o campo com, pelo menos, uma frase",
21549
+ "platform.angular_components.text_area_before_speech": "Grave ou ouça o texto clicando nos ícones",
21550
+ "platform.angular_components.text_area_while_speech": "Clique novamente no ícone para finalizar",
21459
21551
  "platform.angular_components.text_area_end_speech": "Gravação finalizada"
21460
21552
  };
21461
21553