define(["jquery","jquery-ui-modules/widget","jquery/jquery.parsequery"],function($){"use strict";$.widget("rsf.autoSelectSimple",{values:{},changed:false,_create:function(){if($('.product-options-wrapper').length){this._overrideDefaults();}},_overrideDefaults:function(){var hashIndex=window.location.href.indexOf('#');if(hashIndex!==-1){this._parseQueryParams(window.location.href.substr(hashIndex+1));} this._selectValuesByAttribute();if(this.changed==true){setTimeout(function(){$('.product-custom-option').trigger('change');},300);}},_parseQueryParams:function(queryString){var queryParams=$.parseQuery({query:queryString});$.each(queryParams,$.proxy(function(key,value){this.values[key]=value;},this));},_selectValuesByAttribute:function(){$.each(this.values,$.proxy(function(attributeId,optionId){if(!optionId){return;} var element=$("#select_"+attributeId);if(element.length){element.find("option[value="+optionId+"]").prop('selected',true);this.changed=true;return;} var element=$("#options-"+attributeId+"-list");if(element.length){var option=element.find("[value="+optionId+"]");if(option.length){if(option.prop("type")=='radio'||option.prop("type")=='checkbox'){option.prop('checked',true);this.changed=true;return;}}}},this));},});return $.feedForm;});