{"version":3,"sources":["main.js"],"names":["WindowSizeMiddleware","w","window","d","document","e","documentElement","g","getElementsByTagName","this","getWidth","innerWidth","clientWidth","getHeight","innerHeight","clientHeight","ObserverList","observerList","Subject","observers","context","undefined","Observer","suppliedId","updateCallBackRef","id","update","prototype","add","obj","push","count","length","get","index","indexOf","startIndex","i","removeAt","splice","addObserver","observer","removeObserver","notify","observerCount","error","console","log","passiveIfSupportedMiddleware","passive","addEventListener","Object","defineProperty","removeEventListener","err","GlobalMiddleware","self","_scriptsDirectory","_pResizeSubject","_pWindowSizeMiddleware","$WindowSizeMiddleware","_serviceCollectionSingleton","_componentSynchronizationSubject","GetDeviceDateTimeInfo","d2","Date","getFullYear","getMonth","toString","getDate","getScriptsDirectory","$sfConfigModel","EnvId","location","host","ServicesCollection","TryGetOrCreateSingleton","className","params","value","ctorDelegate","theNewInstance","key","SyncBroker","SubscribeToSyncSubject","NotifySyncSubject","SubscribeCheckIfInViewPort","elementId","callback","ubSubscribeOnHit","theElement","getElementById","callbackRef","shouldUnSubscribeOnHit","theBoundScrollAction","el","top","offsetTop","left","offsetLeft","width","offsetWidth","height","offsetHeight","offsetParent","pageYOffset","pageXOffset","elementInViewport2","bind","passiveIfSupported","getWindowHeight","getWindowWidth","PassiveSupported","SubscribeResize","clientData","windowWidth","windowHeight","boundEevent","handleOnResizeEvent","setTimeout","ref","getClientDataMiddleWare","devicePixelRatio","d1","localDateTime","timeStampEpoch","Math","ceil","now","timezoneOffset","getTimezoneOffset","event","element","srcElement","currentTarget","SourceElement","innerText","ex","getNav","navigator","nav","language","languages","hardwareConcurrency","userAgent","platform","product","vendor","appCodeName","appName","appVersion","connection","getCon","con","downlink","effectiveType","onchange","rtt","saveData","_headerBaseURL","GetBaseUrlFromDocumentMiddleware","BASE_URL","attributes","href","_webWorkerMiddleware","getWebWorkerMiddleawre","Worker","ClientToServerUpdateTask","dataModel","userWrapper","type","ClientData","PAGE_URL","Navigator","DataModel","theURL","suppliedHeaders","Content-Type","fetch","method","mode","cache","credentials","headers","redirect","referrer","body","JSON","stringify","then","response","json","postToServer","exception","$GM","$GlobalMiddleware"],"mappings":"AAOA,SAASA,uBACL,IAAIC,EAAIC,OACJC,EAAIC,SACJC,EAAIF,EAAEG,gBACNC,EAAIJ,EAAEK,qBAAqB,QAAQ,GAIvCC,KAAKC,SAAW,WAEZ,OADST,EAAEU,YAAcN,EAAEO,aAAeL,EAAEK,aAGhDH,KAAKI,UAAY,WAEb,OADSZ,EAAEa,aAAeT,EAAEU,cAAgBR,EAAEQ,cAStD,SAASC,eACLP,KAAKQ,aAAe,GA6CxB,SAASC,UACLT,KAAKU,UAAY,IAAIH,aACrBP,KAAKW,aAAUC,EAoCnB,SAASC,SAAUC,EAAYC,GAC3B,aACAf,KAAKgB,GAAKF,EACVd,KAAKiB,OAASF,EACdf,KAAKW,aAAUC,EAhFnBL,aAAaW,UAAUC,IAAM,SAAUC,GACnC,OAAOpB,KAAKQ,aAAaa,KAAKD,IAGlCb,aAAaW,UAAUI,MAAQ,WAC3B,OAAOtB,KAAKQ,aAAae,QAQ7BhB,aAAaW,UAAUM,IAAM,SAAUC,GACnC,GAAIA,GAAS,GAAKA,EAAQzB,KAAKQ,aAAae,OACxC,OAAOvB,KAAKQ,aAAaiB,IAIjClB,aAAaW,UAAUQ,QAAU,SAAUN,EAAKO,GAG5C,IAFA,IAAIC,EAAID,EAEDC,EAAI5B,KAAKQ,aAAae,QAAQ,CACjC,GAAIvB,KAAKQ,aAAaoB,KAAOR,EACzB,OAAOQ,EAEXA,IAGJ,OAAQ,GAGZrB,aAAaW,UAAUW,SAAW,SAAUJ,GACxCzB,KAAKQ,aAAasB,OAAOL,EAAO,IAUpChB,QAAQS,UAAUa,YAAc,SAAUC,GACtChC,KAAKU,UAAUS,IAAIa,QAEEpB,IAAjBZ,KAAKW,SACLqB,EAASf,OAAOjB,KAAKW,UAI7BF,QAAQS,UAAUe,eAAiB,SAAUD,GACzChC,KAAKU,UAAUmB,SAAS7B,KAAKU,U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AAW,WACPgD,4BACD","sourcesContent":["// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification\n// for details on configuring this project to bundle and minify static web assets.\n\n\n/**\n * @constructor\n */\nfunction WindowSizeMiddleware () {\n var w = window,\n d = document,\n e = d.documentElement,\n g = d.getElementsByTagName('body')[0];//,\n //x = w.innerWidth || e.clientWidth || g.clientWidth,\n //y = w.innerHeight || e.clientHeight || g.clientHeight;\n\n this.getWidth = function () {\n var w1 = w.innerWidth || e.clientWidth || g.clientWidth;\n return w1;\n };\n this.getHeight = function () {\n var h1 = w.innerHeight || e.clientHeight || g.clientHeight;\n return h1;\n };\n //console.log(x + ' × ' + y);\n}\n\n/**\n * @constructor\n */\nfunction ObserverList () {\n this.observerList = [];\n}\n/**\n * \n * @param {*} obj \n * @returns {number}\n */\nObserverList.prototype.add = function (obj) {\n return this.observerList.push(obj);\n};\n\nObserverList.prototype.count = function () {\n return this.observerList.length;\n};\n\n/**\n * \n * @param {number} index \n * @returns { * | undefined}\n */\nObserverList.prototype.get = function (index) {\n if (index > -1 && index < this.observerList.length) {\n return this.observerList[index];\n }\n};\n\nObserverList.prototype.indexOf = function (obj, startIndex) {\n var i = startIndex;\n\n while (i < this.observerList.length) {\n if (this.observerList[i] === obj) {\n return i;\n }\n i++;\n }\n\n return -1;\n};\n\nObserverList.prototype.removeAt = function (index) {\n this.observerList.splice(index, 1);\n};\n\n\n\nfunction Subject () {\n this.observers = new ObserverList();\n this.context = undefined;\n}\n\nSubject.prototype.addObserver = function (observer) {\n this.observers.add(observer);\n //update the newly subscribed observer on the current context\n if (this.context !== undefined) {\n observer.update(this.context);\n }\n};\n\nSubject.prototype.removeObserver = function (observer) {\n this.observers.removeAt(this.observers.indexOf(observer, 0));\n};\n\nSubject.prototype.notify = function (context) {\n this.context = context;\n var observerCount = this.observers.count();\n //setTimeout(() => {\n for (var i = 0; i < observerCount; i++) {\n try {\n this.observers.get(i).update(context);\n } catch (error) {\n console.log(error);\n }\n }\n //}, 100);\n};\n\n\n/**\n * @class\n * @type {Observer}\n * @param {number} suppliedId \n * @param {Function} updateCallBackRef \n */\nfunction Observer (suppliedId, updateCallBackRef) {\n \"use strict\";\n this.id = suppliedId;\n this.update = updateCallBackRef;\n this.context = undefined;\n // this.update = function (context) {\n // this.context = context;\n // };\n // this.notifyThePromise = function (context) {\n // if (context !== null) {\n // subscription(context)\n // .then(function (result) {\n\n // //console.log(result);\n // // output: { brand: 'Samsung', color: 'black' }\n // })\n // .catch(function (error) {\n\n // //console.log(error.message);\n\n // });\n // }\n\n // };\n\n}\n\n\nvar passiveIfSupportedMiddleware = { passive: false };\n(function () {\n try {\n window.addEventListener(\"testPassive\", null,\n Object.defineProperty({}, \"passive\",\n { get: function () { passiveIfSupportedMiddleware = { passive: true }; } }\n ));\n window.removeEventListener(\"testPassive\");\n }\n catch (err) {\n //TODO: log error\n }\n\n})();\n/**\n * @constructor\n */\nvar GlobalMiddleware = (function () {\n function GlobalMiddleware () {\n /**\n * @type {GlobalMiddleware}\n */\n var self = this;\n this._scriptsDirectory = undefined;\n this._pResizeSubject = undefined;\n this._pWindowSizeMiddleware = window.$WindowSizeMiddleware || new WindowSizeMiddleware();\n this._serviceCollectionSingleton = {};\n this._componentSynchronizationSubject = undefined;\n\n\n GlobalMiddleware.prototype.GetDeviceDateTimeInfo = function () {\n var d2 = new Date();\n d2.getFullYear() + '-' + (d2.getMonth() + 1).toString() + '-' + d2.getDate();\n console.log(d2);\n }\n\n GlobalMiddleware.prototype.getScriptsDirectory = function () {\n\n if (self._scriptsDirectory) {\n return self._scriptsDirectory;\n } else {\n if (window.$sfConfigModel !== undefined) {\n if (window.$sfConfigModel.EnvId === 8) {\n self._scriptsDirectory = 'prod';\n } else {\n self._scriptsDirectory = 'dist';\n }\n\n } else {\n if (window.location.host.indexOf('v8builder.com') > -1) {\n self._scriptsDirectory = 'prod';\n } else {\n self._scriptsDirectory = 'dist';\n }\n }\n return self._scriptsDirectory;\n }\n }\n\n GlobalMiddleware.prototype.ServicesCollection = {\n TryGetOrCreateSingleton: function (className, params) {\n if (self._serviceCollectionSingleton[className] && self._serviceCollectionSingleton[className].value) {\n return self._serviceCollectionSingleton[className].value;\n } else {\n var ctorDelegate = window[className];\n if (ctorDelegate) {\n\n var theNewInstance = {};\n theNewInstance.key = \"$\" + className;\n theNewInstance.value = new ctorDelegate(params);\n window[theNewInstance.key] = theNewInstance.value;\n self._serviceCollectionSingleton[className] = theNewInstance;\n return self._serviceCollectionSingleton[className].value;\n } else {\n return undefined;\n }\n }\n },\n }\n GlobalMiddleware.prototype.SyncBroker = {\n /**\n * \n * @param {Observer} observer \n */\n SubscribeToSyncSubject: function (observer) {\n if (!self._componentSynchronizationSubject) {\n self._componentSynchronizationSubject = new Subject();\n }\n self._componentSynchronizationSubject.addObserver(observer);\n },\n NotifySyncSubject: function (context) {\n if (!self._componentSynchronizationSubject) {\n self._componentSynchronizationSubject = new Subject();\n }\n\n self._componentSynchronizationSubject.context = context;\n },\n\n }\n\n GlobalMiddleware.prototype.SubscribeCheckIfInViewPort =\n function (elementId, callback, ubSubscribeOnHit) {\n\n var theElement = document.getElementById(elementId);\n var callbackRef = callback;\n var shouldUnSubscribeOnHit = ubSubscribeOnHit;\n var theBoundScrollAction = receiveScrollNotification.bind(theElement, callbackRef);\n\n window.addEventListener('scroll', theBoundScrollAction, passiveIfSupported);\n\n function receiveScrollNotification () {\n\n var isInViewPort = elementInViewport2(theElement);\n if (isInViewPort) {\n callbackRef();\n if (shouldUnSubscribeOnHit) {\n window.removeEventListener('scroll', theBoundScrollAction);\n }\n }\n }\n\n function elementInViewport2 (el) {\n var top = el.offsetTop;\n var left = el.offsetLeft;\n var width = el.offsetWidth;\n var height = el.offsetHeight;\n\n while (el.offsetParent) {\n el = el.offsetParent;\n top += el.offsetTop;\n left += el.offsetLeft;\n }\n\n return (\n top < (window.pageYOffset + window.innerHeight) &&\n left < (window.pageXOffset + window.innerWidth) &&\n (top + height) > window.pageYOffset &&\n (left + width) > window.pageXOffset\n );\n }\n }\n }\n\n GlobalMiddleware.prototype.getWindowHeight = function () {\n return this._pWindowSizeMiddleware.getHeight();\n };\n\n GlobalMiddleware.prototype.getWindowWidth = function () {\n return this._pWindowSizeMiddleware.getWidth();\n };\n\n GlobalMiddleware.prototype.PassiveSupported = function () {\n return passiveIfSupportedMiddleware;\n };\n\n GlobalMiddleware.prototype.SubscribeResize = function (observer) {\n if (!this._pResizeSubject) {\n\n this._pResizeSubject = new Subject();\n\n var clientData = {};\n clientData.windowWidth = this._pWindowSizeMiddleware.getWidth();\n clientData.windowHeight = this._pWindowSizeMiddleware.getHeight();\n this._pResizeSubject.context = clientData;\n\n var boundEevent = handleOnResizeEvent.bind(this);\n\n window.addEventListener('resize', boundEevent, passiveIfSupportedMiddleware);\n\n this._pResizeSubject.addObserver(observer);\n } else {\n this._pResizeSubject.addObserver(observer);\n }\n\n };\n return GlobalMiddleware;\n}());\n\n\nvar handleOnResizeEvent = function () {\n if (this._pResizeSubject) {\n var clientData = {};\n clientData.windowWidth = this._pWindowSizeMiddleware.getWidth();\n clientData.windowHeight = this._pWindowSizeMiddleware.getHeight();\n setTimeout(function (ref) {\n ref._pResizeSubject.notify(clientData);\n }, 150, this);\n //this._pResizeSubject.notify(clientData);\n }\n\n};\n\n\nfunction getClientDataMiddleWare () {\n\n var w = window,\n d = document,\n e = d.documentElement,\n g = d.getElementsByTagName('body')[0];\n var clientData = {};\n clientData.windowWidth = w.innerWidth || e.clientWidth || g.clientWidth;\n clientData.windowHeight = w.innerHeight || e.clientHeight || g.clientHeight;\n clientData.devicePixelRatio = window.devicePixelRatio || 1;\n\n try {\n\n var d1 = new Date();\n clientData.localDateTime = d1.toString();\n clientData.timeStampEpoch = Math.ceil(Date.now() / 1000);\n clientData.timezoneOffset = d1.getTimezoneOffset();\n //clientData.URL = window.location.toString();\n if (window.event) {\n var element = window.event.srcElement || window.event.currentTarget;\n if (element) {\n clientData.SourceElement = {};\n clientData.SourceElement.id = element.id;\n clientData.SourceElement.className = element.className;\n clientData.SourceElement.innerText = element.innerText;\n clientData.SourceElement.offsetTop = element.offsetTop;\n clientData.SourceElement.offsetWidth = element.offsetWidth;\n }\n }\n // if (window.navigator) {\n // var nav = {};\n // nav.language = window.navigator.language;\n // if (window.navigator.languages) {\n // nav.languages = window.navigator.languages.toString();\n // }\n // if (window.navigator.hardwareConcurrency) {\n // nav.hardwareConcurrency = window.navigator.hardwareConcurrency;\n // }\n\n // nav.userAgent = window.navigator.userAgent;\n // nav.platform = window.navigator.platform;\n // nav.product = window.navigator.product;\n // nav.vendor = window.navigator.vendor;\n // clientData.Navigator = nav;\n // }\n\n } catch (ex) {\n //TODO: log exception\n }\n\n return clientData;\n}\n\nfunction getNav () {\n try {\n if (window.navigator) {\n var nav = {};\n nav.language = window.navigator.language;\n if (window.navigator.languages) {\n nav.languages = window.navigator.languages.toString();\n }\n if (window.navigator.hardwareConcurrency) {\n nav.hardwareConcurrency = window.navigator.hardwareConcurrency;\n }\n\n nav.userAgent = window.navigator.userAgent;\n nav.platform = window.navigator.platform;\n nav.product = window.navigator.product;\n nav.vendor = window.navigator.vendor;\n\n //nav.maxTouchPoints = window.navigator.maxTouchPoints;\n\n nav.appCodeName = window.navigator.appCodeName;\n nav.appName = window.navigator.appName;\n nav.appVersion = window.navigator.appVersion;\n nav.connection = getCon();\n return nav;\n }\n\n } catch (ex) {\n //TODO: log exception\n }\n return null;\n}\n\nfunction getCon () {\n try {\n if (window.navigator.connection) {\n\n var con = {};\n con.downlink = window.navigator.connection.downlink;\n con.effectiveType = window.navigator.connection.effectiveType;\n con.onchange = window.navigator.connection.onchange;\n con.rtt = window.navigator.connection.rtt;\n con.saveData = window.navigator.connection.saveData;\n return con;\n }\n } catch (error) {\n\n }\n\n return null;\n\n}\n\n\n\nvar _headerBaseURL = undefined;\n\nfunction GetBaseUrlFromDocumentMiddleware () {\n\n if (!_headerBaseURL) {\n if (window.$sfConfigModel !== undefined && window.$sfConfigModel.BASE_URL !== undefined) {\n _headerBaseURL = window.$sfConfigModel.BASE_URL;\n } else {\n //_baseURL = document.getElementsByTagName('base')[0].href;\n _headerBaseURL = document.getElementsByTagName('base')[0].attributes.href.value;\n }\n\n }\n return _headerBaseURL;\n}\n\nvar _scriptsDirectory = undefined;\nfunction getScriptsDirectory () {\n if (_scriptsDirectory) {\n return _scriptsDirectory;\n } else {\n if (window.$sfConfigModel !== undefined) {\n if (window.$sfConfigModel.EnvId === 8) {\n _scriptsDirectory = 'prod';\n } else {\n _scriptsDirectory = 'dist';\n }\n\n } else {\n if (window.location.host.indexOf('v8builder.com') > -1) {\n _scriptsDirectory = 'prod';\n } else {\n _scriptsDirectory = 'dist';\n }\n }\n return _scriptsDirectory;\n }\n}\n\n\nvar _webWorkerMiddleware = undefined;\nfunction getWebWorkerMiddleawre () {\n if (!_webWorkerMiddleware) {\n if (window.Worker) {\n\n _webWorkerMiddleware = new Worker(GetBaseUrlFromDocumentMiddleware() + getScriptsDirectory() + \"/js/WebWorkerMiddleware.js\");\n }\n }\n return _webWorkerMiddleware;\n}\n\n\n//@ts-check\nfunction ClientToServerUpdateTask (e, dataModel) {\n try {\n var userWrapper = {};\n userWrapper.type = \"ClientDataWrapper\";\n userWrapper.ClientData = getClientDataMiddleWare();\n userWrapper.PAGE_URL = window.location.toString();\n userWrapper.Navigator = getNav();\n\n if (dataModel) {\n userWrapper.DataModel = {};\n userWrapper.DataModel.type = \"DataModel\";\n userWrapper.DataModel.value = dataModel;\n }\n\n setTimeout(function () {\n var theURL = GetBaseUrlFromDocumentMiddleware() + \"ClientServices/Update\";\n postToServer(userWrapper, theURL);\n }, 300);\n\n // // setTimeout(function () {\n // // var theURL = GetBaseUrlFromDocumentMiddleware() + \"ClientServices/Update\";\n // // if (typeof (Worker) !== \"undefined\") {\n // // // Web worker supported!\n // // var webWorker = getWebWorkerMiddleawre();\n // // var dataMsgForWorker = [\n // // \"PostDataFromWorker\",\n // // theURL,\n // // userWrapper\n // // ];\n // // //webWorker.addEventListener('message', handleMessageFromWorker);\n // // webWorker.postMessage(dataMsgForWorker);\n // // //webWorker.onmessage = function (e) {\n // // // var resultContent = e.data;\n // // // console.log('Message received from worker');\n // // // webWorker.terminate();\n // // //};\n\n // // } else {\n // // postToServer(userWrapper, theURL);\n // // }\n // // }, 300);\n\n\n } catch (exception) {\n //TODO: log excepotion\n }\n\n\n\n function postToServer (userWrapper, theURL) {\n //@ts-check\n var suppliedHeaders = {}\n suppliedHeaders['Content-Type'] = 'application/json';\n // Sorry! No Web Worker support..\n fetch(theURL, {\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\n mode: 'same-origin', // no-cors, cors, *same-origin\n cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached\n credentials: 'same-origin', // include, *same-origin, omit\n headers: suppliedHeaders,\n redirect: 'follow', // manual, *follow, error\n referrer: 'client', // no-referrer, *client\n body: JSON.stringify(userWrapper), // body data type must match \"Content-Type\" header\n }).then(value => {\n var response = value;\n return response.json();\n });\n }\n\n function handleMessageFromWorker (msg) {\n console.log('incoming message from worker, msg:', msg);\n\n }\n\n\n}\n\n(function () {\n window.$GM = window.$GlobalMiddleware = new GlobalMiddleware();\n\n setTimeout(function () {\n ClientToServerUpdateTask();\n }, 350);\n})();\n"],"file":"main.js"}