From a3b0ae608da6bffeb013471a10c1cd82cf45a5f9 Mon Sep 17 00:00:00 2001 From: Anil Gupta Date: Thu, 9 Jan 2020 13:54:53 +0530 Subject: [PATCH] RELEASE --- dist/device-register/def/request.d.ts | 12 ++++++++---- .../handler/device-register-handler.d.ts | 4 +++- .../impl/device-register-service-impl.d.ts | 2 ++ dist/index.js | 2 +- dist/profile/index.d.ts | 1 + 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dist/device-register/def/request.d.ts b/dist/device-register/def/request.d.ts index 2514011c3..f006c5906 100644 --- a/dist/device-register/def/request.d.ts +++ b/dist/device-register/def/request.d.ts @@ -1,12 +1,16 @@ import { DeviceSpec } from '../../util/device'; +export interface UserDeclaredLocation { + declaredOffline?: boolean; + state: string; + stateId?: string; + district: string; + districtId?: string; +} export interface DeviceRegisterRequest { dspec?: DeviceSpec; channel?: string; fcmToken?: string; producer?: string; first_access?: number; - userDeclaredLocation?: { - state: string; - district: string; - }; + userDeclaredLocation?: UserDeclaredLocation; } diff --git a/dist/device-register/handler/device-register-handler.d.ts b/dist/device-register/handler/device-register-handler.d.ts index a15f9bd44..5d77d649e 100644 --- a/dist/device-register/handler/device-register-handler.d.ts +++ b/dist/device-register/handler/device-register-handler.d.ts @@ -6,6 +6,7 @@ import { AppInfo } from '../../util/app'; import { SdkConfig } from '../../sdk-config'; import { FrameworkService } from '../../framework'; import { SharedPreferences } from '../../util/shared-preferences'; +import { GetDeviceProfileHandler } from './get-device-profile-handler'; export declare class DeviceRegisterHandler implements ApiRequestHandler { private sdkConfig; private deviceInfo; @@ -13,10 +14,11 @@ export declare class DeviceRegisterHandler implements ApiRequestHandler; private registerDevice; } diff --git a/dist/device-register/impl/device-register-service-impl.d.ts b/dist/device-register/impl/device-register-service-impl.d.ts index f47fd245d..f78a0e362 100644 --- a/dist/device-register/impl/device-register-service-impl.d.ts +++ b/dist/device-register/impl/device-register-service-impl.d.ts @@ -13,6 +13,8 @@ export declare class DeviceRegisterServiceImpl implements DeviceRegisterService private frameworkService; private appInfoService; private apiService; + private readonly deviceRegisterHandler; + private readonly getDeviceProfileHandler; constructor(sdkConfig: SdkConfig, deviceInfo: DeviceInfo, sharedPreferences: SharedPreferences, frameworkService: FrameworkService, appInfoService: AppInfo, apiService: ApiService); registerDevice(request?: DeviceRegisterRequest): Observable; getDeviceProfile(): Observable; diff --git a/dist/index.js b/dist/index.js index dcb358588..d3654b646 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12,4 +12,4 @@ var r=t(387),o=t(388),a=t(68);function n(){return l.TYPED_ARRAY_SUPPORT?21474836 * @author Feross Aboukhadijeh * @license MIT */ -e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,n){"use strict";var i=n(11),r=n(112),o=n(494),a=n(495),c=n(117);function s(e){this.defaults=e,this.interceptors={request:new o,response:new o}}s.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=c(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},s.prototype.getUri=function(e){return e=c(this.defaults,e),r(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],function(n){s.prototype[n]=function(e,t){return this.request(i.merge(t||{},{method:n,url:e}))}}),i.forEach(["post","put","patch"],function(r){s.prototype[r]=function(e,t,n){return this.request(i.merge(n||{},{method:r,url:e,data:t}))}}),e.exports=s},function(e,t,n){"use strict";var r=n(11);function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,function(e){null!==e&&t(e)})},e.exports=i},function(e,t,n){"use strict";var r=n(11),i=n(496),o=n(113),a=n(114),c=n(503),s=n(504);function u(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(t){return u(t),t.baseURL&&!c(t.url)&&(t.url=s(t.baseURL,t.url)),t.headers=t.headers||{},t.data=i(t.data,t.headers,t.transformRequest),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers||{}),r.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||a.adapter)(t).then(function(e){return u(t),e.data=i(e.data,e.headers,t.transformResponse),e},function(e){return o(e)||(u(t),e&&e.response&&(e.response.data=i(e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}},function(e,t,n){"use strict";var r=n(11);e.exports=function(t,n,e){return r.forEach(e,function(e){t=e(t,n)}),t}},function(e,t,n){"use strict";var i=n(11);e.exports=function(n,r){i.forEach(n,function(e,t){t!==r&&t.toUpperCase()===r.toUpperCase()&&(n[r]=e,delete n[t])})}},function(e,t,n){"use strict";var i=n(116);e.exports=function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(i("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var o=n(11),a=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,r,i={};return e&&o.forEach(e.split("\n"),function(e){if(r=e.indexOf(":"),t=o.trim(e.substr(0,r)).toLowerCase(),n=o.trim(e.substr(r+1)),t){if(i[t]&&0<=a.indexOf(t))return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}}),i}},function(e,t,n){"use strict";var a=n(11);e.exports=a.isStandardBrowserEnv()?function(){var n,r=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");function o(e){var t=e;return r&&(i.setAttribute("href",t),t=i.href),i.setAttribute("href",t),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}return n=o(window.location.href),function(e){var t=a.isString(e)?o(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0}},function(e,t,n){"use strict";var c=n(11);e.exports=c.isStandardBrowserEnv()?{write:function(e,t,n,r,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),c.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),c.isString(r)&&a.push("path="+r),c.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(118);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new r(e),t(n.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var t;return{token:new i(function(e){t=e}),cancel:t}},e.exports=i},function(e,t,n){"use strict";e.exports=function(t){return function(e){return t.apply(null,e)}}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,r=i;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(19),r=function(){function e(e){this.table={},this.nElements=0,this.toStr=e||o.defaultToString}return e.prototype.getValue=function(e){var t=this.table["$"+this.toStr(e)];if(!o.isUndefined(t))return t.value},e.prototype.setValue=function(e,t){if(!o.isUndefined(e)&&!o.isUndefined(t)){var n,r="$"+this.toStr(e),i=this.table[r];return n=o.isUndefined(i)?void this.nElements++:i.value,this.table[r]={key:e,value:t},n}},e.prototype.remove=function(e){var t="$"+this.toStr(e),n=this.table[t];if(!o.isUndefined(n))return delete this.table[t],this.nElements--,n.value},e.prototype.keys=function(){var e=[];for(var t in this.table)if(o.has(this.table,t)){var n=this.table[t];e.push(n.key)}return e},e.prototype.values=function(){var e=[];for(var t in this.table)if(o.has(this.table,t)){var n=this.table[t];e.push(n.value)}return e},e.prototype.forEach=function(e){for(var t in this.table)if(o.has(this.table,t)){var n=this.table[t];if(!1===e(n.key,n.value))return}},e.prototype.containsKey=function(e){return!o.isUndefined(this.getValue(e))},e.prototype.clear=function(){this.table={},this.nElements=0},e.prototype.size=function(){return this.nElements},e.prototype.isEmpty=function(){return this.nElements<=0},e.prototype.toString=function(){var n="{";return this.forEach(function(e,t){n+="\n\t"+e+" : "+t}),n+"\n}"},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(19),i=n(120),r=function(){function r(){this.firstNode=null,this.lastNode=null,this.nElements=0}return r.prototype.add=function(e,t){if(o.isUndefined(t)&&(t=this.nElements),t<0||t>this.nElements||o.isUndefined(e))return!1;var n=this.createNode(e);if(0===this.nElements||null===this.lastNode)this.firstNode=n,this.lastNode=n;else if(t===this.nElements)this.lastNode.next=n,this.lastNode=n;else if(0===t)n.next=this.firstNode,this.firstNode=n;else{var r=this.nodeAtIndex(t-1);if(null==r)return!1;n.next=r.next,r.next=n}return this.nElements++,!0},r.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},r.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},r.prototype.elementAtIndex=function(e){var t=this.nodeAtIndex(e);if(null!==t)return t.element},r.prototype.indexOf=function(e,t){var n=t||o.defaultEquals;if(o.isUndefined(e))return-1;for(var r=this.firstNode,i=0;null!==r;){if(n(r.element,e))return i;i++,r=r.next}return-1},r.prototype.contains=function(e,t){return 0<=this.indexOf(e,t)},r.prototype.remove=function(e,t){var n=t||o.defaultEquals;if(this.nElements<1||o.isUndefined(e))return!1;for(var r=null,i=this.firstNode;null!==i;){if(n(i.element,e))return null==r?(this.firstNode=i.next,i===this.lastNode&&(this.lastNode=null)):(i===this.lastNode?(this.lastNode=r).next=i.next:r.next=i.next,i.next=null),this.nElements--,!0;i=(r=i).next}return!1},r.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},r.prototype.equals=function(e,t){var n=t||o.defaultEquals;return e instanceof r&&(this.size()===e.size()&&this.equalsAux(this.firstNode,e.firstNode,n))},r.prototype.equalsAux=function(e,t,n){for(;null!==e&&null!==t;){if(!n(e.element,t.element))return!1;e=e.next,t=t.next}return!0},r.prototype.removeElementAtIndex=function(e){if(!(e<0||e>=this.nElements||null===this.firstNode||null===this.lastNode)){var t;if(1===this.nElements)t=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var n=this.nodeAtIndex(e-1);null===n?(t=this.firstNode.element,this.firstNode=this.firstNode.next):n.next===this.lastNode&&(t=this.lastNode.element,this.lastNode=n),null!==n&&null!==n.next&&(t=n.next.element,n.next=n.next.next)}return this.nElements--,t}},r.prototype.forEach=function(e){for(var t=this.firstNode;null!==t&&!1!==e(t.element);)t=t.next},r.prototype.reverse=function(){for(var e=null,t=this.firstNode,n=null;null!==t;)n=t.next,t.next=e,e=t,t=n;n=this.firstNode,this.firstNode=this.lastNode,this.lastNode=n},r.prototype.toArray=function(){for(var e=[],t=this.firstNode;null!==t;)e.push(t.element),t=t.next;return e},r.prototype.size=function(){return this.nElements},r.prototype.isEmpty=function(){return this.nElements<=0},r.prototype.toString=function(){return i.toString(this.toArray())},r.prototype.nodeAtIndex=function(e){if(e<0||e>=this.nElements)return null;if(e===this.nElements-1)return this.lastNode;for(var t=this.firstNode,n=0;na[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]this.telemetryConfig.telemetryLogMinAllowedOffset?r:0)?[4,Lr.log.interact({type:ze.OTHER,subType:We.DEVICE_TIME_OFFSET_FOUND,env:"sdk",pageId:"sdk",id:"sdk",valueMap:{deviceTime:n,offsetTime:i}}).toPromise()]:[3,3];case 1:return e.sent(),[4,this.keyValueStore.setValue(c.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY,i+"").toPromise()];case 2:e.sent(),e.label=3;case 3:return[2]}})})}),Object(fe.mergeMap)(function(){return Object(H.zip)(i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,Date.now()+""),i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,"true")).pipe(Object(fe.mapTo)(void 0))}),Object(fe.catchError)(function(e){return Object(H.zip)(i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,Date.now()+""),i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,"false")).pipe(Object(fe.mergeMap)(function(){throw console.error(e),new Error("Device Registration Failed")}))}))}))},c.prototype.hasTelemetryThresholdCrossed=function(){var t=this;return this.dbService.execute("\n SELECT count(*) as COUNT FROM "+gt.TABLE_NAME).pipe(Object(fe.map)(function(e){return!!(e&&e[0]&&e[0].COUNT>=t.telemetryConfig.telemetrySyncThreshold)}))},c.prototype.fetchEvents=function(){return this.dbService.execute("\n SELECT * FROM "+gt.TABLE_NAME+"\n WHERE "+gt.COLUMN_NAME_PRIORITY+" = (SELECT MIN ("+gt.COLUMN_NAME_PRIORITY+")\n FROM "+gt.TABLE_NAME+")\n ORDER BY "+gt.COLUMN_NAME_TIMESTAMP+"\n LIMIT "+this.telemetryConfig.telemetrySyncBandwidth)},c.prototype.processEvents=function(e){if(!e.length)return Object(H.of)({processedEventsSize:0});var t=Or.generateUniqueId();return Object(H.of)({processedEvents:this.preprocessors.reduce(function(e,t){return t.process(e)},{id:"ekstep.telemetry",ver:"1.0",ts:ue()().format("YYYY-MM-DDTHH:mm:ss[Z]"),events:e.map(function(e){return JSON.parse(e[gt.COLUMN_NAME_EVENT])}),params:{did:this.deviceInfo.getDeviceID(),msgid:t,key:"",requesterId:""}}),processedEventsSize:e.length,messageId:t})},c.prototype.persistProcessedEvents=function(e,t){var n,r=e.processedEvents,i=e.messageId;if(!r)return Object(H.of)(void 0);var o={table:Ot.TABLE_NAME,modelJson:(n={},n[Ot.COLUMN_NAME_MSG_ID]=i,n[Ot.COLUMN_NAME_NUMBER_OF_EVENTS]=t,n[gt.COLUMN_NAME_PRIORITY]=1,n[Ot.COLUMN_NAME_DATA]=r,n)};return this.dbService.insert(o).pipe(Object(fe.mapTo)(void 0))},c.prototype.deleteEvents=function(e){return e.length?this.dbService.execute("\n DELETE FROM "+gt.TABLE_NAME+"\n WHERE "+gt._ID+" IN ("+e.map(function(e){return e[gt._ID]}).join(",")+")\n "):Object(H.of)(void 0)},c.prototype.handleProcessedEventsBatch=function(e){var n=this;return Object(H.iif)(function(){return!!e},Object(H.of)(void 0),this.sharedPreferences.getString(V.KEY_AUTO_SYNC_MODE).pipe(Object(fe.catchError)(function(){return Object(H.of)("")}),Object(fe.mergeMap)(function(e){switch(e){case jh.OFF:throw new Error("AUTO_SYNC_MODE: "+jh.OFF);case jh.OVER_WIFI:if(navigator.connection.type===Connection.WIFI)return Object(H.of)(void 0);throw new Error("AUTO_SYNC_MODE: "+jh.OVER_WIFI);case jh.ALWAYS_ON:default:return Object(H.of)(void 0)}}))).pipe(Object(fe.mergeMap)(function(){return n.fetchProcessedEventsBatch().pipe(Object(fe.mergeMap)(function(t){return n.syncProcessedEvent(t).pipe(Object(fe.mergeMap)(function(e){return n.deleteProcessedEvent(t).pipe(Object(fe.mapTo)(e||{syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0}))}))}))}),Object(fe.catchError)(function(e){return Object(H.of)({syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0,error:e})}))},c.prototype.fetchProcessedEventsBatch=function(){return this.dbService.read({table:Ot.TABLE_NAME,selection:"",selectionArgs:[],limit:"1"}).pipe(Object(fe.map)(function(e){return e&&e[0]}))},c.prototype.syncProcessedEvent=function(e){var t=this;if(!e)return Object(H.of)(void 0);var n=e[Ot.COLUMN_NAME_DATA].split("").map(function(e){return e.charCodeAt(0)}),r=new Uint8Array(n),i=(new g.Builder).withHost(this.telemetryConfig.host).withType(d.POST).withPath(this.telemetryConfig.apiPath+c.TELEMETRY_ENDPOINT).withBody(r).withApiToken(!0).build();return this.apiService.fetch(i).pipe(Object(fe.tap)(function(o){return Rr(t,void 0,void 0,function(){var t,n,r,i;return Dr(this,function(e){switch(e.label){case 0:return[4,this.keyValueStore.getValue(c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY).toPromise()];case 1:return"false"!==e.sent()?[3,3]:(t=new Date(o.body.ets).getTime(),n=Date.now(),r=t-n,(i=Math.abs(r)>this.telemetryConfig.telemetryLogMinAllowedOffset?r:0)?[4,this.keyValueStore.setValue(c.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY,i+"").toPromise()]:[3,3]);case 2:e.sent(),e.label=3;case 3:return[2]}})})}),Object(fe.map)(function(){return{syncedEventCount:e[Ot.COLUMN_NAME_NUMBER_OF_EVENTS],syncTime:Date.now(),syncedFileSize:(new TextEncoder).encode(e[Ot.COLUMN_NAME_DATA]).length}}))},c.prototype.deleteProcessedEvent=function(e){return e?this.dbService.delete({table:Ot.TABLE_NAME,selection:"_id = ?",selectionArgs:[e[Ot._ID]]}):Object(H.of)(void 0)},c.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY="telemetry_log_min_allowed_offset_key",c.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY="last_synced_device_register_attempt_time_stamp",c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY="last_synced_device_register_is_successful",c.TELEMETRY_ENDPOINT="/telemetry",c.REGISTER_API_SUCCESS_TTL=864e5,c.REGISTER_API_FAILURE_TTL=36e5,c}(),Ur=function(){function e(e,t){this.fileService=e,this.deviceInfo=t}return e.prototype.execute=function(t){var n=this,r=new M;return this.fileService.createDir(t.destinationFolder.concat("Telemetry"),!1).then(function(e){return n.fileService.createFile(e.nativeURL,n.getExportedFileName(),!0)}).then(function(e){return t.destinationDBFilePath=e.nativeURL,r.body=t,r})},e.prototype.getExportedFileName=function(){return"tm_"+this.deviceInfo.getDeviceID()+"_"+Date.now()+".gsa"},e}(),kr=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},xr=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]=e.minCompatibilityLevel&&t<=e.maxCompatibilityLevel},_.readCompatibilityLevel=function(e){var t=e.compatibilityLevel;return t||this.defaultCompatibilityLevel},_.isDraftContent=function(e){return e&&e===Kn.DRAFT.valueOf()},_.isExpired=function(e){if(e){var t=new Date(e).getTime();if((new Date).getTime()>t)return!0}return!1},_.isDuplicateCheckRequired=function(e,t){return e&&0===t},_.isImportFileExist=function(e,t){if(!e||!t)return!1;var n=!1,r=e[Jt.COLUMN_NAME_IDENTIFIER],i=t.identifier,o=e[Jt.COLUMN_NAME_VISIBILITY],a=_.readVisibility(t);return r===i&&o===a&&(n=this.readPkgVersion(JSON.parse(e[Jt.COLUMN_NAME_LOCAL_DATA]))>=this.readPkgVersion(t)),n},_.readPkgVersion=function(e){return e.pkgVersion},_.readContentType=function(e){var t=e.contentType;return t&&(t=t.toLowerCase()),t},_.readAudience=function(e){var t=e.audience,n=[];return"string"==typeof t&&n.push(t),n&&n.length||n.push("Learner"),n.sort(),n.join(",")},_.readPragma=function(e){var t=e.pragma;return t||(t=[]),t.join(",")},_.doesContentExist=function(e,t,n,r){if(!e)return!1;var i=!1,o=e[Jt.COLUMN_NAME_IDENTIFIER],a=JSON.parse(e[Jt.COLUMN_NAME_LOCAL_DATA]);if(o===t){var c=!1;r?c=!(_.readPkgVersion(a)_.MAX_CONTENT_NAME&&(o=o.substring(0,_.MAX_CONTENT_NAME-3)+"..."),n=o+"-v"+i.pkgVersion+".ecar"}return n},_.readOriginFromContentMap=function(e){var t=e.contentMetadata,n=t&&t.virality;return n?n.origin:""},_.readTransferCountFromContentMap=function(e){var t=e.contentMetadata,n=t&&t.virality;return n?rt.parseInt(n.transferCount):0},_.readSizeFromContentMap=function(e){return e.size?e.size:""},_.getUidnIdentifierFiler=function(e,t){var n=e&&"uid = '"+e+"'",r=t&&"identifier = '"+t+"'",i="";return n&&r?i="WHERE ("+r+" AND "+n+")":r?i="WHERE ("+r+")":n&&(i="WHERE ("+n+")"),i},_.getBasePath=function(e){return e?e=-1!==e.indexOf("file://")?e.replace("file://",""):"file://".concat(e):""},_.getRollup=function(e,t){var n,r,i,o;if(t){var a=void 0;for(a=0;a 0";return"select * from "+Jt.TABLE_NAME+" "+r+" "+n},_.getFindAllContentsQuery=function(){return"select * from "+Jt.TABLE_NAME+" where "+Jt.COLUMN_NAME_REF_COUNT+" > 0"},_.constructContentDBModel=function(e,t,n,r,i,o,a,c,s,u,f,l,h,d,p){var b;return(b={})[Jt.COLUMN_NAME_IDENTIFIER]=e,b[Jt.COLUMN_NAME_SERVER_DATA]="",b[Jt.COLUMN_NAME_PATH]=_.getBasePath(a),b[Jt.COLUMN_NAME_REF_COUNT]=c,b[Jt.COLUMN_NAME_CONTENT_STATE]=s,b[Jt.COLUMN_NAME_SIZE_ON_DEVICE]=l,b[Jt.COLUMN_NAME_MANIFEST_VERSION]=t,b[Jt.COLUMN_NAME_LOCAL_DATA]=n,b[Jt.COLUMN_NAME_MIME_TYPE]=r,b[Jt.COLUMN_NAME_CONTENT_TYPE]=i,b[Jt.COLUMN_NAME_VISIBILITY]=o,b[Jt.COLUMN_NAME_AUDIENCE]=u,b[Jt.COLUMN_NAME_PRAGMA]=f,b[Jt.COLUMN_NAME_LOCAL_LAST_UPDATED_ON]=se().format(),b[Jt.COLUMN_NAME_BOARD]=_.getContentAttribute(h),b[Jt.COLUMN_NAME_MEDIUM]=_.getContentAttribute(d),b[Jt.COLUMN_NAME_GRADE]=_.getContentAttribute(p),b},_.getReferenceCount=function(e,t){var n;return e?(n=e[Jt.COLUMN_NAME_REF_COUNT],qn.DEFAULT.valueOf()===e[Jt.COLUMN_NAME_VISIBILITY]&&qn.DEFAULT.valueOf()===t||(n+=1)):n=1,n},_.getContentVisibility=function(e,t,n){var r;return"Library"===t?r=qn.PARENT.valueOf():e&&!qn.PARENT.valueOf()===e[Jt.COLUMN_NAME_VISIBILITY]&&(r=e[Jt.COLUMN_NAME_VISIBILITY]),r||n},_.getContentState=function(e,t){return e&&e[Jt.COLUMN_NAME_CONTENT_STATE]>t&&(t=e[Jt.COLUMN_NAME_CONTENT_STATE]),t},_.isFreeSpaceAvailable=function(e,t,n){var r=10240;return 0a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] 0\n GROUP BY "+Ft.COLUMN_NAME_QID},e.getQuestionReportsQuery=function(e,t){return"SELECT *, SUM("+Ft.COLUMN_NAME_SCORE+") as marks,\n COUNT ("+Ft.COLUMN_NAME_Q_INDEX+") as occurence_count,\n SUM ("+Ft.COLUMN_NAME_MAX_SCORE+") as sum_max_score\n FROM "+Ft.TABLE_NAME+"\n WHERE "+Ft.COLUMN_NAME_UID+" IN("+Gr.joinPreservingQuotes(e)+")\n AND "+Ft.COLUMN_NAME_CONTENT_ID+"='"+t+"'\n GROUP BY "+Ft.COLUMN_NAME_QID},e.getFilterForLearnerAssessmentDetails=function(e,t,n,r){var i=Ft.COLUMN_NAME_QID+" = '"+e+"'";return"WHERE "+(Ft.COLUMN_NAME_UID+" = '"+t+"'")+" AND "+(Ft.COLUMN_NAME_CONTENT_ID+" = '"+n+"'")+" AND "+(Ft.COLUMN_NAME_HIERARCHY_DATA+" = '"+(r||"")+"'")+" "+(e?" AND "+i:"")},e.getLearnerAssessmentsQuery=function(e){return"SELECT * from "+Ft.TABLE_NAME+" "+e+"\n ORDER BY "+Ft.COLUMN_NAME_Q_INDEX},e.getUpdateSelection=function(){return Ft.COLUMN_NAME_UID+" = ? AND\n "+Ft.COLUMN_NAME_CONTENT_ID+" = ? AND\n "+Ft.COLUMN_NAME_HIERARCHY_DATA+" = ? AND\n "+Ft.COLUMN_NAME_QID+" = ? "},e.getLearnerSummaryReadSelection=function(e){return Ft.COLUMN_NAME_UID+" = ? AND\n "+Ft.COLUMN_NAME_CONTENT_ID+" = ? AND\n "+Ft.COLUMN_NAME_HIERARCHY_DATA+" = ? "},e}(),To=function(){function e(e,t){this.apiService=e,this.courseServiceConfig=t,this.GET_BATCH_DETAILS_ENDPOINT="/batch/read/"}return e.prototype.handle=function(e){var t=(new g.Builder).withType(d.GET).withPath(this.courseServiceConfig.apiPath+this.GET_BATCH_DETAILS_ENDPOINT+e.batchId).withApiToken(!0).withSessionToken(!0).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result.response}))},e}(),No=function(){function e(e,t){this.apiService=e,this.courseServiceConfig=t,this.UPDATE_CONTENT_STATE_ENDPOINT="/content/state/update"}return e.prototype.handle=function(e){var t=(new g.Builder).withType(d.PATCH).withPath(this.courseServiceConfig.apiPath+this.UPDATE_CONTENT_STATE_ENDPOINT).withApiToken(!0).withSessionToken(!0).withBody({request:e}).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result}))},e}(),Mo=function(){function e(e,t,n,r){this.apiService=e,this.courseServiceConfig=t,this.profileService=n,this.authService=r,this.GET_COURSE_BATCHES="/batch/list"}return e.prototype.handle=function(e){var n=this,t=(new g.Builder).withType(d.POST).withPath(this.courseServiceConfig.apiPath+this.GET_COURSE_BATCHES).withApiToken(!0).withSessionToken(!1).withBody({request:e}).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return Array.from(new Set(e.body.result.response.content))}),Object(fe.switchMap)(function(t){return n.authService.getSession().pipe(Object(fe.mergeMap)(function(e){return e?n.profileService.getServerProfiles({limit:t.length,filters:{identifier:new Set(t.map(function(e){return e.createdBy}))},fields:["firstName","lastName","identifier"]}).pipe(Object(fe.map)(function(e){return t.forEach(function(t){t.creatorFirstName=e.find(function(e){return e.identifier===t.createdBy}).firstName,t.creatorLastName=e.find(function(e){return e.identifier===t.createdBy}).lastName}),t})):Object(H.of)(t)}))}))},e}(),wo=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Co=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]=t},t.prototype.findValidProgress=function(e,t){var n=this;return e.find(function(e){return n.isProgressValid(e,t)})},t.prototype.updateLastReadContentId=function(e,t,n,r){var i=ra.LAST_READ_CONTENTID_PREFIX.concat("_").concat(e).concat("_").concat(t).concat("_").concat(n);return this.sharedPreference.putString(i,r)},t.prototype.handle=function(n){var e=this;return"START"===n.eid&&t.checkPData(n.context.pdata)?(this.courseService.resetCapturedAssessmentEvents(),this.processOEStart(n).pipe(Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){return la(this,function(e){switch(e.label){case 0:return[4,this.summarizerService.saveLearnerAssessmentDetails(n).pipe(Object(fe.mapTo)(void 0)).toPromise()];case 1:return e.sent(),[2]}})})}),Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){var t=this;return la(this,function(e){switch(e.label){case 0:return[4,this.getCourseContext().pipe(Object(fe.mergeMap)(function(){return t.updateContentState(n)})).toPromise()];case 1:return e.sent(),[2]}})})}),Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){return la(this,function(e){switch(e.label){case 0:return[4,this.markContentAsPlayed(n).toPromise()];case 1:return e.sent(),[2]}})})}))):"START"===n.eid&&t.checkIsCourse(n)?this.getCourseContext().pipe(Object(fe.mapTo)(void 0)):"ASSESS"===n.eid&&t.checkPData(n.context.pdata)?this.processOEAssess(n).pipe(Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){var t;return la(this,function(e){switch(e.label){case 0:return[4,this.getCourseContext().toPromise()];case 1:return t=e.sent(),n.context.cdata.find(function(e){return"AttemptId"===e.type})&&t.userId&&t.courseId&&t.batchId?[4,this.courseService.captureAssessmentEvent({event:n,courseContext:t})]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}),Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){return la(this,function(e){switch(e.label){case 0:return[4,this.summarizerService.saveLearnerAssessmentDetails(n).pipe(Object(fe.mapTo)(void 0)).toPromise()];case 1:return e.sent(),[2]}})})})):"END"===n.eid&&t.checkPData(n.context.pdata)?this.processOEEnd(n).pipe(Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){return la(this,function(e){switch(e.label){case 0:return[4,this.summarizerService.saveLearnerContentSummaryDetails(n).pipe(Object(fe.mapTo)(void 0)).toPromise()];case 1:return e.sent(),[2]}})})}),Object(fe.tap)(function(){return fa(e,void 0,void 0,function(){var t=this;return la(this,function(e){switch(e.label){case 0:return[4,this.getCourseContext().pipe(Object(fe.mergeMap)(function(){return t.updateContentState(n)})).toPromise()];case 1:return e.sent(),[2]}})})})):"END"===n.eid&&t.checkIsCourse(n)?this.setCourseContextEmpty():Object(H.of)(void 0)},t.prototype.markContentAsPlayed=function(e){var n=this,r=e.actor.id,i=e.object.id,t={contentId:i};return this.contentService.getContentDetails(t).pipe(Object(fe.mergeMap)(function(t){var e={status:pi.PLAYED,contentId:i,contentType:t.contentType};return n.profileService.addContentAccess(e).pipe(Object(fe.mergeMap)(function(){var e={uid:r,contentId:i,data:JSON.stringify(t.contentData),marker:jn.PREVIEWED,isMarked:!0,extraInfo:{}};return n.contentService.setContentMarker(e).pipe(Object(fe.mapTo)(!0))}))}))},t.prototype.getCourseContext=function(){return this.sharedPreference.getString(L.COURSE_CONTEXT).pipe(Object(fe.map)(function(e){return e?JSON.parse(e):{}}))},t.prototype.checkStatusOfContent=function(e,t,n,r){var i=this,o={userId:e,batchId:n,contentIds:[r],courseIds:[t]};return this.courseService.getContentState(o).pipe(Object(fe.map)(function(e){var t=e&&e.contentList;return i.getStatus(t,r)}))},t.prototype.getStatus=function(e,t){void 0===e&&(e=[]);var n=e.find(function(e){return e.contentId===t});return n&&n.status||0},t.prototype.processOEStart=function(e){return this.currentUID=e.actor.id,this.currentContentID=e.object.id,Object(H.of)(void 0)},t.prototype.processOEAssess=function(e){var t=this;return this.currentUID&&this.currentContentID&&this.currentUID.toLocaleLowerCase()===e.actor.id.toLocaleLowerCase()&&this.currentContentID.toLocaleLowerCase()===e.object.id.toLocaleLowerCase()?this.summarizerService.deletePreviousAssessmentDetails(this.currentUID,this.currentContentID).pipe(Object(fe.tap)(function(){t.currentUID=void 0,t.currentContentID=void 0}),Object(fe.mapTo)(void 0)):Object(H.of)(void 0)},t.prototype.processOEEnd=function(e){return Object(H.of)(void 0)},t.CONTENT_PLAYER_PID="contentplayer",t}(),da=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},pa=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]e?t.index:e},0);e.frameworks.sort(function(e,t){return(e.index||n+1)-(t.index||n+1)})}return e}))},e.prototype.fetchFromServer=function(e){var t=(new g.Builder).withType(d.GET).withPath(this.frameworkServiceConfig.channelApiPath+this.GET_FRAMEWORK_DETAILS_ENDPOINT+"/"+e.channelId).withApiToken(!0).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result.channel}))},e.prototype.fetchFromFile=function(e){var t=Yi.ASSETS_PATH+this.frameworkServiceConfig.channelConfigDirPath,n=this.CHANNEL_FILE_KEY_PREFIX+e.channelId+".json";return Object(H.from)(this.fileService.readFileFromAssets(t.concat("/",n))).pipe(Object(fe.map)(function(e){return JSON.parse(e).result.channel}))},e}(),Ha=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=n.categories.length-1||e.category===n.categories[t+1].code})),e})}):e}),Ha({},n)):n},n.prepareFrameworkTranslations=function(e,t){return e.name=n.getTranslatedValue(e.translations,t,e.name),e.categories&&(e.categories=e.categories.map(function(e){return e.name=n.getTranslatedValue(e.translations,t,e.name),e.terms&&(e.terms=e.terms.map(function(e){return e.name=n.getTranslatedValue(e.translations,t,e.name),e})),e})),e},n.prepareFrameworkCategoryTranslations=function(e,t){return e.name=n.getTranslatedValue(e.translations,t,e.name),e.terms&&(e.terms=e.terms.map(function(e){return e.name=n.getTranslatedValue(e.translations,t,e.name),e})),e},n.getTranslatedValue=function(e,t,n){return e&&JSON.parse(e)[t]||n},n}(),za=function(){function e(e,t,n,r,i){this.frameworkService=e,this.apiService=t,this.frameworkServiceConfig=n,this.fileService=r,this.cachedItemStore=i,this.FRAMEWORK_FILE_KEY_PREFIX="framework-",this.FRAMEWORK_LOCAL_KEY="framework-",this.GET_FRAMEWORK_DETAILS_ENDPOINT="/read"}return e.prototype.handle=function(t){var n=this;return Object(H.iif)(function(){return!!t.frameworkId},Object(H.defer)(function(){return n.cachedItemStore.getCached(t.frameworkId,n.FRAMEWORK_LOCAL_KEY,"ttl_"+n.FRAMEWORK_LOCAL_KEY,function(){return n.fetchFromServer(t)},function(){return n.fetchFromFile(t)})}),Object(H.defer)(function(){return n.frameworkService.getDefaultChannelDetails().pipe(Object(fe.mergeMap)(function(e){return n.frameworkService.getFrameworkDetails({frameworkId:e.defaultFramework,requiredCategories:t.requiredCategories})}))}))},e.prototype.fetchFromServer=function(e){var t=(new g.Builder).withType(d.GET).withPath(this.frameworkServiceConfig.frameworkApiPath+this.GET_FRAMEWORK_DETAILS_ENDPOINT+"/"+e.frameworkId).withParameters({categories:e.requiredCategories.join(",")}).withApiToken(!0).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result.framework}),Object(fe.map)(function(e){return qa.prepareFrameworkCategoryAssociations(e)}))},e.prototype.fetchFromFile=function(e){var t=Yi.ASSETS_PATH+this.frameworkServiceConfig.frameworkConfigDirPath,n=this.FRAMEWORK_FILE_KEY_PREFIX+e.frameworkId+".json";return Object(H.from)(this.fileService.readFileFromAssets(t.concat("/",n))).pipe(Object(fe.map)(function(e){return JSON.parse(e).result.framework}),Object(fe.map)(function(e){return qa.prepareFrameworkCategoryAssociations(e)}))},e}(),Ka=(ca=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}ca(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Wa=function(n){function r(e){var t=n.call(this,e,"NO_ACTIVE_CHANNEL_FOUND_ERROR")||this;return Object.setPrototypeOf(t,r.prototype),t}return Ka(r,n),r}(_),Xa=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;0<=c;c--)(i=e[c])&&(a=(o<3?i(a):3a[0]&&t[1]e?t.index:e},0);return t.sort(function(e,t){return(e.index||n+1)-(t.index||n+1)}),t}))},e.prototype.getActiveChannelTranslatedDefaultFrameworkDetails=function(t,n){var r=this;return this.frameworkUtilService.getActiveChannel().pipe(Object(fe.mergeMap)(function(e){return r.getTranslatedFrameworkDetails(e.defaultFramework,t,n)}))},e.prototype.getTranslatedFrameworkDetails=function(e,t,n){return this.frameworkService.getFrameworkDetails({frameworkId:e,requiredCategories:t}).pipe(Object(fe.map)(function(e){return qa.prepareFrameworkTranslations(e,n)}))},e.prototype.getAllCategoriesTermsSet=function(e){return e.categories?e.categories.reduce(function(e,t){return e.concat([t.terms||[]])},[]).reduce(function(e,t){return e.concat(t)},[]).reduce(function(e,t){return e.add(t),e},new rc.a(function(e){return Object(ic.makeString)(e)})):new rc.a},e.prototype.getCategoryTerms=function(e,t){return e.categories.find(function(e){return e.code===t.currentCategoryCode}).terms.reduce(function(e,t){return e.add(t),e},new rc.a(function(e){return Object(ic.makeString)(e)}))},e.prototype.getCategoryAssociationTerms=function(e,n){var r=this;if(!e.categories)return new rc.a;var t=e.categories.find(function(e){return e.code===n.prevCategoryCode}).terms;if(!t)return new rc.a;var i=t.filter(function(t){return n.selectedTermsCodes.find(function(e){return e===t.code})}).map(function(e){return e.associations||[]});return i.some(function(e){return 0===e.length})?e.categories.find(function(e){return e.code===n.currentCategoryCode}).terms.reduce(function(e,t){return e.add(t),e},new rc.a(function(e){return Object(ic.makeString)(e)})):i.reduce(function(e,t){return e.concat(t)}).reduce(function(e,t){return e.add(t),e},new rc.a(function(e){return Object(ic.makeString)(e)})).toArray().map(function(t){return r.getAllCategoriesTermsSet(e).toArray().find(function(e){return e.code===t.code})}).reduce(function(e,t){return e.add(t),e},new rc.a(function(e){return Object(ic.makeString)(e)}))},e}(),sc=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;0<=c;c--)(i=e[c])&&(a=(o<3?i(a):3a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] 0",r="SELECT * FROM "+Jt.TABLE_NAME+" "+n;return this.dbService.execute(r).toPromise()},e.prototype.rm=function(e,r){return new Promise(function(t,n){try{buildconfigreader.rm(e,r,function(e){t(e)},function(e){console.error(e),n(!1)})}catch(e){console.error(e),n(!1)}})},e.prototype.getMetaData=function(r){return Ac(this,void 0,void 0,function(){return Tc(this,function(e){return[2,new Promise(function(t,n){buildconfigreader.getMetaData(r,function(e){t(e)},function(e){console.error(e),n(e)})})]})})},e}(),Mc=Object.assign||function(e){for(var t,n=1,r=arguments.length;na[0]&&t[1]a[0]&&t[1] 0",r="select * from "+Jt.TABLE_NAME+" "+n;return this.dbService.execute(r).toPromise()},r.EKSTEP_CONTENT_ARCHIVE="ekstep.content.archive",r.SUPPORTED_MANIFEST_VERSION="1.1",r}(),xc=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Bc=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]T.pkgVersion&&T.childNodes&&0a[0]&&t[1] 0";return this.dbService.execute(t).toPromise()},e.prototype.updateAllRootContentSize=function(){var e=this,t="SELECT * FROM "+Jt.TABLE_NAME+" WHERE "+Jt.COLUMN_NAME_REF_COUNT+" > 0\n AND "+Jt.COLUMN_NAME_VISIBILITY+" = '"+qn.DEFAULT.valueOf()+"'";return this.dbService.execute(t).pipe(Object(fe.tap)(function(){return fs(e,void 0,void 0,function(){return ls(this,function(e){return[2,this.sharedPreferences.putBoolean(L.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!1).toPromise()]})})}),Object(fe.mergeMap)(function(n){return fs(e,void 0,void 0,function(){var i,t=this;return ls(this,function(e){switch(e.label){case 0:return i=[],[4,Promise.all(n.map(function(r){return fs(t,void 0,void 0,function(){var t,n;return ls(this,function(e){switch(e.label){case 0:return[4,this.getSizeOnDevice(r)];case 1:return t=e.sent(),(n=JSON.parse(r[Jt.COLUMN_NAME_LOCAL_DATA]).childNodes)?[4,this.findAllChildContents(n)]:[3,3];case 2:e.sent().forEach(function(e){t+=e[Jt.COLUMN_NAME_SIZE_ON_DEVICE]||0}),r[Jt.COLUMN_NAME_SIZE_ON_DEVICE]=t,i.push(r),e.label=3;case 3:return[2]}})})}))];case 1:return e.sent(),this.updateInDb(i),[2]}})})}),Object(fe.tap)(function(){return fs(e,void 0,void 0,function(){return ls(this,function(e){return[2,this.sharedPreferences.putBoolean(L.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!0).toPromise()]})})}))},e.prototype.getSizeOnDevice=function(a){return fs(this,void 0,void 0,function(){var t,n,r,i,o;return ls(this,function(e){switch(e.label){case 0:return t=0,a[Jt.COLUMN_NAME_MIME_TYPE]!==Gn.COLLECTION.valueOf()?[3,3]:a[Jt.COLUMN_NAME_VISIBILITY]!==qn.DEFAULT.valueOf()?[3,2]:(n=[],r={},i=a[Jt.COLUMN_NAME_IDENTIFIER],r.identifier=i,r.path=a[Jt.COLUMN_NAME_PATH],n.push(r),[4,this.getMetaData(n)]);case 1:o=e.sent(),t=o[i]?o[i].size:0,e.label=2;case 2:return[3,4];case 3:t=a[Jt.COLUMN_NAME_SIZE_ON_DEVICE]?a[Jt.COLUMN_NAME_SIZE_ON_DEVICE]:0,e.label=4;case 4:return[2,Promise.resolve(t||0)]}})})},e.prototype.updateInDb=function(a){return fs(this,void 0,void 0,function(){var t,n,r,i,o;return ls(this,function(e){for(this.dbService.beginTransaction(),t=0,n=a;ta[0]&&t[1]t&&(t=e[Jt.COLUMN_NAME_CONTENT_STATE]),t},e.prototype.getBasePath=function(e,t,n){return e&&!t?e:n},e.prototype.getReferenceCount=function(e,t,n,r){var i;e?(i=e[Jt.COLUMN_NAME_REF_COUNT],(r?r[e[Jt.COLUMN_NAME_IDENTIFIER]]:void 0)||n||qn.DEFAULT.valueOf()===e[bs]&&qn.DEFAULT.valueOf()===t||(i+=1)):i=1;return i},e.prototype.postImportProgressEvent=function(e,t){this.eventsBusService.emit({namespace:ie.CONTENT,event:{type:sr.IMPORT_PROGRESS,payload:{totalCount:t,currentCount:e}}})},e.prototype.constructContentDBModel=function(e,t,n,r,i,o,a,c,s,u,f,l,h,d,p){var b;return(b={})[Jt.COLUMN_NAME_IDENTIFIER]=e,b[Jt.COLUMN_NAME_SERVER_DATA]="",b[Jt.COLUMN_NAME_PATH]=Hi.getBasePath(a),b[Jt.COLUMN_NAME_REF_COUNT]=c,b[Jt.COLUMN_NAME_CONTENT_STATE]=s,b[Jt.COLUMN_NAME_SIZE_ON_DEVICE]=l,b[Jt.COLUMN_NAME_MANIFEST_VERSION]=t,b[Jt.COLUMN_NAME_LOCAL_DATA]=n,b[Jt.COLUMN_NAME_MIME_TYPE]=r,b[Jt.COLUMN_NAME_CONTENT_TYPE]=i,b[Jt.COLUMN_NAME_VISIBILITY]=o,b[Jt.COLUMN_NAME_AUDIENCE]=u,b[Jt.COLUMN_NAME_PRAGMA]=f,b[Jt.COLUMN_NAME_LOCAL_LAST_UPDATED_ON]=se(Date.now()).format(),b[Jt.COLUMN_NAME_BOARD]=Hi.getContentAttribute(h),b[Jt.COLUMN_NAME_MEDIUM]=Hi.getContentAttribute(d),b[Jt.COLUMN_NAME_GRADE]=Hi.getContentAttribute(p),b},e.prototype.createDirectories=function(r,i){return ds(this,void 0,void 0,function(){return ps(this,function(e){return[2,new Promise(function(t,n){buildconfigreader.createDirectories(Hi.getBasePath(r),i,function(e){t(e)},function(e){console.error(e),n(e)})})]})})},e}(),Es=n(125),ys=n.n(Es),vs=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},gs=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] ?",[Date.now().toString(),Date.now().toString()];break;case oh.UNREAD:on.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+on.COLUMN_NAME_EXPIRY_TIME+" > ? AND\n AND "+on.COLUMN_NAME_IS_READ+" > ?",[Date.now().toString(),Date.now().toString(),0];break;case oh.READ:default:on.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+on.COLUMN_NAME_EXPIRY_TIME+" > ?\n AND "+on.COLUMN_NAME_IS_READ+" > ?",[Date.now().toString(),Date.now().toString(),1]}return{table:on.TABLE_NAME,orderBy:on.COLUMN_NAME_NOTIFICATION_RECEIVED_AT+" desc"}},e}(),Mh=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;0<=c;c--)(i=e[c])&&(a=(o<3?i(a):3a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] {\n window.location.href = `"+a.buildUrl(t,n,r)+"`;\n })()"}),[2]})})},a.prototype.success=function(){return lp(this,void 0,void 0,function(){return hp(this,function(e){return[2,fp({},this.captured)]})})},a.prototype.fail=function(){return lp(this,void 0,void 0,function(){return hp(this,function(e){throw fp({},this.captured)})})},a.prototype.getCaptureExtras=function(){return lp(this,void 0,void 0,function(){return hp(this,function(e){return[2,fp({},this.extras)]})})},a}(),pp=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},bp=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]>>((3&t)<<3)&255;return i}}},function(e,t){for(var i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,r=i;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(19),r=function(){function e(e){this.table={},this.nElements=0,this.toStr=e||o.defaultToString}return e.prototype.getValue=function(e){var t=this.table["$"+this.toStr(e)];if(!o.isUndefined(t))return t.value},e.prototype.setValue=function(e,t){if(!o.isUndefined(e)&&!o.isUndefined(t)){var n,r="$"+this.toStr(e),i=this.table[r];return n=o.isUndefined(i)?void this.nElements++:i.value,this.table[r]={key:e,value:t},n}},e.prototype.remove=function(e){var t="$"+this.toStr(e),n=this.table[t];if(!o.isUndefined(n))return delete this.table[t],this.nElements--,n.value},e.prototype.keys=function(){var e=[];for(var t in this.table)if(o.has(this.table,t)){var n=this.table[t];e.push(n.key)}return e},e.prototype.values=function(){var e=[];for(var t in this.table)if(o.has(this.table,t)){var n=this.table[t];e.push(n.value)}return e},e.prototype.forEach=function(e){for(var t in this.table)if(o.has(this.table,t)){var n=this.table[t];if(!1===e(n.key,n.value))return}},e.prototype.containsKey=function(e){return!o.isUndefined(this.getValue(e))},e.prototype.clear=function(){this.table={},this.nElements=0},e.prototype.size=function(){return this.nElements},e.prototype.isEmpty=function(){return this.nElements<=0},e.prototype.toString=function(){var n="{";return this.forEach(function(e,t){n+="\n\t"+e+" : "+t}),n+"\n}"},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(19),i=n(120),r=function(){function r(){this.firstNode=null,this.lastNode=null,this.nElements=0}return r.prototype.add=function(e,t){if(o.isUndefined(t)&&(t=this.nElements),t<0||t>this.nElements||o.isUndefined(e))return!1;var n=this.createNode(e);if(0===this.nElements||null===this.lastNode)this.firstNode=n,this.lastNode=n;else if(t===this.nElements)this.lastNode.next=n,this.lastNode=n;else if(0===t)n.next=this.firstNode,this.firstNode=n;else{var r=this.nodeAtIndex(t-1);if(null==r)return!1;n.next=r.next,r.next=n}return this.nElements++,!0},r.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},r.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},r.prototype.elementAtIndex=function(e){var t=this.nodeAtIndex(e);if(null!==t)return t.element},r.prototype.indexOf=function(e,t){var n=t||o.defaultEquals;if(o.isUndefined(e))return-1;for(var r=this.firstNode,i=0;null!==r;){if(n(r.element,e))return i;i++,r=r.next}return-1},r.prototype.contains=function(e,t){return 0<=this.indexOf(e,t)},r.prototype.remove=function(e,t){var n=t||o.defaultEquals;if(this.nElements<1||o.isUndefined(e))return!1;for(var r=null,i=this.firstNode;null!==i;){if(n(i.element,e))return null==r?(this.firstNode=i.next,i===this.lastNode&&(this.lastNode=null)):(i===this.lastNode?(this.lastNode=r).next=i.next:r.next=i.next,i.next=null),this.nElements--,!0;i=(r=i).next}return!1},r.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},r.prototype.equals=function(e,t){var n=t||o.defaultEquals;return e instanceof r&&(this.size()===e.size()&&this.equalsAux(this.firstNode,e.firstNode,n))},r.prototype.equalsAux=function(e,t,n){for(;null!==e&&null!==t;){if(!n(e.element,t.element))return!1;e=e.next,t=t.next}return!0},r.prototype.removeElementAtIndex=function(e){if(!(e<0||e>=this.nElements||null===this.firstNode||null===this.lastNode)){var t;if(1===this.nElements)t=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var n=this.nodeAtIndex(e-1);null===n?(t=this.firstNode.element,this.firstNode=this.firstNode.next):n.next===this.lastNode&&(t=this.lastNode.element,this.lastNode=n),null!==n&&null!==n.next&&(t=n.next.element,n.next=n.next.next)}return this.nElements--,t}},r.prototype.forEach=function(e){for(var t=this.firstNode;null!==t&&!1!==e(t.element);)t=t.next},r.prototype.reverse=function(){for(var e=null,t=this.firstNode,n=null;null!==t;)n=t.next,t.next=e,e=t,t=n;n=this.firstNode,this.firstNode=this.lastNode,this.lastNode=n},r.prototype.toArray=function(){for(var e=[],t=this.firstNode;null!==t;)e.push(t.element),t=t.next;return e},r.prototype.size=function(){return this.nElements},r.prototype.isEmpty=function(){return this.nElements<=0},r.prototype.toString=function(){return i.toString(this.toArray())},r.prototype.nodeAtIndex=function(e){if(e<0||e>=this.nElements)return null;if(e===this.nElements-1)return this.lastNode;for(var t=this.firstNode,n=0;na[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]this.telemetryConfig.telemetryLogMinAllowedOffset?r:0)?[4,jr.log.interact({type:Xe.OTHER,subType:Qe.DEVICE_TIME_OFFSET_FOUND,env:"sdk",pageId:"sdk",id:"sdk",valueMap:{deviceTime:n,offsetTime:i}}).toPromise()]:[3,3];case 1:return e.sent(),[4,this.keyValueStore.setValue(c.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY,i+"").toPromise()];case 2:e.sent(),e.label=3;case 3:return[2]}})})}),Object(fe.mergeMap)(function(){return Object(H.zip)(i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,Date.now()+""),i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,"true")).pipe(Object(fe.mapTo)(void 0))}),Object(fe.catchError)(function(e){return Object(H.zip)(i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,Date.now()+""),i.keyValueStore.setValue(c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,"false")).pipe(Object(fe.mergeMap)(function(){throw console.error(e),new Error("Device Registration Failed")}))}))}))},c.prototype.hasTelemetryThresholdCrossed=function(){var t=this;return this.dbService.execute("\n SELECT count(*) as COUNT FROM "+St.TABLE_NAME).pipe(Object(fe.map)(function(e){return!!(e&&e[0]&&e[0].COUNT>=t.telemetryConfig.telemetrySyncThreshold)}))},c.prototype.fetchEvents=function(){return this.dbService.execute("\n SELECT * FROM "+St.TABLE_NAME+"\n WHERE "+St.COLUMN_NAME_PRIORITY+" = (SELECT MIN ("+St.COLUMN_NAME_PRIORITY+")\n FROM "+St.TABLE_NAME+")\n ORDER BY "+St.COLUMN_NAME_TIMESTAMP+"\n LIMIT "+this.telemetryConfig.telemetrySyncBandwidth)},c.prototype.processEvents=function(e){if(!e.length)return Object(H.of)({processedEventsSize:0});var t=Tr.generateUniqueId();return Object(H.of)({processedEvents:this.preprocessors.reduce(function(e,t){return t.process(e)},{id:"ekstep.telemetry",ver:"1.0",ts:ue()().format("YYYY-MM-DDTHH:mm:ss[Z]"),events:e.map(function(e){return JSON.parse(e[St.COLUMN_NAME_EVENT])}),params:{did:this.deviceInfo.getDeviceID(),msgid:t,key:"",requesterId:""}}),processedEventsSize:e.length,messageId:t})},c.prototype.persistProcessedEvents=function(e,t){var n,r=e.processedEvents,i=e.messageId;if(!r)return Object(H.of)(void 0);var o={table:Tt.TABLE_NAME,modelJson:(n={},n[Tt.COLUMN_NAME_MSG_ID]=i,n[Tt.COLUMN_NAME_NUMBER_OF_EVENTS]=t,n[St.COLUMN_NAME_PRIORITY]=1,n[Tt.COLUMN_NAME_DATA]=r,n)};return this.dbService.insert(o).pipe(Object(fe.mapTo)(void 0))},c.prototype.deleteEvents=function(e){return e.length?this.dbService.execute("\n DELETE FROM "+St.TABLE_NAME+"\n WHERE "+St._ID+" IN ("+e.map(function(e){return e[St._ID]}).join(",")+")\n "):Object(H.of)(void 0)},c.prototype.handleProcessedEventsBatch=function(e){var n=this;return Object(H.iif)(function(){return!!e},Object(H.of)(void 0),this.sharedPreferences.getString(V.KEY_AUTO_SYNC_MODE).pipe(Object(fe.catchError)(function(){return Object(H.of)("")}),Object(fe.mergeMap)(function(e){switch(e){case xh.OFF:throw new Error("AUTO_SYNC_MODE: "+xh.OFF);case xh.OVER_WIFI:if(navigator.connection.type===Connection.WIFI)return Object(H.of)(void 0);throw new Error("AUTO_SYNC_MODE: "+xh.OVER_WIFI);case xh.ALWAYS_ON:default:return Object(H.of)(void 0)}}))).pipe(Object(fe.mergeMap)(function(){return n.fetchProcessedEventsBatch().pipe(Object(fe.mergeMap)(function(t){return n.syncProcessedEvent(t).pipe(Object(fe.mergeMap)(function(e){return n.deleteProcessedEvent(t).pipe(Object(fe.mapTo)(e||{syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0}))}))}))}),Object(fe.catchError)(function(e){return Object(H.of)({syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0,error:e})}))},c.prototype.fetchProcessedEventsBatch=function(){return this.dbService.read({table:Tt.TABLE_NAME,selection:"",selectionArgs:[],limit:"1"}).pipe(Object(fe.map)(function(e){return e&&e[0]}))},c.prototype.syncProcessedEvent=function(e){var t=this;if(!e)return Object(H.of)(void 0);var n=e[Tt.COLUMN_NAME_DATA].split("").map(function(e){return e.charCodeAt(0)}),r=new Uint8Array(n),i=(new g.Builder).withHost(this.telemetryConfig.host).withType(d.POST).withPath(this.telemetryConfig.apiPath+c.TELEMETRY_ENDPOINT).withBody(r).withApiToken(!0).build();return this.apiService.fetch(i).pipe(Object(fe.tap)(function(o){return Ur(t,void 0,void 0,function(){var t,n,r,i;return kr(this,function(e){switch(e.label){case 0:return[4,this.keyValueStore.getValue(c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY).toPromise()];case 1:return"false"!==e.sent()?[3,3]:(t=new Date(o.body.ets).getTime(),n=Date.now(),r=t-n,(i=Math.abs(r)>this.telemetryConfig.telemetryLogMinAllowedOffset?r:0)?[4,this.keyValueStore.setValue(c.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY,i+"").toPromise()]:[3,3]);case 2:e.sent(),e.label=3;case 3:return[2]}})})}),Object(fe.map)(function(){return{syncedEventCount:e[Tt.COLUMN_NAME_NUMBER_OF_EVENTS],syncTime:Date.now(),syncedFileSize:(new TextEncoder).encode(e[Tt.COLUMN_NAME_DATA]).length}}))},c.prototype.deleteProcessedEvent=function(e){return e?this.dbService.delete({table:Tt.TABLE_NAME,selection:"_id = ?",selectionArgs:[e[Tt._ID]]}):Object(H.of)(void 0)},c.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY="telemetry_log_min_allowed_offset_key",c.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY="last_synced_device_register_attempt_time_stamp",c.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY="last_synced_device_register_is_successful",c.TELEMETRY_ENDPOINT="/telemetry",c.REGISTER_API_SUCCESS_TTL=864e5,c.REGISTER_API_FAILURE_TTL=36e5,c}(),Br=function(){function e(e,t){this.fileService=e,this.deviceInfo=t}return e.prototype.execute=function(t){var n=this,r=new M;return this.fileService.createDir(t.destinationFolder.concat("Telemetry"),!1).then(function(e){return n.fileService.createFile(e.nativeURL,n.getExportedFileName(),!0)}).then(function(e){return t.destinationDBFilePath=e.nativeURL,r.body=t,r})},e.prototype.getExportedFileName=function(){return"tm_"+this.deviceInfo.getDeviceID()+"_"+Date.now()+".gsa"},e}(),Fr=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Vr=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]=e.minCompatibilityLevel&&t<=e.maxCompatibilityLevel},_.readCompatibilityLevel=function(e){var t=e.compatibilityLevel;return t||this.defaultCompatibilityLevel},_.isDraftContent=function(e){return e&&e===Jn.DRAFT.valueOf()},_.isExpired=function(e){if(e){var t=new Date(e).getTime();if((new Date).getTime()>t)return!0}return!1},_.isDuplicateCheckRequired=function(e,t){return e&&0===t},_.isImportFileExist=function(e,t){if(!e||!t)return!1;var n=!1,r=e[Zt.COLUMN_NAME_IDENTIFIER],i=t.identifier,o=e[Zt.COLUMN_NAME_VISIBILITY],a=_.readVisibility(t);return r===i&&o===a&&(n=this.readPkgVersion(JSON.parse(e[Zt.COLUMN_NAME_LOCAL_DATA]))>=this.readPkgVersion(t)),n},_.readPkgVersion=function(e){return e.pkgVersion},_.readContentType=function(e){var t=e.contentType;return t&&(t=t.toLowerCase()),t},_.readAudience=function(e){var t=e.audience,n=[];return"string"==typeof t&&n.push(t),n&&n.length||n.push("Learner"),n.sort(),n.join(",")},_.readPragma=function(e){var t=e.pragma;return t||(t=[]),t.join(",")},_.doesContentExist=function(e,t,n,r){if(!e)return!1;var i=!1,o=e[Zt.COLUMN_NAME_IDENTIFIER],a=JSON.parse(e[Zt.COLUMN_NAME_LOCAL_DATA]);if(o===t){var c=!1;r?c=!(_.readPkgVersion(a)_.MAX_CONTENT_NAME&&(o=o.substring(0,_.MAX_CONTENT_NAME-3)+"..."),n=o+"-v"+i.pkgVersion+".ecar"}return n},_.readOriginFromContentMap=function(e){var t=e.contentMetadata,n=t&&t.virality;return n?n.origin:""},_.readTransferCountFromContentMap=function(e){var t=e.contentMetadata,n=t&&t.virality;return n?at.parseInt(n.transferCount):0},_.readSizeFromContentMap=function(e){return e.size?e.size:""},_.getUidnIdentifierFiler=function(e,t){var n=e&&"uid = '"+e+"'",r=t&&"identifier = '"+t+"'",i="";return n&&r?i="WHERE ("+r+" AND "+n+")":r?i="WHERE ("+r+")":n&&(i="WHERE ("+n+")"),i},_.getBasePath=function(e){return e?e=-1!==e.indexOf("file://")?e.replace("file://",""):"file://".concat(e):""},_.getRollup=function(e,t){var n,r,i,o;if(t){var a=void 0;for(a=0;a 0";return"select * from "+Zt.TABLE_NAME+" "+r+" "+n},_.getFindAllContentsQuery=function(){return"select * from "+Zt.TABLE_NAME+" where "+Zt.COLUMN_NAME_REF_COUNT+" > 0"},_.constructContentDBModel=function(e,t,n,r,i,o,a,c,s,u,f,l,h,d,p){var b;return(b={})[Zt.COLUMN_NAME_IDENTIFIER]=e,b[Zt.COLUMN_NAME_SERVER_DATA]="",b[Zt.COLUMN_NAME_PATH]=_.getBasePath(a),b[Zt.COLUMN_NAME_REF_COUNT]=c,b[Zt.COLUMN_NAME_CONTENT_STATE]=s,b[Zt.COLUMN_NAME_SIZE_ON_DEVICE]=l,b[Zt.COLUMN_NAME_MANIFEST_VERSION]=t,b[Zt.COLUMN_NAME_LOCAL_DATA]=n,b[Zt.COLUMN_NAME_MIME_TYPE]=r,b[Zt.COLUMN_NAME_CONTENT_TYPE]=i,b[Zt.COLUMN_NAME_VISIBILITY]=o,b[Zt.COLUMN_NAME_AUDIENCE]=u,b[Zt.COLUMN_NAME_PRAGMA]=f,b[Zt.COLUMN_NAME_LOCAL_LAST_UPDATED_ON]=se().format(),b[Zt.COLUMN_NAME_BOARD]=_.getContentAttribute(h),b[Zt.COLUMN_NAME_MEDIUM]=_.getContentAttribute(d),b[Zt.COLUMN_NAME_GRADE]=_.getContentAttribute(p),b},_.getReferenceCount=function(e,t){var n;return e?(n=e[Zt.COLUMN_NAME_REF_COUNT],Wn.DEFAULT.valueOf()===e[Zt.COLUMN_NAME_VISIBILITY]&&Wn.DEFAULT.valueOf()===t||(n+=1)):n=1,n},_.getContentVisibility=function(e,t,n){var r;return"Library"===t?r=Wn.PARENT.valueOf():e&&!Wn.PARENT.valueOf()===e[Zt.COLUMN_NAME_VISIBILITY]&&(r=e[Zt.COLUMN_NAME_VISIBILITY]),r||n},_.getContentState=function(e,t){return e&&e[Zt.COLUMN_NAME_CONTENT_STATE]>t&&(t=e[Zt.COLUMN_NAME_CONTENT_STATE]),t},_.isFreeSpaceAvailable=function(e,t,n){var r=10240;return 0a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] 0\n GROUP BY "+Gt.COLUMN_NAME_QID},e.getQuestionReportsQuery=function(e,t){return"SELECT *, SUM("+Gt.COLUMN_NAME_SCORE+") as marks,\n COUNT ("+Gt.COLUMN_NAME_Q_INDEX+") as occurence_count,\n SUM ("+Gt.COLUMN_NAME_MAX_SCORE+") as sum_max_score\n FROM "+Gt.TABLE_NAME+"\n WHERE "+Gt.COLUMN_NAME_UID+" IN("+zr.joinPreservingQuotes(e)+")\n AND "+Gt.COLUMN_NAME_CONTENT_ID+"='"+t+"'\n GROUP BY "+Gt.COLUMN_NAME_QID},e.getFilterForLearnerAssessmentDetails=function(e,t,n,r){var i=Gt.COLUMN_NAME_QID+" = '"+e+"'";return"WHERE "+(Gt.COLUMN_NAME_UID+" = '"+t+"'")+" AND "+(Gt.COLUMN_NAME_CONTENT_ID+" = '"+n+"'")+" AND "+(Gt.COLUMN_NAME_HIERARCHY_DATA+" = '"+(r||"")+"'")+" "+(e?" AND "+i:"")},e.getLearnerAssessmentsQuery=function(e){return"SELECT * from "+Gt.TABLE_NAME+" "+e+"\n ORDER BY "+Gt.COLUMN_NAME_Q_INDEX},e.getUpdateSelection=function(){return Gt.COLUMN_NAME_UID+" = ? AND\n "+Gt.COLUMN_NAME_CONTENT_ID+" = ? AND\n "+Gt.COLUMN_NAME_HIERARCHY_DATA+" = ? AND\n "+Gt.COLUMN_NAME_QID+" = ? "},e.getLearnerSummaryReadSelection=function(e){return Gt.COLUMN_NAME_UID+" = ? AND\n "+Gt.COLUMN_NAME_CONTENT_ID+" = ? AND\n "+Gt.COLUMN_NAME_HIERARCHY_DATA+" = ? "},e}(),wo=function(){function e(e,t){this.apiService=e,this.courseServiceConfig=t,this.GET_BATCH_DETAILS_ENDPOINT="/batch/read/"}return e.prototype.handle=function(e){var t=(new g.Builder).withType(d.GET).withPath(this.courseServiceConfig.apiPath+this.GET_BATCH_DETAILS_ENDPOINT+e.batchId).withApiToken(!0).withSessionToken(!0).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result.response}))},e}(),Co=function(){function e(e,t){this.apiService=e,this.courseServiceConfig=t,this.UPDATE_CONTENT_STATE_ENDPOINT="/content/state/update"}return e.prototype.handle=function(e){var t=(new g.Builder).withType(d.PATCH).withPath(this.courseServiceConfig.apiPath+this.UPDATE_CONTENT_STATE_ENDPOINT).withApiToken(!0).withSessionToken(!0).withBody({request:e}).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result}))},e}(),Io=function(){function e(e,t,n,r){this.apiService=e,this.courseServiceConfig=t,this.profileService=n,this.authService=r,this.GET_COURSE_BATCHES="/batch/list"}return e.prototype.handle=function(e){var n=this,t=(new g.Builder).withType(d.POST).withPath(this.courseServiceConfig.apiPath+this.GET_COURSE_BATCHES).withApiToken(!0).withSessionToken(!1).withBody({request:e}).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return Array.from(new Set(e.body.result.response.content))}),Object(fe.switchMap)(function(t){return n.authService.getSession().pipe(Object(fe.mergeMap)(function(e){return e?n.profileService.getServerProfiles({limit:t.length,filters:{identifier:new Set(t.map(function(e){return e.createdBy}))},fields:["firstName","lastName","identifier"]}).pipe(Object(fe.map)(function(e){return t.forEach(function(t){t.creatorFirstName=e.find(function(e){return e.identifier===t.createdBy}).firstName,t.creatorLastName=e.find(function(e){return e.identifier===t.createdBy}).lastName}),t})):Object(H.of)(t)}))}))},e}(),Po=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Lo=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]=t},t.prototype.findValidProgress=function(e,t){var n=this;return e.find(function(e){return n.isProgressValid(e,t)})},t.prototype.updateLastReadContentId=function(e,t,n,r){var i=aa.LAST_READ_CONTENTID_PREFIX.concat("_").concat(e).concat("_").concat(t).concat("_").concat(n);return this.sharedPreference.putString(i,r)},t.prototype.handle=function(n){var e=this;return"START"===n.eid&&t.checkPData(n.context.pdata)?(this.courseService.resetCapturedAssessmentEvents(),this.processOEStart(n).pipe(Object(fe.tap)(function(){return da(e,void 0,void 0,function(){return pa(this,function(e){switch(e.label){case 0:return[4,this.summarizerService.saveLearnerAssessmentDetails(n).pipe(Object(fe.mapTo)(void 0)).toPromise()];case 1:return e.sent(),[2]}})})}),Object(fe.tap)(function(){return da(e,void 0,void 0,function(){var t=this;return pa(this,function(e){switch(e.label){case 0:return[4,this.getCourseContext().pipe(Object(fe.mergeMap)(function(){return t.updateContentState(n)})).toPromise()];case 1:return e.sent(),[2]}})})}),Object(fe.tap)(function(){return da(e,void 0,void 0,function(){return pa(this,function(e){switch(e.label){case 0:return[4,this.markContentAsPlayed(n).toPromise()];case 1:return e.sent(),[2]}})})}))):"START"===n.eid&&t.checkIsCourse(n)?this.getCourseContext().pipe(Object(fe.mapTo)(void 0)):"ASSESS"===n.eid&&t.checkPData(n.context.pdata)?this.processOEAssess(n).pipe(Object(fe.tap)(function(){return da(e,void 0,void 0,function(){var t;return pa(this,function(e){switch(e.label){case 0:return[4,this.getCourseContext().toPromise()];case 1:return t=e.sent(),n.context.cdata.find(function(e){return"AttemptId"===e.type})&&t.userId&&t.courseId&&t.batchId?[4,this.courseService.captureAssessmentEvent({event:n,courseContext:t})]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}),Object(fe.tap)(function(){return da(e,void 0,void 0,function(){return pa(this,function(e){switch(e.label){case 0:return[4,this.summarizerService.saveLearnerAssessmentDetails(n).pipe(Object(fe.mapTo)(void 0)).toPromise()];case 1:return e.sent(),[2]}})})})):"END"===n.eid&&t.checkPData(n.context.pdata)?this.processOEEnd(n).pipe(Object(fe.tap)(function(){return da(e,void 0,void 0,function(){return pa(this,function(e){switch(e.label){case 0:return[4,this.summarizerService.saveLearnerContentSummaryDetails(n).pipe(Object(fe.mapTo)(void 0)).toPromise()];case 1:return e.sent(),[2]}})})}),Object(fe.tap)(function(){return da(e,void 0,void 0,function(){var t=this;return pa(this,function(e){switch(e.label){case 0:return[4,this.getCourseContext().pipe(Object(fe.mergeMap)(function(){return t.updateContentState(n)})).toPromise()];case 1:return e.sent(),[2]}})})})):"END"===n.eid&&t.checkIsCourse(n)?this.setCourseContextEmpty():Object(H.of)(void 0)},t.prototype.markContentAsPlayed=function(e){var n=this,r=e.actor.id,i=e.object.id,t={contentId:i};return this.contentService.getContentDetails(t).pipe(Object(fe.mergeMap)(function(t){var e={status:Ei.PLAYED,contentId:i,contentType:t.contentType};return n.profileService.addContentAccess(e).pipe(Object(fe.mergeMap)(function(){var e={uid:r,contentId:i,data:JSON.stringify(t.contentData),marker:xn.PREVIEWED,isMarked:!0,extraInfo:{}};return n.contentService.setContentMarker(e).pipe(Object(fe.mapTo)(!0))}))}))},t.prototype.getCourseContext=function(){return this.sharedPreference.getString(L.COURSE_CONTEXT).pipe(Object(fe.map)(function(e){return e?JSON.parse(e):{}}))},t.prototype.checkStatusOfContent=function(e,t,n,r){var i=this,o={userId:e,batchId:n,contentIds:[r],courseIds:[t]};return this.courseService.getContentState(o).pipe(Object(fe.map)(function(e){var t=e&&e.contentList;return i.getStatus(t,r)}))},t.prototype.getStatus=function(e,t){void 0===e&&(e=[]);var n=e.find(function(e){return e.contentId===t});return n&&n.status||0},t.prototype.processOEStart=function(e){return this.currentUID=e.actor.id,this.currentContentID=e.object.id,Object(H.of)(void 0)},t.prototype.processOEAssess=function(e){var t=this;return this.currentUID&&this.currentContentID&&this.currentUID.toLocaleLowerCase()===e.actor.id.toLocaleLowerCase()&&this.currentContentID.toLocaleLowerCase()===e.object.id.toLocaleLowerCase()?this.summarizerService.deletePreviousAssessmentDetails(this.currentUID,this.currentContentID).pipe(Object(fe.tap)(function(){t.currentUID=void 0,t.currentContentID=void 0}),Object(fe.mapTo)(void 0)):Object(H.of)(void 0)},t.prototype.processOEEnd=function(e){return Object(H.of)(void 0)},t.CONTENT_PLAYER_PID="contentplayer",t}(),_a=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Ea=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]e?t.index:e},0);e.frameworks.sort(function(e,t){return(e.index||n+1)-(t.index||n+1)})}return e}))},e.prototype.fetchFromServer=function(e){var t=(new g.Builder).withType(d.GET).withPath(this.frameworkServiceConfig.channelApiPath+this.GET_FRAMEWORK_DETAILS_ENDPOINT+"/"+e.channelId).withApiToken(!0).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result.channel}))},e.prototype.fetchFromFile=function(e){var t=qi.ASSETS_PATH+this.frameworkServiceConfig.channelConfigDirPath,n=this.CHANNEL_FILE_KEY_PREFIX+e.channelId+".json";return Object(H.from)(this.fileService.readFileFromAssets(t.concat("/",n))).pipe(Object(fe.map)(function(e){return JSON.parse(e).result.channel}))},e}(),Ka=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=n.categories.length-1||e.category===n.categories[t+1].code})),e})}):e}),Ka({},n)):n},n.prepareFrameworkTranslations=function(e,t){return e.name=n.getTranslatedValue(e.translations,t,e.name),e.categories&&(e.categories=e.categories.map(function(e){return e.name=n.getTranslatedValue(e.translations,t,e.name),e.terms&&(e.terms=e.terms.map(function(e){return e.name=n.getTranslatedValue(e.translations,t,e.name),e})),e})),e},n.prepareFrameworkCategoryTranslations=function(e,t){return e.name=n.getTranslatedValue(e.translations,t,e.name),e.terms&&(e.terms=e.terms.map(function(e){return e.name=n.getTranslatedValue(e.translations,t,e.name),e})),e},n.getTranslatedValue=function(e,t,n){return e&&JSON.parse(e)[t]||n},n}(),Xa=function(){function e(e,t,n,r,i){this.frameworkService=e,this.apiService=t,this.frameworkServiceConfig=n,this.fileService=r,this.cachedItemStore=i,this.FRAMEWORK_FILE_KEY_PREFIX="framework-",this.FRAMEWORK_LOCAL_KEY="framework-",this.GET_FRAMEWORK_DETAILS_ENDPOINT="/read"}return e.prototype.handle=function(t){var n=this;return Object(H.iif)(function(){return!!t.frameworkId},Object(H.defer)(function(){return n.cachedItemStore.getCached(t.frameworkId,n.FRAMEWORK_LOCAL_KEY,"ttl_"+n.FRAMEWORK_LOCAL_KEY,function(){return n.fetchFromServer(t)},function(){return n.fetchFromFile(t)})}),Object(H.defer)(function(){return n.frameworkService.getDefaultChannelDetails().pipe(Object(fe.mergeMap)(function(e){return n.frameworkService.getFrameworkDetails({frameworkId:e.defaultFramework,requiredCategories:t.requiredCategories})}))}))},e.prototype.fetchFromServer=function(e){var t=(new g.Builder).withType(d.GET).withPath(this.frameworkServiceConfig.frameworkApiPath+this.GET_FRAMEWORK_DETAILS_ENDPOINT+"/"+e.frameworkId).withParameters({categories:e.requiredCategories.join(",")}).withApiToken(!0).build();return this.apiService.fetch(t).pipe(Object(fe.map)(function(e){return e.body.result.framework}),Object(fe.map)(function(e){return Wa.prepareFrameworkCategoryAssociations(e)}))},e.prototype.fetchFromFile=function(e){var t=qi.ASSETS_PATH+this.frameworkServiceConfig.frameworkConfigDirPath,n=this.FRAMEWORK_FILE_KEY_PREFIX+e.frameworkId+".json";return Object(H.from)(this.fileService.readFileFromAssets(t.concat("/",n))).pipe(Object(fe.map)(function(e){return JSON.parse(e).result.framework}),Object(fe.map)(function(e){return Wa.prepareFrameworkCategoryAssociations(e)}))},e}(),Ja=(fa=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}fa(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qa=function(n){function r(e){var t=n.call(this,e,"NO_ACTIVE_CHANNEL_FOUND_ERROR")||this;return Object.setPrototypeOf(t,r.prototype),t}return Ja(r,n),r}(_),$a=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;0<=c;c--)(i=e[c])&&(a=(o<3?i(a):3a[0]&&t[1]e?t.index:e},0);return t.sort(function(e,t){return(e.index||n+1)-(t.index||n+1)}),t}))},e.prototype.getActiveChannelTranslatedDefaultFrameworkDetails=function(t,n){var r=this;return this.frameworkUtilService.getActiveChannel().pipe(Object(fe.mergeMap)(function(e){return r.getTranslatedFrameworkDetails(e.defaultFramework,t,n)}))},e.prototype.getTranslatedFrameworkDetails=function(e,t,n){return this.frameworkService.getFrameworkDetails({frameworkId:e,requiredCategories:t}).pipe(Object(fe.map)(function(e){return Wa.prepareFrameworkTranslations(e,n)}))},e.prototype.getAllCategoriesTermsSet=function(e){return e.categories?e.categories.reduce(function(e,t){return e.concat([t.terms||[]])},[]).reduce(function(e,t){return e.concat(t)},[]).reduce(function(e,t){return e.add(t),e},new ac.a(function(e){return Object(cc.makeString)(e)})):new ac.a},e.prototype.getCategoryTerms=function(e,t){return e.categories.find(function(e){return e.code===t.currentCategoryCode}).terms.reduce(function(e,t){return e.add(t),e},new ac.a(function(e){return Object(cc.makeString)(e)}))},e.prototype.getCategoryAssociationTerms=function(e,n){var r=this;if(!e.categories)return new ac.a;var t=e.categories.find(function(e){return e.code===n.prevCategoryCode}).terms;if(!t)return new ac.a;var i=t.filter(function(t){return n.selectedTermsCodes.find(function(e){return e===t.code})}).map(function(e){return e.associations||[]});return i.some(function(e){return 0===e.length})?e.categories.find(function(e){return e.code===n.currentCategoryCode}).terms.reduce(function(e,t){return e.add(t),e},new ac.a(function(e){return Object(cc.makeString)(e)})):i.reduce(function(e,t){return e.concat(t)}).reduce(function(e,t){return e.add(t),e},new ac.a(function(e){return Object(cc.makeString)(e)})).toArray().map(function(t){return r.getAllCategoriesTermsSet(e).toArray().find(function(e){return e.code===t.code})}).reduce(function(e,t){return e.add(t),e},new ac.a(function(e){return Object(cc.makeString)(e)}))},e}(),lc=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;0<=c;c--)(i=e[c])&&(a=(o<3?i(a):3a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] 0",r="SELECT * FROM "+Zt.TABLE_NAME+" "+n;return this.dbService.execute(r).toPromise()},e.prototype.rm=function(e,r){return new Promise(function(t,n){try{buildconfigreader.rm(e,r,function(e){t(e)},function(e){console.error(e),n(!1)})}catch(e){console.error(e),n(!1)}})},e.prototype.getMetaData=function(r){return Mc(this,void 0,void 0,function(){return wc(this,function(e){return[2,new Promise(function(t,n){buildconfigreader.getMetaData(r,function(e){t(e)},function(e){console.error(e),n(e)})})]})})},e}(),Ic=Object.assign||function(e){for(var t,n=1,r=arguments.length;na[0]&&t[1]a[0]&&t[1] 0",r="select * from "+Zt.TABLE_NAME+" "+n;return this.dbService.execute(r).toPromise()},r.EKSTEP_CONTENT_ARCHIVE="ekstep.content.archive",r.SUPPORTED_MANIFEST_VERSION="1.1",r}(),Vc=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Yc=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]T.pkgVersion&&T.childNodes&&0a[0]&&t[1] 0";return this.dbService.execute(t).toPromise()},e.prototype.updateAllRootContentSize=function(){var e=this,t="SELECT * FROM "+Zt.TABLE_NAME+" WHERE "+Zt.COLUMN_NAME_REF_COUNT+" > 0\n AND "+Zt.COLUMN_NAME_VISIBILITY+" = '"+Wn.DEFAULT.valueOf()+"'";return this.dbService.execute(t).pipe(Object(fe.tap)(function(){return ds(e,void 0,void 0,function(){return ps(this,function(e){return[2,this.sharedPreferences.putBoolean(L.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!1).toPromise()]})})}),Object(fe.mergeMap)(function(n){return ds(e,void 0,void 0,function(){var i,t=this;return ps(this,function(e){switch(e.label){case 0:return i=[],[4,Promise.all(n.map(function(r){return ds(t,void 0,void 0,function(){var t,n;return ps(this,function(e){switch(e.label){case 0:return[4,this.getSizeOnDevice(r)];case 1:return t=e.sent(),(n=JSON.parse(r[Zt.COLUMN_NAME_LOCAL_DATA]).childNodes)?[4,this.findAllChildContents(n)]:[3,3];case 2:e.sent().forEach(function(e){t+=e[Zt.COLUMN_NAME_SIZE_ON_DEVICE]||0}),r[Zt.COLUMN_NAME_SIZE_ON_DEVICE]=t,i.push(r),e.label=3;case 3:return[2]}})})}))];case 1:return e.sent(),this.updateInDb(i),[2]}})})}),Object(fe.tap)(function(){return ds(e,void 0,void 0,function(){return ps(this,function(e){return[2,this.sharedPreferences.putBoolean(L.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!0).toPromise()]})})}))},e.prototype.getSizeOnDevice=function(a){return ds(this,void 0,void 0,function(){var t,n,r,i,o;return ps(this,function(e){switch(e.label){case 0:return t=0,a[Zt.COLUMN_NAME_MIME_TYPE]!==zn.COLLECTION.valueOf()?[3,3]:a[Zt.COLUMN_NAME_VISIBILITY]!==Wn.DEFAULT.valueOf()?[3,2]:(n=[],r={},i=a[Zt.COLUMN_NAME_IDENTIFIER],r.identifier=i,r.path=a[Zt.COLUMN_NAME_PATH],n.push(r),[4,this.getMetaData(n)]);case 1:o=e.sent(),t=o[i]?o[i].size:0,e.label=2;case 2:return[3,4];case 3:t=a[Zt.COLUMN_NAME_SIZE_ON_DEVICE]?a[Zt.COLUMN_NAME_SIZE_ON_DEVICE]:0,e.label=4;case 4:return[2,Promise.resolve(t||0)]}})})},e.prototype.updateInDb=function(a){return ds(this,void 0,void 0,function(){var t,n,r,i,o;return ps(this,function(e){for(this.dbService.beginTransaction(),t=0,n=a;ta[0]&&t[1]t&&(t=e[Zt.COLUMN_NAME_CONTENT_STATE]),t},e.prototype.getBasePath=function(e,t,n){return e&&!t?e:n},e.prototype.getReferenceCount=function(e,t,n,r){var i;e?(i=e[Zt.COLUMN_NAME_REF_COUNT],(r?r[e[Zt.COLUMN_NAME_IDENTIFIER]]:void 0)||n||Wn.DEFAULT.valueOf()===e[ys]&&Wn.DEFAULT.valueOf()===t||(i+=1)):i=1;return i},e.prototype.postImportProgressEvent=function(e,t){this.eventsBusService.emit({namespace:ie.CONTENT,event:{type:lr.IMPORT_PROGRESS,payload:{totalCount:t,currentCount:e}}})},e.prototype.constructContentDBModel=function(e,t,n,r,i,o,a,c,s,u,f,l,h,d,p){var b;return(b={})[Zt.COLUMN_NAME_IDENTIFIER]=e,b[Zt.COLUMN_NAME_SERVER_DATA]="",b[Zt.COLUMN_NAME_PATH]=Ki.getBasePath(a),b[Zt.COLUMN_NAME_REF_COUNT]=c,b[Zt.COLUMN_NAME_CONTENT_STATE]=s,b[Zt.COLUMN_NAME_SIZE_ON_DEVICE]=l,b[Zt.COLUMN_NAME_MANIFEST_VERSION]=t,b[Zt.COLUMN_NAME_LOCAL_DATA]=n,b[Zt.COLUMN_NAME_MIME_TYPE]=r,b[Zt.COLUMN_NAME_CONTENT_TYPE]=i,b[Zt.COLUMN_NAME_VISIBILITY]=o,b[Zt.COLUMN_NAME_AUDIENCE]=u,b[Zt.COLUMN_NAME_PRAGMA]=f,b[Zt.COLUMN_NAME_LOCAL_LAST_UPDATED_ON]=se(Date.now()).format(),b[Zt.COLUMN_NAME_BOARD]=Ki.getContentAttribute(h),b[Zt.COLUMN_NAME_MEDIUM]=Ki.getContentAttribute(d),b[Zt.COLUMN_NAME_GRADE]=Ki.getContentAttribute(p),b},e.prototype.createDirectories=function(r,i){return _s(this,void 0,void 0,function(){return Es(this,function(e){return[2,new Promise(function(t,n){buildconfigreader.createDirectories(Ki.getBasePath(r),i,function(e){t(e)},function(e){console.error(e),n(e)})})]})})},e}(),gs=n(125),ms=n.n(gs),Os=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},Ss=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] ?",[Date.now().toString(),Date.now().toString()];break;case sh.UNREAD:sn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+sn.COLUMN_NAME_EXPIRY_TIME+" > ? AND\n AND "+sn.COLUMN_NAME_IS_READ+" > ?",[Date.now().toString(),Date.now().toString(),0];break;case sh.READ:default:sn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+sn.COLUMN_NAME_EXPIRY_TIME+" > ?\n AND "+sn.COLUMN_NAME_IS_READ+" > ?",[Date.now().toString(),Date.now().toString(),1]}return{table:sn.TABLE_NAME,orderBy:sn.COLUMN_NAME_NOTIFICATION_RECEIVED_AT+" desc"}},e}(),Ih=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;0<=c;c--)(i=e[c])&&(a=(o<3?i(a):3a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1] {\n window.location.href = `"+a.buildUrl(t,n,r)+"`;\n })()"}),[2]})})},a.prototype.success=function(){return pp(this,void 0,void 0,function(){return bp(this,function(e){return[2,dp({},this.captured)]})})},a.prototype.fail=function(){return pp(this,void 0,void 0,function(){return bp(this,function(e){throw dp({},this.captured)})})},a.prototype.getCaptureExtras=function(){return pp(this,void 0,void 0,function(){return bp(this,function(e){return[2,dp({},this.extras)]})})},a}(),Ep=function(o,a,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{i(s.next(e))}catch(e){t(e)}}function r(e){try{i(s.throw(e))}catch(e){t(e)}}function i(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}i((s=s.apply(o,a||[])).next())})},yp=function(n,r){var i,o,a,e,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,o&&(a=o[2&t[0]?"return":t[0]?"throw":"next"])&&!(a=a.call(o,t[1])).done)return a;switch(o=0,a&&(t=[0,a.value]),t[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]a[0]&&t[1]