asap-viewer 12.6.21 → 12.6.22

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 (28) hide show
  1. package/asap-viewer.d.ts +0 -1
  2. package/asap-viewer.metadata.json +1 -1
  3. package/bundles/asap-viewer.umd.js +1532 -1844
  4. package/bundles/asap-viewer.umd.js.map +1 -1
  5. package/bundles/asap-viewer.umd.min.js +1 -1
  6. package/bundles/asap-viewer.umd.min.js.map +1 -1
  7. package/esm2015/asap-viewer.js +1 -2
  8. package/esm2015/lib/@core/services/offline-storage.service.js +1 -1
  9. package/esm2015/lib/asap-viewer.module.js +1 -10
  10. package/esm2015/lib/editor/components/video/video.component.js +1 -9
  11. package/esm2015/lib/visualizador/curso-visualizador/curso-visualizador.component.js +13 -93
  12. package/esm2015/lib/visualizador/curso-visualizador/viewer/viewer.component.js +26 -81
  13. package/esm5/asap-viewer.js +1 -2
  14. package/esm5/lib/@core/services/offline-storage.service.js +1 -1
  15. package/esm5/lib/asap-viewer.module.js +1 -10
  16. package/esm5/lib/editor/components/video/video.component.js +1 -9
  17. package/esm5/lib/visualizador/curso-visualizador/curso-visualizador.component.js +13 -108
  18. package/esm5/lib/visualizador/curso-visualizador/viewer/viewer.component.js +41 -119
  19. package/fesm2015/asap-viewer.js +1373 -1635
  20. package/fesm2015/asap-viewer.js.map +1 -1
  21. package/fesm5/asap-viewer.js +1534 -1845
  22. package/fesm5/asap-viewer.js.map +1 -1
  23. package/lib/visualizador/curso-visualizador/curso-visualizador.component.d.ts +0 -1
  24. package/lib/visualizador/curso-visualizador/viewer/viewer.component.d.ts +1 -1
  25. package/package.json +1 -1
  26. package/esm2015/lib/@core/interceptors/offline.interceptor.js +0 -119
  27. package/esm5/lib/@core/interceptors/offline.interceptor.js +0 -130
  28. package/lib/@core/interceptors/offline.interceptor.d.ts +0 -9
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('@angular/common'), require('@angular/router'), require('@angular/forms'), require('asap-crud'), require('@angular/animations'), require('@angular/platform-browser'), require('@ngx-translate/core'), require('rxjs'), require('rxjs/operators'), require('ngx-color-picker'), require('@angular/material/select'), require('@angular/material/input'), require('@angular/material/stepper'), require('@angular/material/radio'), require('@angular/material/tooltip'), require('@angular/material/slider'), require('ngx-moment'), require('sweetalert2'), require('moment'), require('asap-upload'), require('asap-image-pipe'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/button-toggle'), require('@angular/material/card'), require('@angular/material/checkbox'), require('@angular/material/chips'), require('@angular/material/core'), require('@angular/material/datepicker'), require('@angular/material/dialog'), require('@angular/material/expansion'), require('@angular/material/form-field'), require('@angular/material/grid-list'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/menu'), require('@angular/material/paginator'), require('@angular/material/progress-bar'), require('@angular/material/progress-spinner'), require('@angular/material/sidenav'), require('@angular/material/slide-toggle'), require('@angular/material/snack-bar'), require('@angular/material/sort'), require('@angular/material/table'), require('@angular/material/tabs'), require('@angular/material/toolbar'), require('asap-skeleton'), require('ngx-skeleton-loader'), require('ngx-owl-carousel-o'), require('safe-pipe'), require('@angular/material-moment-adapter'), require('@angular/common/locales/pt'), require('asap-limit-to'), require('asap-global-comments')) :
3
- typeof define === 'function' && define.amd ? define('asap-viewer', ['exports', '@angular/core', '@angular/common/http', '@angular/common', '@angular/router', '@angular/forms', 'asap-crud', '@angular/animations', '@angular/platform-browser', '@ngx-translate/core', 'rxjs', 'rxjs/operators', 'ngx-color-picker', '@angular/material/select', '@angular/material/input', '@angular/material/stepper', '@angular/material/radio', '@angular/material/tooltip', '@angular/material/slider', 'ngx-moment', 'sweetalert2', 'moment', 'asap-upload', 'asap-image-pipe', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/button-toggle', '@angular/material/card', '@angular/material/checkbox', '@angular/material/chips', '@angular/material/core', '@angular/material/datepicker', '@angular/material/dialog', '@angular/material/expansion', '@angular/material/form-field', '@angular/material/grid-list', '@angular/material/icon', '@angular/material/list', '@angular/material/menu', '@angular/material/paginator', '@angular/material/progress-bar', '@angular/material/progress-spinner', '@angular/material/sidenav', '@angular/material/slide-toggle', '@angular/material/snack-bar', '@angular/material/sort', '@angular/material/table', '@angular/material/tabs', '@angular/material/toolbar', 'asap-skeleton', 'ngx-skeleton-loader', 'ngx-owl-carousel-o', 'safe-pipe', '@angular/material-moment-adapter', '@angular/common/locales/pt', 'asap-limit-to', 'asap-global-comments'], factory) :
4
- (global = global || self, factory(global['asap-viewer'] = {}, global.ng.core, global.ng.common.http, global.ng.common, global.ng.router, global.ng.forms, global.asapCrud, global.ng.animations, global.ng.platformBrowser, global.core$1, global.rxjs, global.rxjs.operators, global.ngxColorPicker, global.ng.material.select, global.ng.material.input, global.ng.material.stepper, global.ng.material.radio, global.ng.material.tooltip, global.ng.material.slider, global.ngxMoment, global.Swal, global.moment$1, global.asapUpload, global.asapImagePipe, global.ng.material.autocomplete, global.ng.material.button, global.ng.material['button-toggle'], global.ng.material.card, global.ng.material.checkbox, global.ng.material.chips, global.ng.material.core, global.ng.material.datepicker, global.ng.material.dialog, global.ng.material.expansion, global.ng.material['form-field'], global.ng.material['grid-list'], global.ng.material.icon, global.ng.material.list, global.ng.material.menu, global.ng.material.paginator, global.ng.material['progress-bar'], global.ng.material['progress-spinner'], global.ng.material.sidenav, global.ng.material['slide-toggle'], global.ng.material['snack-bar'], global.ng.material.sort, global.ng.material.table, global.ng.material.tabs, global.ng.material.toolbar, global.asapSkeleton, global.ngxSkeletonLoader, global.ngxOwlCarouselO, global.safePipe, global.ng['material-moment-adapter'], global.ng.common.locales.pt, global.asapLimitTo, global.asapGlobalComments));
5
- }(this, (function (exports, core, http, common, router, forms, asapCrud, animations, platformBrowser, core$1, rxjs, operators, ngxColorPicker, select, input, stepper, radio, tooltip, slider, ngxMoment, Swal, moment$1, asapUpload, asapImagePipe, autocomplete, button, buttonToggle, card, checkbox, chips, core$2, datepicker, dialog, expansion, formField, gridList, icon, list, menu, paginator, progressBar, progressSpinner, sidenav, slideToggle, snackBar, sort, table, tabs, toolbar, asapSkeleton, ngxSkeletonLoader, ngxOwlCarouselO, safePipe, materialMomentAdapter, localePt, asapLimitTo, asapGlobalComments) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/router'), require('@angular/forms'), require('asap-crud'), require('@angular/common/http'), require('@angular/animations'), require('@angular/platform-browser'), require('@ngx-translate/core'), require('ngx-color-picker'), require('@angular/material/select'), require('@angular/material/input'), require('@angular/material/stepper'), require('@angular/material/radio'), require('@angular/material/tooltip'), require('@angular/material/slider'), require('ngx-moment'), require('rxjs'), require('rxjs/operators'), require('sweetalert2'), require('moment'), require('asap-upload'), require('asap-image-pipe'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/button-toggle'), require('@angular/material/card'), require('@angular/material/checkbox'), require('@angular/material/chips'), require('@angular/material/core'), require('@angular/material/datepicker'), require('@angular/material/dialog'), require('@angular/material/expansion'), require('@angular/material/form-field'), require('@angular/material/grid-list'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/menu'), require('@angular/material/paginator'), require('@angular/material/progress-bar'), require('@angular/material/progress-spinner'), require('@angular/material/sidenav'), require('@angular/material/slide-toggle'), require('@angular/material/snack-bar'), require('@angular/material/sort'), require('@angular/material/table'), require('@angular/material/tabs'), require('@angular/material/toolbar'), require('asap-skeleton'), require('ngx-skeleton-loader'), require('ngx-owl-carousel-o'), require('safe-pipe'), require('@angular/material-moment-adapter'), require('@angular/common/locales/pt'), require('asap-limit-to'), require('asap-global-comments')) :
3
+ typeof define === 'function' && define.amd ? define('asap-viewer', ['exports', '@angular/core', '@angular/common', '@angular/router', '@angular/forms', 'asap-crud', '@angular/common/http', '@angular/animations', '@angular/platform-browser', '@ngx-translate/core', 'ngx-color-picker', '@angular/material/select', '@angular/material/input', '@angular/material/stepper', '@angular/material/radio', '@angular/material/tooltip', '@angular/material/slider', 'ngx-moment', 'rxjs', 'rxjs/operators', 'sweetalert2', 'moment', 'asap-upload', 'asap-image-pipe', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/button-toggle', '@angular/material/card', '@angular/material/checkbox', '@angular/material/chips', '@angular/material/core', '@angular/material/datepicker', '@angular/material/dialog', '@angular/material/expansion', '@angular/material/form-field', '@angular/material/grid-list', '@angular/material/icon', '@angular/material/list', '@angular/material/menu', '@angular/material/paginator', '@angular/material/progress-bar', '@angular/material/progress-spinner', '@angular/material/sidenav', '@angular/material/slide-toggle', '@angular/material/snack-bar', '@angular/material/sort', '@angular/material/table', '@angular/material/tabs', '@angular/material/toolbar', 'asap-skeleton', 'ngx-skeleton-loader', 'ngx-owl-carousel-o', 'safe-pipe', '@angular/material-moment-adapter', '@angular/common/locales/pt', 'asap-limit-to', 'asap-global-comments'], factory) :
4
+ (global = global || self, factory(global['asap-viewer'] = {}, global.ng.core, global.ng.common, global.ng.router, global.ng.forms, global.asapCrud, global.ng.common.http, global.ng.animations, global.ng.platformBrowser, global.core$1, global.ngxColorPicker, global.ng.material.select, global.ng.material.input, global.ng.material.stepper, global.ng.material.radio, global.ng.material.tooltip, global.ng.material.slider, global.ngxMoment, global.rxjs, global.rxjs.operators, global.Swal, global.moment$1, global.asapUpload, global.asapImagePipe, global.ng.material.autocomplete, global.ng.material.button, global.ng.material['button-toggle'], global.ng.material.card, global.ng.material.checkbox, global.ng.material.chips, global.ng.material.core, global.ng.material.datepicker, global.ng.material.dialog, global.ng.material.expansion, global.ng.material['form-field'], global.ng.material['grid-list'], global.ng.material.icon, global.ng.material.list, global.ng.material.menu, global.ng.material.paginator, global.ng.material['progress-bar'], global.ng.material['progress-spinner'], global.ng.material.sidenav, global.ng.material['slide-toggle'], global.ng.material['snack-bar'], global.ng.material.sort, global.ng.material.table, global.ng.material.tabs, global.ng.material.toolbar, global.asapSkeleton, global.ngxSkeletonLoader, global.ngxOwlCarouselO, global.safePipe, global.ng['material-moment-adapter'], global.ng.common.locales.pt, global.asapLimitTo, global.asapGlobalComments));
5
+ }(this, (function (exports, core, common, router, forms, asapCrud, http, animations, platformBrowser, core$1, ngxColorPicker, select, input, stepper, radio, tooltip, slider, ngxMoment, rxjs, operators, Swal, moment$1, asapUpload, asapImagePipe, autocomplete, button, buttonToggle, card, checkbox, chips, core$2, datepicker, dialog, expansion, formField, gridList, icon, list, menu, paginator, progressBar, progressSpinner, sidenav, slideToggle, snackBar, sort, table, tabs, toolbar, asapSkeleton, ngxSkeletonLoader, ngxOwlCarouselO, safePipe, materialMomentAdapter, localePt, asapLimitTo, asapGlobalComments) { 'use strict';
6
6
 
7
7
  Swal = Swal && Swal.hasOwnProperty('default') ? Swal['default'] : Swal;
8
8
  localePt = localePt && localePt.hasOwnProperty('default') ? localePt['default'] : localePt;
@@ -3202,1914 +3202,1790 @@
3202
3202
 
3203
3203
  /**
3204
3204
  * @fileoverview added by tsickle
3205
- * Generated from: lib/\@core/services/offline-storage.service.ts
3205
+ * Generated from: lib/shared/file-manager/models/file-manager.model.ts
3206
3206
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3207
3207
  */
3208
- /**
3209
- * @record
3210
- */
3211
- function DownloadedLesson() { }
3208
+ var FileManagerModel = /** @class */ (function () {
3209
+ function FileManagerModel(http, global) {
3210
+ this.http = http;
3211
+ this.global = global;
3212
+ this.apiBaseUrl = this.global.apiURL();
3213
+ }
3214
+ /**
3215
+ * @param {?} data
3216
+ * @return {?}
3217
+ */
3218
+ FileManagerModel.prototype.populate = /**
3219
+ * @param {?} data
3220
+ * @return {?}
3221
+ */
3222
+ function (data) {
3223
+ return undefined;
3224
+ };
3225
+ /**
3226
+ * @param {?} data
3227
+ * @return {?}
3228
+ */
3229
+ FileManagerModel.prototype.uploadFile = /**
3230
+ * @param {?} data
3231
+ * @return {?}
3232
+ */
3233
+ function (data) {
3234
+ /** @type {?} */
3235
+ var formData = new FormData();
3236
+ formData.append('file', data.file);
3237
+ formData.append('name', data.name);
3238
+ formData.append('description', data.description);
3239
+ /** @type {?} */
3240
+ var headerOptions = {
3241
+ 'Authorization': localStorage.getItem('token'),
3242
+ 'Accept': 'application/json'
3243
+ };
3244
+ /** @type {?} */
3245
+ var req = new http.HttpRequest('POST', this.apiBaseUrl + '/api/v2/admin/file', formData, {
3246
+ reportProgress: true,
3247
+ responseType: 'json',
3248
+ headers: new http.HttpHeaders(headerOptions)
3249
+ });
3250
+ return this.http.request(req);
3251
+ // return this.http.post(this.apiBaseUrl + '/api/v2/admin/file', data, {headers: new HttpHeaders(headerOptions)});
3252
+ };
3253
+ /**
3254
+ * @return {?}
3255
+ */
3256
+ FileManagerModel.prototype.getAll = /**
3257
+ * @return {?}
3258
+ */
3259
+ function () {
3260
+ return this.http.get(this.apiBaseUrl + '/api/v2/admin/file/all', { headers: this.getHeader() });
3261
+ };
3262
+ /**
3263
+ * @param {?} id
3264
+ * @return {?}
3265
+ */
3266
+ FileManagerModel.prototype.deleteFile = /**
3267
+ * @param {?} id
3268
+ * @return {?}
3269
+ */
3270
+ function (id) {
3271
+ return this.http.delete(this.apiBaseUrl + '/api/v2/admin/file/' + id, { headers: this.getHeader() });
3272
+ };
3273
+ /**
3274
+ * @return {?}
3275
+ */
3276
+ FileManagerModel.prototype.changeFile = /**
3277
+ * @return {?}
3278
+ */
3279
+ function () {
3280
+ return undefined;
3281
+ };
3282
+ /**
3283
+ * @return {?}
3284
+ */
3285
+ FileManagerModel.prototype.getHeader = /**
3286
+ * @return {?}
3287
+ */
3288
+ function () {
3289
+ /** @type {?} */
3290
+ var token = localStorage.getItem('token');
3291
+ if (token) {
3292
+ /** @type {?} */
3293
+ var headerOptions = {
3294
+ 'Authorization': token,
3295
+ 'Content-Type': 'application/x-www-form-urlencoded',
3296
+ 'Accept': 'application/json'
3297
+ };
3298
+ return new http.HttpHeaders(headerOptions);
3299
+ }
3300
+ };
3301
+ FileManagerModel.decorators = [
3302
+ { type: core.Injectable }
3303
+ ];
3304
+ /** @nocollapse */
3305
+ FileManagerModel.ctorParameters = function () { return [
3306
+ { type: http.HttpClient },
3307
+ { type: asapCrud.Global }
3308
+ ]; };
3309
+ return FileManagerModel;
3310
+ }());
3212
3311
  if (false) {
3213
3312
  /** @type {?} */
3214
- DownloadedLesson.prototype.id;
3215
- /** @type {?} */
3216
- DownloadedLesson.prototype.trailId;
3217
- /** @type {?} */
3218
- DownloadedLesson.prototype.title;
3219
- /** @type {?|undefined} */
3220
- DownloadedLesson.prototype.subtitle;
3221
- /** @type {?|undefined} */
3222
- DownloadedLesson.prototype.thumbnail;
3223
- /** @type {?} */
3224
- DownloadedLesson.prototype.sizeBytes;
3225
- /** @type {?} */
3226
- DownloadedLesson.prototype.sizeFormatted;
3227
- /** @type {?} */
3228
- DownloadedLesson.prototype.downloadedAt;
3229
- /** @type {?} */
3230
- DownloadedLesson.prototype.stageData;
3231
- /** @type {?} */
3232
- DownloadedLesson.prototype.stages;
3233
- /** @type {?|undefined} */
3234
- DownloadedLesson.prototype.videoBlob;
3235
- /** @type {?|undefined} */
3236
- DownloadedLesson.prototype.videoMimeType;
3237
- }
3238
- /**
3239
- * @record
3240
- */
3241
- function SyncAction() { }
3242
- if (false) {
3243
- /** @type {?|undefined} */
3244
- SyncAction.prototype.id;
3313
+ FileManagerModel.prototype.file;
3245
3314
  /** @type {?} */
3246
- SyncAction.prototype.type;
3315
+ FileManagerModel.prototype.name;
3247
3316
  /** @type {?} */
3248
- SyncAction.prototype.endpoint;
3317
+ FileManagerModel.prototype.description;
3249
3318
  /** @type {?} */
3250
- SyncAction.prototype.payload;
3319
+ FileManagerModel.prototype.apiBaseUrl;
3320
+ /**
3321
+ * @type {?}
3322
+ * @private
3323
+ */
3324
+ FileManagerModel.prototype.http;
3251
3325
  /** @type {?} */
3252
- SyncAction.prototype.createdAt;
3253
- }
3326
+ FileManagerModel.prototype.global;
3327
+ }
3328
+
3254
3329
  /**
3255
- * @record
3330
+ * @fileoverview added by tsickle
3331
+ * Generated from: lib/shared/file-manager/services/file-manager.service.ts
3332
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3256
3333
  */
3257
- function DownloadProgress() { }
3258
- if (false) {
3259
- /** @type {?} */
3260
- DownloadProgress.prototype.stageId;
3261
- /** @type {?} */
3262
- DownloadProgress.prototype.progress;
3263
- /** @type {?} */
3264
- DownloadProgress.prototype.loaded;
3265
- /** @type {?} */
3266
- DownloadProgress.prototype.total;
3267
- /** @type {?} */
3268
- DownloadProgress.prototype.status;
3269
- }
3270
- var OfflineStorageService = /** @class */ (function () {
3271
- function OfflineStorageService() {
3272
- var _this = this;
3273
- this.DB_NAME = 'AsapOfflineCoursesDB';
3274
- this.DB_VERSION = 1;
3275
- this.STORE_LESSONS = 'lessons';
3276
- this.STORE_SYNC_QUEUE = 'sync_queue';
3277
- this.db = null;
3278
- this.isOnlineSubject = new rxjs.BehaviorSubject(navigator.onLine);
3279
- this.isOnline$ = this.isOnlineSubject.asObservable();
3280
- this.downloadProgress$ = new rxjs.BehaviorSubject({});
3281
- this.downloadedLessons$ = new rxjs.BehaviorSubject([]);
3282
- this.initNetworkListeners();
3283
- this.initDatabase().then((/**
3284
- * @return {?}
3285
- */
3286
- function () {
3287
- _this.refreshDownloadedLessons();
3288
- if (navigator.onLine) {
3289
- _this.processSyncQueue();
3290
- }
3291
- }));
3334
+ var FileManagerService = /** @class */ (function () {
3335
+ function FileManagerService(fileManagerModel, httpClient, global) {
3336
+ this.fileManagerModel = fileManagerModel;
3337
+ this.httpClient = httpClient;
3338
+ this.global = global;
3292
3339
  }
3293
3340
  /**
3294
- * @private
3341
+ * @param {?} data
3295
3342
  * @return {?}
3296
3343
  */
3297
- OfflineStorageService.prototype.initNetworkListeners = /**
3298
- * @private
3344
+ FileManagerService.prototype.uploadFile = /**
3345
+ * @param {?} data
3299
3346
  * @return {?}
3300
3347
  */
3301
- function () {
3302
- var _this = this;
3303
- rxjs.merge(rxjs.of(navigator.onLine), rxjs.fromEvent(window, 'online').pipe(operators.map((/**
3304
- * @return {?}
3305
- */
3306
- function () { return true; }))), rxjs.fromEvent(window, 'offline').pipe(operators.map((/**
3307
- * @return {?}
3308
- */
3309
- function () { return false; })))).subscribe((/**
3310
- * @param {?} online
3311
- * @return {?}
3312
- */
3313
- function (online) {
3314
- _this.isOnlineSubject.next(online);
3315
- if (online) {
3316
- console.log('[OfflineStorageService] Conexão restabelecida! Processando fila de sincronização...');
3317
- _this.processSyncQueue();
3318
- }
3319
- else {
3320
- console.warn('[OfflineStorageService] Aplicação operando em MODO OFFLINE.');
3321
- }
3322
- }));
3348
+ function (data) {
3349
+ return this.fileManagerModel.uploadFile(this.serialize(data));
3323
3350
  };
3324
3351
  /**
3325
- * @private
3352
+ * @param {?} id
3326
3353
  * @return {?}
3327
3354
  */
3328
- OfflineStorageService.prototype.initDatabase = /**
3329
- * @private
3355
+ FileManagerService.prototype.removeFile = /**
3356
+ * @param {?} id
3357
+ * @return {?}
3358
+ */
3359
+ function (id) {
3360
+ if (id) {
3361
+ return this.fileManagerModel.deleteFile(id);
3362
+ }
3363
+ else {
3364
+ return null;
3365
+ }
3366
+ };
3367
+ /**
3368
+ * @return {?}
3369
+ */
3370
+ FileManagerService.prototype.findFileCollection = /**
3330
3371
  * @return {?}
3331
3372
  */
3332
3373
  function () {
3333
- var _this = this;
3334
- return new Promise((/**
3335
- * @param {?} resolve
3336
- * @param {?} reject
3337
- * @return {?}
3338
- */
3339
- function (resolve, reject) {
3340
- if (_this.db) {
3341
- return resolve(_this.db);
3342
- }
3343
- if (!('indexedDB' in window)) {
3344
- console.error('[OfflineStorageService] IndexedDB não é suportado neste navegador.');
3345
- return reject(new Error('IndexedDB não suportado'));
3346
- }
3347
- /** @type {?} */
3348
- var request = indexedDB.open(_this.DB_NAME, _this.DB_VERSION);
3349
- request.onupgradeneeded = (/**
3350
- * @param {?} event
3351
- * @return {?}
3352
- */
3353
- function (event) {
3354
- /** @type {?} */
3355
- var db = (/** @type {?} */ (event.target.result));
3356
- if (!db.objectStoreNames.contains(_this.STORE_LESSONS)) {
3357
- /** @type {?} */
3358
- var lessonStore = db.createObjectStore(_this.STORE_LESSONS, { keyPath: 'id' });
3359
- lessonStore.createIndex('trailId', 'trailId', { unique: false });
3360
- lessonStore.createIndex('downloadedAt', 'downloadedAt', { unique: false });
3361
- }
3362
- if (!db.objectStoreNames.contains(_this.STORE_SYNC_QUEUE)) {
3363
- /** @type {?} */
3364
- var syncStore = db.createObjectStore(_this.STORE_SYNC_QUEUE, { keyPath: 'id', autoIncrement: true });
3365
- syncStore.createIndex('createdAt', 'createdAt', { unique: false });
3366
- }
3367
- });
3368
- request.onsuccess = (/**
3369
- * @param {?} event
3370
- * @return {?}
3371
- */
3372
- function (event) {
3373
- _this.db = (/** @type {?} */ (event.target.result));
3374
- if (navigator.storage && navigator.storage.persist) {
3375
- navigator.storage.persist().then((/**
3376
- * @param {?} persistent
3377
- * @return {?}
3378
- */
3379
- function (persistent) {
3380
- console.log("[OfflineStorageService] Armazenamento persistente: " + (persistent ? 'Ativado' : 'Padrão'));
3381
- }));
3382
- }
3383
- resolve(_this.db);
3384
- });
3385
- request.onerror = (/**
3386
- * @param {?} event
3387
- * @return {?}
3388
- */
3389
- function (event) {
3390
- console.error('[OfflineStorageService] Erro ao abrir IndexedDB:', event.target.error);
3391
- reject(event.target.error);
3392
- });
3393
- }));
3374
+ return this.fileManagerModel.getAll();
3394
3375
  };
3395
3376
  /**
3396
- * @param {?} lessonData
3377
+ * @param {?} data
3397
3378
  * @return {?}
3398
3379
  */
3399
- OfflineStorageService.prototype.downloadLesson = /**
3400
- * @param {?} lessonData
3380
+ FileManagerService.prototype.serialize = /**
3381
+ * @param {?} data
3401
3382
  * @return {?}
3402
3383
  */
3403
- function (lessonData) {
3404
- return __awaiter(this, void 0, void 0, function () {
3405
- var db, stageId, videoBlob, sizeBytes, targetVideoUrl, err_1, e2_1, downloadedItem;
3406
- var _this = this;
3407
- return __generator(this, function (_a) {
3408
- switch (_a.label) {
3409
- case 0: return [4 /*yield*/, this.initDatabase()];
3410
- case 1:
3411
- db = _a.sent();
3412
- stageId = String(lessonData.id);
3413
- this.updateProgress(stageId, 0, 0, 100, 'downloading');
3414
- sizeBytes = JSON.stringify(lessonData.stageData || {}).length;
3415
- targetVideoUrl = lessonData.videoUrl;
3416
- // Se for Vimeo ou YouTube (onde o navegador não consegue baixar direto pelo frontend sem endpoint backend),
3417
- // utiliza uma URL de vídeo MP4 com CORS aberto garantido (GitHub Raw / MDN) para o teste offline
3418
- if (!targetVideoUrl || targetVideoUrl.includes('youtube.com') || targetVideoUrl.includes('vimeo.com')) {
3419
- targetVideoUrl = 'https://raw.githubusercontent.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4';
3420
- }
3421
- if (!targetVideoUrl) return [3 /*break*/, 9];
3422
- _a.label = 2;
3423
- case 2:
3424
- _a.trys.push([2, 4, , 9]);
3425
- return [4 /*yield*/, this.fetchBlobWithProgress(targetVideoUrl, stageId)];
3426
- case 3:
3427
- videoBlob = _a.sent();
3428
- if (videoBlob) {
3429
- sizeBytes += videoBlob.size;
3430
- console.log("[OfflineStorageService] V\u00EDdeo baixado com sucesso! Tamanho: " + this.formatBytes(videoBlob.size));
3431
- }
3432
- return [3 /*break*/, 9];
3433
- case 4:
3434
- err_1 = _a.sent();
3435
- console.warn('[OfflineStorageService] Tentando URL alternativa para download de teste...', err_1);
3436
- _a.label = 5;
3437
- case 5:
3438
- _a.trys.push([5, 7, , 8]);
3439
- return [4 /*yield*/, this.fetchBlobWithProgress('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4', stageId)];
3440
- case 6:
3441
- videoBlob = _a.sent();
3442
- if (videoBlob) {
3443
- sizeBytes += videoBlob.size;
3444
- }
3445
- return [3 /*break*/, 8];
3446
- case 7:
3447
- e2_1 = _a.sent();
3448
- console.warn('[OfflineStorageService] Falha ao baixar vídeo direto:', e2_1);
3449
- return [3 /*break*/, 8];
3450
- case 8: return [3 /*break*/, 9];
3451
- case 9:
3452
- downloadedItem = {
3453
- id: lessonData.id,
3454
- trailId: lessonData.trailId,
3455
- title: lessonData.title,
3456
- subtitle: lessonData.subtitle || '',
3457
- thumbnail: lessonData.thumbnail || '',
3458
- sizeBytes: sizeBytes,
3459
- sizeFormatted: this.formatBytes(sizeBytes),
3460
- downloadedAt: new Date(),
3461
- stageData: lessonData.stageData,
3462
- stages: lessonData.stages || [],
3463
- videoBlob: videoBlob,
3464
- videoMimeType: videoBlob ? videoBlob.type : 'video/mp4'
3465
- };
3466
- return [2 /*return*/, new Promise((/**
3467
- * @param {?} resolve
3468
- * @param {?} reject
3469
- * @return {?}
3470
- */
3471
- function (resolve, reject) {
3472
- /** @type {?} */
3473
- var transaction = db.transaction([_this.STORE_LESSONS], 'readwrite');
3474
- /** @type {?} */
3475
- var store = transaction.objectStore(_this.STORE_LESSONS);
3476
- /** @type {?} */
3477
- var request = store.put(downloadedItem);
3478
- request.onsuccess = (/**
3479
- * @return {?}
3480
- */
3481
- function () {
3482
- _this.updateProgress(stageId, 100, sizeBytes, sizeBytes, 'completed');
3483
- _this.refreshDownloadedLessons();
3484
- resolve(downloadedItem);
3485
- });
3486
- request.onerror = (/**
3487
- * @param {?} event
3488
- * @return {?}
3489
- */
3490
- function (event) {
3491
- _this.updateProgress(stageId, 0, 0, 0, 'error');
3492
- reject(event.target.error);
3493
- });
3494
- }))];
3495
- }
3496
- });
3497
- });
3384
+ function (data) {
3385
+ /** @type {?} */
3386
+ var fileManager = new FileManagerModel(this.httpClient, this.global);
3387
+ fileManager.name = data.name;
3388
+ fileManager.file = data;
3389
+ fileManager.description = data.type;
3390
+ return fileManager;
3498
3391
  };
3392
+ FileManagerService.decorators = [
3393
+ { type: core.Injectable }
3394
+ ];
3395
+ /** @nocollapse */
3396
+ FileManagerService.ctorParameters = function () { return [
3397
+ { type: FileManagerModel },
3398
+ { type: http.HttpClient },
3399
+ { type: asapCrud.Global }
3400
+ ]; };
3401
+ return FileManagerService;
3402
+ }());
3403
+ if (false) {
3499
3404
  /**
3405
+ * @type {?}
3500
3406
  * @private
3501
- * @param {?} url
3502
- * @param {?} stageId
3503
- * @return {?}
3504
3407
  */
3505
- OfflineStorageService.prototype.fetchBlobWithProgress = /**
3408
+ FileManagerService.prototype.fileManagerModel;
3409
+ /**
3410
+ * @type {?}
3506
3411
  * @private
3507
- * @param {?} url
3508
- * @param {?} stageId
3509
- * @return {?}
3510
3412
  */
3511
- function (url, stageId) {
3512
- var _this = this;
3513
- return new Promise((/**
3514
- * @param {?} resolve
3515
- * @param {?} reject
3516
- * @return {?}
3517
- */
3518
- function (resolve, reject) {
3519
- /** @type {?} */
3520
- var xhr = new XMLHttpRequest();
3521
- xhr.open('GET', url, true);
3522
- xhr.responseType = 'blob';
3523
- xhr.onprogress = (/**
3524
- * @param {?} event
3525
- * @return {?}
3526
- */
3527
- function (event) {
3528
- if (event.lengthComputable) {
3529
- /** @type {?} */
3530
- var progress = Math.round((event.loaded / event.total) * 100);
3531
- _this.updateProgress(stageId, progress, event.loaded, event.total, 'downloading');
3532
- }
3533
- });
3534
- xhr.onload = (/**
3535
- * @return {?}
3536
- */
3537
- function () {
3538
- if (xhr.status >= 200 && xhr.status < 300) {
3539
- resolve(xhr.response);
3540
- }
3541
- else {
3542
- reject(new Error("Falha no download do v\u00EDdeo HTTP status " + xhr.status));
3543
- }
3544
- });
3545
- xhr.onerror = (/**
3546
- * @return {?}
3547
- */
3548
- function () {
3549
- reject(new Error('Erro de rede ou CORS durante o download do vídeo.'));
3550
- });
3551
- xhr.send();
3552
- }));
3553
- };
3413
+ FileManagerService.prototype.httpClient;
3414
+ /** @type {?} */
3415
+ FileManagerService.prototype.global;
3416
+ }
3417
+
3418
+ /**
3419
+ * @fileoverview added by tsickle
3420
+ * Generated from: lib/shared/file-manager/containers/file-manager/file-manager.component.ts
3421
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3422
+ */
3423
+ var FileManagerComponent = /** @class */ (function () {
3424
+ function FileManagerComponent(_fileManagerService, translate) {
3425
+ this._fileManagerService = _fileManagerService;
3426
+ this.translate = translate;
3427
+ this.event = new core.EventEmitter();
3428
+ this.progress = { percentage: 0 };
3429
+ this.loading = false;
3430
+ }
3554
3431
  /**
3555
- * @private
3556
- * @param {?} stageId
3557
- * @param {?} progress
3558
- * @param {?} loaded
3559
- * @param {?} total
3560
- * @param {?} status
3561
3432
  * @return {?}
3562
3433
  */
3563
- OfflineStorageService.prototype.updateProgress = /**
3564
- * @private
3565
- * @param {?} stageId
3566
- * @param {?} progress
3567
- * @param {?} loaded
3568
- * @param {?} total
3569
- * @param {?} status
3434
+ FileManagerComponent.prototype.ngOnInit = /**
3570
3435
  * @return {?}
3571
3436
  */
3572
- function (stageId, progress, loaded, total, status) {
3573
- var _a;
3574
- /** @type {?} */
3575
- var current = this.downloadProgress$.value;
3576
- this.downloadProgress$.next(__assign({}, current, (_a = {}, _a[stageId] = { stageId: stageId, progress: progress, loaded: loaded, total: total, status: status }, _a)));
3437
+ function () {
3438
+ this.findAll();
3577
3439
  };
3578
3440
  /**
3579
- * @param {?} lessonId
3580
3441
  * @return {?}
3581
3442
  */
3582
- OfflineStorageService.prototype.isLessonDownloaded = /**
3583
- * @param {?} lessonId
3443
+ FileManagerComponent.prototype.showModal = /**
3584
3444
  * @return {?}
3585
3445
  */
3586
- function (lessonId) {
3587
- return __awaiter(this, void 0, void 0, function () {
3588
- var lesson, _a;
3589
- return __generator(this, function (_b) {
3590
- switch (_b.label) {
3591
- case 0:
3592
- _b.trys.push([0, 2, , 3]);
3593
- return [4 /*yield*/, this.getDownloadedLesson(lessonId)];
3594
- case 1:
3595
- lesson = _b.sent();
3596
- return [2 /*return*/, !!lesson];
3597
- case 2:
3598
- _a = _b.sent();
3599
- return [2 /*return*/, false];
3600
- case 3: return [2 /*return*/];
3601
- }
3602
- });
3603
- });
3446
+ function () {
3447
+ $('#appFileManager').modal('show');
3604
3448
  };
3605
3449
  /**
3606
- * @param {?} lessonId
3607
3450
  * @return {?}
3608
3451
  */
3609
- OfflineStorageService.prototype.getDownloadedLesson = /**
3610
- * @param {?} lessonId
3452
+ FileManagerComponent.prototype.closeModal = /**
3611
3453
  * @return {?}
3612
3454
  */
3613
- function (lessonId) {
3614
- return __awaiter(this, void 0, void 0, function () {
3615
- var db;
3616
- var _this = this;
3617
- return __generator(this, function (_a) {
3618
- switch (_a.label) {
3619
- case 0: return [4 /*yield*/, this.initDatabase()];
3620
- case 1:
3621
- db = _a.sent();
3622
- return [2 /*return*/, new Promise((/**
3623
- * @param {?} resolve
3624
- * @param {?} reject
3625
- * @return {?}
3626
- */
3627
- function (resolve, reject) {
3628
- /** @type {?} */
3629
- var transaction = db.transaction([_this.STORE_LESSONS], 'readonly');
3630
- /** @type {?} */
3631
- var store = transaction.objectStore(_this.STORE_LESSONS);
3632
- /** @type {?} */
3633
- var req1 = store.get(lessonId);
3634
- req1.onsuccess = (/**
3635
- * @return {?}
3636
- */
3637
- function () {
3638
- if (req1.result) {
3639
- return resolve(req1.result);
3640
- }
3641
- // Tenta a variação string/número
3642
- /** @type {?} */
3643
- var altKey = typeof lessonId === 'number' ? String(lessonId) : Number(lessonId);
3644
- if (!isNaN((/** @type {?} */ (altKey)))) {
3645
- /** @type {?} */
3646
- var req2_1 = store.get(altKey);
3647
- req2_1.onsuccess = (/**
3648
- * @return {?}
3649
- */
3650
- function () {
3651
- if (req2_1.result) {
3652
- return resolve(req2_1.result);
3653
- }
3654
- // Fallback: busca por comparação em getAll
3655
- /** @type {?} */
3656
- var reqAll = store.getAll();
3657
- reqAll.onsuccess = (/**
3658
- * @return {?}
3659
- */
3660
- function () {
3661
- /** @type {?} */
3662
- var all = reqAll.result || [];
3663
- /** @type {?} */
3664
- var found = all.find((/**
3665
- * @param {?} item
3666
- * @return {?}
3667
- */
3668
- function (item) { return String(item.id) === String(lessonId); }));
3669
- resolve(found || null);
3670
- });
3671
- reqAll.onerror = (/**
3672
- * @return {?}
3673
- */
3674
- function () { return resolve(null); });
3675
- });
3676
- req2_1.onerror = (/**
3677
- * @return {?}
3678
- */
3679
- function () { return resolve(null); });
3680
- }
3681
- else {
3682
- resolve(null);
3683
- }
3684
- });
3685
- req1.onerror = (/**
3686
- * @return {?}
3687
- */
3688
- function () {
3689
- resolve(null);
3690
- });
3691
- }))];
3692
- }
3693
- });
3694
- });
3455
+ function () {
3456
+ $('#appFileManager').modal('hide');
3695
3457
  };
3696
3458
  /**
3697
- * @param {?} lessonId
3459
+ * @param {?} $event
3698
3460
  * @return {?}
3699
3461
  */
3700
- OfflineStorageService.prototype.getOfflineVideoUrl = /**
3701
- * @param {?} lessonId
3462
+ FileManagerComponent.prototype.onChange = /**
3463
+ * @param {?} $event
3702
3464
  * @return {?}
3703
3465
  */
3704
- function (lessonId) {
3705
- return __awaiter(this, void 0, void 0, function () {
3706
- var lesson, blobUrl;
3707
- return __generator(this, function (_a) {
3708
- switch (_a.label) {
3709
- case 0: return [4 /*yield*/, this.getDownloadedLesson(lessonId)];
3710
- case 1:
3711
- lesson = _a.sent();
3712
- if (lesson && lesson.videoBlob) {
3713
- blobUrl = URL.createObjectURL(lesson.videoBlob);
3714
- console.log("[OfflineStorageService] Blob de v\u00EDdeo gerado para aula " + lessonId + ":", blobUrl);
3715
- return [2 /*return*/, blobUrl];
3716
- }
3717
- return [2 /*return*/, null];
3718
- }
3466
+ function ($event) {
3467
+ if ($event && this.whiteListUploads($event.target.files[0].type)) {
3468
+ this.selectedFile = $event.target.files[0];
3469
+ }
3470
+ else {
3471
+ swal({
3472
+ type: 'error',
3473
+ title: this.translate.instant('ErrorLoadingFile'),
3474
+ text: this.translate.instant('MakeSureTheFileHasTheAllowedFormat'),
3475
+ buttonsStyling: false,
3476
+ confirmButtonClass: 'btn btn-success'
3719
3477
  });
3720
- });
3478
+ $('#file').val('');
3479
+ }
3721
3480
  };
3722
3481
  /**
3482
+ * @private
3483
+ * @param {?} fileType
3723
3484
  * @return {?}
3724
3485
  */
3725
- OfflineStorageService.prototype.getAllDownloadedLessons = /**
3486
+ FileManagerComponent.prototype.whiteListUploads = /**
3487
+ * @private
3488
+ * @param {?} fileType
3726
3489
  * @return {?}
3727
3490
  */
3728
- function () {
3729
- return __awaiter(this, void 0, void 0, function () {
3730
- var db;
3731
- var _this = this;
3732
- return __generator(this, function (_a) {
3733
- switch (_a.label) {
3734
- case 0: return [4 /*yield*/, this.initDatabase()];
3735
- case 1:
3736
- db = _a.sent();
3737
- return [2 /*return*/, new Promise((/**
3738
- * @param {?} resolve
3739
- * @param {?} reject
3740
- * @return {?}
3741
- */
3742
- function (resolve, reject) {
3743
- /** @type {?} */
3744
- var transaction = db.transaction([_this.STORE_LESSONS], 'readonly');
3745
- /** @type {?} */
3746
- var store = transaction.objectStore(_this.STORE_LESSONS);
3747
- /** @type {?} */
3748
- var request = store.getAll();
3749
- request.onsuccess = (/**
3750
- * @return {?}
3751
- */
3752
- function () {
3753
- resolve(request.result || []);
3754
- });
3755
- request.onerror = (/**
3756
- * @param {?} event
3757
- * @return {?}
3758
- */
3759
- function (event) {
3760
- reject(event.target.error);
3761
- });
3762
- }))];
3763
- }
3764
- });
3765
- });
3491
+ function (fileType) {
3492
+ switch (fileType) {
3493
+ case 'image/png':
3494
+ return true;
3495
+ case 'image/jpeg':
3496
+ return true;
3497
+ case 'image/jpg':
3498
+ return true;
3499
+ case 'image/gif':
3500
+ return true;
3501
+ case 'image/png':
3502
+ return true;
3503
+ case 'application/msword':
3504
+ return true;
3505
+ case 'application/pdf':
3506
+ return true;
3507
+ case 'application/zip':
3508
+ return true;
3509
+ case 'video/x-flv':
3510
+ return true;
3511
+ case 'video/mp4':
3512
+ return true;
3513
+ case 'application/x-mpegURL':
3514
+ return true;
3515
+ case 'video/MP2T':
3516
+ return true;
3517
+ case 'video/3gpp':
3518
+ return true;
3519
+ case 'video/quicktime':
3520
+ return true;
3521
+ case 'video/x-msvideo':
3522
+ return true;
3523
+ case 'video/x-ms-wmv':
3524
+ return true;
3525
+ default:
3526
+ return false;
3527
+ }
3766
3528
  };
3767
3529
  /**
3768
3530
  * @return {?}
3769
3531
  */
3770
- OfflineStorageService.prototype.refreshDownloadedLessons = /**
3532
+ FileManagerComponent.prototype.submit = /**
3771
3533
  * @return {?}
3772
3534
  */
3773
3535
  function () {
3774
- return __awaiter(this, void 0, void 0, function () {
3775
- var lessons, e_1;
3776
- return __generator(this, function (_a) {
3777
- switch (_a.label) {
3778
- case 0:
3779
- _a.trys.push([0, 2, , 3]);
3780
- return [4 /*yield*/, this.getAllDownloadedLessons()];
3781
- case 1:
3782
- lessons = _a.sent();
3783
- this.downloadedLessons$.next(lessons);
3784
- return [3 /*break*/, 3];
3785
- case 2:
3786
- e_1 = _a.sent();
3787
- console.error('[OfflineStorageService] Erro ao carregar aulas baixadas:', e_1);
3788
- return [3 /*break*/, 3];
3789
- case 3: return [2 /*return*/];
3790
- }
3791
- });
3792
- });
3536
+ var _this = this;
3537
+ this.progress.percentage = 0;
3538
+ this.loading = true;
3539
+ this._fileManagerService.uploadFile(this.selectedFile)
3540
+ .subscribe((/**
3541
+ * @param {?} event
3542
+ * @return {?}
3543
+ */
3544
+ function (event) {
3545
+ if (event.type === http.HttpEventType.UploadProgress) {
3546
+ _this.progress.percentage = Math.round(100 * event.loaded / event.total);
3547
+ }
3548
+ else if (event instanceof http.HttpResponse) {
3549
+ _this.event.emit(event.body.data);
3550
+ _this.loading = false;
3551
+ _this.closeModal();
3552
+ }
3553
+ }));
3554
+ this.selectedFile = undefined;
3793
3555
  };
3794
3556
  /**
3795
- * @param {?} lessonId
3796
3557
  * @return {?}
3797
3558
  */
3798
- OfflineStorageService.prototype.deleteDownloadedLesson = /**
3799
- * @param {?} lessonId
3559
+ FileManagerComponent.prototype.findAll = /**
3800
3560
  * @return {?}
3801
3561
  */
3802
- function (lessonId) {
3803
- return __awaiter(this, void 0, void 0, function () {
3804
- var db;
3805
- var _this = this;
3806
- return __generator(this, function (_a) {
3807
- switch (_a.label) {
3808
- case 0: return [4 /*yield*/, this.initDatabase()];
3809
- case 1:
3810
- db = _a.sent();
3811
- return [2 /*return*/, new Promise((/**
3812
- * @param {?} resolve
3813
- * @param {?} reject
3814
- * @return {?}
3815
- */
3816
- function (resolve, reject) {
3817
- /** @type {?} */
3818
- var transaction = db.transaction([_this.STORE_LESSONS], 'readwrite');
3819
- /** @type {?} */
3820
- var store = transaction.objectStore(_this.STORE_LESSONS);
3821
- /** @type {?} */
3822
- var request = store.delete(lessonId);
3823
- request.onsuccess = (/**
3824
- * @return {?}
3825
- */
3826
- function () {
3827
- _this.refreshDownloadedLessons();
3828
- resolve(true);
3829
- });
3830
- request.onerror = (/**
3831
- * @param {?} event
3832
- * @return {?}
3833
- */
3834
- function (event) {
3835
- reject(event.target.error);
3836
- });
3837
- }))];
3838
- }
3839
- });
3840
- });
3562
+ function () {
3563
+ var _this = this;
3564
+ this._fileManagerService.findFileCollection()
3565
+ .subscribe((/**
3566
+ * @param {?} res
3567
+ * @return {?}
3568
+ */
3569
+ function (res) {
3570
+ _this.fileList = res.data;
3571
+ }));
3841
3572
  };
3842
3573
  /**
3574
+ * @param {?} item
3843
3575
  * @return {?}
3844
3576
  */
3845
- OfflineStorageService.prototype.clearAllDownloads = /**
3577
+ FileManagerComponent.prototype.selectFile = /**
3578
+ * @param {?} item
3846
3579
  * @return {?}
3847
3580
  */
3848
- function () {
3849
- return __awaiter(this, void 0, void 0, function () {
3850
- var db;
3851
- var _this = this;
3852
- return __generator(this, function (_a) {
3853
- switch (_a.label) {
3854
- case 0: return [4 /*yield*/, this.initDatabase()];
3855
- case 1:
3856
- db = _a.sent();
3857
- return [2 /*return*/, new Promise((/**
3858
- * @param {?} resolve
3859
- * @param {?} reject
3860
- * @return {?}
3861
- */
3862
- function (resolve, reject) {
3863
- /** @type {?} */
3864
- var transaction = db.transaction([_this.STORE_LESSONS], 'readwrite');
3865
- /** @type {?} */
3866
- var store = transaction.objectStore(_this.STORE_LESSONS);
3867
- /** @type {?} */
3868
- var request = store.clear();
3869
- request.onsuccess = (/**
3870
- * @return {?}
3871
- */
3872
- function () {
3873
- _this.refreshDownloadedLessons();
3874
- resolve(true);
3875
- });
3876
- request.onerror = (/**
3877
- * @param {?} event
3878
- * @return {?}
3879
- */
3880
- function (event) {
3881
- reject(event.target.error);
3882
- });
3883
- }))];
3884
- }
3885
- });
3886
- });
3581
+ function (item) {
3582
+ this.event.emit(item);
3583
+ this.closeModal();
3887
3584
  };
3888
3585
  /**
3889
- * @param {?} action
3586
+ * @param {?} item
3890
3587
  * @return {?}
3891
3588
  */
3892
- OfflineStorageService.prototype.queueSyncAction = /**
3893
- * @param {?} action
3589
+ FileManagerComponent.prototype.deleteFromList = /**
3590
+ * @param {?} item
3894
3591
  * @return {?}
3895
3592
  */
3896
- function (action) {
3897
- return __awaiter(this, void 0, void 0, function () {
3898
- var db;
3899
- var _this = this;
3900
- return __generator(this, function (_a) {
3901
- switch (_a.label) {
3902
- case 0: return [4 /*yield*/, this.initDatabase()];
3903
- case 1:
3904
- db = _a.sent();
3905
- return [2 /*return*/, new Promise((/**
3906
- * @param {?} resolve
3907
- * @param {?} reject
3908
- * @return {?}
3909
- */
3910
- function (resolve, reject) {
3911
- /** @type {?} */
3912
- var transaction = db.transaction([_this.STORE_SYNC_QUEUE], 'readwrite');
3913
- /** @type {?} */
3914
- var store = transaction.objectStore(_this.STORE_SYNC_QUEUE);
3915
- /** @type {?} */
3916
- var syncItem = __assign({}, action, { createdAt: new Date() });
3917
- /** @type {?} */
3918
- var request = store.add(syncItem);
3919
- request.onsuccess = (/**
3920
- * @return {?}
3921
- */
3922
- function () {
3923
- console.log('[OfflineStorageService] Ação salva na fila de sincronização offline:', action);
3924
- resolve();
3925
- });
3926
- request.onerror = (/**
3927
- * @param {?} event
3928
- * @return {?}
3929
- */
3930
- function (event) {
3931
- reject(event.target.error);
3932
- });
3933
- }))];
3934
- }
3593
+ function (item) {
3594
+ var _this = this;
3595
+ this._fileManagerService.removeFile(item.id)
3596
+ .subscribe((/**
3597
+ * @param {?} res
3598
+ * @return {?}
3599
+ */
3600
+ function (res) {
3601
+ swal({
3602
+ type: 'success',
3603
+ title: _this.translate.instant('SuccessfullyRemoved'),
3604
+ text: _this.translate.instant('TheSelectedFileHasBeenRemovedFromTheSystem'),
3605
+ buttonsStyling: true,
3606
+ confirmButtonClass: 'btn btn-success'
3935
3607
  });
3936
- });
3608
+ _this.findAll();
3609
+ }), (/**
3610
+ * @param {?} err
3611
+ * @return {?}
3612
+ */
3613
+ function (err) {
3614
+ swal({
3615
+ type: 'error',
3616
+ title: _this.translate.instant('ErrorRemovingFile'),
3617
+ text: _this.translate.instant('TryAgainLater'),
3618
+ buttonsStyling: true,
3619
+ confirmButtonClass: 'btn btn-success'
3620
+ });
3621
+ }));
3622
+ };
3623
+ FileManagerComponent.decorators = [
3624
+ { type: core.Component, args: [{
3625
+ selector: 'app-file-manager',
3626
+ exportAs: 'appFileManager',
3627
+ template: "<!-- Modal -->\r\n<div id=\"appFileManager\" class=\"modal fade\" role=\"dialog\" data-backdrop=\"false\" >\r\n <div class=\"modal-dialog modal-lg\">\r\n <!-- Modal content-->\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>\r\n <h4 class=\"modal-title\">{{ 'FileManager' | translate }}</h4>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div class=\"col-md-12\">\r\n <div class=\"row\">\r\n <div class=\"col-md-2\">\r\n <ul class=\"nav nav-pills nav-pills-icons nav-pills-primary nav-stacked\" role=\"tablist\">\r\n <!--\r\n color-classes: \"nav-pills-primary\", \"nav-pills-info\", \"nav-pills-success\", \"nav-pills-warning\",\"nav-pills-danger\"\r\n-->\r\n <li class=\"active\">\r\n <a href=\"#upload\" role=\"tab\" data-toggle=\"tab\">\r\n <i class=\"material-icons\">backup</i> {{ 'Upload' | translate }}\r\n </a>\r\n </li>\r\n <li>\r\n <a href=\"#arquivos\" role=\"tab\" data-toggle=\"tab\">\r\n <i class=\"material-icons\">assignment</i> {{ 'Files' | translate }}\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n <div class=\"col-md-10\">\r\n <div class=\"tab-content\">\r\n <div class=\"tab-pane active\" id=\"upload\">\r\n <div class=\"col-sm-12\">\r\n <form *ngIf=\"!loading\" class=\"text-center\">\r\n <div class=\"fileinput fileinput-new text-center\" data-provides=\"fileinput\">\r\n <div class=\"fileinput-new thumbnail preview\" style=\"width: 320px;\">\r\n <img src=\"../../assets/img/image_placeholder.jpg\" alt=\"...\">\r\n </div>\r\n <div class=\"fileinput-preview fileinput-exists thumbnail\"></div>\r\n <div>\r\n <span class=\"btn btn-primary btn-round btn-file\">\r\n <span class=\"fileinput-new\">{{ 'SelectAFile' | translate }}</span>\r\n <span class=\"fileinput-exists\">{{ 'Alter' | translate }}</span>\r\n <input ng2FileSelect (change)=\"onChange($event)\" id=\"file\" type=\"file\" name=\"...\"/>\r\n </span>\r\n <button type=\"button\" (click)=\"submit()\" class=\"fileinput-exists btn btn-primary btn-round\">\r\n {{ 'Confirm' | translate }}\r\n </button>\r\n <a href=\"#pablo\" class=\"btn btn-danger btn-round fileinput-exists\" data-dismiss=\"fileinput\"><i\r\n class=\"fa fa-times\"></i> {{ 'Remove' | translate }}</a>\r\n </div>\r\n </div>\r\n </form>\r\n <div *ngIf=\"loading\">\r\n <br>\r\n <br>\r\n <legend>{{ 'Loading...' | translate }}</legend>\r\n <div class=\"progress progress-line-primary\">\r\n <div class=\"progress-bar\" role=\"progressbar\" aria-valuenow=\"60\"\r\n aria-valuemin=\"0\" aria-valuemax=\"100\" [ngStyle]=\"{width: progress.percentage + '%'}\">\r\n <span class=\"sr-only\">{{ progress.percentage + '%' }} {{ 'Concluded' | translate }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"tab-pane\" id=\"arquivos\">\r\n <div class=\"col-md-12\" style=\"height: 360px; overflow: auto;\">\r\n <div class=\"table-responsive\">\r\n <table class=\"table\">\r\n <thead>\r\n <tr>\r\n <th>{{ 'Date' | translate }}</th>\r\n <th>{{ 'File' | translate }}</th>\r\n <th>{{ 'Actions' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let item of fileList\">\r\n <td>{{ item.updated_at.date | date: 'dd/MM/yyyy' }}</td>\r\n <td>{{ item.name }}</td>\r\n <td class=\"td-actions text-right\">\r\n <button (click)=\"selectFile(item)\" type=\"button\" class=\"btn btn-success\">\r\n <i class=\"material-icons\">check</i>\r\n </button>\r\n <button (click)=\"deleteFromList(item)\" type=\"button\" class=\"btn btn-danger\">\r\n <i class=\"material-icons\">close</i>\r\n </button>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <!--<div class=\"modal-footer\">-->\r\n <!--<button type=\"button\" class=\"btn btn-primary\" data-dismiss=\"modal\">Confirmar</button>-->\r\n <!--<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Fechar</button>-->\r\n <!--</div>-->\r\n </div>\r\n </div>\r\n</div>\r\n",
3628
+ providers: [FileManagerService, FileManagerModel],
3629
+ styles: [".fileinput .thumbnail{max-width:100%!important;height:240px}.modal-content{min-height:450px}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}"]
3630
+ }] }
3631
+ ];
3632
+ /** @nocollapse */
3633
+ FileManagerComponent.ctorParameters = function () { return [
3634
+ { type: FileManagerService },
3635
+ { type: core$1.TranslateService }
3636
+ ]; };
3637
+ FileManagerComponent.propDecorators = {
3638
+ event: [{ type: core.Output }]
3937
3639
  };
3640
+ return FileManagerComponent;
3641
+ }());
3642
+ if (false) {
3643
+ /** @type {?} */
3644
+ FileManagerComponent.prototype.event;
3645
+ /** @type {?} */
3646
+ FileManagerComponent.prototype.selectedFile;
3647
+ /** @type {?} */
3648
+ FileManagerComponent.prototype.progress;
3649
+ /** @type {?} */
3650
+ FileManagerComponent.prototype.loading;
3651
+ /** @type {?} */
3652
+ FileManagerComponent.prototype.fileList;
3938
3653
  /**
3939
- * @return {?}
3654
+ * @type {?}
3655
+ * @private
3940
3656
  */
3941
- OfflineStorageService.prototype.processSyncQueue = /**
3942
- * @return {?}
3657
+ FileManagerComponent.prototype._fileManagerService;
3658
+ /**
3659
+ * @type {?}
3660
+ * @private
3943
3661
  */
3944
- function () {
3945
- return __awaiter(this, void 0, void 0, function () {
3946
- var db;
3947
- var _this = this;
3948
- return __generator(this, function (_a) {
3949
- switch (_a.label) {
3950
- case 0: return [4 /*yield*/, this.initDatabase()];
3951
- case 1:
3952
- db = _a.sent();
3953
- return [2 /*return*/, new Promise((/**
3954
- * @param {?} resolve
3955
- * @param {?} reject
3956
- * @return {?}
3957
- */
3958
- function (resolve, reject) {
3959
- /** @type {?} */
3960
- var transaction = db.transaction([_this.STORE_SYNC_QUEUE], 'readwrite');
3961
- /** @type {?} */
3962
- var store = transaction.objectStore(_this.STORE_SYNC_QUEUE);
3963
- /** @type {?} */
3964
- var request = store.getAll();
3965
- request.onsuccess = (/**
3966
- * @return {?}
3967
- */
3968
- function () { return __awaiter(_this, void 0, void 0, function () {
3969
- var items, syncedCount, items_1, items_1_1, item, clearTx;
3970
- var e_2, _a;
3971
- return __generator(this, function (_b) {
3972
- items = request.result || [];
3973
- if (items.length === 0) {
3974
- return [2 /*return*/, resolve(0)];
3975
- }
3976
- console.log("[OfflineStorageService] Sincronizando " + items.length + " itens pendentes com o servidor...");
3977
- syncedCount = 0;
3978
- try {
3979
- for (items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
3980
- item = items_1_1.value;
3981
- try {
3982
- console.log("[OfflineStorageService] Sincronizado: " + item.endpoint, item.payload);
3983
- syncedCount++;
3984
- }
3985
- catch (err) {
3986
- console.error("[OfflineStorageService] Erro ao sincronizar item " + item.id + ":", err);
3987
- }
3988
- }
3989
- }
3990
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3991
- finally {
3992
- try {
3993
- if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
3994
- }
3995
- finally { if (e_2) throw e_2.error; }
3996
- }
3997
- clearTx = db.transaction([this.STORE_SYNC_QUEUE], 'readwrite');
3998
- clearTx.objectStore(this.STORE_SYNC_QUEUE).clear();
3999
- resolve(syncedCount);
4000
- return [2 /*return*/];
4001
- });
4002
- }); });
4003
- request.onerror = (/**
4004
- * @param {?} event
4005
- * @return {?}
4006
- */
4007
- function (event) {
4008
- reject(event.target.error);
4009
- });
4010
- }))];
4011
- }
4012
- });
4013
- });
3662
+ FileManagerComponent.prototype.translate;
3663
+ }
3664
+
3665
+ /**
3666
+ * @fileoverview added by tsickle
3667
+ * Generated from: lib/shared/file-manager/containers/file-manager-directive/file-manager.directive.ts
3668
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3669
+ */
3670
+ var FileManagerDirective = /** @class */ (function () {
3671
+ function FileManagerDirective() {
3672
+ }
3673
+ FileManagerDirective.decorators = [
3674
+ { type: core.Directive, args: [{
3675
+ selector: '[appFileManager]'
3676
+ },] }
3677
+ ];
3678
+ return FileManagerDirective;
3679
+ }());
3680
+
3681
+ /**
3682
+ * @fileoverview added by tsickle
3683
+ * Generated from: lib/shared/file-manager/file-manager.module.ts
3684
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3685
+ */
3686
+ var FileManagerModule = /** @class */ (function () {
3687
+ function FileManagerModule() {
3688
+ }
3689
+ FileManagerModule.decorators = [
3690
+ { type: core.NgModule, args: [{
3691
+ imports: [
3692
+ common.CommonModule,
3693
+ forms.ReactiveFormsModule,
3694
+ router.RouterModule,
3695
+ forms.FormsModule,
3696
+ core$1.TranslateModule
3697
+ ],
3698
+ declarations: [
3699
+ FileManagerComponent,
3700
+ FileManagerDirective
3701
+ ],
3702
+ exports: [
3703
+ FileManagerComponent
3704
+ ],
3705
+ },] }
3706
+ ];
3707
+ return FileManagerModule;
3708
+ }());
3709
+
3710
+ /**
3711
+ * @fileoverview added by tsickle
3712
+ * Generated from: lib/editor/components/shared/title.component.ts
3713
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3714
+ */
3715
+ var SharedTitleComponent = /** @class */ (function () {
3716
+ function SharedTitleComponent() {
3717
+ }
3718
+ SharedTitleComponent.decorators = [
3719
+ { type: core.Component, args: [{
3720
+ selector: 'app-editor-component-shared-title',
3721
+ template: "\n <h2\n class=\"mb-4 animated shared-title px-4\"\n [ngClass]=\"title?.animation\"\n [style.fontSize.px]=\"title?.size\"\n [style.textAlign]=\"title?.align\"\n [style.color]=\"title.color\" *ngIf=\"title?.text !== ''\">\n {{ title?.text || '' }}\n </h2>\n "
3722
+ }] }
3723
+ ];
3724
+ SharedTitleComponent.propDecorators = {
3725
+ title: [{ type: core.Input }]
3726
+ };
3727
+ return SharedTitleComponent;
3728
+ }());
3729
+ if (false) {
3730
+ /** @type {?} */
3731
+ SharedTitleComponent.prototype.title;
3732
+ /** @type {?} */
3733
+ SharedTitleComponent.prototype.item;
3734
+ }
3735
+
3736
+ /**
3737
+ * @fileoverview added by tsickle
3738
+ * Generated from: lib/editor/components/shared/subtitle.component.ts
3739
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3740
+ */
3741
+ var SharedSubTitleComponent = /** @class */ (function () {
3742
+ function SharedSubTitleComponent() {
3743
+ }
3744
+ SharedSubTitleComponent.decorators = [
3745
+ { type: core.Component, args: [{
3746
+ selector: 'app-editor-component-shared-subtitle',
3747
+ template: "\n <p\n *ngIf=\"subtitle?.enable\"\n class=\"mb-4 animated shared-subtitle\"\n [ngClass]=\"subtitle?.animation\"\n [style.fontSize.px]=\"subtitle?.size\"\n [style.textAlign]=\"subtitle?.align\"\n [style.color]=\"subtitle?.color\">\n {{ subtitle.text || '' }}\n </p>\n "
3748
+ }] }
3749
+ ];
3750
+ SharedSubTitleComponent.propDecorators = {
3751
+ subtitle: [{ type: core.Input }]
4014
3752
  };
3753
+ return SharedSubTitleComponent;
3754
+ }());
3755
+ if (false) {
3756
+ /** @type {?} */
3757
+ SharedSubTitleComponent.prototype.subtitle;
3758
+ }
3759
+
3760
+ /**
3761
+ * @fileoverview added by tsickle
3762
+ * Generated from: lib/editor/components/shared/button.component.ts
3763
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3764
+ */
3765
+ /**
3766
+ * @record
3767
+ */
3768
+ function Button() { }
3769
+ if (false) {
3770
+ /** @type {?} */
3771
+ Button.prototype.background;
3772
+ /** @type {?} */
3773
+ Button.prototype.color;
3774
+ /** @type {?} */
3775
+ Button.prototype.text;
3776
+ /** @type {?|undefined} */
3777
+ Button.prototype.hide;
3778
+ }
3779
+ var SharedButtonComponent = /** @class */ (function () {
3780
+ function SharedButtonComponent(translate) {
3781
+ this.translate = translate;
3782
+ this.button = {
3783
+ background: '#3C4858',
3784
+ color: '#FFFFF',
3785
+ text: this.translate.instant('Next'),
3786
+ };
3787
+ this.disabled = false;
3788
+ this.event = new core.EventEmitter();
3789
+ }
4015
3790
  /**
4016
- * @param {?} bytes
4017
- * @param {?=} decimals
4018
3791
  * @return {?}
4019
3792
  */
4020
- OfflineStorageService.prototype.formatBytes = /**
4021
- * @param {?} bytes
4022
- * @param {?=} decimals
3793
+ SharedButtonComponent.prototype.goNext = /**
4023
3794
  * @return {?}
4024
3795
  */
4025
- function (bytes, decimals) {
4026
- if (decimals === void 0) { decimals = 1; }
4027
- if (!bytes || bytes === 0)
4028
- return '0 MB';
4029
- /** @type {?} */
4030
- var k = 1024;
4031
- /** @type {?} */
4032
- var dm = decimals < 0 ? 0 : decimals;
4033
- /** @type {?} */
4034
- var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
4035
- /** @type {?} */
4036
- var i = Math.floor(Math.log(bytes) / Math.log(k));
4037
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
3796
+ function () {
3797
+ this.event.emit();
4038
3798
  };
4039
3799
  /**
4040
- * @param {?} lessons
4041
3800
  * @return {?}
4042
3801
  */
4043
- OfflineStorageService.prototype.getTotalStorageUsed = /**
4044
- * @param {?} lessons
3802
+ SharedButtonComponent.prototype.ngOnInit = /**
4045
3803
  * @return {?}
4046
3804
  */
4047
- function (lessons) {
4048
- /** @type {?} */
4049
- var totalBytes = lessons.reduce((/**
4050
- * @param {?} acc
4051
- * @param {?} curr
4052
- * @return {?}
4053
- */
4054
- function (acc, curr) { return acc + (curr.sizeBytes || 0); }), 0);
4055
- return {
4056
- totalBytes: totalBytes,
4057
- formatted: this.formatBytes(totalBytes)
4058
- };
3805
+ function () {
4059
3806
  };
4060
- OfflineStorageService.decorators = [
4061
- { type: core.Injectable, args: [{
4062
- providedIn: 'root'
4063
- },] }
3807
+ SharedButtonComponent.decorators = [
3808
+ { type: core.Component, args: [{
3809
+ selector: 'app-editor-component-shared-button',
3810
+ template: "\n <div *ngIf=\"button.hide && (button.text ) && (button.text !='')\" class=\"row\">\n <div class=\"col-md-12 text-center mt-4\">\n <button (click)=\"goNext()\" [disabled]=\"disabled\" type=\"button\" class=\"btn\" style=\"color:white\" \n [ngStyle]=\"{'color': button.color, 'background': button.background}\">\n {{ button.text }}\n </button>\n </div>\n </div>\n "
3811
+ }] }
4064
3812
  ];
4065
3813
  /** @nocollapse */
4066
- OfflineStorageService.ctorParameters = function () { return []; };
4067
- /** @nocollapse */ OfflineStorageService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function OfflineStorageService_Factory() { return new OfflineStorageService(); }, token: OfflineStorageService, providedIn: "root" });
4068
- return OfflineStorageService;
3814
+ SharedButtonComponent.ctorParameters = function () { return [
3815
+ { type: core$1.TranslateService }
3816
+ ]; };
3817
+ SharedButtonComponent.propDecorators = {
3818
+ button: [{ type: core.Input }],
3819
+ disabled: [{ type: core.Input }],
3820
+ event: [{ type: core.Output }]
3821
+ };
3822
+ return SharedButtonComponent;
4069
3823
  }());
4070
3824
  if (false) {
3825
+ /** @type {?} */
3826
+ SharedButtonComponent.prototype.button;
3827
+ /** @type {?} */
3828
+ SharedButtonComponent.prototype.disabled;
3829
+ /** @type {?} */
3830
+ SharedButtonComponent.prototype.event;
4071
3831
  /**
4072
3832
  * @type {?}
4073
3833
  * @private
4074
3834
  */
4075
- OfflineStorageService.prototype.DB_NAME;
4076
- /**
4077
- * @type {?}
4078
- * @private
4079
- */
4080
- OfflineStorageService.prototype.DB_VERSION;
4081
- /**
4082
- * @type {?}
4083
- * @private
4084
- */
4085
- OfflineStorageService.prototype.STORE_LESSONS;
4086
- /**
4087
- * @type {?}
4088
- * @private
4089
- */
4090
- OfflineStorageService.prototype.STORE_SYNC_QUEUE;
4091
- /**
4092
- * @type {?}
4093
- * @private
4094
- */
4095
- OfflineStorageService.prototype.db;
4096
- /**
4097
- * @type {?}
4098
- * @private
4099
- */
4100
- OfflineStorageService.prototype.isOnlineSubject;
3835
+ SharedButtonComponent.prototype.translate;
3836
+ }
3837
+
3838
+ /**
3839
+ * @fileoverview added by tsickle
3840
+ * Generated from: lib/editor/components/shared/media.component.ts
3841
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3842
+ */
3843
+ var SharedMediaComponent = /** @class */ (function () {
3844
+ function SharedMediaComponent() {
3845
+ }
3846
+ SharedMediaComponent.decorators = [
3847
+ { type: core.Component, args: [{
3848
+ selector: 'app-editor-component-shared-media',
3849
+ template: "\n <div class=\"row\" *ngIf=\"media.type == 'image' || media.type == 'IMAGE'\">\n <div class=\"col-sm-11 mx-auto mb-4\">\n <img height=\"320\" style=\"width: 100%; object-fit: scale-down; max-height: 320px;\" *ngIf=\"media.url != ''\"\n [src]=\"media.url\" />\n </div>\n </div>\n <div class=\"row\" *ngIf=\"media.type == 'youtube' || media.type == 'YOUTUBE'\">\n <div class=\"col-sm-11 mx-auto mb-4\" *ngIf=\"media.url !== ''\">\n <iframe [src]=\"media.url | youtubeEmbed | safeUrl:'resourceUrl'\" width=\"100%\" height=\"500px\" frameborder=\"0\"\n allowfullscreen></iframe>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"media.type == 'vimeo' || media.type == 'VIMEO'\">\n <div class=\"col-sm-11 mx-auto mb-4\" *ngIf=\"media.url !== ''\">\n <iframe [src]=\"media.url | vimeoEmbed | safeUrl:'resourceUrl'\" width=\"100%\" height=\"500px\" frameborder=\"0\"\n allowfullscreen></iframe>\n </div>\n </div>\n "
3850
+ }] }
3851
+ ];
3852
+ SharedMediaComponent.propDecorators = {
3853
+ media: [{ type: core.Input }]
3854
+ };
3855
+ return SharedMediaComponent;
3856
+ }());
3857
+ if (false) {
4101
3858
  /** @type {?} */
4102
- OfflineStorageService.prototype.isOnline$;
3859
+ SharedMediaComponent.prototype.media;
3860
+ }
3861
+
3862
+ /**
3863
+ * @fileoverview added by tsickle
3864
+ * Generated from: lib/editor/components/shared/text.component.ts
3865
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3866
+ */
3867
+ var SharedTextComponent = /** @class */ (function () {
3868
+ function SharedTextComponent() {
3869
+ }
3870
+ SharedTextComponent.decorators = [
3871
+ { type: core.Component, args: [{
3872
+ selector: 'app-editor-component-shared-text',
3873
+ template: "\n <p\n class=\"mb-4 animated\"\n [ngClass]=\"text?.animation\"\n [style.fontSize.px]=\"text?.size\"\n [style.textAlign]=\"text?.align\"\n [style.color]=\"text.color\" *ngIf=\"text?.text !== ''\">\n {{ text.text || '' }}\n </p>\n "
3874
+ }] }
3875
+ ];
3876
+ SharedTextComponent.propDecorators = {
3877
+ text: [{ type: core.Input }]
3878
+ };
3879
+ return SharedTextComponent;
3880
+ }());
3881
+ if (false) {
4103
3882
  /** @type {?} */
4104
- OfflineStorageService.prototype.downloadProgress$;
3883
+ SharedTextComponent.prototype.text;
3884
+ }
3885
+
3886
+ /**
3887
+ * @fileoverview added by tsickle
3888
+ * Generated from: lib/editor/components/shared/shared.module.ts
3889
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3890
+ */
3891
+ /** @type {?} */
3892
+ var components = [
3893
+ SharedTitleComponent,
3894
+ SharedSubTitleComponent,
3895
+ SharedButtonComponent,
3896
+ SharedMediaComponent,
3897
+ SharedTextComponent
3898
+ ];
3899
+ var ComponentSharedModule = /** @class */ (function () {
3900
+ function ComponentSharedModule() {
3901
+ }
3902
+ ComponentSharedModule.decorators = [
3903
+ { type: core.NgModule, args: [{
3904
+ imports: [
3905
+ common.CommonModule,
3906
+ forms.FormsModule,
3907
+ forms.ReactiveFormsModule,
3908
+ ngxColorPicker.ColorPickerModule,
3909
+ ngxMoment.MomentModule,
3910
+ select.MatSelectModule,
3911
+ core$1.TranslateModule,
3912
+ input.MatInputModule,
3913
+ stepper.MatStepperModule,
3914
+ radio.MatRadioModule,
3915
+ tooltip.MatTooltipModule,
3916
+ slider.MatSliderModule,
3917
+ PipesModule
3918
+ ],
3919
+ declarations: __spread(components),
3920
+ exports: __spread(components)
3921
+ },] }
3922
+ ];
3923
+ return ComponentSharedModule;
3924
+ }());
3925
+
3926
+ /**
3927
+ * @fileoverview added by tsickle
3928
+ * Generated from: lib/editor/components/dynamic-input/dynamic-input.component.ts
3929
+ * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3930
+ */
3931
+ var DynamicInputComponent = /** @class */ (function () {
3932
+ function DynamicInputComponent() {
3933
+ }
3934
+ DynamicInputComponent.decorators = [
3935
+ { type: core.Component, args: [{
3936
+ selector: 'app-editor-component-dynamic-input',
3937
+ template: "<textarea \r\n ngControlName\r\n *ngIf=\"input.type == 'text-long'\"\r\n name=\"input\"\r\n matInput \r\n matTextareaAutosize\r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\"></textarea>\r\n\r\n<input \r\n *ngIf=\"input.type == 'text-short'\"\r\n type=\"text\"\r\n name=\"input\"\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<input \r\n *ngIf=\"input.type == 'number'\"\r\n type=\"number\"\r\n name=\"input\"\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<input \r\n *ngIf=\"input.type == 'currency'\"\r\n type=\"text\"\r\n name=\"input\"\r\n currencyMask\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<input \r\n *ngIf=\"input.type == 'date'\"\r\n type=\"date\"\r\n name=\"input\"\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<div class=\"form-group form-focus label-floating\" *ngIf=\"input.type === 'select-single'\">\r\n <mat-form-field class=\"w-100 m-b-3\">\r\n <mat-select name=\"input\" [placeholder]=\"input.placeholder\">\r\n <mat-option *ngFor=\"let opt of input.selectOptions\" [value]=\"opt.value\"> {{ opt.value }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>\r\n\r\n<div class=\"form-group form-focus label-floating\" *ngIf=\"input.type === 'select-multi'\">\r\n <mat-form-field class=\"w-100 m-b-3\">\r\n <mat-select multiple name=\"input\" [placeholder]=\"input.placeholder\">\r\n <mat-option *ngFor=\"let opt of input.selectOptions\" [value]=\"opt.value\"> {{ opt.value }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>",
3938
+ styles: [".flex-container{padding:0;margin:0;list-style:none;-ms-box-orient:horizontal;display:-moz-flex;display:flex}.nowrap{flex-wrap:nowrap}.wrap{flex-wrap:wrap}::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle{border-color:#e91e63}::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle{background-color:#e91e63}::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element{background-color:rgba(233,30,99,.26)}.mat-checkbox-label,::ng-deep .mat-radio-label{cursor:pointer;white-space:nowrap;padding:10px}::ng-deep .mat-horizontal-stepper-header{height:40px!important;padding:0 15px!important}::ng-deep .mat-step-header .mat-step-icon{background-color:#e91e63;color:#fff}::ng-deep .mat-stepper-horizontal-line{margin:0!important}::ng-deep .checkbox .checkbox-material .check{width:15px;height:15px;border:1px solid #ddd;border-radius:3px}::ng-deep .checkbox .checkbox-material .check:before{position:absolute;content:\"\";transform:rotate(45deg);display:block;margin-top:-5px;margin-left:5px;font-size:.5em;width:1;height:0;-webkit-animation:.3s forwards checkbox-off;animation:.3s forwards checkbox-off}::ng-deep .checkbox label{cursor:pointer;padding-left:0;font-size:.8em;font-weight:500;color:#525859}.mt--5{margin-top:-7px}.mt-20{margin-top:20px}.ml-3{margin-left:3px}.no-margin{margin:0!important}.bg-purple{background:#9c27b0}.fc-gray{color:#525859!important}.fc-purple{color:#9c27b0!important}.fc-red{color:#e50606!important}.fc-green{color:#2ac994!important}.bold{font-weight:700}.bolder{font-weight:bolder}.placeholder{color:#d5d5d5}.border{border:1px solid #d2d2d2}.no-border{border:none}.bl-0{border-left:none}.border-label{padding:0;border-radius:3px;border:1px solid #ccc;background:rgba(255,255,255,.5)}.border-top{border-top:1px solid #eee}.border-bottom{border-bottom:1px solid #eee}.col-center-block{float:none;display:block;margin:0 auto}.btn.focus,.btn:focus{color:#fff;background-color:#595959;border-color:#595959;outline:0;box-shadow:0 0 0 .2rem rgba(89,89,89,.25)}.btn-primary{color:#fff;background-color:#6c757d!important;border-color:#6c757d!important;box-shadow:none;font-size:1em}.btn-primary:hover{color:#fff;background-color:#595959;border-color:#595959;box-shadow:0 14px 26px -12px rgba(89,89,89,.42),0 4px 23px 0 rgba(0,0,0,.12),0 8px 10px -5px rgba(89,89,89,.2)}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 .2rem rgba(89,89,89,.5)}.btn-primary.disabled,.btn-primary:disabled{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-primary.disabled,.btn-primary:disabled:hover,.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#595959;border-color:#595959}.btn-primary:not(:disabled):not(.disabled).active:focus,.btn-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(89,89,89,.5)}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-muted{background:#ccc}.btn-muted:hover{background:#bbb}.box-group{padding:10px;background:#f5f5f5;border:1px solid #eee;border-radius:3px}.box{display:flex;display:-ms-flexbox;align-items:center;-webkit-box-align:center;-ms-flex-align:center;flex-direction:column;justify-content:center;-webkit-justify-content:center;-webkit-box-pack:center;margin-left:auto}.box-list{display:flex;align-items:center;justify-content:center;height:100%;padding-bottom:30px;width:100%}.box-ask-border{display:inline-block;margin:2%;max-width:190px;min-height:190px;text-align:left;width:46%}.box-ask-border:hover{border-color:#dedede;color:#dedede;background:#fff7fa;border-radius:7px}.box-label{cursor:pointer;display:block;height:100%;padding:12px}.box-img{background-position:50%;background-size:cover;border-radius:7px;height:160px;margin:0;width:100%;-o-object-fit:cover;object-fit:cover}.box-input{display:block;position:relative;cursor:pointer;font-size:15px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.box-input input{position:absolute;opacity:0;cursor:pointer}.checkmark{position:absolute;top:-17px;left:-17px;background:0 0;border:2px solid #dadada;color:#3c3c3c;border-radius:10px;display:inline-block;margin:2%;width:116%;height:120%;min-height:190px}.box-input input:checked~.checkmark{border:2px solid #dedede}.checkmark:after{content:\"\";position:absolute;display:none}.box-input input:checked~.box-ask-border:after{border:2px solid #dadada;color:#3c3c3c;border-radius:10px;display:inline-block;font-size:15px;margin:2%;max-width:190px;text-align:left;width:46%}.box-ask-border:after{border-color:#dedede;color:rgba (233,30,99,.3);background:#fff7fa}.title{font-size:13px;float:left;padding:2px 10px;position:fixed}.title-question{font-size:1.12em;font-weight:900;color:#525859;margin-bottom:20px}.title-config{font-size:.8em;font-weight:500;color:#525859;margin-bottom:0;width:100%}.tool-name{font-weight:600;color:#9c27b0}.tool-name-subtitle{font-weight:600;color:#525859}.img-responsive,.vid-responsive{display:block;max-width:100%;height:auto}.img-thumbnail,.vid-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;margin-bottom:30px;transition:.2s ease-in-out}.col-left{border-right:1px solid #eee}.col-center{float:left;width:60%}.col-right{border-left:1px solid #eee}.col-left,.col-right{float:left;width:20%;overflow-x:hidden!important}.col-sup{height:28vh;overflow-y:auto;padding:10px;border-top:1px solid #eee;border-bottom:1px solid #eee;margin-top:25px}.col-sub{height:51.5vh;overflow-y:auto;padding:10px;border-top:1px solid #eee;margin-top:25px}.col-int{height:83.5vh;overflow-y:auto;padding:10px;margin-top:25px;border-top:1px solid #eee}.icon{float:left;width:50%;height:70px;text-align:center;margin:20px 0}.icon i{font-size:40px}.icon a{display:block;color:#999}.icon a:hover{color:#777}.icon p{font-size:14px;margin:5px}table thead th{font-size:1em;font-weight:900;color:#383838}table tfoot .amount{font-size:1em;font-weight:900;color:#383838;text-align:right}.nav-tabs{border-bottom:1px solid #ddd;margin-bottom:20px;background:0 0}.nav-tabs>li>a{margin-right:0!important;padding:4px 8px;color:#9c27b0!important}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd!important;border-bottom-color:transparent!important}.divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}input.cell-text::-webkit-input-placeholder{color:#d5d5d5}input.cell-text::-moz-placeholder{color:#d5d5d5}input.cell-text:-ms-input-placeholder{color:#d5d5d5}input.cell-text::-ms-input-placeholder{color:#d5d5d5}input.cell-text::placeholder{color:#d5d5d5}input.text{border:1px solid #ddd;padding:5px 10px;border-radius:3px;color:#333}input.text::-webkit-input-placeholder{color:#d5d5d5}input.text::-moz-placeholder{color:#d5d5d5}input.text:-ms-input-placeholder{color:#d5d5d5}input.text::-ms-input-placeholder{color:#d5d5d5}input.text::placeholder{color:#d5d5d5}select.text{border:1px solid #ddd;padding:5px 2px;border-radius:3px;color:#333}select.text::-webkit-input-placeholder{color:#d5d5d5}select.text::-moz-placeholder{color:#d5d5d5}select.text:-ms-input-placeholder{color:#d5d5d5}select.text::-ms-input-placeholder{color:#d5d5d5}select.text::placeholder{color:#d5d5d5}textarea.text{border:1px solid #ddd;padding:5px 10px;border-radius:3px;color:#333;resize:none}textarea.text::-webkit-input-placeholder{color:#d5d5d5}textarea.text::-moz-placeholder{color:#d5d5d5}textarea.text:-ms-input-placeholder{color:#d5d5d5}textarea.text::-ms-input-placeholder{color:#d5d5d5}textarea.text::placeholder{color:#d5d5d5}.text-input{color:#b5b4b4;font-size:1.12em;position:relative;vertical-align:middle;display:inline-block;transition:.5s;padding:0;cursor:pointer;border-bottom:2px solid #fff;-webkit-transition:.5s}.text-input::after,.text-input::before{width:100%;height:100%;z-index:3;content:\"\";position:absolute;top:0;left:0;box-sizing:border-box;-webkit-transform:scale(0);transition:.5s}.text-input::-webkit-input-placeholder{color:#dcb8e3;font-size:1.09em}.text-input::-moz-placeholder{color:#dcb8e3;font-size:1.09em}.text-input:-ms-input-placeholder{color:#dcb8e3;font-size:1.09em}.text-input::-ms-input-placeholder{color:#dcb8e3;font-size:1.09em}.text-input::placeholder{color:#dcb8e3;font-size:1.09em}.text-input:focus,.text-input:hover{color:#dcb8e3;font-size:1.09em;border-bottom:2px solid #dedede}input[type=checkbox],input[type=radio]{display:none}input[type=checkbox]+label,input[type=radio]+label{color:#b5b4b4;font-size:1.09em}input[type=radio]+label span{display:inline-block;width:19px;height:19px;margin:-2px 10px 0 0;vertical-align:middle;cursor:pointer}input[type=checkbox]+label span{display:inline-block;width:19px;height:19px;margin:-2px 10px 0 0;vertical-align:middle;cursor:pointer;transition:.1s}input[type=checkbox]:checked+label span{transition:.1s}.multiple-questions label span{display:block;cursor:pointer;max-height:242px;border:1px solid #ddd;border-radius:7px;padding:10px 10px 0;margin:5px;max-width:180px;min-height:180px}.multiple-questions label span.no-image{min-height:0}.multiple-questions label span.no-image img{display:none!important}.multiple-questions input[type=radio]:checked+span{border:1px solid #595959!important;background:#fcfcfc}.multiple-questions label span img{border-radius:7px;width:180px;height:180px}.multiple-questions .text{text-align:center;padding:15px 0;min-height:30px}input.multichoice:empty{margin-left:-999px}input.multichoice:empty~label{position:relative;margin-right:20px;margin-bottom:20px;padding-right:20px;float:left;line-height:2.5em;text-indent:3.5em;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:.1s}input.multichoice:empty~label:before{position:relative;left:0;float:left;content:'';width:40px;background:#d1d3d4;border-radius:3px 0 0 3px;margin-left:0;margin-right:-40px}input.multichoice:checked~label:before{content:'\\2714';text-indent:.9em;color:#fff;background-color:#6c63fe;transition:.1s}.d-flex{display:flex!important}.flex-wrap{flex-wrap:wrap!important}.justify-content-center{justify-content:center!important}.flex-column{flex-direction:column!important}.align-content-center{align-content:center!important}.align-vertical-center{-ms-align-items:center!important;align-items:center!important}.wrapper{min-height:100%;position:relative;overflow:hidden}.wrapper:after,.wrapper:before{content:\" \";display:table}.wrapper:after{clear:both}.content-wrapper{min-height:100%;background-color:#fff;z-index:800;padding-top:40px}.top-menu{position:absolute;border-bottom:1px solid #eee;top:0;width:100%;height:40px;padding:0 10px;line-height:40px}.tool{float:right;padding:2px 5px}.footer{position:absolute;border-top:1px solid #eee;bottom:0;padding:0 10px;width:100%;height:40px;line-height:40px;background:#fff}.cliente{font-size:16px}.modulo a{padding:2px 5px;border-radius:4px;display:block;background:#9c27b0;color:#fff;margin-bottom:5px}.modulo a:hover{background:#831596}.modulo span a{float:right;font-size:12px;padding:0;background:0 0;margin-left:5px;margin-top:1px}.modulo span a:hover{color:#e9e9e9}.etapa a{padding:2px 5px 2px 20px;border-radius:4px;display:block;background:0 0;color:#777;margin-bottom:5px}.etapa span a{float:right;font-size:12px;padding:0;background:0 0;color:#ddd;margin-left:5px;margin-top:1px}.etapa span a:hover{color:#999}.form-custom input[type=number],.form-custom input[type=text],.form-custom select,.form-custom textarea{border:1px solid #dadde2;padding:3px 5px;border-radius:2px;font-size:13px;overflow-x:hidden}.form-custom .txt{border:1px solid #dadde2;padding:3px 5px;border-radius:2px;font-size:13px}.form-custom ::-webkit-input-placeholder{font-size:13px;color:#999}.form-custom ::-moz-placeholder{font-size:13px;color:#999}.form-custom ::-ms-input-placeholder{font-size:13px;color:#999}.wrapper-input{height:45px}.btn-rose{background:#e91e63}.cursor{cursor:pointer}.midia-w iframe{width:100%}.midia-h iframe{height:400px}.breadcrumb{padding:0 15px;margin-bottom:20px;list-style:none;background-color:transparent;font-size:12px}.config-label{width:100%;margin:5px 0;float:left;font-size:.8em;display:block;line-height:1.5em}.config-textarea{width:100%;margin:5px 0;float:left;resize:initial;overflow-y:auto;display:block;font-size:.9em!important;color:#999}.config-input,.config-select{width:100%;margin:5px 0;float:left;display:block;font-size:.9em!important;color:#999}.config-box{width:100%;margin:5px;float:left}.config-box-50{width:45%;min-height:110px;margin:5px;float:left;background:#f9f9f9;border:1px solid #eee;border-radius:5px;padding:10px}.config-box-title{width:100%;padding:10px;font-size:.85em}.no-bg-image{background-image:none}.space-inside{padding:10px}.block{display:block}.fake-link{cursor:pointer}.item-component{margin:0;border-radius:2px;border:1px solid #fff}.item-component:hover{border-color:#9c27b0}.item-component.active{border-color:#9c27b0;background-color:#f9f9f9}.item-box-model{border:3px dashed #ddd;padding:20px;color:#ccc;min-height:50px}.item-component-challenge,.item-component-conclusion,.item-component-download,.item-component-dynamic-input,.item-component-dynamic-table,.item-component-image,.item-component-intro,.item-component-long-text,.item-component-multichoise,.item-component-multiple-questions,.item-component-pdf,.item-component-rating,.item-component-sales-channel,.item-component-sheet-correct-incorrect,.item-component-star-point,.item-component-text,.item-component-upload,.item-component-video,.item-component-yes-no{padding:0}.item-component-image .material-icons,.item-component-pdf .material-icons,.item-component-video .material-icons{font-size:80px}.item-component-title .title-bold{font-weight:700}.item-component-title .title-italic{font-style:italic}.item-component-title .title-underline{text-decoration:underline}.icon.disabled{opacity:.3}.item-component-image-icon-container,.item-component-pdf-icon-container,.item-component-video-icon-container{background:#eee;border:1px solid #ccc;text-align:center;color:#444;font-size:50px;padding:160px}.btn-container{text-align:center}.etapa a:hover,.etapa.active a{background:#f4f4f4}.etapa.active:before{font:700 14px/1 FontAwesome;content:\"\\f0da\";float:left;color:#9c27b0;position:relative;top:5px;left:5px}.scroll{overflow-y:auto}#trail-status{color:#ddd;margin-right:10px;background:0 0;border:none}#trail-status.active{color:#6c9}.item-btn-delete{position:relative}.item-btn-delete button{position:absolute;top:-10px;right:-10px;border:1px solid #9c27b0;background-color:#fff;color:#9c27b0;border-radius:50%;width:20px;height:20px;padding:0;font-size:12px;line-height:12px;z-index:1}.item-btn-delete button:hover{background-color:#9c27b0;color:#fff}.custom-divisor{margin:10px 0}#tbl-objetivo td{padding:0 8px;height:0}#accordion .tool-name:after{font-family:\"Glyphicons Halflings\";content:\"\\e114\";float:right}#accordion .tool-name.collapsed:after{content:\"\\e080\"}#editor-components-wrapper img{max-height:500px;-o-object-fit:contain;object-fit:contain;background:#eee;width:auto}.input-styled{border:1px solid #ccc;padding:4px 6px;border-radius:2px}.pulse:hover{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-name:pulse;animation-name:pulse}@-webkit-keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.9);opacity:.7}}@keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.9);opacity:.7}}.cover{position:relative}.cover img{width:100%;min-height:480px;-o-object-fit:cover;object-fit:cover;opacity:1;transition:.5s;-webkit-backface-visibility:hidden;backface-visibility:hidden}.mx-auto{float:none;margin:0 auto}@media (min-width:576px) and (max-width:767px){::ng-deep .sheet-correct .radio{width:90%!important}}@media (min-width:768px) and (max-width:991px){::ng-deep .sheet-correct .radio{width:45%!important}}@media (min-width:992px) and (max-width:1199px){::ng-deep .sheet-correct .radio{width:65%!important}}@media (min-width:1200px){::ng-deep .sheet-correct .radio{width:45%!important}}@media (min-width:1600px){.col-sup{height:45vh}.col-sub{height:55.5vh}.col-int{height:88.5vh}}.image-modal{transition:.5s}.image-modal-item{width:100%;-o-object-fit:scale-down;object-fit:scale-down;max-height:320px;cursor:zoom-in}.image-modal-full{position:fixed;top:0;left:0;z-index:99999;width:100%;height:100%;padding:10%;background:rgba(0,0,0,.3);-o-object-fit:contain;object-fit:contain;cursor:zoom-out}", "input,textarea{padding:10px}"]
3939
+ }] }
3940
+ ];
3941
+ /** @nocollapse */
3942
+ DynamicInputComponent.ctorParameters = function () { return []; };
3943
+ DynamicInputComponent.propDecorators = {
3944
+ input: [{ type: core.Input }]
3945
+ };
3946
+ return DynamicInputComponent;
3947
+ }());
3948
+ if (false) {
4105
3949
  /** @type {?} */
4106
- OfflineStorageService.prototype.downloadedLessons$;
3950
+ DynamicInputComponent.prototype.input;
4107
3951
  }
4108
3952
 
4109
3953
  /**
4110
3954
  * @fileoverview added by tsickle
4111
- * Generated from: lib/\@core/interceptors/offline.interceptor.ts
3955
+ * Generated from: lib/\@core/services/trail-content.service.ts
4112
3956
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4113
3957
  */
4114
- var OfflineHttpInterceptor = /** @class */ (function () {
4115
- function OfflineHttpInterceptor(offlineService) {
4116
- this.offlineService = offlineService;
3958
+ var TrailContentService = /** @class */ (function () {
3959
+ function TrailContentService(http, global) {
3960
+ this.http = http;
3961
+ this.global = global;
4117
3962
  }
4118
3963
  /**
4119
- * @param {?} request
4120
- * @param {?} next
3964
+ * @param {?} id
4121
3965
  * @return {?}
4122
3966
  */
4123
- OfflineHttpInterceptor.prototype.intercept = /**
4124
- * @param {?} request
4125
- * @param {?} next
3967
+ TrailContentService.prototype.all = /**
3968
+ * @param {?} id
4126
3969
  * @return {?}
4127
3970
  */
4128
- function (request, next) {
4129
- var _this = this;
4130
- return next.handle(request).pipe(operators.catchError((/**
4131
- * @param {?} error
3971
+ function (id) {
3972
+ return this.http.get(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/' + id, this.getHeaders()).pipe(operators.catchError((/**
3973
+ * @param {?} err
4132
3974
  * @return {?}
4133
3975
  */
4134
- function (error) {
4135
- return _this.handleOfflineFallback(request, error);
4136
- })));
3976
+ function (err) { return rxjs.of({ data: [] }); })));
4137
3977
  };
4138
3978
  /**
4139
- * @private
4140
- * @param {?} request
4141
- * @param {?} originalError
3979
+ * @param {?} id
4142
3980
  * @return {?}
4143
3981
  */
4144
- OfflineHttpInterceptor.prototype.handleOfflineFallback = /**
4145
- * @private
4146
- * @param {?} request
4147
- * @param {?} originalError
3982
+ TrailContentService.prototype.updateGrafico = /**
3983
+ * @param {?} id
4148
3984
  * @return {?}
4149
3985
  */
4150
- function (request, originalError) {
4151
- /** @type {?} */
4152
- var url = request.url;
4153
- // 1. Intercepta chamadas POST/PUT de progresso, anotações, tempo e salva na fila offline
4154
- if (request.method === 'POST' || request.method === 'PUT') {
4155
- if (url.includes('/progresso') ||
4156
- url.includes('/tempo') ||
4157
- url.includes('/multiple') ||
4158
- url.includes('/anotacoes') ||
4159
- url.includes('/conteudo/vote')) {
4160
- /** @type {?} */
4161
- var actionType = 'stage_progress';
4162
- if (url.includes('/tempo')) {
4163
- actionType = 'video_progress';
4164
- }
4165
- else if (url.includes('/anotacoes')) {
4166
- actionType = 'notes';
4167
- }
4168
- this.offlineService.queueSyncAction({
4169
- type: actionType,
4170
- endpoint: url,
4171
- payload: request.body || {}
4172
- });
4173
- console.log('[OfflineHttpInterceptor] Requisição POST/PUT interceptada e salva na fila de sincronização:', url);
4174
- return rxjs.of(new http.HttpResponse({
4175
- status: 200,
4176
- statusText: 'OK (Offline Queued)',
4177
- body: { status: true, success: true, queued: true, message: 'Ação salva offline' }
4178
- }));
4179
- }
4180
- }
4181
- // 2. Intercepta requisições GET de conteúdo ou etapas
4182
- if (request.method === 'GET') {
4183
- /** @type {?} */
4184
- var matches = url.match(/\/(\d+)(?:$|\/|\?)/);
4185
- if (matches && matches[1]) {
4186
- /** @type {?} */
4187
- var id = matches[1];
4188
- return rxjs.from(this.offlineService.getDownloadedLesson(id)).pipe(operators.switchMap((/**
4189
- * @param {?} lesson
4190
- * @return {?}
4191
- */
4192
- function (lesson) {
4193
- if (lesson) {
4194
- console.log('[OfflineHttpInterceptor] Resposta offline fornecida para:', url);
4195
- /** @type {?} */
4196
- var dataValue = Array.isArray(lesson.stageData) ? lesson.stageData : [lesson.stageData];
4197
- return rxjs.of(new http.HttpResponse({
4198
- status: 200,
4199
- statusText: 'OK (Offline Cache)',
4200
- body: {
4201
- status: true,
4202
- data: [{
4203
- id: lesson.id,
4204
- title: lesson.title,
4205
- value: dataValue
4206
- }]
4207
- }
4208
- }));
4209
- }
4210
- return rxjs.throwError(originalError);
4211
- })));
4212
- }
4213
- }
4214
- return rxjs.throwError(originalError);
3986
+ function (id) {
3987
+ return this.http.get(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/assessment/' + id, this.getHeaders());
4215
3988
  };
4216
- OfflineHttpInterceptor.decorators = [
4217
- { type: core.Injectable }
4218
- ];
4219
- /** @nocollapse */
4220
- OfflineHttpInterceptor.ctorParameters = function () { return [
4221
- { type: OfflineStorageService }
4222
- ]; };
4223
- return OfflineHttpInterceptor;
4224
- }());
4225
- if (false) {
4226
- /**
4227
- * @type {?}
4228
- * @private
4229
- */
4230
- OfflineHttpInterceptor.prototype.offlineService;
4231
- }
4232
-
4233
- /**
4234
- * @fileoverview added by tsickle
4235
- * Generated from: lib/shared/file-manager/models/file-manager.model.ts
4236
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4237
- */
4238
- var FileManagerModel = /** @class */ (function () {
4239
- function FileManagerModel(http, global) {
4240
- this.http = http;
4241
- this.global = global;
4242
- this.apiBaseUrl = this.global.apiURL();
4243
- }
4244
3989
  /**
3990
+ * @param {?} id
4245
3991
  * @param {?} data
4246
3992
  * @return {?}
4247
3993
  */
4248
- FileManagerModel.prototype.populate = /**
3994
+ TrailContentService.prototype.save = /**
3995
+ * @param {?} id
4249
3996
  * @param {?} data
4250
3997
  * @return {?}
4251
3998
  */
4252
- function (data) {
4253
- return undefined;
3999
+ function (id, data) {
4000
+ return this.http.post(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/' + id, { value: data }, this.getHeaders());
4254
4001
  };
4255
4002
  /**
4003
+ * @param {?} id
4256
4004
  * @param {?} data
4257
4005
  * @return {?}
4258
4006
  */
4259
- FileManagerModel.prototype.uploadFile = /**
4007
+ TrailContentService.prototype.update = /**
4008
+ * @param {?} id
4260
4009
  * @param {?} data
4261
4010
  * @return {?}
4262
4011
  */
4263
- function (data) {
4264
- /** @type {?} */
4265
- var formData = new FormData();
4266
- formData.append('file', data.file);
4267
- formData.append('name', data.name);
4268
- formData.append('description', data.description);
4269
- /** @type {?} */
4270
- var headerOptions = {
4271
- 'Authorization': localStorage.getItem('token'),
4272
- 'Accept': 'application/json'
4273
- };
4274
- /** @type {?} */
4275
- var req = new http.HttpRequest('POST', this.apiBaseUrl + '/api/v2/admin/file', formData, {
4276
- reportProgress: true,
4277
- responseType: 'json',
4278
- headers: new http.HttpHeaders(headerOptions)
4279
- });
4280
- return this.http.request(req);
4281
- // return this.http.post(this.apiBaseUrl + '/api/v2/admin/file', data, {headers: new HttpHeaders(headerOptions)});
4012
+ function (id, data) {
4013
+ return this.http.put(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/' + id, { value: data }, this.getHeaders());
4282
4014
  };
4283
4015
  /**
4016
+ * @param {?} id
4284
4017
  * @return {?}
4285
4018
  */
4286
- FileManagerModel.prototype.getAll = /**
4019
+ TrailContentService.prototype.delete = /**
4020
+ * @param {?} id
4287
4021
  * @return {?}
4288
4022
  */
4289
- function () {
4290
- return this.http.get(this.apiBaseUrl + '/api/v2/admin/file/all', { headers: this.getHeader() });
4023
+ function (id) {
4024
+ return this.http.delete(this.global.apiURL() + '/api/v2/client/exercises/' + id, this.getHeaders());
4291
4025
  };
4292
4026
  /**
4293
4027
  * @param {?} id
4028
+ * @param {?} seconds
4294
4029
  * @return {?}
4295
4030
  */
4296
- FileManagerModel.prototype.deleteFile = /**
4031
+ TrailContentService.prototype.videoTime = /**
4297
4032
  * @param {?} id
4033
+ * @param {?} seconds
4298
4034
  * @return {?}
4299
4035
  */
4300
- function (id) {
4301
- return this.http.delete(this.apiBaseUrl + '/api/v2/admin/file/' + id, { headers: this.getHeader() });
4036
+ function (id, seconds) {
4037
+ return this.http.get(this.global.apiURL() + '/api/v2/client/trilha/conteudo/tempo/' + id + '/' + seconds, this.getHeaders());
4302
4038
  };
4303
4039
  /**
4040
+ * @param {?} id
4041
+ * @param {?} vote
4304
4042
  * @return {?}
4305
4043
  */
4306
- FileManagerModel.prototype.changeFile = /**
4044
+ TrailContentService.prototype.vote = /**
4045
+ * @param {?} id
4046
+ * @param {?} vote
4307
4047
  * @return {?}
4308
4048
  */
4309
- function () {
4310
- return undefined;
4049
+ function (id, vote) {
4050
+ return this.http.post(this.global.apiURL() + '/api/v2/client/trilha/conteudo/vote/' + id, { voto: vote }, this.getHeaders());
4311
4051
  };
4312
4052
  /**
4313
4053
  * @return {?}
4314
4054
  */
4315
- FileManagerModel.prototype.getHeader = /**
4055
+ TrailContentService.prototype.getHeaders = /**
4316
4056
  * @return {?}
4317
4057
  */
4318
4058
  function () {
4319
4059
  /** @type {?} */
4320
4060
  var token = localStorage.getItem('token');
4321
- if (token) {
4322
- /** @type {?} */
4323
- var headerOptions = {
4324
- 'Authorization': token,
4325
- 'Content-Type': 'application/x-www-form-urlencoded',
4326
- 'Accept': 'application/json'
4327
- };
4328
- return new http.HttpHeaders(headerOptions);
4329
- }
4061
+ /** @type {?} */
4062
+ var headerOptions = {
4063
+ 'Authorization': token,
4064
+ 'Accept': 'application/json'
4065
+ };
4066
+ return { headers: new http.HttpHeaders(headerOptions) };
4330
4067
  };
4331
- FileManagerModel.decorators = [
4068
+ TrailContentService.decorators = [
4332
4069
  { type: core.Injectable }
4333
4070
  ];
4334
4071
  /** @nocollapse */
4335
- FileManagerModel.ctorParameters = function () { return [
4072
+ TrailContentService.ctorParameters = function () { return [
4336
4073
  { type: http.HttpClient },
4337
4074
  { type: asapCrud.Global }
4338
4075
  ]; };
4339
- return FileManagerModel;
4076
+ return TrailContentService;
4340
4077
  }());
4341
4078
  if (false) {
4342
4079
  /** @type {?} */
4343
- FileManagerModel.prototype.file;
4344
- /** @type {?} */
4345
- FileManagerModel.prototype.name;
4346
- /** @type {?} */
4347
- FileManagerModel.prototype.description;
4348
- /** @type {?} */
4349
- FileManagerModel.prototype.apiBaseUrl;
4350
- /**
4351
- * @type {?}
4352
- * @private
4353
- */
4354
- FileManagerModel.prototype.http;
4080
+ TrailContentService.prototype.http;
4355
4081
  /** @type {?} */
4356
- FileManagerModel.prototype.global;
4082
+ TrailContentService.prototype.global;
4357
4083
  }
4358
4084
 
4359
4085
  /**
4360
4086
  * @fileoverview added by tsickle
4361
- * Generated from: lib/shared/file-manager/services/file-manager.service.ts
4087
+ * Generated from: lib/\@core/services/offline-storage.service.ts
4362
4088
  * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4363
4089
  */
4364
- var FileManagerService = /** @class */ (function () {
4365
- function FileManagerService(fileManagerModel, httpClient, global) {
4366
- this.fileManagerModel = fileManagerModel;
4367
- this.httpClient = httpClient;
4368
- this.global = global;
4090
+ /**
4091
+ * @record
4092
+ */
4093
+ function DownloadedLesson() { }
4094
+ if (false) {
4095
+ /** @type {?} */
4096
+ DownloadedLesson.prototype.id;
4097
+ /** @type {?} */
4098
+ DownloadedLesson.prototype.trailId;
4099
+ /** @type {?} */
4100
+ DownloadedLesson.prototype.title;
4101
+ /** @type {?|undefined} */
4102
+ DownloadedLesson.prototype.subtitle;
4103
+ /** @type {?|undefined} */
4104
+ DownloadedLesson.prototype.thumbnail;
4105
+ /** @type {?} */
4106
+ DownloadedLesson.prototype.sizeBytes;
4107
+ /** @type {?} */
4108
+ DownloadedLesson.prototype.sizeFormatted;
4109
+ /** @type {?} */
4110
+ DownloadedLesson.prototype.downloadedAt;
4111
+ /** @type {?} */
4112
+ DownloadedLesson.prototype.stageData;
4113
+ /** @type {?} */
4114
+ DownloadedLesson.prototype.stages;
4115
+ /** @type {?|undefined} */
4116
+ DownloadedLesson.prototype.videoBlob;
4117
+ /** @type {?|undefined} */
4118
+ DownloadedLesson.prototype.videoMimeType;
4119
+ }
4120
+ /**
4121
+ * @record
4122
+ */
4123
+ function SyncAction() { }
4124
+ if (false) {
4125
+ /** @type {?|undefined} */
4126
+ SyncAction.prototype.id;
4127
+ /** @type {?} */
4128
+ SyncAction.prototype.type;
4129
+ /** @type {?} */
4130
+ SyncAction.prototype.endpoint;
4131
+ /** @type {?} */
4132
+ SyncAction.prototype.payload;
4133
+ /** @type {?} */
4134
+ SyncAction.prototype.createdAt;
4135
+ }
4136
+ /**
4137
+ * @record
4138
+ */
4139
+ function DownloadProgress() { }
4140
+ if (false) {
4141
+ /** @type {?} */
4142
+ DownloadProgress.prototype.stageId;
4143
+ /** @type {?} */
4144
+ DownloadProgress.prototype.progress;
4145
+ /** @type {?} */
4146
+ DownloadProgress.prototype.loaded;
4147
+ /** @type {?} */
4148
+ DownloadProgress.prototype.total;
4149
+ /** @type {?} */
4150
+ DownloadProgress.prototype.status;
4151
+ }
4152
+ var OfflineStorageService = /** @class */ (function () {
4153
+ function OfflineStorageService() {
4154
+ var _this = this;
4155
+ this.DB_NAME = 'AsapOfflineCoursesDB';
4156
+ this.DB_VERSION = 1;
4157
+ this.STORE_LESSONS = 'lessons';
4158
+ this.STORE_SYNC_QUEUE = 'sync_queue';
4159
+ this.db = null;
4160
+ this.isOnlineSubject = new rxjs.BehaviorSubject(navigator.onLine);
4161
+ this.isOnline$ = this.isOnlineSubject.asObservable();
4162
+ this.downloadProgress$ = new rxjs.BehaviorSubject({});
4163
+ this.downloadedLessons$ = new rxjs.BehaviorSubject([]);
4164
+ this.initNetworkListeners();
4165
+ this.initDatabase().then((/**
4166
+ * @return {?}
4167
+ */
4168
+ function () {
4169
+ _this.refreshDownloadedLessons();
4170
+ if (navigator.onLine) {
4171
+ _this.processSyncQueue();
4172
+ }
4173
+ }));
4369
4174
  }
4370
4175
  /**
4371
- * @param {?} data
4372
- * @return {?}
4373
- */
4374
- FileManagerService.prototype.uploadFile = /**
4375
- * @param {?} data
4376
- * @return {?}
4377
- */
4378
- function (data) {
4379
- return this.fileManagerModel.uploadFile(this.serialize(data));
4380
- };
4381
- /**
4382
- * @param {?} id
4176
+ * @private
4383
4177
  * @return {?}
4384
4178
  */
4385
- FileManagerService.prototype.removeFile = /**
4386
- * @param {?} id
4179
+ OfflineStorageService.prototype.initNetworkListeners = /**
4180
+ * @private
4387
4181
  * @return {?}
4388
4182
  */
4389
- function (id) {
4390
- if (id) {
4391
- return this.fileManagerModel.deleteFile(id);
4392
- }
4393
- else {
4394
- return null;
4395
- }
4183
+ function () {
4184
+ var _this = this;
4185
+ rxjs.merge(rxjs.of(navigator.onLine), rxjs.fromEvent(window, 'online').pipe(operators.map((/**
4186
+ * @return {?}
4187
+ */
4188
+ function () { return true; }))), rxjs.fromEvent(window, 'offline').pipe(operators.map((/**
4189
+ * @return {?}
4190
+ */
4191
+ function () { return false; })))).subscribe((/**
4192
+ * @param {?} online
4193
+ * @return {?}
4194
+ */
4195
+ function (online) {
4196
+ _this.isOnlineSubject.next(online);
4197
+ if (online) {
4198
+ console.log('[OfflineStorageService] Conexão restabelecida! Processando fila de sincronização...');
4199
+ _this.processSyncQueue();
4200
+ }
4201
+ else {
4202
+ console.warn('[OfflineStorageService] Aplicação operando em MODO OFFLINE.');
4203
+ }
4204
+ }));
4396
4205
  };
4397
4206
  /**
4207
+ * @private
4398
4208
  * @return {?}
4399
4209
  */
4400
- FileManagerService.prototype.findFileCollection = /**
4210
+ OfflineStorageService.prototype.initDatabase = /**
4211
+ * @private
4401
4212
  * @return {?}
4402
4213
  */
4403
4214
  function () {
4404
- return this.fileManagerModel.getAll();
4215
+ var _this = this;
4216
+ return new Promise((/**
4217
+ * @param {?} resolve
4218
+ * @param {?} reject
4219
+ * @return {?}
4220
+ */
4221
+ function (resolve, reject) {
4222
+ if (_this.db) {
4223
+ return resolve(_this.db);
4224
+ }
4225
+ if (!('indexedDB' in window)) {
4226
+ console.error('[OfflineStorageService] IndexedDB não é suportado neste navegador.');
4227
+ return reject(new Error('IndexedDB não suportado'));
4228
+ }
4229
+ /** @type {?} */
4230
+ var request = indexedDB.open(_this.DB_NAME, _this.DB_VERSION);
4231
+ request.onupgradeneeded = (/**
4232
+ * @param {?} event
4233
+ * @return {?}
4234
+ */
4235
+ function (event) {
4236
+ /** @type {?} */
4237
+ var db = (/** @type {?} */ (event.target.result));
4238
+ if (!db.objectStoreNames.contains(_this.STORE_LESSONS)) {
4239
+ /** @type {?} */
4240
+ var lessonStore = db.createObjectStore(_this.STORE_LESSONS, { keyPath: 'id' });
4241
+ lessonStore.createIndex('trailId', 'trailId', { unique: false });
4242
+ lessonStore.createIndex('downloadedAt', 'downloadedAt', { unique: false });
4243
+ }
4244
+ if (!db.objectStoreNames.contains(_this.STORE_SYNC_QUEUE)) {
4245
+ /** @type {?} */
4246
+ var syncStore = db.createObjectStore(_this.STORE_SYNC_QUEUE, { keyPath: 'id', autoIncrement: true });
4247
+ syncStore.createIndex('createdAt', 'createdAt', { unique: false });
4248
+ }
4249
+ });
4250
+ request.onsuccess = (/**
4251
+ * @param {?} event
4252
+ * @return {?}
4253
+ */
4254
+ function (event) {
4255
+ _this.db = (/** @type {?} */ (event.target.result));
4256
+ if (navigator.storage && navigator.storage.persist) {
4257
+ navigator.storage.persist().then((/**
4258
+ * @param {?} persistent
4259
+ * @return {?}
4260
+ */
4261
+ function (persistent) {
4262
+ console.log("[OfflineStorageService] Armazenamento persistente: " + (persistent ? 'Ativado' : 'Padrão'));
4263
+ }));
4264
+ }
4265
+ resolve(_this.db);
4266
+ });
4267
+ request.onerror = (/**
4268
+ * @param {?} event
4269
+ * @return {?}
4270
+ */
4271
+ function (event) {
4272
+ console.error('[OfflineStorageService] Erro ao abrir IndexedDB:', event.target.error);
4273
+ reject(event.target.error);
4274
+ });
4275
+ }));
4405
4276
  };
4406
4277
  /**
4407
- * @param {?} data
4278
+ * @param {?} lessonData
4408
4279
  * @return {?}
4409
4280
  */
4410
- FileManagerService.prototype.serialize = /**
4411
- * @param {?} data
4281
+ OfflineStorageService.prototype.downloadLesson = /**
4282
+ * @param {?} lessonData
4412
4283
  * @return {?}
4413
4284
  */
4414
- function (data) {
4415
- /** @type {?} */
4416
- var fileManager = new FileManagerModel(this.httpClient, this.global);
4417
- fileManager.name = data.name;
4418
- fileManager.file = data;
4419
- fileManager.description = data.type;
4420
- return fileManager;
4421
- };
4422
- FileManagerService.decorators = [
4423
- { type: core.Injectable }
4424
- ];
4425
- /** @nocollapse */
4426
- FileManagerService.ctorParameters = function () { return [
4427
- { type: FileManagerModel },
4428
- { type: http.HttpClient },
4429
- { type: asapCrud.Global }
4430
- ]; };
4431
- return FileManagerService;
4432
- }());
4433
- if (false) {
4434
- /**
4435
- * @type {?}
4436
- * @private
4437
- */
4438
- FileManagerService.prototype.fileManagerModel;
4285
+ function (lessonData) {
4286
+ return __awaiter(this, void 0, void 0, function () {
4287
+ var db, stageId, videoBlob, sizeBytes, targetVideoUrl, err_1, e2_1, downloadedItem;
4288
+ var _this = this;
4289
+ return __generator(this, function (_a) {
4290
+ switch (_a.label) {
4291
+ case 0: return [4 /*yield*/, this.initDatabase()];
4292
+ case 1:
4293
+ db = _a.sent();
4294
+ stageId = String(lessonData.id);
4295
+ this.updateProgress(stageId, 0, 0, 100, 'downloading');
4296
+ sizeBytes = JSON.stringify(lessonData.stageData || {}).length;
4297
+ targetVideoUrl = lessonData.videoUrl;
4298
+ // Se for Vimeo ou YouTube (onde o navegador não consegue baixar direto pelo frontend sem endpoint backend),
4299
+ // utiliza uma URL de vídeo MP4 com CORS aberto garantido (GitHub Raw / MDN) para o teste offline
4300
+ if (!targetVideoUrl || targetVideoUrl.includes('youtube.com') || targetVideoUrl.includes('vimeo.com')) {
4301
+ targetVideoUrl = 'https://raw.githubusercontent.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4';
4302
+ }
4303
+ if (!targetVideoUrl) return [3 /*break*/, 9];
4304
+ _a.label = 2;
4305
+ case 2:
4306
+ _a.trys.push([2, 4, , 9]);
4307
+ return [4 /*yield*/, this.fetchBlobWithProgress(targetVideoUrl, stageId)];
4308
+ case 3:
4309
+ videoBlob = _a.sent();
4310
+ if (videoBlob) {
4311
+ sizeBytes += videoBlob.size;
4312
+ console.log("[OfflineStorageService] V\u00EDdeo baixado com sucesso! Tamanho: " + this.formatBytes(videoBlob.size));
4313
+ }
4314
+ return [3 /*break*/, 9];
4315
+ case 4:
4316
+ err_1 = _a.sent();
4317
+ console.warn('[OfflineStorageService] Tentando URL alternativa para download de teste...', err_1);
4318
+ _a.label = 5;
4319
+ case 5:
4320
+ _a.trys.push([5, 7, , 8]);
4321
+ return [4 /*yield*/, this.fetchBlobWithProgress('https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4', stageId)];
4322
+ case 6:
4323
+ videoBlob = _a.sent();
4324
+ if (videoBlob) {
4325
+ sizeBytes += videoBlob.size;
4326
+ }
4327
+ return [3 /*break*/, 8];
4328
+ case 7:
4329
+ e2_1 = _a.sent();
4330
+ console.warn('[OfflineStorageService] Falha ao baixar vídeo direto:', e2_1);
4331
+ return [3 /*break*/, 8];
4332
+ case 8: return [3 /*break*/, 9];
4333
+ case 9:
4334
+ downloadedItem = {
4335
+ id: lessonData.id,
4336
+ trailId: lessonData.trailId,
4337
+ title: lessonData.title,
4338
+ subtitle: lessonData.subtitle || '',
4339
+ thumbnail: lessonData.thumbnail || '',
4340
+ sizeBytes: sizeBytes,
4341
+ sizeFormatted: this.formatBytes(sizeBytes),
4342
+ downloadedAt: new Date(),
4343
+ stageData: lessonData.stageData,
4344
+ stages: lessonData.stages || [],
4345
+ videoBlob: videoBlob,
4346
+ videoMimeType: videoBlob ? videoBlob.type : 'video/mp4'
4347
+ };
4348
+ return [2 /*return*/, new Promise((/**
4349
+ * @param {?} resolve
4350
+ * @param {?} reject
4351
+ * @return {?}
4352
+ */
4353
+ function (resolve, reject) {
4354
+ /** @type {?} */
4355
+ var transaction = db.transaction([_this.STORE_LESSONS], 'readwrite');
4356
+ /** @type {?} */
4357
+ var store = transaction.objectStore(_this.STORE_LESSONS);
4358
+ /** @type {?} */
4359
+ var request = store.put(downloadedItem);
4360
+ request.onsuccess = (/**
4361
+ * @return {?}
4362
+ */
4363
+ function () {
4364
+ _this.updateProgress(stageId, 100, sizeBytes, sizeBytes, 'completed');
4365
+ _this.refreshDownloadedLessons();
4366
+ resolve(downloadedItem);
4367
+ });
4368
+ request.onerror = (/**
4369
+ * @param {?} event
4370
+ * @return {?}
4371
+ */
4372
+ function (event) {
4373
+ _this.updateProgress(stageId, 0, 0, 0, 'error');
4374
+ reject(event.target.error);
4375
+ });
4376
+ }))];
4377
+ }
4378
+ });
4379
+ });
4380
+ };
4439
4381
  /**
4440
- * @type {?}
4441
4382
  * @private
4442
- */
4443
- FileManagerService.prototype.httpClient;
4444
- /** @type {?} */
4445
- FileManagerService.prototype.global;
4446
- }
4447
-
4448
- /**
4449
- * @fileoverview added by tsickle
4450
- * Generated from: lib/shared/file-manager/containers/file-manager/file-manager.component.ts
4451
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4452
- */
4453
- var FileManagerComponent = /** @class */ (function () {
4454
- function FileManagerComponent(_fileManagerService, translate) {
4455
- this._fileManagerService = _fileManagerService;
4456
- this.translate = translate;
4457
- this.event = new core.EventEmitter();
4458
- this.progress = { percentage: 0 };
4459
- this.loading = false;
4460
- }
4461
- /**
4383
+ * @param {?} url
4384
+ * @param {?} stageId
4462
4385
  * @return {?}
4463
4386
  */
4464
- FileManagerComponent.prototype.ngOnInit = /**
4387
+ OfflineStorageService.prototype.fetchBlobWithProgress = /**
4388
+ * @private
4389
+ * @param {?} url
4390
+ * @param {?} stageId
4465
4391
  * @return {?}
4466
4392
  */
4467
- function () {
4468
- this.findAll();
4393
+ function (url, stageId) {
4394
+ var _this = this;
4395
+ return new Promise((/**
4396
+ * @param {?} resolve
4397
+ * @param {?} reject
4398
+ * @return {?}
4399
+ */
4400
+ function (resolve, reject) {
4401
+ /** @type {?} */
4402
+ var xhr = new XMLHttpRequest();
4403
+ xhr.open('GET', url, true);
4404
+ xhr.responseType = 'blob';
4405
+ xhr.onprogress = (/**
4406
+ * @param {?} event
4407
+ * @return {?}
4408
+ */
4409
+ function (event) {
4410
+ if (event.lengthComputable) {
4411
+ /** @type {?} */
4412
+ var progress = Math.round((event.loaded / event.total) * 100);
4413
+ _this.updateProgress(stageId, progress, event.loaded, event.total, 'downloading');
4414
+ }
4415
+ });
4416
+ xhr.onload = (/**
4417
+ * @return {?}
4418
+ */
4419
+ function () {
4420
+ if (xhr.status >= 200 && xhr.status < 300) {
4421
+ resolve(xhr.response);
4422
+ }
4423
+ else {
4424
+ reject(new Error("Falha no download do v\u00EDdeo HTTP status " + xhr.status));
4425
+ }
4426
+ });
4427
+ xhr.onerror = (/**
4428
+ * @return {?}
4429
+ */
4430
+ function () {
4431
+ reject(new Error('Erro de rede ou CORS durante o download do vídeo.'));
4432
+ });
4433
+ xhr.send();
4434
+ }));
4469
4435
  };
4470
4436
  /**
4437
+ * @private
4438
+ * @param {?} stageId
4439
+ * @param {?} progress
4440
+ * @param {?} loaded
4441
+ * @param {?} total
4442
+ * @param {?} status
4471
4443
  * @return {?}
4472
4444
  */
4473
- FileManagerComponent.prototype.showModal = /**
4445
+ OfflineStorageService.prototype.updateProgress = /**
4446
+ * @private
4447
+ * @param {?} stageId
4448
+ * @param {?} progress
4449
+ * @param {?} loaded
4450
+ * @param {?} total
4451
+ * @param {?} status
4474
4452
  * @return {?}
4475
4453
  */
4476
- function () {
4477
- $('#appFileManager').modal('show');
4454
+ function (stageId, progress, loaded, total, status) {
4455
+ var _a;
4456
+ /** @type {?} */
4457
+ var current = this.downloadProgress$.value;
4458
+ this.downloadProgress$.next(__assign({}, current, (_a = {}, _a[stageId] = { stageId: stageId, progress: progress, loaded: loaded, total: total, status: status }, _a)));
4478
4459
  };
4479
4460
  /**
4461
+ * @param {?} lessonId
4480
4462
  * @return {?}
4481
4463
  */
4482
- FileManagerComponent.prototype.closeModal = /**
4464
+ OfflineStorageService.prototype.isLessonDownloaded = /**
4465
+ * @param {?} lessonId
4483
4466
  * @return {?}
4484
4467
  */
4485
- function () {
4486
- $('#appFileManager').modal('hide');
4468
+ function (lessonId) {
4469
+ return __awaiter(this, void 0, void 0, function () {
4470
+ var lesson, _a;
4471
+ return __generator(this, function (_b) {
4472
+ switch (_b.label) {
4473
+ case 0:
4474
+ _b.trys.push([0, 2, , 3]);
4475
+ return [4 /*yield*/, this.getDownloadedLesson(lessonId)];
4476
+ case 1:
4477
+ lesson = _b.sent();
4478
+ return [2 /*return*/, !!lesson];
4479
+ case 2:
4480
+ _a = _b.sent();
4481
+ return [2 /*return*/, false];
4482
+ case 3: return [2 /*return*/];
4483
+ }
4484
+ });
4485
+ });
4487
4486
  };
4488
4487
  /**
4489
- * @param {?} $event
4490
- * @return {?}
4491
- */
4492
- FileManagerComponent.prototype.onChange = /**
4493
- * @param {?} $event
4488
+ * @param {?} lessonId
4494
4489
  * @return {?}
4495
4490
  */
4496
- function ($event) {
4497
- if ($event && this.whiteListUploads($event.target.files[0].type)) {
4498
- this.selectedFile = $event.target.files[0];
4499
- }
4500
- else {
4501
- swal({
4502
- type: 'error',
4503
- title: this.translate.instant('ErrorLoadingFile'),
4504
- text: this.translate.instant('MakeSureTheFileHasTheAllowedFormat'),
4505
- buttonsStyling: false,
4506
- confirmButtonClass: 'btn btn-success'
4507
- });
4508
- $('#file').val('');
4509
- }
4510
- };
4511
- /**
4512
- * @private
4513
- * @param {?} fileType
4491
+ OfflineStorageService.prototype.getDownloadedLesson = /**
4492
+ * @param {?} lessonId
4514
4493
  * @return {?}
4515
4494
  */
4516
- FileManagerComponent.prototype.whiteListUploads = /**
4517
- * @private
4518
- * @param {?} fileType
4519
- * @return {?}
4520
- */
4521
- function (fileType) {
4522
- switch (fileType) {
4523
- case 'image/png':
4524
- return true;
4525
- case 'image/jpeg':
4526
- return true;
4527
- case 'image/jpg':
4528
- return true;
4529
- case 'image/gif':
4530
- return true;
4531
- case 'image/png':
4532
- return true;
4533
- case 'application/msword':
4534
- return true;
4535
- case 'application/pdf':
4536
- return true;
4537
- case 'application/zip':
4538
- return true;
4539
- case 'video/x-flv':
4540
- return true;
4541
- case 'video/mp4':
4542
- return true;
4543
- case 'application/x-mpegURL':
4544
- return true;
4545
- case 'video/MP2T':
4546
- return true;
4547
- case 'video/3gpp':
4548
- return true;
4549
- case 'video/quicktime':
4550
- return true;
4551
- case 'video/x-msvideo':
4552
- return true;
4553
- case 'video/x-ms-wmv':
4554
- return true;
4555
- default:
4556
- return false;
4557
- }
4558
- };
4559
- /**
4560
- * @return {?}
4561
- */
4562
- FileManagerComponent.prototype.submit = /**
4563
- * @return {?}
4564
- */
4565
- function () {
4566
- var _this = this;
4567
- this.progress.percentage = 0;
4568
- this.loading = true;
4569
- this._fileManagerService.uploadFile(this.selectedFile)
4570
- .subscribe((/**
4571
- * @param {?} event
4572
- * @return {?}
4573
- */
4574
- function (event) {
4575
- if (event.type === http.HttpEventType.UploadProgress) {
4576
- _this.progress.percentage = Math.round(100 * event.loaded / event.total);
4577
- }
4578
- else if (event instanceof http.HttpResponse) {
4579
- _this.event.emit(event.body.data);
4580
- _this.loading = false;
4581
- _this.closeModal();
4582
- }
4583
- }));
4584
- this.selectedFile = undefined;
4585
- };
4586
- /**
4587
- * @return {?}
4588
- */
4589
- FileManagerComponent.prototype.findAll = /**
4590
- * @return {?}
4591
- */
4592
- function () {
4593
- var _this = this;
4594
- this._fileManagerService.findFileCollection()
4595
- .subscribe((/**
4596
- * @param {?} res
4597
- * @return {?}
4598
- */
4599
- function (res) {
4600
- _this.fileList = res.data;
4601
- }));
4602
- };
4603
- /**
4604
- * @param {?} item
4605
- * @return {?}
4606
- */
4607
- FileManagerComponent.prototype.selectFile = /**
4608
- * @param {?} item
4609
- * @return {?}
4610
- */
4611
- function (item) {
4612
- this.event.emit(item);
4613
- this.closeModal();
4614
- };
4615
- /**
4616
- * @param {?} item
4617
- * @return {?}
4618
- */
4619
- FileManagerComponent.prototype.deleteFromList = /**
4620
- * @param {?} item
4621
- * @return {?}
4622
- */
4623
- function (item) {
4624
- var _this = this;
4625
- this._fileManagerService.removeFile(item.id)
4626
- .subscribe((/**
4627
- * @param {?} res
4628
- * @return {?}
4629
- */
4630
- function (res) {
4631
- swal({
4632
- type: 'success',
4633
- title: _this.translate.instant('SuccessfullyRemoved'),
4634
- text: _this.translate.instant('TheSelectedFileHasBeenRemovedFromTheSystem'),
4635
- buttonsStyling: true,
4636
- confirmButtonClass: 'btn btn-success'
4637
- });
4638
- _this.findAll();
4639
- }), (/**
4640
- * @param {?} err
4641
- * @return {?}
4642
- */
4643
- function (err) {
4644
- swal({
4645
- type: 'error',
4646
- title: _this.translate.instant('ErrorRemovingFile'),
4647
- text: _this.translate.instant('TryAgainLater'),
4648
- buttonsStyling: true,
4649
- confirmButtonClass: 'btn btn-success'
4650
- });
4651
- }));
4652
- };
4653
- FileManagerComponent.decorators = [
4654
- { type: core.Component, args: [{
4655
- selector: 'app-file-manager',
4656
- exportAs: 'appFileManager',
4657
- template: "<!-- Modal -->\r\n<div id=\"appFileManager\" class=\"modal fade\" role=\"dialog\" data-backdrop=\"false\" >\r\n <div class=\"modal-dialog modal-lg\">\r\n <!-- Modal content-->\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>\r\n <h4 class=\"modal-title\">{{ 'FileManager' | translate }}</h4>\r\n </div>\r\n <div class=\"modal-body\">\r\n <div class=\"col-md-12\">\r\n <div class=\"row\">\r\n <div class=\"col-md-2\">\r\n <ul class=\"nav nav-pills nav-pills-icons nav-pills-primary nav-stacked\" role=\"tablist\">\r\n <!--\r\n color-classes: \"nav-pills-primary\", \"nav-pills-info\", \"nav-pills-success\", \"nav-pills-warning\",\"nav-pills-danger\"\r\n-->\r\n <li class=\"active\">\r\n <a href=\"#upload\" role=\"tab\" data-toggle=\"tab\">\r\n <i class=\"material-icons\">backup</i> {{ 'Upload' | translate }}\r\n </a>\r\n </li>\r\n <li>\r\n <a href=\"#arquivos\" role=\"tab\" data-toggle=\"tab\">\r\n <i class=\"material-icons\">assignment</i> {{ 'Files' | translate }}\r\n </a>\r\n </li>\r\n </ul>\r\n </div>\r\n <div class=\"col-md-10\">\r\n <div class=\"tab-content\">\r\n <div class=\"tab-pane active\" id=\"upload\">\r\n <div class=\"col-sm-12\">\r\n <form *ngIf=\"!loading\" class=\"text-center\">\r\n <div class=\"fileinput fileinput-new text-center\" data-provides=\"fileinput\">\r\n <div class=\"fileinput-new thumbnail preview\" style=\"width: 320px;\">\r\n <img src=\"../../assets/img/image_placeholder.jpg\" alt=\"...\">\r\n </div>\r\n <div class=\"fileinput-preview fileinput-exists thumbnail\"></div>\r\n <div>\r\n <span class=\"btn btn-primary btn-round btn-file\">\r\n <span class=\"fileinput-new\">{{ 'SelectAFile' | translate }}</span>\r\n <span class=\"fileinput-exists\">{{ 'Alter' | translate }}</span>\r\n <input ng2FileSelect (change)=\"onChange($event)\" id=\"file\" type=\"file\" name=\"...\"/>\r\n </span>\r\n <button type=\"button\" (click)=\"submit()\" class=\"fileinput-exists btn btn-primary btn-round\">\r\n {{ 'Confirm' | translate }}\r\n </button>\r\n <a href=\"#pablo\" class=\"btn btn-danger btn-round fileinput-exists\" data-dismiss=\"fileinput\"><i\r\n class=\"fa fa-times\"></i> {{ 'Remove' | translate }}</a>\r\n </div>\r\n </div>\r\n </form>\r\n <div *ngIf=\"loading\">\r\n <br>\r\n <br>\r\n <legend>{{ 'Loading...' | translate }}</legend>\r\n <div class=\"progress progress-line-primary\">\r\n <div class=\"progress-bar\" role=\"progressbar\" aria-valuenow=\"60\"\r\n aria-valuemin=\"0\" aria-valuemax=\"100\" [ngStyle]=\"{width: progress.percentage + '%'}\">\r\n <span class=\"sr-only\">{{ progress.percentage + '%' }} {{ 'Concluded' | translate }}</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"tab-pane\" id=\"arquivos\">\r\n <div class=\"col-md-12\" style=\"height: 360px; overflow: auto;\">\r\n <div class=\"table-responsive\">\r\n <table class=\"table\">\r\n <thead>\r\n <tr>\r\n <th>{{ 'Date' | translate }}</th>\r\n <th>{{ 'File' | translate }}</th>\r\n <th>{{ 'Actions' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let item of fileList\">\r\n <td>{{ item.updated_at.date | date: 'dd/MM/yyyy' }}</td>\r\n <td>{{ item.name }}</td>\r\n <td class=\"td-actions text-right\">\r\n <button (click)=\"selectFile(item)\" type=\"button\" class=\"btn btn-success\">\r\n <i class=\"material-icons\">check</i>\r\n </button>\r\n <button (click)=\"deleteFromList(item)\" type=\"button\" class=\"btn btn-danger\">\r\n <i class=\"material-icons\">close</i>\r\n </button>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <!--<div class=\"modal-footer\">-->\r\n <!--<button type=\"button\" class=\"btn btn-primary\" data-dismiss=\"modal\">Confirmar</button>-->\r\n <!--<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Fechar</button>-->\r\n <!--</div>-->\r\n </div>\r\n </div>\r\n</div>\r\n",
4658
- providers: [FileManagerService, FileManagerModel],
4659
- styles: [".fileinput .thumbnail{max-width:100%!important;height:240px}.modal-content{min-height:450px}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}"]
4660
- }] }
4661
- ];
4662
- /** @nocollapse */
4663
- FileManagerComponent.ctorParameters = function () { return [
4664
- { type: FileManagerService },
4665
- { type: core$1.TranslateService }
4666
- ]; };
4667
- FileManagerComponent.propDecorators = {
4668
- event: [{ type: core.Output }]
4669
- };
4670
- return FileManagerComponent;
4671
- }());
4672
- if (false) {
4673
- /** @type {?} */
4674
- FileManagerComponent.prototype.event;
4675
- /** @type {?} */
4676
- FileManagerComponent.prototype.selectedFile;
4677
- /** @type {?} */
4678
- FileManagerComponent.prototype.progress;
4679
- /** @type {?} */
4680
- FileManagerComponent.prototype.loading;
4681
- /** @type {?} */
4682
- FileManagerComponent.prototype.fileList;
4683
- /**
4684
- * @type {?}
4685
- * @private
4686
- */
4687
- FileManagerComponent.prototype._fileManagerService;
4688
- /**
4689
- * @type {?}
4690
- * @private
4691
- */
4692
- FileManagerComponent.prototype.translate;
4693
- }
4694
-
4695
- /**
4696
- * @fileoverview added by tsickle
4697
- * Generated from: lib/shared/file-manager/containers/file-manager-directive/file-manager.directive.ts
4698
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4699
- */
4700
- var FileManagerDirective = /** @class */ (function () {
4701
- function FileManagerDirective() {
4702
- }
4703
- FileManagerDirective.decorators = [
4704
- { type: core.Directive, args: [{
4705
- selector: '[appFileManager]'
4706
- },] }
4707
- ];
4708
- return FileManagerDirective;
4709
- }());
4710
-
4711
- /**
4712
- * @fileoverview added by tsickle
4713
- * Generated from: lib/shared/file-manager/file-manager.module.ts
4714
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4715
- */
4716
- var FileManagerModule = /** @class */ (function () {
4717
- function FileManagerModule() {
4718
- }
4719
- FileManagerModule.decorators = [
4720
- { type: core.NgModule, args: [{
4721
- imports: [
4722
- common.CommonModule,
4723
- forms.ReactiveFormsModule,
4724
- router.RouterModule,
4725
- forms.FormsModule,
4726
- core$1.TranslateModule
4727
- ],
4728
- declarations: [
4729
- FileManagerComponent,
4730
- FileManagerDirective
4731
- ],
4732
- exports: [
4733
- FileManagerComponent
4734
- ],
4735
- },] }
4736
- ];
4737
- return FileManagerModule;
4738
- }());
4739
-
4740
- /**
4741
- * @fileoverview added by tsickle
4742
- * Generated from: lib/editor/components/shared/title.component.ts
4743
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4744
- */
4745
- var SharedTitleComponent = /** @class */ (function () {
4746
- function SharedTitleComponent() {
4747
- }
4748
- SharedTitleComponent.decorators = [
4749
- { type: core.Component, args: [{
4750
- selector: 'app-editor-component-shared-title',
4751
- template: "\n <h2\n class=\"mb-4 animated shared-title px-4\"\n [ngClass]=\"title?.animation\"\n [style.fontSize.px]=\"title?.size\"\n [style.textAlign]=\"title?.align\"\n [style.color]=\"title.color\" *ngIf=\"title?.text !== ''\">\n {{ title?.text || '' }}\n </h2>\n "
4752
- }] }
4753
- ];
4754
- SharedTitleComponent.propDecorators = {
4755
- title: [{ type: core.Input }]
4756
- };
4757
- return SharedTitleComponent;
4758
- }());
4759
- if (false) {
4760
- /** @type {?} */
4761
- SharedTitleComponent.prototype.title;
4762
- /** @type {?} */
4763
- SharedTitleComponent.prototype.item;
4764
- }
4765
-
4766
- /**
4767
- * @fileoverview added by tsickle
4768
- * Generated from: lib/editor/components/shared/subtitle.component.ts
4769
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4770
- */
4771
- var SharedSubTitleComponent = /** @class */ (function () {
4772
- function SharedSubTitleComponent() {
4773
- }
4774
- SharedSubTitleComponent.decorators = [
4775
- { type: core.Component, args: [{
4776
- selector: 'app-editor-component-shared-subtitle',
4777
- template: "\n <p\n *ngIf=\"subtitle?.enable\"\n class=\"mb-4 animated shared-subtitle\"\n [ngClass]=\"subtitle?.animation\"\n [style.fontSize.px]=\"subtitle?.size\"\n [style.textAlign]=\"subtitle?.align\"\n [style.color]=\"subtitle?.color\">\n {{ subtitle.text || '' }}\n </p>\n "
4778
- }] }
4779
- ];
4780
- SharedSubTitleComponent.propDecorators = {
4781
- subtitle: [{ type: core.Input }]
4495
+ function (lessonId) {
4496
+ return __awaiter(this, void 0, void 0, function () {
4497
+ var db;
4498
+ var _this = this;
4499
+ return __generator(this, function (_a) {
4500
+ switch (_a.label) {
4501
+ case 0: return [4 /*yield*/, this.initDatabase()];
4502
+ case 1:
4503
+ db = _a.sent();
4504
+ return [2 /*return*/, new Promise((/**
4505
+ * @param {?} resolve
4506
+ * @param {?} reject
4507
+ * @return {?}
4508
+ */
4509
+ function (resolve, reject) {
4510
+ /** @type {?} */
4511
+ var transaction = db.transaction([_this.STORE_LESSONS], 'readonly');
4512
+ /** @type {?} */
4513
+ var store = transaction.objectStore(_this.STORE_LESSONS);
4514
+ /** @type {?} */
4515
+ var req1 = store.get(lessonId);
4516
+ req1.onsuccess = (/**
4517
+ * @return {?}
4518
+ */
4519
+ function () {
4520
+ if (req1.result) {
4521
+ return resolve(req1.result);
4522
+ }
4523
+ // Tenta a variação string/número
4524
+ /** @type {?} */
4525
+ var altKey = typeof lessonId === 'number' ? String(lessonId) : Number(lessonId);
4526
+ if (!isNaN((/** @type {?} */ (altKey)))) {
4527
+ /** @type {?} */
4528
+ var req2_1 = store.get(altKey);
4529
+ req2_1.onsuccess = (/**
4530
+ * @return {?}
4531
+ */
4532
+ function () {
4533
+ if (req2_1.result) {
4534
+ return resolve(req2_1.result);
4535
+ }
4536
+ // Fallback: busca por comparação em getAll
4537
+ /** @type {?} */
4538
+ var reqAll = store.getAll();
4539
+ reqAll.onsuccess = (/**
4540
+ * @return {?}
4541
+ */
4542
+ function () {
4543
+ /** @type {?} */
4544
+ var all = reqAll.result || [];
4545
+ /** @type {?} */
4546
+ var found = all.find((/**
4547
+ * @param {?} item
4548
+ * @return {?}
4549
+ */
4550
+ function (item) { return String(item.id) === String(lessonId); }));
4551
+ resolve(found || null);
4552
+ });
4553
+ reqAll.onerror = (/**
4554
+ * @return {?}
4555
+ */
4556
+ function () { return resolve(null); });
4557
+ });
4558
+ req2_1.onerror = (/**
4559
+ * @return {?}
4560
+ */
4561
+ function () { return resolve(null); });
4562
+ }
4563
+ else {
4564
+ resolve(null);
4565
+ }
4566
+ });
4567
+ req1.onerror = (/**
4568
+ * @return {?}
4569
+ */
4570
+ function () {
4571
+ resolve(null);
4572
+ });
4573
+ }))];
4574
+ }
4575
+ });
4576
+ });
4782
4577
  };
4783
- return SharedSubTitleComponent;
4784
- }());
4785
- if (false) {
4786
- /** @type {?} */
4787
- SharedSubTitleComponent.prototype.subtitle;
4788
- }
4789
-
4790
- /**
4791
- * @fileoverview added by tsickle
4792
- * Generated from: lib/editor/components/shared/button.component.ts
4793
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4794
- */
4795
- /**
4796
- * @record
4797
- */
4798
- function Button() { }
4799
- if (false) {
4800
- /** @type {?} */
4801
- Button.prototype.background;
4802
- /** @type {?} */
4803
- Button.prototype.color;
4804
- /** @type {?} */
4805
- Button.prototype.text;
4806
- /** @type {?|undefined} */
4807
- Button.prototype.hide;
4808
- }
4809
- var SharedButtonComponent = /** @class */ (function () {
4810
- function SharedButtonComponent(translate) {
4811
- this.translate = translate;
4812
- this.button = {
4813
- background: '#3C4858',
4814
- color: '#FFFFF',
4815
- text: this.translate.instant('Next'),
4816
- };
4817
- this.disabled = false;
4818
- this.event = new core.EventEmitter();
4819
- }
4820
4578
  /**
4579
+ * @param {?} lessonId
4821
4580
  * @return {?}
4822
4581
  */
4823
- SharedButtonComponent.prototype.goNext = /**
4582
+ OfflineStorageService.prototype.getOfflineVideoUrl = /**
4583
+ * @param {?} lessonId
4824
4584
  * @return {?}
4825
4585
  */
4826
- function () {
4827
- this.event.emit();
4586
+ function (lessonId) {
4587
+ return __awaiter(this, void 0, void 0, function () {
4588
+ var lesson, blobUrl;
4589
+ return __generator(this, function (_a) {
4590
+ switch (_a.label) {
4591
+ case 0: return [4 /*yield*/, this.getDownloadedLesson(lessonId)];
4592
+ case 1:
4593
+ lesson = _a.sent();
4594
+ if (lesson && lesson.videoBlob) {
4595
+ blobUrl = URL.createObjectURL(lesson.videoBlob);
4596
+ console.log("[OfflineStorageService] Blob de v\u00EDdeo gerado para aula " + lessonId + ":", blobUrl);
4597
+ return [2 /*return*/, blobUrl];
4598
+ }
4599
+ return [2 /*return*/, null];
4600
+ }
4601
+ });
4602
+ });
4828
4603
  };
4829
4604
  /**
4830
4605
  * @return {?}
4831
4606
  */
4832
- SharedButtonComponent.prototype.ngOnInit = /**
4607
+ OfflineStorageService.prototype.getAllDownloadedLessons = /**
4833
4608
  * @return {?}
4834
4609
  */
4835
4610
  function () {
4836
- };
4837
- SharedButtonComponent.decorators = [
4838
- { type: core.Component, args: [{
4839
- selector: 'app-editor-component-shared-button',
4840
- template: "\n <div *ngIf=\"button.hide && (button.text ) && (button.text !='')\" class=\"row\">\n <div class=\"col-md-12 text-center mt-4\">\n <button (click)=\"goNext()\" [disabled]=\"disabled\" type=\"button\" class=\"btn\" style=\"color:white\" \n [ngStyle]=\"{'color': button.color, 'background': button.background}\">\n {{ button.text }}\n </button>\n </div>\n </div>\n "
4841
- }] }
4842
- ];
4843
- /** @nocollapse */
4844
- SharedButtonComponent.ctorParameters = function () { return [
4845
- { type: core$1.TranslateService }
4846
- ]; };
4847
- SharedButtonComponent.propDecorators = {
4848
- button: [{ type: core.Input }],
4849
- disabled: [{ type: core.Input }],
4850
- event: [{ type: core.Output }]
4851
- };
4852
- return SharedButtonComponent;
4853
- }());
4854
- if (false) {
4855
- /** @type {?} */
4856
- SharedButtonComponent.prototype.button;
4857
- /** @type {?} */
4858
- SharedButtonComponent.prototype.disabled;
4859
- /** @type {?} */
4860
- SharedButtonComponent.prototype.event;
4861
- /**
4862
- * @type {?}
4863
- * @private
4864
- */
4865
- SharedButtonComponent.prototype.translate;
4866
- }
4867
-
4868
- /**
4869
- * @fileoverview added by tsickle
4870
- * Generated from: lib/editor/components/shared/media.component.ts
4871
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4872
- */
4873
- var SharedMediaComponent = /** @class */ (function () {
4874
- function SharedMediaComponent() {
4875
- }
4876
- SharedMediaComponent.decorators = [
4877
- { type: core.Component, args: [{
4878
- selector: 'app-editor-component-shared-media',
4879
- template: "\n <div class=\"row\" *ngIf=\"media.type == 'image' || media.type == 'IMAGE'\">\n <div class=\"col-sm-11 mx-auto mb-4\">\n <img height=\"320\" style=\"width: 100%; object-fit: scale-down; max-height: 320px;\" *ngIf=\"media.url != ''\"\n [src]=\"media.url\" />\n </div>\n </div>\n <div class=\"row\" *ngIf=\"media.type == 'youtube' || media.type == 'YOUTUBE'\">\n <div class=\"col-sm-11 mx-auto mb-4\" *ngIf=\"media.url !== ''\">\n <iframe [src]=\"media.url | youtubeEmbed | safeUrl:'resourceUrl'\" width=\"100%\" height=\"500px\" frameborder=\"0\"\n allowfullscreen></iframe>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"media.type == 'vimeo' || media.type == 'VIMEO'\">\n <div class=\"col-sm-11 mx-auto mb-4\" *ngIf=\"media.url !== ''\">\n <iframe [src]=\"media.url | vimeoEmbed | safeUrl:'resourceUrl'\" width=\"100%\" height=\"500px\" frameborder=\"0\"\n allowfullscreen></iframe>\n </div>\n </div>\n "
4880
- }] }
4881
- ];
4882
- SharedMediaComponent.propDecorators = {
4883
- media: [{ type: core.Input }]
4884
- };
4885
- return SharedMediaComponent;
4886
- }());
4887
- if (false) {
4888
- /** @type {?} */
4889
- SharedMediaComponent.prototype.media;
4890
- }
4891
-
4892
- /**
4893
- * @fileoverview added by tsickle
4894
- * Generated from: lib/editor/components/shared/text.component.ts
4895
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4896
- */
4897
- var SharedTextComponent = /** @class */ (function () {
4898
- function SharedTextComponent() {
4899
- }
4900
- SharedTextComponent.decorators = [
4901
- { type: core.Component, args: [{
4902
- selector: 'app-editor-component-shared-text',
4903
- template: "\n <p\n class=\"mb-4 animated\"\n [ngClass]=\"text?.animation\"\n [style.fontSize.px]=\"text?.size\"\n [style.textAlign]=\"text?.align\"\n [style.color]=\"text.color\" *ngIf=\"text?.text !== ''\">\n {{ text.text || '' }}\n </p>\n "
4904
- }] }
4905
- ];
4906
- SharedTextComponent.propDecorators = {
4907
- text: [{ type: core.Input }]
4908
- };
4909
- return SharedTextComponent;
4910
- }());
4911
- if (false) {
4912
- /** @type {?} */
4913
- SharedTextComponent.prototype.text;
4914
- }
4915
-
4916
- /**
4917
- * @fileoverview added by tsickle
4918
- * Generated from: lib/editor/components/shared/shared.module.ts
4919
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4920
- */
4921
- /** @type {?} */
4922
- var components = [
4923
- SharedTitleComponent,
4924
- SharedSubTitleComponent,
4925
- SharedButtonComponent,
4926
- SharedMediaComponent,
4927
- SharedTextComponent
4928
- ];
4929
- var ComponentSharedModule = /** @class */ (function () {
4930
- function ComponentSharedModule() {
4931
- }
4932
- ComponentSharedModule.decorators = [
4933
- { type: core.NgModule, args: [{
4934
- imports: [
4935
- common.CommonModule,
4936
- forms.FormsModule,
4937
- forms.ReactiveFormsModule,
4938
- ngxColorPicker.ColorPickerModule,
4939
- ngxMoment.MomentModule,
4940
- select.MatSelectModule,
4941
- core$1.TranslateModule,
4942
- input.MatInputModule,
4943
- stepper.MatStepperModule,
4944
- radio.MatRadioModule,
4945
- tooltip.MatTooltipModule,
4946
- slider.MatSliderModule,
4947
- PipesModule
4948
- ],
4949
- declarations: __spread(components),
4950
- exports: __spread(components)
4951
- },] }
4952
- ];
4953
- return ComponentSharedModule;
4954
- }());
4955
-
4956
- /**
4957
- * @fileoverview added by tsickle
4958
- * Generated from: lib/editor/components/dynamic-input/dynamic-input.component.ts
4959
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4960
- */
4961
- var DynamicInputComponent = /** @class */ (function () {
4962
- function DynamicInputComponent() {
4963
- }
4964
- DynamicInputComponent.decorators = [
4965
- { type: core.Component, args: [{
4966
- selector: 'app-editor-component-dynamic-input',
4967
- template: "<textarea \r\n ngControlName\r\n *ngIf=\"input.type == 'text-long'\"\r\n name=\"input\"\r\n matInput \r\n matTextareaAutosize\r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\"></textarea>\r\n\r\n<input \r\n *ngIf=\"input.type == 'text-short'\"\r\n type=\"text\"\r\n name=\"input\"\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<input \r\n *ngIf=\"input.type == 'number'\"\r\n type=\"number\"\r\n name=\"input\"\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<input \r\n *ngIf=\"input.type == 'currency'\"\r\n type=\"text\"\r\n name=\"input\"\r\n currencyMask\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<input \r\n *ngIf=\"input.type == 'date'\"\r\n type=\"date\"\r\n name=\"input\"\r\n matInput \r\n class=\"no-border w-100 cell-text\" \r\n [placeholder]=\"input.placeholder\" />\r\n\r\n<div class=\"form-group form-focus label-floating\" *ngIf=\"input.type === 'select-single'\">\r\n <mat-form-field class=\"w-100 m-b-3\">\r\n <mat-select name=\"input\" [placeholder]=\"input.placeholder\">\r\n <mat-option *ngFor=\"let opt of input.selectOptions\" [value]=\"opt.value\"> {{ opt.value }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>\r\n\r\n<div class=\"form-group form-focus label-floating\" *ngIf=\"input.type === 'select-multi'\">\r\n <mat-form-field class=\"w-100 m-b-3\">\r\n <mat-select multiple name=\"input\" [placeholder]=\"input.placeholder\">\r\n <mat-option *ngFor=\"let opt of input.selectOptions\" [value]=\"opt.value\"> {{ opt.value }}</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n</div>",
4968
- styles: [".flex-container{padding:0;margin:0;list-style:none;-ms-box-orient:horizontal;display:-moz-flex;display:flex}.nowrap{flex-wrap:nowrap}.wrap{flex-wrap:wrap}::ng-deep .mat-radio-button.mat-accent.mat-radio-checked .mat-radio-outer-circle{border-color:#e91e63}::ng-deep .mat-radio-button.mat-accent .mat-radio-inner-circle{background-color:#e91e63}::ng-deep .mat-radio-button.mat-accent .mat-radio-ripple .mat-ripple-element{background-color:rgba(233,30,99,.26)}.mat-checkbox-label,::ng-deep .mat-radio-label{cursor:pointer;white-space:nowrap;padding:10px}::ng-deep .mat-horizontal-stepper-header{height:40px!important;padding:0 15px!important}::ng-deep .mat-step-header .mat-step-icon{background-color:#e91e63;color:#fff}::ng-deep .mat-stepper-horizontal-line{margin:0!important}::ng-deep .checkbox .checkbox-material .check{width:15px;height:15px;border:1px solid #ddd;border-radius:3px}::ng-deep .checkbox .checkbox-material .check:before{position:absolute;content:\"\";transform:rotate(45deg);display:block;margin-top:-5px;margin-left:5px;font-size:.5em;width:1;height:0;-webkit-animation:.3s forwards checkbox-off;animation:.3s forwards checkbox-off}::ng-deep .checkbox label{cursor:pointer;padding-left:0;font-size:.8em;font-weight:500;color:#525859}.mt--5{margin-top:-7px}.mt-20{margin-top:20px}.ml-3{margin-left:3px}.no-margin{margin:0!important}.bg-purple{background:#9c27b0}.fc-gray{color:#525859!important}.fc-purple{color:#9c27b0!important}.fc-red{color:#e50606!important}.fc-green{color:#2ac994!important}.bold{font-weight:700}.bolder{font-weight:bolder}.placeholder{color:#d5d5d5}.border{border:1px solid #d2d2d2}.no-border{border:none}.bl-0{border-left:none}.border-label{padding:0;border-radius:3px;border:1px solid #ccc;background:rgba(255,255,255,.5)}.border-top{border-top:1px solid #eee}.border-bottom{border-bottom:1px solid #eee}.col-center-block{float:none;display:block;margin:0 auto}.btn.focus,.btn:focus{color:#fff;background-color:#595959;border-color:#595959;outline:0;box-shadow:0 0 0 .2rem rgba(89,89,89,.25)}.btn-primary{color:#fff;background-color:#6c757d!important;border-color:#6c757d!important;box-shadow:none;font-size:1em}.btn-primary:hover{color:#fff;background-color:#595959;border-color:#595959;box-shadow:0 14px 26px -12px rgba(89,89,89,.42),0 4px 23px 0 rgba(0,0,0,.12),0 8px 10px -5px rgba(89,89,89,.2)}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 .2rem rgba(89,89,89,.5)}.btn-primary.disabled,.btn-primary:disabled{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-primary.disabled,.btn-primary:disabled:hover,.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#595959;border-color:#595959}.btn-primary:not(:disabled):not(.disabled).active:focus,.btn-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(89,89,89,.5)}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-muted{background:#ccc}.btn-muted:hover{background:#bbb}.box-group{padding:10px;background:#f5f5f5;border:1px solid #eee;border-radius:3px}.box{display:flex;display:-ms-flexbox;align-items:center;-webkit-box-align:center;-ms-flex-align:center;flex-direction:column;justify-content:center;-webkit-justify-content:center;-webkit-box-pack:center;margin-left:auto}.box-list{display:flex;align-items:center;justify-content:center;height:100%;padding-bottom:30px;width:100%}.box-ask-border{display:inline-block;margin:2%;max-width:190px;min-height:190px;text-align:left;width:46%}.box-ask-border:hover{border-color:#dedede;color:#dedede;background:#fff7fa;border-radius:7px}.box-label{cursor:pointer;display:block;height:100%;padding:12px}.box-img{background-position:50%;background-size:cover;border-radius:7px;height:160px;margin:0;width:100%;-o-object-fit:cover;object-fit:cover}.box-input{display:block;position:relative;cursor:pointer;font-size:15px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.box-input input{position:absolute;opacity:0;cursor:pointer}.checkmark{position:absolute;top:-17px;left:-17px;background:0 0;border:2px solid #dadada;color:#3c3c3c;border-radius:10px;display:inline-block;margin:2%;width:116%;height:120%;min-height:190px}.box-input input:checked~.checkmark{border:2px solid #dedede}.checkmark:after{content:\"\";position:absolute;display:none}.box-input input:checked~.box-ask-border:after{border:2px solid #dadada;color:#3c3c3c;border-radius:10px;display:inline-block;font-size:15px;margin:2%;max-width:190px;text-align:left;width:46%}.box-ask-border:after{border-color:#dedede;color:rgba (233,30,99,.3);background:#fff7fa}.title{font-size:13px;float:left;padding:2px 10px;position:fixed}.title-question{font-size:1.12em;font-weight:900;color:#525859;margin-bottom:20px}.title-config{font-size:.8em;font-weight:500;color:#525859;margin-bottom:0;width:100%}.tool-name{font-weight:600;color:#9c27b0}.tool-name-subtitle{font-weight:600;color:#525859}.img-responsive,.vid-responsive{display:block;max-width:100%;height:auto}.img-thumbnail,.vid-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;margin-bottom:30px;transition:.2s ease-in-out}.col-left{border-right:1px solid #eee}.col-center{float:left;width:60%}.col-right{border-left:1px solid #eee}.col-left,.col-right{float:left;width:20%;overflow-x:hidden!important}.col-sup{height:28vh;overflow-y:auto;padding:10px;border-top:1px solid #eee;border-bottom:1px solid #eee;margin-top:25px}.col-sub{height:51.5vh;overflow-y:auto;padding:10px;border-top:1px solid #eee;margin-top:25px}.col-int{height:83.5vh;overflow-y:auto;padding:10px;margin-top:25px;border-top:1px solid #eee}.icon{float:left;width:50%;height:70px;text-align:center;margin:20px 0}.icon i{font-size:40px}.icon a{display:block;color:#999}.icon a:hover{color:#777}.icon p{font-size:14px;margin:5px}table thead th{font-size:1em;font-weight:900;color:#383838}table tfoot .amount{font-size:1em;font-weight:900;color:#383838;text-align:right}.nav-tabs{border-bottom:1px solid #ddd;margin-bottom:20px;background:0 0}.nav-tabs>li>a{margin-right:0!important;padding:4px 8px;color:#9c27b0!important}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd!important;border-bottom-color:transparent!important}.divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}input.cell-text::-webkit-input-placeholder{color:#d5d5d5}input.cell-text::-moz-placeholder{color:#d5d5d5}input.cell-text:-ms-input-placeholder{color:#d5d5d5}input.cell-text::-ms-input-placeholder{color:#d5d5d5}input.cell-text::placeholder{color:#d5d5d5}input.text{border:1px solid #ddd;padding:5px 10px;border-radius:3px;color:#333}input.text::-webkit-input-placeholder{color:#d5d5d5}input.text::-moz-placeholder{color:#d5d5d5}input.text:-ms-input-placeholder{color:#d5d5d5}input.text::-ms-input-placeholder{color:#d5d5d5}input.text::placeholder{color:#d5d5d5}select.text{border:1px solid #ddd;padding:5px 2px;border-radius:3px;color:#333}select.text::-webkit-input-placeholder{color:#d5d5d5}select.text::-moz-placeholder{color:#d5d5d5}select.text:-ms-input-placeholder{color:#d5d5d5}select.text::-ms-input-placeholder{color:#d5d5d5}select.text::placeholder{color:#d5d5d5}textarea.text{border:1px solid #ddd;padding:5px 10px;border-radius:3px;color:#333;resize:none}textarea.text::-webkit-input-placeholder{color:#d5d5d5}textarea.text::-moz-placeholder{color:#d5d5d5}textarea.text:-ms-input-placeholder{color:#d5d5d5}textarea.text::-ms-input-placeholder{color:#d5d5d5}textarea.text::placeholder{color:#d5d5d5}.text-input{color:#b5b4b4;font-size:1.12em;position:relative;vertical-align:middle;display:inline-block;transition:.5s;padding:0;cursor:pointer;border-bottom:2px solid #fff;-webkit-transition:.5s}.text-input::after,.text-input::before{width:100%;height:100%;z-index:3;content:\"\";position:absolute;top:0;left:0;box-sizing:border-box;-webkit-transform:scale(0);transition:.5s}.text-input::-webkit-input-placeholder{color:#dcb8e3;font-size:1.09em}.text-input::-moz-placeholder{color:#dcb8e3;font-size:1.09em}.text-input:-ms-input-placeholder{color:#dcb8e3;font-size:1.09em}.text-input::-ms-input-placeholder{color:#dcb8e3;font-size:1.09em}.text-input::placeholder{color:#dcb8e3;font-size:1.09em}.text-input:focus,.text-input:hover{color:#dcb8e3;font-size:1.09em;border-bottom:2px solid #dedede}input[type=checkbox],input[type=radio]{display:none}input[type=checkbox]+label,input[type=radio]+label{color:#b5b4b4;font-size:1.09em}input[type=radio]+label span{display:inline-block;width:19px;height:19px;margin:-2px 10px 0 0;vertical-align:middle;cursor:pointer}input[type=checkbox]+label span{display:inline-block;width:19px;height:19px;margin:-2px 10px 0 0;vertical-align:middle;cursor:pointer;transition:.1s}input[type=checkbox]:checked+label span{transition:.1s}.multiple-questions label span{display:block;cursor:pointer;max-height:242px;border:1px solid #ddd;border-radius:7px;padding:10px 10px 0;margin:5px;max-width:180px;min-height:180px}.multiple-questions label span.no-image{min-height:0}.multiple-questions label span.no-image img{display:none!important}.multiple-questions input[type=radio]:checked+span{border:1px solid #595959!important;background:#fcfcfc}.multiple-questions label span img{border-radius:7px;width:180px;height:180px}.multiple-questions .text{text-align:center;padding:15px 0;min-height:30px}input.multichoice:empty{margin-left:-999px}input.multichoice:empty~label{position:relative;margin-right:20px;margin-bottom:20px;padding-right:20px;float:left;line-height:2.5em;text-indent:3.5em;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:.1s}input.multichoice:empty~label:before{position:relative;left:0;float:left;content:'';width:40px;background:#d1d3d4;border-radius:3px 0 0 3px;margin-left:0;margin-right:-40px}input.multichoice:checked~label:before{content:'\\2714';text-indent:.9em;color:#fff;background-color:#6c63fe;transition:.1s}.d-flex{display:flex!important}.flex-wrap{flex-wrap:wrap!important}.justify-content-center{justify-content:center!important}.flex-column{flex-direction:column!important}.align-content-center{align-content:center!important}.align-vertical-center{-ms-align-items:center!important;align-items:center!important}.wrapper{min-height:100%;position:relative;overflow:hidden}.wrapper:after,.wrapper:before{content:\" \";display:table}.wrapper:after{clear:both}.content-wrapper{min-height:100%;background-color:#fff;z-index:800;padding-top:40px}.top-menu{position:absolute;border-bottom:1px solid #eee;top:0;width:100%;height:40px;padding:0 10px;line-height:40px}.tool{float:right;padding:2px 5px}.footer{position:absolute;border-top:1px solid #eee;bottom:0;padding:0 10px;width:100%;height:40px;line-height:40px;background:#fff}.cliente{font-size:16px}.modulo a{padding:2px 5px;border-radius:4px;display:block;background:#9c27b0;color:#fff;margin-bottom:5px}.modulo a:hover{background:#831596}.modulo span a{float:right;font-size:12px;padding:0;background:0 0;margin-left:5px;margin-top:1px}.modulo span a:hover{color:#e9e9e9}.etapa a{padding:2px 5px 2px 20px;border-radius:4px;display:block;background:0 0;color:#777;margin-bottom:5px}.etapa span a{float:right;font-size:12px;padding:0;background:0 0;color:#ddd;margin-left:5px;margin-top:1px}.etapa span a:hover{color:#999}.form-custom input[type=number],.form-custom input[type=text],.form-custom select,.form-custom textarea{border:1px solid #dadde2;padding:3px 5px;border-radius:2px;font-size:13px;overflow-x:hidden}.form-custom .txt{border:1px solid #dadde2;padding:3px 5px;border-radius:2px;font-size:13px}.form-custom ::-webkit-input-placeholder{font-size:13px;color:#999}.form-custom ::-moz-placeholder{font-size:13px;color:#999}.form-custom ::-ms-input-placeholder{font-size:13px;color:#999}.wrapper-input{height:45px}.btn-rose{background:#e91e63}.cursor{cursor:pointer}.midia-w iframe{width:100%}.midia-h iframe{height:400px}.breadcrumb{padding:0 15px;margin-bottom:20px;list-style:none;background-color:transparent;font-size:12px}.config-label{width:100%;margin:5px 0;float:left;font-size:.8em;display:block;line-height:1.5em}.config-textarea{width:100%;margin:5px 0;float:left;resize:initial;overflow-y:auto;display:block;font-size:.9em!important;color:#999}.config-input,.config-select{width:100%;margin:5px 0;float:left;display:block;font-size:.9em!important;color:#999}.config-box{width:100%;margin:5px;float:left}.config-box-50{width:45%;min-height:110px;margin:5px;float:left;background:#f9f9f9;border:1px solid #eee;border-radius:5px;padding:10px}.config-box-title{width:100%;padding:10px;font-size:.85em}.no-bg-image{background-image:none}.space-inside{padding:10px}.block{display:block}.fake-link{cursor:pointer}.item-component{margin:0;border-radius:2px;border:1px solid #fff}.item-component:hover{border-color:#9c27b0}.item-component.active{border-color:#9c27b0;background-color:#f9f9f9}.item-box-model{border:3px dashed #ddd;padding:20px;color:#ccc;min-height:50px}.item-component-challenge,.item-component-conclusion,.item-component-download,.item-component-dynamic-input,.item-component-dynamic-table,.item-component-image,.item-component-intro,.item-component-long-text,.item-component-multichoise,.item-component-multiple-questions,.item-component-pdf,.item-component-rating,.item-component-sales-channel,.item-component-sheet-correct-incorrect,.item-component-star-point,.item-component-text,.item-component-upload,.item-component-video,.item-component-yes-no{padding:0}.item-component-image .material-icons,.item-component-pdf .material-icons,.item-component-video .material-icons{font-size:80px}.item-component-title .title-bold{font-weight:700}.item-component-title .title-italic{font-style:italic}.item-component-title .title-underline{text-decoration:underline}.icon.disabled{opacity:.3}.item-component-image-icon-container,.item-component-pdf-icon-container,.item-component-video-icon-container{background:#eee;border:1px solid #ccc;text-align:center;color:#444;font-size:50px;padding:160px}.btn-container{text-align:center}.etapa a:hover,.etapa.active a{background:#f4f4f4}.etapa.active:before{font:700 14px/1 FontAwesome;content:\"\\f0da\";float:left;color:#9c27b0;position:relative;top:5px;left:5px}.scroll{overflow-y:auto}#trail-status{color:#ddd;margin-right:10px;background:0 0;border:none}#trail-status.active{color:#6c9}.item-btn-delete{position:relative}.item-btn-delete button{position:absolute;top:-10px;right:-10px;border:1px solid #9c27b0;background-color:#fff;color:#9c27b0;border-radius:50%;width:20px;height:20px;padding:0;font-size:12px;line-height:12px;z-index:1}.item-btn-delete button:hover{background-color:#9c27b0;color:#fff}.custom-divisor{margin:10px 0}#tbl-objetivo td{padding:0 8px;height:0}#accordion .tool-name:after{font-family:\"Glyphicons Halflings\";content:\"\\e114\";float:right}#accordion .tool-name.collapsed:after{content:\"\\e080\"}#editor-components-wrapper img{max-height:500px;-o-object-fit:contain;object-fit:contain;background:#eee;width:auto}.input-styled{border:1px solid #ccc;padding:4px 6px;border-radius:2px}.pulse:hover{-webkit-animation-duration:.5s;animation-duration:.5s;-webkit-animation-name:pulse;animation-name:pulse}@-webkit-keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.9);opacity:.7}}@keyframes pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.9);opacity:.7}}.cover{position:relative}.cover img{width:100%;min-height:480px;-o-object-fit:cover;object-fit:cover;opacity:1;transition:.5s;-webkit-backface-visibility:hidden;backface-visibility:hidden}.mx-auto{float:none;margin:0 auto}@media (min-width:576px) and (max-width:767px){::ng-deep .sheet-correct .radio{width:90%!important}}@media (min-width:768px) and (max-width:991px){::ng-deep .sheet-correct .radio{width:45%!important}}@media (min-width:992px) and (max-width:1199px){::ng-deep .sheet-correct .radio{width:65%!important}}@media (min-width:1200px){::ng-deep .sheet-correct .radio{width:45%!important}}@media (min-width:1600px){.col-sup{height:45vh}.col-sub{height:55.5vh}.col-int{height:88.5vh}}.image-modal{transition:.5s}.image-modal-item{width:100%;-o-object-fit:scale-down;object-fit:scale-down;max-height:320px;cursor:zoom-in}.image-modal-full{position:fixed;top:0;left:0;z-index:99999;width:100%;height:100%;padding:10%;background:rgba(0,0,0,.3);-o-object-fit:contain;object-fit:contain;cursor:zoom-out}", "input,textarea{padding:10px}"]
4969
- }] }
4970
- ];
4971
- /** @nocollapse */
4972
- DynamicInputComponent.ctorParameters = function () { return []; };
4973
- DynamicInputComponent.propDecorators = {
4974
- input: [{ type: core.Input }]
4975
- };
4976
- return DynamicInputComponent;
4977
- }());
4978
- if (false) {
4979
- /** @type {?} */
4980
- DynamicInputComponent.prototype.input;
4981
- }
4982
-
4983
- /**
4984
- * @fileoverview added by tsickle
4985
- * Generated from: lib/\@core/services/trail-content.service.ts
4986
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4987
- */
4988
- var TrailContentService = /** @class */ (function () {
4989
- function TrailContentService(http, global) {
4990
- this.http = http;
4991
- this.global = global;
4992
- }
4993
- /**
4994
- * @param {?} id
4995
- * @return {?}
4996
- */
4997
- TrailContentService.prototype.all = /**
4998
- * @param {?} id
4999
- * @return {?}
5000
- */
5001
- function (id) {
5002
- return this.http.get(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/' + id, this.getHeaders()).pipe(operators.catchError((/**
5003
- * @param {?} err
5004
- * @return {?}
5005
- */
5006
- function (err) { return rxjs.of({ data: [] }); })));
4611
+ return __awaiter(this, void 0, void 0, function () {
4612
+ var db;
4613
+ var _this = this;
4614
+ return __generator(this, function (_a) {
4615
+ switch (_a.label) {
4616
+ case 0: return [4 /*yield*/, this.initDatabase()];
4617
+ case 1:
4618
+ db = _a.sent();
4619
+ return [2 /*return*/, new Promise((/**
4620
+ * @param {?} resolve
4621
+ * @param {?} reject
4622
+ * @return {?}
4623
+ */
4624
+ function (resolve, reject) {
4625
+ /** @type {?} */
4626
+ var transaction = db.transaction([_this.STORE_LESSONS], 'readonly');
4627
+ /** @type {?} */
4628
+ var store = transaction.objectStore(_this.STORE_LESSONS);
4629
+ /** @type {?} */
4630
+ var request = store.getAll();
4631
+ request.onsuccess = (/**
4632
+ * @return {?}
4633
+ */
4634
+ function () {
4635
+ resolve(request.result || []);
4636
+ });
4637
+ request.onerror = (/**
4638
+ * @param {?} event
4639
+ * @return {?}
4640
+ */
4641
+ function (event) {
4642
+ reject(event.target.error);
4643
+ });
4644
+ }))];
4645
+ }
4646
+ });
4647
+ });
5007
4648
  };
5008
4649
  /**
5009
- * @param {?} id
5010
4650
  * @return {?}
5011
4651
  */
5012
- TrailContentService.prototype.updateGrafico = /**
5013
- * @param {?} id
4652
+ OfflineStorageService.prototype.refreshDownloadedLessons = /**
5014
4653
  * @return {?}
5015
4654
  */
5016
- function (id) {
5017
- return this.http.get(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/assessment/' + id, this.getHeaders());
4655
+ function () {
4656
+ return __awaiter(this, void 0, void 0, function () {
4657
+ var lessons, e_1;
4658
+ return __generator(this, function (_a) {
4659
+ switch (_a.label) {
4660
+ case 0:
4661
+ _a.trys.push([0, 2, , 3]);
4662
+ return [4 /*yield*/, this.getAllDownloadedLessons()];
4663
+ case 1:
4664
+ lessons = _a.sent();
4665
+ this.downloadedLessons$.next(lessons);
4666
+ return [3 /*break*/, 3];
4667
+ case 2:
4668
+ e_1 = _a.sent();
4669
+ console.error('[OfflineStorageService] Erro ao carregar aulas baixadas:', e_1);
4670
+ return [3 /*break*/, 3];
4671
+ case 3: return [2 /*return*/];
4672
+ }
4673
+ });
4674
+ });
5018
4675
  };
5019
4676
  /**
5020
- * @param {?} id
5021
- * @param {?} data
4677
+ * @param {?} lessonId
5022
4678
  * @return {?}
5023
4679
  */
5024
- TrailContentService.prototype.save = /**
5025
- * @param {?} id
5026
- * @param {?} data
4680
+ OfflineStorageService.prototype.deleteDownloadedLesson = /**
4681
+ * @param {?} lessonId
5027
4682
  * @return {?}
5028
4683
  */
5029
- function (id, data) {
5030
- return this.http.post(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/' + id, { value: data }, this.getHeaders());
4684
+ function (lessonId) {
4685
+ return __awaiter(this, void 0, void 0, function () {
4686
+ var db;
4687
+ var _this = this;
4688
+ return __generator(this, function (_a) {
4689
+ switch (_a.label) {
4690
+ case 0: return [4 /*yield*/, this.initDatabase()];
4691
+ case 1:
4692
+ db = _a.sent();
4693
+ return [2 /*return*/, new Promise((/**
4694
+ * @param {?} resolve
4695
+ * @param {?} reject
4696
+ * @return {?}
4697
+ */
4698
+ function (resolve, reject) {
4699
+ /** @type {?} */
4700
+ var transaction = db.transaction([_this.STORE_LESSONS], 'readwrite');
4701
+ /** @type {?} */
4702
+ var store = transaction.objectStore(_this.STORE_LESSONS);
4703
+ /** @type {?} */
4704
+ var request = store.delete(lessonId);
4705
+ request.onsuccess = (/**
4706
+ * @return {?}
4707
+ */
4708
+ function () {
4709
+ _this.refreshDownloadedLessons();
4710
+ resolve(true);
4711
+ });
4712
+ request.onerror = (/**
4713
+ * @param {?} event
4714
+ * @return {?}
4715
+ */
4716
+ function (event) {
4717
+ reject(event.target.error);
4718
+ });
4719
+ }))];
4720
+ }
4721
+ });
4722
+ });
5031
4723
  };
5032
4724
  /**
5033
- * @param {?} id
5034
- * @param {?} data
5035
4725
  * @return {?}
5036
4726
  */
5037
- TrailContentService.prototype.update = /**
5038
- * @param {?} id
5039
- * @param {?} data
4727
+ OfflineStorageService.prototype.clearAllDownloads = /**
5040
4728
  * @return {?}
5041
4729
  */
5042
- function (id, data) {
5043
- return this.http.put(this.global.apiURL() + '/api/v2/client/trilha/conteudo/multiple/' + id, { value: data }, this.getHeaders());
4730
+ function () {
4731
+ return __awaiter(this, void 0, void 0, function () {
4732
+ var db;
4733
+ var _this = this;
4734
+ return __generator(this, function (_a) {
4735
+ switch (_a.label) {
4736
+ case 0: return [4 /*yield*/, this.initDatabase()];
4737
+ case 1:
4738
+ db = _a.sent();
4739
+ return [2 /*return*/, new Promise((/**
4740
+ * @param {?} resolve
4741
+ * @param {?} reject
4742
+ * @return {?}
4743
+ */
4744
+ function (resolve, reject) {
4745
+ /** @type {?} */
4746
+ var transaction = db.transaction([_this.STORE_LESSONS], 'readwrite');
4747
+ /** @type {?} */
4748
+ var store = transaction.objectStore(_this.STORE_LESSONS);
4749
+ /** @type {?} */
4750
+ var request = store.clear();
4751
+ request.onsuccess = (/**
4752
+ * @return {?}
4753
+ */
4754
+ function () {
4755
+ _this.refreshDownloadedLessons();
4756
+ resolve(true);
4757
+ });
4758
+ request.onerror = (/**
4759
+ * @param {?} event
4760
+ * @return {?}
4761
+ */
4762
+ function (event) {
4763
+ reject(event.target.error);
4764
+ });
4765
+ }))];
4766
+ }
4767
+ });
4768
+ });
5044
4769
  };
5045
4770
  /**
5046
- * @param {?} id
4771
+ * @param {?} action
5047
4772
  * @return {?}
5048
4773
  */
5049
- TrailContentService.prototype.delete = /**
5050
- * @param {?} id
4774
+ OfflineStorageService.prototype.queueSyncAction = /**
4775
+ * @param {?} action
5051
4776
  * @return {?}
5052
4777
  */
5053
- function (id) {
5054
- return this.http.delete(this.global.apiURL() + '/api/v2/client/exercises/' + id, this.getHeaders());
4778
+ function (action) {
4779
+ return __awaiter(this, void 0, void 0, function () {
4780
+ var db;
4781
+ var _this = this;
4782
+ return __generator(this, function (_a) {
4783
+ switch (_a.label) {
4784
+ case 0: return [4 /*yield*/, this.initDatabase()];
4785
+ case 1:
4786
+ db = _a.sent();
4787
+ return [2 /*return*/, new Promise((/**
4788
+ * @param {?} resolve
4789
+ * @param {?} reject
4790
+ * @return {?}
4791
+ */
4792
+ function (resolve, reject) {
4793
+ /** @type {?} */
4794
+ var transaction = db.transaction([_this.STORE_SYNC_QUEUE], 'readwrite');
4795
+ /** @type {?} */
4796
+ var store = transaction.objectStore(_this.STORE_SYNC_QUEUE);
4797
+ /** @type {?} */
4798
+ var syncItem = __assign({}, action, { createdAt: new Date() });
4799
+ /** @type {?} */
4800
+ var request = store.add(syncItem);
4801
+ request.onsuccess = (/**
4802
+ * @return {?}
4803
+ */
4804
+ function () {
4805
+ console.log('[OfflineStorageService] Ação salva na fila de sincronização offline:', action);
4806
+ resolve();
4807
+ });
4808
+ request.onerror = (/**
4809
+ * @param {?} event
4810
+ * @return {?}
4811
+ */
4812
+ function (event) {
4813
+ reject(event.target.error);
4814
+ });
4815
+ }))];
4816
+ }
4817
+ });
4818
+ });
5055
4819
  };
5056
4820
  /**
5057
- * @param {?} id
5058
- * @param {?} seconds
5059
4821
  * @return {?}
5060
4822
  */
5061
- TrailContentService.prototype.videoTime = /**
5062
- * @param {?} id
5063
- * @param {?} seconds
4823
+ OfflineStorageService.prototype.processSyncQueue = /**
5064
4824
  * @return {?}
5065
4825
  */
5066
- function (id, seconds) {
5067
- return this.http.get(this.global.apiURL() + '/api/v2/client/trilha/conteudo/tempo/' + id + '/' + seconds, this.getHeaders());
4826
+ function () {
4827
+ return __awaiter(this, void 0, void 0, function () {
4828
+ var db;
4829
+ var _this = this;
4830
+ return __generator(this, function (_a) {
4831
+ switch (_a.label) {
4832
+ case 0: return [4 /*yield*/, this.initDatabase()];
4833
+ case 1:
4834
+ db = _a.sent();
4835
+ return [2 /*return*/, new Promise((/**
4836
+ * @param {?} resolve
4837
+ * @param {?} reject
4838
+ * @return {?}
4839
+ */
4840
+ function (resolve, reject) {
4841
+ /** @type {?} */
4842
+ var transaction = db.transaction([_this.STORE_SYNC_QUEUE], 'readwrite');
4843
+ /** @type {?} */
4844
+ var store = transaction.objectStore(_this.STORE_SYNC_QUEUE);
4845
+ /** @type {?} */
4846
+ var request = store.getAll();
4847
+ request.onsuccess = (/**
4848
+ * @return {?}
4849
+ */
4850
+ function () { return __awaiter(_this, void 0, void 0, function () {
4851
+ var items, syncedCount, items_1, items_1_1, item, clearTx;
4852
+ var e_2, _a;
4853
+ return __generator(this, function (_b) {
4854
+ items = request.result || [];
4855
+ if (items.length === 0) {
4856
+ return [2 /*return*/, resolve(0)];
4857
+ }
4858
+ console.log("[OfflineStorageService] Sincronizando " + items.length + " itens pendentes com o servidor...");
4859
+ syncedCount = 0;
4860
+ try {
4861
+ for (items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
4862
+ item = items_1_1.value;
4863
+ try {
4864
+ console.log("[OfflineStorageService] Sincronizado: " + item.endpoint, item.payload);
4865
+ syncedCount++;
4866
+ }
4867
+ catch (err) {
4868
+ console.error("[OfflineStorageService] Erro ao sincronizar item " + item.id + ":", err);
4869
+ }
4870
+ }
4871
+ }
4872
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
4873
+ finally {
4874
+ try {
4875
+ if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
4876
+ }
4877
+ finally { if (e_2) throw e_2.error; }
4878
+ }
4879
+ clearTx = db.transaction([this.STORE_SYNC_QUEUE], 'readwrite');
4880
+ clearTx.objectStore(this.STORE_SYNC_QUEUE).clear();
4881
+ resolve(syncedCount);
4882
+ return [2 /*return*/];
4883
+ });
4884
+ }); });
4885
+ request.onerror = (/**
4886
+ * @param {?} event
4887
+ * @return {?}
4888
+ */
4889
+ function (event) {
4890
+ reject(event.target.error);
4891
+ });
4892
+ }))];
4893
+ }
4894
+ });
4895
+ });
5068
4896
  };
5069
4897
  /**
5070
- * @param {?} id
5071
- * @param {?} vote
4898
+ * @param {?} bytes
4899
+ * @param {?=} decimals
5072
4900
  * @return {?}
5073
4901
  */
5074
- TrailContentService.prototype.vote = /**
5075
- * @param {?} id
5076
- * @param {?} vote
4902
+ OfflineStorageService.prototype.formatBytes = /**
4903
+ * @param {?} bytes
4904
+ * @param {?=} decimals
5077
4905
  * @return {?}
5078
4906
  */
5079
- function (id, vote) {
5080
- return this.http.post(this.global.apiURL() + '/api/v2/client/trilha/conteudo/vote/' + id, { voto: vote }, this.getHeaders());
4907
+ function (bytes, decimals) {
4908
+ if (decimals === void 0) { decimals = 1; }
4909
+ if (!bytes || bytes === 0)
4910
+ return '0 MB';
4911
+ /** @type {?} */
4912
+ var k = 1024;
4913
+ /** @type {?} */
4914
+ var dm = decimals < 0 ? 0 : decimals;
4915
+ /** @type {?} */
4916
+ var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
4917
+ /** @type {?} */
4918
+ var i = Math.floor(Math.log(bytes) / Math.log(k));
4919
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
5081
4920
  };
5082
4921
  /**
4922
+ * @param {?} lessons
5083
4923
  * @return {?}
5084
4924
  */
5085
- TrailContentService.prototype.getHeaders = /**
4925
+ OfflineStorageService.prototype.getTotalStorageUsed = /**
4926
+ * @param {?} lessons
5086
4927
  * @return {?}
5087
4928
  */
5088
- function () {
5089
- /** @type {?} */
5090
- var token = localStorage.getItem('token');
4929
+ function (lessons) {
5091
4930
  /** @type {?} */
5092
- var headerOptions = {
5093
- 'Authorization': token,
5094
- 'Accept': 'application/json'
4931
+ var totalBytes = lessons.reduce((/**
4932
+ * @param {?} acc
4933
+ * @param {?} curr
4934
+ * @return {?}
4935
+ */
4936
+ function (acc, curr) { return acc + (curr.sizeBytes || 0); }), 0);
4937
+ return {
4938
+ totalBytes: totalBytes,
4939
+ formatted: this.formatBytes(totalBytes)
5095
4940
  };
5096
- return { headers: new http.HttpHeaders(headerOptions) };
5097
4941
  };
5098
- TrailContentService.decorators = [
5099
- { type: core.Injectable }
4942
+ OfflineStorageService.decorators = [
4943
+ { type: core.Injectable, args: [{
4944
+ providedIn: 'root'
4945
+ },] }
5100
4946
  ];
5101
4947
  /** @nocollapse */
5102
- TrailContentService.ctorParameters = function () { return [
5103
- { type: http.HttpClient },
5104
- { type: asapCrud.Global }
5105
- ]; };
5106
- return TrailContentService;
4948
+ OfflineStorageService.ctorParameters = function () { return []; };
4949
+ /** @nocollapse */ OfflineStorageService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function OfflineStorageService_Factory() { return new OfflineStorageService(); }, token: OfflineStorageService, providedIn: "root" });
4950
+ return OfflineStorageService;
5107
4951
  }());
5108
4952
  if (false) {
4953
+ /**
4954
+ * @type {?}
4955
+ * @private
4956
+ */
4957
+ OfflineStorageService.prototype.DB_NAME;
4958
+ /**
4959
+ * @type {?}
4960
+ * @private
4961
+ */
4962
+ OfflineStorageService.prototype.DB_VERSION;
4963
+ /**
4964
+ * @type {?}
4965
+ * @private
4966
+ */
4967
+ OfflineStorageService.prototype.STORE_LESSONS;
4968
+ /**
4969
+ * @type {?}
4970
+ * @private
4971
+ */
4972
+ OfflineStorageService.prototype.STORE_SYNC_QUEUE;
4973
+ /**
4974
+ * @type {?}
4975
+ * @private
4976
+ */
4977
+ OfflineStorageService.prototype.db;
4978
+ /**
4979
+ * @type {?}
4980
+ * @private
4981
+ */
4982
+ OfflineStorageService.prototype.isOnlineSubject;
5109
4983
  /** @type {?} */
5110
- TrailContentService.prototype.http;
4984
+ OfflineStorageService.prototype.isOnline$;
5111
4985
  /** @type {?} */
5112
- TrailContentService.prototype.global;
4986
+ OfflineStorageService.prototype.downloadProgress$;
4987
+ /** @type {?} */
4988
+ OfflineStorageService.prototype.downloadedLessons$;
5113
4989
  }
5114
4990
 
5115
4991
  /**
@@ -5608,14 +5484,6 @@
5608
5484
  function () {
5609
5485
  _this.showSaved = false;
5610
5486
  }), 1000);
5611
- if (!navigator.onLine) {
5612
- this.offlineService.queueSyncAction({
5613
- type: 'notes',
5614
- endpoint: '/api/v2/client/ambiente-virtual/anotacoes',
5615
- payload: { id: this.id, data: data }
5616
- });
5617
- return;
5618
- }
5619
5487
  if (this.contentId) {
5620
5488
  this._trailContentService.update(this.contentId, data).subscribe((/**
5621
5489
  * @param {?} res
@@ -14323,58 +14191,6 @@
14323
14191
  }
14324
14192
  }));
14325
14193
  };
14326
- /**
14327
- * @param {?} id
14328
- * @return {?}
14329
- */
14330
- CursoVisualizadorComponent.prototype.loadOfflineModule = /**
14331
- * @param {?} id
14332
- * @return {?}
14333
- */
14334
- function (id) {
14335
- return __awaiter(this, void 0, void 0, function () {
14336
- var offlineData, e_1;
14337
- return __generator(this, function (_a) {
14338
- switch (_a.label) {
14339
- case 0:
14340
- _a.trys.push([0, 2, , 3]);
14341
- return [4 /*yield*/, this.offlineService.getDownloadedLesson(id)];
14342
- case 1:
14343
- offlineData = _a.sent();
14344
- if (offlineData) {
14345
- this.etapa = {
14346
- id: offlineData.id,
14347
- nome: offlineData.title,
14348
- sinopse: offlineData.subtitle,
14349
- thumb: offlineData.thumbnail
14350
- };
14351
- if (offlineData.stages && offlineData.stages.length > 0) {
14352
- this.data = offlineData.stages;
14353
- this.current = this.data[0];
14354
- if (this.cursoViewer) {
14355
- this.cursoViewer.getContent(this.current.id);
14356
- }
14357
- if (this.cursoNavBar) {
14358
- this.cursoNavBar.menuItems = this.data;
14359
- this.cursoNavBar.setIndexes(this.data, this.current);
14360
- }
14361
- }
14362
- this.loader = false;
14363
- console.log('[CursoVisualizador] Módulo carregado do armazenamento offline:', offlineData);
14364
- return [2 /*return*/];
14365
- }
14366
- return [3 /*break*/, 3];
14367
- case 2:
14368
- e_1 = _a.sent();
14369
- console.error('[CursoVisualizador] Erro ao recuperar módulo offline:', e_1);
14370
- return [3 /*break*/, 3];
14371
- case 3:
14372
- this.loader = false;
14373
- return [2 /*return*/];
14374
- }
14375
- });
14376
- });
14377
- };
14378
14194
  /**
14379
14195
  * @return {?}
14380
14196
  */
@@ -14383,9 +14199,6 @@
14383
14199
  */
14384
14200
  function () {
14385
14201
  var _this = this;
14386
- if (!navigator.onLine) {
14387
- return;
14388
- }
14389
14202
  this.trailService.trilhaInfoEtapa(this.id).subscribe((/**
14390
14203
  * @param {?} res
14391
14204
  * @return {?}
@@ -14408,12 +14221,6 @@
14408
14221
  }
14409
14222
  _this.etapa = etapa;
14410
14223
  }
14411
- }), (/**
14412
- * @param {?} err
14413
- * @return {?}
14414
- */
14415
- function (err) {
14416
- console.log("[CursoVisualizador] Fallback getData offline");
14417
14224
  }));
14418
14225
  };
14419
14226
  /**
@@ -14424,9 +14231,6 @@
14424
14231
  */
14425
14232
  function () {
14426
14233
  var _this = this;
14427
- if (!navigator.onLine) {
14428
- return;
14429
- }
14430
14234
  this._bannerService.verifyBannerTrilha(this.id)
14431
14235
  .subscribe((/**
14432
14236
  * @param {?} res
@@ -14437,11 +14241,7 @@
14437
14241
  if (_this.bannerArray.length > 0 && _this.bannerArray[0].status === 0) {
14438
14242
  _this.openDialog(_this.bannerArray);
14439
14243
  }
14440
- }), (/**
14441
- * @param {?} err
14442
- * @return {?}
14443
- */
14444
- function (err) { }));
14244
+ }));
14445
14245
  };
14446
14246
  /**
14447
14247
  * @param {?} data
@@ -14496,10 +14296,6 @@
14496
14296
  var _this = this;
14497
14297
  this.loader = true;
14498
14298
  this.module = this.id;
14499
- if (!navigator.onLine) {
14500
- this.loadOfflineModule(this.id);
14501
- return;
14502
- }
14503
14299
  this.ambienteVirtualService.getSubEtapa(this.id).subscribe((/**
14504
14300
  * @param {?} res
14505
14301
  * @return {?}
@@ -14541,8 +14337,8 @@
14541
14337
  * @return {?}
14542
14338
  */
14543
14339
  function (err) {
14544
- console.log("Erro de rede getSubEtapa, tentando carregar offline:", err);
14545
- _this.loadOfflineModule(_this.id);
14340
+ console.log("Erro", err);
14341
+ _this.notificate();
14546
14342
  }));
14547
14343
  };
14548
14344
  /**
@@ -14858,40 +14654,18 @@
14858
14654
  * @return {?}
14859
14655
  */
14860
14656
  function (idSubStep) {
14861
- var _this = this;
14862
14657
  if (idSubStep !== undefined) {
14863
- this.offlineService.isLessonDownloaded(idSubStep).then((/**
14864
- * @param {?} isDownloaded
14658
+ this.ambienteVirtualService.registerNewProgress(idSubStep).subscribe((/**
14659
+ * @param {?} response
14865
14660
  * @return {?}
14866
14661
  */
14867
- function (isDownloaded) {
14868
- if (isDownloaded || !navigator.onLine) {
14869
- _this.offlineService.queueSyncAction({
14870
- type: 'stage_progress',
14871
- endpoint: '/api/v2/client/progresso/sub/post?sub_id=' + idSubStep,
14872
- payload: { subetapa_id: idSubStep, status: 1 }
14873
- });
14874
- console.log('[CursoVisualizador] Progresso offline da etapa ' + idSubStep + ' enfileirado para sincronização.');
14875
- return;
14876
- }
14877
- _this.ambienteVirtualService.registerNewProgress(idSubStep).subscribe((/**
14878
- * @param {?} response
14879
- * @return {?}
14880
- */
14881
- function (response) {
14882
- console.log('checkAsRead online sucesso:', response);
14883
- }), (/**
14884
- * @param {?} error
14885
- * @return {?}
14886
- */
14887
- function (error) {
14888
- console.warn('Falha ao registrar progresso online, salvando na fila offline:', error);
14889
- _this.offlineService.queueSyncAction({
14890
- type: 'stage_progress',
14891
- endpoint: '/api/v2/client/progresso/sub/post?sub_id=' + idSubStep,
14892
- payload: { subetapa_id: idSubStep, status: 1 }
14893
- });
14894
- }));
14662
+ function (response) {
14663
+ console.log('checkAsRead', response);
14664
+ }), (/**
14665
+ * @param {?} error
14666
+ * @return {?}
14667
+ */
14668
+ function (error) {
14895
14669
  }));
14896
14670
  }
14897
14671
  };
@@ -16645,116 +16419,48 @@
16645
16419
  * @return {?}
16646
16420
  */
16647
16421
  function (step) {
16648
- return __awaiter(this, void 0, void 0, function () {
16649
- var offlineLesson, stageItems, e_1;
16650
- var _this = this;
16651
- return __generator(this, function (_a) {
16652
- switch (_a.label) {
16653
- case 0:
16654
- this.loader = true;
16655
- _a.label = 1;
16656
- case 1:
16657
- _a.trys.push([1, 3, , 4]);
16658
- return [4 /*yield*/, this.offlineService.getDownloadedLesson(step)];
16659
- case 2:
16660
- offlineLesson = _a.sent();
16661
- if (offlineLesson) {
16662
- stageItems = [];
16663
- if (Array.isArray(offlineLesson.stageData) && offlineLesson.stageData.length > 0) {
16664
- stageItems = offlineLesson.stageData;
16665
- }
16666
- else if (offlineLesson.stageData && offlineLesson.stageData.type) {
16667
- stageItems = [offlineLesson.stageData];
16668
- }
16669
- else {
16670
- stageItems = [{
16671
- type: 'video',
16672
- title: offlineLesson.title,
16673
- subTitle: offlineLesson.subtitle,
16674
- source: 'file',
16675
- source_path: offlineLesson.thumbnail,
16676
- showVideoControl: true
16677
- }];
16678
- }
16679
- this.componentArray = stageItems;
16680
- this.content = { id: step, value: this.componentArray };
16681
- this.loader = false;
16682
- this.cdr.detectChanges();
16683
- console.log('[ViewerComponent] Conteúdo carregado offline com sucesso (sem chamadas HTTP):', this.componentArray);
16684
- return [2 /*return*/];
16422
+ var _this = this;
16423
+ this.loader = true;
16424
+ this._ambienteVirtualService.getContent(step)
16425
+ .subscribe((/**
16426
+ * @param {?} res
16427
+ * @return {?}
16428
+ */
16429
+ function (res) {
16430
+ var e_1, _a;
16431
+ if (res && res.data && res.data[0]) {
16432
+ /** @type {?} */
16433
+ var data = res.data[0].value;
16434
+ _this.redirect = res.redirect;
16435
+ _this.content = res.data[0];
16436
+ if (res['data'][0].value) {
16437
+ /** @type {?} */
16438
+ var itensJson = res['data'][0].value;
16439
+ _this.componentArray = [];
16440
+ try {
16441
+ for (var itensJson_1 = __values(itensJson), itensJson_1_1 = itensJson_1.next(); !itensJson_1_1.done; itensJson_1_1 = itensJson_1.next()) {
16442
+ var item = itensJson_1_1.value;
16443
+ _this.componentArray.push(item);
16685
16444
  }
16686
- return [3 /*break*/, 4];
16687
- case 3:
16688
- e_1 = _a.sent();
16689
- console.error('[ViewerComponent] Erro ao recuperar conteúdo offline:', e_1);
16690
- return [3 /*break*/, 4];
16691
- case 4:
16692
- this._ambienteVirtualService.getContent(step)
16693
- .subscribe((/**
16694
- * @param {?} res
16695
- * @return {?}
16696
- */
16697
- function (res) {
16698
- var e_2, _a;
16699
- if (res && res.data && res.data[0]) {
16700
- /** @type {?} */
16701
- var data = res.data[0].value;
16702
- _this.redirect = res.redirect;
16703
- _this.content = res.data[0];
16704
- if (res['data'][0].value) {
16705
- /** @type {?} */
16706
- var itensJson = res['data'][0].value;
16707
- _this.componentArray = [];
16708
- try {
16709
- for (var itensJson_1 = __values(itensJson), itensJson_1_1 = itensJson_1.next(); !itensJson_1_1.done; itensJson_1_1 = itensJson_1.next()) {
16710
- var item = itensJson_1_1.value;
16711
- _this.componentArray.push(item);
16712
- }
16713
- }
16714
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
16715
- finally {
16716
- try {
16717
- if (itensJson_1_1 && !itensJson_1_1.done && (_a = itensJson_1.return)) _a.call(itensJson_1);
16718
- }
16719
- finally { if (e_2) throw e_2.error; }
16720
- }
16721
- }
16722
- }
16723
- _this.loader = false;
16724
- }), (/**
16725
- * @param {?} err
16726
- * @return {?}
16727
- */
16728
- function (err) { return __awaiter(_this, void 0, void 0, function () {
16729
- var offlineLesson, e_3;
16730
- return __generator(this, function (_a) {
16731
- switch (_a.label) {
16732
- case 0:
16733
- console.log("Erro de rede getContent, tentando recuperar do offline storage:", err);
16734
- _a.label = 1;
16735
- case 1:
16736
- _a.trys.push([1, 3, , 4]);
16737
- return [4 /*yield*/, this.offlineService.getDownloadedLesson(step)];
16738
- case 2:
16739
- offlineLesson = _a.sent();
16740
- if (offlineLesson && offlineLesson.stageData) {
16741
- this.componentArray = Array.isArray(offlineLesson.stageData) ? offlineLesson.stageData : [offlineLesson.stageData];
16742
- this.content = { id: step, value: this.componentArray };
16743
- }
16744
- return [3 /*break*/, 4];
16745
- case 3:
16746
- e_3 = _a.sent();
16747
- return [3 /*break*/, 4];
16748
- case 4:
16749
- this.loader = false;
16750
- return [2 /*return*/];
16751
- }
16752
- });
16753
- }); }));
16754
- return [2 /*return*/];
16445
+ }
16446
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
16447
+ finally {
16448
+ try {
16449
+ if (itensJson_1_1 && !itensJson_1_1.done && (_a = itensJson_1.return)) _a.call(itensJson_1);
16450
+ }
16451
+ finally { if (e_1) throw e_1.error; }
16452
+ }
16755
16453
  }
16756
- });
16757
- });
16454
+ }
16455
+ _this.loader = false;
16456
+ }), (/**
16457
+ * @param {?} err
16458
+ * @return {?}
16459
+ */
16460
+ function (err) {
16461
+ console.log(err);
16462
+ _this.loader = false;
16463
+ }));
16758
16464
  };
16759
16465
  Object.defineProperty(ViewerComponent.prototype, "hasVideo", {
16760
16466
  get: /**
@@ -16823,16 +16529,6 @@
16823
16529
  * @return {?}
16824
16530
  */
16825
16531
  function (time) {
16826
- if (!navigator.onLine) {
16827
- if (this.content && this.content.id) {
16828
- this.offlineService.queueSyncAction({
16829
- type: 'video_progress',
16830
- endpoint: '/api/v2/client/ambiente-virtual/video-tempo',
16831
- payload: { content_id: this.content.id, current_time: time.current }
16832
- });
16833
- }
16834
- return;
16835
- }
16836
16532
  if (this.content && this.content.id) {
16837
16533
  this.trailContentService.videoTime(this.content.id, time.current).subscribe((/**
16838
16534
  * @param {?} result
@@ -30814,13 +30510,6 @@
30814
30510
  ModalStarRatingComponent,
30815
30511
  StudioModalStarRatingComponent,
30816
30512
  OfflineManagerModalComponent
30817
- ],
30818
- providers: [
30819
- {
30820
- provide: http.HTTP_INTERCEPTORS,
30821
- useClass: OfflineHttpInterceptor,
30822
- multi: true
30823
- }
30824
30513
  ]
30825
30514
  },] }
30826
30515
  ];
@@ -31014,7 +30703,6 @@
31014
30703
  exports.ɵho = Trail;
31015
30704
  exports.ɵhp = StudioStarRatingComponent;
31016
30705
  exports.ɵhq = StudioModalStarRatingComponent;
31017
- exports.ɵhr = OfflineHttpInterceptor;
31018
30706
  exports.ɵi = BaseService;
31019
30707
  exports.ɵj = DevelopmentService;
31020
30708
  exports.ɵk = ArticlesService;