@wavemaker/app-runtime-wm-build 11.4.3-next.25756 → 11.5.0-next.141080
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.
|
@@ -64635,7 +64635,7 @@
|
|
|
64635
64635
|
}
|
|
64636
64636
|
ImageCacheDirective.prototype.ngDoCheck = function() {
|
|
64637
64637
|
var _this = this;
|
|
64638
|
-
if (
|
|
64638
|
+
if (this.componentInstance.imgSource && this.componentInstance.imgSource.startsWith("http")) {
|
|
64639
64639
|
if (this._lastUrl !== this.componentInstance.imgSource) {
|
|
64640
64640
|
this._lastUrl = this.componentInstance.imgSource;
|
|
64641
64641
|
this.componentInstance.imgSource = DEFAULT_IMAGE;
|
|
@@ -727,7 +727,7 @@ var c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
727
727
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
728
728
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
729
729
|
PERFORMANCE OF THIS SOFTWARE.
|
|
730
|
-
***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-login",new Map([["errormessage",i.PROP_STRING],["eventsource",i.PROP_ANY]]))},p={widgetType:"wm-login",hostClass:"app-login"},u=function(e){function t(t){var n=e.call(this,t,p)||this;return i.styler(n.nativeElement,n,i.APPLY_STYLES_TYPE.CONTAINER),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onSuccessCB=function(){this.invokeEventCallback("success")},t.prototype.onErrorCB=function(e){this.loginMessage={type:"error",caption:this.errormessage||e||this.appLocale.LABEL_INVALID_USERNAME_OR_PASSWORD,show:!0},this.messageCmp.showMessage(this.loginMessage.caption,this.loginMessage.type),this.invokeEventCallback("error")},t.prototype.getLoginDetails=function(){return this.formCmp.dataoutput},t.prototype.doLogin=function(){this.eventsource?this.formCmp.ngform.valid&&this.eventsource.invoke({loginInfo:this.getLoginDetails()},this.onSuccessCB.bind(this),this.onErrorCB.bind(this)):console.warn('Default action "loginAction" does not exist. Either create the Action or assign an event to onSubmit of the login widget')},t.prototype.initLoginButtonActions=function(){var e=this;this.loginBtnCmp.getNativeElement().addEventListener("click",(function(t){e.nativeElement.hasAttribute("submit.event")||e.loginBtnCmp.getNativeElement().hasAttribute("click.event")||e.loginBtnCmp.getNativeElement().hasAttribute("tap.event")||e.doLogin()}))},t.prototype.ngAfterViewInit=function(){var t=this;e.prototype.ngAfterViewInit.call(this),this.formCmp.getNativeElement().addEventListener("submit",(function(e){return e.preventDefault()})),this.buttonComponents.forEach((function(e){if("loginButton"===e.getNativeElement().getAttribute("name")||_.includes(e.getNativeElement().classList,"app-login-button")){if(t.loginBtnCmp)return;t.loginBtnCmp=e,t.initLoginButtonActions()}}))},t}(i.StylableComponent);u.initializeProps=c(),u.decorators=[{type:t.Component,args:[{selector:"div[wmLogin]",template:'<p wmMessage class="app-login-message" #message show.bind="loginMessage.show" caption.bind="loginMessage.caption" type.bind="loginMessage.type"></p>\n<ng-content></ng-content>\n',providers:[i.provideAsWidgetRef(u)]}]}],u.ctorParameters=function(){return[{type:t.Injector}]},u.propDecorators={formCmp:[{type:t.ContentChild,args:[o.FormComponent]}],buttonComponents:[{type:t.ContentChildren,args:[r.ButtonComponent,{descendants:!0}]}],messageCmp:[{type:t.ViewChild,args:[i.MessageComponent,{static:!0}]}]};var d=[u],h=function(){};h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(d)),exports:l([],s(d)),entryComponents:[]}]}],e.LoginComponent=u,e.LoginModule=h,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@wm/core"),require("@awesome-cordova-plugins/file/ngx"),require("@awesome-cordova-plugins/app-version/ngx"),require("@awesome-cordova-plugins/app-version/ngx/index"),require("@awesome-cordova-plugins/file/ngx/index"),require("@angular/common/http"),require("rxjs/operators"),require("@wm/components/base"),require("@awesome-cordova-plugins/file-opener/ngx"),require("@awesome-cordova-plugins/file-opener/ngx/index"),require("@awesome-cordova-plugins/network/ngx"),require("@awesome-cordova-plugins/network/ngx/index")):"function"==typeof define&&define.amd?define("@wm/mobile/core",["exports","@angular/core","@wm/core","@awesome-cordova-plugins/file/ngx","@awesome-cordova-plugins/app-version/ngx","@awesome-cordova-plugins/app-version/ngx/index","@awesome-cordova-plugins/file/ngx/index","@angular/common/http","rxjs/operators","@wm/components/base","@awesome-cordova-plugins/file-opener/ngx","@awesome-cordova-plugins/file-opener/ngx/index","@awesome-cordova-plugins/network/ngx","@awesome-cordova-plugins/network/ngx/index"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.core={}),e.ng.core,e.wm.core,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.ng.common.http,e.rxjs.operators,e.wm.components.base,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h){"use strict";function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var f,g=m(t),v=m(n),y=m(r),b=m(a),w=m(s),P=m(c),O=m(u),S=m(h);e.FileType=void 0,(f=e.FileType||(e.FileType={})).AUDIO="AUDIO",f.DOCUMENT="DOCUMENT",f.IMAGE="IMAGE",f.VIDEO="VIDEO";var E=["gif","jpg","png","svg","webp","jpeg","jif","jfif","jfi"],T=["mp4","mpg","avi","wma","mp2","3gp","3g2","m4p","m4v","mpg","fiv"],R=["mp3","m4p","aiff","aa","aax","wma"],A=[{name:"{APP_NAME}",children:[{name:"Media",children:[{name:"{APP_NAME} Images",fileType:e.FileType.IMAGE},{name:"{APP_NAME} Audio",fileType:e.FileType.AUDIO},{name:"{APP_NAME} Vedios",fileType:e.FileType.VIDEO},{name:"{APP_NAME} Documents",fileType:e.FileType.DOCUMENT}]}]}],C=function(){function t(e,t){this.cordovaAppVersion=e,this.cordovaFile=t,this._fileTypeVsPathMap={temporary:{},persistent:{}}}return t.prototype.addMediaToGallery=function(e){return n.isAndroid()&&this.isPersistentType(e)?new Promise((function(t,n){cordova.plugins.MediaScannerPlugin.scanFile(e,t,n)})):Promise.resolve()},t.prototype.appendToFileName=function(e,t){var n;return t=t||"_"+_.now(),(n=(e=e||"noname").split(".")).length>1?(n[n.length-2]=n[n.length-2]+t,n.join(".")):e+t},t.prototype.clearTemporaryStorage=function(){return this.cordovaFile.removeRecursively(this.getTemporaryRootPath()+this._appName+"/","Media")},t.prototype.copy=function(e,t){var n=this,i=t.split("/").pop(),o=this.findFolderPath(e,i),r=t.substring(0,t.lastIndexOf("/"));return this.newFileName(o,i).then((function(e){return n.cordovaFile.copyFile(r,i,o,e).then((function(){return o+e}))}))},t.prototype.findFolderPath=function(t,n){var i=t?this._fileTypeVsPathMap.persistent:this._fileTypeVsPathMap.temporary;return i[this.findFileType(n)]||i[e.FileType.DOCUMENT]},t.prototype.getPersistentRootPath=function(){return cordova.file.dataDirectory},t.prototype.getTemporaryRootPath=function(){return cordova.file.cacheDirectory},t.prototype.getUploadDirectory=function(){return this._uploadDir},t.prototype.isPersistentType=function(e){return e.startsWith(this.getPersistentRootPath())},t.prototype.isValidPath=function(e){var t,n;return e?(t=e.substring(0,e.lastIndexOf("/")+1),n=e.split("/").pop(),this.cordovaFile.checkFile(t,n).then((function(){return e}))):Promise.reject("File path is required")},t.prototype.listFiles=function(e,t){return new Promise((function(n,i){resolveLocalFileSystemURL(e,(function(e){e.files?n([]):e.createReader().readEntries((function(e){t&&(e=e.filter((function(e){return e.name.match(t)}))),e=e.map((function(e){return{name:e.name,isDirectory:e.isDirectory,path:e.nativeURL}})),n(e)}),i)}),i)}))},t.prototype.newFileName=function(e,t){var n=this;return this.cordovaFile.checkFile(e,t).then((function(){var i=t.lastIndexOf(".");return t=i>0?t.substring(0,i)+"_"+_.now()+"."+t.substring(i+1):t+"_"+_.now(),n.newFileName(e,t)}),(function(){return t}))},t.prototype.removeFile=function(e){var t=e.lastIndexOf("/"),n=e.substring(0,t),i=e.substring(t+1);return this.cordovaFile.removeFile(n,i)},t.prototype.removeDir=function(e){var t=this,i=e.lastIndexOf("/"),o=e.substring(0,i+1),r=e.substring(i+1),a=r+_.now();return this.cordovaFile.checkDir(o,r).then((function(){return t.cordovaFile.moveDir(o,r,o,a).then((function(){return t.cordovaFile.removeDir(o,a)}))})).catch(n.noop)},t.prototype.start=function(){var e=this;return FileReader.READ_CHUNK_SIZE=524288,Promise.resolve().then((function(){return e.cordovaAppVersion.getAppName()})).then((function(t){var n=[];return e._appName=t,n.push(e.createFolderIfNotExists(e.getTemporaryRootPath(),A,e._fileTypeVsPathMap.temporary)),n.push(e.createFolderIfNotExists(e.getPersistentRootPath(),A,e._fileTypeVsPathMap.persistent)),n.push(e.setupUploadDirectory()),Promise.all(n)})).then((function(){if(n.isAndroid())return e.cordovaFile.readAsText(cordova.file.externalRootDirectory,"random-file-for-permission").catch(n.noop)}))},t.prototype.getServiceName=function(){return t.SERVICE_NAME},t.prototype.createFolderIfNotExists=function(e,t,n){var i=this,o=[];if(t&&t.forEach((function(t){var r;t.name=t.name.replace("{APP_NAME}",i._appName),r=e+t.name+"/",t.fileType&&!n[t.fileType]&&(n[t.fileType]=r);var a=i.cordovaFile.createDir(e,t.name,!1).then((function(){return i.createFolderIfNotExists(r,t.children,n)}),(function(){return i.createFolderIfNotExists(r,t.children,n)}));o.push(a)})),o.length>0)return Promise.all(o)},t.prototype.findFileType=function(t){var n;if(t.indexOf(".")>0){if(n=t.split(".").pop().toLowerCase(),E.some((function(e){return e===n})))return e.FileType.IMAGE;if(T.some((function(e){return e===n})))return e.FileType.VIDEO;if(R.some((function(e){return e===n})))return e.FileType.AUDIO}return e.FileType.DOCUMENT},t.prototype.setupUploadDirectory=function(){var e=this,t="uploads",n=cordova.file.dataDirectory;return this.cordovaFile.checkDir(n,t).then((function(){return e._uploadDir=n+t}),(function(){return e.cordovaFile.createDir(n,t,!0).then((function(){return e._uploadDir=n+t}))}))},t}();C.SERVICE_NAME="DeviceFileService",C.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new C(g.\u0275\u0275inject(y.AppVersion),g.\u0275\u0275inject(b.File))},token:C,providedIn:"root"}),C.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],C.ctorParameters=function(){return[{type:o.AppVersion},{type:i.File}]};Object.create;function I(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}Object.create;var D=function(){function e(e,t,n,i){this.cordovaFile=e,this.http=t,this.deviceFileService=n,this.fileExtensionFromMimePipe=i,this._downloadQueue=[],this._concurrentDownloads=0}return e.prototype.download=function(e,t,n,i,o,r){return this.addToDownloadQueue(e,t,n,i,o,r)},e.prototype.addToDownloadQueue=function(e,t,n,i,o,r){var a=this;return new Promise((function(s,l){a._downloadQueue.push({url:e,headers:r,isPersistent:t,destFolder:n,destFile:i,resolve:s,reject:l,progressObserver:o}),a._concurrentDownloads<2&&a.downloadNext()}))},e.prototype.downloadNext=function(){var e=this;if(this._downloadQueue.length>0){var t=this._downloadQueue.shift();this.downloadFile(t).then((function(n){t.resolve(n),e.downloadNext()}),(function(){t.reject(),e.downloadNext()}))}},e.prototype.downloadFile=function(e){var t,n,i=this;return this._concurrentDownloads++,this.sendHttpRequest(e.url,e.progressObserver,e.headers).then((function(t){return n=t.body,i.getFileName(t,e,n.type)})).then((function(o){return e.destFolder||(e.destFolder=i.deviceFileService.findFolderPath(e.isPersistent,o)),t=e.destFolder+o,i.cordovaFile.writeFile(e.destFolder,o,n)})).then((function(){return i._concurrentDownloads--,t}),(function(t){return i._concurrentDownloads--,i.cordovaFile.removeFile(e.destFolder,e.destFile),Promise.reject("Failed to downloaded "+e.url+" with error "+JSON.stringify(t))}))},e.prototype.getFileName=function(e,t,n){var i,o,r=e.headers.get("Content-Disposition"),a=t.destFile;if(!a&&r&&-1!==r.indexOf("attachment")){var s=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(r);null!==s&&s[1]&&(a=s[1].replace(/['"]/g,""))}a||(a=(a=t.url.split("?")[0]).split("/").pop()),n&&(i=this.fileExtensionFromMimePipe.transform(n)),_.isArray(i)&&!_.isEmpty(i)&&(o=_.find(i,(function(e){return _.endsWith(a,e)})),i=i[0]),o||_.endsWith(a,i)||(a+=i);var l=t.destFolder||this.deviceFileService.findFolderPath(t.isPersistent,a);return this.deviceFileService.newFileName(l,a)},e.prototype.sendHttpRequest=function(e,t,n){var i=new s.HttpHeaders;n&&Object.entries(n).forEach((function(e){var t=I(e,2),n=t[0],o=t[1];return i=i.append(n,o)}));var o=new s.HttpRequest("GET",e,{headers:i,responseType:"blob",reportProgress:null!=t});return this.http.request(o).pipe(l.map((function(e){return t&&t.next&&e.type===s.HttpEventType.DownloadProgress&&t.next(e),e})),l.filter((function(e){return e.type===s.HttpEventType.Response})),l.map((function(e){return t&&t.complete&&t.complete(),e}))).toPromise()},e}();D.SERVICE_NAME="DeviceFileDownloadService",D.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new D(g.\u0275\u0275inject(b.File),g.\u0275\u0275inject(w.HttpClient),g.\u0275\u0275inject(C),g.\u0275\u0275inject(P.FileExtensionFromMimePipe))},token:D,providedIn:"root"}),D.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],D.ctorParameters=function(){return[{type:i.File},{type:s.HttpClient},{type:C},{type:c.FileExtensionFromMimePipe}]};var N="appCache.json",x=function(){function e(e,t,n){this.cordovaFile=e,this.fileService=t,this.downloadService=n,this._cacheIndex={}}return e.prototype.addEntry=function(e,t){this._cacheIndex[e]=t,this.writeCacheIndexToFile()},e.prototype.getLocalPath=function(e,t,n,i){var o=this;if(void 0===i&&(i=!1),i)return this.download(e,n);var r=this._cacheIndex[e];return this.fileService.isValidPath(r).catch((function(){return delete o._cacheIndex[e],t?o.download(e,n):Promise.reject("No cache entry for "+e)}))},e.prototype.invalidateCache=function(){this._cacheIndex={},this.writeCacheIndexToFile(),this.fileService.clearTemporaryStorage()},e.prototype.start=function(){var e=this;return this.cordovaFile.readAsText(cordova.file.dataDirectory,N).then((function(t){e._cacheIndex=JSON.parse(t)}),n.noop)},e.prototype.getServiceName=function(){return e.SERVICE_NAME},e.prototype.download=function(e,t){var n=this;return this.downloadService.download(e,t).then((function(t){return n._cacheIndex[e]=t,n.writeCacheIndexToFile(),t}))},e.prototype.writeCacheIndexToFile=function(){var e=this;this._writing?this._saveCache=!0:(this._writing=!0,this.cordovaFile.writeFile(cordova.file.dataDirectory,N,JSON.stringify(this._cacheIndex),{replace:!0}).catch(n.noop).then((function(){e._saveCache?setTimeout((function(){e._writing=!1,e._saveCache=!1,e.writeCacheIndexToFile()}),5e3):e._writing=!1})))},e}();x.SERVICE_NAME="DeviceFileCacheService",x.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new x(g.\u0275\u0275inject(b.File),g.\u0275\u0275inject(C),g.\u0275\u0275inject(D))},token:x,providedIn:"root"}),x.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],x.ctorParameters=function(){return[{type:i.File},{type:C},{type:D}]};var k=function(){function e(e,t,n,i,o){this.cordovaFile=e,this.cordovaFileOpener=t,this.fileService=n,this.cacheService=i,this.downloadService=o}return e.prototype.getFileMimeType=function(e){return new Promise((function(t){resolveLocalFileSystemURL(e,(function(e){e.file((function(e){t(e.type)}))}))}))},e.prototype.openRemoteFile=function(e,t,n,i){var o=this;return this.getLocalPath(e,t,n,i).then((function(e){return o.getFileMimeType(e).then((function(t){return o.cordovaFileOpener.open(e,t)}))}))},e.prototype.start=function(){var e,t=this;return e=n.isAndroid()?cordova.file.externalCacheDirectory:n.isIos()?cordova.file.documentsDirectory+"NoCloud/":cordova.file.dataDirectory,this.cordovaFile.createDir(e,"downloads",!1).catch(n.noop).then((function(){t._downloadsFolder=e+"downloads/"}))},e.prototype.getServiceName=function(){return x.SERVICE_NAME},e.prototype.generateFileName=function(e,t){var n=e.split("?")[0];return n=n.split("/").pop(),n=this.fileService.appendToFileName(n,""+_.now()),t?n.split(".")[0]+"."+t:n},e.prototype.getLocalPath=function(e,t,n,i){var o=this;return new Promise((function(r,a){return o.cacheService.getLocalPath(e,!1,!1).then((function(i){var a,s,l,c,p;i.startsWith(o._downloadsFolder)?r(i):(l=i.lastIndexOf("."),t=i.substring(l+1),a=n||o.generateFileName(e,t),s=i.lastIndexOf("/"),c=i.substring(0,s),p=i.substring(s+1),o.cordovaFile.copyFile(c,p,o._downloadsFolder,a).then((function(){var t=o._downloadsFolder+a;o.cacheService.addEntry(e,t),r(t)})))})).catch((function(){o.downloadService.download(e,!1,o._downloadsFolder,n,void 0,i).then((function(t){o.cacheService.addEntry(e,t),r(t)}),a)}))}))},e}();k.SERVICE_NAME="DeviceFileOpenerService",k.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new k(g.\u0275\u0275inject(b.File),g.\u0275\u0275inject(O.FileOpener),g.\u0275\u0275inject(C),g.\u0275\u0275inject(x),g.\u0275\u0275inject(D))},token:k,providedIn:"root"}),k.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],k.ctorParameters=function(){return[{type:i.File},{type:p.FileOpener},{type:C},{type:x},{type:D}]};var M="registry.info",L=function(){function e(e){var t=this;this.file=e,this._registry={},this._isReady=!1,this._whenReadyPromises=[],this._backBtnTapListeners=[],this._startUpServices=[],this._config={};if(setTimeout((function(){t._isReady||(console.warn("Device is not ready even after 10 seconds"),console.warn("Waiting For %O",t._startUpServices.map((function(e){return e.getServiceName()}))))}),1e4),document.addEventListener("backbutton",this.executeBackTapListeners.bind(this)),n.hasCordova()){var i=location.port?":"+location.port:"",o=location.protocol+"//"+location.hostname+i+(n.isIos()?"":"/_www")+"/config.json";n.fetchContent("json",o,!0,(function(e){!e.error&&e.baseUrl&&(t._config=e)}))}}return e.prototype.executeBackTapListeners=function(e){_.forEach(this._backBtnTapListeners,(function(t){return!1!==t(e)})),n.$appDigest()},e.prototype.addStartUpService=function(e){this._startUpServices.push(e)},e.prototype.onBackButtonTap=function(e){var t=this;return this._backBtnTapListeners.unshift(e),function(){var n=t._backBtnTapListeners.indexOf(e);n>=0&&t._backBtnTapListeners.splice(n,1)}},e.prototype.start=function(){var e=this;return this._isReady||0===this._startUpServices.length?(this._isReady=!0,Promise.resolve()):new Promise((function(e){n.hasCordova()?document.addEventListener("deviceready",(function(){return e()}),!1):e()})).then((function(){if(window.cordova)return e.file.readAsText(cordova.file.dataDirectory,M).then((function(t){return e._registry=JSON.parse(t)}),n.noop)})).then((function(){return Promise.all(e._startUpServices.map((function(e){return e.start().catch((function(t){return console.error("%s failed to start due to: %O",e.getServiceName(),t),Promise.reject(t)}))})))})).then((function(){window.wmDeviceReady=!0,document.dispatchEvent(new CustomEvent("wmDeviceReady")),e._startUpServices.length=0,e._whenReadyPromises.forEach((function(e){return e()})),e._isReady=!0}))},e.prototype.getServiceName=function(){return e.SERVICE_NAME},e.prototype.whenReady=function(){var e=this;return this._isReady?Promise.resolve():new Promise((function(t){e._whenReadyPromises.push(t)}))},e.prototype.getBaseUrl=function(){return"http://NOSERVERREQUIRED.com"===this._config.baseUrl?"NONE":this._config.baseUrl},e.prototype.isAppConnectedToPreview=function(){return this._config.customUrl!==this._config.baseUrl&&"NONE"!==this.getBaseUrl()},e.prototype.getConfig=function(){return this._config},e.prototype.useNativeXHR=function(){return(n.isIos()||!0===this._config.useNativeXHR)&&n.hasCordova()&&cordova.plugin&&cordova.plugin.http},e.prototype.getAppBuildTime=function(){return Promise.resolve(this._config.buildTime)},e.prototype.storeEntry=function(e,t){return this._registry[e]=t,this.file.writeFile(cordova.file.dataDirectory,M,JSON.stringify(this._registry),{replace:!0})},e.prototype.getEntry=function(e){return this._registry[e]},e}();L.SERVICE_NAME="DeviceService",L.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new L(g.\u0275\u0275inject(b.File))},token:L,providedIn:"root"}),L.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],L.ctorParameters=function(){return[{type:i.File}]};var F=window.XMLHttpRequest,j=window.cordova,B=function(){function e(e){this.nXhr=e,this.xhr=new F,this.method="GET",this.requestHeaders={},this.responseHeaders={},this.responseHeaderText="",this.url="",this.async=!0,this.listeners={}}return e.prototype.triggerListeners=function(e,t){var n=this.listeners[e];n&&n.forEach((function(e){e.apply(window,t)}))},e.prototype.copyNativeResponse=function(e){this.nXhr.status=e.status,this.nXhr.statusText=e.statusText||e.status,this.nXhr.response=e.data,this.nXhr.responseType=e.headers&&e.headers["content-type"]||"plain/text",this.nXhr.responseURL=e.responseURL,this.nXhr.responseXML=e.responseXML,this.nXhr.responseText=e.data&&e.data.toString()||e.error,this.responseHeaderText=function(){var t=[];for(var n in e.headers)t.push(n+": "+e.headers[n]);return t.join("\r\n")}()},e.prototype.copyXMLHttpResponse=function(e){this.nXhr.status=e.status,this.nXhr.statusText=e.statusText,this.nXhr.response=e.response,this.nXhr.responseType=e.responseType,this.nXhr.responseURL=e.responseURL,this.nXhr.responseXML=e.responseXML,this.nXhr.responseText=e.responseText,this.responseHeaderText=e.getAllResponseHeaders(),this.nXhr.getResponseHeader=function(t){return e.getResponseHeader(t)}},e.prototype.sendViaXhr=function(e){var t=this,n=this;for(var i in this.xhr.onreadystatechange=this.nXhr.onreadystatechange,this.xhr.onload=function(){n.copyXMLHttpResponse(n.xhr),n.nXhr.onload&&n.nXhr.onload.apply(n.nXhr,arguments)},this.xhr.onerror=this.nXhr.onerror,this.async||(this.xhr.ontimeout=this.nXhr.ontimeout,this.xhr.timeout=this.nXhr.timeout),this.xhr.withCredentials=this.nXhr.withCredentials,this.listeners)this.xhr.addEventListener(i,(function(e){t.copyXMLHttpResponse(t.xhr),t.triggerListeners(e.type)}));this.xhr.send(e)},e.prototype.close=function(){for(var e in this.listeners)this.listeners[e].length=0},e}(),G=function(){function e(){this.onreadystatechange=null,this.readyState=0,this.response=null,this.responseType=null,this.responseText=null,this.responseURL=null,this.responseXML=null,this.status=0,this.statusText="",this.ontimeout=null,this.onload=null,this.onerror=null,this.timeout=0,this.withCredentials=!1,this.progress={lengthComputable:!1,loaded:0,total:0,close:function(e){void 0===e&&(e=!1)}},this.upload={addEventListener:this.addEventListener.bind(this)},this._internal=new B(this)}return e.prototype.abort=function(){this.status=-1,this._internal.triggerListeners("error"),this.onerror&&this.onerror(),this._internal.xhr.abort(),this.close()},e.prototype.getResponseHeader=function(e){return this.response.headers[e]},e.prototype.getAllResponseHeaders=function(){return this._internal.responseHeaderText},e.prototype.setRequestHeader=function(e,t){this._internal.requestHeaders[e]=t,this._internal.xhr.setRequestHeader(e,t)},e.prototype.overrideMimeType=function(e){this._internal.xhr.overrideMimeType(e)},e.prototype.open=function(e,t,n,i,o){void 0===n&&(n=!0),this._internal.method=e,this._internal.url=t,this._internal.async=n,this._internal.xhr.open(e,t,n,i,o)},e.prototype.send=function(e,t){void 0===t&&(t=!1),t||this._internal.url.startsWith("http://localhost")||!this._internal.url.startsWith("http")?this._internal.sendViaXhr(e):"blob"===this.responseType?this.sendBlobViaNativePlugin(e):this.sendViaNativePlugin(e)},e.prototype.addEventListener=function(e,t){this._internal.listeners[e]=this._internal.listeners[e]||[],this._internal.listeners[e].push(t)},e.prototype.removeEventListener=function(e,t){if(this._internal.listeners[e]){var n=this._internal.listeners[e].indexOf(t);this._internal.listeners[e].splice(n,1)}},e.prototype.prepareOptions=function(e){var t={headers:{},data:e=e||{},method:this._internal.method,serializer:"raw"};for(var n in null!=e&&null!=e&&(e.constructor&&e.constructor.toString().indexOf("FormData()")>=0?(t.serializer="multipart",this.startProgress()):t.serializer="string"==typeof e?"utf8":"urlencoded"),this._internal.requestHeaders)t.headers[n]=this._internal.requestHeaders[n];return t},e.prototype.startProgress=function(e){var t=this,n=8388608;e=e||n;var i=200*Math.ceil(e/n),o=Math.ceil(e/n)*(n/10);this.progress={lengthComputable:!0,loaded:0,total:e,close:null};var r=function(){t._internal.triggerListeners("progress",[{lengthComputable:!0,total:t.progress.total,loaded:t.progress.loaded}])},a=setInterval((function(){t.progress.loaded+o<e&&(t.progress.loaded+=o),r()}),i);this.progress.close=function(e){void 0===e&&(e=!1),e&&(t.progress.loaded=t.progress.total),r(),clearInterval(a)}},e.prototype.sendBlobViaNativePlugin=function(e){var t=this,i=this.prepareOptions(e),o=(n.isIos()?j.file.tempDirectory:j.file.cacheDirectory)+Date.now(),r=setTimeout((function(){t.timeout>0&&(console.error("network call with request %O failed with timeout",t),t._internal.triggerListeners("load"),t._internal.triggerListeners("error"),t.onerror&&t.onerror(),t.ontimeout&&t.ontimeout(),t.close())}),this.timeout>0?this.timeout:1),a=function(e){console.error("network call with request %O failed with response : %O",t,e),t._internal.triggerListeners("load",[e]),t._internal.triggerListeners("error",[e]),t.onerror&&t.onerror(),clearTimeout(r)};j.plugin.http.downloadFile(new URL(this._internal.url).href,{},i.headers,o,(function(e,n){e.file((function(e){return function(e,n){var i={headers:n&&n.headers||{},status:200,data:e},o=n&&n.headers&&n.headers["content-type"];o&&(i.data.type=o.split(";")[0]),console.log("network call with request %O successed with response : %O",t,i),t._internal.copyNativeResponse(i),t._internal.triggerListeners("load"),t.onload&&t.onload(),clearTimeout(r)}(e,n)}),a)}),a)},e.prototype.sendViaNativePlugin=function(e){var t=this,n=this.prepareOptions(e),i=setTimeout((function(){t.timeout>0&&(console.error("network call with request %O failed with timeout",t),t._internal.triggerListeners("load"),t._internal.triggerListeners("error"),t.ontimeout&&t.ontimeout(),t.close())}),this.timeout>0?this.timeout:1);new Promise((function(e,i){j.plugin.http.sendRequest(new URL(t._internal.url).href,n,e,i)})).then((function(e){console.log("network call with request %O successed with response : %O",t,e),t.progress.close(!0),t._internal.copyNativeResponse(e),t._internal.triggerListeners("load"),t.onload&&t.onload()}),(function(e){t.progress.close(),t._internal.copyNativeResponse(e),console.error("network call with request %O failed with response : %O",t,e),t._internal.triggerListeners("load",[e]),t._internal.triggerListeners("error",[e]),t.onerror&&t.onerror()})).finally((function(){return clearTimeout(i)}))},e.prototype.close=function(){this.ontimeout=null,this.onload=null,this.onerror=null,this.onreadystatechange=null,this._internal.close()},e}(),V="WM.NetworkService._autoConnect",$="WM.NetworkService.isConnected",U=[new RegExp("/wmProperties.js")],W={isConnecting:!1,isConnected:!0,isNetworkAvailable:!0,isServiceAvailable:!0,noServiceRequired:!1},q=null,z=function(e){var t=!W.isConnected&&_.startsWith(e,"http");return t&&(t=!_.find(U,(function(t){return t.test(e)}))),t},H=z,Y=function(e){var t=e?G:XMLHttpRequest,n=t.prototype.open;return t.prototype.open=function(e,t,i,o,r){if(void 0===i&&(i=!0),!W.noServiceRequired&&z(t)){var a=t.split("://"),s=a[1].indexOf("/");a[1]="localhost"+(s>0?a[1].substr(s):"/"),t=a.join("://")}return n.apply(this,[e,t,i,o,r])},t},K=Y,Q=function(){function e(e,t,n,i){var o=this;this.httpClient=e,this.app=t,this.network=n,this.deviceService=i,this._autoConnect="false"!==localStorage.getItem(V),this._isCheckingServer=!1,this.disableAutoConnect=function(){return o.setAutoConnect(!1)},this.isConnected=function(){return _.get(navigator,"connection")&&navigator.connection.type&&(W.isConnected=W.isConnected&&"none"!==navigator.connection.type),o.checkForNetworkStateChange(),W.isConnected},this.isConnecting=function(){return W.isConnecting},W.isConnected="true"===localStorage.getItem($),q=q||K(i.useNativeXHR())}return e.prototype.connect=function(){return this.setAutoConnect(!0),this.tryToConnect()},e.prototype.disconnect=function(){var e=this.tryToDisconnect();return this.disableAutoConnect(),e},e.prototype.isAvailable=function(e){var t=this;return void 0===e&&(e=!1),e?this.isServiceAvailable().then((function(){return t.checkForNetworkStateChange(),W.isServiceAvailable})):W.isServiceAvailable},e.prototype.onConnect=function(){var e,t,i=this;return this.isConnected()?Promise.resolve():(e=n.getAbortableDefer(),t=this.app.subscribe("onNetworkStateChange",(function(){i.isConnected()&&(e.resolve(!0),t())})),e.promise.catch((function(){t()})),e.promise)},e.prototype.retryIfNetworkFails=function(e){var t=this,i=n.getAbortableDefer();return n.retryIfFails(e,0,0,(function(){var e;return!t.isConnected()&&(e=t.onConnect(),i.promise.catch((function(){e.abort()})),e)})).then(i.resolve,i.reject),i.promise},e.prototype.start=function(){var e=this;return window.cordova&&window.Connection&&navigator.connection&&(W.isNetworkAvailable="none"!==navigator.connection.type,W.isConnected=W.isNetworkAvailable&&W.isConnected,this.network.onConnect().subscribe((function(){W.isNetworkAvailable=!0,e.tryToConnect().catch(n.noop)})),this.network.onDisconnect().subscribe((function(){W.isNetworkAvailable=!1,W.isServiceAvailable=!1,e.tryToDisconnect()})),this.app.subscribe("onNetworkStateChange",(function(t){!t.isNetworkAvailable||t.isServiceAvailable||e._isCheckingServer||t.noServiceRequired||(e._isCheckingServer=!0,e.checkForServiceAvailiblity().then((function(){e._isCheckingServer=!1,e.connect()}),(function(){e._isCheckingServer=!1})))}))),this.tryToConnect(!0).catch(n.noop)},e.prototype.getServiceName=function(){return e.SERVICE_NAME},e.prototype.unblock=function(e){U.push(new RegExp(e))},e.prototype.getState=function(){return _.clone(W)},e.prototype.checkForNetworkStateChange=function(){_.isEqual(this._lastKnownNetworkState,W)||(this._lastKnownNetworkState=_.clone(W),this.app.notify("onNetworkStateChange",this._lastKnownNetworkState))},e.prototype.checkForServiceAvailiblity=function(){var e=this;return new Promise((function(t){var n=setInterval((function(){W.isNetworkAvailable&&e.isServiceAvailable(4500).then((function(e){e&&(clearInterval(n),t())}))}),5e3)}))},e.prototype.isServiceAvailable=function(e){return"NONE"===this.app.deployedUrl?(W.isServiceAvailable=!1,W.noServiceRequired=!0,Promise.resolve(!1)):this.pingServer(e).then((function(e){return W.isServiceAvailable=e,W.isServiceAvailable||(W.isConnecting=!1,W.isConnected=!1),e}))},e.prototype.pingServer=function(e){var t=this;return void 0===e&&(e=6e4),new Promise((function(n){var i=new q,o=t.app.deployedUrl;o&&!_.endsWith(o,"/")?o+="/":o=o||"";var r=setTimeout((function(){i.abort(),n(!1)}),e);i.addEventListener("load",(function(){200===i.status?n(!0):n(!1),r&&clearTimeout(r)})),i.addEventListener("error",(function(){return n(!1)})),i.open("GET",o+"services/application/wmProperties.js?t="+Date.now()),i.send()}))},e.prototype.setAutoConnect=function(e){this._autoConnect=e,localStorage.setItem(V,""+e)},e.prototype.tryToConnect=function(e){var t=this;return void 0===e&&(e=!1),new Promise((function(n,i){t.isServiceAvailable(5e3).then((function(){W.isServiceAvailable&&t._autoConnect?(W.isConnecting=!0,e||t.checkForNetworkStateChange(),setTimeout((function(){W.isConnecting=!1,W.isConnected=!0,localStorage.setItem($,""+!0),e||t.checkForNetworkStateChange(),n(!0)}),e?0:5e3)):(W.isConnecting=!1,W.isConnected=!1,localStorage.setItem($,""+!1),i(),t.checkForNetworkStateChange())}))}))},e.prototype.tryToDisconnect=function(){return W.isConnected=!1,W.isConnecting=!1,this.checkForNetworkStateChange(),localStorage.setItem($,""+W.isConnected),Promise.resolve(W.isConnected)},e}();Q.SERVICE_NAME="NetworkService",Q.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new Q(g.\u0275\u0275inject(w.HttpClient),g.\u0275\u0275inject(v.App),g.\u0275\u0275inject(S.Network),g.\u0275\u0275inject(L))},token:Q,providedIn:"root"}),Q.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Q.ctorParameters=function(){return[{type:s.HttpClient},{type:n.App},{type:d.Network},{type:L}]};var X=function(){function e(t,i,o,r,a){var s=this;e.addStartupServices(t,i,o,r,a);var l=t.getConfig().enableSSLPinning;n.hasCordova()&&document.addEventListener("wmDeviceReady",(function(){t.useNativeXHR()&&(window.XMLHttpRequest=G,l&&cordova.plugin.http.setServerTrustMode("pinned",(function(){console.log("SSL Pinning enabled.!")}),(function(e){console.log("Failed to enable SSL Pinning. Due to: "+e)})),s.overrideResolveLocalFileSystemURL())}),!1)}return e.addStartupServices=function(e,t,i,o,r){this.initialized||(e.addStartUpService(r),n.hasCordova()&&(e.addStartUpService(t),e.addStartUpService(i),e.addStartUpService(o)),this.initialized=!0)},e.prototype.overrideResolveLocalFileSystemURL=function(){var e=window.resolveLocalFileSystemURL;window.resolveLocalFileSystemURL=function(t,n,i){if(t&&t.startsWith("http://localhost")){var o="/local-filesystem";(t=new URL(t).pathname).startsWith(o)&&(t="file://"+t.substring(o.length))}e.call(window,t,n,i)}},e}();X.initialized=!1,X.decorators=[{type:t.NgModule,args:[{declarations:[],imports:[],providers:[],bootstrap:[]}]}],X.ctorParameters=function(){return[{type:L},{type:C},{type:x},{type:k},{type:Q}]};var J=function(){function e(e,t){this.url=e,this.cordovaFile=t,this._files=[],this._params=[],this._headers=[]}return e.prototype.addFile=function(e,t,n){return this._files.push({name:e,path:t,fileName:n}),this},e.prototype.addHeader=function(e,t){return this._headers.push({name:e,value:t}),this},e.prototype.addParam=function(e,t){return this._params.push({name:e,value:t}),this},e.prototype.post=function(){var e=this,t=new FormData;return this._params.forEach((function(e){return t.append(e.name,e.value)})),Promise.all(this._files.map((function(e){return e.path?n.convertToBlob(e.path).then((function(t){return{name:e.name,fileName:e.fileName,blob:t.blob}})):e}))).then((function(n){return n.forEach((function(e){return t.append(e.name,e.blob||e.path,e.fileName)})),new Promise((function(n,i){var o=new XMLHttpRequest;o.open("POST",e.url),e._headers.forEach((function(e){return o.setRequestHeader(e.name,e.value)})),o.onload=function(){n({headers:function(e){return o.getResponseHeader(e)},response:o.response,text:o.responseText})},o.onerror=i,o.onabort=i,o.send(t)}))}))},e}(),Z=function(){function e(e){this.cordovaFile=e}return e.prototype.upload=function(e,t,n,i,o,r){var a=new J(e,this.cordovaFile).addFile(t,n,i);return _.forEach(o,(function(e,t){return a.addParam(e,t)})),_.forEach(r,(function(e,t){return a.addHeader(e,t)})),a.post()},e}();Z.SERVICE_NAME="DeviceFileUploadService",Z.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new Z(g.\u0275\u0275inject(b.File))},token:Z,providedIn:"root"}),Z.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Z.ctorParameters=function(){return[{type:i.File}]};var ee=function(){function e(e){var t=this;this.app=e,this.handlers=[],document.addEventListener("externalAppMessageReceived",(function(e){var n=e.detail.message;t.handlers.forEach((function(e){var t=e&&n.address.match(e.pattern);t&&t.length>0&&e.callBack(n)}))}))}return e.prototype.subscribe=function(e,t){var n=this,i={pattern:new RegExp(e),callBack:t};return this.handlers.push(i),function(){return _.remove(n.handlers,i)}},e}();ee.SERVICE_NAME="ExtAppMessageService",ee.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new ee(g.\u0275\u0275inject(v.App))},token:ee,providedIn:"root"}),ee.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ee.ctorParameters=function(){return[{type:n.App}]},function(e,t){function i(e,t,n){return n=n<0?void 0:n,e&&t>=0&&e.length>t&&e.substring(t,n)||void 0}function o(e,t){return e&&e.indexOf(t)}function r(e){if(!e)return!1;var t=e.match(/\{([^)]+)\}/);if(t){var i=n.getValidJSON("{"+t[1]+"}");if(i&&i.flow)return i.flow}return!1}function a(e){var t=i(e,o(e,"?")+1,o(e,"#")),n={},a=r(e);return"implicit"===a?t=e.match(/access_token=([^&#]*)/)[0]:"pkce"===a&&(t=e.match(/code=([^&#]*)/)[0]),_.forEach(_.split(t,"&"),(function(e){var t=e.split("=");n[t[0]]=t[1]})),n}function s(e){var t="implicit"===r(e)?"#":"?";return i(e,o(e,"://")+3,o(e,t))}e.handleOpenURL=function(n){var i=e.handleOpenURL;if(i.isReady&&!_.startsWith(n,"http")){var o=function(e){return{address:s(e),data:a(e)}}(n),r=new e.CustomEvent("externalAppMessageReceived",{detail:{message:o}});t.dispatchEvent(r)}i.lastURL=n}}(window,document),e.DeviceFileCacheService=x,e.DeviceFileDownloadService=D,e.DeviceFileOpenerService=k,e.DeviceFileService=C,e.DeviceFileUploadService=Z,e.DeviceService=L,e.ExtAppMessageService=ee,e.MobileCoreModule=X,e.NetworkService=Q,e.UploadRequest=J,e["\u02750"]=H,e["\u02751"]=Y,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@wm/components/base"),require("@angular/common/http"),require("@awesome-cordova-plugins/file/ngx"),require("@awesome-cordova-plugins/file-opener/ngx"),require("@wm/core"),require("@wm/mobile/core"),require("@angular/common"),require("@wm/components/basic/progress")):"function"==typeof define&&define.amd?define("@wm/mobile/components/basic",["exports","@angular/core","@wm/components/base","@angular/common/http","@awesome-cordova-plugins/file/ngx","@awesome-cordova-plugins/file-opener/ngx","@wm/core","@wm/mobile/core","@angular/common","@wm/components/basic/progress"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.components=e.wm.mobile.components||{},e.wm.mobile.components.basic={}),e.ng.core,e.wm.components.base,e.ng.common.http,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.wm.core,e.wm.mobile.core,e.ng.common,e.wm.components.basic.progress)}(this,(function(e,t,n,i,o,r,a,s,l,c){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=p(t),d=p(a),h=function(){function e(e){this.widget=e}return e.prototype.onClick=function(){var e=this.widget.hyperlink;if(e){if(e.indexOf(":")>=0&&!_.startsWith(e,"http://")&&!_.startsWith(e,"https://"))return;if(_.startsWith(e,"#"))return void(window.location.href=window.location.origin+window.location.pathname+e);_.startsWith(e,"//")&&(e="https:"+e),window.cordova&&window.open(e,this.widget.target)}},e}();h.decorators=[{type:t.Directive,args:[{selector:"[wmAnchor]"}]}],h.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[n.WidgetRef]}]}]},h.propDecorators={onClick:[{type:t.HostListener,args:["click"]}]};var m="app-auto-update.apk",f=function(){function e(e,t,n,i,o,r){var s=this;this.deviceService=e,this.fileDownloadService=t,this.elRef=n,this.file=i,this.fileOpener=o,this.http=r,this.downloadProgress=0,this.downloading=!1,this.message="There is an update available. Would you like to update the app?",a.addClass(this.elRef.nativeElement,"app-update-dialog modal fade in hidden"),a.setCSS(this.elRef.nativeElement,"display","block"),a.hasCordova()&&this.getBuildMeta().then((function(e){e&&"DEVELOPMENT_MODE"===e.buildMode&&(s.file.removeFile(cordova.file.externalApplicationStorageDirectory,m).catch(a.noop),s.checkForUpdate().then(s.getUserConfirmation.bind(s),a.noop))}))}return e.prototype.cancel=function(){a.addClass(this.elRef.nativeElement,"hidden")},e.prototype.installLatestVersion=function(){var e=this,t=cordova.file.externalApplicationStorageDirectory+m,n=this._buildMeta.host+"/appBuild/rest/mobileBuilds/android/download?token="+this._buildMeta.token+"&buildNumber="+this._buildMeta.latestBuildNumber+"&fileName="+"app-auto-update.apk&releaseVersion="+this._buildMeta.platformVersion,i={next:function(t){e.downloadProgress=t.loaded/t.total*100},error:null,complete:null};this.fileDownloadService.download(n,!1,cordova.file.externalApplicationStorageDirectory,m,i).then((function(){e.fileOpener.open(t,"application/vnd.android.package-archive")}),(function(){this.message="Failed to download latest version."})),this.message="Downloading the latest version ["+this._buildMeta.latestVersion+"].",this.downloading=!0},e.prototype.checkForUpdate=function(){var e=this;return new Promise((function(t,n){e.http.get(e._buildMeta.host+"/appBuild/rest/mobileBuilds/latest_build?token="+e._buildMeta.token+"&releaseVersion="+e._buildMeta.platformVersion).toPromise().then((function(i){var o=i.success.body.buildNumber,r=i.success.body.version;e._buildMeta.buildNumber<o?(e._buildMeta.latestBuildNumber=o,e._buildMeta.latestVersion=r,t(o)):n()}),n)}))},e.prototype.getBuildMeta=function(){var e=this;return this._buildMeta?Promise.resolve(this._buildMeta):this.file.readAsText(cordova.file.applicationDirectory+"www/","build_meta.json").then((function(t){return e._buildMeta=JSON.parse(t),e._buildMeta}),a.noop)},e.prototype.getUserConfirmation=function(){this.downloadProgress=0,this.downloading=!1,this.message="There is an update available. Would you like to update the app?",a.removeClass(this.elRef.nativeElement,"hidden")},e}();f.decorators=[{type:t.Component,args:[{selector:"[wmAppUpdate]",template:'<div class="modal-dialog">\n <div class="modal-content"> \n <div class="modal-body"> \n <span [textContent]="message"></span>\n <div class="progress" [hidden]="!downloading">\n <div class="progress-bar" [style.width.%]="downloadProgress"></div>\n </div>\n </div>\n <div class="modal-footer"> \n <button type="button" class="btn btn-default" data-dismiss="modal" (click)="cancel()">Skip update</button>\n <button type="button" class="btn btn-primary" [hidden]="downloading" (click)="installLatestVersion()">Update</button>\n </div>\n </div>\n</div>'}]}],f.ctorParameters=function(){return[{type:s.DeviceService},{type:s.DeviceFileDownloadService},{type:t.ElementRef},{type:o.File},{type:r.FileOpener},{type:i.HttpClient}]};var g=function(){function e(e){this.deviceService=e,this.selectedFiles=[],this.submitEmitter=new t.EventEmitter}return e.prototype.getFileExtension=function(e){var t=e?e.lastIndexOf("."):-1;return t>0?e.substring(t+1):""},e.prototype.ngOnDestroy=function(){this.backButtonListenerDeregister&&this.backButtonListenerDeregister()},e.prototype.onFileClick=function(e){e.isFile?e.isSelected?this.deselectFile(e):this.selectFile(e):this.goToFolder(e)},Object.defineProperty(e.prototype,"show",{set:function(e){var t=this,n=cordova.file.externalRootDirectory;this.isVisible=e,e?(this.currentFolder||(a.isIos()&&(n=cordova.file.documentsDirectory),resolveLocalFileSystemURL(n,(function(e){return t.goToFolder(e)}))),this.backButtonListenerDeregister=this.deviceService.onBackButtonTap((function(){if(t.isVisible)return t.currentFolder.parent?t.onFileClick(t.currentFolder.parent):t.isVisible=!1,a.$appDigest(),!1}))):this.backButtonListenerDeregister&&this.backButtonListenerDeregister()},enumerable:!1,configurable:!0}),e.prototype.submit=function(){var e=this,t=[];this.loadFileSize(this.selectedFiles).then((function(){_.forEach(e.selectedFiles,(function(e){e.isSelected=!1,t.push({path:e.nativeURL,name:e.name,size:e.size})})),e.selectedFiles=[],e.isVisible=!1,e.submitEmitter.next({files:t})}))},e.prototype.deselectFile=function(e){_.remove(this.selectedFiles,e),e.isSelected=!1},e.prototype.goToFolder=function(e){var t=this;e.files?this.currentFolder=e:this.loadFolder(e,this.fileTypeToSelect).then((function(n){e.files=n,e.parent=t.currentFolder,t.currentFolder=e}))},e.prototype.loadFileSize=function(e){return Promise.all(e.map((function(e){return new Promise((function(t,n){e.file((function(n){e.size=n.size,t()}),n)}))})))},e.prototype.loadFolder=function(e,t){return new Promise((function(n,i){var o;e.createReader().readEntries((function(e){_.isEmpty(t)||(o=_.split(t,","),e=_.filter(e,(function(e){return!e.isFile||_.findIndex(o,(function(t){return _.endsWith(e.name,"."+t)}))>=0}))),n(_.sortBy(e,(function(e){return(e.isFile?"1_":"0_")+e.name.toLowerCase()})))}),i)}))},e.prototype.refreshFolder=function(){var e=this;return this.loadFolder(this.currentFolder,this.fileTypeToSelect).then((function(t){return e.currentFolder.files=t}))},e.prototype.selectFile=function(e){!this.multiple&&this.selectedFiles.length>0&&(this.selectedFiles[0].isSelected=!1,this.selectedFiles=[]),this.selectedFiles.push(e),e.isSelected=!0},e}();g.decorators=[{type:t.Component,args:[{selector:"[wmMobileFileBrowser]",template:'<div class="app-file-browser" *ngIf="isVisible && currentFolder">\n <div class="modal-backdrop fade" [class.in]="isVisible"></div>\n <div class="modal fade" style="display: block;" [class.in]="isVisible" >\n <div class="modal-dialog">\n <div class="modal-content">\n <div class="modal-header clearfix">\n <h4 class="modal-title pull-left">\n <span (click)="onFileClick(currentFolder.parent)" [hidden]="!!!currentFolder.parent">\n <i class="wi wi-long-arrow-left"></i>\n </span>\n {{currentFolder.name}}\n </h4>\n <div class="selected-file-button pull-right" (click)="refreshFolder()">\n <i class="wi wi-refresh"></i>\n </div>\n </div>\n <div class="modal-body">\n <div class="file-info-box" *ngFor="let file of currentFolder.files">\n <div class="file-info" [class.bg-primary]="file.isSelected" (click)="onFileClick(file)">\n <i class="file-icon wi wi-folder" *ngIf="!file.isFile"></i>\n <i class="file-icon wi wi-file {{getFileExtension(file.name)}}" *ngIf="file.isFile"></i>\n <span class="file-name">{{file.name}}</span>\n </div>\n </div>\n </div>\n <div class="modal-footer">\n <button type="button" class="btn btn-primary" *ngIf="selectedFiles && selectedFiles.length > 0" (click)="submit()">\n Done <span class="badge badge-light">{{selectedFiles.length}}</span>\n </button>\n <button type="button" class="btn btn-default" (click)="show = false;">Close</button>\n </div>\n </div>\n </div>\n </div>\n</div>'}]}],g.ctorParameters=function(){return[{type:s.DeviceService}]},g.propDecorators={fileTypeToSelect:[{type:t.Input}],multiple:[{type:t.Input}],submitEmitter:[{type:t.Output,args:["submit"]}]};var v=function(){function e(e){this.spinnerService=e}return e.prototype.selectAudio=function(e){var t=this;void 0===e&&(e=!1);var n=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectAudio(e,t,n)})).then((function(e){return t.getFiles(e)})).then((function(e){return t.spinnerService.hide(n),e}))},e.prototype.setFileBrowser=function(e){this.fileBrowserComponent=e},e.prototype.selectFiles=function(e,t){var n=this;void 0===e&&(e=!1);var i=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectFiles(e,t,n)})).then((function(e){return n.getFiles(e)})).then((function(e){return n.spinnerService.hide(i),e}))},e.prototype.selectImages=function(e){var t=this;void 0===e&&(e=!1);var n=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectImage(e,t,n)})).then((function(e){return t.getFiles(e)})).then((function(e){return t.spinnerService.hide(n),e}))},e.prototype.selectVideos=function(e){var t=this;void 0===e&&(e=!1);var n=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectVideo(e,t,n)})).then((function(e){return t.getFiles(e)})).then((function(e){return t.spinnerService.hide(n),e}))},e.prototype.getFiles=function(e){return Promise.all(_.map(e,(function(e){return e.indexOf("://")<0&&(e="file://"+e),a.convertToBlob(e)}))).then((function(e){return _.map(e,(function(e){var t=e.filepath;return{name:t.split("/").pop(),path:t,content:e.blob,size:e.blob.size}}))}))},e}();v.SERVICE_NAME="FileSelectorService",v.\u0275prov=u.\u0275\u0275defineInjectable({factory:function(){return new v(u.\u0275\u0275inject(d.AbstractSpinnerService))},token:v,providedIn:"root"}),v.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],v.ctorParameters=function(){return[{type:a.AbstractSpinnerService}]};var y=function(){function e(e,t,n){this.componentInstance=e,this.deviceFileCacheService=t,this.file=n,this._isEnabled=!1,this._lastUrl=""}return e.prototype.ngDoCheck=function(){var e=this;_.isString(this.componentInstance.imgSource)&&this.componentInstance.imgSource.startsWith("http")&&(this._lastUrl!==this.componentInstance.imgSource?(this._lastUrl=this.componentInstance.imgSource,this.componentInstance.imgSource="resources/images/imagelists/default-image.png",this.getLocalPath(this._lastUrl).then((function(t){e._cacheUrl=a.transformFileURI(t),e.componentInstance.imgSource=e._cacheUrl}))):this._cacheUrl&&(this.componentInstance.imgSource=this._cacheUrl))},Object.defineProperty(e.prototype,"wmImageCache",{set:function(e){this._isEnabled=a.hasCordova()&&"true"===e},enumerable:!1,configurable:!0}),e.prototype.getLocalPath=function(e){return a.hasCordova()&&e&&e.indexOf("{{")<0&&e.startsWith("http")?this.deviceFileCacheService.getLocalPath(e,!0,!0,!this._isEnabled).catch(a.noop):Promise.resolve(e)},e}();y.decorators=[{type:t.Directive,args:[{selector:"[wmImageCache]"}]}],y.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[n.WidgetRef]}]},{type:s.DeviceFileCacheService},{type:o.File}]},y.propDecorators={wmImageCache:[{type:t.Input}]};
|
|
730
|
+
***************************************************************************** */var a=function(e,t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};Object.create;function s(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var i,o=0,r=t.length;o<r;o++)!i&&o in t||(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}Object.create;var c=function(){i.register("wm-login",new Map([["errormessage",i.PROP_STRING],["eventsource",i.PROP_ANY]]))},p={widgetType:"wm-login",hostClass:"app-login"},u=function(e){function t(t){var n=e.call(this,t,p)||this;return i.styler(n.nativeElement,n,i.APPLY_STYLES_TYPE.CONTAINER),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.onSuccessCB=function(){this.invokeEventCallback("success")},t.prototype.onErrorCB=function(e){this.loginMessage={type:"error",caption:this.errormessage||e||this.appLocale.LABEL_INVALID_USERNAME_OR_PASSWORD,show:!0},this.messageCmp.showMessage(this.loginMessage.caption,this.loginMessage.type),this.invokeEventCallback("error")},t.prototype.getLoginDetails=function(){return this.formCmp.dataoutput},t.prototype.doLogin=function(){this.eventsource?this.formCmp.ngform.valid&&this.eventsource.invoke({loginInfo:this.getLoginDetails()},this.onSuccessCB.bind(this),this.onErrorCB.bind(this)):console.warn('Default action "loginAction" does not exist. Either create the Action or assign an event to onSubmit of the login widget')},t.prototype.initLoginButtonActions=function(){var e=this;this.loginBtnCmp.getNativeElement().addEventListener("click",(function(t){e.nativeElement.hasAttribute("submit.event")||e.loginBtnCmp.getNativeElement().hasAttribute("click.event")||e.loginBtnCmp.getNativeElement().hasAttribute("tap.event")||e.doLogin()}))},t.prototype.ngAfterViewInit=function(){var t=this;e.prototype.ngAfterViewInit.call(this),this.formCmp.getNativeElement().addEventListener("submit",(function(e){return e.preventDefault()})),this.buttonComponents.forEach((function(e){if("loginButton"===e.getNativeElement().getAttribute("name")||_.includes(e.getNativeElement().classList,"app-login-button")){if(t.loginBtnCmp)return;t.loginBtnCmp=e,t.initLoginButtonActions()}}))},t}(i.StylableComponent);u.initializeProps=c(),u.decorators=[{type:t.Component,args:[{selector:"div[wmLogin]",template:'<p wmMessage class="app-login-message" #message show.bind="loginMessage.show" caption.bind="loginMessage.caption" type.bind="loginMessage.type"></p>\n<ng-content></ng-content>\n',providers:[i.provideAsWidgetRef(u)]}]}],u.ctorParameters=function(){return[{type:t.Injector}]},u.propDecorators={formCmp:[{type:t.ContentChild,args:[o.FormComponent]}],buttonComponents:[{type:t.ContentChildren,args:[r.ButtonComponent,{descendants:!0}]}],messageCmp:[{type:t.ViewChild,args:[i.MessageComponent,{static:!0}]}]};var d=[u],h=function(){};h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.WmComponentsModule],declarations:l([],s(d)),exports:l([],s(d)),entryComponents:[]}]}],e.LoginComponent=u,e.LoginModule=h,e["\u0275a"]=c,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@wm/core"),require("@awesome-cordova-plugins/file/ngx"),require("@awesome-cordova-plugins/app-version/ngx"),require("@awesome-cordova-plugins/app-version/ngx/index"),require("@awesome-cordova-plugins/file/ngx/index"),require("@angular/common/http"),require("rxjs/operators"),require("@wm/components/base"),require("@awesome-cordova-plugins/file-opener/ngx"),require("@awesome-cordova-plugins/file-opener/ngx/index"),require("@awesome-cordova-plugins/network/ngx"),require("@awesome-cordova-plugins/network/ngx/index")):"function"==typeof define&&define.amd?define("@wm/mobile/core",["exports","@angular/core","@wm/core","@awesome-cordova-plugins/file/ngx","@awesome-cordova-plugins/app-version/ngx","@awesome-cordova-plugins/app-version/ngx/index","@awesome-cordova-plugins/file/ngx/index","@angular/common/http","rxjs/operators","@wm/components/base","@awesome-cordova-plugins/file-opener/ngx","@awesome-cordova-plugins/file-opener/ngx/index","@awesome-cordova-plugins/network/ngx","@awesome-cordova-plugins/network/ngx/index"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.core={}),e.ng.core,e.wm.core,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.ng.common.http,e.rxjs.operators,e.wm.components.base,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.awesomeCordova.plugins)}(this,(function(e,t,n,i,o,r,a,s,l,c,p,u,d,h){"use strict";function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var f,g=m(t),v=m(n),y=m(r),b=m(a),w=m(s),P=m(c),O=m(u),S=m(h);e.FileType=void 0,(f=e.FileType||(e.FileType={})).AUDIO="AUDIO",f.DOCUMENT="DOCUMENT",f.IMAGE="IMAGE",f.VIDEO="VIDEO";var E=["gif","jpg","png","svg","webp","jpeg","jif","jfif","jfi"],T=["mp4","mpg","avi","wma","mp2","3gp","3g2","m4p","m4v","mpg","fiv"],R=["mp3","m4p","aiff","aa","aax","wma"],A=[{name:"{APP_NAME}",children:[{name:"Media",children:[{name:"{APP_NAME} Images",fileType:e.FileType.IMAGE},{name:"{APP_NAME} Audio",fileType:e.FileType.AUDIO},{name:"{APP_NAME} Vedios",fileType:e.FileType.VIDEO},{name:"{APP_NAME} Documents",fileType:e.FileType.DOCUMENT}]}]}],C=function(){function t(e,t){this.cordovaAppVersion=e,this.cordovaFile=t,this._fileTypeVsPathMap={temporary:{},persistent:{}}}return t.prototype.addMediaToGallery=function(e){return n.isAndroid()&&this.isPersistentType(e)?new Promise((function(t,n){cordova.plugins.MediaScannerPlugin.scanFile(e,t,n)})):Promise.resolve()},t.prototype.appendToFileName=function(e,t){var n;return t=t||"_"+_.now(),(n=(e=e||"noname").split(".")).length>1?(n[n.length-2]=n[n.length-2]+t,n.join(".")):e+t},t.prototype.clearTemporaryStorage=function(){return this.cordovaFile.removeRecursively(this.getTemporaryRootPath()+this._appName+"/","Media")},t.prototype.copy=function(e,t){var n=this,i=t.split("/").pop(),o=this.findFolderPath(e,i),r=t.substring(0,t.lastIndexOf("/"));return this.newFileName(o,i).then((function(e){return n.cordovaFile.copyFile(r,i,o,e).then((function(){return o+e}))}))},t.prototype.findFolderPath=function(t,n){var i=t?this._fileTypeVsPathMap.persistent:this._fileTypeVsPathMap.temporary;return i[this.findFileType(n)]||i[e.FileType.DOCUMENT]},t.prototype.getPersistentRootPath=function(){return cordova.file.dataDirectory},t.prototype.getTemporaryRootPath=function(){return cordova.file.cacheDirectory},t.prototype.getUploadDirectory=function(){return this._uploadDir},t.prototype.isPersistentType=function(e){return e.startsWith(this.getPersistentRootPath())},t.prototype.isValidPath=function(e){var t,n;return e?(t=e.substring(0,e.lastIndexOf("/")+1),n=e.split("/").pop(),this.cordovaFile.checkFile(t,n).then((function(){return e}))):Promise.reject("File path is required")},t.prototype.listFiles=function(e,t){return new Promise((function(n,i){resolveLocalFileSystemURL(e,(function(e){e.files?n([]):e.createReader().readEntries((function(e){t&&(e=e.filter((function(e){return e.name.match(t)}))),e=e.map((function(e){return{name:e.name,isDirectory:e.isDirectory,path:e.nativeURL}})),n(e)}),i)}),i)}))},t.prototype.newFileName=function(e,t){var n=this;return this.cordovaFile.checkFile(e,t).then((function(){var i=t.lastIndexOf(".");return t=i>0?t.substring(0,i)+"_"+_.now()+"."+t.substring(i+1):t+"_"+_.now(),n.newFileName(e,t)}),(function(){return t}))},t.prototype.removeFile=function(e){var t=e.lastIndexOf("/"),n=e.substring(0,t),i=e.substring(t+1);return this.cordovaFile.removeFile(n,i)},t.prototype.removeDir=function(e){var t=this,i=e.lastIndexOf("/"),o=e.substring(0,i+1),r=e.substring(i+1),a=r+_.now();return this.cordovaFile.checkDir(o,r).then((function(){return t.cordovaFile.moveDir(o,r,o,a).then((function(){return t.cordovaFile.removeDir(o,a)}))})).catch(n.noop)},t.prototype.start=function(){var e=this;return FileReader.READ_CHUNK_SIZE=524288,Promise.resolve().then((function(){return e.cordovaAppVersion.getAppName()})).then((function(t){var n=[];return e._appName=t,n.push(e.createFolderIfNotExists(e.getTemporaryRootPath(),A,e._fileTypeVsPathMap.temporary)),n.push(e.createFolderIfNotExists(e.getPersistentRootPath(),A,e._fileTypeVsPathMap.persistent)),n.push(e.setupUploadDirectory()),Promise.all(n)})).then((function(){if(n.isAndroid())return e.cordovaFile.readAsText(cordova.file.externalRootDirectory,"random-file-for-permission").catch(n.noop)}))},t.prototype.getServiceName=function(){return t.SERVICE_NAME},t.prototype.createFolderIfNotExists=function(e,t,n){var i=this,o=[];if(t&&t.forEach((function(t){var r;t.name=t.name.replace("{APP_NAME}",i._appName),r=e+t.name+"/",t.fileType&&!n[t.fileType]&&(n[t.fileType]=r);var a=i.cordovaFile.createDir(e,t.name,!1).then((function(){return i.createFolderIfNotExists(r,t.children,n)}),(function(){return i.createFolderIfNotExists(r,t.children,n)}));o.push(a)})),o.length>0)return Promise.all(o)},t.prototype.findFileType=function(t){var n;if(t.indexOf(".")>0){if(n=t.split(".").pop().toLowerCase(),E.some((function(e){return e===n})))return e.FileType.IMAGE;if(T.some((function(e){return e===n})))return e.FileType.VIDEO;if(R.some((function(e){return e===n})))return e.FileType.AUDIO}return e.FileType.DOCUMENT},t.prototype.setupUploadDirectory=function(){var e=this,t="uploads",n=cordova.file.dataDirectory;return this.cordovaFile.checkDir(n,t).then((function(){return e._uploadDir=n+t}),(function(){return e.cordovaFile.createDir(n,t,!0).then((function(){return e._uploadDir=n+t}))}))},t}();C.SERVICE_NAME="DeviceFileService",C.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new C(g.\u0275\u0275inject(y.AppVersion),g.\u0275\u0275inject(b.File))},token:C,providedIn:"root"}),C.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],C.ctorParameters=function(){return[{type:o.AppVersion},{type:i.File}]};Object.create;function I(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}Object.create;var D=function(){function e(e,t,n,i){this.cordovaFile=e,this.http=t,this.deviceFileService=n,this.fileExtensionFromMimePipe=i,this._downloadQueue=[],this._concurrentDownloads=0}return e.prototype.download=function(e,t,n,i,o,r){return this.addToDownloadQueue(e,t,n,i,o,r)},e.prototype.addToDownloadQueue=function(e,t,n,i,o,r){var a=this;return new Promise((function(s,l){a._downloadQueue.push({url:e,headers:r,isPersistent:t,destFolder:n,destFile:i,resolve:s,reject:l,progressObserver:o}),a._concurrentDownloads<2&&a.downloadNext()}))},e.prototype.downloadNext=function(){var e=this;if(this._downloadQueue.length>0){var t=this._downloadQueue.shift();this.downloadFile(t).then((function(n){t.resolve(n),e.downloadNext()}),(function(){t.reject(),e.downloadNext()}))}},e.prototype.downloadFile=function(e){var t,n,i=this;return this._concurrentDownloads++,this.sendHttpRequest(e.url,e.progressObserver,e.headers).then((function(t){return n=t.body,i.getFileName(t,e,n.type)})).then((function(o){return e.destFolder||(e.destFolder=i.deviceFileService.findFolderPath(e.isPersistent,o)),t=e.destFolder+o,i.cordovaFile.writeFile(e.destFolder,o,n)})).then((function(){return i._concurrentDownloads--,t}),(function(t){return i._concurrentDownloads--,i.cordovaFile.removeFile(e.destFolder,e.destFile),Promise.reject("Failed to downloaded "+e.url+" with error "+JSON.stringify(t))}))},e.prototype.getFileName=function(e,t,n){var i,o,r=e.headers.get("Content-Disposition"),a=t.destFile;if(!a&&r&&-1!==r.indexOf("attachment")){var s=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(r);null!==s&&s[1]&&(a=s[1].replace(/['"]/g,""))}a||(a=(a=t.url.split("?")[0]).split("/").pop()),n&&(i=this.fileExtensionFromMimePipe.transform(n)),_.isArray(i)&&!_.isEmpty(i)&&(o=_.find(i,(function(e){return _.endsWith(a,e)})),i=i[0]),o||_.endsWith(a,i)||(a+=i);var l=t.destFolder||this.deviceFileService.findFolderPath(t.isPersistent,a);return this.deviceFileService.newFileName(l,a)},e.prototype.sendHttpRequest=function(e,t,n){var i=new s.HttpHeaders;n&&Object.entries(n).forEach((function(e){var t=I(e,2),n=t[0],o=t[1];return i=i.append(n,o)}));var o=new s.HttpRequest("GET",e,{headers:i,responseType:"blob",reportProgress:null!=t});return this.http.request(o).pipe(l.map((function(e){return t&&t.next&&e.type===s.HttpEventType.DownloadProgress&&t.next(e),e})),l.filter((function(e){return e.type===s.HttpEventType.Response})),l.map((function(e){return t&&t.complete&&t.complete(),e}))).toPromise()},e}();D.SERVICE_NAME="DeviceFileDownloadService",D.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new D(g.\u0275\u0275inject(b.File),g.\u0275\u0275inject(w.HttpClient),g.\u0275\u0275inject(C),g.\u0275\u0275inject(P.FileExtensionFromMimePipe))},token:D,providedIn:"root"}),D.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],D.ctorParameters=function(){return[{type:i.File},{type:s.HttpClient},{type:C},{type:c.FileExtensionFromMimePipe}]};var N="appCache.json",x=function(){function e(e,t,n){this.cordovaFile=e,this.fileService=t,this.downloadService=n,this._cacheIndex={}}return e.prototype.addEntry=function(e,t){this._cacheIndex[e]=t,this.writeCacheIndexToFile()},e.prototype.getLocalPath=function(e,t,n,i){var o=this;if(void 0===i&&(i=!1),i)return this.download(e,n);var r=this._cacheIndex[e];return this.fileService.isValidPath(r).catch((function(){return delete o._cacheIndex[e],t?o.download(e,n):Promise.reject("No cache entry for "+e)}))},e.prototype.invalidateCache=function(){this._cacheIndex={},this.writeCacheIndexToFile(),this.fileService.clearTemporaryStorage()},e.prototype.start=function(){var e=this;return this.cordovaFile.readAsText(cordova.file.dataDirectory,N).then((function(t){e._cacheIndex=JSON.parse(t)}),n.noop)},e.prototype.getServiceName=function(){return e.SERVICE_NAME},e.prototype.download=function(e,t){var n=this;return this.downloadService.download(e,t).then((function(t){return n._cacheIndex[e]=t,n.writeCacheIndexToFile(),t}))},e.prototype.writeCacheIndexToFile=function(){var e=this;this._writing?this._saveCache=!0:(this._writing=!0,this.cordovaFile.writeFile(cordova.file.dataDirectory,N,JSON.stringify(this._cacheIndex),{replace:!0}).catch(n.noop).then((function(){e._saveCache?setTimeout((function(){e._writing=!1,e._saveCache=!1,e.writeCacheIndexToFile()}),5e3):e._writing=!1})))},e}();x.SERVICE_NAME="DeviceFileCacheService",x.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new x(g.\u0275\u0275inject(b.File),g.\u0275\u0275inject(C),g.\u0275\u0275inject(D))},token:x,providedIn:"root"}),x.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],x.ctorParameters=function(){return[{type:i.File},{type:C},{type:D}]};var k=function(){function e(e,t,n,i,o){this.cordovaFile=e,this.cordovaFileOpener=t,this.fileService=n,this.cacheService=i,this.downloadService=o}return e.prototype.getFileMimeType=function(e){return new Promise((function(t){resolveLocalFileSystemURL(e,(function(e){e.file((function(e){t(e.type)}))}))}))},e.prototype.openRemoteFile=function(e,t,n,i){var o=this;return this.getLocalPath(e,t,n,i).then((function(e){return o.getFileMimeType(e).then((function(t){return o.cordovaFileOpener.open(e,t)}))}))},e.prototype.start=function(){var e,t=this;return e=n.isAndroid()?cordova.file.externalCacheDirectory:n.isIos()?cordova.file.documentsDirectory+"NoCloud/":cordova.file.dataDirectory,this.cordovaFile.createDir(e,"downloads",!1).catch(n.noop).then((function(){t._downloadsFolder=e+"downloads/"}))},e.prototype.getServiceName=function(){return x.SERVICE_NAME},e.prototype.generateFileName=function(e,t){var n=e.split("?")[0];return n=n.split("/").pop(),n=this.fileService.appendToFileName(n,""+_.now()),t?n.split(".")[0]+"."+t:n},e.prototype.getLocalPath=function(e,t,n,i){var o=this;return new Promise((function(r,a){return o.cacheService.getLocalPath(e,!1,!1).then((function(i){var a,s,l,c,p;i.startsWith(o._downloadsFolder)?r(i):(l=i.lastIndexOf("."),t=i.substring(l+1),a=n||o.generateFileName(e,t),s=i.lastIndexOf("/"),c=i.substring(0,s),p=i.substring(s+1),o.cordovaFile.copyFile(c,p,o._downloadsFolder,a).then((function(){var t=o._downloadsFolder+a;o.cacheService.addEntry(e,t),r(t)})))})).catch((function(){o.downloadService.download(e,!1,o._downloadsFolder,n,void 0,i).then((function(t){o.cacheService.addEntry(e,t),r(t)}),a)}))}))},e}();k.SERVICE_NAME="DeviceFileOpenerService",k.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new k(g.\u0275\u0275inject(b.File),g.\u0275\u0275inject(O.FileOpener),g.\u0275\u0275inject(C),g.\u0275\u0275inject(x),g.\u0275\u0275inject(D))},token:k,providedIn:"root"}),k.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],k.ctorParameters=function(){return[{type:i.File},{type:p.FileOpener},{type:C},{type:x},{type:D}]};var M="registry.info",L=function(){function e(e){var t=this;this.file=e,this._registry={},this._isReady=!1,this._whenReadyPromises=[],this._backBtnTapListeners=[],this._startUpServices=[],this._config={};if(setTimeout((function(){t._isReady||(console.warn("Device is not ready even after 10 seconds"),console.warn("Waiting For %O",t._startUpServices.map((function(e){return e.getServiceName()}))))}),1e4),document.addEventListener("backbutton",this.executeBackTapListeners.bind(this)),n.hasCordova()){var i=location.port?":"+location.port:"",o=location.protocol+"//"+location.hostname+i+(n.isIos()?"":"/_www")+"/config.json";n.fetchContent("json",o,!0,(function(e){!e.error&&e.baseUrl&&(t._config=e)}))}}return e.prototype.executeBackTapListeners=function(e){_.forEach(this._backBtnTapListeners,(function(t){return!1!==t(e)})),n.$appDigest()},e.prototype.addStartUpService=function(e){this._startUpServices.push(e)},e.prototype.onBackButtonTap=function(e){var t=this;return this._backBtnTapListeners.unshift(e),function(){var n=t._backBtnTapListeners.indexOf(e);n>=0&&t._backBtnTapListeners.splice(n,1)}},e.prototype.start=function(){var e=this;return this._isReady||0===this._startUpServices.length?(this._isReady=!0,Promise.resolve()):new Promise((function(e){n.hasCordova()?document.addEventListener("deviceready",(function(){return e()}),!1):e()})).then((function(){if(window.cordova)return e.file.readAsText(cordova.file.dataDirectory,M).then((function(t){return e._registry=JSON.parse(t)}),n.noop)})).then((function(){return Promise.all(e._startUpServices.map((function(e){return e.start().catch((function(t){return console.error("%s failed to start due to: %O",e.getServiceName(),t),Promise.reject(t)}))})))})).then((function(){window.wmDeviceReady=!0,document.dispatchEvent(new CustomEvent("wmDeviceReady")),e._startUpServices.length=0,e._whenReadyPromises.forEach((function(e){return e()})),e._isReady=!0}))},e.prototype.getServiceName=function(){return e.SERVICE_NAME},e.prototype.whenReady=function(){var e=this;return this._isReady?Promise.resolve():new Promise((function(t){e._whenReadyPromises.push(t)}))},e.prototype.getBaseUrl=function(){return"http://NOSERVERREQUIRED.com"===this._config.baseUrl?"NONE":this._config.baseUrl},e.prototype.isAppConnectedToPreview=function(){return this._config.customUrl!==this._config.baseUrl&&"NONE"!==this.getBaseUrl()},e.prototype.getConfig=function(){return this._config},e.prototype.useNativeXHR=function(){return(n.isIos()||!0===this._config.useNativeXHR)&&n.hasCordova()&&cordova.plugin&&cordova.plugin.http},e.prototype.getAppBuildTime=function(){return Promise.resolve(this._config.buildTime)},e.prototype.storeEntry=function(e,t){return this._registry[e]=t,this.file.writeFile(cordova.file.dataDirectory,M,JSON.stringify(this._registry),{replace:!0})},e.prototype.getEntry=function(e){return this._registry[e]},e}();L.SERVICE_NAME="DeviceService",L.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new L(g.\u0275\u0275inject(b.File))},token:L,providedIn:"root"}),L.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],L.ctorParameters=function(){return[{type:i.File}]};var F=window.XMLHttpRequest,j=window.cordova,B=function(){function e(e){this.nXhr=e,this.xhr=new F,this.method="GET",this.requestHeaders={},this.responseHeaders={},this.responseHeaderText="",this.url="",this.async=!0,this.listeners={}}return e.prototype.triggerListeners=function(e,t){var n=this.listeners[e];n&&n.forEach((function(e){e.apply(window,t)}))},e.prototype.copyNativeResponse=function(e){this.nXhr.status=e.status,this.nXhr.statusText=e.statusText||e.status,this.nXhr.response=e.data,this.nXhr.responseType=e.headers&&e.headers["content-type"]||"plain/text",this.nXhr.responseURL=e.responseURL,this.nXhr.responseXML=e.responseXML,this.nXhr.responseText=e.data&&e.data.toString()||e.error,this.responseHeaderText=function(){var t=[];for(var n in e.headers)t.push(n+": "+e.headers[n]);return t.join("\r\n")}()},e.prototype.copyXMLHttpResponse=function(e){this.nXhr.status=e.status,this.nXhr.statusText=e.statusText,this.nXhr.response=e.response,this.nXhr.responseType=e.responseType,this.nXhr.responseURL=e.responseURL,this.nXhr.responseXML=e.responseXML,this.nXhr.responseText=e.responseText,this.responseHeaderText=e.getAllResponseHeaders(),this.nXhr.getResponseHeader=function(t){return e.getResponseHeader(t)}},e.prototype.sendViaXhr=function(e){var t=this,n=this;for(var i in this.xhr.onreadystatechange=this.nXhr.onreadystatechange,this.xhr.onload=function(){n.copyXMLHttpResponse(n.xhr),n.nXhr.onload&&n.nXhr.onload.apply(n.nXhr,arguments)},this.xhr.onerror=this.nXhr.onerror,this.async||(this.xhr.ontimeout=this.nXhr.ontimeout,this.xhr.timeout=this.nXhr.timeout),this.xhr.withCredentials=this.nXhr.withCredentials,this.listeners)this.xhr.addEventListener(i,(function(e){t.copyXMLHttpResponse(t.xhr),t.triggerListeners(e.type)}));this.xhr.send(e)},e.prototype.close=function(){for(var e in this.listeners)this.listeners[e].length=0},e}(),G=function(){function e(){this.onreadystatechange=null,this.readyState=0,this.response=null,this.responseType=null,this.responseText=null,this.responseURL=null,this.responseXML=null,this.status=0,this.statusText="",this.ontimeout=null,this.onload=null,this.onerror=null,this.timeout=0,this.withCredentials=!1,this.progress={lengthComputable:!1,loaded:0,total:0,close:function(e){void 0===e&&(e=!1)}},this.upload={addEventListener:this.addEventListener.bind(this)},this._internal=new B(this)}return e.prototype.abort=function(){this.status=-1,this._internal.triggerListeners("error"),this.onerror&&this.onerror(),this._internal.xhr.abort(),this.close()},e.prototype.getResponseHeader=function(e){return this.response.headers[e]},e.prototype.getAllResponseHeaders=function(){return this._internal.responseHeaderText},e.prototype.setRequestHeader=function(e,t){this._internal.requestHeaders[e]=t,this._internal.xhr.setRequestHeader(e,t)},e.prototype.overrideMimeType=function(e){this._internal.xhr.overrideMimeType(e)},e.prototype.open=function(e,t,n,i,o){void 0===n&&(n=!0),this._internal.method=e,this._internal.url=t,this._internal.async=n,this._internal.xhr.open(e,t,n,i,o)},e.prototype.send=function(e,t){void 0===t&&(t=!1),t||this._internal.url.startsWith("http://localhost")||!this._internal.url.startsWith("http")?this._internal.sendViaXhr(e):"blob"===this.responseType?this.sendBlobViaNativePlugin(e):this.sendViaNativePlugin(e)},e.prototype.addEventListener=function(e,t){this._internal.listeners[e]=this._internal.listeners[e]||[],this._internal.listeners[e].push(t)},e.prototype.removeEventListener=function(e,t){if(this._internal.listeners[e]){var n=this._internal.listeners[e].indexOf(t);this._internal.listeners[e].splice(n,1)}},e.prototype.prepareOptions=function(e){var t={headers:{},data:e=e||{},method:this._internal.method,serializer:"raw"};for(var n in null!=e&&null!=e&&(e.constructor&&e.constructor.toString().indexOf("FormData()")>=0?(t.serializer="multipart",this.startProgress()):t.serializer="string"==typeof e?"utf8":"urlencoded"),this._internal.requestHeaders)t.headers[n]=this._internal.requestHeaders[n];return t},e.prototype.startProgress=function(e){var t=this,n=8388608;e=e||n;var i=200*Math.ceil(e/n),o=Math.ceil(e/n)*(n/10);this.progress={lengthComputable:!0,loaded:0,total:e,close:null};var r=function(){t._internal.triggerListeners("progress",[{lengthComputable:!0,total:t.progress.total,loaded:t.progress.loaded}])},a=setInterval((function(){t.progress.loaded+o<e&&(t.progress.loaded+=o),r()}),i);this.progress.close=function(e){void 0===e&&(e=!1),e&&(t.progress.loaded=t.progress.total),r(),clearInterval(a)}},e.prototype.sendBlobViaNativePlugin=function(e){var t=this,i=this.prepareOptions(e),o=(n.isIos()?j.file.tempDirectory:j.file.cacheDirectory)+Date.now(),r=setTimeout((function(){t.timeout>0&&(console.error("network call with request %O failed with timeout",t),t._internal.triggerListeners("load"),t._internal.triggerListeners("error"),t.onerror&&t.onerror(),t.ontimeout&&t.ontimeout(),t.close())}),this.timeout>0?this.timeout:1),a=function(e){console.error("network call with request %O failed with response : %O",t,e),t._internal.triggerListeners("load",[e]),t._internal.triggerListeners("error",[e]),t.onerror&&t.onerror(),clearTimeout(r)};j.plugin.http.downloadFile(new URL(this._internal.url).href,{},i.headers,o,(function(e,n){e.file((function(e){return function(e,n){var i={headers:n&&n.headers||{},status:200,data:e},o=n&&n.headers&&n.headers["content-type"];o&&(i.data.type=o.split(";")[0]),console.log("network call with request %O successed with response : %O",t,i),t._internal.copyNativeResponse(i),t._internal.triggerListeners("load"),t.onload&&t.onload(),clearTimeout(r)}(e,n)}),a)}),a)},e.prototype.sendViaNativePlugin=function(e){var t=this,n=this.prepareOptions(e),i=setTimeout((function(){t.timeout>0&&(console.error("network call with request %O failed with timeout",t),t._internal.triggerListeners("load"),t._internal.triggerListeners("error"),t.ontimeout&&t.ontimeout(),t.close())}),this.timeout>0?this.timeout:1);new Promise((function(e,i){j.plugin.http.sendRequest(new URL(t._internal.url).href,n,e,i)})).then((function(e){console.log("network call with request %O successed with response : %O",t,e),t.progress.close(!0),t._internal.copyNativeResponse(e),t._internal.triggerListeners("load"),t.onload&&t.onload()}),(function(e){t.progress.close(),t._internal.copyNativeResponse(e),console.error("network call with request %O failed with response : %O",t,e),t._internal.triggerListeners("load",[e]),t._internal.triggerListeners("error",[e]),t.onerror&&t.onerror()})).finally((function(){return clearTimeout(i)}))},e.prototype.close=function(){this.ontimeout=null,this.onload=null,this.onerror=null,this.onreadystatechange=null,this._internal.close()},e}(),V="WM.NetworkService._autoConnect",$="WM.NetworkService.isConnected",U=[new RegExp("/wmProperties.js")],W={isConnecting:!1,isConnected:!0,isNetworkAvailable:!0,isServiceAvailable:!0,noServiceRequired:!1},q=null,z=function(e){var t=!W.isConnected&&_.startsWith(e,"http");return t&&(t=!_.find(U,(function(t){return t.test(e)}))),t},H=z,Y=function(e){var t=e?G:XMLHttpRequest,n=t.prototype.open;return t.prototype.open=function(e,t,i,o,r){if(void 0===i&&(i=!0),!W.noServiceRequired&&z(t)){var a=t.split("://"),s=a[1].indexOf("/");a[1]="localhost"+(s>0?a[1].substr(s):"/"),t=a.join("://")}return n.apply(this,[e,t,i,o,r])},t},K=Y,Q=function(){function e(e,t,n,i){var o=this;this.httpClient=e,this.app=t,this.network=n,this.deviceService=i,this._autoConnect="false"!==localStorage.getItem(V),this._isCheckingServer=!1,this.disableAutoConnect=function(){return o.setAutoConnect(!1)},this.isConnected=function(){return _.get(navigator,"connection")&&navigator.connection.type&&(W.isConnected=W.isConnected&&"none"!==navigator.connection.type),o.checkForNetworkStateChange(),W.isConnected},this.isConnecting=function(){return W.isConnecting},W.isConnected="true"===localStorage.getItem($),q=q||K(i.useNativeXHR())}return e.prototype.connect=function(){return this.setAutoConnect(!0),this.tryToConnect()},e.prototype.disconnect=function(){var e=this.tryToDisconnect();return this.disableAutoConnect(),e},e.prototype.isAvailable=function(e){var t=this;return void 0===e&&(e=!1),e?this.isServiceAvailable().then((function(){return t.checkForNetworkStateChange(),W.isServiceAvailable})):W.isServiceAvailable},e.prototype.onConnect=function(){var e,t,i=this;return this.isConnected()?Promise.resolve():(e=n.getAbortableDefer(),t=this.app.subscribe("onNetworkStateChange",(function(){i.isConnected()&&(e.resolve(!0),t())})),e.promise.catch((function(){t()})),e.promise)},e.prototype.retryIfNetworkFails=function(e){var t=this,i=n.getAbortableDefer();return n.retryIfFails(e,0,0,(function(){var e;return!t.isConnected()&&(e=t.onConnect(),i.promise.catch((function(){e.abort()})),e)})).then(i.resolve,i.reject),i.promise},e.prototype.start=function(){var e=this;return window.cordova&&window.Connection&&navigator.connection&&(W.isNetworkAvailable="none"!==navigator.connection.type,W.isConnected=W.isNetworkAvailable&&W.isConnected,this.network.onConnect().subscribe((function(){W.isNetworkAvailable=!0,e.tryToConnect().catch(n.noop)})),this.network.onDisconnect().subscribe((function(){W.isNetworkAvailable=!1,W.isServiceAvailable=!1,e.tryToDisconnect()})),this.app.subscribe("onNetworkStateChange",(function(t){!t.isNetworkAvailable||t.isServiceAvailable||e._isCheckingServer||t.noServiceRequired||(e._isCheckingServer=!0,e.checkForServiceAvailiblity().then((function(){e._isCheckingServer=!1,e.connect()}),(function(){e._isCheckingServer=!1})))}))),this.tryToConnect(!0).catch(n.noop)},e.prototype.getServiceName=function(){return e.SERVICE_NAME},e.prototype.unblock=function(e){U.push(new RegExp(e))},e.prototype.getState=function(){return _.clone(W)},e.prototype.checkForNetworkStateChange=function(){_.isEqual(this._lastKnownNetworkState,W)||(this._lastKnownNetworkState=_.clone(W),this.app.notify("onNetworkStateChange",this._lastKnownNetworkState))},e.prototype.checkForServiceAvailiblity=function(){var e=this;return new Promise((function(t){var n=setInterval((function(){W.isNetworkAvailable&&e.isServiceAvailable(4500).then((function(e){e&&(clearInterval(n),t())}))}),5e3)}))},e.prototype.isServiceAvailable=function(e){return"NONE"===this.app.deployedUrl?(W.isServiceAvailable=!1,W.noServiceRequired=!0,Promise.resolve(!1)):this.pingServer(e).then((function(e){return W.isServiceAvailable=e,W.isServiceAvailable||(W.isConnecting=!1,W.isConnected=!1),e}))},e.prototype.pingServer=function(e){var t=this;return void 0===e&&(e=6e4),new Promise((function(n){var i=new q,o=t.app.deployedUrl;o&&!_.endsWith(o,"/")?o+="/":o=o||"";var r=setTimeout((function(){i.abort(),n(!1)}),e);i.addEventListener("load",(function(){200===i.status?n(!0):n(!1),r&&clearTimeout(r)})),i.addEventListener("error",(function(){return n(!1)})),i.open("GET",o+"services/application/wmProperties.js?t="+Date.now()),i.send()}))},e.prototype.setAutoConnect=function(e){this._autoConnect=e,localStorage.setItem(V,""+e)},e.prototype.tryToConnect=function(e){var t=this;return void 0===e&&(e=!1),new Promise((function(n,i){t.isServiceAvailable(5e3).then((function(){W.isServiceAvailable&&t._autoConnect?(W.isConnecting=!0,e||t.checkForNetworkStateChange(),setTimeout((function(){W.isConnecting=!1,W.isConnected=!0,localStorage.setItem($,""+!0),e||t.checkForNetworkStateChange(),n(!0)}),e?0:5e3)):(W.isConnecting=!1,W.isConnected=!1,localStorage.setItem($,""+!1),i(),t.checkForNetworkStateChange())}))}))},e.prototype.tryToDisconnect=function(){return W.isConnected=!1,W.isConnecting=!1,this.checkForNetworkStateChange(),localStorage.setItem($,""+W.isConnected),Promise.resolve(W.isConnected)},e}();Q.SERVICE_NAME="NetworkService",Q.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new Q(g.\u0275\u0275inject(w.HttpClient),g.\u0275\u0275inject(v.App),g.\u0275\u0275inject(S.Network),g.\u0275\u0275inject(L))},token:Q,providedIn:"root"}),Q.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Q.ctorParameters=function(){return[{type:s.HttpClient},{type:n.App},{type:d.Network},{type:L}]};var X=function(){function e(t,i,o,r,a){var s=this;e.addStartupServices(t,i,o,r,a);var l=t.getConfig().enableSSLPinning;n.hasCordova()&&document.addEventListener("wmDeviceReady",(function(){t.useNativeXHR()&&(window.XMLHttpRequest=G,l&&cordova.plugin.http.setServerTrustMode("pinned",(function(){console.log("SSL Pinning enabled.!")}),(function(e){console.log("Failed to enable SSL Pinning. Due to: "+e)})),s.overrideResolveLocalFileSystemURL())}),!1)}return e.addStartupServices=function(e,t,i,o,r){this.initialized||(e.addStartUpService(r),n.hasCordova()&&(e.addStartUpService(t),e.addStartUpService(i),e.addStartUpService(o)),this.initialized=!0)},e.prototype.overrideResolveLocalFileSystemURL=function(){var e=window.resolveLocalFileSystemURL;window.resolveLocalFileSystemURL=function(t,n,i){if(t&&t.startsWith("http://localhost")){var o="/local-filesystem";(t=new URL(t).pathname).startsWith(o)&&(t="file://"+t.substring(o.length))}e.call(window,t,n,i)}},e}();X.initialized=!1,X.decorators=[{type:t.NgModule,args:[{declarations:[],imports:[],providers:[],bootstrap:[]}]}],X.ctorParameters=function(){return[{type:L},{type:C},{type:x},{type:k},{type:Q}]};var J=function(){function e(e,t){this.url=e,this.cordovaFile=t,this._files=[],this._params=[],this._headers=[]}return e.prototype.addFile=function(e,t,n){return this._files.push({name:e,path:t,fileName:n}),this},e.prototype.addHeader=function(e,t){return this._headers.push({name:e,value:t}),this},e.prototype.addParam=function(e,t){return this._params.push({name:e,value:t}),this},e.prototype.post=function(){var e=this,t=new FormData;return this._params.forEach((function(e){return t.append(e.name,e.value)})),Promise.all(this._files.map((function(e){return e.path?n.convertToBlob(e.path).then((function(t){return{name:e.name,fileName:e.fileName,blob:t.blob}})):e}))).then((function(n){return n.forEach((function(e){return t.append(e.name,e.blob||e.path,e.fileName)})),new Promise((function(n,i){var o=new XMLHttpRequest;o.open("POST",e.url),e._headers.forEach((function(e){return o.setRequestHeader(e.name,e.value)})),o.onload=function(){n({headers:function(e){return o.getResponseHeader(e)},response:o.response,text:o.responseText})},o.onerror=i,o.onabort=i,o.send(t)}))}))},e}(),Z=function(){function e(e){this.cordovaFile=e}return e.prototype.upload=function(e,t,n,i,o,r){var a=new J(e,this.cordovaFile).addFile(t,n,i);return _.forEach(o,(function(e,t){return a.addParam(e,t)})),_.forEach(r,(function(e,t){return a.addHeader(e,t)})),a.post()},e}();Z.SERVICE_NAME="DeviceFileUploadService",Z.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new Z(g.\u0275\u0275inject(b.File))},token:Z,providedIn:"root"}),Z.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Z.ctorParameters=function(){return[{type:i.File}]};var ee=function(){function e(e){var t=this;this.app=e,this.handlers=[],document.addEventListener("externalAppMessageReceived",(function(e){var n=e.detail.message;t.handlers.forEach((function(e){var t=e&&n.address.match(e.pattern);t&&t.length>0&&e.callBack(n)}))}))}return e.prototype.subscribe=function(e,t){var n=this,i={pattern:new RegExp(e),callBack:t};return this.handlers.push(i),function(){return _.remove(n.handlers,i)}},e}();ee.SERVICE_NAME="ExtAppMessageService",ee.\u0275prov=g.\u0275\u0275defineInjectable({factory:function(){return new ee(g.\u0275\u0275inject(v.App))},token:ee,providedIn:"root"}),ee.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ee.ctorParameters=function(){return[{type:n.App}]},function(e,t){function i(e,t,n){return n=n<0?void 0:n,e&&t>=0&&e.length>t&&e.substring(t,n)||void 0}function o(e,t){return e&&e.indexOf(t)}function r(e){if(!e)return!1;var t=e.match(/\{([^)]+)\}/);if(t){var i=n.getValidJSON("{"+t[1]+"}");if(i&&i.flow)return i.flow}return!1}function a(e){var t=i(e,o(e,"?")+1,o(e,"#")),n={},a=r(e);return"implicit"===a?t=e.match(/access_token=([^&#]*)/)[0]:"pkce"===a&&(t=e.match(/code=([^&#]*)/)[0]),_.forEach(_.split(t,"&"),(function(e){var t=e.split("=");n[t[0]]=t[1]})),n}function s(e){var t="implicit"===r(e)?"#":"?";return i(e,o(e,"://")+3,o(e,t))}e.handleOpenURL=function(n){var i=e.handleOpenURL;if(i.isReady&&!_.startsWith(n,"http")){var o=function(e){return{address:s(e),data:a(e)}}(n),r=new e.CustomEvent("externalAppMessageReceived",{detail:{message:o}});t.dispatchEvent(r)}i.lastURL=n}}(window,document),e.DeviceFileCacheService=x,e.DeviceFileDownloadService=D,e.DeviceFileOpenerService=k,e.DeviceFileService=C,e.DeviceFileUploadService=Z,e.DeviceService=L,e.ExtAppMessageService=ee,e.MobileCoreModule=X,e.NetworkService=Q,e.UploadRequest=J,e["\u02750"]=H,e["\u02751"]=Y,Object.defineProperty(e,"__esModule",{value:!0})})),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@wm/components/base"),require("@angular/common/http"),require("@awesome-cordova-plugins/file/ngx"),require("@awesome-cordova-plugins/file-opener/ngx"),require("@wm/core"),require("@wm/mobile/core"),require("@angular/common"),require("@wm/components/basic/progress")):"function"==typeof define&&define.amd?define("@wm/mobile/components/basic",["exports","@angular/core","@wm/components/base","@angular/common/http","@awesome-cordova-plugins/file/ngx","@awesome-cordova-plugins/file-opener/ngx","@wm/core","@wm/mobile/core","@angular/common","@wm/components/basic/progress"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).wm=e.wm||{},e.wm.mobile=e.wm.mobile||{},e.wm.mobile.components=e.wm.mobile.components||{},e.wm.mobile.components.basic={}),e.ng.core,e.wm.components.base,e.ng.common.http,e.awesomeCordova.plugins,e.awesomeCordova.plugins,e.wm.core,e.wm.mobile.core,e.ng.common,e.wm.components.basic.progress)}(this,(function(e,t,n,i,o,r,a,s,l,c){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=p(t),d=p(a),h=function(){function e(e){this.widget=e}return e.prototype.onClick=function(){var e=this.widget.hyperlink;if(e){if(e.indexOf(":")>=0&&!_.startsWith(e,"http://")&&!_.startsWith(e,"https://"))return;if(_.startsWith(e,"#"))return void(window.location.href=window.location.origin+window.location.pathname+e);_.startsWith(e,"//")&&(e="https:"+e),window.cordova&&window.open(e,this.widget.target)}},e}();h.decorators=[{type:t.Directive,args:[{selector:"[wmAnchor]"}]}],h.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[n.WidgetRef]}]}]},h.propDecorators={onClick:[{type:t.HostListener,args:["click"]}]};var m="app-auto-update.apk",f=function(){function e(e,t,n,i,o,r){var s=this;this.deviceService=e,this.fileDownloadService=t,this.elRef=n,this.file=i,this.fileOpener=o,this.http=r,this.downloadProgress=0,this.downloading=!1,this.message="There is an update available. Would you like to update the app?",a.addClass(this.elRef.nativeElement,"app-update-dialog modal fade in hidden"),a.setCSS(this.elRef.nativeElement,"display","block"),a.hasCordova()&&this.getBuildMeta().then((function(e){e&&"DEVELOPMENT_MODE"===e.buildMode&&(s.file.removeFile(cordova.file.externalApplicationStorageDirectory,m).catch(a.noop),s.checkForUpdate().then(s.getUserConfirmation.bind(s),a.noop))}))}return e.prototype.cancel=function(){a.addClass(this.elRef.nativeElement,"hidden")},e.prototype.installLatestVersion=function(){var e=this,t=cordova.file.externalApplicationStorageDirectory+m,n=this._buildMeta.host+"/appBuild/rest/mobileBuilds/android/download?token="+this._buildMeta.token+"&buildNumber="+this._buildMeta.latestBuildNumber+"&fileName="+"app-auto-update.apk&releaseVersion="+this._buildMeta.platformVersion,i={next:function(t){e.downloadProgress=t.loaded/t.total*100},error:null,complete:null};this.fileDownloadService.download(n,!1,cordova.file.externalApplicationStorageDirectory,m,i).then((function(){e.fileOpener.open(t,"application/vnd.android.package-archive")}),(function(){this.message="Failed to download latest version."})),this.message="Downloading the latest version ["+this._buildMeta.latestVersion+"].",this.downloading=!0},e.prototype.checkForUpdate=function(){var e=this;return new Promise((function(t,n){e.http.get(e._buildMeta.host+"/appBuild/rest/mobileBuilds/latest_build?token="+e._buildMeta.token+"&releaseVersion="+e._buildMeta.platformVersion).toPromise().then((function(i){var o=i.success.body.buildNumber,r=i.success.body.version;e._buildMeta.buildNumber<o?(e._buildMeta.latestBuildNumber=o,e._buildMeta.latestVersion=r,t(o)):n()}),n)}))},e.prototype.getBuildMeta=function(){var e=this;return this._buildMeta?Promise.resolve(this._buildMeta):this.file.readAsText(cordova.file.applicationDirectory+"www/","build_meta.json").then((function(t){return e._buildMeta=JSON.parse(t),e._buildMeta}),a.noop)},e.prototype.getUserConfirmation=function(){this.downloadProgress=0,this.downloading=!1,this.message="There is an update available. Would you like to update the app?",a.removeClass(this.elRef.nativeElement,"hidden")},e}();f.decorators=[{type:t.Component,args:[{selector:"[wmAppUpdate]",template:'<div class="modal-dialog">\n <div class="modal-content"> \n <div class="modal-body"> \n <span [textContent]="message"></span>\n <div class="progress" [hidden]="!downloading">\n <div class="progress-bar" [style.width.%]="downloadProgress"></div>\n </div>\n </div>\n <div class="modal-footer"> \n <button type="button" class="btn btn-default" data-dismiss="modal" (click)="cancel()">Skip update</button>\n <button type="button" class="btn btn-primary" [hidden]="downloading" (click)="installLatestVersion()">Update</button>\n </div>\n </div>\n</div>'}]}],f.ctorParameters=function(){return[{type:s.DeviceService},{type:s.DeviceFileDownloadService},{type:t.ElementRef},{type:o.File},{type:r.FileOpener},{type:i.HttpClient}]};var g=function(){function e(e){this.deviceService=e,this.selectedFiles=[],this.submitEmitter=new t.EventEmitter}return e.prototype.getFileExtension=function(e){var t=e?e.lastIndexOf("."):-1;return t>0?e.substring(t+1):""},e.prototype.ngOnDestroy=function(){this.backButtonListenerDeregister&&this.backButtonListenerDeregister()},e.prototype.onFileClick=function(e){e.isFile?e.isSelected?this.deselectFile(e):this.selectFile(e):this.goToFolder(e)},Object.defineProperty(e.prototype,"show",{set:function(e){var t=this,n=cordova.file.externalRootDirectory;this.isVisible=e,e?(this.currentFolder||(a.isIos()&&(n=cordova.file.documentsDirectory),resolveLocalFileSystemURL(n,(function(e){return t.goToFolder(e)}))),this.backButtonListenerDeregister=this.deviceService.onBackButtonTap((function(){if(t.isVisible)return t.currentFolder.parent?t.onFileClick(t.currentFolder.parent):t.isVisible=!1,a.$appDigest(),!1}))):this.backButtonListenerDeregister&&this.backButtonListenerDeregister()},enumerable:!1,configurable:!0}),e.prototype.submit=function(){var e=this,t=[];this.loadFileSize(this.selectedFiles).then((function(){_.forEach(e.selectedFiles,(function(e){e.isSelected=!1,t.push({path:e.nativeURL,name:e.name,size:e.size})})),e.selectedFiles=[],e.isVisible=!1,e.submitEmitter.next({files:t})}))},e.prototype.deselectFile=function(e){_.remove(this.selectedFiles,e),e.isSelected=!1},e.prototype.goToFolder=function(e){var t=this;e.files?this.currentFolder=e:this.loadFolder(e,this.fileTypeToSelect).then((function(n){e.files=n,e.parent=t.currentFolder,t.currentFolder=e}))},e.prototype.loadFileSize=function(e){return Promise.all(e.map((function(e){return new Promise((function(t,n){e.file((function(n){e.size=n.size,t()}),n)}))})))},e.prototype.loadFolder=function(e,t){return new Promise((function(n,i){var o;e.createReader().readEntries((function(e){_.isEmpty(t)||(o=_.split(t,","),e=_.filter(e,(function(e){return!e.isFile||_.findIndex(o,(function(t){return _.endsWith(e.name,"."+t)}))>=0}))),n(_.sortBy(e,(function(e){return(e.isFile?"1_":"0_")+e.name.toLowerCase()})))}),i)}))},e.prototype.refreshFolder=function(){var e=this;return this.loadFolder(this.currentFolder,this.fileTypeToSelect).then((function(t){return e.currentFolder.files=t}))},e.prototype.selectFile=function(e){!this.multiple&&this.selectedFiles.length>0&&(this.selectedFiles[0].isSelected=!1,this.selectedFiles=[]),this.selectedFiles.push(e),e.isSelected=!0},e}();g.decorators=[{type:t.Component,args:[{selector:"[wmMobileFileBrowser]",template:'<div class="app-file-browser" *ngIf="isVisible && currentFolder">\n <div class="modal-backdrop fade" [class.in]="isVisible"></div>\n <div class="modal fade" style="display: block;" [class.in]="isVisible" >\n <div class="modal-dialog">\n <div class="modal-content">\n <div class="modal-header clearfix">\n <h4 class="modal-title pull-left">\n <span (click)="onFileClick(currentFolder.parent)" [hidden]="!!!currentFolder.parent">\n <i class="wi wi-long-arrow-left"></i>\n </span>\n {{currentFolder.name}}\n </h4>\n <div class="selected-file-button pull-right" (click)="refreshFolder()">\n <i class="wi wi-refresh"></i>\n </div>\n </div>\n <div class="modal-body">\n <div class="file-info-box" *ngFor="let file of currentFolder.files">\n <div class="file-info" [class.bg-primary]="file.isSelected" (click)="onFileClick(file)">\n <i class="file-icon wi wi-folder" *ngIf="!file.isFile"></i>\n <i class="file-icon wi wi-file {{getFileExtension(file.name)}}" *ngIf="file.isFile"></i>\n <span class="file-name">{{file.name}}</span>\n </div>\n </div>\n </div>\n <div class="modal-footer">\n <button type="button" class="btn btn-primary" *ngIf="selectedFiles && selectedFiles.length > 0" (click)="submit()">\n Done <span class="badge badge-light">{{selectedFiles.length}}</span>\n </button>\n <button type="button" class="btn btn-default" (click)="show = false;">Close</button>\n </div>\n </div>\n </div>\n </div>\n</div>'}]}],g.ctorParameters=function(){return[{type:s.DeviceService}]},g.propDecorators={fileTypeToSelect:[{type:t.Input}],multiple:[{type:t.Input}],submitEmitter:[{type:t.Output,args:["submit"]}]};var v=function(){function e(e){this.spinnerService=e}return e.prototype.selectAudio=function(e){var t=this;void 0===e&&(e=!1);var n=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectAudio(e,t,n)})).then((function(e){return t.getFiles(e)})).then((function(e){return t.spinnerService.hide(n),e}))},e.prototype.setFileBrowser=function(e){this.fileBrowserComponent=e},e.prototype.selectFiles=function(e,t){var n=this;void 0===e&&(e=!1);var i=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectFiles(e,t,n)})).then((function(e){return n.getFiles(e)})).then((function(e){return n.spinnerService.hide(i),e}))},e.prototype.selectImages=function(e){var t=this;void 0===e&&(e=!1);var n=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectImage(e,t,n)})).then((function(e){return t.getFiles(e)})).then((function(e){return t.spinnerService.hide(n),e}))},e.prototype.selectVideos=function(e){var t=this;void 0===e&&(e=!1);var n=this.spinnerService.show("");return new Promise((function(t,n){cordova.wavemaker.filePicker.selectVideo(e,t,n)})).then((function(e){return t.getFiles(e)})).then((function(e){return t.spinnerService.hide(n),e}))},e.prototype.getFiles=function(e){return Promise.all(_.map(e,(function(e){return e.indexOf("://")<0&&(e="file://"+e),a.convertToBlob(e)}))).then((function(e){return _.map(e,(function(e){var t=e.filepath;return{name:t.split("/").pop(),path:t,content:e.blob,size:e.blob.size}}))}))},e}();v.SERVICE_NAME="FileSelectorService",v.\u0275prov=u.\u0275\u0275defineInjectable({factory:function(){return new v(u.\u0275\u0275inject(d.AbstractSpinnerService))},token:v,providedIn:"root"}),v.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],v.ctorParameters=function(){return[{type:a.AbstractSpinnerService}]};var y=function(){function e(e,t,n){this.componentInstance=e,this.deviceFileCacheService=t,this.file=n,this._isEnabled=!1,this._lastUrl=""}return e.prototype.ngDoCheck=function(){var e=this;this.componentInstance.imgSource&&this.componentInstance.imgSource.startsWith("http")&&(this._lastUrl!==this.componentInstance.imgSource?(this._lastUrl=this.componentInstance.imgSource,this.componentInstance.imgSource="resources/images/imagelists/default-image.png",this.getLocalPath(this._lastUrl).then((function(t){e._cacheUrl=a.transformFileURI(t),e.componentInstance.imgSource=e._cacheUrl}))):this._cacheUrl&&(this.componentInstance.imgSource=this._cacheUrl))},Object.defineProperty(e.prototype,"wmImageCache",{set:function(e){this._isEnabled=a.hasCordova()&&"true"===e},enumerable:!1,configurable:!0}),e.prototype.getLocalPath=function(e){return a.hasCordova()&&e&&e.indexOf("{{")<0&&e.startsWith("http")?this.deviceFileCacheService.getLocalPath(e,!0,!0,!this._isEnabled).catch(a.noop):Promise.resolve(e)},e}();y.decorators=[{type:t.Directive,args:[{selector:"[wmImageCache]"}]}],y.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Self},{type:t.Inject,args:[n.WidgetRef]}]},{type:s.DeviceFileCacheService},{type:o.File}]},y.propDecorators={wmImageCache:[{type:t.Input}]};
|
|
731
731
|
/*! *****************************************************************************
|
|
732
732
|
Copyright (c) Microsoft Corporation.
|
|
733
733
|
|