{"version":3,"sources":["Core/App.ts"],"names":["define","require","exports","Env","Object","defineProperty","value","AppModel","AppContext","PageContext","[object Object]","this","pageContext","getPageContextFromUrl","location","pathname","toLocaleLowerCase","path","context","i","config","contextMappings","length","ctx","contextMatches","contextMatch","Array","j","matches","RegExp","exec","name","appContext","amdModule","format","toLowerCase","$","dxLoadPanel","module","Main","onLoad","console","warn"],"mappings":"AAAAA,OAAO,CAAC,UAAW,UAAW,iBAAkB,SAAUC,EAASC,EAASC,GACxE,aACAC,OAAOC,eAAeH,EAAS,aAAc,CAAEI,OAAO,IACtDJ,EAAQK,SAAWL,EAAQM,WAAaN,EAAQO,iBAAc,EAC9D,MAAMA,GAENP,EAAQO,YAAcA,EA8BtBP,EAAQM,WA7BR,MACIE,cACIC,KAAKC,YAAcD,KAAKE,sBAAsBC,SAASC,SAASC,qBAEpEN,sBAAsBO,GAClB,IAAIC,EAAU,KACd,IAAK,IAAIC,EAAI,EAAGA,EAAIhB,EAAIiB,OAAOC,gBAAgBC,OAAQH,IAAK,CACxD,IAAII,EAAMpB,EAAIiB,OAAOC,gBAAgBF,GACrC,GAAKI,EAAL,CAEA,IAAIC,EAA6C,iBAArBD,EAAIE,aAC1B,IAAIC,MAAMH,EAAIE,cACdF,EAAIE,aACV,IAAK,IAAIE,EAAI,EAAGA,EAAIH,EAAeF,OAAQK,IAAK,CAE5C,IAAIC,EADQ,IAAIC,OAAOL,EAAeG,GAAI,MACtBG,KAAKhB,SAASC,UAClC,GAAIa,GAAWA,EAAQN,OAAQ,EAC3BJ,EAAU,IAAIT,GACNsB,KAAOR,EAAIQ,KACnBb,EAAQO,aAAeF,EAAIE,aAC3B,OAGR,GAAIP,EACA,OAER,OAAOA,IAqBfhB,EAAQK,SAjBR,MACIG,YAAYQ,GAER,GADAP,KAAKqB,WAAad,EACiB,MAA/BP,KAAKqB,WAAWpB,YAAqB,CACrC,IAAIqB,EAAY,yBAAyBC,OAAOvB,KAAKqB,WAAWpB,YAAYmB,KAAKI,eACjFC,EAAE,uBAAuBC,YAAY,SAAU,WAAW,GAC1DpC,EAAQ,CAACgC,GAAaK,KACR,IAAIA,EAAOC,MACjBC,SACJJ,EAAE,uBAAuBC,YAAY,SAAU,WAAW,IAC3D,KACCI,QAAQC,KAAK,yBAAyBR,OAAOvB,KAAKqB,WAAWpB,YAAYmB,OACzEK,EAAE,uBAAuBC,YAAY,SAAU,WAAW","sourcesContent":["import Interfaces = require(\"./Interfaces\");\nimport Env = require(\"./Environment\");\n\nexport class PageContext implements Interfaces.IPageContext {\n public name: string;\n public contextMatch: Array;\n}\n\n\nexport class AppContext implements Interfaces.IAppContext {\n pageContext: Interfaces.IPageContext;\n\n constructor() {\n this.pageContext = this.getPageContextFromUrl(location.pathname.toLocaleLowerCase());\n }\n\n private getPageContextFromUrl(path: string): Interfaces.IPageContext {\n let context: Interfaces.IPageContext = null;\n for (let i = 0; i < Env.config.contextMappings.length; i++) {\n var ctx = Env.config.contextMappings[i];\n\n if (!ctx)\n continue;\n\n var contextMatches = typeof ctx.contextMatch === \"string\"\n ? new Array(ctx.contextMatch)\n : >ctx.contextMatch;\n\n for (let j = 0; j < contextMatches.length; j++) {\n var regex = new RegExp(contextMatches[j], \"gi\");\n let matches = regex.exec(location.pathname);\n if (matches && matches.length) {\n context = new PageContext();\n context.name = ctx.name;\n context.contextMatch = ctx.contextMatch;\n break;\n }\n\n }\n if (context)\n break;\n }\n return context;\n }\n}\n\nexport class AppModel implements Interfaces.IAppModel {\n public appContext: Interfaces.IAppContext;\n\n constructor(context: Interfaces.IAppContext) {\n this.appContext = context;\n if (this.appContext.pageContext != null) {\n var amdModule = \"Modules/{0}/{0}.module\".format(this.appContext.pageContext.name.toLowerCase());\n $(\"#wizardLoadingPanel\").dxLoadPanel(\"option\", \"visible\", true);\n require([amdModule],\n (module: any) => {\n var mod = new module.Main() as Interfaces.IAppModule;\n mod.onLoad();\n $(\"#wizardLoadingPanel\").dxLoadPanel(\"option\", \"visible\", false);\n }, () => {\n //Env.log.warn(\"No amdModule for '{0}'\".format(this.appContext.pageContext));\n console.warn(\"No amdModule for '{0}'\".format(this.appContext.pageContext.name));\n $(\"#wizardLoadingPanel\").dxLoadPanel(\"option\", \"visible\", false);\n });\n }\n }\n}"],"file":"App.js"}