var visualOptionSelectorControl = elementor.modules.controls.BaseData.extend({ 
  onReady: function() {
    // Init variables
    this.rad_options = this.$el.find(".visual-option-item input[type='radio']");
    this.save_input  = this.$el.find(".visual-option-selector-value");

    if ( this.save_input.val() ) {
      for ( let i = 0; i < this.rad_options.length; i++ ) {
        if ( jQuery( this.rad_options[i] ).val() == this.save_input.val() ) {
          jQuery( this.rad_options[i] ).attr( "checked", "true");
          break;
        }
      }
    }

    this.rad_options.on( "change", () => this.saveValue() );
  },

  saveValue: function() {
    for ( let i = 0; i < this.rad_options.length; i++ ) {
      if ( this.rad_options[i].checked ) {
        this.setValue( jQuery( this.rad_options[i] ).val() );
        break;
      }
    }
  },

  onBeforeDestroy: function() {
    this.saveValue();
  }
});

elementor.addControlView( "rad-visual-option-selector", visualOptionSelectorControl );