<commit_before>/**
 * Copyright 2014 aixigo AG
 * Released under the MIT license.
 * http://laxarjs.org/license
 */
define( [
   'angular',
   'require',
   '../../../utilities/assert',
   '../../../utilities/path',
   '../../paths'
], function( ng, require, assert, path, paths ) {
   'use strict';

   var module = ng.module( 'laxar.portal.angular_adapter', [] );

   ///////////////////////////////////////////////////////////////////////////////////////////////////////////

   var $compile;
   var $controller;
   var themeManager;
   var cssLoader;
   module.run( [
      '$compile', '$controller', 'ThemeManager', 'CssLoader',
      function( _$compile_, _$controller_, _themeManager_, _cssLoader_ ) {
         $controller = _$controller_;
         $compile = _$compile_;
         themeManager = _themeManager_;
         cssLoader = _cssLoader_;
      }
   ] );

   ///////////////////////////////////////////////////////////////////////////////////////////////////////////

   function create( q, fileResourceProvider, specification, features, widgetConfiguration, anchorElement ) {
      assert( q ).isNotNull();
      assert( fileResourceProvider ).hasType( Object ).isNotNull();
      assert( specification ).hasType( Object ).isNotNull();
      assert( features ).hasType( Object ).isNotNull();
      assert( widgetConfiguration ).hasType( Object ).isNotNull();
      assert( anchorElement ).isNotNull();

      var scope_;
      var widgetServices_;
      var hasDom_ = false;
      var domPrepare_;

      function createController( widgetServices, configuration ) {
         assert( widgetServices ).hasType( Object ).isNotNull();
         assert( widgetServices.eventBus ).hasType( Object ).isNotNull();
         assert( widgetServices.idGenerator ).hasType( Function ).isNotNull();
         assert( configuration ).hasType( Object ).isNotNull();

         widgetServices_ = widgetServices;

         scope_ = configuration.anchorScope.$new();
         scope_.eventBus = widgetServices.eventBus;
         scope_.id = widgetServices.idGenerator;
         scope_.widget = {
            area: widgetConfiguration.area,
            id: widgetConfiguration.id,
            path: widgetConfiguration.widget
         };
         scope_.features = features;

         var controllerName = 'widgets.' + widgetConfiguration.widget.replace( /\//g, '.' ) + '.Controller';
         $controller( controllerName, { '$scope': scope_ } );
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      function domPrepare() {
         if( !domPrepare_ ) {
            domPrepare_ = resolveAssets( q, widgetConfiguration, specification )
               .then( function( urls ) {
                  urls.cssFileUrls.forEach( function( url ) {
                     cssLoader.load( url );
                  } );
                  if( urls.templateUrl ) {
                     hasDom_ = true;
                     return fileResourceProvider.provide( urls.templateUrl )
                        .then( function( templateHtml ) {
                           var element = ng.element( anchorElement );
                           element.html( templateHtml );
                           $compile( element )( scope_ );
                        } );
                  }
               } );
         }
         return domPrepare_;
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * @param {HTMLElement} areaElement
       *    The widget area to attach this widget to.
       */
      function domAttachTo( areaElement ) {<commit_msg>(#67) re-added missing widget root element IDs<commit_after>/**
 * Copyright 2014 aixigo AG
 * Released under the MIT license.
 * http://laxarjs.org/license
 */
define( [
   'angular',
   'require',
   '../../../utilities/assert',
   '../../../utilities/path',
   '../../paths'
], function( ng, require, assert, path, paths ) {
   'use strict';

   var module = ng.module( 'laxar.portal.angular_adapter', [] );

   ///////////////////////////////////////////////////////////////////////////////////////////////////////////

   var $compile;
   var $controller;
   var themeManager;
   var cssLoader;
   module.run( [
      '$compile', '$controller', 'ThemeManager', 'CssLoader',
      function( _$compile_, _$controller_, _themeManager_, _cssLoader_ ) {
         $controller = _$controller_;
         $compile = _$compile_;
         themeManager = _themeManager_;
         cssLoader = _cssLoader_;
      }
   ] );

   ///////////////////////////////////////////////////////////////////////////////////////////////////////////

   function create( q, fileResourceProvider, specification, features, widgetConfiguration, anchorElement ) {
      assert( q ).isNotNull();
      assert( fileResourceProvider ).hasType( Object ).isNotNull();
      assert( specification ).hasType( Object ).isNotNull();
      assert( features ).hasType( Object ).isNotNull();
      assert( widgetConfiguration ).hasType( Object ).isNotNull();
      assert( anchorElement ).isNotNull();

      var scope_;
      var widgetServices_;
      var hasDom_ = false;
      var domPrepare_;

      function createController( widgetServices, configuration ) {
         assert( widgetServices ).hasType( Object ).isNotNull();
         assert( widgetServices.eventBus ).hasType( Object ).isNotNull();
         assert( widgetServices.idGenerator ).hasType( Function ).isNotNull();
         assert( configuration ).hasType( Object ).isNotNull();

         widgetServices_ = widgetServices;

         scope_ = configuration.anchorScope.$new();
         scope_.eventBus = widgetServices.eventBus;
         scope_.id = widgetServices.idGenerator;
         scope_.widget = {
            area: widgetConfiguration.area,
            id: widgetConfiguration.id,
            path: widgetConfiguration.widget
         };
         scope_.features = features;

         var controllerName = 'widgets.' + widgetConfiguration.widget.replace( /\//g, '.' ) + '.Controller';
         $controller( controllerName, { '$scope': scope_ } );
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      function domPrepare() {
         if( !domPrepare_ ) {
            domPrepare_ = resolveAssets( q, widgetConfiguration, specification )
               .then( function( urls ) {
                  urls.cssFileUrls.forEach( function( url ) {
                     cssLoader.load( url );
                  } );
                  if( urls.templateUrl ) {
                     hasDom_ = true;
                     return fileResourceProvider.provide( urls.templateUrl )
                        .then( function( templateHtml ) {
                           var element = ng.element( anchorElement );
                           element.html( templateHtml );
                           $compile( element )( scope_ );
                           element[ 0 ].id = 'widget__' + widgetConfiguration.id;
                        } );
                  }
               } );
         }
         return domPrepare_;
      }

      ////////////////////////////////////////////////////////////////////////////////////////////////////////

      /**
       * @param {HTMLElement} areaElement
       *    The widget area to attach this widget to.
       */
      function domAttachTo( areaElement ) {
{'fraction_non_alphanumeric': 0.21791605203164813, 'fraction_numerical': 0.0014751240445219256, 'mean_word_length': 1.3980707395498393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1692444', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1662, 'n_words': 413}