text: /**
    Copyright (c) 2015, 2018, Oracle and/or its affiliates.
    The Universal Permissive License (UPL), Version 1.0
  */
  'use strict';
  
  /**
   * Example of Require.js boostrap javascript
   */
  
  requirejs.config(
    {
      baseUrl: 'js',
  
      // Path mappings for the logical module names
      // Update the main-release-paths.json for release mode when updating the mappings
      paths:
      //injector:mainReleasePaths
      {
        'knockout': 'libs/knockout/knockout-3.4.0.debug',
        'jquery': 'libs/jquery/jquery-3.1.1',
        'jqueryui-amd': 'libs/jquery/jqueryui-amd-1.12.0',
        'promise': 'libs/es6-promise/es6-promise',
        'hammerjs': 'libs/hammer/hammer-2.0.8',
        'ojdnd': 'libs/dnd-polyfill/dnd-polyfill-1.0.0',
        'ojs': 'libs/oj/v4.2.0/debug',
        'ojL10n': 'libs/oj/v4.2.0/ojL10n',
        'ojtranslations': 'libs/oj/v4.2.0/resources',
        'text': 'libs/require/text',
        'signals': 'libs/js-signals/signals',
        'customElements': 'libs/webcomponents/custom-elements.min',
        'proj4': 'libs/proj4js/dist/proj4-src',
        'css': 'libs/require-css/css'
      }
      //endinjector
      ,
  
      // Shim configurations for modules that do not expose AMD
      shim:
      {
        'jquery':
        {
          exports: ['jQuery', '$']
        },
        'maps': {
          deps: ['jquery', 'i18n'],
          exports: ['MVMapView']
        }
      },
      config: {
        ojL10n: {
            merge: {
                //'ojtranslations/nls/ojtranslations': 'resources/nls/menu'
            }
        }
      }
    }
  );
  
  require(['ojs/ojcore',
      'knockout',
      'jquery',
      'utils',
      'ojs/ojrouter',
      'ojs/ojknockout',
      'ojs/ojmodule',
      'ojs/ojbutton',
      'ojs/ojtoolbar',
      'ojs/ojmenu',
      'ojs/ojinputtext'
  ],
          function (oj, ko, $, utils) {
  
            $(function () {
              function init() {
              }
        
              // If running in a hybrid (e.g. Cordova) environment, we need to wait for the deviceready
              // event before executing any code that might interact with Cordova APIs or plugins.
              if ($(document.body).hasClass('oj-hybrid')) {
                document.addEventListener('deviceready', init);
              } else {
                init();
              }
            });
  
              var router = oj.Router.rootInstance;
              router.configure({
                  'dashboard': {label: 'Dashboard'},
                  'people': {label: 'Flights'},
                  'hotels': {label: 'Hotels'},
                  'person': {label: 'Person',
                      exit: function () {
                          var childRouter = router.currentState().value;
                          childRouter.dispose();
                      },
                      enter: function () {
                          var childRouter = router.createChildRouter('emp');
                          childRouter.defaultStateId = '100';
                          router.currentState().value = childRouter;
                      }
                  },
                  'login': {label: 'Login', isDefault: true}
  
              });
  
              function MainViewModel() {
                  var self = this;
                  self.router = router;
                  utils.readSettings();
                  self.myPeople = ko.observableArray();
                  self.myPerson = ko.observableArray();
                  self.ready = ko.observable(false);
  
                  self.optionChangeHandler = function (event, data) {
                      // Only go for user action events
                      if (('ojAppNav' === event.target.id || 'ojAppNav2' === event.target.id) && event.originalEvent) {
                          self.router.go(data.value);
                      }
                  };
                  self.getHomeURL = function () {
                      var baseURL = window.location.href;
                      var end = baseURL.indexOf('?');
                      var url;
                      if (end !== -1) {
                          url = baseURL.substring(0, end);
                      } else {
                          url = baseURL;
                      }
  
                      return url;
                  };
                  self.screenRange = oj.ResponsiveKnockoutUtils.createScreenRangeObservable();
                  var lgQuery = oj.ResponsiveUtils.getFrameworkQuery(oj.ResponsiveUtils.FRAMEWORK_QUERY_KEY.LG_UP);
                  var mdQuery = oj.ResponsiveUtils.getFrameworkQuery(oj.ResponsiveUtils.FRAMEWORK_QUERY_KEY.MD_UP);
                  var smQuery = oj.ResponsiveUtils.getFrameworkQuery(oj.ResponsiveUtils.FRAMEWORK_QUERY_KEY.SM_UP);
                  var smOnlyQuery = oj.ResponsiveUtils.getFrameworkQuery(oj.ResponsiveUtils.FRAMEWORK_QUERY_KEY.SM_ONLY);
                  self.large = oj.ResponsiveKnockoutUtils.createMediaQueryObservable(lgQuery);
                  self.medium = oj.ResponsiveKnockoutUtils.createMediaQueryObservable(mdQuery);
                  self.small = oj.ResponsiveKnockoutUtils.createMediaQueryObservable(smQuery);
                  self.smallOnly = oj.ResponsiveKnockoutUtils.createMediaQueryObservable(smOnlyQuery);
  
                  self.dynamicConfig = ko.pureComputed(function () {
                      if (self.smallOnly()) {
                          return {name: 'phone/' + router.moduleConfig.name(), lifecycleListner: router.moduleConfig.lifecycleListner, params: router.moduleConfig.params};
                      }
                      return router.moduleConfig;
                  });
              }
  
              oj.Router.defaults['urlAdapter'] = new oj.Router.urlParamAdapter();
              oj.Router.sync().then(
                      function () {
                          ko.applyBindings(new MainViewModel(), document.getElementById('globalBody'));
                          $('#globalBody').show();
                      },
                      function (error) {
                          oj.Logger.error('Error in root start: ' + error.message);
                      });
          }
  );
  
  
  