define(['handlebars', 'lib/handlebars/helpers'], function (Handlebars, Helpers0) { 'use strict';

    Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
    Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;

    if (!Helpers0.__initialized) {
      Helpers0(Handlebars);
      Helpers0.__initialized = true;
    }
    var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
      this.compilerInfo = [4,'>= 1.0.0'];
    helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
      var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression;


      buffer += "<input type=\"hidden\" name=\"";
      if (helper = helpers.uri) { stack1 = helper.call(depth0, {hash:{},data:data}); }
      else { helper = (depth0 && depth0.uri); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
      buffer += escapeExpression(stack1)
        + "\" value=\"";
      if (helper = helpers.value) { stack1 = helper.call(depth0, {hash:{},data:data}); }
      else { helper = (depth0 && depth0.value); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
      buffer += escapeExpression(stack1)
        + "\" />\n";
      return buffer;
      });
    function hiddenTpl(data, options, asString) {
      var html = Template(data, options);
      return (asString || true) ? html : $(html);
    }

    /**
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * as published by the Free Software Foundation; under version 2
     * of the License (non-upgradable).
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     *
     * Copyright (c) 2019 Open Assessment Technologies SA ;
     */

    /**
     * Defines the provider for a hidden field widget.
     *
     * @example
     * import widgetHiddenProvider from 'ui/form/widget/providers/hidden';
     * widgetFactory.registerProvider('hidden', widgetHiddenProvider);
     * const widget = widgetFactory(container, {
     *     widget: 'hidden'
     *     uri: 'hiddenText',
     *     value: 'hidden value'
     * });
     *
     */
    const widgetHiddenProvider = {
      /**
       * Initialize the widget.
       * @param {widgetConfig} config
       */
      init(config) {
        // Simply set the type.
        config.widgetType = 'hidden';
      },
      /**
       * Gets access to the actual form element
       * @returns {jQuery}
       */
      getWidgetElement() {
        return this.getElement();
      },
      /**
       * Expose the template to the factory and it will apply it
       */
      template: hiddenTpl
    };

    return widgetHiddenProvider;

});
