{"ast":null,"code":"/** @publicapi @module ng1 */\n\n/** */\nimport { pick, forEach, tail, extend, isArray, isInjectable, isDefined, isString, services, trace, ViewService, ResolveContext, Resolvable } from '@uirouter/core';\n/** @internalapi */\n\nexport function getNg1ViewConfigFactory() {\n  var templateFactory = null;\n  return function (path, view) {\n    templateFactory = templateFactory || services.$injector.get('$templateFactory');\n    return [new Ng1ViewConfig(path, view, templateFactory)];\n  };\n}\n/** @internalapi */\n\nvar hasAnyKey = function (keys, obj) {\n  return keys.reduce(function (acc, key) {\n    return acc || isDefined(obj[key]);\n  }, false);\n};\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n *\n * @internalapi\n */\n\n\nexport function ng1ViewsBuilder(state) {\n  // Do not process root state\n  if (!state.parent) return {};\n  var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n      ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n      compKeys = ['component', 'bindings', 'componentProvider'],\n      nonCompKeys = tplKeys.concat(ctrlKeys),\n      allViewKeys = compKeys.concat(nonCompKeys); // Do not allow a state to have both state-level props and also a `views: {}` property.\n  // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n  // However, the `$default` approach should not be mixed with a separate `views: ` block.\n\n  if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n    throw new Error(\"State '\" + state.name + \"' has a 'views' object. \" + \"It cannot also have \\\"view properties\\\" at the state level.  \" + \"Move the following properties into a view (in the 'views' object): \" + (\" \" + allViewKeys.filter(function (key) {\n      return isDefined(state[key]);\n    }).join(', ')));\n  }\n\n  var views = {},\n      viewsObject = state.views || {\n    $default: pick(state, allViewKeys)\n  };\n  forEach(viewsObject, function (config, name) {\n    // Account for views: { \"\": { template... } }\n    name = name || '$default'; // Account for views: { header: \"headerComponent\" }\n\n    if (isString(config)) config = {\n      component: config\n    }; // Make a shallow copy of the config object\n\n    config = extend({}, config); // Do not allow a view to mix props for component-style view with props for template/controller-style view\n\n    if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n      throw new Error(\"Cannot combine: \" + compKeys.join('|') + \" with: \" + nonCompKeys.join('|') + \" in stateview: '\" + name + \"@\" + state.name + \"'\");\n    }\n\n    config.resolveAs = config.resolveAs || '$resolve';\n    config.$type = 'ng1';\n    config.$context = state;\n    config.$name = name;\n    var normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n    config.$uiViewName = normalized.uiViewName;\n    config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n    views[name] = config;\n  });\n  return views;\n}\n/** @hidden */\n\nvar id = 0;\n/** @internalapi */\n\nvar Ng1ViewConfig = function () {\n  function Ng1ViewConfig(path, viewDecl, factory) {\n    var _this = this;\n\n    this.path = path;\n    this.viewDecl = viewDecl;\n    this.factory = factory;\n    this.$id = id++;\n    this.loaded = false;\n\n    this.getTemplate = function (uiView, context) {\n      return _this.component ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings) : _this.template;\n    };\n  }\n\n  Ng1ViewConfig.prototype.load = function () {\n    var _this = this;\n\n    var $q = services.$q;\n    var context = new ResolveContext(this.path);\n    var params = this.path.reduce(function (acc, node) {\n      return extend(acc, node.paramValues);\n    }, {});\n    var promises = {\n      template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n      controller: $q.when(this.getController(context))\n    };\n    return $q.all(promises).then(function (results) {\n      trace.traceViewServiceEvent('Loaded', _this);\n      _this.controller = results.controller;\n      extend(_this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n\n      return _this;\n    });\n  };\n  /**\n   * Gets the controller for a view configuration.\n   *\n   * @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.\n   */\n\n\n  Ng1ViewConfig.prototype.getController = function (context) {\n    var provider = this.viewDecl.controllerProvider;\n    if (!isInjectable(provider)) return this.viewDecl.controller;\n    var deps = services.$injector.annotate(provider);\n    var providerFn = isArray(provider) ? tail(provider) : provider;\n    var resolvable = new Resolvable('', providerFn, deps);\n    return resolvable.get(context);\n  };\n\n  return Ng1ViewConfig;\n}();\n\nexport { Ng1ViewConfig };","map":{"version":3,"sources":["D:/Development/Work/CENOS/cenos-ui/node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"],"names":["pick","forEach","tail","extend","isArray","isInjectable","isDefined","isString","services","trace","ViewService","ResolveContext","Resolvable","getNg1ViewConfigFactory","templateFactory","path","view","$injector","get","Ng1ViewConfig","hasAnyKey","keys","obj","reduce","acc","key","ng1ViewsBuilder","state","parent","tplKeys","ctrlKeys","compKeys","nonCompKeys","concat","allViewKeys","views","Error","name","filter","join","viewsObject","$default","config","component","resolveAs","$type","$context","$name","normalized","normalizeUIViewTarget","$uiViewName","uiViewName","$uiViewContextAnchor","uiViewContextAnchor","id","viewDecl","factory","_this","$id","loaded","getTemplate","uiView","context","makeComponentTemplate","bindings","template","prototype","load","$q","params","node","paramValues","promises","when","fromConfig","controller","getController","all","then","results","traceViewServiceEvent","provider","controllerProvider","deps","annotate","providerFn","resolvable"],"mappings":"AAAA;;AAA8B;AAC9B,SAASA,IAAT,EAAeC,OAAf,EAAwBC,IAAxB,EAA8BC,MAA9B,EAAsCC,OAAtC,EAA+CC,YAA/C,EAA6DC,SAA7D,EAAwEC,QAAxE,EAAkFC,QAAlF,EAA4FC,KAA5F,EAAmGC,WAAnG,EAAgHC,cAAhH,EAAgIC,UAAhI,QAAmJ,gBAAnJ;AACA;;AACA,OAAO,SAASC,uBAAT,GAAmC;AACtC,MAAIC,eAAe,GAAG,IAAtB;AACA,SAAO,UAAUC,IAAV,EAAgBC,IAAhB,EAAsB;AACzBF,IAAAA,eAAe,GAAGA,eAAe,IAAIN,QAAQ,CAACS,SAA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AAmByE,UAAnB,EAA+BF,IAA/B,CAAjB;AACA,WAAOG,UAAU,CAACpE,GAAX,CAAe4C,OAAf,CAAP;AACH,GARD;;AASA,SAAO3C,aAAP;AACH,CA7CkC,EAAnC;;AA8CA,SAASA,aAAT","sourcesContent":["/** @publicapi @module ng1 */ /** */\nimport { pick, forEach, tail, extend, isArray, isInjectable, isDefined, isString, services, trace, ViewService, ResolveContext, Resolvable, } from '@uirouter/core';\n/** @internalapi */\nexport function getNg1ViewConfigFactory() {\n    var templateFactory = null;\n    return function (path, view) {\n        templateFactory = templateFactory || services.$injector.get('$templateFactory');\n        return [new Ng1ViewConfig(path, view, templateFactory)];\n    };\n}\n/** @internalapi */\nvar hasAnyKey = function (keys, obj) { return keys.reduce(function (acc, key) { return acc || isDefined(obj[key]); }, false); };\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n *\n * @internalapi\n */\nexport function ng1ViewsBuilder(state) {\n    // Do not process root state\n    if (!state.parent)\n        return {};\n    var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys);\n    // Do not allow a state to have both state-level props and also a `views: {}` property.\n    // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n    // However, the `$default` approach should not be mixed with a separate `views: ` block.\n    if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n        throw new Error(\"State '\" + state.name + \"' has a 'views' object. \" +\n            \"It cannot also have \\\"view properties\\\" at the state level.  \" +\n            \"Move the following properties into a view (in the 'views' object): \" +\n            (\" \" + allViewKeys.filter(function (key) { return isDefined(state[key]); }).join(', ')));\n    }\n    var views = {}, viewsObject = state.views || { $default: pick(state, allViewKeys) };\n    forEach(viewsObject, function (config, name) {\n        // Account for views: { \"\": { template... } }\n        name = name || '$default';\n        // Account for views: { header: \"headerComponent\" }\n        if (isString(config))\n            config = { component: config };\n        // Make a shallow copy of the config object\n        config = extend({}, config);\n        // Do not allow a view to mix props for component-style view with props for template/controller-style view\n        if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n            throw new Error(\"Cannot combine: \" + compKeys.join('|') + \" with: \" + nonCompKeys.join('|') + \" in stateview: '\" + name + \"@\" + state.name + \"'\");\n        }\n        config.resolveAs = config.resolveAs || '$resolve';\n        config.$type = 'ng1';\n        config.$context = state;\n        config.$name = name;\n        var normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n        config.$uiViewName = normalized.uiViewName;\n        config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n        views[name] = config;\n    });\n    return views;\n}\n/** @hidden */\nvar id = 0;\n/** @internalapi */\nvar Ng1ViewConfig = /** @class */ (function () {\n    function Ng1ViewConfig(path, viewDecl, factory) {\n        var _this = this;\n        this.path = path;\n        this.viewDecl = viewDecl;\n        this.factory = factory;\n        this.$id = id++;\n        this.loaded = false;\n        this.getTemplate = function (uiView, context) {\n            return _this.component\n                ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings)\n                : _this.template;\n        };\n    }\n    Ng1ViewConfig.prototype.load = function () {\n        var _this = this;\n        var $q = services.$q;\n        var context = new ResolveContext(this.path);\n        var params = this.path.reduce(function (acc, node) { return extend(acc, node.paramValues); }, {});\n        var promises = {\n            template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n            controller: $q.when(this.getController(context)),\n        };\n        return $q.all(promises).then(function (results) {\n            trace.traceViewServiceEvent('Loaded', _this);\n            _this.controller = results.controller;\n            extend(_this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n            return _this;\n        });\n    };\n    /**\n     * Gets the controller for a view configuration.\n     *\n     * @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.\n     */\n    Ng1ViewConfig.prototype.getController = function (context) {\n        var provider = this.viewDecl.controllerProvider;\n        if (!isInjectable(provider))\n            return this.viewDecl.controller;\n        var deps = services.$injector.annotate(provider);\n        var providerFn = isArray(provider) ? tail(provider) : provider;\n        var resolvable = new Resolvable('', providerFn, deps);\n        return resolvable.get(context);\n    };\n    return Ng1ViewConfig;\n}());\nexport { Ng1ViewConfig };\n"]},"metadata":{},"sourceType":"module"}