{"version":3,"sources":["../LuV.LUMAS.Services/scripts/main.ts"],"names":["initContext","spPageContextInfo","lumasContext","cdnBaseUrl","svcBaseUrl","webAbsoluteUrl","rev","environment","token","onLogin","onLogout","login","this","i","length","ex","console","log","logout","siteAbsoluteUrl","Date","getTime","toString","scripts","document","getElementsByTagName","appScript","src","appBundleIndex","toLowerCase","indexOf","substr","window","$lumasContext","requirejs","config","skipDataMain","baseUrl","paths","start","jquery","lodash","angular","angular-sanitize","angular-cache","ngRoute","angular-filter","ui-select","angularjs-slider","urlArgs","shim","deps","exports","require","EnsureScriptFunc","_spBodyOnLoadFunctions","push","_spPageContextInfo"],"mappings":"CAAA,WACC,aAEqB,SAAdA,EAAwBC;;AAExB,IAAMC,EAA8B,CAChCC,WAAY,IACZC,WAAY,iBACZC,eAAgB,IAChBC,IAAK,GACLC,YAAa,SACbC,MAAO,GACPC,QAAS,GACTC,SAAU,GACVC,MAAO,SAAUH,GAEb,GADAI,KAAKJ,MAAQA,EACTI,KAAKH,QACL,IAAK,IAAII,EAAI,EAAGA,EAAID,KAAKH,QAAQK,OAAQD,IACrC,IACID,KAAKH,QAAQI,KACf,MAAOE,GACLC,QAAQC,IAAI,SAAUF,KAKtCG,OAAQ,WAEJ,GADAN,KAAKJ,MAAQ,GACTI,KAAKF,SACL,IAAK,IAAIG,EAAI,EAAGA,EAAID,KAAKF,SAASI,OAAQD,IACtC,IACID,KAAKF,SAASG,KAChB,MAAOE,GACLC,QAAQC,IAAI,SAAUF,MAO1Cd;;AAEFC,EAAaE,WAAgBH,EAAkBkB,gBAAe,8BACjEjB,EAAaG,eAAiBJ,EAAkBI,eAC7CH,EAAaK,YAAc,UAK3BL,EAAaI,KAAM,IAAIc,MAAOC,UAAUC,WAE1C;;AAGE,IAFA,IAAIC,EAAUC,SAASC,qBAAqB,UAEnCZ,EAAIU,EAAQT,OAAS,EAAQ,GAALD,EAAQA,IAAK,CAC5C,IAAIa,EAAYH,EAAQV,GACxB,GAAIa,EAAUC,IAAK,CACjB,IAAIC,EAAiBF,EAAUC,IAAIE,cAAcC,QAAQ,mBACzD,IAAsB,EAAlBF,EAAqB,CACvB1B,EAAaC,WAAauB,EAAUC,IAAII,OAAO,EAAGH,EAAiB,GACnE,SAIN,MAAOb,IACTiB,OAAOC,cAAgB/B,EAEnBgC,UAAUC,OAAO,CACbC,cAAc,EACdC,QAAYL,OAAOC,cAAc9B,WAAU,WAC3CmC,MAAO,CACHC,MAAO;;AAEPC,OAAQ,iBACRC,OAAQ,iBACRC,QAAS,kBACTC,mBAAoB,2BACpBC,gBAAiB,wBACjBC,QAAS,gCACTC,iBAAkB,iCAClBC,YAAa,yBACbC,mBAAoB,4BAExBC,QAAS,OAAOjB,OAAOC,cAAc3B,IACrC4C,KAAM,CACFR,QAAS,CACLS,KAAM,CAAC,UACPC,QAAS,WAEbT,mBAAoB,CAChBQ,KAAM,CAAC,YAEXZ,MAAO,CACHY,KAAM,CAAC,UAAW,YAAa,mBAAoB,qBAEvDN,QAAS,CACLM,KAAM,CAAC,YAEXL,iBAAkB,CACdK,KAAM,CAAC,YAEXJ,YAAa,CACTI,KAAM,CAAC,YAEXH,mBAAoB,CAChBG,KAAM,CAAC,eAKnBE,QAAQ,CAAC,SAAU,cAGQ,oBAApBC,iBACPC,uBAAuBC,KAAK,WACxB,IAAMvD,EAAqB+B,OAAeyB,mBAC1CzD,EAAYC,KAGhBD,IAvHR,CAyHGgC","file":"main.js","sourcesContent":["(function (wnd) {\r\n\t'use strict';\r\n\r\n let initContext = function (spPageContextInfo?) {\r\n //Online\r\n const lumasContext: ILumasContext = {\r\n cdnBaseUrl: '/',\r\n svcBaseUrl: '/api/v1/lumas/',\r\n webAbsoluteUrl: '/',\r\n rev: '',\r\n environment: 'online',\r\n token: '',\r\n onLogin: [],\r\n onLogout: [],\r\n login: function (token) {\r\n this.token = token;\r\n if (this.onLogin) {\r\n for (var i = 0; i < this.onLogin.length; i++) {\r\n try {\r\n this.onLogin[i]();\r\n } catch (ex) {\r\n console.log(`Error!`, ex);\r\n }\r\n }\r\n }\r\n },\r\n logout: function () {\r\n this.token = '';\r\n if (this.onLogout) {\r\n for (var i = 0; i < this.onLogout.length; i++) {\r\n try {\r\n this.onLogout[i]();\r\n } catch (ex) {\r\n console.log(`Error!`, ex);\r\n }\r\n }\r\n }\r\n },\r\n };\r\n\r\n if (spPageContextInfo) {\r\n //SP\r\n lumasContext.svcBaseUrl = `${spPageContextInfo.siteAbsoluteUrl}/_vti_bin/lumasservice.svc/`;\r\n\t lumasContext.webAbsoluteUrl = spPageContextInfo.webAbsoluteUrl;\r\n lumasContext.environment = 'onPrem';\r\n }\r\n if (RELEASE) {\r\n lumasContext.rev = Math.floor(new Date().getTime() / 630000000).toString();\r\n } else {\r\n lumasContext.rev = new Date().getTime().toString();\r\n }\r\n try {\r\n var scripts = document.getElementsByTagName('script');\r\n //some browser plugins render script tags to the html, so it cannot be for sure that the last script is the app.bundle.js\r\n for (var i = scripts.length - 1; i >= 0; i--) {\r\n var appScript = scripts[i];\r\n if (appScript.src) {\r\n var appBundleIndex = appScript.src.toLowerCase().indexOf('/_lumas/scripts');\r\n if (appBundleIndex > -1) {\r\n lumasContext.cdnBaseUrl = appScript.src.substr(0, appBundleIndex + 8);\r\n break;\r\n }\r\n }\r\n }\r\n } catch (ex) {}\r\n window.$lumasContext = lumasContext;\r\n\r\n requirejs.config({\r\n skipDataMain: true,\r\n baseUrl: `${window.$lumasContext.cdnBaseUrl}scripts/`,\r\n paths: {\r\n start: `start`,\r\n // 3rd party libs\r\n jquery: `lib/jquery.min`,\r\n lodash: `lib/lodash.min`,\r\n angular: `lib/angular.min`,\r\n 'angular-sanitize': `lib/angular-sanitize.min`,\r\n 'angular-cache': `lib/angular-cache.min`,\r\n ngRoute: `lib/modules/angular-route.min`,\r\n 'angular-filter': `lib/modules/angular-filter.min`,\r\n 'ui-select': `lib/modules/select.min`,\r\n 'angularjs-slider': `lib/modules/rzslider.min`,\r\n },\r\n urlArgs: `rev=${window.$lumasContext.rev}`,\r\n shim: {\r\n angular: {\r\n deps: ['jquery'],\r\n exports: 'angular',\r\n },\r\n 'angular-sanitize': {\r\n deps: ['angular'],\r\n },\r\n start: {\r\n deps: [`ngRoute`, 'ui-select', 'angular-sanitize', 'angularjs-slider'],\r\n },\r\n ngRoute: {\r\n deps: ['angular'],\r\n },\r\n 'angular-filter': {\r\n deps: ['angular'],\r\n },\r\n 'ui-select': {\r\n deps: ['angular'],\r\n },\r\n 'angularjs-slider': {\r\n deps: ['angular'],\r\n },\r\n },\r\n });\r\n\r\n require(['start'], () => { });\r\n };\r\n\r\n if (typeof EnsureScriptFunc != 'undefined') {\r\n _spBodyOnLoadFunctions.push(function () {\r\n const spPageContextInfo = (window as any)._spPageContextInfo;\r\n initContext(spPageContextInfo);\r\n });\r\n } else {\r\n initContext();\r\n }\r\n})(window);\r\n"]}