From 1d34f91866e91eb97fb6bcfbb01d049794eb14e8 Mon Sep 17 00:00:00 2001 From: FreeScout Date: Mon, 30 Jul 2018 08:11:35 -0700 Subject: [PATCH] New conversation and reply --- app/Conversation.php | 61 +- app/Customer.php | 44 +- app/Email.php | 25 +- .../Controllers/ConversationsController.php | 333 +++ app/Http/Controllers/SecureController.php | 119 - app/Listeners/CreateThreadStatusChanged.php | 2 +- app/Mailbox.php | 14 + app/Observers/ThreadObserver.php | 1 + app/Thread.php | 33 + .../2018_07_09_052314_create_emails_table.php | 2 +- ...7_11_010333_create_conversations_table.php | 3 +- public/css/style.css | 106 +- public/js/laroute.js | 4 +- public/js/main.js | 155 +- public/js/parsley/i18n/al.js | 29 + public/js/parsley/i18n/ar.js | 29 + public/js/parsley/i18n/bg.js | 29 + public/js/parsley/i18n/ca.js | 29 + public/js/parsley/i18n/cs.extra.js | 13 + public/js/parsley/i18n/cs.js | 29 + public/js/parsley/i18n/da.js | 29 + public/js/parsley/i18n/de.extra.js | 13 + public/js/parsley/i18n/de.js | 29 + public/js/parsley/i18n/el.extra.js | 14 + public/js/parsley/i18n/el.js | 29 + public/js/parsley/i18n/en.extra.js | 14 + public/js/parsley/i18n/en.js | 30 + public/js/parsley/i18n/es.js | 30 + public/js/parsley/i18n/et.js | 29 + public/js/parsley/i18n/eu.js | 29 + public/js/parsley/i18n/fa.js | 29 + public/js/parsley/i18n/fi.extra.js | 6 + public/js/parsley/i18n/fi.js | 29 + public/js/parsley/i18n/fr.extra.js | 14 + public/js/parsley/i18n/fr.js | 29 + public/js/parsley/i18n/he.extra.js | 6 + public/js/parsley/i18n/he.js | 29 + public/js/parsley/i18n/hr.extra.js | 14 + public/js/parsley/i18n/hr.js | 29 + public/js/parsley/i18n/hu.extra.js | 14 + public/js/parsley/i18n/hu.js | 30 + public/js/parsley/i18n/id.extra.js | 6 + public/js/parsley/i18n/id.js | 29 + public/js/parsley/i18n/it.extra.js | 6 + public/js/parsley/i18n/it.js | 29 + public/js/parsley/i18n/ja.extra.js | 14 + public/js/parsley/i18n/ja.js | 29 + public/js/parsley/i18n/ko.js | 29 + public/js/parsley/i18n/lt.extra.js | 14 + public/js/parsley/i18n/lt.js | 29 + public/js/parsley/i18n/lv.extra.js | 14 + public/js/parsley/i18n/lv.js | 29 + public/js/parsley/i18n/ms.extra.js | 13 + public/js/parsley/i18n/ms.js | 29 + public/js/parsley/i18n/nl.extra.js | 11 + public/js/parsley/i18n/nl.js | 26 + public/js/parsley/i18n/no.js | 29 + public/js/parsley/i18n/pl.js | 29 + public/js/parsley/i18n/pt-br.js | 29 + public/js/parsley/i18n/pt-pt.js | 29 + public/js/parsley/i18n/ro.extra.js | 14 + public/js/parsley/i18n/ro.js | 29 + public/js/parsley/i18n/ru.extra.js | 14 + public/js/parsley/i18n/ru.js | 29 + public/js/parsley/i18n/sk.extra.js | 13 + public/js/parsley/i18n/sk.js | 29 + public/js/parsley/i18n/sl.extra.js | 14 + public/js/parsley/i18n/sl.js | 30 + public/js/parsley/i18n/sq.js | 29 + public/js/parsley/i18n/sr.extra.js | 14 + public/js/parsley/i18n/sr.js | 29 + public/js/parsley/i18n/sv.extra.js | 6 + public/js/parsley/i18n/sv.js | 29 + public/js/parsley/i18n/th.js | 29 + public/js/parsley/i18n/tk.js | 29 + public/js/parsley/i18n/tr.js | 29 + public/js/parsley/i18n/ua.extra.js | 14 + public/js/parsley/i18n/ua.js | 29 + public/js/parsley/i18n/uk.extra.js | 9 + public/js/parsley/i18n/uk.js | 29 + public/js/parsley/i18n/zh_cn.extra.js | 6 + public/js/parsley/i18n/zh_cn.js | 29 + public/js/parsley/i18n/zh_tw.js | 29 + public/js/parsley/parsley.js | 2494 +++++++++++++++++ public/js/parsley/parsley.js.map | 1 + public/js/parsley/parsley.min.js | 18 + public/js/parsley/parsley.min.js.map | 1 + public/js/vars.js | 5 + .../views/conversations/create.blade.php | 30 +- .../editor_bottom_toolbar.blade.php | 34 + resources/views/conversations/view.blade.php | 56 +- .../views/customers/profile_snippet.blade.php | 4 +- resources/views/js/vars.blade.php | 5 +- resources/views/layouts/app.blade.php | 2 +- .../views/mailboxes/settings_menu.blade.php | 2 +- resources/views/mailboxes/view.blade.php | 2 +- routes/web.php | 2 +- 97 files changed, 4923 insertions(+), 202 deletions(-) create mode 100644 public/js/parsley/i18n/al.js create mode 100644 public/js/parsley/i18n/ar.js create mode 100644 public/js/parsley/i18n/bg.js create mode 100644 public/js/parsley/i18n/ca.js create mode 100644 public/js/parsley/i18n/cs.extra.js create mode 100644 public/js/parsley/i18n/cs.js create mode 100644 public/js/parsley/i18n/da.js create mode 100644 public/js/parsley/i18n/de.extra.js create mode 100644 public/js/parsley/i18n/de.js create mode 100644 public/js/parsley/i18n/el.extra.js create mode 100644 public/js/parsley/i18n/el.js create mode 100644 public/js/parsley/i18n/en.extra.js create mode 100644 public/js/parsley/i18n/en.js create mode 100644 public/js/parsley/i18n/es.js create mode 100644 public/js/parsley/i18n/et.js create mode 100644 public/js/parsley/i18n/eu.js create mode 100644 public/js/parsley/i18n/fa.js create mode 100644 public/js/parsley/i18n/fi.extra.js create mode 100644 public/js/parsley/i18n/fi.js create mode 100644 public/js/parsley/i18n/fr.extra.js create mode 100644 public/js/parsley/i18n/fr.js create mode 100644 public/js/parsley/i18n/he.extra.js create mode 100644 public/js/parsley/i18n/he.js create mode 100644 public/js/parsley/i18n/hr.extra.js create mode 100644 public/js/parsley/i18n/hr.js create mode 100644 public/js/parsley/i18n/hu.extra.js create mode 100644 public/js/parsley/i18n/hu.js create mode 100644 public/js/parsley/i18n/id.extra.js create mode 100644 public/js/parsley/i18n/id.js create mode 100644 public/js/parsley/i18n/it.extra.js create mode 100644 public/js/parsley/i18n/it.js create mode 100644 public/js/parsley/i18n/ja.extra.js create mode 100644 public/js/parsley/i18n/ja.js create mode 100644 public/js/parsley/i18n/ko.js create mode 100644 public/js/parsley/i18n/lt.extra.js create mode 100644 public/js/parsley/i18n/lt.js create mode 100644 public/js/parsley/i18n/lv.extra.js create mode 100644 public/js/parsley/i18n/lv.js create mode 100644 public/js/parsley/i18n/ms.extra.js create mode 100644 public/js/parsley/i18n/ms.js create mode 100644 public/js/parsley/i18n/nl.extra.js create mode 100644 public/js/parsley/i18n/nl.js create mode 100644 public/js/parsley/i18n/no.js create mode 100644 public/js/parsley/i18n/pl.js create mode 100644 public/js/parsley/i18n/pt-br.js create mode 100644 public/js/parsley/i18n/pt-pt.js create mode 100644 public/js/parsley/i18n/ro.extra.js create mode 100644 public/js/parsley/i18n/ro.js create mode 100644 public/js/parsley/i18n/ru.extra.js create mode 100644 public/js/parsley/i18n/ru.js create mode 100644 public/js/parsley/i18n/sk.extra.js create mode 100644 public/js/parsley/i18n/sk.js create mode 100644 public/js/parsley/i18n/sl.extra.js create mode 100644 public/js/parsley/i18n/sl.js create mode 100644 public/js/parsley/i18n/sq.js create mode 100644 public/js/parsley/i18n/sr.extra.js create mode 100644 public/js/parsley/i18n/sr.js create mode 100644 public/js/parsley/i18n/sv.extra.js create mode 100644 public/js/parsley/i18n/sv.js create mode 100644 public/js/parsley/i18n/th.js create mode 100644 public/js/parsley/i18n/tk.js create mode 100644 public/js/parsley/i18n/tr.js create mode 100644 public/js/parsley/i18n/ua.extra.js create mode 100644 public/js/parsley/i18n/ua.js create mode 100644 public/js/parsley/i18n/uk.extra.js create mode 100644 public/js/parsley/i18n/uk.js create mode 100644 public/js/parsley/i18n/zh_cn.extra.js create mode 100644 public/js/parsley/i18n/zh_cn.js create mode 100644 public/js/parsley/i18n/zh_tw.js create mode 100644 public/js/parsley/parsley.js create mode 100644 public/js/parsley/parsley.js.map create mode 100644 public/js/parsley/parsley.min.js create mode 100644 public/js/parsley/parsley.min.js.map create mode 100644 resources/views/conversations/editor_bottom_toolbar.blade.php diff --git a/app/Conversation.php b/app/Conversation.php index 43f05820..32d74a57 100644 --- a/app/Conversation.php +++ b/app/Conversation.php @@ -3,6 +3,8 @@ namespace App; use Illuminate\Database\Eloquent\Model; +use App\Customer; +use App\Email; class Conversation extends Model { @@ -198,15 +200,16 @@ class Conversation extends Model { $this->preview = ''; - if ($text) { - $this->preview = mb_substr($text, 0, self::PREVIEW_MAXLENGTH); - } else { + if (!$text) { $first_thread = $this->threads()->first(); if ($first_thread) { - $this->preview = mb_substr($first_thread->body, 0, self::PREVIEW_MAXLENGTH); + $text = $first_thread->body; } } + $text = strip_tags($text); + $this->preview = mb_substr($text, 0, self::PREVIEW_MAXLENGTH); + return $this->preview; } @@ -390,4 +393,54 @@ class Conversation extends Model $this->folder_id = $folder->id; } } + + /** + * Set CC as JSON. + */ + public function setCc($emails) + { + $emails_array = self::sanitizeEmails($emails); + if ($emails_array) { + $this->cc = json_encode($emails_array); + } else { + $this->cc = null; + } + } + + /** + * Set BCC as JSON. + */ + public function setBcc( $emails) + { + $emails_array = self::sanitizeEmails($emails); + if ($emails_array) { + $this->bcc = json_encode($emails_array); + } else { + $this->bcc = null; + } + } + + /** + * Convert list of email to array. + * + * @return + */ + public static function sanitizeEmails($emails) + { + $emails_array = []; + + if (is_array($emails)) { + $emails_array = $emails; + } else { + $emails_array = explode(',', $emails); + } + + foreach ($emails_array as $i => $email) { + $emails_array[$i] = Email::sanitizeEmail($email); + if (!$emails_array[$i]) { + unset($emails_array[$i]); + } + } + return $emails_array; + } } diff --git a/app/Customer.php b/app/Customer.php index c5765607..fe5adbe6 100644 --- a/app/Customer.php +++ b/app/Customer.php @@ -3,6 +3,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; +use App\Email; class Customer extends Model { @@ -459,15 +460,16 @@ class Customer extends Model * * @return string */ - public function getFullName() + public function getFullName($email_if_empty = false) { if ($this->first_name || $this->last_name) { return $this->first_name.' '.$this->last_name; - } elseif ($this->emails) { - return explode('@', $this->emails[0]->email)[0]; - } else { - return $this->id; + } elseif ($email_if_empty) { + if (count($this->emails)) { + return explode('@', $this->emails[0]->email)[0]; + } } + return ''; } /** @@ -610,4 +612,36 @@ class Customer extends Model } $this->websites = json_encode($websites); } + + /** + * Create customer or get existing. + * + * @param string $email + * @param array $data [description] + * @return [type] [description] + */ + public static function create($email, $data = []) + { + $email = Email::sanitizeEmail($email); + if (!$email) { + return null; + } + $email_obj = Email::where('email', $email)->first(); + if ($email_obj) { + $customer = $email_obj->customer; + } else { + $customer = new Customer(); + $email_obj = new Email(); + $email_obj->email = $email; + } + $customer->fill($data); + $customer->save(); + + if (empty($email_obj->id) || !$email_obj->customer_id) { + $email_obj->customer()->associate($customer); + $email_obj->save(); + } + + return $customer; + } } diff --git a/app/Email.php b/app/Email.php index f8fa2d5a..c07c33c7 100644 --- a/app/Email.php +++ b/app/Email.php @@ -9,9 +9,15 @@ class Email extends Model /** * Email types. */ - const TYPE_WORK = 'work'; - const TYPE_HOME = 'home'; - const TYPE_OTHER = 'other'; + const TYPE_WORK = 1; + const TYPE_HOME = 2; + const TYPE_OTHER = 3; + + public static $types = [ + self::TYPE_WORK => 'work', + self::TYPE_HOME => 'home', + self::TYPE_OTHER => 'other', + ]; public $timestamps = false; @@ -29,17 +35,18 @@ class Email extends Model } /** - * Sanatize email address. - * - * @param string $email - * + * Sanitize email address. + * + * @param string $email * @return string */ - public static function sanatizeEmail($email) + public static function sanitizeEmail($email) { + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + return false; + } $email = filter_var($email, FILTER_SANITIZE_EMAIL); $email = strtolower($email); - return $email; } } diff --git a/app/Http/Controllers/ConversationsController.php b/app/Http/Controllers/ConversationsController.php index 0a891451..466d5577 100644 --- a/app/Http/Controllers/ConversationsController.php +++ b/app/Http/Controllers/ConversationsController.php @@ -3,8 +3,14 @@ namespace App\Http\Controllers; use App\Conversation; +use App\Customer; use App\Folder; use App\Mailbox; +use App\Thread; +use Validator; +use Illuminate\Http\Request; +use App\Events\ConversationStatusChanged; +use App\Events\ConversationUserChanged; class ConversationsController extends Controller { @@ -74,4 +80,331 @@ class ConversationsController extends Controller 'folders' => $conversation->mailbox->getAssesibleFolders(), ]); } + + /** + * Save new conversation. + */ + /*public function createSave($mailbox_id, Request $request) + { + $mailbox = Mailbox::findOrFail($mailbox_id); + $this->authorize('view', $mailbox); + + $validator = Validator::make($request->all(), [ + 'to' => 'required|string', + 'subject' => 'required|string|max:998', + 'body' => 'required|string', + 'cc' => 'nullable|string', + 'bcc' => 'nullable|string', + ]); + + if ($validator->fails()) { + return redirect()->route('conversations.create', ['mailbox_id' => $mailbox_id]) + ->withErrors($validator) + ->withInput(); + } + + $to_array = Conversation::sanitizeEmails($request->to); + + // Check if there are any emails + if (!$to_array) { + return redirect()->route('conversations.create', ['mailbox_id' => $mailbox_id]) + ->withErrors(['to' => __('Incorrect recipients')]) + ->withInput(); + } + + $now = date('Y-m-d H:i:s'); + $customer = Customer::create($to_array[0]); + + $conversation = new Conversation(); + $conversation->type = Conversation::TYPE_EMAIL; + $conversation->status = $request->status; + $conversation->state = Conversation::STATE_PUBLISHED; + $conversation->subject = $request->subject; + $conversation->setCc($request->cc); + $conversation->setBcc($request->bcc); + $conversation->setPreview($request->body); + // todo: attachments + //$conversation->has_attachments = ; + // Set folder id + $conversation->mailbox_id = $mailbox_id; + if ((int)$request->user_id != -1) { + // Check if user has access to the current mailbox + if ($mailbox->userHasAccess($request->user_id)) { + $conversation->user_id = $request->user_id; + } + } + + $conversation->customer_id = $customer->id; + $conversation->created_by_user_id = auth()->user()->id; + $conversation->source_via = Conversation::PERSON_USER; + $conversation->source_type = Conversation::SOURCE_TYPE_WEB; + $conversation->user_updated_at = $now; + $conversation->last_reply_at = $now; + $conversation->last_reply_from = Conversation::PERSON_USER; + $conversation->updateFolder(); + $conversation->save(); + + // Create thread + $thread = new Thread(); + $thread->conversation_id = $conversation->id; + $thread->user_id = auth()->user()->id; + $thread->type = Thread::TYPE_MESSAGE; + $thread->status = $request->status; + $thread->state = Thread::STATE_PUBLISHED; + $thread->body = $request->body; + $thread->setTo($request->to); + $thread->setCc($request->cc); + $thread->setBcc($request->bcc); + $thread->source_via = Thread::PERSON_USER; + $thread->source_type = Thread::SOURCE_TYPE_WEB; + $thread->customer_id = $customer->id; + $thread->created_by_user_id = auth()->user()->id; + $thread->save(); + + return redirect()->route('conversations.view', ['id' => $conversation->id]); + }*/ + + /** + * Conversations ajax controller. + */ + public function ajax(Request $request) + { + $response = [ + 'status' => 'error', + 'msg' => '', + ]; + + $user = auth()->user(); + + switch ($request->action) { + + // Change conversation user + case 'conversation_change_user': + $conversation = Conversation::find($request->conversation_id); + + $new_user_id = (int) $request->user_id; + + if (!$conversation) { + $response['msg'] = __('Conversation not found'); + } + if (!$response['msg'] && $conversation->user_id == $new_user_id) { + $response['msg'] = __('Assignee already set'); + } + if (!$response['msg'] && !$user->can('update', $conversation)) { + $response['msg'] = __('Not enough permissions'); + } + if (!$response['msg'] && (int) $new_user_id != -1 && !in_array($new_user_id, $conversation->mailbox->userIdsHavingAccess())) { + $response['msg'] = __('Incorrect user'); + } + if (!$response['msg']) { + // Next conversation has to be determined before updating status for current one + $next_conversation = $conversation->getNearby(); + + $conversation->setUser($new_user_id); + $conversation->save(); + + event(new ConversationUserChanged($conversation)); + + $response['status'] = 'success'; + + // Flash + $flash_message = __('Assignee updated'); + if ($new_user_id != $user->id) { + $flash_message .= ' '.__('View').''; + + if ($next_conversation) { + $response['redirect_url'] = route('conversations.view', ['id' => $next_conversation->id]); + } else { + // Show conversations list + $response['redirect_url'] = route('mailboxes.view.folder', ['id' => $conversation->mailbox_id, 'folder_id' => $conversation->folder_id]); + } + } + \Session::flash('flash_success_floating', $flash_message); + + $response['msg'] = __('Assignee updated'); + } + break; + + // Change conversation status + case 'conversation_change_status': + $conversation = Conversation::find($request->conversation_id); + + $new_status = (int) $request->status; + + if (!$conversation) { + $response['msg'] = __('Conversation not found'); + } + if (!$response['msg'] && $conversation->status == $new_status) { + $response['msg'] = __('Status already set'); + } + if (!$response['msg'] && !$user->can('update', $conversation)) { + $response['msg'] = __('Not enough permissions'); + } + if (!$response['msg'] && !in_array((int) $request->status, array_keys(Conversation::$statuses))) { + $response['msg'] = __('Incorrect status'); + } + if (!$response['msg']) { + // Next conversation has to be determined before updating status for current one + $next_conversation = $conversation->getNearby(); + + $conversation->setStatus($new_status, $user); + $conversation->save(); + + event(new ConversationStatusChanged($conversation)); + + $response['status'] = 'success'; + + // Flash + $flash_message = __('Status updated'); + if ($new_status != Conversation::STATUS_ACTIVE) { + $flash_message .= ' '.__('View').''; + + if ($next_conversation) { + $response['redirect_url'] = route('conversations.view', ['id' => $next_conversation->id]); + } else { + // Show conversations list + $response['redirect_url'] = route('mailboxes.view.folder', ['id' => $conversation->mailbox_id, 'folder_id' => $conversation->folder_id]); + } + } + \Session::flash('flash_success_floating', $flash_message); + + $response['msg'] = __('Status updated'); + } + break; + + // Send reply or new conversation + case 'send_reply': + + $mailbox = Mailbox::findOrFail($request->mailbox_id); + + if (!$response['msg'] && !$user->can('view', $mailbox)) { + $response['msg'] = __('Not enough permissions'); + } + + $conversation = null; + if (!$response['msg'] && !empty($request->conversation_id)) { + $conversation = Conversation::find($request->conversation_id); + if ($conversation && !$user->can('view', $conversation)) { + $response['msg'] = __('Not enough permissions'); + } + } + + $new = false; + if (empty($request->conversation_id)) { + $new = true; + } + + if (!$response['msg']) { + $validator = Validator::make($request->all(), [ + 'to' => 'required|string', + 'subject' => 'required|string|max:998', + 'body' => 'required|string', + 'cc' => 'nullable|string', + 'bcc' => 'nullable|string', + ]); + + if ($validator->fails()) { + foreach ($validator->errors() as $errors) { + foreach ($errors as $field => $message) { + $response['msg'] .= $message.' '; + } + } + // return redirect()->route('conversations.create', ['mailbox_id' => $mailbox_id]) + // ->withErrors($validator) + // ->withInput(); + } + } + + if (!$response['msg'] && $new) { + $to_array = Conversation::sanitizeEmails($request->to); + + // Check if there are any emails + if (!$to_array) { + $response['msg'] .= __('Incorrect recipients'); + // return redirect()->route('conversations.create', ['mailbox_id' => $mailbox_id]) + // ->withErrors(['to' => __('Incorrect recipients')]) + // ->withInput(); + } + } + + if (!$response['msg']) { + $now = date('Y-m-d H:i:s'); + + if ($new) { + // New conversation + $customer = Customer::create($to_array[0]); + + $conversation = new Conversation(); + $conversation->type = Conversation::TYPE_EMAIL; + $conversation->status = $request->status; + $conversation->state = Conversation::STATE_PUBLISHED; + $conversation->subject = $request->subject; + $conversation->setCc($request->cc); + $conversation->setBcc($request->bcc); + $conversation->setPreview($request->body); + // todo: attachments + //$conversation->has_attachments = ; + // Set folder id + $conversation->mailbox_id = $request->mailbox_id; + $conversation->customer_id = $customer->id; + $conversation->created_by_user_id = auth()->user()->id; + $conversation->source_via = Conversation::PERSON_USER; + $conversation->source_type = Conversation::SOURCE_TYPE_WEB; + } else { + $customer = $conversation->customer; + } + $conversation->status = $request->status; + if ((int)$request->user_id != -1) { + // Check if user has access to the current mailbox + if ($mailbox->userHasAccess($request->user_id)) { + $conversation->user_id = $request->user_id; + } + } else { + $conversation->user_id = null; + } + $conversation->last_reply_at = $now; + $conversation->last_reply_from = Conversation::PERSON_USER; + $conversation->user_updated_at = $now; + $conversation->updateFolder(); + $conversation->save(); + + // Create thread + $thread = new Thread(); + $thread->conversation_id = $conversation->id; + $thread->user_id = auth()->user()->id; + $thread->type = Thread::TYPE_MESSAGE; + $thread->status = $request->status; + $thread->state = Thread::STATE_PUBLISHED; + $thread->body = $request->body; + $thread->setTo($request->to); + $thread->setCc($request->cc); + $thread->setBcc($request->bcc); + $thread->source_via = Thread::PERSON_USER; + $thread->source_type = Thread::SOURCE_TYPE_WEB; + $thread->customer_id = $customer->id; + $thread->created_by_user_id = auth()->user()->id; + $thread->save(); + + $response['status'] = 'success'; + $response['redirect_url'] = route('conversations.view', ['id' => $conversation->id]); + + $flash_message = __( + ':%tag_start%Email Sent:%tag_end% :%view_start%View:%a_end% or :%undo_start%Undo:%a_end%', + ['%tag_start%' => '', '%tag_end%' => '', '%view_start%' => ' ', '%a_end%' => ' ', '%undo_start%' => ' '] + ); + + \Session::flash('flash_success_floating', $flash_message); + } + break; + default: + $response['msg'] = 'Unknown action'; + break; + } + + if ($response['status'] == 'error' && empty($response['msg'])) { + $response['msg'] = 'Unknown error occured'; + } + + return \Response::json($response); + } } diff --git a/app/Http/Controllers/SecureController.php b/app/Http/Controllers/SecureController.php index bd6a27d0..b860a8d6 100644 --- a/app/Http/Controllers/SecureController.php +++ b/app/Http/Controllers/SecureController.php @@ -4,8 +4,6 @@ namespace App\Http\Controllers; use App\ActivityLog; use App\Conversation; -use App\Events\ConversationStatusChanged; -use App\Events\ConversationUserChanged; use Illuminate\Http\Request; class SecureController extends Controller @@ -76,121 +74,4 @@ class SecureController extends Controller return view('secure/logs', ['logs' => $logs, 'names' => $names, 'current_name' => $current_name, 'cols' => $cols]); } - - public function ajax(Request $request) - { - $response = [ - 'status' => 'error', - 'msg' => '', - ]; - - $user = auth()->user(); - - switch ($request->action) { - - // Change conversation user - case 'conversation_change_user': - $conversation = Conversation::find($request->conversation_id); - - $new_user_id = (int) $request->user_id; - - if (!$conversation) { - $response['msg'] = 'Conversation not found'; - } - if (!$response['msg'] && $conversation->user_id == $new_user_id) { - $response['msg'] = 'Assignee already set'; - } - if (!$response['msg'] && !$user->can('update', $conversation)) { - $response['msg'] = 'Not enough permissions'; - } - if (!$response['msg'] && (int) $new_user_id != -1 && !in_array($new_user_id, $conversation->mailbox->userIdsHavingAccess())) { - $response['msg'] = 'Incorrect user'; - } - if (!$response['msg']) { - // Next conversation has to be determined before updating status for current one - $next_conversation = $conversation->getNearby(); - - $conversation->setUser($new_user_id); - $conversation->save(); - - event(new ConversationUserChanged($conversation)); - - $response['status'] = 'success'; - - // Flash - $flash_message = __('Assignee updated'); - if ($new_user_id != $user->id) { - $flash_message .= ' '.__('View').''; - - if ($next_conversation) { - $response['redirect_url'] = route('conversations.view', ['id' => $next_conversation->id]); - } else { - // Show conversations list - $response['redirect_url'] = route('mailboxes.view.folder', ['id' => $conversation->mailbox_id, 'folder_id' => $conversation->folder_id]); - } - } - \Session::flash('flash_success_floating', $flash_message); - - $response['msg'] = __('Assignee updated'); - } - break; - - // Change conversation status - case 'conversation_change_status': - $conversation = Conversation::find($request->conversation_id); - - $new_status = (int) $request->status; - - if (!$conversation) { - $response['msg'] = 'Conversation not found'; - } - if (!$response['msg'] && $conversation->status == $new_status) { - $response['msg'] = 'Status already set'; - } - if (!$response['msg'] && !$user->can('update', $conversation)) { - $response['msg'] = 'Not enough permissions'; - } - if (!$response['msg'] && !in_array((int) $request->status, array_keys(Conversation::$statuses))) { - $response['msg'] = 'Incorrect status'; - } - if (!$response['msg']) { - // Next conversation has to be determined before updating status for current one - $next_conversation = $conversation->getNearby(); - - $conversation->setStatus($new_status, $user); - $conversation->save(); - - event(new ConversationStatusChanged($conversation)); - - $response['status'] = 'success'; - - // Flash - $flash_message = __('Status updated'); - if ($new_status != Conversation::STATUS_ACTIVE) { - $flash_message .= ' '.__('View').''; - - if ($next_conversation) { - $response['redirect_url'] = route('conversations.view', ['id' => $next_conversation->id]); - } else { - // Show conversations list - $response['redirect_url'] = route('mailboxes.view.folder', ['id' => $conversation->mailbox_id, 'folder_id' => $conversation->folder_id]); - } - } - \Session::flash('flash_success_floating', $flash_message); - - $response['msg'] = __('Status updated'); - } - break; - - default: - $response['msg'] = 'Unknown action'; - break; - } - - if ($response['status'] == 'error' && empty($response['msg'])) { - $response['msg'] = 'Unknown error occured'; - } - - return \Response::json($response); - } } diff --git a/app/Listeners/CreateThreadStatusChanged.php b/app/Listeners/CreateThreadStatusChanged.php index c6e3a2a8..b49af52e 100644 --- a/app/Listeners/CreateThreadStatusChanged.php +++ b/app/Listeners/CreateThreadStatusChanged.php @@ -31,7 +31,7 @@ class CreateThreadStatusChanged $thread->user_id = $event->conversation->user_id; $thread->type = Thread::TYPE_LINEITEM; $thread->state = Thread::STATE_PUBLISHED; - $thread->status = $conversation->status; + $thread->status = $event->conversation->status; $thread->action_type = Thread::ACTION_TYPE_STATUS_CHANGED; $thread->source_via = Thread::PERSON_USER; // todo: this need to be changed for API diff --git a/app/Mailbox.php b/app/Mailbox.php index d9e88c4b..45f4898a 100644 --- a/app/Mailbox.php +++ b/app/Mailbox.php @@ -282,4 +282,18 @@ class Mailbox extends Model return $user_ids->merge($admin_ids)->unique()->toArray(); } + + /** + * Check if user has access to the mailbox. + * @return bool + */ + public function userHasAccess($user_id) + { + $user = User::find($user_id); + if ($user && $user->isAdmin()) { + return true; + } else { + return (bool)$this->users()->where('users.id', $user_id)->count(); + } + } } diff --git a/app/Observers/ThreadObserver.php b/app/Observers/ThreadObserver.php index a0589700..b9785f88 100644 --- a/app/Observers/ThreadObserver.php +++ b/app/Observers/ThreadObserver.php @@ -2,6 +2,7 @@ namespace App\Observers; +use App\Conversation; use App\Thread; class ThreadObserver diff --git a/app/Thread.php b/app/Thread.php index 1d58834c..3399e59d 100644 --- a/app/Thread.php +++ b/app/Thread.php @@ -236,6 +236,39 @@ class Thread extends Model } } + /** + * Set to as JSON. + */ + public function setTo($emails) + { + $emails_array = Conversation::sanitizeEmails($emails); + if ($emails_array) { + $this->to = json_encode($emails_array); + } else { + $this->to = null; + } + } + + public function setCc($emails) + { + $emails_array = Conversation::sanitizeEmails($emails); + if ($emails_array) { + $this->cc = json_encode($emails_array); + } else { + $this->cc = null; + } + } + + public function setBcc($emails) + { + $emails_array = Conversation::sanitizeEmails($emails); + if ($emails_array) { + $this->bcc = json_encode($emails_array); + } else { + $this->bcc = null; + } + } + /** * Get thread's status name. * diff --git a/database/migrations/2018_07_09_052314_create_emails_table.php b/database/migrations/2018_07_09_052314_create_emails_table.php index f616b639..de32f475 100644 --- a/database/migrations/2018_07_09_052314_create_emails_table.php +++ b/database/migrations/2018_07_09_052314_create_emails_table.php @@ -21,7 +21,7 @@ class CreateEmailsTable extends Migration // SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes $table->string('email', 191)->unique(); // Type is not used in the web interface, but appears in API - $table->string('type', 5)->default(Email::TYPE_WORK); + $table->unsignedTinyInteger('type')->default(Email::TYPE_WORK); }); } diff --git a/database/migrations/2018_07_11_010333_create_conversations_table.php b/database/migrations/2018_07_11_010333_create_conversations_table.php index 33d447fb..fbe0656b 100644 --- a/database/migrations/2018_07_11_010333_create_conversations_table.php +++ b/database/migrations/2018_07_11_010333_create_conversations_table.php @@ -20,6 +20,7 @@ class CreateConversationsTable extends Migration // Conversation Number $table->unsignedInteger('number'); // Number of threads the conversation has + // Lineitems and notes are not counted $table->unsignedInteger('threads_count')->default(0); $table->unsignedTinyInteger('type'); $table->integer('folder_id'); @@ -54,7 +55,7 @@ class CreateConversationsTable extends Migration $table->timestamp('closed_at')->nullable(); // UTC time when the last user update occurred $table->timestamp('user_updated_at')->nullable(); - // customerWaitingSince + // customerWaitingSince - reply by customer or user $table->timestamp('last_reply_at')->nullable(); // Whether the last reply was from a user or a customer $table->unsignedTinyInteger('last_reply_from')->nullable(); diff --git a/public/css/style.css b/public/css/style.css index 41c83689..921598f5 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -391,23 +391,29 @@ select.form-control { border-color: #4f5d69; } .btn-success.btn-light { - background-color: #81c981; + background-color: #71c171; } .btn-success.btn-light:hover { - background-color: #449d44; + background-color: #57b357; } .btn-warning.btn-light { - background-color: #f2b967; + background-color: #f2b661; } .btn-warning.btn-light:hover { background-color: #ec971f; } .btn-danger.btn-light { - background-color: #e27c78; + background-color: #de6864; } .btn-danger.btn-light:hover { background-color: #c9302c; } +.has-error.help-block { + color: #a94442; +} +.has-error .form-control[data-parsley-exclude="true"] { + border-color: #ccc; +} /** * Cards @@ -620,9 +626,12 @@ a h4 { background-color: #e6e6e6; border-color: #e6e6e6; } +.note-editor.panel { + margin: 0; +} .note-btn i.glyphicon { position: relative; - top: 3px; + top: 2px; } .note-btn.btn-sm { font-size: 14px; @@ -634,6 +643,40 @@ a h4 { .note-actions .note-btn:first-child { font-size: 16px; } +.note-editor.note-frame .note-statusbar.note-statusbar-toolbar { + border-top: 1px solid #ddd; + background-color: #f9fafa; + text-align: right; + color: #72808e; +} +.note-bottom-div { + margin: 0 8px; + color: #c1cbd4; + font-size: 9px; +} +.btn-group-send { + margin-left: 12px; + margin-top: -1px; + margin-bottom: -1px; +} +.btn-group-send .btn { + height: 38px; +} +.btn-send-menu { + padding-left: 8px; + padding-right: 8px; + font-size: 9px; + border-left-color: #659ac8; +} +.btn-send-text { + min-width: 94px; +} +.note-statusbar-toolbar select.form-control { + height: 24px; + line-height: 24px; + padding-top: 2px; + padding-bottom: 1px; +} /** * Customer @@ -1050,13 +1093,18 @@ table.table-conversations td.conv-attachment { .conv-actions .conv-action:hover { color: #394956; } +.conv-action.inactive { + color: #aeb6c0; +} .conv-action.dropdown { padding: 0!important; } #conv-subject { - padding: 16px 9px 24px 20px; border-bottom: 1px solid #e3e8eb; } +.conv-subj-block { + padding: 16px 9px 24px 20px; +} .conv-subjwrap { padding-right: 145px; position: relative; @@ -1315,6 +1363,34 @@ table.table-conversations td.conv-attachment { .conv-block { margin: 0 20px; } +.conv-block.conv-reply-block { + margin-top: -7px; + margin-bottom: 12px; +} +.conv-reply-block .form-group { + margin-bottom: 5px; +} +.conv-reply-block .form-group label { + width: 33px; + padding-right: 0; + padding-left: 0px; +} +.conv-reply-block .form-group input { + max-width: 600px; + min-width: 150px; +} +.conv-reply-block .control-label { + float: left; + text-align: right; +} +.conv-reply-body { + margin-top: 13px; +} +.conv-reply-field { + padding-left: 10px; + float: left; + width: 68%; +} @media (max-width:700px) { .conv-info .btn-group button.conv-info-val span:first-child { display: none!important; @@ -1329,7 +1405,7 @@ table.table-conversations td.conv-attachment { .conv-subjtext { font-size: 20px; } - #conv-subject { + .conv-subj-block { padding: 16px 2px 24px 13px; } .conv-customer-block { @@ -1383,6 +1459,9 @@ table.table-conversations td.conv-attachment { .conv-block { margin: 0 13px; } + .conv-reply-field { + width: 80%; + } } @media (max-width:1100px) { #conv-layout-header, @@ -1398,6 +1477,9 @@ table.table-conversations td.conv-attachment { #conv-layout-customer { border-bottom: 1px solid #e3e8eb; } + .customer-snippet { + min-height: 46px; + } .customer-snippet, .conv-sidebar-block { padding: 0; @@ -1417,7 +1499,7 @@ table.table-conversations td.conv-attachment { box-shadow: 0 1px 2px rgba(0,0,0,.2); } .conv-customer-block { - padding: 15px 20px 12px; + padding: 15px 20px 15px; } .customer-data { margin: 0 0 0 45px; @@ -1538,6 +1620,9 @@ table.table-conversations td.conv-attachment { box-shadow: 4px 4px 12px rgba(0, 0, 0, .175); cursor: default; } +.alert-floating.alert-danger { + position: fixed; +} .alert-floating .glyphicon { margin-right: 8px; position: relative; @@ -1823,4 +1908,9 @@ a.help-icon:hover { background: url('../img/loader-main.gif') 50% 50% no-repeat transparent; opacity: 0.90; filter: alpha(opacity=90); /* For IE8 and earlier */ +} +a.text-danger, +a.text-danger:hover, +a.text-danger:focus { + color: #cc1f19!important; } \ No newline at end of file diff --git a/public/js/laroute.js b/public/js/laroute.js index 76f0dede..3ef5ec79 100644 --- a/public/js/laroute.js +++ b/public/js/laroute.js @@ -8,8 +8,8 @@ rootUrl: '', routes : [ { - "uri": "ajax", - "name": "ajax" + "uri": "conversation\/ajax", + "name": "conversations.ajax" } ], prefix: '', diff --git a/public/js/main.js b/public/js/main.js index 84e6fb4d..902feb18 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -1,4 +1,28 @@ var fs_sidebar_menu_applied = false; +var fs_loader_timeout; +// Default validation options +// https://devhints.io/parsley +window.ParsleyConfig = window.ParsleyConfig || {}; +$.extend(window.ParsleyConfig, { + excluded: '.note-codable, [data-parsley-exclude]', + errorClass: 'has-error', + //successClass: 'has-success', + classHandler: function(ParsleyField) { + return ParsleyField.$element.parents('.form-group:first'); + }, + errorsContainer: function(ParsleyField) { + var help_block = ParsleyField.$element.parent().children('.help-block:first'); + + if (help_block) { + return help_block; + } else { + return ParsleyField.$element; + //return ParsleyField.$element.parents('.form-group:first'); + } + }, + errorsWrapper: '
', + errorTemplate: '
' +}); // Configuring editor var EditorAttachmentButton = function (context) { @@ -21,7 +45,7 @@ var EditorSavedRepliesButton = function (context) { // create button var button = ui.button({ - contents: '', + contents: '', tooltip: Lang.get("messages.saved_replies"), container: 'body', click: function () { @@ -96,13 +120,15 @@ function mailboxUpdateInit(from_name_custom) // https://www.kerneldev.com/2018/01/11/using-summernote-wysiwyg-editor-with-laravel/ // https://gist.github.com/abr4xas/22caf07326a81ecaaa195f97321da4ae $('#signature').summernote({ - height: 120, + minHeight: 120, dialogsInBody: true, + disableResizeEditor: true, toolbar: [ // [groupName, [list of button]] ['style', ['bold', 'italic', 'underline', 'ul', 'ol', 'link', 'codeview']], ] }); + $('.note-statusbar').remove(); $('#from_name').change(function(event) { if ($(this).val() == from_name_custom) { @@ -183,10 +209,8 @@ function multiInputInit() } ); } -function fsAjax(data, success_callback, error_callback, no_loader) +function fsAjax(data, url, success_callback, error_callback, no_loader) { - var url = laroute.route('ajax'); - // Setup AJAX $.ajaxSetup({ headers: { @@ -195,13 +219,14 @@ function fsAjax(data, success_callback, error_callback, no_loader) }); // Show loader if (typeof(no_loader) == "undefined" || !no_loader) { - fsLoaderShow(); + fsLoaderShow(true); } if (typeof(error_callback) == "undefined" || !error_callback) { error_callback = function() { fsShowFloatingAlert('error', Lang.get("messages.ajax_error")); fsLoaderHide(); + $("button[data-loading-text!='']:disabled").button('reset'); }; } @@ -215,14 +240,22 @@ function fsAjax(data, success_callback, error_callback, no_loader) }); } -function fsLoaderShow() +// Show loader +function fsLoaderShow(delay) { - $("#loader-main").show(); + if (typeof(delay) != "undefined" && delay) { + fs_loader_timeout = setTimeout(function() { + $("#loader-main").show(); + }, 1000); + } else { + $("#loader-main").show(); + } } function fsLoaderHide() { $("#loader-main").hide(); + clearTimeout(fs_loader_timeout); } // Display floating alerts @@ -273,7 +306,9 @@ function conversationInit() action: 'conversation_change_user', user_id: $(this).attr('data-user_id'), conversation_id: fsGetGlobalAttr('conversation_id') - }, function(response) { + }, + laroute.route('conversations.ajax'), + function(response) { if (typeof(response.status) != "undefined" && response.status == 'success') { if (typeof(response.redirect_url) != "undefined") { window.location.href = response.redirect_url; @@ -298,7 +333,9 @@ function conversationInit() action: 'conversation_change_status', status: $(this).attr('data-status'), conversation_id: fsGetGlobalAttr('conversation_id') - }, function(response) { + }, + laroute.route('conversations.ajax'), + function(response) { if (typeof(response.status) != "undefined" && response.status == 'success') { if (typeof(response.redirect_url) != "undefined") { window.location.href = response.redirect_url; @@ -315,6 +352,20 @@ function conversationInit() } e.preventDefault(); }); + + // Reply + jQuery(".conv-reply").click(function(e){ + if ($(".conv-reply-block").hasClass('hidden')) { + $(".conv-action-block").addClass('hidden'); + $(".conv-reply-block").removeClass('hidden'); + $(".conv-action").addClass('inactive'); + $(this).removeClass('inactive'); + } else { + $(".conv-action-block").addClass('hidden'); + $(".conv-action").removeClass('inactive'); + } + e.preventDefault(); + }); }); } @@ -323,31 +374,81 @@ function fsGetGlobalAttr(attr) return $("body:first").attr('data-'+attr); } +// Initialize conversation body editor +function convEditorInit() +{ + $('#body').summernote({ + minHeight: 200, + dialogsInBody: true, + dialogsFade: true, + disableResizeEditor: true, + toolbar: [ + // [groupName, [list of button]] + ['style', ['attachment', 'bold', 'italic', 'underline', 'ul', 'ol', 'link', 'picture', 'codeview', 'savedreplies']], + ['actions', ['savedraft', 'discard']], + ], + buttons: { + attachment: EditorAttachmentButton, + savedreplies: EditorSavedRepliesButton, + savedraft: EditorSaveDraftButton, + discard: EditorDiscardButton + } + }); + var html = $('#editor_bottom_toolbar').html(); + $('.note-statusbar').addClass('note-statusbar-toolbar form-inline').html(html); +} + // New conversation page function newConversationInit() { $(document).ready(function() { - $('#body').summernote({ - height: 120, - dialogsInBody: true, - dialogsFade: true, - toolbar: [ - // [groupName, [list of button]] - ['style', ['attachment', 'bold', 'italic', 'underline', 'ul', 'ol', 'link', 'picture', 'codeview', 'savedreplies']], - ['actions', ['savedraft', 'discard']], - ], - buttons: { - attachment: EditorAttachmentButton, - savedreplies: EditorSavedRepliesButton, - savedraft: EditorSaveDraftButton, - discard: EditorDiscardButton - } - }); + convEditorInit(); $('.toggle-cc a:first').click(function() { $('.field-cc').removeClass('hidden'); $(this).parent().remove(); }); + + $('.dropdown-after-send a').click(function() { + $('.dropdown-after-send li').removeClass('active'); + $(this).parent().addClass('active'); + alert('todo: implement choosing action after sending a message'); + }); + + // Send reply or new conversation + jQuery(".btn-send-text").click(function(e){ + var button = $(this); + + // Validate before sending + form = $(".form-reply:first"); + + if (!form.parsley().validate()) { + return; + } + + button.button('loading'); + + data = form.serialize(); + data += '&action=send_reply'; + + fsAjax(data, laroute.route('conversations.ajax'), function(response) { + if (typeof(response.status) != "undefined" && response.status == 'success') { + if (typeof(response.redirect_url) != "undefined") { + window.location.href = response.redirect_url; + } else { + window.location.href = ''; + } + } else if (typeof(response.msg) != "undefined") { + fsShowFloatingAlert('error', response.msg); + button.button('reset'); + } else { + fsShowFloatingAlert('error', Lang.get("messages.error_occured")); + button.button('reset'); + } + fsLoaderHide(); + }); + e.preventDefault(); + }); }); -} \ No newline at end of file +} diff --git a/public/js/parsley/i18n/al.js b/public/js/parsley/i18n/al.js new file mode 100644 index 00000000..e880f774 --- /dev/null +++ b/public/js/parsley/i18n/al.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley + + +Parsley.addMessages('al', { + defaultMessage: "Kjo vlerë është invalide.", + type: { + email: "Kjo vlerë duhet të ketë formë valide të një email adrese.", + url: "Kjo vlerë duhet të ketë formë valide të një URL-je.", + number: "Kjo vlerë duhet të jetë numërike.", + integer: "Kjo vlerë duhet të jetë numër i plotë.", + digits: "Kjo vlerë duhet të jetë shifër.", + alphanum: "Kjo vlerë duhet të jetë alfanumerike." + }, + notblank: "Kjo vlerë nuk duhet të jetë e zbrazët.", + required: "Kjo vlerë kërkohet domosdosmërisht.", + pattern: "Kjo vlerë është invalide.", + min: "Kjo vlerë duhet të jetë më e madhe ose e barabartë me %s.", + max: "Kjo vlerë duhet të jetë më e vogël ose e barabartë me %s.", + range: "Kjo vlerë duhet të jetë në mes të %s dhe %s.", + minlength: "Kjo vlerë është shum e shkurtë. Ajo duhet të ketë %s apo më shum shkronja.", + maxlength: "Kjo vlerë është shum e gjatë. Ajo duhet të ketë %s apo më pak shkronja", + length: "Gjatësia e kësaj vlere është invalide. Ajo duhet të jetë në mes të %s dhe %s shkronjash.", + mincheck: "Ju duhet të zgjedhni së paku %s zgjedhje.", + maxcheck: "Ju duhet të zgjedhni %s ose më pak zgjedhje.", + check: "Ju duhet të zgjedhni në mes të %s dhe %s zgjedhjeve.", + equalto: "Kjo vlerë duhet të jetë e njejtë." +}); + +Parsley.setLocale('al'); diff --git a/public/js/parsley/i18n/ar.js b/public/js/parsley/i18n/ar.js new file mode 100644 index 00000000..1079c327 --- /dev/null +++ b/public/js/parsley/i18n/ar.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ar', { + defaultMessage: "تأكد من صحة القيمة المدخل", + type: { + email: "تأكد من إدخال بريد الكتروني صحيح", + url: "تأكد من إدخال رابط صحيح", + number: "تأكد من إدخال رقم", + integer: "تأكد من إدخال عدد صحيح بدون كسور", + digits: "تأكد من إدخال رقم", + alphanum: "تأكد من إدخال حروف وأرقام فقط" + }, + notblank: "تأكد من تعبئة الحقل", + required: "هذا الحقل مطلوب", + pattern: "القيمة المدخلة غير صحيحة", + min: "القيمة المدخلة يجب أن تكون أكبر من %s.", + max: "القيمة المدخلة يجب أن تكون أصغر من %s.", + range: "القيمة المدخلة يجب أن تكون بين %s و %s.", + minlength: "القيمة المدخلة قصيرة جداً . تأكد من إدخال %s حرف أو أكثر", + maxlength: "القيمة المدخلة طويلة . تأكد من إدخال %s حرف أو أقل", + length: "القيمة المدخلة غير صحيحة. تأكد من إدخال بين %s و %s خانة", + mincheck: "يجب اختيار %s خيار على الأقل.", + maxcheck: "يجب اختيار%s خيار أو أقل", + check: "يجب اختيار بين %s و %s خيار.", + equalto: "تأكد من تطابق القيمتين المدخلة." +}); + +Parsley.setLocale('ar'); diff --git a/public/js/parsley/i18n/bg.js b/public/js/parsley/i18n/bg.js new file mode 100644 index 00000000..ae36df2a --- /dev/null +++ b/public/js/parsley/i18n/bg.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('bg', { + defaultMessage: "Невалидна стойност.", + type: { + email: "Невалиден имейл адрес.", + url: "Невалиден URL адрес.", + number: "Невалиден номер.", + integer: "Невалиден номер.", + digits: "Невалидни цифри.", + alphanum: "Стойността трябва да садържа само букви или цифри." + }, + notblank: "Полето е задължително.", + required: "Полето е задължително.", + pattern: "Невалидна стойност.", + min: "Стойността трябва да бъде по-голяма или равна на %s.", + max: "Стойността трябва да бъде по-малка или равна на %s.", + range: "Стойността трябва да бъде между %s и %s.", + minlength: "Стойността е прекалено кратка. Мин. дължина: %s символа.", + maxlength: "Стойността е прекалено дълга. Макс. дължина: %s символа.", + length: "Дължината на стойността трябва да бъде между %s и %s символа.", + mincheck: "Трябва да изберете поне %s стойности.", + maxcheck: "Трябва да изберете най-много %s стойности.", + check: "Трябва да изберете между %s и %s стойности.", + equalto: "Стойността трябва да съвпада." +}); + +Parsley.setLocale('bg'); diff --git a/public/js/parsley/i18n/ca.js b/public/js/parsley/i18n/ca.js new file mode 100644 index 00000000..3090ee4c --- /dev/null +++ b/public/js/parsley/i18n/ca.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ca', { + defaultMessage: "Aquest valor sembla ser invàlid.", + type: { + email: "Aquest valor ha de ser una adreça de correu electrònic vàlida.", + url: "Aquest valor ha de ser una URL vàlida.", + number: "Aquest valor ha de ser un nombre vàlid.", + integer: "Aquest valor ha de ser un nombre enter vàlid.", + digits: "Aquest valor només pot contenir dígits.", + alphanum: "Aquest valor ha de ser alfanumèric." + }, + notblank: "Aquest valor no pot ser buit.", + required: "Aquest valor és obligatori.", + pattern: "Aquest valor és incorrecte.", + min: "Aquest valor no pot ser menor que %s.", + max: "Aquest valor no pot ser major que %s.", + range: "Aquest valor ha d'estar entre %s i %s.", + minlength: "Aquest valor és massa curt. La longitud mínima és de %s caràcters.", + maxlength: "Aquest valor és massa llarg. La longitud màxima és de %s caràcters.", + length: "La longitud d'aquest valor ha de ser d'entre %s i %s caràcters.", + mincheck: "Has de marcar un mínim de %s opcions.", + maxcheck: "Has de marcar un màxim de %s opcions.", + check: "Has de marcar entre %s i %s opcions.", + equalto: "Aquest valor ha de ser el mateix." +}); + +Parsley.setLocale('ca'); diff --git a/public/js/parsley/i18n/cs.extra.js b/public/js/parsley/i18n/cs.extra.js new file mode 100644 index 00000000..e6ae7401 --- /dev/null +++ b/public/js/parsley/i18n/cs.extra.js @@ -0,0 +1,13 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('cs', { + dateiso: "Tato položka musí být datum ve formátu RRRR-MM-DD.", + minwords: "Tato položka musí mít délku nejméně %s slov.", + maxwords: "Tato položka musí mít délku nejvíce %s slov.", + words: "Tato položka musí být od %s do %s slov dlouhá.", + gt: "Tato hodnota musí být větší.", + gte: "Tato hodnota musí být větší nebo rovna.", + lt: "Tato hodnota musí být menší.", + lte: "Tato hodnota musí být menší nebo rovna." +}); diff --git a/public/js/parsley/i18n/cs.js b/public/js/parsley/i18n/cs.js new file mode 100644 index 00000000..59fcdd01 --- /dev/null +++ b/public/js/parsley/i18n/cs.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('cs', { + defaultMessage: "Tato položka je neplatná.", + type: { + email: "Tato položka musí být e-mailová adresa.", + url: "Tato položka musí být platná URL adresa.", + number: "Tato položka musí být číslo.", + integer: "Tato položka musí být celé číslo.", + digits: "Tato položka musí být kladné celé číslo.", + alphanum: "Tato položka musí být alfanumerická." + }, + notblank: "Tato položka nesmí být prázdná.", + required: "Tato položka je povinná.", + pattern: "Tato položka je neplatná.", + min: "Tato položka musí být větší nebo rovna %s.", + max: "Tato položka musí být menší nebo rovna %s.", + range: "Tato položka musí být v rozsahu od %s do %s.", + minlength: "Tato položka musí mít nejméně %s znaků.", + maxlength: "Tato položka musí mít nejvíce %s znaků.", + length: "Tato položka musí mít délku od %s do %s znaků.", + mincheck: "Je nutné vybrat alespoň %s možností.", + maxcheck: "Je nutné vybrat nejvýše %s možností.", + check: "Je nutné vybrat od %s do %s možností.", + equalto: "Tato položka musí být stejná." +}); + +Parsley.setLocale('cs'); diff --git a/public/js/parsley/i18n/da.js b/public/js/parsley/i18n/da.js new file mode 100644 index 00000000..dba051a8 --- /dev/null +++ b/public/js/parsley/i18n/da.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('da', { + defaultMessage: "Indtast venligst en korrekt værdi.", + type: { + email: "Indtast venligst en korrekt emailadresse.", + url: "Indtast venligst en korrekt internetadresse.", + number: "Indtast venligst et tal.", + integer: "Indtast venligst et heltal.", + digits: "Dette felt må kun bestå af tal.", + alphanum: "Dette felt skal indeholde både tal og bogstaver." + }, + notblank: "Dette felt må ikke være tomt.", + required: "Dette felt er påkrævet.", + pattern: "Ugyldig indtastning.", + min: "Dette felt skal indeholde et tal som er større end eller lig med %s.", + max: "Dette felt skal indeholde et tal som er mindre end eller lig med %s.", + range: "Dette felt skal indeholde et tal mellem %s og %s.", + minlength: "Indtast venligst mindst %s tegn.", + maxlength: "Dette felt kan højst indeholde %s tegn.", + length: "Længden af denne værdi er ikke korrekt. Værdien skal være mellem %s og %s tegn lang.", + mincheck: "Vælg mindst %s muligheder.", + maxcheck: "Vælg op til %s muligheder.", + check: "Vælg mellem %s og %s muligheder.", + equalto: "De to felter er ikke ens." +}); + +Parsley.setLocale('da'); diff --git a/public/js/parsley/i18n/de.extra.js b/public/js/parsley/i18n/de.extra.js new file mode 100644 index 00000000..d720b3cd --- /dev/null +++ b/public/js/parsley/i18n/de.extra.js @@ -0,0 +1,13 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('de', { + dateiso: "Die Eingabe muss ein gültiges Datum sein (YYYY-MM-DD).", + minwords: "Die Eingabe ist zu kurz. Sie muss aus %s oder mehr Wörtern bestehen.", + maxwords: "Die Eingabe ist zu lang. Sie muss aus %s oder weniger Wörtern bestehen.", + words: "Die Länge der Eingabe ist ungültig. Sie muss zwischen %s und %s Wörter enthalten.", + gt: "Die Eingabe muss größer sein.", + gte: "Die Eingabe muss größer oder gleich sein.", + lt: "Die Eingabe muss kleiner sein.", + lte: "Die Eingabe muss kleiner oder gleich sein." +}); diff --git a/public/js/parsley/i18n/de.js b/public/js/parsley/i18n/de.js new file mode 100644 index 00000000..93b8186e --- /dev/null +++ b/public/js/parsley/i18n/de.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('de', { + defaultMessage: "Die Eingabe scheint nicht korrekt zu sein.", + type: { + email: "Die Eingabe muss eine gültige E-Mail-Adresse sein.", + url: "Die Eingabe muss eine gültige URL sein.", + number: "Die Eingabe muss eine Zahl sein.", + integer: "Die Eingabe muss eine Zahl sein.", + digits: "Die Eingabe darf nur Ziffern enthalten.", + alphanum: "Die Eingabe muss alphanumerisch sein." + }, + notblank: "Die Eingabe darf nicht leer sein.", + required: "Dies ist ein Pflichtfeld.", + pattern: "Die Eingabe scheint ungültig zu sein.", + min: "Die Eingabe muss größer oder gleich %s sein.", + max: "Die Eingabe muss kleiner oder gleich %s sein.", + range: "Die Eingabe muss zwischen %s und %s liegen.", + minlength: "Die Eingabe ist zu kurz. Es müssen mindestens %s Zeichen eingegeben werden.", + maxlength: "Die Eingabe ist zu lang. Es dürfen höchstens %s Zeichen eingegeben werden.", + length: "Die Länge der Eingabe ist ungültig. Es müssen zwischen %s und %s Zeichen eingegeben werden.", + mincheck: "Wählen Sie mindestens %s Angaben aus.", + maxcheck: "Wählen Sie maximal %s Angaben aus.", + check: "Wählen Sie zwischen %s und %s Angaben.", + equalto: "Dieses Feld muss dem anderen entsprechen." +}); + +Parsley.setLocale('de'); diff --git a/public/js/parsley/i18n/el.extra.js b/public/js/parsley/i18n/el.extra.js new file mode 100644 index 00000000..5166b433 --- /dev/null +++ b/public/js/parsley/i18n/el.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('el', { + dateiso: "Η τιμή πρέπει να είναι μια έγκυρη ημερομηνία (YYYY-MM-DD).", + minwords: "Το κείμενο είναι πολύ μικρό. Πρέπει να έχει %s ή και περισσότερες λέξεις.", + maxwords: "Το κείμενο είναι πολύ μεγάλο. Πρέπει να έχει %s ή και λιγότερες λέξεις.", + words: "Το μήκος του κειμένου είναι μη έγκυρο. Πρέπει να είναι μεταξύ %s και %s λεξεων.", + gt: "Η τιμή πρέπει να είναι μεγαλύτερη.", + gte: "Η τιμή πρέπει να είναι μεγαλύτερη ή ίση.", + lt: "Η τιμή πρέπει να είναι μικρότερη.", + lte: "Η τιμή πρέπει να είναι μικρότερη ή ίση.", + notequalto: "Η τιμή πρέπει να είναι διαφορετική." +}); diff --git a/public/js/parsley/i18n/el.js b/public/js/parsley/i18n/el.js new file mode 100644 index 00000000..bd13766c --- /dev/null +++ b/public/js/parsley/i18n/el.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('el', { + defaultMessage: "Η τιμή φαίνεται να είναι μη έγκυρη.", + type: { + email: "Η τιμή πρέπει να είναι ένα έγκυρο email.", + url: "Η τιμή πρέπει να είναι ένα έγκυρο url.", + number: "Η τιμή πρέπει να είναι ένας έγκυρος αριθμός.", + integer: "Η τιμή πρέπει να είναι ένας έγκυρος ακέραιος.", + digits: "Η τιμή πρέπει να είναι ψηφία.", + alphanum: "Η τιμή πρέπει να είναι αλφαριθμητικό." + }, + notblank: "Η τιμή δεν πρέπει να είναι κενή.", + required: "Η τιμή αυτή απαιτείται.", + pattern: "Η τιμή φαίνεται να είναι μη έγκυρη.", + min: "Η τιμή πρέπει να είναι μεγαλύτερη ή ίση με %s.", + max: "Η τιμή πρέπει να είναι μικρότερη ή ίση με %s.", + range: "Η τιμή πρέπει να είναι μεταξύ %s και %s.", + minlength: "Το κείμενο είναι πολύ μικρό. Πρέπει να είναι %s ή και περισσότεροι χαρακτήρες.", + maxlength: "Η κείμενο είναι πολύ μεγάλο. Πρέπει να είναι %s ή και λιγότεροι χαρακτήρες.", + length: "Το μήκος του κειμένου είναι μη έγκυρο. Πρέπει να είναι μεταξύ %s και %s χαρακτήρων.", + mincheck: "Πρέπει να επιλέξετε τουλάχιστον %s επιλογές.", + maxcheck: "Πρέπει να επιλέξετε %s ή λιγότερες επιλογές.", + check: "Πρέπει να επιλέξετε μεταξύ %s και %s επίλογων.", + equalto: "Η τιμή πρέπει να είναι η ίδια." +}); + +Parsley.setLocale('el'); diff --git a/public/js/parsley/i18n/en.extra.js b/public/js/parsley/i18n/en.extra.js new file mode 100644 index 00000000..b9da5f85 --- /dev/null +++ b/public/js/parsley/i18n/en.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('en', { + dateiso: "This value should be a valid date (YYYY-MM-DD).", + minwords: "This value is too short. It should have %s words or more.", + maxwords: "This value is too long. It should have %s words or fewer.", + words: "This value length is invalid. It should be between %s and %s words long.", + gt: "This value should be greater.", + gte: "This value should be greater or equal.", + lt: "This value should be less.", + lte: "This value should be less or equal.", + notequalto: "This value should be different." +}); diff --git a/public/js/parsley/i18n/en.js b/public/js/parsley/i18n/en.js new file mode 100644 index 00000000..6dc3fa09 --- /dev/null +++ b/public/js/parsley/i18n/en.js @@ -0,0 +1,30 @@ +// This is included with the Parsley library itself, +// thus there is no use in adding it to your project. + + +Parsley.addMessages('en', { + defaultMessage: "This value seems to be invalid.", + type: { + email: "This value should be a valid email.", + url: "This value should be a valid url.", + number: "This value should be a valid number.", + integer: "This value should be a valid integer.", + digits: "This value should be digits.", + alphanum: "This value should be alphanumeric." + }, + notblank: "This value should not be blank.", + required: "This value is required.", + pattern: "This value seems to be invalid.", + min: "This value should be greater than or equal to %s.", + max: "This value should be lower than or equal to %s.", + range: "This value should be between %s and %s.", + minlength: "This value is too short. It should have %s characters or more.", + maxlength: "This value is too long. It should have %s characters or fewer.", + length: "This value length is invalid. It should be between %s and %s characters long.", + mincheck: "You must select at least %s choices.", + maxcheck: "You must select %s choices or fewer.", + check: "You must select between %s and %s choices.", + equalto: "This value should be the same." +}); + +Parsley.setLocale('en'); diff --git a/public/js/parsley/i18n/es.js b/public/js/parsley/i18n/es.js new file mode 100644 index 00000000..9aa8aeea --- /dev/null +++ b/public/js/parsley/i18n/es.js @@ -0,0 +1,30 @@ +// ParsleyConfig definition if not already set +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('es', { + defaultMessage: "Este valor parece ser inválido.", + type: { + email: "Este valor debe ser un correo válido.", + url: "Este valor debe ser una URL válida.", + number: "Este valor debe ser un número válido.", + integer: "Este valor debe ser un número válido.", + digits: "Este valor debe ser un dígito válido.", + alphanum: "Este valor debe ser alfanumérico." + }, + notblank: "Este valor no debe estar en blanco.", + required: "Este valor es requerido.", + pattern: "Este valor es incorrecto.", + min: "Este valor no debe ser menor que %s.", + max: "Este valor no debe ser mayor que %s.", + range: "Este valor debe estar entre %s y %s.", + minlength: "Este valor es muy corto. La longitud mínima es de %s caracteres.", + maxlength: "Este valor es muy largo. La longitud máxima es de %s caracteres.", + length: "La longitud de este valor debe estar entre %s y %s caracteres.", + mincheck: "Debe seleccionar al menos %s opciones.", + maxcheck: "Debe seleccionar %s opciones o menos.", + check: "Debe seleccionar entre %s y %s opciones.", + equalto: "Este valor debe ser idéntico." +}); + +Parsley.setLocale('es'); diff --git a/public/js/parsley/i18n/et.js b/public/js/parsley/i18n/et.js new file mode 100644 index 00000000..b57c67f5 --- /dev/null +++ b/public/js/parsley/i18n/et.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('et', { + defaultMessage: "See väärtus ei sobi.", + type: { + email: "See väärtus peab olema kehtiv email.", + url: "See väärtus peab olema kehtiv link.", + number: "See väärtus peab olema number.", + integer: "See väärtus peab olema täisarv.", + digits: "See väärtus peab olema number.", + alphanum: "See väärtus peab olema täht või number." + }, + notblank: "See väärtus ei tohi olla tühi.", + required: "See väärtus on nõutud.", + pattern: "See väärtus ei sobi.", + min: "See väärtus peab olema suurem või võrdne %s.", + max: "See väärtus peab olema väiksem või võrdne %s.", + range: "See väärtus peab olema %s ja %s vahel.", + minlength: "See väärtus on liiga lühike. Peab olema vähemalt %s tähte.", + maxlength: "See väärtus ei tohi olla rohkem kui %s tähte.", + length: "See väärtuse pikkus ei sobi. Peab olema vahemikus %s - %s.", + mincheck: "Pead valima vähemalt %s valikut.", + maxcheck: "Maksimaalselt %s valikut.", + check: "Valik peab olema vahemikus %s ja %s .", + equalto: "See väärtus peab olema sama." +}); + +Parsley.setLocale('et'); diff --git a/public/js/parsley/i18n/eu.js b/public/js/parsley/i18n/eu.js new file mode 100644 index 00000000..15fd55b4 --- /dev/null +++ b/public/js/parsley/i18n/eu.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('eu', { + defaultMessage: "Balio hau baliogabekoa dirudi.", + type: { + email: "Balio honek posta balioduna izan behar da.", + url: "Balio honek URL balioduna izan behar da.", + number: "Balio honek zenbaki balioduna izan behar da.", + integer: "Balio honek zenbaki balioduna izan behar da.", + digits: "Balio honek digitu balioduna izan behar da.", + alphanum: "Balio honek alfanumerikoa izan behar da." + }, + notblank: "Balio honek ezin da hutsik egon.", + required: "Balio hau nahitaezkoa da.", + pattern: "Balio hau ez da zuzena.", + min: "Balio honek %s baino baxuagoa ezin da izan.", + max: "Balio honek %s baino altuagoa ezin da izan.", + range: "Balio honek %s eta %s artean egon behar da.", + minlength: "Balio hau oso motza da. Gutxienezko luzera %s karakteretakoa da.", + maxlength: "Balio hau oso luzea da. Gehienezko luzera %s karakteretakoa da.", + length: "Balio honen luzera %s eta %s karaketere artean egon behar da.", + mincheck: "%s aukera hautatu behar dituzu gutxienez.", + maxcheck: "%s aukera edo gutxiago hautatu behar dituzu.", + check: "%s eta %s aukeren artean hautatu behar duzu.", + equalto: "Balio honek berbera izan behar da." +}); + +Parsley.setLocale('eu'); diff --git a/public/js/parsley/i18n/fa.js b/public/js/parsley/i18n/fa.js new file mode 100644 index 00000000..a58fd8bd --- /dev/null +++ b/public/js/parsley/i18n/fa.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('fa', { + defaultMessage: "این مقدار صحیح نمی باشد", + type: { + email: "این مقدار باید یک ایمیل معتبر باشد", + url: "این مقدار باید یک آدرس معتبر باشد", + number: "این مقدار باید یک عدد معتبر باشد", + integer: "این مقدار باید یک عدد صحیح معتبر باشد", + digits: "این مقدار باید یک عدد باشد", + alphanum: "این مقدار باید حروف الفبا باشد" + }, + notblank: "این مقدار نباید خالی باشد", + required: "این مقدار باید وارد شود", + pattern: "این مقدار به نظر می رسد نامعتبر است", + min: "این مقدیر باید بزرگتر با مساوی %s باشد", + max: "این مقدار باید کمتر و یا مساوی %s باشد", + range: "این مقدار باید بین %s و %s باشد", + minlength: "این مقدار بیش از حد کوتاه است. باید %s کاراکتر یا بیشتر باشد.", + maxlength: "این مقدار بیش از حد طولانی است. باید %s کاراکتر یا کمتر باشد.", + length: "این مقدار نامعتبر است و باید بین %s و %s باشد", + mincheck: "شما حداقل باید %s گزینه را انتخاب کنید.", + maxcheck: "شما حداکثر می‌توانید %s انتخاب داشته باشید.", + check: "باید بین %s و %s مورد انتخاب کنید", + equalto: "این مقدار باید یکسان باشد" +}); + +Parsley.setLocale('fa'); diff --git a/public/js/parsley/i18n/fi.extra.js b/public/js/parsley/i18n/fi.extra.js new file mode 100644 index 00000000..b57734d7 --- /dev/null +++ b/public/js/parsley/i18n/fi.extra.js @@ -0,0 +1,6 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('fi', { + dateiso: "Syötä oikea päivämäärä (YYYY-MM-DD)." +}); diff --git a/public/js/parsley/i18n/fi.js b/public/js/parsley/i18n/fi.js new file mode 100644 index 00000000..f7256667 --- /dev/null +++ b/public/js/parsley/i18n/fi.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('fi', { + defaultMessage: "Syötetty arvo on virheellinen.", + type: { + email: "Sähköpostiosoite on virheellinen.", + url: "Url-osoite on virheellinen.", + number: "Syötä numero.", + integer: "Syötä kokonaisluku.", + digits: "Syötä ainoastaan numeroita.", + alphanum: "Syötä ainoastaan kirjaimia tai numeroita." + }, + notblank: "Tämä kenttää ei voi jättää tyhjäksi.", + required: "Tämä kenttä on pakollinen.", + pattern: "Syötetty arvo on virheellinen.", + min: "Syötä arvo joka on yhtä suuri tai suurempi kuin %s.", + max: "Syötä arvo joka on pienempi tai yhtä suuri kuin %s.", + range: "Syötä arvo väliltä: %s-%s.", + minlength: "Syötetyn arvon täytyy olla vähintään %s merkkiä pitkä.", + maxlength: "Syötetty arvo saa olla enintään %s merkkiä pitkä.", + length: "Syötetyn arvon täytyy olla vähintään %s ja enintään %s merkkiä pitkä.", + mincheck: "Valitse vähintään %s vaihtoehtoa.", + maxcheck: "Valitse enintään %s vaihtoehtoa.", + check: "Valitse %s-%s vaihtoehtoa.", + equalto: "Salasanat eivät täsmää." +}); + +Parsley.setLocale('fi'); diff --git a/public/js/parsley/i18n/fr.extra.js b/public/js/parsley/i18n/fr.extra.js new file mode 100644 index 00000000..57d67950 --- /dev/null +++ b/public/js/parsley/i18n/fr.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('fr', { + dateiso: "Cette valeur n'est pas une date valide (YYYY-MM-DD).", + minwords: "Cette valeur est trop courte. Elle doit contenir au moins %s mots.", + maxwords: "Cette valeur est trop longue. Elle doit contenir tout au plus %s mots.", + words: "Cette valeur est invalide. Elle doit contenir entre %s et %s mots.", + gt: "Cette valeur doit être plus grande.", + gte: "Cette valeur doit être plus grande ou égale.", + lt: "Cette valeur doit être plus petite.", + lte: "Cette valeur doit être plus petite ou égale.", + notequalto: "Cette valeur doit être différente." +}); diff --git a/public/js/parsley/i18n/fr.js b/public/js/parsley/i18n/fr.js new file mode 100644 index 00000000..59aaafa2 --- /dev/null +++ b/public/js/parsley/i18n/fr.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('fr', { + defaultMessage: "Cette valeur semble non valide.", + type: { + email: "Cette valeur n'est pas une adresse email valide.", + url: "Cette valeur n'est pas une URL valide.", + number: "Cette valeur doit être un nombre.", + integer: "Cette valeur doit être un entier.", + digits: "Cette valeur doit être numérique.", + alphanum: "Cette valeur doit être alphanumérique." + }, + notblank: "Cette valeur ne peut pas être vide.", + required: "Ce champ est requis.", + pattern: "Cette valeur semble non valide.", + min: "Cette valeur ne doit pas être inférieure à %s.", + max: "Cette valeur ne doit pas excéder %s.", + range: "Cette valeur doit être comprise entre %s et %s.", + minlength: "Cette chaîne est trop courte. Elle doit avoir au minimum %s caractères.", + maxlength: "Cette chaîne est trop longue. Elle doit avoir au maximum %s caractères.", + length: "Cette valeur doit contenir entre %s et %s caractères.", + mincheck: "Vous devez sélectionner au moins %s choix.", + maxcheck: "Vous devez sélectionner %s choix maximum.", + check: "Vous devez sélectionner entre %s et %s choix.", + equalto: "Cette valeur devrait être identique." +}); + +Parsley.setLocale('fr'); diff --git a/public/js/parsley/i18n/he.extra.js b/public/js/parsley/i18n/he.extra.js new file mode 100644 index 00000000..c9418808 --- /dev/null +++ b/public/js/parsley/i18n/he.extra.js @@ -0,0 +1,6 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('he', { + dateiso: "ערך זה צריך להיות תאריך בפורמט (YYYY-MM-DD)." +}); diff --git a/public/js/parsley/i18n/he.js b/public/js/parsley/i18n/he.js new file mode 100644 index 00000000..196ba5f2 --- /dev/null +++ b/public/js/parsley/i18n/he.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('he', { + defaultMessage: "נראה כי ערך זה אינו תקף.", + type: { + email: "ערך זה צריך להיות כתובת אימייל.", + url: "ערך זה צריך להיות URL תקף.", + number: "ערך זה צריך להיות מספר.", + integer: "ערך זה צריך להיות מספר שלם.", + digits: "ערך זה צריך להיות ספרתי.", + alphanum: "ערך זה צריך להיות אלפאנומרי." + }, + notblank: "ערך זה אינו יכול להשאר ריק.", + required: "ערך זה דרוש.", + pattern: "נראה כי ערך זה אינו תקף.", + min: "ערך זה צריך להיות לכל הפחות %s.", + max: "ערך זה צריך להיות לכל היותר %s.", + range: "ערך זה צריך להיות בין %s ל-%s.", + minlength: "ערך זה קצר מידי. הוא צריך להיות לכל הפחות %s תווים.", + maxlength: "ערך זה ארוך מידי. הוא צריך להיות לכל היותר %s תווים.", + length: "ערך זה אינו באורך תקף. האורך צריך להיות בין %s ל-%s תווים.", + mincheck: "אנא בחר לפחות %s אפשרויות.", + maxcheck: "אנא בחר לכל היותר %s אפשרויות.", + check: "אנא בחר בין %s ל-%s אפשרויות.", + equalto: "ערך זה צריך להיות זהה." +}); + +Parsley.setLocale('he'); diff --git a/public/js/parsley/i18n/hr.extra.js b/public/js/parsley/i18n/hr.extra.js new file mode 100644 index 00000000..e0939bda --- /dev/null +++ b/public/js/parsley/i18n/hr.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('hr', { + dateiso: "Ovo polje treba sadržavati ispravno unešen datum (GGGG-MM-DD).", + minwords: "Unos je prekratak. Treba sadržavati %s ili više riječi.", + maxwords: "Unos je predugačak. Treba sadržavati %s ili manje riječi.", + words: "Neispravna duljina unosa. Treba sadržavati između %s i %s riječi.", + gt: "Ova vrijednost treba biti veća.", + gte: "Ova vrijednost treba biti veća ili jednaka.", + lt: "Ova vrijednost treba biti manja.", + lte: "Ova vrijednost treba biti manja ili jednaka.", + notequalto: "Ova vrijednost treba biti drugačija." +}); diff --git a/public/js/parsley/i18n/hr.js b/public/js/parsley/i18n/hr.js new file mode 100644 index 00000000..606e1e5f --- /dev/null +++ b/public/js/parsley/i18n/hr.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('hr', { + defaultMessage: "Neispravan unos.", + type: { + email: "Ovo polje treba sadržavati ispravnu email adresu.", + url: "Ovo polje treba sadržavati ispravni url.", + number: "Ovo polje treba sadržavati ispravno upisan broj.", + integer: "Ovo polje treba sadržavati ispravno upisan cijeli broj.", + digits: "Ovo polje treba sadržavati znamenke.", + alphanum: "Ovo polje treba sadržavati brojke ili slova." + }, + notblank: "Ovo polje ne smije biti prazno.", + required: "Ovo polje je obavezno.", + pattern: "Neispravan unos.", + min: "Vrijednost treba biti jednaka ili veća od %s.", + max: "Vrijednost treba biti jednaka ili manja od %s.", + range: "Vrijednost treba biti između %s i %s.", + minlength: "Unos je prekratak. Treba sadržavati %s ili više znakova.", + maxlength: "Unos je predugačak. Treba sadržavati %s ili manje znakova.", + length: "Neispravna duljina unosa. Treba sadržavati između %s i %s znakova.", + mincheck: "Treba odabrati najmanje %s izbora.", + maxcheck: "Treba odabrati %s ili manje izbora.", + check: "Treba odabrati između %s i %s izbora.", + equalto: "Ova vrijednost treba biti ista." +}); + +Parsley.setLocale('hr'); diff --git a/public/js/parsley/i18n/hu.extra.js b/public/js/parsley/i18n/hu.extra.js new file mode 100644 index 00000000..08ca74b9 --- /dev/null +++ b/public/js/parsley/i18n/hu.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('hu', { + dateiso: "A mező értéke csak érvényes dátum lehet (YYYY-MM-DD).", + minwords: "Minimum %s szó megadása szükséges.", + maxwords: "Maximum %s szó megadása engedélyezett.", + words: "Minimum %s, maximum %s szó megadása szükséges.", + gt: "A mező értéke nagyobb kell legyen.", + gte: "A mező értéke nagyobb vagy egyenlő kell legyen.", + lt: "A mező értéke kevesebb kell legyen.", + lte: "A mező értéke kevesebb vagy egyenlő kell legyen.", + notequalto: "Az érték különböző kell legyen." +}); diff --git a/public/js/parsley/i18n/hu.js b/public/js/parsley/i18n/hu.js new file mode 100644 index 00000000..0fe38fdb --- /dev/null +++ b/public/js/parsley/i18n/hu.js @@ -0,0 +1,30 @@ +// This is included with the Parsley library itself, +// thus there is no use in adding it to your project. + + +Parsley.addMessages('hu', { + defaultMessage: "Érvénytelen mező.", + type: { + email: "Érvénytelen email cím.", + url: "Érvénytelen URL cím.", + number: "Érvénytelen szám.", + integer: "Érvénytelen egész szám.", + digits: "Érvénytelen szám.", + alphanum: "Érvénytelen alfanumerikus érték." + }, + notblank: "Ez a mező nem maradhat üresen.", + required: "A mező kitöltése kötelező.", + pattern: "Érvénytelen érték.", + min: "A mező értéke nagyobb vagy egyenlő kell legyen mint %s.", + max: "A mező értéke kisebb vagy egyenlő kell legyen mint %s.", + range: "A mező értéke %s és %s közé kell essen.", + minlength: "Legalább %s karakter megadása szükséges.", + maxlength: "Legfeljebb %s karakter megadása engedélyezett.", + length: "Nem megfelelő karakterszám. Minimum %s, maximum %s karakter adható meg.", + mincheck: "Legalább %s értéket kell kiválasztani.", + maxcheck: "Maximum %s értéket lehet kiválasztani.", + check: "Legalább %s, legfeljebb %s értéket kell kiválasztani.", + equalto: "A mező értéke nem egyező." +}); + +Parsley.setLocale('hu'); diff --git a/public/js/parsley/i18n/id.extra.js b/public/js/parsley/i18n/id.extra.js new file mode 100644 index 00000000..4d9c2092 --- /dev/null +++ b/public/js/parsley/i18n/id.extra.js @@ -0,0 +1,6 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('id', { + dateiso: "Harus tanggal yang valid (YYYY-MM-DD)." +}); diff --git a/public/js/parsley/i18n/id.js b/public/js/parsley/i18n/id.js new file mode 100644 index 00000000..cc33f612 --- /dev/null +++ b/public/js/parsley/i18n/id.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('id', { + defaultMessage: "tidak valid", + type: { + email: "email tidak valid", + url: "url tidak valid", + number: "nomor tidak valid", + integer: "integer tidak valid", + digits: "harus berupa digit", + alphanum: "harus berupa alphanumeric" + }, + notblank: "tidak boleh kosong", + required: "tidak boleh kosong", + pattern: "tidak valid", + min: "harus lebih besar atau sama dengan %s.", + max: "harus lebih kecil atau sama dengan %s.", + range: "harus dalam rentang %s dan %s.", + minlength: "terlalu pendek, minimal %s karakter atau lebih.", + maxlength: "terlalu panjang, maksimal %s karakter atau kurang.", + length: "panjang karakter harus dalam rentang %s dan %s", + mincheck: "pilih minimal %s pilihan", + maxcheck: "pilih maksimal %s pilihan", + check: "pilih antar %s dan %s pilihan", + equalto: "harus sama" +}); + +Parsley.setLocale('id'); diff --git a/public/js/parsley/i18n/it.extra.js b/public/js/parsley/i18n/it.extra.js new file mode 100644 index 00000000..92e4e703 --- /dev/null +++ b/public/js/parsley/i18n/it.extra.js @@ -0,0 +1,6 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('it', { + dateiso: "Inserire una data valida (AAAA-MM-GG)." +}); diff --git a/public/js/parsley/i18n/it.js b/public/js/parsley/i18n/it.js new file mode 100644 index 00000000..32c90c33 --- /dev/null +++ b/public/js/parsley/i18n/it.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('it', { + defaultMessage: "Questo valore sembra essere non valido.", + type: { + email: "Questo valore deve essere un indirizzo email valido.", + url: "Questo valore deve essere un URL valido.", + number: "Questo valore deve essere un numero valido.", + integer: "Questo valore deve essere un numero valido.", + digits: "Questo valore deve essere di tipo numerico.", + alphanum: "Questo valore deve essere di tipo alfanumerico." + }, + notblank: "Questo valore non deve essere vuoto.", + required: "Questo valore è richiesto.", + pattern: "Questo valore non è corretto.", + min: "Questo valore deve essere maggiore di %s.", + max: "Questo valore deve essere minore di %s.", + range: "Questo valore deve essere compreso tra %s e %s.", + minlength: "Questo valore è troppo corto. La lunghezza minima è di %s caratteri.", + maxlength: "Questo valore è troppo lungo. La lunghezza massima è di %s caratteri.", + length: "La lunghezza di questo valore deve essere compresa fra %s e %s caratteri.", + mincheck: "Devi scegliere almeno %s opzioni.", + maxcheck: "Devi scegliere al più %s opzioni.", + check: "Devi scegliere tra %s e %s opzioni.", + equalto: "Questo valore deve essere identico." +}); + +Parsley.setLocale('it'); diff --git a/public/js/parsley/i18n/ja.extra.js b/public/js/parsley/i18n/ja.extra.js new file mode 100644 index 00000000..1837229f --- /dev/null +++ b/public/js/parsley/i18n/ja.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ja', { + dateiso: "有効な日付を入力してください。 (YYYY-MM-DD).", + minwords: "語句が短すぎます。 %s 語以上で入力してください。", + maxwords: "語句が長すぎます。 %s 語以内で入力してください。", + words: "語句の長さが正しくありません。 %s 語から %s 語の間で入力してください。", + gt: "より大きい値を入力してください。", + gte: "より大きいか、同じ値を入力してください。", + lt: "より小さい値を入力してください。", + lte: "より小さいか、同じ値を入力してください。", + notequalto: "異なる値を入力してください。" +}); diff --git a/public/js/parsley/i18n/ja.js b/public/js/parsley/i18n/ja.js new file mode 100644 index 00000000..17aab567 --- /dev/null +++ b/public/js/parsley/i18n/ja.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ja', { + defaultMessage: "無効な値です。", + type: { + email: "有効なメールアドレスを入力してください。", + url: "有効なURLを入力してください。", + number: "数値を入力してください。", + integer: "整数を入力してください。", + digits: "数字を入力してください。", + alphanum: "英数字を入力してください。" + }, + notblank: "この値を入力してください", + required: "この値は必須です。", + pattern: "この値は無効です。", + min: "%s 以上の値にしてください。", + max: "%s 以下の値にしてください。", + range: "%s から %s の値にしてください。", + minlength: "%s 文字以上で入力してください。", + maxlength: "%s 文字以下で入力してください。", + length: "%s から %s 文字の間で入力してください。", + mincheck: "%s 個以上選択してください。", + maxcheck: "%s 個以下選択してください。", + check: "%s から %s 個選択してください。", + equalto: "値が違います。" +}); + +Parsley.setLocale('ja'); diff --git a/public/js/parsley/i18n/ko.js b/public/js/parsley/i18n/ko.js new file mode 100644 index 00000000..66bb44ec --- /dev/null +++ b/public/js/parsley/i18n/ko.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ko', { + defaultMessage: "입력하신 내용이 올바르지 않습니다.", + type: { + email: "입력하신 이메일이 유효하지 않습니다.", + url: "입력하신 URL이 유효하지 않습니다.", + number: "입력하신 전화번호가 올바르지 않습니다.", + integer: "입력하신 정수가 유효하지 않습니다.", + digits: "숫자를 입력하여 주십시오.", + alphanum: "입력하신 내용은 알파벳과 숫자의 조합이어야 합니다." + }, + notblank: "공백은 입력하실 수 없습니다.", + required: "필수 입력사항입니다.", + pattern: "입력하신 내용이 올바르지 않습니다.", + min: "입력하신 내용이 %s보다 크거나 같아야 합니다. ", + max: "입력하신 내용이 %s보다 작거나 같아야 합니다.", + range: "입력하신 내용이 %s보다 크고 %s 보다 작아야 합니다.", + minlength: "%s 이상의 글자수를 입력하십시오. ", + maxlength: "%s 이하의 글자수를 입력하십시오. ", + length: "입력하신 내용의 글자수가 %s보다 크고 %s보다 작아야 합니다.", + mincheck: "최소한 %s개를 선택하여 주십시오. ", + maxcheck: "%s개 또는 그보다 적게 선택하여 주십시오.", + check: "선택하신 내용이 %s보다 크거나 %s보다 작아야 합니다.", + equalto: "같은 값을 입력하여 주십시오." +}); + +Parsley.setLocale('ko'); diff --git a/public/js/parsley/i18n/lt.extra.js b/public/js/parsley/i18n/lt.extra.js new file mode 100644 index 00000000..3586fecf --- /dev/null +++ b/public/js/parsley/i18n/lt.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('lt', { + dateiso: "Šis įrašas turi būti teisingo formato data (YYYY-MM-DD).", + minwords: "Šis įrašas turi turėti ne mažiau kaip %s žodžių.", + maxwords: "Šis įrašas turi turėti ne daugiau kaip %s žodžių.", + words: "Šis įrašas turi turėti nuo %s iki %s žodžių.", + gt: "Ši vertė turi būti didesnė.", + gte: "Ši vertė turi būti didesnė arba lygi.", + lt: "Ši vertė turi būti mažesnė.", + lte: "Ši vertė turi būti mažesnė arba lygi.", + notequalto: "Ši vertė turi būti skirtinga." +}); diff --git a/public/js/parsley/i18n/lt.js b/public/js/parsley/i18n/lt.js new file mode 100644 index 00000000..49339e69 --- /dev/null +++ b/public/js/parsley/i18n/lt.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('lt', { + defaultMessage: "Šis įrašas neteisingas.", + type: { + email: "Šis įrašas nėra teisingas el. paštas.", + url: "Šis įrašas nėra teisingas url.", + number: "Šis įrašas nėra skaičius.", + integer: "Šis įrašas nėra sveikasis skaičius.", + digits: "Šis įrašas turi būti skaičius.", + alphanum: "Šis įrašas turi būti iš skaičių ir raidžių." + }, + notblank: "Šis įrašas negali būti tuščias.", + required: "Šis įrašas yra privalomas", + pattern: "Šis įrašas neteisingas.", + min: "Ši vertė turi būti didesnė arba lygi %s.", + max: "Ši vertė turi būti mažesnė arba lygi %s.", + range: "Ši vertė turi būti tarp %s ir %s.", + minlength: "Šis įrašas per trumpas. Jis turi turėti %s simbolius arba daugiau.", + maxlength: "Šis įrašas per ilgas. Jis turi turėti %s simbolius arba mažiau.", + length: "Šio įrašo ilgis neteisingas. Jis turėtų būti tarp %s ir %s simbolių.", + mincheck: "Jūs turite pasirinkti bent %s pasirinkimus.", + maxcheck: "Jūs turite pasirinkti ne daugiau %s pasirinkimų.", + check: "Jūs turite pasirinkti tarp %s ir %s pasirinkimų.", + equalto: "Ši reikšmė turėtų būti vienoda." +}); + +Parsley.setLocale('lt'); diff --git a/public/js/parsley/i18n/lv.extra.js b/public/js/parsley/i18n/lv.extra.js new file mode 100644 index 00000000..842a6068 --- /dev/null +++ b/public/js/parsley/i18n/lv.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('lv', { + dateiso: "Šai vērtībai jābūt korekti noformētam datumam (YYYY-MM-DD).", + minwords: "Šī vērtība ir par īsu. Tai jābūt vismaz %s vārdus garai.", + maxwords: "Šī vērtība ir par garu. Tai jābūt %s vārdus garai vai īsākai.", + words: "Šīs vērtības garums ir nederīgs. Tai jābūt no %s līdz %s vārdus garai.", + gt: "Šai vērtībai jābūt lielākai.", + gte: "Šai vērtībai jābūt lielākai vai vienādai.", + lt: "Šai vērtībai jābūt mazākai.", + lte: "Šai vērtībai jābūt mazākai vai vienādai.", + notequalto: "Šai vērtībai jābūt atšķirīgai." +}); diff --git a/public/js/parsley/i18n/lv.js b/public/js/parsley/i18n/lv.js new file mode 100644 index 00000000..10e1a435 --- /dev/null +++ b/public/js/parsley/i18n/lv.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('lv', { + defaultMessage: "Šis ieraksts veikts nekorekti.", + type: { + email: "Šeit jāieraksta derīgs e-pasts.", + url: "Šeit jāieraksta korekts url.", + number: "Šeit jāieraksta derīgs skaitlis.", + integer: "Šeit jāieraksta vesels skaitlis.", + digits: "Šeit jāieraksta cipari.", + alphanum: "Šeit derīgi tikai alfabēta burti vai cipari." + }, + notblank: "Šis ieraksts nedrīkst būt tukšs.", + required: "Šis ieraksts ir obligāti jāaizpilda.", + pattern: "Šis ieraksts aizpildīts nekorekti.", + min: "Šai vērtībai jābūt lielākai vai vienādai ar %s.", + max: "Šai vērtībai jābūt mazākai vai vienādai ar %s.", + range: "Šai vērtībai jābūt starp %s un %s.", + minlength: "Vērtībai jābūt vismaz %s simbolu garai.", + maxlength: "Vērtībai jābūt %s simbolus garai vai īsākai.", + length: "Šīs vērtības garums ir neatbilstošs. Tai jābūt %s līdz %s simbolus garai.", + mincheck: "Jāizvēlas vismaz %s varianti.", + maxcheck: "Jāizvēlas %s varianti vai mazāk.", + check: "Jāizvēlas no %s līdz %s variantiem.", + equalto: "Šai vērtībai jāsakrīt." +}); + +Parsley.setLocale('lv'); diff --git a/public/js/parsley/i18n/ms.extra.js b/public/js/parsley/i18n/ms.extra.js new file mode 100644 index 00000000..7ce05d32 --- /dev/null +++ b/public/js/parsley/i18n/ms.extra.js @@ -0,0 +1,13 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ms', { + dateiso: "Nilai hendaklah berbentuk tarikh yang sah (YYYY-MM-DD).", + minwords: "Ayat terlalu pendek. Ianya perlu sekurang-kurangnya %s patah perkataan.", + maxwords: "Ayat terlalu panjang. Ianya tidak boleh melebihi %s patah perkataan.", + words: "Panjang ayat tidak sah. Jumlah perkataan adalah diantara %s hingga %s patah perkataan.", + gt: "Nilai lebih besar diperlukan.", + gte: "Nilai hendaklah lebih besar atau sama.", + lt: "Nilai lebih kecil diperlukan.", + lte: "Nilai hendaklah lebih kecil atau sama." +}); diff --git a/public/js/parsley/i18n/ms.js b/public/js/parsley/i18n/ms.js new file mode 100644 index 00000000..c475eb94 --- /dev/null +++ b/public/js/parsley/i18n/ms.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ms', { + defaultMessage: "Nilai tidak sah.", + type: { + email: "Nilai mestilah dalam format emel yang sah.", + url: "Nilai mestilah dalam bentuk url yang sah.", + number: "Hanya nombor dibenarkan.", + integer: "Hanya integer dibenarkan.", + digits: "Hanya angka dibenarkan.", + alphanum: "Hanya alfanumerik dibenarkan." + }, + notblank: "Nilai ini tidak boleh kosong.", + required: "Nilai ini wajib diisi.", + pattern: "Bentuk nilai ini tidak sah.", + min: "Nilai perlu lebih besar atau sama dengan %s.", + max: "Nilai perlu lebih kecil atau sama dengan %s.", + range: "Nilai perlu berada antara %s hingga %s.", + minlength: "Nilai terlalu pendek. Ianya perlu sekurang-kurangnya %s huruf.", + maxlength: "Nilai terlalu panjang. Ianya tidak boleh melebihi %s huruf.", + length: "Panjang nilai tidak sah. Panjangnya perlu diantara %s hingga %s huruf.", + mincheck: "Anda mesti memilih sekurang-kurangnya %s pilihan.", + maxcheck: "Anda tidak boleh memilih lebih daripada %s pilihan.", + check: "Anda mesti memilih diantara %s hingga %s pilihan.", + equalto: "Nilai dimasukkan hendaklah sama." +}); + +Parsley.setLocale('ms'); diff --git a/public/js/parsley/i18n/nl.extra.js b/public/js/parsley/i18n/nl.extra.js new file mode 100644 index 00000000..4d58107b --- /dev/null +++ b/public/js/parsley/i18n/nl.extra.js @@ -0,0 +1,11 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('nl', { + dateiso: "Deze waarde moet een datum in het volgende formaat zijn: (YYYY-MM-DD).", + minwords: "Deze waarde moet minstens %s woorden bevatten.", + maxwords: "Deze waarde mag maximaal %s woorden bevatten.", + words: "Deze waarde moet tussen de %s en %s woorden bevatten.", + gt: "Deze waarde moet groter dan %s zijn.", + lt: "Deze waarde moet kleiner dan %s zijn." +}); diff --git a/public/js/parsley/i18n/nl.js b/public/js/parsley/i18n/nl.js new file mode 100644 index 00000000..fbb5c4ba --- /dev/null +++ b/public/js/parsley/i18n/nl.js @@ -0,0 +1,26 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('nl', { + defaultMessage: "Deze waarde lijkt onjuist.", + type: { + email: "Dit lijkt geen geldig e-mail adres te zijn.", + url: "Dit lijkt geen geldige URL te zijn.", + number: "Deze waarde moet een nummer zijn.", + integer: "Deze waarde moet een nummer zijn.", + digits: "Deze waarde moet numeriek zijn.", + alphanum: "Deze waarde moet alfanumeriek zijn." + }, + notblank: "Deze waarde mag niet leeg zijn.", + required: "Dit veld is verplicht.", + pattern: "Deze waarde lijkt onjuist te zijn.", + min: "Deze waarde mag niet lager zijn dan %s.", + max: "Deze waarde mag niet groter zijn dan %s.", + range: "Deze waarde moet tussen %s en %s liggen.", + minlength: "Deze tekst is te kort. Deze moet uit minimaal %s karakters bestaan.", + maxlength: "Deze waarde is te lang. Deze mag maximaal %s karakters lang zijn.", + length: "Deze waarde moet tussen %s en %s karakters lang zijn.", + equalto: "Deze waardes moeten identiek zijn." +}); + +Parsley.setLocale('nl'); diff --git a/public/js/parsley/i18n/no.js b/public/js/parsley/i18n/no.js new file mode 100644 index 00000000..8547f0c6 --- /dev/null +++ b/public/js/parsley/i18n/no.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('no', { + defaultMessage: "Verdien er ugyldig.", + type: { + email: "Verdien må være en gyldig e-postadresse.", + url: "Verdien må være en gyldig url.", + number: "Verdien må være et gyldig tall.", + integer: "Verdien må være et gyldig heltall.", + digits: "Verdien må være et siffer.", + alphanum: "Verdien må være alfanumerisk" + }, + notblank: "Verdien kan ikke være blank.", + required: "Verdien er obligatorisk.", + pattern: "Verdien er ugyldig.", + min: "Verdien må være større eller lik %s.", + max: "Verdien må være mindre eller lik %s.", + range: "Verdien må være mellom %s and %s.", + minlength: "Verdien er for kort. Den må bestå av minst %s tegn.", + maxlength: "Verdien er for lang. Den kan bestå av maksimalt %s tegn.", + length: "Verdien har ugyldig lengde. Den må være mellom %s og %s tegn lang.", + mincheck: "Du må velge minst %s alternativer.", + maxcheck: "Du må velge %s eller færre alternativer.", + check: "Du må velge mellom %s og %s alternativer.", + equalto: "Verdien må være lik." +}); + +Parsley.setLocale('no'); diff --git a/public/js/parsley/i18n/pl.js b/public/js/parsley/i18n/pl.js new file mode 100644 index 00000000..56408ae1 --- /dev/null +++ b/public/js/parsley/i18n/pl.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('pl', { + defaultMessage: "Wartość wygląda na nieprawidłową", + type: { + email: "Wpisz poprawny adres e-mail.", + url: "Wpisz poprawny adres URL.", + number: "Wpisz poprawną liczbę.", + integer: "Dozwolone są jedynie liczby całkowite.", + digits: "Dozwolone są jedynie cyfry.", + alphanum: "Dozwolone są jedynie znaki alfanumeryczne." + }, + notblank: "Pole nie może być puste.", + required: "Pole jest wymagane.", + pattern: "Pole zawiera nieprawidłową wartość.", + min: "Wartość nie może być mniejsza od %s.", + max: "Wartość nie może być większa od %s.", + range: "Wartość powinna zaweriać się pomiędzy %s a %s.", + minlength: "Minimalna ilość znaków wynosi %s.", + maxlength: "Maksymalna ilość znaków wynosi %s.", + length: "Ilość znaków wynosi od %s do %s.", + mincheck: "Wybierz minimalnie %s opcji.", + maxcheck: "Wybierz maksymalnie %s opcji.", + check: "Wybierz od %s do %s opcji.", + equalto: "Wartości nie są identyczne." +}); + +Parsley.setLocale('pl'); diff --git a/public/js/parsley/i18n/pt-br.js b/public/js/parsley/i18n/pt-br.js new file mode 100644 index 00000000..2ce2de08 --- /dev/null +++ b/public/js/parsley/i18n/pt-br.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('pt-br', { + defaultMessage: "Este valor parece ser inválido.", + type: { + email: "Este campo deve ser um email válido.", + url: "Este campo deve ser um URL válida.", + number: "Este campo deve ser um número válido.", + integer: "Este campo deve ser um inteiro válido.", + digits: "Este campo deve conter apenas dígitos.", + alphanum: "Este campo deve ser alfa numérico." + }, + notblank: "Este campo não pode ficar vazio.", + required: "Este campo é obrigatório.", + pattern: "Este campo parece estar inválido.", + min: "Este campo deve ser maior ou igual a %s.", + max: "Este campo deve ser menor ou igual a %s.", + range: "Este campo deve estar entre %s e %s.", + minlength: "Este campo é pequeno demais. Ele deveria ter %s caracteres ou mais.", + maxlength: "Este campo é grande demais. Ele deveria ter %s caracteres ou menos.", + length: "O tamanho deste campo é inválido. Ele deveria ter entre %s e %s caracteres.", + mincheck: "Você deve escolher pelo menos %s opções.", + maxcheck: "Você deve escolher %s opções ou mais", + check: "Você deve escolher entre %s e %s opções.", + equalto: "Este valor deveria ser igual." +}); + +Parsley.setLocale('pt-br'); diff --git a/public/js/parsley/i18n/pt-pt.js b/public/js/parsley/i18n/pt-pt.js new file mode 100644 index 00000000..072c9d22 --- /dev/null +++ b/public/js/parsley/i18n/pt-pt.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('pt-pt', { + defaultMessage: "Este valor parece ser inválido.", + type: { + email: "Este campo deve ser um email válido.", + url: "Este campo deve ser um URL válido.", + number: "Este campo deve ser um número válido.", + integer: "Este campo deve ser um número inteiro válido.", + digits: "Este campo deve conter apenas dígitos.", + alphanum: "Este campo deve ser alfanumérico." + }, + notblank: "Este campo não pode ficar vazio.", + required: "Este campo é obrigatório.", + pattern: "Este campo parece estar inválido.", + min: "Este valor deve ser maior ou igual a %s.", + max: "Este valor deve ser menor ou igual a %s.", + range: "Este valor deve estar entre %s e %s.", + minlength: "Este campo é pequeno demais. Deve ter %s caracteres ou mais.", + maxlength: "Este campo é grande demais. Deve ter %s caracteres ou menos.", + length: "O tamanho deste campo é inválido. Ele deveria ter entre %s e %s caracteres.", + mincheck: "Escolha pelo menos %s opções.", + maxcheck: "Escolha %s opções ou mais", + check: "Escolha entre %s e %s opções.", + equalto: "Este valor deveria ser igual." +}); + +Parsley.setLocale('pt-pt'); diff --git a/public/js/parsley/i18n/ro.extra.js b/public/js/parsley/i18n/ro.extra.js new file mode 100644 index 00000000..e3689312 --- /dev/null +++ b/public/js/parsley/i18n/ro.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ro', { + dateiso: "Trebuie să fie o dată corectă (YYYY-MM-DD).", + minwords: "Textul e prea scurt. Trebuie să aibă cel puțin %s cuvinte.", + maxwords: "Textul e prea lung. Trebuie să aibă cel mult %s cuvinte.", + words: "Textul trebuie să aibă cel puțin %s și cel mult %s caractere.", + gt: "Valoarea ar trebui să fie mai mare.", + gte: "Valoarea ar trebui să fie mai mare sau egală.", + lt: "Valoarea ar trebui să fie mai mică.", + lte: "Valoarea ar trebui să fie mai mică sau egală.", + notequalto: "Valoarea ar trebui să fie diferită." +}); diff --git a/public/js/parsley/i18n/ro.js b/public/js/parsley/i18n/ro.js new file mode 100644 index 00000000..e1f6c323 --- /dev/null +++ b/public/js/parsley/i18n/ro.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ro', { + defaultMessage: "Acest câmp nu este completat corect.", + type: { + email: "Trebuie să scrii un email valid.", + url: "Trebuie să scrii un link valid", + number: "Trebuie să scrii un număr valid", + integer: "Trebuie să scrii un număr întreg valid", + digits: "Trebuie să conțină doar cifre.", + alphanum: "Trebuie să conțină doar cifre sau litere." + }, + notblank: "Acest câmp nu poate fi lăsat gol.", + required: "Acest câmp trebuie să fie completat.", + pattern: "Acest câmp nu este completat corect.", + min: "Trebuie să fie ceva mai mare sau egal cu %s.", + max: "Trebuie să fie ceva mai mic sau egal cu %s.", + range: "Valoarea trebuie să fie între %s și %s.", + minlength: "Trebuie să scrii cel puțin %s caractere.", + maxlength: "Trebuie să scrii cel mult %s caractere.", + length: "Trebuie să scrii cel puțin %s și %s cel mult %s caractere.", + mincheck: "Trebuie să alegi cel puțin %s opțiuni.", + maxcheck: "Poți alege maxim %s opțiuni.", + check: "Trebuie să alegi între %s sau %s.", + equalto: "Trebuie să fie la fel." +}); + +Parsley.setLocale('ro'); diff --git a/public/js/parsley/i18n/ru.extra.js b/public/js/parsley/i18n/ru.extra.js new file mode 100644 index 00000000..f833c2f7 --- /dev/null +++ b/public/js/parsley/i18n/ru.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ru', { + dateiso: "Это значение должно быть корректной датой (ГГГГ-ММ-ДД).", + minwords: "Это значение должно содержать не менее %s слов.", + maxwords: "Это значение должно содержать не более %s слов.", + words: "Это значение должно содержать от %s до %s слов.", + gt: "Это значение должно быть больше.", + gte: "Это значение должно быть больше или равно.", + lt: "Это значение должно быть меньше.", + lte: "Это значение должно быть меньше или равно.", + notequalto: "Это значение должно отличаться." +}); diff --git a/public/js/parsley/i18n/ru.js b/public/js/parsley/i18n/ru.js new file mode 100644 index 00000000..233a0981 --- /dev/null +++ b/public/js/parsley/i18n/ru.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ru', { + defaultMessage: "Некорректное значение.", + type: { + email: "Введите адрес электронной почты.", + url: "Введите URL адрес.", + number: "Введите число.", + integer: "Введите целое число.", + digits: "Введите только цифры.", + alphanum: "Введите буквенно-цифровое значение." + }, + notblank: "Это поле должно быть заполнено.", + required: "Обязательное поле.", + pattern: "Это значение некорректно.", + min: "Это значение должно быть не менее чем %s.", + max: "Это значение должно быть не более чем %s.", + range: "Это значение должно быть от %s до %s.", + minlength: "Это значение должно содержать не менее %s символов.", + maxlength: "Это значение должно содержать не более %s символов.", + length: "Это значение должно содержать от %s до %s символов.", + mincheck: "Выберите не менее %s значений.", + maxcheck: "Выберите не более %s значений.", + check: "Выберите от %s до %s значений.", + equalto: "Это значение должно совпадать." +}); + +Parsley.setLocale('ru'); diff --git a/public/js/parsley/i18n/sk.extra.js b/public/js/parsley/i18n/sk.extra.js new file mode 100644 index 00000000..bda6ea40 --- /dev/null +++ b/public/js/parsley/i18n/sk.extra.js @@ -0,0 +1,13 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sk', { + dateiso: "Prosím zadajte dátum vo formáte RRRR-MM-DD.", + minwords: "Prosím zadajte hodnotu dlhú %s slov a viacej.", + maxwords: "Prosím zadajte hodnotu kratšiu ako %s slov.", + words: "Prosím zadajte hodnotu medzi %s a %s slov.", + gt: "Táto hodnota musí byť väčšia.", + gte: "Táto hodnota musí byť väčšia alebo rovná.", + lt: "Táto hodnota musí byť menšia.", + lte: "Táto hodnota musí byť menšia alebo rovná." +}); diff --git a/public/js/parsley/i18n/sk.js b/public/js/parsley/i18n/sk.js new file mode 100644 index 00000000..98cf19ba --- /dev/null +++ b/public/js/parsley/i18n/sk.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sk', { + defaultMessage: "Prosím zadajte správnu hodnotu.", + type: { + email: "Prosím zadajte správnu emailovú adresu.", + url: "Prosím zadajte platnú URL adresu.", + number: "Toto pole môže obsahovať len čísla", + integer: "Toto pole môže obsahovať len celé čísla", + digits: "Toto pole môže obsahovať len kladné celé čísla.", + alphanum: "Toto pole môže obsahovať len alfanumerické znaky." + }, + notblank: "Toto pole nesmie byť prázdne.", + required: "Toto pole je povinné.", + pattern: "Toto pole je je neplatné.", + min: "Prosím zadajte hodnotu väčšiu alebo rovnú %s.", + max: "Prosím zadajte hodnotu menšiu alebo rovnú %s.", + range: "Prosím zadajte hodnotu v rozmedzí %s a %s", + minlength: "Prosím zadajte hodnotu dlhú %s znakov a viacej.", + maxlength: "Prosím zadajte hodnotu kratšiu ako %s znakov.", + length: "Prosím zadajte hodnotu medzi %s a %s znakov.", + mincheck: "Je nutné vybrať minimálne %s z možností.", + maxcheck: "Je nutné vybrať maximálne %s z možností.", + check: "Je nutné vybrať od %s do %s z možností.", + equalto: "Prosím zadajte rovnakú hodnotu." +}); + +Parsley.setLocale('sk'); diff --git a/public/js/parsley/i18n/sl.extra.js b/public/js/parsley/i18n/sl.extra.js new file mode 100644 index 00000000..94d31b37 --- /dev/null +++ b/public/js/parsley/i18n/sl.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sl', { + dateiso: "Vnesite datum v ISO obliki (YYYY-MM-DD).", + minwords: "Vpis je prekratek. Vpisati morate najmnaj %s besed.", + maxwords: "Vpis je predolg. Vpišete lahko največ %s besed.", + words: "Dolžina vpisa je napačna. Dolžina je lahko samo med %s in %s besed.", + gt: "Vpisani podatek mora biti večji.", + gte: "Vpisani podatek mora biti enak ali večji.", + lt: "Vpisani podatek mora biti manjši.", + lte: "Vpisani podatek mora biti enak ali manjši.", + notequalto: "Vpisana vrednost mora biti drugačna." +}); diff --git a/public/js/parsley/i18n/sl.js b/public/js/parsley/i18n/sl.js new file mode 100644 index 00000000..e2918170 --- /dev/null +++ b/public/js/parsley/i18n/sl.js @@ -0,0 +1,30 @@ +// This is included with the Parsley library itself, +// thus there is no use in adding it to your project. + + +Parsley.addMessages('sl', { + defaultMessage: "Podatek ne ustreza vpisnim kriterijem.", + type: { + email: "Vpišite pravilen email.", + url: "Vpišite pravilen url naslov.", + number: "Vpišite številko.", + integer: "Vpišite celo število brez decimalnih mest.", + digits: "Vpišite samo cifre.", + alphanum: "Vpišite samo alfanumerične znake (cifre in črke)." + }, + notblank: "To polje ne sme biti prazno.", + required: "To polje je obvezno.", + pattern: "Podatek ne ustreza vpisnim kriterijem.", + min: "Vrednost mora biti višja ali enaka kot %s.", + max: "Vrednost mora biti nižja ali enaka kot %s.", + range: "Vrednost mora biti med %s in %s.", + minlength: "Vpis je prekratek. Mora imeti najmanj %s znakov.", + maxlength: "Vpis je predolg. Lahko ima največ %s znakov.", + length: "Število vpisanih znakov je napačno. Število znakov je lahko samo med %s in %s.", + mincheck: "Izbrati morate vsaj %s možnosti.", + maxcheck: "Izberete lahko največ %s možnosti.", + check: "Število izbranih možnosti je lahko samo med %s in %s.", + equalto: "Vnos mora biti enak." +}); + +Parsley.setLocale('sl'); diff --git a/public/js/parsley/i18n/sq.js b/public/js/parsley/i18n/sq.js new file mode 100644 index 00000000..c7af4e44 --- /dev/null +++ b/public/js/parsley/i18n/sq.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sq', { + defaultMessage: "Kjo vlere eshte e pasakte.", + type: { + email: "Duhet te jete nje email i vlefshem.", + url: "Duhet te jete nje URL e vlefshme.", + number: "Duhet te jete numer.", + integer: "Kjo vlere duhet te jete integer.", + digits: "Kjo vlere duhet te permbaje digit.", + alphanum: "Kjo vlere duhet te permbaje vetel alphanumeric." + }, + notblank: "Nuk mund te lihet bosh.", + required: "Eshte e detyrueshme.", + pattern: "Kjo vlere eshte e pasakte.", + min: "Duhet te jete me e madhe ose baraz me %s.", + max: "Duhet te jete me e vogel ose baraz me %s.", + range: "Duhet te jete midis %s dhe %s.", + minlength: "Kjo vlere eshte shume e shkurter. Ajo duhet te permbaje min %s karaktere.", + maxlength: "Kjo vlere eshte shume e gjate. Ajo duhet te permbaje max %s karaktere.", + length: "Gjatesia e kesaj vlere eshte e pasakte. Ajo duhet te jete midis %s dhe %s karakteresh.", + mincheck: "Ju duhet te zgjidhni te pakten %s vlere.", + maxcheck: "Ju duhet te zgjidhni max %s vlera.", + check: "Ju mund te zgjidhni midis %s dhe %s vlerash.", + equalto: "Kjo vlere duhet te jete e njejte." +}); + +Parsley.setLocale('sq'); diff --git a/public/js/parsley/i18n/sr.extra.js b/public/js/parsley/i18n/sr.extra.js new file mode 100644 index 00000000..e8a5d493 --- /dev/null +++ b/public/js/parsley/i18n/sr.extra.js @@ -0,0 +1,14 @@ +// Extra validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sr', { + dateiso: "Unesite validan datum u formatu YYYY-MM-DD.", + minwords: "Potrebno je da unesete %s ili više reči.", + maxwords: "Moguće je uneti maksimalno %s reči.", + words: "Potrebno je da unesete između %s i %s reči.", + gt: "Ova vrednost mora da bude veća.", + gte: "Ova vrednost mora da bude veća ili jednaka.", + lt: "Ova vrednost mora da bude manja.", + lte: "Ova vrednost mora da bude manja ili jednaka.", + notequalto: "Sadržaj ovog polja mora biti različit." +}); diff --git a/public/js/parsley/i18n/sr.js b/public/js/parsley/i18n/sr.js new file mode 100644 index 00000000..75277378 --- /dev/null +++ b/public/js/parsley/i18n/sr.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sr', { + defaultMessage: "Uneta vrednost nije validna.", + type: { + email: "Unesite pravilnu email adresu.", + url: "Unesite pravilnu url adresu.", + number: "Unesite numeričku vrednost.", + integer: "Unesite ceo broj bez decimala.", + digits: "Unesite samo brojeve.", + alphanum: "Unesite samo alfanumeričke znake (slova i brojeve)." + }, + notblank: "Ovo polje ne sme biti prazno.", + required: "Ovo polje je obavezno.", + pattern: "Uneta vrednost nije validna.", + min: "Vrednost mora biti veća ili jednaka %s.", + max: "Vrednost mora biti manja ili jednaka %s.", + range: "Vrednost mora biti između %s i %s.", + minlength: "Unos je prekratak. Mora imati najmanje %s znakova.", + maxlength: "Unos je predug. Može imati najviše %s znakova.", + length: "Dužina unosa je pogrešna. Broj znakova mora biti između %s i %s.", + mincheck: "Morate izabrati minimalno %s opcija.", + maxcheck: "Možete izabrati najviše %s opcija.", + check: "Broj izabranih opcija mora biti između %s i %s.", + equalto: "Unos mora biti jednak." +}); + +Parsley.setLocale('sr'); diff --git a/public/js/parsley/i18n/sv.extra.js b/public/js/parsley/i18n/sv.extra.js new file mode 100644 index 00000000..88e9e5c4 --- /dev/null +++ b/public/js/parsley/i18n/sv.extra.js @@ -0,0 +1,6 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sv', { + dateiso: "Ange ett giltigt datum (ÅÅÅÅ-MM-DD)." +}); diff --git a/public/js/parsley/i18n/sv.js b/public/js/parsley/i18n/sv.js new file mode 100644 index 00000000..9edf3bc8 --- /dev/null +++ b/public/js/parsley/i18n/sv.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('sv', { + defaultMessage: "Ogiltigt värde.", + type: { + email: "Ange en giltig e-postadress.", + url: "Ange en giltig URL.", + number: "Ange ett giltigt nummer.", + integer: "Ange ett heltal.", + digits: "Ange endast siffror.", + alphanum: "Ange endast bokstäver och siffror." + }, + notblank: "Värdet får inte vara tomt.", + required: "Måste fyllas i.", + pattern: "Värdet är ej giltigt.", + min: "Värdet måste vara större än eller lika med %s.", + max: "Värdet måste vara mindre än eller lika med %s.", + range: "Värdet måste vara mellan %s och %s.", + minlength: "Värdet måste vara minst %s tecken.", + maxlength: "Värdet får maximalt innehålla %s tecken.", + length: "Värdet måste vara mellan %s och %s tecken.", + mincheck: "Minst %s val måste göras.", + maxcheck: "Maximalt %s val får göras.", + check: "Mellan %s och %s val måste göras.", + equalto: "Värdena måste vara lika." +}); + +Parsley.setLocale('sv'); diff --git a/public/js/parsley/i18n/th.js b/public/js/parsley/i18n/th.js new file mode 100644 index 00000000..d3001e32 --- /dev/null +++ b/public/js/parsley/i18n/th.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('th', { + defaultMessage: "ค่านี้ดูเหมือนว่าจะไม่ถูกต้อง", + type: { + email: "ค่านี้ควรจะเป็นอีเมลที่ถูกต้อง", + url: "ค่านี้ควรจะเป็น url ที่ถูกต้อง", + number: "ค่านี้ควรจะเป็นตัวเลขที่ถูกต้อง", + integer: "ค่านี้ควรจะเป็นจำนวนเต็มที่ถูกต้อง", + digits: "ค่านี้ควรเป็นทศนิยมที่ถูกต้อง", + alphanum: "ค่านี้ควรเป็นอักขระตัวอักษรหรือตัวเลขที่ถูกต้อง" + }, + notblank: "ค่านี้ไม่ควรจะว่าง", + required: "ค่านี้จำเป็น", + pattern: "ค่านี้ดูเหมือนว่าจะไม่ถูกต้อง", + min: "ค่านี้ควรมากกว่าหรือเท่ากับ %s.", + max: "ค่านี้ควรจะน้อยกว่าหรือเท่ากับ %s.", + range: "ค่ายี้ควรจะอยู่ระหว่าง %s และ %s.", + minlength: "ค่านี้สั้นเกินไป ควรจะมี %s อักขระหรือมากกว่า", + maxlength: "ค่านี้ยาวเกินไป ควรจะมี %s อักขระหรือน้อยกว่า", + length: "ความยาวของค่านี้ไม่ถูกต้อง ควรมีความยาวอยู่ระหว่าง %s และ %s อักขระ", + mincheck: "คุณควรเลือกอย่างน้อย %s ตัวเลือก", + maxcheck: "คุณควรเลือก %s ตัวเลือกหรือน้อยกว่า", + check: "คุณควรเลือกระหว่าง %s และ %s ตัวเลือก", + equalto: "ค่านี้ควรจะเหมือนกัน" +}); + +Parsley.setLocale('th'); diff --git a/public/js/parsley/i18n/tk.js b/public/js/parsley/i18n/tk.js new file mode 100644 index 00000000..c7cdb52b --- /dev/null +++ b/public/js/parsley/i18n/tk.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('tk', { + defaultMessage: "Bu maglumat nädogry.", + type: { + email: "Dogry e-poçta adresi ýazmaly.", + url: "Dogry web sahypa salgysy ýazmaly.", + number: "Dogry san ýazmaly.", + integer: "Dogry bitin san ýazmaly.", + digits: "San ýazmaly.", + alphanum: "San ýa-da harp ýazmaly." + }, + notblank: "Bu ýeri boş goýmaly däl.", + required: "Bu ýeri doldurmak hökmany.", + pattern: "Bu maglumat nädogry.", + min: "Iň azyndan %s ýa-da ondan uly bolmaly.", + max: "Iň köp %s ýa-da ondan kiçi bolmaly.", + range: "Bu ýer %s we %s aralygynda san bolmaly.", + minlength: "Bu ýeriň uzynlygy iň azyndan %s harp ýa-da ondan köp bolmaly.", + maxlength: "Bu ýeriň uzynlygy iň köp %s harp ýa-da ondan az bolmaly.", + length: "Bu ýeriň uzynlygy %s we %s harp aralygynda bolmaly.", + mincheck: "Iň azyndan %s sanysyny saýlamaly.", + maxcheck: "Iň köp %s sanysyny saýlamaly.", + check: "Iň az %s, iň köp %s sanysyny saýlamaly.", + equalto: "Bu maglumat deň bolmaly." +}); + +Parsley.setLocale('tk'); diff --git a/public/js/parsley/i18n/tr.js b/public/js/parsley/i18n/tr.js new file mode 100644 index 00000000..15277948 --- /dev/null +++ b/public/js/parsley/i18n/tr.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('tr', { + defaultMessage: "Girdiğiniz değer geçerli değil.", + type: { + email: "Geçerli bir e-mail adresi yazmanız gerekiyor.", + url: "Geçerli bir bağlantı adresi yazmanız gerekiyor.", + number: "Geçerli bir sayı yazmanız gerekiyor.", + integer: "Geçerli bir tamsayı yazmanız gerekiyor.", + digits: "Geçerli bir rakam yazmanız gerekiyor.", + alphanum: "Geçerli bir alfanümerik değer yazmanız gerekiyor." + }, + notblank: "Bu alan boş bırakılamaz.", + required: "Bu alan boş bırakılamaz.", + pattern: "Girdiğiniz değer geçerli değil.", + min: "Bu alan %s değerinden büyük ya da bu değere eşit olmalı.", + max: "Bu alan %s değerinden küçük ya da bu değere eşit olmalı.", + range: "Bu alan %s ve %s değerleri arasında olmalı.", + minlength: "Bu alanın uzunluğu %s karakter veya daha fazla olmalı.", + maxlength: "Bu alanın uzunluğu %s karakter veya daha az olmalı.", + length: "Bu alanın uzunluğu %s ve %s karakter arasında olmalı.", + mincheck: "En az %s adet seçim yapmalısınız.", + maxcheck: "En fazla %s seçim yapabilirsiniz.", + check: "Bu alan için en az %s, en fazla %s seçim yapmalısınız.", + equalto: "Bu alanın değeri aynı olmalı." +}); + +Parsley.setLocale('tr'); diff --git a/public/js/parsley/i18n/ua.extra.js b/public/js/parsley/i18n/ua.extra.js new file mode 100644 index 00000000..3b72fd25 --- /dev/null +++ b/public/js/parsley/i18n/ua.extra.js @@ -0,0 +1,14 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ua', { + dateiso: "Це значення повинно бути коректною датою (РРРР-ММ-ДД).", + minwords: "Це значення повинно містити не менше %s слів.", + maxwords: "Це значення повинно містити не більше %s слів.", + words: "Це значення повинно містити від %s до %s слів.", + gt: "Це значення повинно бути більше.", + gte: "Це значення повинно бути більше або дорівнює.", + lt: "Це значення повинно бути менше.", + lte: "Це значення повинно бути менше або дорівнює.", + notequalto: "Це значення повинно відрізнятися." +}); diff --git a/public/js/parsley/i18n/ua.js b/public/js/parsley/i18n/ua.js new file mode 100644 index 00000000..2e3c2283 --- /dev/null +++ b/public/js/parsley/i18n/ua.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('ua', { + defaultMessage: "Некоректне значення.", + type: { + email: "Введіть адресу електронної пошти.", + url: "Введіть URL адресу.", + number: "Введіть число.", + integer: "Введіть ціле число.", + digits: "Введіть тільки цифри.", + alphanum: "Введіть буквено-цифрове значення." + }, + notblank: "Це поле має бути заповненим.", + required: "Обов'язкове поле.", + pattern: "Це значення некоректне.", + min: "Це значення повинно бути не менше ніж %s.", + max: "Це значення повинно бути не більше ніж %s.", + range: "Це значення повинно бути від %s до %s.", + minlength: "Це значення повинно містити не менше %s символів.", + maxlength: "Це значення повинно містити не більше %s символів.", + length: "Це значення повинно містити від %s до %s символів.", + mincheck: "Виберіть не менше %s значень.", + maxcheck: "Виберіть не більше %s значень.", + check: "Виберіть від %s до %s значень.", + equalto: "Це значення повинно співпадати." +}); + +Parsley.setLocale('ua'); diff --git a/public/js/parsley/i18n/uk.extra.js b/public/js/parsley/i18n/uk.extra.js new file mode 100644 index 00000000..d581b1aa --- /dev/null +++ b/public/js/parsley/i18n/uk.extra.js @@ -0,0 +1,9 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('uk', { + dateiso: "Це значення має бути коректною датою (РРРР-ММ-ДД).", + minwords: "Це значення повинно містити не менше %s слів.", + maxwords: "Це значення повинно містити не більше %s слів.", + words: "Це значення повинно містити від %s до %s слів." +}); diff --git a/public/js/parsley/i18n/uk.js b/public/js/parsley/i18n/uk.js new file mode 100644 index 00000000..da63e306 --- /dev/null +++ b/public/js/parsley/i18n/uk.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('uk', { + defaultMessage: "Некоректне значення.", + type: { + email: "Введіть адресу електронної пошти.", + url: "Введіть URL-адресу.", + number: "Введіть число.", + integer: "Введіть ціле число.", + digits: "Введіть тільки цифри.", + alphanum: "Введіть буквено-цифрове значення." + }, + notblank: "Це поле повинно бути заповнено.", + required: "Обов'язкове поле", + pattern: "Це значення некоректно.", + min: "Це значення повинно бути не менше ніж %s.", + max: "Це значення повинно бути не більше ніж %s.", + range: "Це значення повинно бути від %s до %s.", + minlength: "Це значення повинно містити не менше ніж %s символів.", + maxlength: "Це значення повинно містити не більше ніж %s символів.", + length: "Це значення повинно містити від %s до %s символів.", + mincheck: "Виберіть не менше %s значень.", + maxcheck: "Виберіть не більше %s значень.", + check: "Виберіть від %s до %s значень.", + equalto: "Це значення повинно збігатися." +}); + +Parsley.setLocale('uk'); diff --git a/public/js/parsley/i18n/zh_cn.extra.js b/public/js/parsley/i18n/zh_cn.extra.js new file mode 100644 index 00000000..df728e55 --- /dev/null +++ b/public/js/parsley/i18n/zh_cn.extra.js @@ -0,0 +1,6 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('zh-cn', { + dateiso: "请输入正确格式的日期 (YYYY-MM-DD)." +}); diff --git a/public/js/parsley/i18n/zh_cn.js b/public/js/parsley/i18n/zh_cn.js new file mode 100644 index 00000000..253696c8 --- /dev/null +++ b/public/js/parsley/i18n/zh_cn.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('zh-cn', { + defaultMessage: "不正确的值", + type: { + email: "请输入一个有效的电子邮箱地址", + url: "请输入一个有效的链接", + number: "请输入正确的数字", + integer: "请输入正确的整数", + digits: "请输入正确的号码", + alphanum: "请输入字母或数字" + }, + notblank: "请输入值", + required: "必填项", + pattern: "格式不正确", + min: "输入值请大于或等于 %s", + max: "输入值请小于或等于 %s", + range: "输入值应该在 %s 到 %s 之间", + minlength: "请输入至少 %s 个字符", + maxlength: "请输入至多 %s 个字符", + length: "字符长度应该在 %s 到 %s 之间", + mincheck: "请至少选择 %s 个选项", + maxcheck: "请选择不超过 %s 个选项", + check: "请选择 %s 到 %s 个选项", + equalto: "输入值不同" +}); + +Parsley.setLocale('zh-cn'); diff --git a/public/js/parsley/i18n/zh_tw.js b/public/js/parsley/i18n/zh_tw.js new file mode 100644 index 00000000..a1e924f9 --- /dev/null +++ b/public/js/parsley/i18n/zh_tw.js @@ -0,0 +1,29 @@ +// Validation errors messages for Parsley +// Load this after Parsley + +Parsley.addMessages('zh-tw', { + defaultMessage: "這個值似乎是無效的。", + type: { + email: "請輸入一個正確的電子郵件地址。", + url: "請輸入一個有效的網址。", + number: "請輸入一個數字。", + integer: "請輸入一個整數。", + digits: "這個欄位只接受數字。", + alphanum: "這個欄位只接受英文字母或是數字。" + }, + notblank: "這個欄位不能為空白。", + required: "這個欄位必須填寫。", + pattern: "這個值似乎是無效的。", + min: "輸入的值應該大於或等於 %s", + max: "輸入的值應該小於或等於 %s", + range: "輸入的值應該在 %s 和 %s 之間。", + minlength: "輸入的值至少要有 %s 個字元。", + maxlength: "輸入的值最多可以有 %s 個字元。", + length: "字元長度應該在 %s 和 %s 之間。", + mincheck: "你至少要選擇 %s 個項目。", + maxcheck: "你最多可選擇 %s 個項目。", + check: "你必須選擇 %s 到 %s 個項目。", + equalto: "輸入值不同。" +}); + +Parsley.setLocale('zh-tw'); diff --git a/public/js/parsley/parsley.js b/public/js/parsley/parsley.js new file mode 100644 index 00000000..ba550a3a --- /dev/null +++ b/public/js/parsley/parsley.js @@ -0,0 +1,2494 @@ +/*! +* Parsley.js +* Version 2.8.1 - built Sat, Feb 3rd 2018, 2:27 pm +* http://parsleyjs.org +* Guillaume Potier - +* Marc-Andre Lafortune - +* MIT Licensed +*/ + +// The source code below is generated by babel as +// Parsley is written in ECMAScript 6 +// +var _slice = Array.prototype.slice; + +var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : global.parsley = factory(global.jQuery); +})(this, function ($) { + 'use strict'; + + var globalID = 1; + var pastWarnings = {}; + + var Utils = { + // Parsley DOM-API + // returns object from dom attributes and values + attr: function attr(element, namespace, obj) { + var i; + var attribute; + var attributes; + var regex = new RegExp('^' + namespace, 'i'); + + if ('undefined' === typeof obj) obj = {};else { + // Clear all own properties. This won't affect prototype's values + for (i in obj) { + if (obj.hasOwnProperty(i)) delete obj[i]; + } + } + + if (!element) return obj; + + attributes = element.attributes; + for (i = attributes.length; i--;) { + attribute = attributes[i]; + + if (attribute && attribute.specified && regex.test(attribute.name)) { + obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value); + } + } + + return obj; + }, + + checkAttr: function checkAttr(element, namespace, _checkAttr) { + return element.hasAttribute(namespace + _checkAttr); + }, + + setAttr: function setAttr(element, namespace, attr, value) { + element.setAttribute(this.dasherize(namespace + attr), String(value)); + }, + + getType: function getType(element) { + return element.getAttribute('type') || 'text'; + }, + + generateID: function generateID() { + return '' + globalID++; + }, + + /** Third party functions **/ + deserializeValue: function deserializeValue(value) { + var num; + + try { + return value ? value == "true" || (value == "false" ? false : value == "null" ? null : !isNaN(num = Number(value)) ? num : /^[\[\{]/.test(value) ? JSON.parse(value) : value) : value; + } catch (e) { + return value; + } + }, + + // Zepto camelize function + camelize: function camelize(str) { + return str.replace(/-+(.)?/g, function (match, chr) { + return chr ? chr.toUpperCase() : ''; + }); + }, + + // Zepto dasherize function + dasherize: function dasherize(str) { + return str.replace(/::/g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\d])([A-Z])/g, '$1_$2').replace(/_/g, '-').toLowerCase(); + }, + + warn: function warn() { + var _window$console; + + if (window.console && 'function' === typeof window.console.warn) (_window$console = window.console).warn.apply(_window$console, arguments); + }, + + warnOnce: function warnOnce(msg) { + if (!pastWarnings[msg]) { + pastWarnings[msg] = true; + this.warn.apply(this, arguments); + } + }, + + _resetWarnings: function _resetWarnings() { + pastWarnings = {}; + }, + + trimString: function trimString(string) { + return string.replace(/^\s+|\s+$/g, ''); + }, + + parse: { + date: function date(string) { + var parsed = string.match(/^(\d{4,})-(\d\d)-(\d\d)$/); + if (!parsed) return null; + + var _parsed$map = parsed.map(function (x) { + return parseInt(x, 10); + }); + + var _parsed$map2 = _slicedToArray(_parsed$map, 4); + + var _ = _parsed$map2[0]; + var year = _parsed$map2[1]; + var month = _parsed$map2[2]; + var day = _parsed$map2[3]; + + var date = new Date(year, month - 1, day); + if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) return null; + return date; + }, + string: function string(_string) { + return _string; + }, + integer: function integer(string) { + if (isNaN(string)) return null; + return parseInt(string, 10); + }, + number: function number(string) { + if (isNaN(string)) throw null; + return parseFloat(string); + }, + 'boolean': function _boolean(string) { + return !/^\s*false\s*$/i.test(string); + }, + object: function object(string) { + return Utils.deserializeValue(string); + }, + regexp: function regexp(_regexp) { + var flags = ''; + + // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern + if (/^\/.*\/(?:[gimy]*)$/.test(_regexp)) { + // Replace the regexp literal string with the first match group: ([gimy]*) + // If no flag is present, this will be a blank string + flags = _regexp.replace(/.*\/([gimy]*)$/, '$1'); + // Again, replace the regexp literal string with the first match group: + // everything excluding the opening and closing slashes and the flags + _regexp = _regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1'); + } else { + // Anchor regexp: + _regexp = '^' + _regexp + '$'; + } + return new RegExp(_regexp, flags); + } + }, + + parseRequirement: function parseRequirement(requirementType, string) { + var converter = this.parse[requirementType || 'string']; + if (!converter) throw 'Unknown requirement specification: "' + requirementType + '"'; + var converted = converter(string); + if (converted === null) throw 'Requirement is not a ' + requirementType + ': "' + string + '"'; + return converted; + }, + + namespaceEvents: function namespaceEvents(events, namespace) { + events = this.trimString(events || '').split(/\s+/); + if (!events[0]) return ''; + return $.map(events, function (evt) { + return evt + '.' + namespace; + }).join(' '); + }, + + difference: function difference(array, remove) { + // This is O(N^2), should be optimized + var result = []; + $.each(array, function (_, elem) { + if (remove.indexOf(elem) == -1) result.push(elem); + }); + return result; + }, + + // Alter-ego to native Promise.all, but for jQuery + all: function all(promises) { + // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements + return $.when.apply($, _toConsumableArray(promises).concat([42, 42])); + }, + + // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill + objectCreate: Object.create || (function () { + var Object = function Object() {}; + return function (prototype) { + if (arguments.length > 1) { + throw Error('Second argument not supported'); + } + if (typeof prototype != 'object') { + throw TypeError('Argument must be an object'); + } + Object.prototype = prototype; + var result = new Object(); + Object.prototype = null; + return result; + }; + })(), + + _SubmitSelector: 'input[type="submit"], button:submit' + }; + + // All these options could be overriden and specified directly in DOM using + // `data-parsley-` default DOM-API + // eg: `inputs` can be set in DOM using `data-parsley-inputs="input, textarea"` + // eg: `data-parsley-stop-on-first-failing-constraint="false"` + + var Defaults = { + // ### General + + // Default data-namespace for DOM API + namespace: 'data-parsley-', + + // Supported inputs by default + inputs: 'input, textarea, select', + + // Excluded inputs by default + excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]', + + // Stop validating field on highest priority failing constraint + priorityEnabled: true, + + // ### Field only + + // identifier used to group together inputs (e.g. radio buttons...) + multiple: null, + + // identifier (or array of identifiers) used to validate only a select group of inputs + group: null, + + // ### UI + // Enable\Disable error messages + uiEnabled: true, + + // Key events threshold before validation + validationThreshold: 3, + + // Focused field on form validation error. 'first'|'last'|'none' + focus: 'first', + + // event(s) that will trigger validation before first failure. eg: `input`... + trigger: false, + + // event(s) that will trigger validation after first failure. + triggerAfterFailure: 'input', + + // Class that would be added on every failing validation Parsley field + errorClass: 'parsley-error', + + // Same for success validation + successClass: 'parsley-success', + + // Return the `$element` that will receive these above success or error classes + // Could also be (and given directly from DOM) a valid selector like `'#div'` + classHandler: function classHandler(Field) {}, + + // Return the `$element` where errors will be appended + // Could also be (and given directly from DOM) a valid selector like `'#div'` + errorsContainer: function errorsContainer(Field) {}, + + // ul elem that would receive errors' list + errorsWrapper: '
    ', + + // li elem that would receive error message + errorTemplate: '
  • ' + }; + + var Base = function Base() { + this.__id__ = Utils.generateID(); + }; + + Base.prototype = { + asyncSupport: true, // Deprecated + + _pipeAccordingToValidationResult: function _pipeAccordingToValidationResult() { + var _this = this; + + var pipe = function pipe() { + var r = $.Deferred(); + if (true !== _this.validationResult) r.reject(); + return r.resolve().promise(); + }; + return [pipe, pipe]; + }, + + actualizeOptions: function actualizeOptions() { + Utils.attr(this.element, this.options.namespace, this.domOptions); + if (this.parent && this.parent.actualizeOptions) this.parent.actualizeOptions(); + return this; + }, + + _resetOptions: function _resetOptions(initOptions) { + this.domOptions = Utils.objectCreate(this.parent.options); + this.options = Utils.objectCreate(this.domOptions); + // Shallow copy of ownProperties of initOptions: + for (var i in initOptions) { + if (initOptions.hasOwnProperty(i)) this.options[i] = initOptions[i]; + } + this.actualizeOptions(); + }, + + _listeners: null, + + // Register a callback for the given event name + // Callback is called with context as the first argument and the `this` + // The context is the current parsley instance, or window.Parsley if global + // A return value of `false` will interrupt the calls + on: function on(name, fn) { + this._listeners = this._listeners || {}; + var queue = this._listeners[name] = this._listeners[name] || []; + queue.push(fn); + + return this; + }, + + // Deprecated. Use `on` instead + subscribe: function subscribe(name, fn) { + $.listenTo(this, name.toLowerCase(), fn); + }, + + // Unregister a callback (or all if none is given) for the given event name + off: function off(name, fn) { + var queue = this._listeners && this._listeners[name]; + if (queue) { + if (!fn) { + delete this._listeners[name]; + } else { + for (var i = queue.length; i--;) if (queue[i] === fn) queue.splice(i, 1); + } + } + return this; + }, + + // Deprecated. Use `off` + unsubscribe: function unsubscribe(name, fn) { + $.unsubscribeTo(this, name.toLowerCase()); + }, + + // Trigger an event of the given name + // A return value of `false` interrupts the callback chain + // Returns false if execution was interrupted + trigger: function trigger(name, target, extraArg) { + target = target || this; + var queue = this._listeners && this._listeners[name]; + var result; + var parentResult; + if (queue) { + for (var i = queue.length; i--;) { + result = queue[i].call(target, target, extraArg); + if (result === false) return result; + } + } + if (this.parent) { + return this.parent.trigger(name, target, extraArg); + } + return true; + }, + + asyncIsValid: function asyncIsValid(group, force) { + Utils.warnOnce("asyncIsValid is deprecated; please use whenValid instead"); + return this.whenValid({ group: group, force: force }); + }, + + _findRelated: function _findRelated() { + return this.options.multiple ? $(this.parent.element.querySelectorAll('[' + this.options.namespace + 'multiple="' + this.options.multiple + '"]')) : this.$element; + } + }; + + var convertArrayRequirement = function convertArrayRequirement(string, length) { + var m = string.match(/^\s*\[(.*)\]\s*$/); + if (!m) throw 'Requirement is not an array: "' + string + '"'; + var values = m[1].split(',').map(Utils.trimString); + if (values.length !== length) throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed'; + return values; + }; + + var convertExtraOptionRequirement = function convertExtraOptionRequirement(requirementSpec, string, extraOptionReader) { + var main = null; + var extra = {}; + for (var key in requirementSpec) { + if (key) { + var value = extraOptionReader(key); + if ('string' === typeof value) value = Utils.parseRequirement(requirementSpec[key], value); + extra[key] = value; + } else { + main = Utils.parseRequirement(requirementSpec[key], string); + } + } + return [main, extra]; + }; + + // A Validator needs to implement the methods `validate` and `parseRequirements` + + var Validator = function Validator(spec) { + $.extend(true, this, spec); + }; + + Validator.prototype = { + // Returns `true` iff the given `value` is valid according the given requirements. + validate: function validate(value, requirementFirstArg) { + if (this.fn) { + // Legacy style validator + + if (arguments.length > 3) // If more args then value, requirement, instance... + requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest + return this.fn(value, requirementFirstArg); + } + + if (Array.isArray(value)) { + if (!this.validateMultiple) throw 'Validator `' + this.name + '` does not handle multiple values'; + return this.validateMultiple.apply(this, arguments); + } else { + var instance = arguments[arguments.length - 1]; + if (this.validateDate && instance._isDateInput()) { + arguments[0] = Utils.parse.date(arguments[0]); + if (arguments[0] === null) return false; + return this.validateDate.apply(this, arguments); + } + if (this.validateNumber) { + if (isNaN(value)) return false; + arguments[0] = parseFloat(arguments[0]); + return this.validateNumber.apply(this, arguments); + } + if (this.validateString) { + return this.validateString.apply(this, arguments); + } + throw 'Validator `' + this.name + '` only handles multiple values'; + } + }, + + // Parses `requirements` into an array of arguments, + // according to `this.requirementType` + parseRequirements: function parseRequirements(requirements, extraOptionReader) { + if ('string' !== typeof requirements) { + // Assume requirement already parsed + // but make sure we return an array + return Array.isArray(requirements) ? requirements : [requirements]; + } + var type = this.requirementType; + if (Array.isArray(type)) { + var values = convertArrayRequirement(requirements, type.length); + for (var i = 0; i < values.length; i++) values[i] = Utils.parseRequirement(type[i], values[i]); + return values; + } else if ($.isPlainObject(type)) { + return convertExtraOptionRequirement(type, requirements, extraOptionReader); + } else { + return [Utils.parseRequirement(type, requirements)]; + } + }, + // Defaults: + requirementType: 'string', + + priority: 2 + + }; + + var ValidatorRegistry = function ValidatorRegistry(validators, catalog) { + this.__class__ = 'ValidatorRegistry'; + + // Default Parsley locale is en + this.locale = 'en'; + + this.init(validators || {}, catalog || {}); + }; + + var typeTesters = { + email: /^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/, + + // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers + number: /^-?(\d*\.)?\d+(e[-+]?\d+)?$/i, + + integer: /^-?\d+$/, + + digits: /^\d+$/, + + alphanum: /^\w+$/i, + + date: { + test: function test(value) { + return Utils.parse.date(value) !== null; + } + }, + + url: new RegExp("^" + + // protocol identifier + "(?:(?:https?|ftp)://)?" + // ** mod: make scheme optional + // user:pass authentication + "(?:\\S+(?::\\S*)?@)?" + "(?:" + + // IP address exclusion + // private & local networks + // "(?!(?:10|127)(?:\\.\\d{1,3}){3})" + // ** mod: allow local networks + // "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + // ** mod: allow local networks + // "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" + // ** mod: allow local networks + // IP address dotted notation octets + // excludes loopback network 0.0.0.0 + // excludes reserved space >= 224.0.0.0 + // excludes network & broacast addresses + // (first & last IP address of each class) + "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + "|" + + // host name + '(?:(?:[a-zA-Z\\u00a1-\\uffff0-9]-*)*[a-zA-Z\\u00a1-\\uffff0-9]+)' + + // domain name + '(?:\\.(?:[a-zA-Z\\u00a1-\\uffff0-9]-*)*[a-zA-Z\\u00a1-\\uffff0-9]+)*' + + // TLD identifier + '(?:\\.(?:[a-zA-Z\\u00a1-\\uffff]{2,}))' + ")" + + // port number + "(?::\\d{2,5})?" + + // resource path + "(?:/\\S*)?" + "$") + }; + typeTesters.range = typeTesters.number; + + // See http://stackoverflow.com/a/10454560/8279 + var decimalPlaces = function decimalPlaces(num) { + var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/); + if (!match) { + return 0; + } + return Math.max(0, + // Number of digits right of decimal point. + (match[1] ? match[1].length : 0) - ( + // Adjust for scientific notation. + match[2] ? +match[2] : 0)); + }; + + // parseArguments('number', ['1', '2']) => [1, 2] + var ValidatorRegistry__parseArguments = function ValidatorRegistry__parseArguments(type, args) { + return args.map(Utils.parse[type]); + }; + // operatorToValidator returns a validating function for an operator function, applied to the given type + var ValidatorRegistry__operatorToValidator = function ValidatorRegistry__operatorToValidator(type, operator) { + return function (value) { + for (var _len = arguments.length, requirementsAndInput = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + requirementsAndInput[_key - 1] = arguments[_key]; + } + + requirementsAndInput.pop(); // Get rid of `input` argument + return operator.apply(undefined, [value].concat(_toConsumableArray(ValidatorRegistry__parseArguments(type, requirementsAndInput)))); + }; + }; + + var ValidatorRegistry__comparisonOperator = function ValidatorRegistry__comparisonOperator(operator) { + return { + validateDate: ValidatorRegistry__operatorToValidator('date', operator), + validateNumber: ValidatorRegistry__operatorToValidator('number', operator), + requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s) + priority: 30 + }; + }; + + ValidatorRegistry.prototype = { + init: function init(validators, catalog) { + this.catalog = catalog; + // Copy prototype's validators: + this.validators = _extends({}, this.validators); + + for (var name in validators) this.addValidator(name, validators[name].fn, validators[name].priority); + + window.Parsley.trigger('parsley:validator:init'); + }, + + // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n + setLocale: function setLocale(locale) { + if ('undefined' === typeof this.catalog[locale]) throw new Error(locale + ' is not available in the catalog'); + + this.locale = locale; + + return this; + }, + + // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true` + addCatalog: function addCatalog(locale, messages, set) { + if ('object' === typeof messages) this.catalog[locale] = messages; + + if (true === set) return this.setLocale(locale); + + return this; + }, + + // Add a specific message for a given constraint in a given locale + addMessage: function addMessage(locale, name, message) { + if ('undefined' === typeof this.catalog[locale]) this.catalog[locale] = {}; + + this.catalog[locale][name] = message; + + return this; + }, + + // Add messages for a given locale + addMessages: function addMessages(locale, nameMessageObject) { + for (var name in nameMessageObject) this.addMessage(locale, name, nameMessageObject[name]); + + return this; + }, + + // Add a new validator + // + // addValidator('custom', { + // requirementType: ['integer', 'integer'], + // validateString: function(value, from, to) {}, + // priority: 22, + // messages: { + // en: "Hey, that's no good", + // fr: "Aye aye, pas bon du tout", + // } + // }) + // + // Old API was addValidator(name, function, priority) + // + addValidator: function addValidator(name, arg1, arg2) { + if (this.validators[name]) Utils.warn('Validator "' + name + '" is already defined.');else if (Defaults.hasOwnProperty(name)) { + Utils.warn('"' + name + '" is a restricted keyword and is not a valid validator name.'); + return; + } + return this._setValidator.apply(this, arguments); + }, + + hasValidator: function hasValidator(name) { + return !!this.validators[name]; + }, + + updateValidator: function updateValidator(name, arg1, arg2) { + if (!this.validators[name]) { + Utils.warn('Validator "' + name + '" is not already defined.'); + return this.addValidator.apply(this, arguments); + } + return this._setValidator.apply(this, arguments); + }, + + removeValidator: function removeValidator(name) { + if (!this.validators[name]) Utils.warn('Validator "' + name + '" is not defined.'); + + delete this.validators[name]; + + return this; + }, + + _setValidator: function _setValidator(name, validator, priority) { + if ('object' !== typeof validator) { + // Old style validator, with `fn` and `priority` + validator = { + fn: validator, + priority: priority + }; + } + if (!validator.validate) { + validator = new Validator(validator); + } + this.validators[name] = validator; + + for (var locale in validator.messages || {}) this.addMessage(locale, name, validator.messages[locale]); + + return this; + }, + + getErrorMessage: function getErrorMessage(constraint) { + var message; + + // Type constraints are a bit different, we have to match their requirements too to find right error message + if ('type' === constraint.name) { + var typeMessages = this.catalog[this.locale][constraint.name] || {}; + message = typeMessages[constraint.requirements]; + } else message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements); + + return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage; + }, + + // Kind of light `sprintf()` implementation + formatMessage: function formatMessage(string, parameters) { + if ('object' === typeof parameters) { + for (var i in parameters) string = this.formatMessage(string, parameters[i]); + + return string; + } + + return 'string' === typeof string ? string.replace(/%s/i, parameters) : ''; + }, + + // Here is the Parsley default validators list. + // A validator is an object with the following key values: + // - priority: an integer + // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these + // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise + // Alternatively, a validator can be a function that returns such an object + // + validators: { + notblank: { + validateString: function validateString(value) { + return (/\S/.test(value) + ); + }, + priority: 2 + }, + required: { + validateMultiple: function validateMultiple(values) { + return values.length > 0; + }, + validateString: function validateString(value) { + return (/\S/.test(value) + ); + }, + priority: 512 + }, + type: { + validateString: function validateString(value, type) { + var _ref = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; + + var _ref$step = _ref.step; + var step = _ref$step === undefined ? 'any' : _ref$step; + var _ref$base = _ref.base; + var base = _ref$base === undefined ? 0 : _ref$base; + + var tester = typeTesters[type]; + if (!tester) { + throw new Error('validator type `' + type + '` is not supported'); + } + if (!tester.test(value)) return false; + if ('number' === type) { + if (!/^any$/i.test(step || '')) { + var nb = Number(value); + var decimals = Math.max(decimalPlaces(step), decimalPlaces(base)); + if (decimalPlaces(nb) > decimals) // Value can't have too many decimals + return false; + // Be careful of rounding errors by using integers. + var toInt = function toInt(f) { + return Math.round(f * Math.pow(10, decimals)); + }; + if ((toInt(nb) - toInt(base)) % toInt(step) != 0) return false; + } + } + return true; + }, + requirementType: { + '': 'string', + step: 'string', + base: 'number' + }, + priority: 256 + }, + pattern: { + validateString: function validateString(value, regexp) { + return regexp.test(value); + }, + requirementType: 'regexp', + priority: 64 + }, + minlength: { + validateString: function validateString(value, requirement) { + return value.length >= requirement; + }, + requirementType: 'integer', + priority: 30 + }, + maxlength: { + validateString: function validateString(value, requirement) { + return value.length <= requirement; + }, + requirementType: 'integer', + priority: 30 + }, + length: { + validateString: function validateString(value, min, max) { + return value.length >= min && value.length <= max; + }, + requirementType: ['integer', 'integer'], + priority: 30 + }, + mincheck: { + validateMultiple: function validateMultiple(values, requirement) { + return values.length >= requirement; + }, + requirementType: 'integer', + priority: 30 + }, + maxcheck: { + validateMultiple: function validateMultiple(values, requirement) { + return values.length <= requirement; + }, + requirementType: 'integer', + priority: 30 + }, + check: { + validateMultiple: function validateMultiple(values, min, max) { + return values.length >= min && values.length <= max; + }, + requirementType: ['integer', 'integer'], + priority: 30 + }, + min: ValidatorRegistry__comparisonOperator(function (value, requirement) { + return value >= requirement; + }), + max: ValidatorRegistry__comparisonOperator(function (value, requirement) { + return value <= requirement; + }), + range: ValidatorRegistry__comparisonOperator(function (value, min, max) { + return value >= min && value <= max; + }), + equalto: { + validateString: function validateString(value, refOrValue) { + var $reference = $(refOrValue); + if ($reference.length) return value === $reference.val();else return value === refOrValue; + }, + priority: 256 + } + } + }; + + var UI = {}; + + var diffResults = function diffResults(newResult, oldResult, deep) { + var added = []; + var kept = []; + + for (var i = 0; i < newResult.length; i++) { + var found = false; + + for (var j = 0; j < oldResult.length; j++) if (newResult[i].assert.name === oldResult[j].assert.name) { + found = true; + break; + } + + if (found) kept.push(newResult[i]);else added.push(newResult[i]); + } + + return { + kept: kept, + added: added, + removed: !deep ? diffResults(oldResult, newResult, true).added : [] + }; + }; + + UI.Form = { + + _actualizeTriggers: function _actualizeTriggers() { + var _this2 = this; + + this.$element.on('submit.Parsley', function (evt) { + _this2.onSubmitValidate(evt); + }); + this.$element.on('click.Parsley', Utils._SubmitSelector, function (evt) { + _this2.onSubmitButton(evt); + }); + + // UI could be disabled + if (false === this.options.uiEnabled) return; + + this.element.setAttribute('novalidate', ''); + }, + + focus: function focus() { + this._focusedField = null; + + if (true === this.validationResult || 'none' === this.options.focus) return null; + + for (var i = 0; i < this.fields.length; i++) { + var field = this.fields[i]; + if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) { + this._focusedField = field.$element; + if ('first' === this.options.focus) break; + } + } + + if (null === this._focusedField) return null; + + return this._focusedField.focus(); + }, + + _destroyUI: function _destroyUI() { + // Reset all event listeners + this.$element.off('.Parsley'); + } + + }; + + UI.Field = { + + _reflowUI: function _reflowUI() { + this._buildUI(); + + // If this field doesn't have an active UI don't bother doing something + if (!this._ui) return; + + // Diff between two validation results + var diff = diffResults(this.validationResult, this._ui.lastValidationResult); + + // Then store current validation result for next reflow + this._ui.lastValidationResult = this.validationResult; + + // Handle valid / invalid / none field class + this._manageStatusClass(); + + // Add, remove, updated errors messages + this._manageErrorsMessages(diff); + + // Triggers impl + this._actualizeTriggers(); + + // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user + if ((diff.kept.length || diff.added.length) && !this._failedOnce) { + this._failedOnce = true; + this._actualizeTriggers(); + } + }, + + // Returns an array of field's error message(s) + getErrorsMessages: function getErrorsMessages() { + // No error message, field is valid + if (true === this.validationResult) return []; + + var messages = []; + + for (var i = 0; i < this.validationResult.length; i++) messages.push(this.validationResult[i].errorMessage || this._getErrorMessage(this.validationResult[i].assert)); + + return messages; + }, + + // It's a goal of Parsley that this method is no longer required [#1073] + addError: function addError(name) { + var _ref2 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var message = _ref2.message; + var assert = _ref2.assert; + var _ref2$updateClass = _ref2.updateClass; + var updateClass = _ref2$updateClass === undefined ? true : _ref2$updateClass; + + this._buildUI(); + this._addError(name, { message: message, assert: assert }); + + if (updateClass) this._errorClass(); + }, + + // It's a goal of Parsley that this method is no longer required [#1073] + updateError: function updateError(name) { + var _ref3 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var message = _ref3.message; + var assert = _ref3.assert; + var _ref3$updateClass = _ref3.updateClass; + var updateClass = _ref3$updateClass === undefined ? true : _ref3$updateClass; + + this._buildUI(); + this._updateError(name, { message: message, assert: assert }); + + if (updateClass) this._errorClass(); + }, + + // It's a goal of Parsley that this method is no longer required [#1073] + removeError: function removeError(name) { + var _ref4 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var _ref4$updateClass = _ref4.updateClass; + var updateClass = _ref4$updateClass === undefined ? true : _ref4$updateClass; + + this._buildUI(); + this._removeError(name); + + // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult + // but highly improbable cuz' manually removing a well Parsley handled error makes no sense. + if (updateClass) this._manageStatusClass(); + }, + + _manageStatusClass: function _manageStatusClass() { + if (this.hasConstraints() && this.needsValidation() && true === this.validationResult) this._successClass();else if (this.validationResult.length > 0) this._errorClass();else this._resetClass(); + }, + + _manageErrorsMessages: function _manageErrorsMessages(diff) { + if ('undefined' !== typeof this.options.errorsMessagesDisabled) return; + + // Case where we have errorMessage option that configure an unique field error message, regardless failing validators + if ('undefined' !== typeof this.options.errorMessage) { + if (diff.added.length || diff.kept.length) { + this._insertErrorWrapper(); + + if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length) this._ui.$errorsWrapper.append($(this.options.errorTemplate).addClass('parsley-custom-error-message')); + + return this._ui.$errorsWrapper.addClass('filled').find('.parsley-custom-error-message').html(this.options.errorMessage); + } + + return this._ui.$errorsWrapper.removeClass('filled').find('.parsley-custom-error-message').remove(); + } + + // Show, hide, update failing constraints messages + for (var i = 0; i < diff.removed.length; i++) this._removeError(diff.removed[i].assert.name); + + for (i = 0; i < diff.added.length; i++) this._addError(diff.added[i].assert.name, { message: diff.added[i].errorMessage, assert: diff.added[i].assert }); + + for (i = 0; i < diff.kept.length; i++) this._updateError(diff.kept[i].assert.name, { message: diff.kept[i].errorMessage, assert: diff.kept[i].assert }); + }, + + _addError: function _addError(name, _ref5) { + var message = _ref5.message; + var assert = _ref5.assert; + + this._insertErrorWrapper(); + this._ui.$errorClassHandler.attr('aria-describedby', this._ui.errorsWrapperId); + this._ui.$errorsWrapper.addClass('filled').append($(this.options.errorTemplate).addClass('parsley-' + name).html(message || this._getErrorMessage(assert))); + }, + + _updateError: function _updateError(name, _ref6) { + var message = _ref6.message; + var assert = _ref6.assert; + + this._ui.$errorsWrapper.addClass('filled').find('.parsley-' + name).html(message || this._getErrorMessage(assert)); + }, + + _removeError: function _removeError(name) { + this._ui.$errorClassHandler.removeAttr('aria-describedby'); + this._ui.$errorsWrapper.removeClass('filled').find('.parsley-' + name).remove(); + }, + + _getErrorMessage: function _getErrorMessage(constraint) { + var customConstraintErrorMessage = constraint.name + 'Message'; + + if ('undefined' !== typeof this.options[customConstraintErrorMessage]) return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements); + + return window.Parsley.getErrorMessage(constraint); + }, + + _buildUI: function _buildUI() { + // UI could be already built or disabled + if (this._ui || false === this.options.uiEnabled) return; + + var _ui = {}; + + // Give field its Parsley id in DOM + this.element.setAttribute(this.options.namespace + 'id', this.__id__); + + /** Generate important UI elements and store them in this **/ + // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes + _ui.$errorClassHandler = this._manageClassHandler(); + + // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer + _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__); + _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId); + + // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly + _ui.lastValidationResult = []; + _ui.validationInformationVisible = false; + + // Store it in this for later + this._ui = _ui; + }, + + // Determine which element will have `parsley-error` and `parsley-success` classes + _manageClassHandler: function _manageClassHandler() { + // Class handled could also be determined by function given in Parsley options + if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length) return $(this.options.classHandler); + + // Class handled could also be determined by function given in Parsley options + var $handlerFunction = this.options.classHandler; + + // It might also be the function name of a global function + if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler]) $handlerFunction = window[this.options.classHandler]; + + if ('function' === typeof $handlerFunction) { + var $handler = $handlerFunction.call(this, this); + + // If this function returned a valid existing DOM element, go for it + if ('undefined' !== typeof $handler && $handler.length) return $handler; + } else if ('object' === typeof $handlerFunction && $handlerFunction instanceof jQuery && $handlerFunction.length) { + return $handlerFunction; + } else if ($handlerFunction) { + Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function'); + } + + return this._inputHolder(); + }, + + _inputHolder: function _inputHolder() { + // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container + if (!this.options.multiple || this.element.nodeName === 'SELECT') return this.$element; + + // But if multiple element (radio, checkbox), that would be their parent + return this.$element.parent(); + }, + + _insertErrorWrapper: function _insertErrorWrapper() { + var $errorsContainer = this.options.errorsContainer; + + // Nothing to do if already inserted + if (0 !== this._ui.$errorsWrapper.parent().length) return this._ui.$errorsWrapper.parent(); + + if ('string' === typeof $errorsContainer) { + if ($($errorsContainer).length) return $($errorsContainer).append(this._ui.$errorsWrapper);else if ('function' === typeof window[$errorsContainer]) $errorsContainer = window[$errorsContainer];else Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function'); + } + + if ('function' === typeof $errorsContainer) $errorsContainer = $errorsContainer.call(this, this); + + if ('object' === typeof $errorsContainer && $errorsContainer.length) return $errorsContainer.append(this._ui.$errorsWrapper); + + return this._inputHolder().after(this._ui.$errorsWrapper); + }, + + _actualizeTriggers: function _actualizeTriggers() { + var _this3 = this; + + var $toBind = this._findRelated(); + var trigger; + + // Remove Parsley events already bound on this field + $toBind.off('.Parsley'); + if (this._failedOnce) $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), function () { + _this3._validateIfNeeded(); + });else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) { + $toBind.on(trigger, function (event) { + _this3._validateIfNeeded(event); + }); + } + }, + + _validateIfNeeded: function _validateIfNeeded(event) { + var _this4 = this; + + // For keyup, keypress, keydown, input... events that could be a little bit obstrusive + // do not validate if val length < min threshold on first validation. Once field have been validated once and info + // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change. + if (event && /key|input/.test(event.type)) if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold) return; + + if (this.options.debounce) { + window.clearTimeout(this._debounced); + this._debounced = window.setTimeout(function () { + return _this4.validate(); + }, this.options.debounce); + } else this.validate(); + }, + + _resetUI: function _resetUI() { + // Reset all event listeners + this._failedOnce = false; + this._actualizeTriggers(); + + // Nothing to do if UI never initialized for this field + if ('undefined' === typeof this._ui) return; + + // Reset all errors' li + this._ui.$errorsWrapper.removeClass('filled').children().remove(); + + // Reset validation class + this._resetClass(); + + // Reset validation flags and last validation result + this._ui.lastValidationResult = []; + this._ui.validationInformationVisible = false; + }, + + _destroyUI: function _destroyUI() { + this._resetUI(); + + if ('undefined' !== typeof this._ui) this._ui.$errorsWrapper.remove(); + + delete this._ui; + }, + + _successClass: function _successClass() { + this._ui.validationInformationVisible = true; + this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass); + }, + _errorClass: function _errorClass() { + this._ui.validationInformationVisible = true; + this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass); + }, + _resetClass: function _resetClass() { + this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass); + } + }; + + var Form = function Form(element, domOptions, options) { + this.__class__ = 'Form'; + + this.element = element; + this.$element = $(element); + this.domOptions = domOptions; + this.options = options; + this.parent = window.Parsley; + + this.fields = []; + this.validationResult = null; + }; + + var Form__statusMapping = { pending: null, resolved: true, rejected: false }; + + Form.prototype = { + onSubmitValidate: function onSubmitValidate(event) { + var _this5 = this; + + // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior + if (true === event.parsley) return; + + // If we didn't come here through a submit button, use the first one in the form + var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0]; + this._submitSource = null; + this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true); + if (submitSource && null !== submitSource.getAttribute('formnovalidate')) return; + + window.Parsley._remoteCache = {}; + + var promise = this.whenValidate({ event: event }); + + if ('resolved' === promise.state() && false !== this._trigger('submit')) { + // All good, let event go through. We make this distinction because browsers + // differ in their handling of `submit` being called from inside a submit event [#1047] + } else { + // Rejected or pending: cancel this submit + event.stopImmediatePropagation(); + event.preventDefault(); + if ('pending' === promise.state()) promise.done(function () { + _this5._submit(submitSource); + }); + } + }, + + onSubmitButton: function onSubmitButton(event) { + this._submitSource = event.currentTarget; + }, + // internal + // _submit submits the form, this time without going through the validations. + // Care must be taken to "fake" the actual submit button being clicked. + _submit: function _submit(submitSource) { + if (false === this._trigger('submit')) return; + // Add submit button's data + if (submitSource) { + var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false); + if (0 === $synthetic.length) $synthetic = $('').appendTo(this.$element); + $synthetic.attr({ + name: submitSource.getAttribute('name'), + value: submitSource.getAttribute('value') + }); + } + + this.$element.trigger(_extends($.Event('submit'), { parsley: true })); + }, + + // Performs validation on fields while triggering events. + // @returns `true` if all validations succeeds, `false` + // if a failure is immediately detected, or `null` + // if dependant on a promise. + // Consider using `whenValidate` instead. + validate: function validate(options) { + if (arguments.length >= 1 && !$.isPlainObject(options)) { + Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.'); + + var _arguments = _slice.call(arguments); + + var group = _arguments[0]; + var force = _arguments[1]; + var event = _arguments[2]; + + options = { group: group, force: force, event: event }; + } + return Form__statusMapping[this.whenValidate(options).state()]; + }, + + whenValidate: function whenValidate() { + var _Utils$all$done$fail$always, + _this6 = this; + + var _ref7 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + var group = _ref7.group; + var force = _ref7.force; + var event = _ref7.event; + + this.submitEvent = event; + if (event) { + this.submitEvent = _extends({}, event, { preventDefault: function preventDefault() { + Utils.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`"); + _this6.validationResult = false; + } }); + } + this.validationResult = true; + + // fire validate event to eventually modify things before every validation + this._trigger('validate'); + + // Refresh form DOM options and form's fields that could have changed + this._refreshFields(); + + var promises = this._withoutReactualizingFormOptions(function () { + return $.map(_this6.fields, function (field) { + return field.whenValidate({ force: force, group: group }); + }); + }); + + return (_Utils$all$done$fail$always = Utils.all(promises).done(function () { + _this6._trigger('success'); + }).fail(function () { + _this6.validationResult = false; + _this6.focus(); + _this6._trigger('error'); + }).always(function () { + _this6._trigger('validated'); + })).pipe.apply(_Utils$all$done$fail$always, _toConsumableArray(this._pipeAccordingToValidationResult())); + }, + + // Iterate over refreshed fields, and stop on first failure. + // Returns `true` if all fields are valid, `false` if a failure is detected + // or `null` if the result depends on an unresolved promise. + // Prefer using `whenValid` instead. + isValid: function isValid(options) { + if (arguments.length >= 1 && !$.isPlainObject(options)) { + Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.'); + + var _arguments2 = _slice.call(arguments); + + var group = _arguments2[0]; + var force = _arguments2[1]; + + options = { group: group, force: force }; + } + return Form__statusMapping[this.whenValid(options).state()]; + }, + + // Iterate over refreshed fields and validate them. + // Returns a promise. + // A validation that immediately fails will interrupt the validations. + whenValid: function whenValid() { + var _this7 = this; + + var _ref8 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + var group = _ref8.group; + var force = _ref8.force; + + this._refreshFields(); + + var promises = this._withoutReactualizingFormOptions(function () { + return $.map(_this7.fields, function (field) { + return field.whenValid({ group: group, force: force }); + }); + }); + return Utils.all(promises); + }, + + refresh: function refresh() { + this._refreshFields(); + return this; + }, + + // Reset UI + reset: function reset() { + // Form case: emit a reset event for each field + for (var i = 0; i < this.fields.length; i++) this.fields[i].reset(); + + this._trigger('reset'); + }, + + // Destroy Parsley instance (+ UI) + destroy: function destroy() { + // Field case: emit destroy event to clean UI and then destroy stored instance + this._destroyUI(); + + // Form case: destroy all its fields and then destroy stored instance + for (var i = 0; i < this.fields.length; i++) this.fields[i].destroy(); + + this.$element.removeData('Parsley'); + this._trigger('destroy'); + }, + + _refreshFields: function _refreshFields() { + return this.actualizeOptions()._bindFields(); + }, + + _bindFields: function _bindFields() { + var _this8 = this; + + var oldFields = this.fields; + + this.fields = []; + this.fieldsMappedById = {}; + + this._withoutReactualizingFormOptions(function () { + _this8.$element.find(_this8.options.inputs).not(_this8.options.excluded).each(function (_, element) { + var fieldInstance = new window.Parsley.Factory(element, {}, _this8); + + // Only add valid and not excluded `Field` and `FieldMultiple` children + if (('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) && true !== fieldInstance.options.excluded) { + var uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__; + if ('undefined' === typeof _this8.fieldsMappedById[uniqueId]) { + _this8.fieldsMappedById[uniqueId] = fieldInstance; + _this8.fields.push(fieldInstance); + } + } + }); + + $.each(Utils.difference(oldFields, _this8.fields), function (_, field) { + field.reset(); + }); + }); + return this; + }, + + // Internal only. + // Looping on a form's fields to do validation or similar + // will trigger reactualizing options on all of them, which + // in turn will reactualize the form's options. + // To avoid calling actualizeOptions so many times on the form + // for nothing, _withoutReactualizingFormOptions temporarily disables + // the method actualizeOptions on this form while `fn` is called. + _withoutReactualizingFormOptions: function _withoutReactualizingFormOptions(fn) { + var oldActualizeOptions = this.actualizeOptions; + this.actualizeOptions = function () { + return this; + }; + var result = fn(); + this.actualizeOptions = oldActualizeOptions; + return result; + }, + + // Internal only. + // Shortcut to trigger an event + // Returns true iff event is not interrupted and default not prevented. + _trigger: function _trigger(eventName) { + return this.trigger('form:' + eventName); + } + + }; + + var Constraint = function Constraint(parsleyField, name, requirements, priority, isDomConstraint) { + var validatorSpec = window.Parsley._validatorRegistry.validators[name]; + var validator = new Validator(validatorSpec); + priority = priority || parsleyField.options[name + 'Priority'] || validator.priority; + isDomConstraint = true === isDomConstraint; + + _extends(this, { + validator: validator, + name: name, + requirements: requirements, + priority: priority, + isDomConstraint: isDomConstraint + }); + this._parseRequirements(parsleyField.options); + }; + + var capitalize = function capitalize(str) { + var cap = str[0].toUpperCase(); + return cap + str.slice(1); + }; + + Constraint.prototype = { + validate: function validate(value, instance) { + var _validator; + + return (_validator = this.validator).validate.apply(_validator, [value].concat(_toConsumableArray(this.requirementList), [instance])); + }, + + _parseRequirements: function _parseRequirements(options) { + var _this9 = this; + + this.requirementList = this.validator.parseRequirements(this.requirements, function (key) { + return options[_this9.name + capitalize(key)]; + }); + } + }; + + var Field = function Field(field, domOptions, options, parsleyFormInstance) { + this.__class__ = 'Field'; + + this.element = field; + this.$element = $(field); + + // Set parent if we have one + if ('undefined' !== typeof parsleyFormInstance) { + this.parent = parsleyFormInstance; + } + + this.options = options; + this.domOptions = domOptions; + + // Initialize some properties + this.constraints = []; + this.constraintsByName = {}; + this.validationResult = true; + + // Bind constraints + this._bindConstraints(); + }; + + var parsley_field__statusMapping = { pending: null, resolved: true, rejected: false }; + + Field.prototype = { + // # Public API + // Validate field and trigger some events for mainly `UI` + // @returns `true`, an array of the validators that failed, or + // `null` if validation is not finished. Prefer using whenValidate + validate: function validate(options) { + if (arguments.length >= 1 && !$.isPlainObject(options)) { + Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.'); + options = { options: options }; + } + var promise = this.whenValidate(options); + if (!promise) // If excluded with `group` option + return true; + switch (promise.state()) { + case 'pending': + return null; + case 'resolved': + return true; + case 'rejected': + return this.validationResult; + } + }, + + // Validate field and trigger some events for mainly `UI` + // @returns a promise that succeeds only when all validations do + // or `undefined` if field is not in the given `group`. + whenValidate: function whenValidate() { + var _whenValid$always$done$fail$always, + _this10 = this; + + var _ref9 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + var force = _ref9.force; + var group = _ref9.group; + + // do not validate a field if not the same as given validation group + this.refresh(); + if (group && !this._isInGroup(group)) return; + + this.value = this.getValue(); + + // Field Validate event. `this.value` could be altered for custom needs + this._trigger('validate'); + + return (_whenValid$always$done$fail$always = this.whenValid({ force: force, value: this.value, _refreshed: true }).always(function () { + _this10._reflowUI(); + }).done(function () { + _this10._trigger('success'); + }).fail(function () { + _this10._trigger('error'); + }).always(function () { + _this10._trigger('validated'); + })).pipe.apply(_whenValid$always$done$fail$always, _toConsumableArray(this._pipeAccordingToValidationResult())); + }, + + hasConstraints: function hasConstraints() { + return 0 !== this.constraints.length; + }, + + // An empty optional field does not need validation + needsValidation: function needsValidation(value) { + if ('undefined' === typeof value) value = this.getValue(); + + // If a field is empty and not required, it is valid + // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators + if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty) return false; + + return true; + }, + + _isInGroup: function _isInGroup(group) { + if (Array.isArray(this.options.group)) return -1 !== $.inArray(group, this.options.group); + return this.options.group === group; + }, + + // Just validate field. Do not trigger any event. + // Returns `true` iff all constraints pass, `false` if there are failures, + // or `null` if the result can not be determined yet (depends on a promise) + // See also `whenValid`. + isValid: function isValid(options) { + if (arguments.length >= 1 && !$.isPlainObject(options)) { + Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.'); + + var _arguments3 = _slice.call(arguments); + + var force = _arguments3[0]; + var value = _arguments3[1]; + + options = { force: force, value: value }; + } + var promise = this.whenValid(options); + if (!promise) // Excluded via `group` + return true; + return parsley_field__statusMapping[promise.state()]; + }, + + // Just validate field. Do not trigger any event. + // @returns a promise that succeeds only when all validations do + // or `undefined` if the field is not in the given `group`. + // The argument `force` will force validation of empty fields. + // If a `value` is given, it will be validated instead of the value of the input. + whenValid: function whenValid() { + var _this11 = this; + + var _ref10 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + var _ref10$force = _ref10.force; + var force = _ref10$force === undefined ? false : _ref10$force; + var value = _ref10.value; + var group = _ref10.group; + var _refreshed = _ref10._refreshed; + + // Recompute options and rebind constraints to have latest changes + if (!_refreshed) this.refresh(); + // do not validate a field if not the same as given validation group + if (group && !this._isInGroup(group)) return; + + this.validationResult = true; + + // A field without constraint is valid + if (!this.hasConstraints()) return $.when(); + + // Value could be passed as argument, needed to add more power to 'field:validate' + if ('undefined' === typeof value || null === value) value = this.getValue(); + + if (!this.needsValidation(value) && true !== force) return $.when(); + + var groupedConstraints = this._getGroupedConstraints(); + var promises = []; + $.each(groupedConstraints, function (_, constraints) { + // Process one group of constraints at a time, we validate the constraints + // and combine the promises together. + var promise = Utils.all($.map(constraints, function (constraint) { + return _this11._validateConstraint(value, constraint); + })); + promises.push(promise); + if (promise.state() === 'rejected') return false; // Interrupt processing if a group has already failed + }); + return Utils.all(promises); + }, + + // @returns a promise + _validateConstraint: function _validateConstraint(value, constraint) { + var _this12 = this; + + var result = constraint.validate(value, this); + // Map false to a failed promise + if (false === result) result = $.Deferred().reject(); + // Make sure we return a promise and that we record failures + return Utils.all([result]).fail(function (errorMessage) { + if (!(_this12.validationResult instanceof Array)) _this12.validationResult = []; + _this12.validationResult.push({ + assert: constraint, + errorMessage: 'string' === typeof errorMessage && errorMessage + }); + }); + }, + + // @returns Parsley field computed value that could be overrided or configured in DOM + getValue: function getValue() { + var value; + + // Value could be overriden in DOM or with explicit options + if ('function' === typeof this.options.value) value = this.options.value(this);else if ('undefined' !== typeof this.options.value) value = this.options.value;else value = this.$element.val(); + + // Handle wrong DOM or configurations + if ('undefined' === typeof value || null === value) return ''; + + return this._handleWhitespace(value); + }, + + // Reset UI + reset: function reset() { + this._resetUI(); + return this._trigger('reset'); + }, + + // Destroy Parsley instance (+ UI) + destroy: function destroy() { + // Field case: emit destroy event to clean UI and then destroy stored instance + this._destroyUI(); + this.$element.removeData('Parsley'); + this.$element.removeData('FieldMultiple'); + this._trigger('destroy'); + }, + + // Actualize options and rebind constraints + refresh: function refresh() { + this._refreshConstraints(); + return this; + }, + + _refreshConstraints: function _refreshConstraints() { + return this.actualizeOptions()._bindConstraints(); + }, + + refreshConstraints: function refreshConstraints() { + Utils.warnOnce("Parsley's refreshConstraints is deprecated. Please use refresh"); + return this.refresh(); + }, + + /** + * Add a new constraint to a field + * + * @param {String} name + * @param {Mixed} requirements optional + * @param {Number} priority optional + * @param {Boolean} isDomConstraint optional + */ + addConstraint: function addConstraint(name, requirements, priority, isDomConstraint) { + + if (window.Parsley._validatorRegistry.validators[name]) { + var constraint = new Constraint(this, name, requirements, priority, isDomConstraint); + + // if constraint already exist, delete it and push new version + if ('undefined' !== this.constraintsByName[constraint.name]) this.removeConstraint(constraint.name); + + this.constraints.push(constraint); + this.constraintsByName[constraint.name] = constraint; + } + + return this; + }, + + // Remove a constraint + removeConstraint: function removeConstraint(name) { + for (var i = 0; i < this.constraints.length; i++) if (name === this.constraints[i].name) { + this.constraints.splice(i, 1); + break; + } + delete this.constraintsByName[name]; + return this; + }, + + // Update a constraint (Remove + re-add) + updateConstraint: function updateConstraint(name, parameters, priority) { + return this.removeConstraint(name).addConstraint(name, parameters, priority); + }, + + // # Internals + + // Internal only. + // Bind constraints from config + options + DOM + _bindConstraints: function _bindConstraints() { + var constraints = []; + var constraintsByName = {}; + + // clean all existing DOM constraints to only keep javascript user constraints + for (var i = 0; i < this.constraints.length; i++) if (false === this.constraints[i].isDomConstraint) { + constraints.push(this.constraints[i]); + constraintsByName[this.constraints[i].name] = this.constraints[i]; + } + + this.constraints = constraints; + this.constraintsByName = constraintsByName; + + // then re-add Parsley DOM-API constraints + for (var name in this.options) this.addConstraint(name, this.options[name], undefined, true); + + // finally, bind special HTML5 constraints + return this._bindHtml5Constraints(); + }, + + // Internal only. + // Bind specific HTML5 constraints to be HTML5 compliant + _bindHtml5Constraints: function _bindHtml5Constraints() { + // html5 required + if (null !== this.element.getAttribute('required')) this.addConstraint('required', true, undefined, true); + + // html5 pattern + if (null !== this.element.getAttribute('pattern')) this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true); + + // range + var min = this.element.getAttribute('min'); + var max = this.element.getAttribute('max'); + if (null !== min && null !== max) this.addConstraint('range', [min, max], undefined, true); + + // HTML5 min + else if (null !== min) this.addConstraint('min', min, undefined, true); + + // HTML5 max + else if (null !== max) this.addConstraint('max', max, undefined, true); + + // length + if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength')) this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true); + + // HTML5 minlength + else if (null !== this.element.getAttribute('minlength')) this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true); + + // HTML5 maxlength + else if (null !== this.element.getAttribute('maxlength')) this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true); + + // html5 types + var type = Utils.getType(this.element); + + // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise + if ('number' === type) { + return this.addConstraint('type', ['number', { + step: this.element.getAttribute('step') || '1', + base: min || this.element.getAttribute('value') + }], undefined, true); + // Regular other HTML5 supported types + } else if (/^(email|url|range|date)$/i.test(type)) { + return this.addConstraint('type', type, undefined, true); + } + return this; + }, + + // Internal only. + // Field is required if have required constraint without `false` value + _isRequired: function _isRequired() { + if ('undefined' === typeof this.constraintsByName.required) return false; + + return false !== this.constraintsByName.required.requirements; + }, + + // Internal only. + // Shortcut to trigger an event + _trigger: function _trigger(eventName) { + return this.trigger('field:' + eventName); + }, + + // Internal only + // Handles whitespace in a value + // Use `data-parsley-whitespace="squish"` to auto squish input value + // Use `data-parsley-whitespace="trim"` to auto trim input value + _handleWhitespace: function _handleWhitespace(value) { + if (true === this.options.trimValue) Utils.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"'); + + if ('squish' === this.options.whitespace) value = value.replace(/\s{2,}/g, ' '); + + if ('trim' === this.options.whitespace || 'squish' === this.options.whitespace || true === this.options.trimValue) value = Utils.trimString(value); + + return value; + }, + + _isDateInput: function _isDateInput() { + var c = this.constraintsByName.type; + return c && c.requirements === 'date'; + }, + + // Internal only. + // Returns the constraints, grouped by descending priority. + // The result is thus an array of arrays of constraints. + _getGroupedConstraints: function _getGroupedConstraints() { + if (false === this.options.priorityEnabled) return [this.constraints]; + + var groupedConstraints = []; + var index = {}; + + // Create array unique of priorities + for (var i = 0; i < this.constraints.length; i++) { + var p = this.constraints[i].priority; + if (!index[p]) groupedConstraints.push(index[p] = []); + index[p].push(this.constraints[i]); + } + // Sort them by priority DESC + groupedConstraints.sort(function (a, b) { + return b[0].priority - a[0].priority; + }); + + return groupedConstraints; + } + + }; + + var parsley_field = Field; + + var Multiple = function Multiple() { + this.__class__ = 'FieldMultiple'; + }; + + Multiple.prototype = { + // Add new `$element` sibling for multiple field + addElement: function addElement($element) { + this.$elements.push($element); + + return this; + }, + + // See `Field._refreshConstraints()` + _refreshConstraints: function _refreshConstraints() { + var fieldConstraints; + + this.constraints = []; + + // Select multiple special treatment + if (this.element.nodeName === 'SELECT') { + this.actualizeOptions()._bindConstraints(); + + return this; + } + + // Gather all constraints for each input in the multiple group + for (var i = 0; i < this.$elements.length; i++) { + + // Check if element have not been dynamically removed since last binding + if (!$('html').has(this.$elements[i]).length) { + this.$elements.splice(i, 1); + continue; + } + + fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints; + + for (var j = 0; j < fieldConstraints.length; j++) this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint); + } + + return this; + }, + + // See `Field.getValue()` + getValue: function getValue() { + // Value could be overriden in DOM + if ('function' === typeof this.options.value) return this.options.value(this);else if ('undefined' !== typeof this.options.value) return this.options.value; + + // Radio input case + if (this.element.nodeName === 'INPUT') { + var type = Utils.getType(this.element); + if (type === 'radio') return this._findRelated().filter(':checked').val() || ''; + + // checkbox input case + if (type === 'checkbox') { + var values = []; + + this._findRelated().filter(':checked').each(function () { + values.push($(this).val()); + }); + + return values; + } + } + + // Select multiple case + if (this.element.nodeName === 'SELECT' && null === this.$element.val()) return []; + + // Default case that should never happen + return this.$element.val(); + }, + + _init: function _init() { + this.$elements = [this.$element]; + + return this; + } + }; + + var Factory = function Factory(element, options, parsleyFormInstance) { + this.element = element; + this.$element = $(element); + + // If the element has already been bound, returns its saved Parsley instance + var savedparsleyFormInstance = this.$element.data('Parsley'); + if (savedparsleyFormInstance) { + + // If the saved instance has been bound without a Form parent and there is one given in this call, add it + if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) { + savedparsleyFormInstance.parent = parsleyFormInstance; + savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options); + } + + if ('object' === typeof options) { + _extends(savedparsleyFormInstance.options, options); + } + + return savedparsleyFormInstance; + } + + // Parsley must be instantiated with a DOM element or jQuery $element + if (!this.$element.length) throw new Error('You must bind Parsley on an existing element.'); + + if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__) throw new Error('Parent instance must be a Form instance'); + + this.parent = parsleyFormInstance || window.Parsley; + return this.init(options); + }; + + Factory.prototype = { + init: function init(options) { + this.__class__ = 'Parsley'; + this.__version__ = '2.8.1'; + this.__id__ = Utils.generateID(); + + // Pre-compute options + this._resetOptions(options); + + // A Form instance is obviously a `
    ` element but also every node that is not an input and has the `data-parsley-validate` attribute + if (this.element.nodeName === 'FORM' || Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)) return this.bind('parsleyForm'); + + // Every other element is bound as a `Field` or `FieldMultiple` + return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField'); + }, + + isMultiple: function isMultiple() { + var type = Utils.getType(this.element); + return type === 'radio' || type === 'checkbox' || this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple'); + }, + + // Multiples fields are a real nightmare :( + // Maybe some refactoring would be appreciated here... + handleMultiple: function handleMultiple() { + var _this13 = this; + + var name; + var multiple; + var parsleyMultipleInstance; + + // Handle multiple name + this.options.multiple = this.options.multiple || (name = this.element.getAttribute('name')) || this.element.getAttribute('id'); + + // Special select multiple input + if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) { + this.options.multiple = this.options.multiple || this.__id__; + return this.bind('parsleyFieldMultiple'); + + // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it + } else if (!this.options.multiple) { + Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element); + return this; + } + + // Remove special chars + this.options.multiple = this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g, ''); + + // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name + if (name) { + $('input[name="' + name + '"]').each(function (i, input) { + var type = Utils.getType(input); + if (type === 'radio' || type === 'checkbox') input.setAttribute(_this13.options.namespace + 'multiple', _this13.options.multiple); + }); + } + + // Check here if we don't already have a related multiple instance saved + var $previouslyRelated = this._findRelated(); + for (var i = 0; i < $previouslyRelated.length; i++) { + parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley'); + if ('undefined' !== typeof parsleyMultipleInstance) { + + if (!this.$element.data('FieldMultiple')) { + parsleyMultipleInstance.addElement(this.$element); + } + + break; + } + } + + // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')` + // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance + this.bind('parsleyField', true); + + return parsleyMultipleInstance || this.bind('parsleyFieldMultiple'); + }, + + // Return proper `Form`, `Field` or `FieldMultiple` + bind: function bind(type, doNotStore) { + var parsleyInstance; + + switch (type) { + case 'parsleyForm': + parsleyInstance = $.extend(new Form(this.element, this.domOptions, this.options), new Base(), window.ParsleyExtend)._bindFields(); + break; + case 'parsleyField': + parsleyInstance = $.extend(new parsley_field(this.element, this.domOptions, this.options, this.parent), new Base(), window.ParsleyExtend); + break; + case 'parsleyFieldMultiple': + parsleyInstance = $.extend(new parsley_field(this.element, this.domOptions, this.options, this.parent), new Multiple(), new Base(), window.ParsleyExtend)._init(); + break; + default: + throw new Error(type + 'is not a supported Parsley type'); + } + + if (this.options.multiple) Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple); + + if ('undefined' !== typeof doNotStore) { + this.$element.data('FieldMultiple', parsleyInstance); + + return parsleyInstance; + } + + // Store the freshly bound instance in a DOM element for later access using jQuery `data()` + this.$element.data('Parsley', parsleyInstance); + + // Tell the world we have a new Form or Field instance! + parsleyInstance._actualizeTriggers(); + parsleyInstance._trigger('init'); + + return parsleyInstance; + } + }; + + var vernums = $.fn.jquery.split('.'); + if (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) { + throw "The loaded version of jQuery is too old. Please upgrade to 1.8.x or better."; + } + if (!vernums.forEach) { + Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim'); + } + // Inherit `on`, `off` & `trigger` to Parsley: + var Parsley = _extends(new Base(), { + element: document, + $element: $(document), + actualizeOptions: null, + _resetOptions: null, + Factory: Factory, + version: '2.8.1' + }); + + // Supplement Field and Form with Base + // This way, the constructors will have access to those methods + _extends(parsley_field.prototype, UI.Field, Base.prototype); + _extends(Form.prototype, UI.Form, Base.prototype); + // Inherit actualizeOptions and _resetOptions: + _extends(Factory.prototype, Base.prototype); + + // ### jQuery API + // `$('.elem').parsley(options)` or `$('.elem').psly(options)` + $.fn.parsley = $.fn.psly = function (options) { + if (this.length > 1) { + var instances = []; + + this.each(function () { + instances.push($(this).parsley(options)); + }); + + return instances; + } + + // Return undefined if applied to non existing DOM element + if (this.length == 0) { + return; + } + + return new Factory(this[0], options); + }; + + // ### Field and Form extension + // Ensure the extension is now defined if it wasn't previously + if ('undefined' === typeof window.ParsleyExtend) window.ParsleyExtend = {}; + + // ### Parsley config + // Inherit from ParsleyDefault, and copy over any existing values + Parsley.options = _extends(Utils.objectCreate(Defaults), window.ParsleyConfig); + window.ParsleyConfig = Parsley.options; // Old way of accessing global options + + // ### Globals + window.Parsley = window.psly = Parsley; + Parsley.Utils = Utils; + window.ParsleyUtils = {}; + $.each(Utils, function (key, value) { + if ('function' === typeof value) { + window.ParsleyUtils[key] = function () { + Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.'); + return Utils[key].apply(Utils, arguments); + }; + } + }); + + // ### Define methods that forward to the registry, and deprecate all access except through window.Parsley + var registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n); + window.ParsleyValidator = {}; + $.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) { + window.Parsley[method] = function () { + return registry[method].apply(registry, arguments); + }; + window.ParsleyValidator[method] = function () { + var _window$Parsley; + + Utils.warnOnce('Accessing the method \'' + method + '\' through Validator is deprecated. Simply call \'window.Parsley.' + method + '(...)\''); + return (_window$Parsley = window.Parsley)[method].apply(_window$Parsley, arguments); + }; + }); + + // ### UI + // Deprecated global object + window.Parsley.UI = UI; + window.ParsleyUI = { + removeError: function removeError(instance, name, doNotUpdateClass) { + var updateClass = true !== doNotUpdateClass; + Utils.warnOnce('Accessing UI is deprecated. Call \'removeError\' on the instance directly. Please comment in issue 1073 as to your need to call this method.'); + return instance.removeError(name, { updateClass: updateClass }); + }, + getErrorsMessages: function getErrorsMessages(instance) { + Utils.warnOnce('Accessing UI is deprecated. Call \'getErrorsMessages\' on the instance directly.'); + return instance.getErrorsMessages(); + } + }; + $.each('addError updateError'.split(' '), function (i, method) { + window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) { + var updateClass = true !== doNotUpdateClass; + Utils.warnOnce('Accessing UI is deprecated. Call \'' + method + '\' on the instance directly. Please comment in issue 1073 as to your need to call this method.'); + return instance[method](name, { message: message, assert: assert, updateClass: updateClass }); + }; + }); + + // ### PARSLEY auto-binding + // Prevent it by setting `ParsleyConfig.autoBind` to `false` + if (false !== window.ParsleyConfig.autoBind) { + $(function () { + // Works only on `data-parsley-validate`. + if ($('[data-parsley-validate]').length) $('[data-parsley-validate]').parsley(); + }); + } + + var o = $({}); + var deprecated = function deprecated() { + Utils.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley"); + }; + + // Returns an event handler that calls `fn` with the arguments it expects + function adapt(fn, context) { + // Store to allow unbinding + if (!fn.parsleyAdaptedCallback) { + fn.parsleyAdaptedCallback = function () { + var args = Array.prototype.slice.call(arguments, 0); + args.unshift(this); + fn.apply(context || o, args); + }; + } + return fn.parsleyAdaptedCallback; + } + + var eventPrefix = 'parsley:'; + // Converts 'parsley:form:validate' into 'form:validate' + function eventName(name) { + if (name.lastIndexOf(eventPrefix, 0) === 0) return name.substr(eventPrefix.length); + return name; + } + + // $.listen is deprecated. Use Parsley.on instead. + $.listen = function (name, callback) { + var context; + deprecated(); + if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) { + context = arguments[1]; + callback = arguments[2]; + } + + if ('function' !== typeof callback) throw new Error('Wrong parameters'); + + window.Parsley.on(eventName(name), adapt(callback, context)); + }; + + $.listenTo = function (instance, name, fn) { + deprecated(); + if (!(instance instanceof parsley_field) && !(instance instanceof Form)) throw new Error('Must give Parsley instance'); + + if ('string' !== typeof name || 'function' !== typeof fn) throw new Error('Wrong parameters'); + + instance.on(eventName(name), adapt(fn)); + }; + + $.unsubscribe = function (name, fn) { + deprecated(); + if ('string' !== typeof name || 'function' !== typeof fn) throw new Error('Wrong arguments'); + window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback); + }; + + $.unsubscribeTo = function (instance, name) { + deprecated(); + if (!(instance instanceof parsley_field) && !(instance instanceof Form)) throw new Error('Must give Parsley instance'); + instance.off(eventName(name)); + }; + + $.unsubscribeAll = function (name) { + deprecated(); + window.Parsley.off(eventName(name)); + $('form,input,textarea,select').each(function () { + var instance = $(this).data('Parsley'); + if (instance) { + instance.off(eventName(name)); + } + }); + }; + + // $.emit is deprecated. Use jQuery events instead. + $.emit = function (name, instance) { + var _instance; + + deprecated(); + var instanceGiven = instance instanceof parsley_field || instance instanceof Form; + var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1); + args.unshift(eventName(name)); + if (!instanceGiven) { + instance = window.Parsley; + } + (_instance = instance).trigger.apply(_instance, _toConsumableArray(args)); + }; + + var pubsub = {}; + + $.extend(true, Parsley, { + asyncValidators: { + 'default': { + fn: function fn(xhr) { + // By default, only status 2xx are deemed successful. + // Note: we use status instead of state() because responses with status 200 + // but invalid messages (e.g. an empty body for content type set to JSON) will + // result in state() === 'rejected'. + return xhr.status >= 200 && xhr.status < 300; + }, + url: false + }, + reverse: { + fn: function fn(xhr) { + // If reverse option is set, a failing ajax request is considered successful + return xhr.status < 200 || xhr.status >= 300; + }, + url: false + } + }, + + addAsyncValidator: function addAsyncValidator(name, fn, url, options) { + Parsley.asyncValidators[name] = { + fn: fn, + url: url || false, + options: options || {} + }; + + return this; + } + + }); + + Parsley.addValidator('remote', { + requirementType: { + '': 'string', + 'validator': 'string', + 'reverse': 'boolean', + 'options': 'object' + }, + + validateString: function validateString(value, url, options, instance) { + var data = {}; + var ajaxOptions; + var csr; + var validator = options.validator || (true === options.reverse ? 'reverse' : 'default'); + + if ('undefined' === typeof Parsley.asyncValidators[validator]) throw new Error('Calling an undefined async validator: `' + validator + '`'); + + url = Parsley.asyncValidators[validator].url || url; + + // Fill current value + if (url.indexOf('{value}') > -1) { + url = url.replace('{value}', encodeURIComponent(value)); + } else { + data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value; + } + + // Merge options passed in from the function with the ones in the attribute + var remoteOptions = $.extend(true, options.options || {}, Parsley.asyncValidators[validator].options); + + // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options` + ajaxOptions = $.extend(true, {}, { + url: url, + data: data, + type: 'GET' + }, remoteOptions); + + // Generate store key based on ajax options + instance.trigger('field:ajaxoptions', instance, ajaxOptions); + + csr = $.param(ajaxOptions); + + // Initialise querry cache + if ('undefined' === typeof Parsley._remoteCache) Parsley._remoteCache = {}; + + // Try to retrieve stored xhr + var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions); + + var handleXhr = function handleXhr() { + var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options); + if (!result) // Map falsy results to rejected promise + result = $.Deferred().reject(); + return $.when(result); + }; + + return xhr.then(handleXhr, handleXhr); + }, + + priority: -1 + }); + + Parsley.on('form:submit', function () { + Parsley._remoteCache = {}; + }); + + Base.prototype.addAsyncValidator = function () { + Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`'); + return Parsley.addAsyncValidator.apply(Parsley, arguments); + }; + + // This is included with the Parsley library itself, + // thus there is no use in adding it to your project. + Parsley.addMessages('en', { + defaultMessage: "This value seems to be invalid.", + type: { + email: "This value should be a valid email.", + url: "This value should be a valid url.", + number: "This value should be a valid number.", + integer: "This value should be a valid integer.", + digits: "This value should be digits.", + alphanum: "This value should be alphanumeric." + }, + notblank: "This value should not be blank.", + required: "This value is required.", + pattern: "This value seems to be invalid.", + min: "This value should be greater than or equal to %s.", + max: "This value should be lower than or equal to %s.", + range: "This value should be between %s and %s.", + minlength: "This value is too short. It should have %s characters or more.", + maxlength: "This value is too long. It should have %s characters or fewer.", + length: "This value length is invalid. It should be between %s and %s characters long.", + mincheck: "You must select at least %s choices.", + maxcheck: "You must select %s choices or fewer.", + check: "You must select between %s and %s choices.", + equalto: "This value should be the same." + }); + + Parsley.setLocale('en'); + + /** + * inputevent - Alleviate browser bugs for input events + * https://github.com/marcandre/inputevent + * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm) + * @author Marc-Andre Lafortune + * @license MIT + */ + + function InputEvent() { + var _this14 = this; + + var globals = window || global; + + // Slightly odd way construct our object. This way methods are force bound. + // Used to test for duplicate library. + _extends(this, { + + // For browsers that do not support isTrusted, assumes event is native. + isNativeEvent: function isNativeEvent(evt) { + return evt.originalEvent && evt.originalEvent.isTrusted !== false; + }, + + fakeInputEvent: function fakeInputEvent(evt) { + if (_this14.isNativeEvent(evt)) { + $(evt.target).trigger('input'); + } + }, + + misbehaves: function misbehaves(evt) { + if (_this14.isNativeEvent(evt)) { + _this14.behavesOk(evt); + $(document).on('change.inputevent', evt.data.selector, _this14.fakeInputEvent); + _this14.fakeInputEvent(evt); + } + }, + + behavesOk: function behavesOk(evt) { + if (_this14.isNativeEvent(evt)) { + $(document) // Simply unbinds the testing handler + .off('input.inputevent', evt.data.selector, _this14.behavesOk).off('change.inputevent', evt.data.selector, _this14.misbehaves); + } + }, + + // Bind the testing handlers + install: function install() { + if (globals.inputEventPatched) { + return; + } + globals.inputEventPatched = '0.0.3'; + var _arr = ['select', 'input[type="checkbox"]', 'input[type="radio"]', 'input[type="file"]']; + for (var _i = 0; _i < _arr.length; _i++) { + var selector = _arr[_i]; + $(document).on('input.inputevent', selector, { selector: selector }, _this14.behavesOk).on('change.inputevent', selector, { selector: selector }, _this14.misbehaves); + } + }, + + uninstall: function uninstall() { + delete globals.inputEventPatched; + $(document).off('.inputevent'); + } + + }); + }; + + var inputevent = new InputEvent(); + + inputevent.install(); + + var parsley = Parsley; + + return parsley; +}); +//# sourceMappingURL=parsley.js.map diff --git a/public/js/parsley/parsley.js.map b/public/js/parsley/parsley.js.map new file mode 100644 index 00000000..e5fbb0de --- /dev/null +++ b/public/js/parsley/parsley.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["parsley.js","src/parsley/utils.js","src/parsley/defaults.js","src/parsley/base.js","src/parsley/validator.js","src/parsley/validator_registry.js","src/parsley/ui.js","src/parsley/form.js","src/parsley/constraint.js","src/parsley/field.js","src/parsley/multiple.js","src/parsley/factory.js","src/parsley/main.js","src/parsley/pubsub.js","src/parsley/remote.js","src/i18n/en.js","src/vendor/inputevent.js","src/parsley.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,AAAC,CAAA,UAAU,MAAM,EAAE,OAAO,EAAE;AAC1B,SAAO,OAAO,KAAK,QAAQ,I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A,CACC,EAAA,CAAG,kBAAA,EAAoB,QAAA,EAAU,EAAC,QAAA,EAAA,QAAA,EAAA,EAAW,QAAK,SAAA,CAAA,CAClD,EAAA,CAAG,mBAAA,EAAqB,QAAA,EAAU,EAAC,QAAA,EAAA,QAAA,EAAA,EAAW,QAAK,UAAA,CAAA,CAAA;SAC9D;OACA;;AAEI,eAAA,EAAW,qBAAM;AACf,eAAO,OAAA,CAAQ,iBAAA,CAAA;AACf,SAAA,CAAE,QAAA,CAAA,CAAU,GAAA,CAAI,aAAA,CAAA,CAAA;OACtB;;KAEA,CAAA,CAAA;GACC,CAAA;;AAhED,MAAA,UAAA,GAkEe,IAAI,UAAA,EAAA,CAAA;;AC3DnB,YAAW,CAAA,OAAA,EAAA,CAAA;;AAPX,MAAA,OAAA,GAAA,OAAA,CAAA;;AjB89EE,SAAO,OAAO,CAAC;CAEhB,CAAC,CAAE","file":"parsley.js","sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :\n typeof define === 'function' && define.amd ? define(['jquery'], factory) :\n global.parsley = factory(global.$)\n}(this, function ($) { 'use strict';\n\n var globalID = 1;\n var pastWarnings = {};\n\n var Utils = {\n // Parsley DOM-API\n // returns object from dom attributes and values\n attr: function (element, namespace, obj) {\n var i;\n var attribute;\n var attributes;\n var regex = new RegExp('^' + namespace, 'i');\n\n if ('undefined' === typeof obj)\n obj = {};\n else {\n // Clear all own properties. This won't affect prototype's values\n for (i in obj) {\n if (obj.hasOwnProperty(i))\n delete obj[i];\n }\n }\n\n if (!element)\n return obj;\n\n attributes = element.attributes;\n for (i = attributes.length; i--; ) {\n attribute = attributes[i];\n\n if (attribute && attribute.specified && regex.test(attribute.name)) {\n obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value);\n }\n }\n\n return obj;\n },\n\n checkAttr: function (element, namespace, checkAttr) {\n return element.hasAttribute(namespace + checkAttr);\n },\n\n setAttr: function (element, namespace, attr, value) {\n element.setAttribute(this.dasherize(namespace + attr), String(value));\n },\n\n getType: function(element) {\n return element.getAttribute('type') || 'text';\n },\n\n generateID: function () {\n return '' + globalID++;\n },\n\n /** Third party functions **/\n deserializeValue: function (value) {\n var num;\n\n try {\n return value ?\n value == \"true\" ||\n (value == \"false\" ? false :\n value == \"null\" ? null :\n !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? JSON.parse(value) :\n value)\n : value;\n } catch (e) { return value; }\n },\n\n // Zepto camelize function\n camelize: function (str) {\n return str.replace(/-+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n // Zepto dasherize function\n dasherize: function (str) {\n return str.replace(/::/g, '/')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .replace(/([a-z\\d])([A-Z])/g, '$1_$2')\n .replace(/_/g, '-')\n .toLowerCase();\n },\n\n warn: function () {\n if (window.console && 'function' === typeof window.console.warn)\n window.console.warn(...arguments);\n },\n\n warnOnce: function(msg) {\n if (!pastWarnings[msg]) {\n pastWarnings[msg] = true;\n this.warn(...arguments);\n }\n },\n\n _resetWarnings: function () {\n pastWarnings = {};\n },\n\n trimString: function(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n },\n\n parse: {\n date: function(string) {\n let parsed = string.match(/^(\\d{4,})-(\\d\\d)-(\\d\\d)$/);\n if (!parsed)\n return null;\n let [_, year, month, day] = parsed.map(x => parseInt(x, 10));\n let date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day)\n return null;\n return date;\n },\n string: function(string) {\n return string;\n },\n integer: function(string) {\n if (isNaN(string))\n return null;\n return parseInt(string, 10);\n },\n number: function(string) {\n if (isNaN(string))\n throw null;\n return parseFloat(string);\n },\n 'boolean': function _boolean(string) {\n return !(/^\\s*false\\s*$/i.test(string));\n },\n object: function(string) {\n return Utils.deserializeValue(string);\n },\n regexp: function(regexp) {\n var flags = '';\n\n // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern\n if (/^\\/.*\\/(?:[gimy]*)$/.test(regexp)) {\n // Replace the regexp literal string with the first match group: ([gimy]*)\n // If no flag is present, this will be a blank string\n flags = regexp.replace(/.*\\/([gimy]*)$/, '$1');\n // Again, replace the regexp literal string with the first match group:\n // everything excluding the opening and closing slashes and the flags\n regexp = regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');\n } else {\n // Anchor regexp:\n regexp = '^' + regexp + '$';\n }\n return new RegExp(regexp, flags);\n }\n },\n\n parseRequirement: function(requirementType, string) {\n var converter = this.parse[requirementType || 'string'];\n if (!converter)\n throw 'Unknown requirement specification: \"' + requirementType + '\"';\n let converted = converter(string);\n if (converted === null)\n throw `Requirement is not a ${requirementType}: \"${string}\"`;\n return converted;\n },\n\n namespaceEvents: function(events, namespace) {\n events = this.trimString(events || '').split(/\\s+/);\n if (!events[0])\n return '';\n return $.map(events, evt => `${evt}.${namespace}`).join(' ');\n },\n\n difference: function(array, remove) {\n // This is O(N^2), should be optimized\n let result = [];\n $.each(array, (_, elem) => {\n if (remove.indexOf(elem) == -1)\n result.push(elem);\n });\n return result;\n },\n\n // Alter-ego to native Promise.all, but for jQuery\n all: function(promises) {\n // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements\n return $.when(...promises, 42, 42);\n },\n\n // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill\n objectCreate: Object.create || (function () {\n var Object = function () {};\n return function (prototype) {\n if (arguments.length > 1) {\n throw Error('Second argument not supported');\n }\n if (typeof prototype != 'object') {\n throw TypeError('Argument must be an object');\n }\n Object.prototype = prototype;\n var result = new Object();\n Object.prototype = null;\n return result;\n };\n })(),\n\n _SubmitSelector: 'input[type=\"submit\"], button:submit'\n };\n\n // All these options could be overriden and specified directly in DOM using\n // `data-parsley-` default DOM-API\n // eg: `inputs` can be set in DOM using `data-parsley-inputs=\"input, textarea\"`\n // eg: `data-parsley-stop-on-first-failing-constraint=\"false\"`\n\n var Defaults = {\n // ### General\n\n // Default data-namespace for DOM API\n namespace: 'data-parsley-',\n\n // Supported inputs by default\n inputs: 'input, textarea, select',\n\n // Excluded inputs by default\n excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',\n\n // Stop validating field on highest priority failing constraint\n priorityEnabled: true,\n\n // ### Field only\n\n // identifier used to group together inputs (e.g. radio buttons...)\n multiple: null,\n\n // identifier (or array of identifiers) used to validate only a select group of inputs\n group: null,\n\n // ### UI\n // Enable\\Disable error messages\n uiEnabled: true,\n\n // Key events threshold before validation\n validationThreshold: 3,\n\n // Focused field on form validation error. 'first'|'last'|'none'\n focus: 'first',\n\n // event(s) that will trigger validation before first failure. eg: `input`...\n trigger: false,\n\n // event(s) that will trigger validation after first failure.\n triggerAfterFailure: 'input',\n\n // Class that would be added on every failing validation Parsley field\n errorClass: 'parsley-error',\n\n // Same for success validation\n successClass: 'parsley-success',\n\n // Return the `$element` that will receive these above success or error classes\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n classHandler: function (Field) {},\n\n // Return the `$element` where errors will be appended\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n errorsContainer: function (Field) {},\n\n // ul elem that would receive errors' list\n errorsWrapper: '
      ',\n\n // li elem that would receive error message\n errorTemplate: '
    • '\n };\n\n var Base = function () {\n this.__id__ = Utils.generateID();\n };\n\n Base.prototype = {\n asyncSupport: true, // Deprecated\n\n _pipeAccordingToValidationResult: function () {\n var pipe = () => {\n var r = $.Deferred();\n if (true !== this.validationResult)\n r.reject();\n return r.resolve().promise();\n };\n return [pipe, pipe];\n },\n\n actualizeOptions: function () {\n Utils.attr(this.element, this.options.namespace, this.domOptions);\n if (this.parent && this.parent.actualizeOptions)\n this.parent.actualizeOptions();\n return this;\n },\n\n _resetOptions: function (initOptions) {\n this.domOptions = Utils.objectCreate(this.parent.options);\n this.options = Utils.objectCreate(this.domOptions);\n // Shallow copy of ownProperties of initOptions:\n for (var i in initOptions) {\n if (initOptions.hasOwnProperty(i))\n this.options[i] = initOptions[i];\n }\n this.actualizeOptions();\n },\n\n _listeners: null,\n\n // Register a callback for the given event name\n // Callback is called with context as the first argument and the `this`\n // The context is the current parsley instance, or window.Parsley if global\n // A return value of `false` will interrupt the calls\n on: function (name, fn) {\n this._listeners = this._listeners || {};\n var queue = this._listeners[name] = this._listeners[name] || [];\n queue.push(fn);\n\n return this;\n },\n\n // Deprecated. Use `on` instead\n subscribe: function(name, fn) {\n $.listenTo(this, name.toLowerCase(), fn);\n },\n\n // Unregister a callback (or all if none is given) for the given event name\n off: function (name, fn) {\n var queue = this._listeners && this._listeners[name];\n if (queue) {\n if (!fn) {\n delete this._listeners[name];\n } else {\n for (var i = queue.length; i--; )\n if (queue[i] === fn)\n queue.splice(i, 1);\n }\n }\n return this;\n },\n\n // Deprecated. Use `off`\n unsubscribe: function(name, fn) {\n $.unsubscribeTo(this, name.toLowerCase());\n },\n\n // Trigger an event of the given name\n // A return value of `false` interrupts the callback chain\n // Returns false if execution was interrupted\n trigger: function (name, target, extraArg) {\n target = target || this;\n var queue = this._listeners && this._listeners[name];\n var result;\n var parentResult;\n if (queue) {\n for (var i = queue.length; i--; ) {\n result = queue[i].call(target, target, extraArg);\n if (result === false) return result;\n }\n }\n if (this.parent) {\n return this.parent.trigger(name, target, extraArg);\n }\n return true;\n },\n\n asyncIsValid: function (group, force) {\n Utils.warnOnce(\"asyncIsValid is deprecated; please use whenValid instead\");\n return this.whenValid({group, force});\n },\n\n _findRelated: function () {\n return this.options.multiple ?\n $(this.parent.element.querySelectorAll(`[${this.options.namespace}multiple=\"${this.options.multiple}\"]`))\n : this.$element;\n }\n };\n\n var convertArrayRequirement = function(string, length) {\n var m = string.match(/^\\s*\\[(.*)\\]\\s*$/);\n if (!m)\n throw 'Requirement is not an array: \"' + string + '\"';\n var values = m[1].split(',').map(Utils.trimString);\n if (values.length !== length)\n throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed';\n return values;\n };\n\n var convertExtraOptionRequirement = function(requirementSpec, string, extraOptionReader) {\n var main = null;\n var extra = {};\n for (var key in requirementSpec) {\n if (key) {\n var value = extraOptionReader(key);\n if ('string' === typeof value)\n value = Utils.parseRequirement(requirementSpec[key], value);\n extra[key] = value;\n } else {\n main = Utils.parseRequirement(requirementSpec[key], string);\n }\n }\n return [main, extra];\n };\n\n // A Validator needs to implement the methods `validate` and `parseRequirements`\n\n var Validator = function(spec) {\n $.extend(true, this, spec);\n };\n\n Validator.prototype = {\n // Returns `true` iff the given `value` is valid according the given requirements.\n validate: function(value, requirementFirstArg) {\n if (this.fn) { // Legacy style validator\n\n if (arguments.length > 3) // If more args then value, requirement, instance...\n requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest\n return this.fn(value, requirementFirstArg);\n }\n\n if (Array.isArray(value)) {\n if (!this.validateMultiple)\n throw 'Validator `' + this.name + '` does not handle multiple values';\n return this.validateMultiple(...arguments);\n } else {\n let instance = arguments[arguments.length - 1];\n if (this.validateDate && instance._isDateInput()) {\n arguments[0] = Utils.parse.date(arguments[0]);\n if (arguments[0] === null)\n return false;\n return this.validateDate(...arguments);\n }\n if (this.validateNumber) {\n if (isNaN(value))\n return false;\n arguments[0] = parseFloat(arguments[0]);\n return this.validateNumber(...arguments);\n }\n if (this.validateString) {\n return this.validateString(...arguments);\n }\n throw 'Validator `' + this.name + '` only handles multiple values';\n }\n },\n\n // Parses `requirements` into an array of arguments,\n // according to `this.requirementType`\n parseRequirements: function(requirements, extraOptionReader) {\n if ('string' !== typeof requirements) {\n // Assume requirement already parsed\n // but make sure we return an array\n return Array.isArray(requirements) ? requirements : [requirements];\n }\n var type = this.requirementType;\n if (Array.isArray(type)) {\n var values = convertArrayRequirement(requirements, type.length);\n for (var i = 0; i < values.length; i++)\n values[i] = Utils.parseRequirement(type[i], values[i]);\n return values;\n } else if ($.isPlainObject(type)) {\n return convertExtraOptionRequirement(type, requirements, extraOptionReader);\n } else {\n return [Utils.parseRequirement(type, requirements)];\n }\n },\n // Defaults:\n requirementType: 'string',\n\n priority: 2\n\n };\n\n var ValidatorRegistry = function (validators, catalog) {\n this.__class__ = 'ValidatorRegistry';\n\n // Default Parsley locale is en\n this.locale = 'en';\n\n this.init(validators || {}, catalog || {});\n };\n\n var typeTesters = {\n email: /^((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/,\n\n // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers\n number: /^-?(\\d*\\.)?\\d+(e[-+]?\\d+)?$/i,\n\n integer: /^-?\\d+$/,\n\n digits: /^\\d+$/,\n\n alphanum: /^\\w+$/i,\n\n date: {\n test: value => Utils.parse.date(value) !== null\n },\n\n url: new RegExp(\n \"^\" +\n // protocol identifier\n \"(?:(?:https?|ftp)://)?\" + // ** mod: make scheme optional\n // user:pass authentication\n \"(?:\\\\S+(?::\\\\S*)?@)?\" +\n \"(?:\" +\n // IP address exclusion\n // private & local networks\n // \"(?!(?:10|127)(?:\\\\.\\\\d{1,3}){3})\" + // ** mod: allow local networks\n // \"(?!(?:169\\\\.254|192\\\\.168)(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // \"(?!172\\\\.(?:1[6-9]|2\\\\d|3[0-1])(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // IP address dotted notation octets\n // excludes loopback network 0.0.0.0\n // excludes reserved space >= 224.0.0.0\n // excludes network & broacast addresses\n // (first & last IP address of each class)\n \"(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])\" +\n \"(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}\" +\n \"(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))\" +\n \"|\" +\n // host name\n \"(?:(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)\" +\n // domain name\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)*\" +\n // TLD identifier\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff]{2,}))\" +\n \")\" +\n // port number\n \"(?::\\\\d{2,5})?\" +\n // resource path\n \"(?:/\\\\S*)?\" +\n \"$\"\n )\n };\n typeTesters.range = typeTesters.number;\n\n // See http://stackoverflow.com/a/10454560/8279\n var decimalPlaces = num => {\n var match = ('' + num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n if (!match) { return 0; }\n return Math.max(\n 0,\n // Number of digits right of decimal point.\n (match[1] ? match[1].length : 0) -\n // Adjust for scientific notation.\n (match[2] ? +match[2] : 0));\n };\n\n // parseArguments('number', ['1', '2']) => [1, 2]\n let ValidatorRegistry__parseArguments = (type, args) => args.map(Utils.parse[type]);\n // operatorToValidator returns a validating function for an operator function, applied to the given type\n let ValidatorRegistry__operatorToValidator = (type, operator) => {\n return (value, ...requirementsAndInput) => {\n requirementsAndInput.pop(); // Get rid of `input` argument\n return operator(value, ...ValidatorRegistry__parseArguments(type, requirementsAndInput));\n };\n };\n\n let ValidatorRegistry__comparisonOperator = operator => ({\n validateDate: ValidatorRegistry__operatorToValidator('date', operator),\n validateNumber: ValidatorRegistry__operatorToValidator('number', operator),\n requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s)\n priority: 30\n });\n\n ValidatorRegistry.prototype = {\n init: function (validators, catalog) {\n this.catalog = catalog;\n // Copy prototype's validators:\n this.validators = Object.assign({}, this.validators);\n\n for (var name in validators)\n this.addValidator(name, validators[name].fn, validators[name].priority);\n\n window.Parsley.trigger('parsley:validator:init');\n },\n\n // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n\n setLocale: function (locale) {\n if ('undefined' === typeof this.catalog[locale])\n throw new Error(locale + ' is not available in the catalog');\n\n this.locale = locale;\n\n return this;\n },\n\n // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true`\n addCatalog: function (locale, messages, set) {\n if ('object' === typeof messages)\n this.catalog[locale] = messages;\n\n if (true === set)\n return this.setLocale(locale);\n\n return this;\n },\n\n // Add a specific message for a given constraint in a given locale\n addMessage: function (locale, name, message) {\n if ('undefined' === typeof this.catalog[locale])\n this.catalog[locale] = {};\n\n this.catalog[locale][name] = message;\n\n return this;\n },\n\n // Add messages for a given locale\n addMessages: function (locale, nameMessageObject) {\n for (var name in nameMessageObject)\n this.addMessage(locale, name, nameMessageObject[name]);\n\n return this;\n },\n\n // Add a new validator\n //\n // addValidator('custom', {\n // requirementType: ['integer', 'integer'],\n // validateString: function(value, from, to) {},\n // priority: 22,\n // messages: {\n // en: \"Hey, that's no good\",\n // fr: \"Aye aye, pas bon du tout\",\n // }\n // })\n //\n // Old API was addValidator(name, function, priority)\n //\n addValidator: function (name, arg1, arg2) {\n if (this.validators[name])\n Utils.warn('Validator \"' + name + '\" is already defined.');\n else if (Defaults.hasOwnProperty(name)) {\n Utils.warn('\"' + name + '\" is a restricted keyword and is not a valid validator name.');\n return;\n }\n return this._setValidator(...arguments);\n },\n\n hasValidator: function (name) {\n return !!this.validators[name];\n },\n\n updateValidator: function (name, arg1, arg2) {\n if (!this.validators[name]) {\n Utils.warn('Validator \"' + name + '\" is not already defined.');\n return this.addValidator(...arguments);\n }\n return this._setValidator(...arguments);\n },\n\n removeValidator: function (name) {\n if (!this.validators[name])\n Utils.warn('Validator \"' + name + '\" is not defined.');\n\n delete this.validators[name];\n\n return this;\n },\n\n _setValidator: function (name, validator, priority) {\n if ('object' !== typeof validator) {\n // Old style validator, with `fn` and `priority`\n validator = {\n fn: validator,\n priority: priority\n };\n }\n if (!validator.validate) {\n validator = new Validator(validator);\n }\n this.validators[name] = validator;\n\n for (var locale in validator.messages || {})\n this.addMessage(locale, name, validator.messages[locale]);\n\n return this;\n },\n\n getErrorMessage: function (constraint) {\n var message;\n\n // Type constraints are a bit different, we have to match their requirements too to find right error message\n if ('type' === constraint.name) {\n var typeMessages = this.catalog[this.locale][constraint.name] || {};\n message = typeMessages[constraint.requirements];\n } else\n message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements);\n\n return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage;\n },\n\n // Kind of light `sprintf()` implementation\n formatMessage: function (string, parameters) {\n if ('object' === typeof parameters) {\n for (var i in parameters)\n string = this.formatMessage(string, parameters[i]);\n\n return string;\n }\n\n return 'string' === typeof string ? string.replace(/%s/i, parameters) : '';\n },\n\n // Here is the Parsley default validators list.\n // A validator is an object with the following key values:\n // - priority: an integer\n // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these\n // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise\n // Alternatively, a validator can be a function that returns such an object\n //\n validators: {\n notblank: {\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 2\n },\n required: {\n validateMultiple: function(values) {\n return values.length > 0;\n },\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 512\n },\n type: {\n validateString: function(value, type, {step = 'any', base = 0} = {}) {\n var tester = typeTesters[type];\n if (!tester) {\n throw new Error('validator type `' + type + '` is not supported');\n }\n if (!tester.test(value))\n return false;\n if ('number' === type) {\n if (!/^any$/i.test(step || '')) {\n var nb = Number(value);\n var decimals = Math.max(decimalPlaces(step), decimalPlaces(base));\n if (decimalPlaces(nb) > decimals) // Value can't have too many decimals\n return false;\n // Be careful of rounding errors by using integers.\n var toInt = f => Math.round(f * Math.pow(10, decimals));\n if ((toInt(nb) - toInt(base)) % toInt(step) != 0)\n return false;\n }\n }\n return true;\n },\n requirementType: {\n '': 'string',\n step: 'string',\n base: 'number'\n },\n priority: 256\n },\n pattern: {\n validateString: function(value, regexp) {\n return regexp.test(value);\n },\n requirementType: 'regexp',\n priority: 64\n },\n minlength: {\n validateString: function (value, requirement) {\n return value.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxlength: {\n validateString: function (value, requirement) {\n return value.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n length: {\n validateString: function (value, min, max) {\n return value.length >= min && value.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n mincheck: {\n validateMultiple: function (values, requirement) {\n return values.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxcheck: {\n validateMultiple: function (values, requirement) {\n return values.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n check: {\n validateMultiple: function (values, min, max) {\n return values.length >= min && values.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n min: ValidatorRegistry__comparisonOperator((value, requirement) => value >= requirement),\n max: ValidatorRegistry__comparisonOperator((value, requirement) => value <= requirement),\n range: ValidatorRegistry__comparisonOperator((value, min, max) => value >= min && value <= max),\n equalto: {\n validateString: function (value, refOrValue) {\n var $reference = $(refOrValue);\n if ($reference.length)\n return value === $reference.val();\n else\n return value === refOrValue;\n },\n priority: 256\n }\n }\n };\n\n var UI = {};\n\n var diffResults = function (newResult, oldResult, deep) {\n var added = [];\n var kept = [];\n\n for (var i = 0; i < newResult.length; i++) {\n var found = false;\n\n for (var j = 0; j < oldResult.length; j++)\n if (newResult[i].assert.name === oldResult[j].assert.name) {\n found = true;\n break;\n }\n\n if (found)\n kept.push(newResult[i]);\n else\n added.push(newResult[i]);\n }\n\n return {\n kept: kept,\n added: added,\n removed: !deep ? diffResults(oldResult, newResult, true).added : []\n };\n };\n\n UI.Form = {\n\n _actualizeTriggers: function () {\n this.$element.on('submit.Parsley', evt => { this.onSubmitValidate(evt); });\n this.$element.on('click.Parsley', Utils._SubmitSelector, evt => { this.onSubmitButton(evt); });\n\n // UI could be disabled\n if (false === this.options.uiEnabled)\n return;\n\n this.element.setAttribute('novalidate', '');\n },\n\n focus: function () {\n this._focusedField = null;\n\n if (true === this.validationResult || 'none' === this.options.focus)\n return null;\n\n for (var i = 0; i < this.fields.length; i++) {\n var field = this.fields[i];\n if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) {\n this._focusedField = field.$element;\n if ('first' === this.options.focus)\n break;\n }\n }\n\n if (null === this._focusedField)\n return null;\n\n return this._focusedField.focus();\n },\n\n _destroyUI: function () {\n // Reset all event listeners\n this.$element.off('.Parsley');\n }\n\n };\n\n UI.Field = {\n\n _reflowUI: function () {\n this._buildUI();\n\n // If this field doesn't have an active UI don't bother doing something\n if (!this._ui)\n return;\n\n // Diff between two validation results\n var diff = diffResults(this.validationResult, this._ui.lastValidationResult);\n\n // Then store current validation result for next reflow\n this._ui.lastValidationResult = this.validationResult;\n\n // Handle valid / invalid / none field class\n this._manageStatusClass();\n\n // Add, remove, updated errors messages\n this._manageErrorsMessages(diff);\n\n // Triggers impl\n this._actualizeTriggers();\n\n // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user\n if ((diff.kept.length || diff.added.length) && !this._failedOnce) {\n this._failedOnce = true;\n this._actualizeTriggers();\n }\n },\n\n // Returns an array of field's error message(s)\n getErrorsMessages: function () {\n // No error message, field is valid\n if (true === this.validationResult)\n return [];\n\n var messages = [];\n\n for (var i = 0; i < this.validationResult.length; i++)\n messages.push(this.validationResult[i].errorMessage ||\n this._getErrorMessage(this.validationResult[i].assert));\n\n return messages;\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n addError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._addError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n updateError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._updateError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n removeError: function (name, {updateClass = true} = {}) {\n this._buildUI();\n this._removeError(name);\n\n // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult\n // but highly improbable cuz' manually removing a well Parsley handled error makes no sense.\n if (updateClass)\n this._manageStatusClass();\n },\n\n _manageStatusClass: function () {\n if (this.hasConstraints() && this.needsValidation() && true === this.validationResult)\n this._successClass();\n else if (this.validationResult.length > 0)\n this._errorClass();\n else\n this._resetClass();\n },\n\n _manageErrorsMessages: function (diff) {\n if ('undefined' !== typeof this.options.errorsMessagesDisabled)\n return;\n\n // Case where we have errorMessage option that configure an unique field error message, regardless failing validators\n if ('undefined' !== typeof this.options.errorMessage) {\n if ((diff.added.length || diff.kept.length)) {\n this._insertErrorWrapper();\n\n if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length)\n this._ui.$errorsWrapper\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-custom-error-message')\n );\n\n return this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-custom-error-message')\n .html(this.options.errorMessage);\n }\n\n return this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-custom-error-message')\n .remove();\n }\n\n // Show, hide, update failing constraints messages\n for (var i = 0; i < diff.removed.length; i++)\n this._removeError(diff.removed[i].assert.name);\n\n for (i = 0; i < diff.added.length; i++)\n this._addError(diff.added[i].assert.name, {message: diff.added[i].errorMessage, assert: diff.added[i].assert});\n\n for (i = 0; i < diff.kept.length; i++)\n this._updateError(diff.kept[i].assert.name, {message: diff.kept[i].errorMessage, assert: diff.kept[i].assert});\n },\n\n\n _addError: function (name, {message, assert}) {\n this._insertErrorWrapper();\n this._ui.$errorClassHandler\n .attr('aria-describedby', this._ui.errorsWrapperId);\n this._ui.$errorsWrapper\n .addClass('filled')\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-' + name)\n .html(message || this._getErrorMessage(assert))\n );\n },\n\n _updateError: function (name, {message, assert}) {\n this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-' + name)\n .html(message || this._getErrorMessage(assert));\n },\n\n _removeError: function (name) {\n this._ui.$errorClassHandler\n .removeAttr('aria-describedby');\n this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-' + name)\n .remove();\n },\n\n _getErrorMessage: function (constraint) {\n var customConstraintErrorMessage = constraint.name + 'Message';\n\n if ('undefined' !== typeof this.options[customConstraintErrorMessage])\n return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements);\n\n return window.Parsley.getErrorMessage(constraint);\n },\n\n _buildUI: function () {\n // UI could be already built or disabled\n if (this._ui || false === this.options.uiEnabled)\n return;\n\n var _ui = {};\n\n // Give field its Parsley id in DOM\n this.element.setAttribute(this.options.namespace + 'id', this.__id__);\n\n /** Generate important UI elements and store them in this **/\n // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes\n _ui.$errorClassHandler = this._manageClassHandler();\n\n // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer\n _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__);\n _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId);\n\n // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly\n _ui.lastValidationResult = [];\n _ui.validationInformationVisible = false;\n\n // Store it in this for later\n this._ui = _ui;\n },\n\n // Determine which element will have `parsley-error` and `parsley-success` classes\n _manageClassHandler: function () {\n // Class handled could also be determined by function given in Parsley options\n if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length)\n return $(this.options.classHandler);\n\n // Class handled could also be determined by function given in Parsley options\n var $handlerFunction = this.options.classHandler;\n\n // It might also be the function name of a global function\n if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler])\n $handlerFunction = window[this.options.classHandler];\n\n if ('function' === typeof $handlerFunction) {\n var $handler = $handlerFunction.call(this, this);\n\n // If this function returned a valid existing DOM element, go for it\n if ('undefined' !== typeof $handler && $handler.length)\n return $handler;\n } else if ('object' === typeof $handlerFunction && $handlerFunction instanceof jQuery && $handlerFunction.length) {\n return $handlerFunction;\n } else if ($handlerFunction) {\n Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function');\n }\n\n return this._inputHolder();\n },\n\n _inputHolder: function() {\n // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container\n if (!this.options.multiple || this.element.nodeName === 'SELECT')\n return this.$element;\n\n // But if multiple element (radio, checkbox), that would be their parent\n return this.$element.parent();\n },\n\n _insertErrorWrapper: function () {\n var $errorsContainer = this.options.errorsContainer;\n\n // Nothing to do if already inserted\n if (0 !== this._ui.$errorsWrapper.parent().length)\n return this._ui.$errorsWrapper.parent();\n\n if ('string' === typeof $errorsContainer) {\n if ($($errorsContainer).length)\n return $($errorsContainer).append(this._ui.$errorsWrapper);\n else if ('function' === typeof window[$errorsContainer])\n $errorsContainer = window[$errorsContainer];\n else\n Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function');\n }\n\n if ('function' === typeof $errorsContainer)\n $errorsContainer = $errorsContainer.call(this, this);\n\n if ('object' === typeof $errorsContainer && $errorsContainer.length)\n return $errorsContainer.append(this._ui.$errorsWrapper);\n\n return this._inputHolder().after(this._ui.$errorsWrapper);\n },\n\n _actualizeTriggers: function () {\n var $toBind = this._findRelated();\n var trigger;\n\n // Remove Parsley events already bound on this field\n $toBind.off('.Parsley');\n if (this._failedOnce)\n $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), () => {\n this._validateIfNeeded();\n });\n else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) {\n $toBind.on(trigger, event => {\n this._validateIfNeeded(event);\n });\n }\n },\n\n _validateIfNeeded: function (event) {\n // For keyup, keypress, keydown, input... events that could be a little bit obstrusive\n // do not validate if val length < min threshold on first validation. Once field have been validated once and info\n // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.\n if (event && /key|input/.test(event.type))\n if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold)\n return;\n\n if (this.options.debounce) {\n window.clearTimeout(this._debounced);\n this._debounced = window.setTimeout(() => this.validate(), this.options.debounce);\n } else\n this.validate();\n },\n\n _resetUI: function () {\n // Reset all event listeners\n this._failedOnce = false;\n this._actualizeTriggers();\n\n // Nothing to do if UI never initialized for this field\n if ('undefined' === typeof this._ui)\n return;\n\n // Reset all errors' li\n this._ui.$errorsWrapper\n .removeClass('filled')\n .children()\n .remove();\n\n // Reset validation class\n this._resetClass();\n\n // Reset validation flags and last validation result\n this._ui.lastValidationResult = [];\n this._ui.validationInformationVisible = false;\n },\n\n _destroyUI: function () {\n this._resetUI();\n\n if ('undefined' !== typeof this._ui)\n this._ui.$errorsWrapper.remove();\n\n delete this._ui;\n },\n\n _successClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass);\n },\n _errorClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass);\n },\n _resetClass: function () {\n this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass);\n }\n };\n\n var Form = function (element, domOptions, options) {\n this.__class__ = 'Form';\n\n this.element = element;\n this.$element = $(element);\n this.domOptions = domOptions;\n this.options = options;\n this.parent = window.Parsley;\n\n this.fields = [];\n this.validationResult = null;\n };\n\n var Form__statusMapping = {pending: null, resolved: true, rejected: false};\n\n Form.prototype = {\n onSubmitValidate: function (event) {\n // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior\n if (true === event.parsley)\n return;\n\n // If we didn't come here through a submit button, use the first one in the form\n var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0];\n this._submitSource = null;\n this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true);\n if (submitSource && null !== submitSource.getAttribute('formnovalidate'))\n return;\n\n window.Parsley._remoteCache = {};\n\n var promise = this.whenValidate({event});\n\n if ('resolved' === promise.state() && false !== this._trigger('submit')) {\n // All good, let event go through. We make this distinction because browsers\n // differ in their handling of `submit` being called from inside a submit event [#1047]\n } else {\n // Rejected or pending: cancel this submit\n event.stopImmediatePropagation();\n event.preventDefault();\n if ('pending' === promise.state())\n promise.done(() => { this._submit(submitSource); });\n }\n },\n\n onSubmitButton: function(event) {\n this._submitSource = event.currentTarget;\n },\n // internal\n // _submit submits the form, this time without going through the validations.\n // Care must be taken to \"fake\" the actual submit button being clicked.\n _submit: function (submitSource) {\n if (false === this._trigger('submit'))\n return;\n // Add submit button's data\n if (submitSource) {\n var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false);\n if (0 === $synthetic.length)\n $synthetic = $('').appendTo(this.$element);\n $synthetic.attr({\n name: submitSource.getAttribute('name'),\n value: submitSource.getAttribute('value')\n });\n }\n\n this.$element.trigger(Object.assign($.Event('submit'), {parsley: true}));\n },\n\n // Performs validation on fields while triggering events.\n // @returns `true` if all validations succeeds, `false`\n // if a failure is immediately detected, or `null`\n // if dependant on a promise.\n // Consider using `whenValidate` instead.\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.');\n var [group, force, event] = arguments;\n options = {group, force, event};\n }\n return Form__statusMapping[ this.whenValidate(options).state() ];\n },\n\n whenValidate: function ({group, force, event} = {}) {\n this.submitEvent = event;\n if (event) {\n this.submitEvent = Object.assign({}, event, {preventDefault: () => {\n Utils.warnOnce(\"Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`\");\n this.validationResult = false;\n }});\n }\n this.validationResult = true;\n\n // fire validate event to eventually modify things before every validation\n this._trigger('validate');\n\n // Refresh form DOM options and form's fields that could have changed\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValidate({force, group}));\n });\n\n return Utils.all(promises)\n .done( () => { this._trigger('success'); })\n .fail( () => {\n this.validationResult = false;\n this.focus();\n this._trigger('error');\n })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n // Iterate over refreshed fields, and stop on first failure.\n // Returns `true` if all fields are valid, `false` if a failure is detected\n // or `null` if the result depends on an unresolved promise.\n // Prefer using `whenValid` instead.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.');\n var [group, force] = arguments;\n options = {group, force};\n }\n return Form__statusMapping[ this.whenValid(options).state() ];\n },\n\n // Iterate over refreshed fields and validate them.\n // Returns a promise.\n // A validation that immediately fails will interrupt the validations.\n whenValid: function ({group, force} = {}) {\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValid({group, force}));\n });\n return Utils.all(promises);\n },\n\n refresh: function() {\n this._refreshFields();\n return this;\n },\n\n // Reset UI\n reset: function () {\n // Form case: emit a reset event for each field\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].reset();\n\n this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n\n // Form case: destroy all its fields and then destroy stored instance\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].destroy();\n\n this.$element.removeData('Parsley');\n this._trigger('destroy');\n },\n\n _refreshFields: function () {\n return this.actualizeOptions()._bindFields();\n },\n\n _bindFields: function () {\n var oldFields = this.fields;\n\n this.fields = [];\n this.fieldsMappedById = {};\n\n this._withoutReactualizingFormOptions(() => {\n this.$element\n .find(this.options.inputs)\n .not(this.options.excluded)\n .each((_, element) => {\n var fieldInstance = new window.Parsley.Factory(element, {}, this);\n\n // Only add valid and not excluded `Field` and `FieldMultiple` children\n if (('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) && (true !== fieldInstance.options.excluded)) {\n let uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__;\n if ('undefined' === typeof this.fieldsMappedById[uniqueId]) {\n this.fieldsMappedById[uniqueId] = fieldInstance;\n this.fields.push(fieldInstance);\n }\n }\n });\n\n $.each(Utils.difference(oldFields, this.fields), (_, field) => {\n field.reset();\n });\n });\n return this;\n },\n\n // Internal only.\n // Looping on a form's fields to do validation or similar\n // will trigger reactualizing options on all of them, which\n // in turn will reactualize the form's options.\n // To avoid calling actualizeOptions so many times on the form\n // for nothing, _withoutReactualizingFormOptions temporarily disables\n // the method actualizeOptions on this form while `fn` is called.\n _withoutReactualizingFormOptions: function (fn) {\n var oldActualizeOptions = this.actualizeOptions;\n this.actualizeOptions = function () { return this; };\n var result = fn();\n this.actualizeOptions = oldActualizeOptions;\n return result;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n // Returns true iff event is not interrupted and default not prevented.\n _trigger: function (eventName) {\n return this.trigger('form:' + eventName);\n }\n\n };\n\n const Constraint = function(parsleyField, name, requirements, priority, isDomConstraint) {\n const validatorSpec = window.Parsley._validatorRegistry.validators[name];\n const validator = new Validator(validatorSpec);\n priority = priority || parsleyField.options[name + 'Priority'] || validator.priority;\n isDomConstraint = (true === isDomConstraint);\n\n Object.assign(this, {\n validator,\n name,\n requirements,\n priority,\n isDomConstraint\n });\n this._parseRequirements(parsleyField.options);\n };\n\n const capitalize = function(str) {\n const cap = str[0].toUpperCase();\n return cap + str.slice(1);\n };\n\n Constraint.prototype = {\n validate: function(value, instance) {\n return this.validator.validate(value, ...this.requirementList, instance);\n },\n\n _parseRequirements: function(options) {\n this.requirementList = this.validator.parseRequirements(this.requirements,\n key => options[this.name + capitalize(key)]\n );\n }\n };\n\n var Field = function (field, domOptions, options, parsleyFormInstance) {\n this.__class__ = 'Field';\n\n this.element = field;\n this.$element = $(field);\n\n // Set parent if we have one\n if ('undefined' !== typeof parsleyFormInstance) {\n this.parent = parsleyFormInstance;\n }\n\n this.options = options;\n this.domOptions = domOptions;\n\n // Initialize some properties\n this.constraints = [];\n this.constraintsByName = {};\n this.validationResult = true;\n\n // Bind constraints\n this._bindConstraints();\n };\n\n var parsley_field__statusMapping = {pending: null, resolved: true, rejected: false};\n\n Field.prototype = {\n // # Public API\n // Validate field and trigger some events for mainly `UI`\n // @returns `true`, an array of the validators that failed, or\n // `null` if validation is not finished. Prefer using whenValidate\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.');\n options = {options};\n }\n var promise = this.whenValidate(options);\n if (!promise) // If excluded with `group` option\n return true;\n switch (promise.state()) {\n case 'pending': return null;\n case 'resolved': return true;\n case 'rejected': return this.validationResult;\n }\n },\n\n // Validate field and trigger some events for mainly `UI`\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if field is not in the given `group`.\n whenValidate: function ({force, group} = {}) {\n // do not validate a field if not the same as given validation group\n this.refresh();\n if (group && !this._isInGroup(group))\n return;\n\n this.value = this.getValue();\n\n // Field Validate event. `this.value` could be altered for custom needs\n this._trigger('validate');\n\n return this.whenValid({force, value: this.value, _refreshed: true})\n .always(() => { this._reflowUI(); })\n .done(() => { this._trigger('success'); })\n .fail(() => { this._trigger('error'); })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n hasConstraints: function () {\n return 0 !== this.constraints.length;\n },\n\n // An empty optional field does not need validation\n needsValidation: function (value) {\n if ('undefined' === typeof value)\n value = this.getValue();\n\n // If a field is empty and not required, it is valid\n // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators\n if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty)\n return false;\n\n return true;\n },\n\n _isInGroup: function (group) {\n if (Array.isArray(this.options.group))\n return -1 !== $.inArray(group, this.options.group);\n return this.options.group === group;\n },\n\n // Just validate field. Do not trigger any event.\n // Returns `true` iff all constraints pass, `false` if there are failures,\n // or `null` if the result can not be determined yet (depends on a promise)\n // See also `whenValid`.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.');\n var [force, value] = arguments;\n options = {force, value};\n }\n var promise = this.whenValid(options);\n if (!promise) // Excluded via `group`\n return true;\n return parsley_field__statusMapping[promise.state()];\n },\n\n // Just validate field. Do not trigger any event.\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if the field is not in the given `group`.\n // The argument `force` will force validation of empty fields.\n // If a `value` is given, it will be validated instead of the value of the input.\n whenValid: function ({force = false, value, group, _refreshed} = {}) {\n // Recompute options and rebind constraints to have latest changes\n if (!_refreshed)\n this.refresh();\n // do not validate a field if not the same as given validation group\n if (group && !this._isInGroup(group))\n return;\n\n this.validationResult = true;\n\n // A field without constraint is valid\n if (!this.hasConstraints())\n return $.when();\n\n // Value could be passed as argument, needed to add more power to 'field:validate'\n if ('undefined' === typeof value || null === value)\n value = this.getValue();\n\n if (!this.needsValidation(value) && true !== force)\n return $.when();\n\n var groupedConstraints = this._getGroupedConstraints();\n var promises = [];\n $.each(groupedConstraints, (_, constraints) => {\n // Process one group of constraints at a time, we validate the constraints\n // and combine the promises together.\n var promise = Utils.all(\n $.map(constraints, constraint => this._validateConstraint(value, constraint))\n );\n promises.push(promise);\n if (promise.state() === 'rejected')\n return false; // Interrupt processing if a group has already failed\n });\n return Utils.all(promises);\n },\n\n // @returns a promise\n _validateConstraint: function(value, constraint) {\n var result = constraint.validate(value, this);\n // Map false to a failed promise\n if (false === result)\n result = $.Deferred().reject();\n // Make sure we return a promise and that we record failures\n return Utils.all([result]).fail(errorMessage => {\n if (!(this.validationResult instanceof Array))\n this.validationResult = [];\n this.validationResult.push({\n assert: constraint,\n errorMessage: 'string' === typeof errorMessage && errorMessage\n });\n });\n },\n\n // @returns Parsley field computed value that could be overrided or configured in DOM\n getValue: function () {\n var value;\n\n // Value could be overriden in DOM or with explicit options\n if ('function' === typeof this.options.value)\n value = this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n value = this.options.value;\n else\n value = this.$element.val();\n\n // Handle wrong DOM or configurations\n if ('undefined' === typeof value || null === value)\n return '';\n\n return this._handleWhitespace(value);\n },\n\n // Reset UI\n reset: function () {\n this._resetUI();\n return this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n this.$element.removeData('Parsley');\n this.$element.removeData('FieldMultiple');\n this._trigger('destroy');\n },\n\n // Actualize options and rebind constraints\n refresh: function () {\n this._refreshConstraints();\n return this;\n },\n\n _refreshConstraints: function () {\n return this.actualizeOptions()._bindConstraints();\n },\n\n refreshConstraints: function() {\n Utils.warnOnce(\"Parsley's refreshConstraints is deprecated. Please use refresh\");\n return this.refresh();\n },\n\n /**\n * Add a new constraint to a field\n *\n * @param {String} name\n * @param {Mixed} requirements optional\n * @param {Number} priority optional\n * @param {Boolean} isDomConstraint optional\n */\n addConstraint: function (name, requirements, priority, isDomConstraint) {\n\n if (window.Parsley._validatorRegistry.validators[name]) {\n var constraint = new Constraint(this, name, requirements, priority, isDomConstraint);\n\n // if constraint already exist, delete it and push new version\n if ('undefined' !== this.constraintsByName[constraint.name])\n this.removeConstraint(constraint.name);\n\n this.constraints.push(constraint);\n this.constraintsByName[constraint.name] = constraint;\n }\n\n return this;\n },\n\n // Remove a constraint\n removeConstraint: function (name) {\n for (var i = 0; i < this.constraints.length; i++)\n if (name === this.constraints[i].name) {\n this.constraints.splice(i, 1);\n break;\n }\n delete this.constraintsByName[name];\n return this;\n },\n\n // Update a constraint (Remove + re-add)\n updateConstraint: function (name, parameters, priority) {\n return this.removeConstraint(name)\n .addConstraint(name, parameters, priority);\n },\n\n // # Internals\n\n // Internal only.\n // Bind constraints from config + options + DOM\n _bindConstraints: function () {\n var constraints = [];\n var constraintsByName = {};\n\n // clean all existing DOM constraints to only keep javascript user constraints\n for (var i = 0; i < this.constraints.length; i++)\n if (false === this.constraints[i].isDomConstraint) {\n constraints.push(this.constraints[i]);\n constraintsByName[this.constraints[i].name] = this.constraints[i];\n }\n\n this.constraints = constraints;\n this.constraintsByName = constraintsByName;\n\n // then re-add Parsley DOM-API constraints\n for (var name in this.options)\n this.addConstraint(name, this.options[name], undefined, true);\n\n // finally, bind special HTML5 constraints\n return this._bindHtml5Constraints();\n },\n\n // Internal only.\n // Bind specific HTML5 constraints to be HTML5 compliant\n _bindHtml5Constraints: function () {\n // html5 required\n if (null !== this.element.getAttribute('required'))\n this.addConstraint('required', true, undefined, true);\n\n // html5 pattern\n if (null !== this.element.getAttribute('pattern'))\n this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true);\n\n // range\n let min = this.element.getAttribute('min');\n let max = this.element.getAttribute('max');\n if (null !== min && null !== max)\n this.addConstraint('range', [min, max], undefined, true);\n\n // HTML5 min\n else if (null !== min)\n this.addConstraint('min', min, undefined, true);\n\n // HTML5 max\n else if (null !== max)\n this.addConstraint('max', max, undefined, true);\n\n\n // length\n if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength'))\n this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true);\n\n // HTML5 minlength\n else if (null !== this.element.getAttribute('minlength'))\n this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true);\n\n // HTML5 maxlength\n else if (null !== this.element.getAttribute('maxlength'))\n this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true);\n\n\n // html5 types\n var type = Utils.getType(this.element);\n\n // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise\n if ('number' === type) {\n return this.addConstraint('type', ['number', {\n step: this.element.getAttribute('step') || '1',\n base: min || this.element.getAttribute('value')\n }], undefined, true);\n // Regular other HTML5 supported types\n } else if (/^(email|url|range|date)$/i.test(type)) {\n return this.addConstraint('type', type, undefined, true);\n }\n return this;\n },\n\n // Internal only.\n // Field is required if have required constraint without `false` value\n _isRequired: function () {\n if ('undefined' === typeof this.constraintsByName.required)\n return false;\n\n return false !== this.constraintsByName.required.requirements;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n _trigger: function (eventName) {\n return this.trigger('field:' + eventName);\n },\n\n // Internal only\n // Handles whitespace in a value\n // Use `data-parsley-whitespace=\"squish\"` to auto squish input value\n // Use `data-parsley-whitespace=\"trim\"` to auto trim input value\n _handleWhitespace: function (value) {\n if (true === this.options.trimValue)\n Utils.warnOnce('data-parsley-trim-value=\"true\" is deprecated, please use data-parsley-whitespace=\"trim\"');\n\n if ('squish' === this.options.whitespace)\n value = value.replace(/\\s{2,}/g, ' ');\n\n if (('trim' === this.options.whitespace) || ('squish' === this.options.whitespace) || (true === this.options.trimValue))\n value = Utils.trimString(value);\n\n return value;\n },\n\n _isDateInput: function() {\n var c = this.constraintsByName.type;\n return c && c.requirements === 'date';\n },\n\n // Internal only.\n // Returns the constraints, grouped by descending priority.\n // The result is thus an array of arrays of constraints.\n _getGroupedConstraints: function () {\n if (false === this.options.priorityEnabled)\n return [this.constraints];\n\n var groupedConstraints = [];\n var index = {};\n\n // Create array unique of priorities\n for (var i = 0; i < this.constraints.length; i++) {\n var p = this.constraints[i].priority;\n if (!index[p])\n groupedConstraints.push(index[p] = []);\n index[p].push(this.constraints[i]);\n }\n // Sort them by priority DESC\n groupedConstraints.sort(function (a, b) { return b[0].priority - a[0].priority; });\n\n return groupedConstraints;\n }\n\n };\n\n var parsley_field = Field;\n\n var Multiple = function () {\n this.__class__ = 'FieldMultiple';\n };\n\n Multiple.prototype = {\n // Add new `$element` sibling for multiple field\n addElement: function ($element) {\n this.$elements.push($element);\n\n return this;\n },\n\n // See `Field._refreshConstraints()`\n _refreshConstraints: function () {\n var fieldConstraints;\n\n this.constraints = [];\n\n // Select multiple special treatment\n if (this.element.nodeName === 'SELECT') {\n this.actualizeOptions()._bindConstraints();\n\n return this;\n }\n\n // Gather all constraints for each input in the multiple group\n for (var i = 0; i < this.$elements.length; i++) {\n\n // Check if element have not been dynamically removed since last binding\n if (!$('html').has(this.$elements[i]).length) {\n this.$elements.splice(i, 1);\n continue;\n }\n\n fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints;\n\n for (var j = 0; j < fieldConstraints.length; j++)\n this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint);\n }\n\n return this;\n },\n\n // See `Field.getValue()`\n getValue: function () {\n // Value could be overriden in DOM\n if ('function' === typeof this.options.value)\n return this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n return this.options.value;\n\n // Radio input case\n if (this.element.nodeName === 'INPUT') {\n var type = Utils.getType(this.element);\n if (type === 'radio')\n return this._findRelated().filter(':checked').val() || '';\n\n // checkbox input case\n if (type === 'checkbox') {\n var values = [];\n\n this._findRelated().filter(':checked').each(function () {\n values.push($(this).val());\n });\n\n return values;\n }\n }\n\n // Select multiple case\n if (this.element.nodeName === 'SELECT' && null === this.$element.val())\n return [];\n\n // Default case that should never happen\n return this.$element.val();\n },\n\n _init: function () {\n this.$elements = [this.$element];\n\n return this;\n }\n };\n\n var Factory = function (element, options, parsleyFormInstance) {\n this.element = element;\n this.$element = $(element);\n\n // If the element has already been bound, returns its saved Parsley instance\n var savedparsleyFormInstance = this.$element.data('Parsley');\n if (savedparsleyFormInstance) {\n\n // If the saved instance has been bound without a Form parent and there is one given in this call, add it\n if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) {\n savedparsleyFormInstance.parent = parsleyFormInstance;\n savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);\n }\n\n if ('object' === typeof options) {\n Object.assign(savedparsleyFormInstance.options, options);\n }\n\n return savedparsleyFormInstance;\n }\n\n // Parsley must be instantiated with a DOM element or jQuery $element\n if (!this.$element.length)\n throw new Error('You must bind Parsley on an existing element.');\n\n if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__)\n throw new Error('Parent instance must be a Form instance');\n\n this.parent = parsleyFormInstance || window.Parsley;\n return this.init(options);\n };\n\n Factory.prototype = {\n init: function (options) {\n this.__class__ = 'Parsley';\n this.__version__ = '2.8.1';\n this.__id__ = Utils.generateID();\n\n // Pre-compute options\n this._resetOptions(options);\n\n // A Form instance is obviously a `` element but also every node that is not an input and has the `data-parsley-validate` attribute\n if (this.element.nodeName === 'FORM' || (Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)))\n return this.bind('parsleyForm');\n\n // Every other element is bound as a `Field` or `FieldMultiple`\n return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField');\n },\n\n isMultiple: function () {\n var type = Utils.getType(this.element);\n return ((type === 'radio' || type === 'checkbox') ||\n (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')));\n },\n\n // Multiples fields are a real nightmare :(\n // Maybe some refactoring would be appreciated here...\n handleMultiple: function () {\n var name;\n var multiple;\n var parsleyMultipleInstance;\n\n // Handle multiple name\n this.options.multiple = this.options.multiple ||\n (name = this.element.getAttribute('name')) ||\n this.element.getAttribute('id');\n\n // Special select multiple input\n if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) {\n this.options.multiple = this.options.multiple || this.__id__;\n return this.bind('parsleyFieldMultiple');\n\n // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it\n } else if (!this.options.multiple) {\n Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element);\n return this;\n }\n\n // Remove special chars\n this.options.multiple = this.options.multiple.replace(/(:|\\.|\\[|\\]|\\{|\\}|\\$)/g, '');\n\n // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name\n if (name) {\n $('input[name=\"' + name + '\"]').each((i, input) => {\n var type = Utils.getType(input);\n if ((type === 'radio' || type === 'checkbox'))\n input.setAttribute(this.options.namespace + 'multiple', this.options.multiple);\n });\n }\n\n // Check here if we don't already have a related multiple instance saved\n var $previouslyRelated = this._findRelated();\n for (var i = 0; i < $previouslyRelated.length; i++) {\n parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley');\n if ('undefined' !== typeof parsleyMultipleInstance) {\n\n if (!this.$element.data('FieldMultiple')) {\n parsleyMultipleInstance.addElement(this.$element);\n }\n\n break;\n }\n }\n\n // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')`\n // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance\n this.bind('parsleyField', true);\n\n return parsleyMultipleInstance || this.bind('parsleyFieldMultiple');\n },\n\n // Return proper `Form`, `Field` or `FieldMultiple`\n bind: function (type, doNotStore) {\n var parsleyInstance;\n\n switch (type) {\n case 'parsleyForm':\n parsleyInstance = $.extend(\n new Form(this.element, this.domOptions, this.options),\n new Base(),\n window.ParsleyExtend\n )._bindFields();\n break;\n case 'parsleyField':\n parsleyInstance = $.extend(\n new parsley_field(this.element, this.domOptions, this.options, this.parent),\n new Base(),\n window.ParsleyExtend\n );\n break;\n case 'parsleyFieldMultiple':\n parsleyInstance = $.extend(\n new parsley_field(this.element, this.domOptions, this.options, this.parent),\n new Multiple(),\n new Base(),\n window.ParsleyExtend\n )._init();\n break;\n default:\n throw new Error(type + 'is not a supported Parsley type');\n }\n\n if (this.options.multiple)\n Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple);\n\n if ('undefined' !== typeof doNotStore) {\n this.$element.data('FieldMultiple', parsleyInstance);\n\n return parsleyInstance;\n }\n\n // Store the freshly bound instance in a DOM element for later access using jQuery `data()`\n this.$element.data('Parsley', parsleyInstance);\n\n // Tell the world we have a new Form or Field instance!\n parsleyInstance._actualizeTriggers();\n parsleyInstance._trigger('init');\n\n return parsleyInstance;\n }\n };\n\n var vernums = $.fn.jquery.split('.');\n if (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) {\n throw \"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.\";\n }\n if (!vernums.forEach) {\n Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim');\n }\n // Inherit `on`, `off` & `trigger` to Parsley:\n var Parsley = Object.assign(new Base(), {\n element: document,\n $element: $(document),\n actualizeOptions: null,\n _resetOptions: null,\n Factory: Factory,\n version: '2.8.1'\n });\n\n // Supplement Field and Form with Base\n // This way, the constructors will have access to those methods\n Object.assign(parsley_field.prototype, UI.Field, Base.prototype);\n Object.assign(Form.prototype, UI.Form, Base.prototype);\n // Inherit actualizeOptions and _resetOptions:\n Object.assign(Factory.prototype, Base.prototype);\n\n // ### jQuery API\n // `$('.elem').parsley(options)` or `$('.elem').psly(options)`\n $.fn.parsley = $.fn.psly = function (options) {\n if (this.length > 1) {\n var instances = [];\n\n this.each(function () {\n instances.push($(this).parsley(options));\n });\n\n return instances;\n }\n\n // Return undefined if applied to non existing DOM element\n if (this.length == 0) {\n return;\n }\n\n return new Factory(this[0], options);\n };\n\n // ### Field and Form extension\n // Ensure the extension is now defined if it wasn't previously\n if ('undefined' === typeof window.ParsleyExtend)\n window.ParsleyExtend = {};\n\n // ### Parsley config\n // Inherit from ParsleyDefault, and copy over any existing values\n Parsley.options = Object.assign(Utils.objectCreate(Defaults), window.ParsleyConfig);\n window.ParsleyConfig = Parsley.options; // Old way of accessing global options\n\n // ### Globals\n window.Parsley = window.psly = Parsley;\n Parsley.Utils = Utils;\n window.ParsleyUtils = {};\n $.each(Utils, (key, value) => {\n if ('function' === typeof value) {\n window.ParsleyUtils[key] = (...args) => {\n Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.');\n return Utils[key](...args);\n };\n }\n });\n\n // ### Define methods that forward to the registry, and deprecate all access except through window.Parsley\n var registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n);\n window.ParsleyValidator = {};\n $.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) {\n window.Parsley[method] = (...args) => registry[method](...args);\n window.ParsleyValidator[method] = function () {\n Utils.warnOnce(`Accessing the method '${method}' through Validator is deprecated. Simply call 'window.Parsley.${method}(...)'`);\n return window.Parsley[method](...arguments);\n };\n });\n\n // ### UI\n // Deprecated global object\n window.Parsley.UI = UI;\n window.ParsleyUI = {\n removeError: function (instance, name, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance.removeError(name, {updateClass});\n },\n getErrorsMessages: function (instance) {\n Utils.warnOnce(`Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly.`);\n return instance.getErrorsMessages();\n }\n };\n $.each('addError updateError'.split(' '), function (i, method) {\n window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call '${method}' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance[method](name, {message, assert, updateClass});\n };\n });\n\n // ### PARSLEY auto-binding\n // Prevent it by setting `ParsleyConfig.autoBind` to `false`\n if (false !== window.ParsleyConfig.autoBind) {\n $(function () {\n // Works only on `data-parsley-validate`.\n if ($('[data-parsley-validate]').length)\n $('[data-parsley-validate]').parsley();\n });\n }\n\n var o = $({});\n var deprecated = function () {\n Utils.warnOnce(\"Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley\");\n };\n\n // Returns an event handler that calls `fn` with the arguments it expects\n function adapt(fn, context) {\n // Store to allow unbinding\n if (!fn.parsleyAdaptedCallback) {\n fn.parsleyAdaptedCallback = function () {\n var args = Array.prototype.slice.call(arguments, 0);\n args.unshift(this);\n fn.apply(context || o, args);\n };\n }\n return fn.parsleyAdaptedCallback;\n }\n\n var eventPrefix = 'parsley:';\n // Converts 'parsley:form:validate' into 'form:validate'\n function eventName(name) {\n if (name.lastIndexOf(eventPrefix, 0) === 0)\n return name.substr(eventPrefix.length);\n return name;\n }\n\n // $.listen is deprecated. Use Parsley.on instead.\n $.listen = function (name, callback) {\n var context;\n deprecated();\n if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) {\n context = arguments[1];\n callback = arguments[2];\n }\n\n if ('function' !== typeof callback)\n throw new Error('Wrong parameters');\n\n window.Parsley.on(eventName(name), adapt(callback, context));\n };\n\n $.listenTo = function (instance, name, fn) {\n deprecated();\n if (!(instance instanceof parsley_field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong parameters');\n\n instance.on(eventName(name), adapt(fn));\n };\n\n $.unsubscribe = function (name, fn) {\n deprecated();\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong arguments');\n window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback);\n };\n\n $.unsubscribeTo = function (instance, name) {\n deprecated();\n if (!(instance instanceof parsley_field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n instance.off(eventName(name));\n };\n\n $.unsubscribeAll = function (name) {\n deprecated();\n window.Parsley.off(eventName(name));\n $('form,input,textarea,select').each(function () {\n var instance = $(this).data('Parsley');\n if (instance) {\n instance.off(eventName(name));\n }\n });\n };\n\n // $.emit is deprecated. Use jQuery events instead.\n $.emit = function (name, instance) {\n deprecated();\n var instanceGiven = (instance instanceof parsley_field) || (instance instanceof Form);\n var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1);\n args.unshift(eventName(name));\n if (!instanceGiven) {\n instance = window.Parsley;\n }\n instance.trigger(...args);\n };\n\n var pubsub = {};\n\n $.extend(true, Parsley, {\n asyncValidators: {\n 'default': {\n fn: function (xhr) {\n // By default, only status 2xx are deemed successful.\n // Note: we use status instead of state() because responses with status 200\n // but invalid messages (e.g. an empty body for content type set to JSON) will\n // result in state() === 'rejected'.\n return xhr.status >= 200 && xhr.status < 300;\n },\n url: false\n },\n reverse: {\n fn: function (xhr) {\n // If reverse option is set, a failing ajax request is considered successful\n return xhr.status < 200 || xhr.status >= 300;\n },\n url: false\n }\n },\n\n addAsyncValidator: function (name, fn, url, options) {\n Parsley.asyncValidators[name] = {\n fn: fn,\n url: url || false,\n options: options || {}\n };\n\n return this;\n }\n\n });\n\n Parsley.addValidator('remote', {\n requirementType: {\n '': 'string',\n 'validator': 'string',\n 'reverse': 'boolean',\n 'options': 'object'\n },\n\n validateString: function (value, url, options, instance) {\n var data = {};\n var ajaxOptions;\n var csr;\n var validator = options.validator || (true === options.reverse ? 'reverse' : 'default');\n\n if ('undefined' === typeof Parsley.asyncValidators[validator])\n throw new Error('Calling an undefined async validator: `' + validator + '`');\n\n url = Parsley.asyncValidators[validator].url || url;\n\n // Fill current value\n if (url.indexOf('{value}') > -1) {\n url = url.replace('{value}', encodeURIComponent(value));\n } else {\n data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value;\n }\n\n // Merge options passed in from the function with the ones in the attribute\n var remoteOptions = $.extend(true, options.options || {} , Parsley.asyncValidators[validator].options);\n\n // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options`\n ajaxOptions = $.extend(true, {}, {\n url: url,\n data: data,\n type: 'GET'\n }, remoteOptions);\n\n // Generate store key based on ajax options\n instance.trigger('field:ajaxoptions', instance, ajaxOptions);\n\n csr = $.param(ajaxOptions);\n\n // Initialise querry cache\n if ('undefined' === typeof Parsley._remoteCache)\n Parsley._remoteCache = {};\n\n // Try to retrieve stored xhr\n var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions);\n\n var handleXhr = function () {\n var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options);\n if (!result) // Map falsy results to rejected promise\n result = $.Deferred().reject();\n return $.when(result);\n };\n\n return xhr.then(handleXhr, handleXhr);\n },\n\n priority: -1\n });\n\n Parsley.on('form:submit', function () {\n Parsley._remoteCache = {};\n });\n\n Base.prototype.addAsyncValidator = function () {\n Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`');\n return Parsley.addAsyncValidator(...arguments);\n };\n\n // This is included with the Parsley library itself,\n // thus there is no use in adding it to your project.\n Parsley.addMessages('en', {\n defaultMessage: \"This value seems to be invalid.\",\n type: {\n email: \"This value should be a valid email.\",\n url: \"This value should be a valid url.\",\n number: \"This value should be a valid number.\",\n integer: \"This value should be a valid integer.\",\n digits: \"This value should be digits.\",\n alphanum: \"This value should be alphanumeric.\"\n },\n notblank: \"This value should not be blank.\",\n required: \"This value is required.\",\n pattern: \"This value seems to be invalid.\",\n min: \"This value should be greater than or equal to %s.\",\n max: \"This value should be lower than or equal to %s.\",\n range: \"This value should be between %s and %s.\",\n minlength: \"This value is too short. It should have %s characters or more.\",\n maxlength: \"This value is too long. It should have %s characters or fewer.\",\n length: \"This value length is invalid. It should be between %s and %s characters long.\",\n mincheck: \"You must select at least %s choices.\",\n maxcheck: \"You must select %s choices or fewer.\",\n check: \"You must select between %s and %s choices.\",\n equalto: \"This value should be the same.\"\n });\n\n Parsley.setLocale('en');\n\n /**\n * inputevent - Alleviate browser bugs for input events\n * https://github.com/marcandre/inputevent\n * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm)\n * @author Marc-Andre Lafortune \n * @license MIT\n */\n\n function InputEvent() {\n let globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n Object.assign(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: evt => {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: evt => {\n if (this.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: evt => {\n if (this.isNativeEvent(evt)) {\n this.behavesOk(evt);\n $(document)\n .on('change.inputevent', evt.data.selector, this.fakeInputEvent);\n this.fakeInputEvent(evt);\n }\n },\n\n behavesOk: evt => {\n if (this.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, this.behavesOk)\n .off('change.inputevent', evt.data.selector, this.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: () => {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n for (let selector of ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]']) {\n $(document)\n .on('input.inputevent', selector, {selector}, this.behavesOk)\n .on('change.inputevent', selector, {selector}, this.misbehaves);\n }\n },\n\n uninstall: () => {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n };\n\n var inputevent = new InputEvent();\n\n inputevent.install();\n\n var parsley = Parsley;\n\n return parsley;\n\n}));\n","import $ from 'jquery';\n\nvar globalID = 1;\nvar pastWarnings = {};\n\nvar Utils = {\n // Parsley DOM-API\n // returns object from dom attributes and values\n attr: function (element, namespace, obj) {\n var i;\n var attribute;\n var attributes;\n var regex = new RegExp('^' + namespace, 'i');\n\n if ('undefined' === typeof obj)\n obj = {};\n else {\n // Clear all own properties. This won't affect prototype's values\n for (i in obj) {\n if (obj.hasOwnProperty(i))\n delete obj[i];\n }\n }\n\n if (!element)\n return obj;\n\n attributes = element.attributes;\n for (i = attributes.length; i--; ) {\n attribute = attributes[i];\n\n if (attribute && attribute.specified && regex.test(attribute.name)) {\n obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value);\n }\n }\n\n return obj;\n },\n\n checkAttr: function (element, namespace, checkAttr) {\n return element.hasAttribute(namespace + checkAttr);\n },\n\n setAttr: function (element, namespace, attr, value) {\n element.setAttribute(this.dasherize(namespace + attr), String(value));\n },\n\n getType: function(element) {\n return element.getAttribute('type') || 'text';\n },\n\n generateID: function () {\n return '' + globalID++;\n },\n\n /** Third party functions **/\n deserializeValue: function (value) {\n var num;\n\n try {\n return value ?\n value == \"true\" ||\n (value == \"false\" ? false :\n value == \"null\" ? null :\n !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? JSON.parse(value) :\n value)\n : value;\n } catch (e) { return value; }\n },\n\n // Zepto camelize function\n camelize: function (str) {\n return str.replace(/-+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n // Zepto dasherize function\n dasherize: function (str) {\n return str.replace(/::/g, '/')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .replace(/([a-z\\d])([A-Z])/g, '$1_$2')\n .replace(/_/g, '-')\n .toLowerCase();\n },\n\n warn: function () {\n if (window.console && 'function' === typeof window.console.warn)\n window.console.warn(...arguments);\n },\n\n warnOnce: function(msg) {\n if (!pastWarnings[msg]) {\n pastWarnings[msg] = true;\n this.warn(...arguments);\n }\n },\n\n _resetWarnings: function () {\n pastWarnings = {};\n },\n\n trimString: function(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n },\n\n parse: {\n date: function(string) {\n let parsed = string.match(/^(\\d{4,})-(\\d\\d)-(\\d\\d)$/);\n if (!parsed)\n return null;\n let [_, year, month, day] = parsed.map(x => parseInt(x, 10));\n let date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day)\n return null;\n return date;\n },\n string: function(string) {\n return string;\n },\n integer: function(string) {\n if (isNaN(string))\n return null;\n return parseInt(string, 10);\n },\n number: function(string) {\n if (isNaN(string))\n throw null;\n return parseFloat(string);\n },\n 'boolean': function _boolean(string) {\n return !(/^\\s*false\\s*$/i.test(string));\n },\n object: function(string) {\n return Utils.deserializeValue(string);\n },\n regexp: function(regexp) {\n var flags = '';\n\n // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern\n if (/^\\/.*\\/(?:[gimy]*)$/.test(regexp)) {\n // Replace the regexp literal string with the first match group: ([gimy]*)\n // If no flag is present, this will be a blank string\n flags = regexp.replace(/.*\\/([gimy]*)$/, '$1');\n // Again, replace the regexp literal string with the first match group:\n // everything excluding the opening and closing slashes and the flags\n regexp = regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');\n } else {\n // Anchor regexp:\n regexp = '^' + regexp + '$';\n }\n return new RegExp(regexp, flags);\n }\n },\n\n parseRequirement: function(requirementType, string) {\n var converter = this.parse[requirementType || 'string'];\n if (!converter)\n throw 'Unknown requirement specification: \"' + requirementType + '\"';\n let converted = converter(string);\n if (converted === null)\n throw `Requirement is not a ${requirementType}: \"${string}\"`;\n return converted;\n },\n\n namespaceEvents: function(events, namespace) {\n events = this.trimString(events || '').split(/\\s+/);\n if (!events[0])\n return '';\n return $.map(events, evt => `${evt}.${namespace}`).join(' ');\n },\n\n difference: function(array, remove) {\n // This is O(N^2), should be optimized\n let result = [];\n $.each(array, (_, elem) => {\n if (remove.indexOf(elem) == -1)\n result.push(elem);\n });\n return result;\n },\n\n // Alter-ego to native Promise.all, but for jQuery\n all: function(promises) {\n // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements\n return $.when(...promises, 42, 42);\n },\n\n // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill\n objectCreate: Object.create || (function () {\n var Object = function () {};\n return function (prototype) {\n if (arguments.length > 1) {\n throw Error('Second argument not supported');\n }\n if (typeof prototype != 'object') {\n throw TypeError('Argument must be an object');\n }\n Object.prototype = prototype;\n var result = new Object();\n Object.prototype = null;\n return result;\n };\n })(),\n\n _SubmitSelector: 'input[type=\"submit\"], button:submit'\n};\n\nexport default Utils;\n","// All these options could be overriden and specified directly in DOM using\n// `data-parsley-` default DOM-API\n// eg: `inputs` can be set in DOM using `data-parsley-inputs=\"input, textarea\"`\n// eg: `data-parsley-stop-on-first-failing-constraint=\"false\"`\n\nvar Defaults = {\n // ### General\n\n // Default data-namespace for DOM API\n namespace: 'data-parsley-',\n\n // Supported inputs by default\n inputs: 'input, textarea, select',\n\n // Excluded inputs by default\n excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',\n\n // Stop validating field on highest priority failing constraint\n priorityEnabled: true,\n\n // ### Field only\n\n // identifier used to group together inputs (e.g. radio buttons...)\n multiple: null,\n\n // identifier (or array of identifiers) used to validate only a select group of inputs\n group: null,\n\n // ### UI\n // Enable\\Disable error messages\n uiEnabled: true,\n\n // Key events threshold before validation\n validationThreshold: 3,\n\n // Focused field on form validation error. 'first'|'last'|'none'\n focus: 'first',\n\n // event(s) that will trigger validation before first failure. eg: `input`...\n trigger: false,\n\n // event(s) that will trigger validation after first failure.\n triggerAfterFailure: 'input',\n\n // Class that would be added on every failing validation Parsley field\n errorClass: 'parsley-error',\n\n // Same for success validation\n successClass: 'parsley-success',\n\n // Return the `$element` that will receive these above success or error classes\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n classHandler: function (Field) {},\n\n // Return the `$element` where errors will be appended\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n errorsContainer: function (Field) {},\n\n // ul elem that would receive errors' list\n errorsWrapper: '
        ',\n\n // li elem that would receive error message\n errorTemplate: '
      • '\n};\n\nexport default Defaults;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar Base = function () {\n this.__id__ = Utils.generateID();\n};\n\nBase.prototype = {\n asyncSupport: true, // Deprecated\n\n _pipeAccordingToValidationResult: function () {\n var pipe = () => {\n var r = $.Deferred();\n if (true !== this.validationResult)\n r.reject();\n return r.resolve().promise();\n };\n return [pipe, pipe];\n },\n\n actualizeOptions: function () {\n Utils.attr(this.element, this.options.namespace, this.domOptions);\n if (this.parent && this.parent.actualizeOptions)\n this.parent.actualizeOptions();\n return this;\n },\n\n _resetOptions: function (initOptions) {\n this.domOptions = Utils.objectCreate(this.parent.options);\n this.options = Utils.objectCreate(this.domOptions);\n // Shallow copy of ownProperties of initOptions:\n for (var i in initOptions) {\n if (initOptions.hasOwnProperty(i))\n this.options[i] = initOptions[i];\n }\n this.actualizeOptions();\n },\n\n _listeners: null,\n\n // Register a callback for the given event name\n // Callback is called with context as the first argument and the `this`\n // The context is the current parsley instance, or window.Parsley if global\n // A return value of `false` will interrupt the calls\n on: function (name, fn) {\n this._listeners = this._listeners || {};\n var queue = this._listeners[name] = this._listeners[name] || [];\n queue.push(fn);\n\n return this;\n },\n\n // Deprecated. Use `on` instead\n subscribe: function(name, fn) {\n $.listenTo(this, name.toLowerCase(), fn);\n },\n\n // Unregister a callback (or all if none is given) for the given event name\n off: function (name, fn) {\n var queue = this._listeners && this._listeners[name];\n if (queue) {\n if (!fn) {\n delete this._listeners[name];\n } else {\n for (var i = queue.length; i--; )\n if (queue[i] === fn)\n queue.splice(i, 1);\n }\n }\n return this;\n },\n\n // Deprecated. Use `off`\n unsubscribe: function(name, fn) {\n $.unsubscribeTo(this, name.toLowerCase());\n },\n\n // Trigger an event of the given name\n // A return value of `false` interrupts the callback chain\n // Returns false if execution was interrupted\n trigger: function (name, target, extraArg) {\n target = target || this;\n var queue = this._listeners && this._listeners[name];\n var result;\n var parentResult;\n if (queue) {\n for (var i = queue.length; i--; ) {\n result = queue[i].call(target, target, extraArg);\n if (result === false) return result;\n }\n }\n if (this.parent) {\n return this.parent.trigger(name, target, extraArg);\n }\n return true;\n },\n\n asyncIsValid: function (group, force) {\n Utils.warnOnce(\"asyncIsValid is deprecated; please use whenValid instead\");\n return this.whenValid({group, force});\n },\n\n _findRelated: function () {\n return this.options.multiple ?\n $(this.parent.element.querySelectorAll(`[${this.options.namespace}multiple=\"${this.options.multiple}\"]`))\n : this.$element;\n }\n};\n\nexport default Base;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar convertArrayRequirement = function(string, length) {\n var m = string.match(/^\\s*\\[(.*)\\]\\s*$/);\n if (!m)\n throw 'Requirement is not an array: \"' + string + '\"';\n var values = m[1].split(',').map(Utils.trimString);\n if (values.length !== length)\n throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed';\n return values;\n};\n\nvar convertExtraOptionRequirement = function(requirementSpec, string, extraOptionReader) {\n var main = null;\n var extra = {};\n for (var key in requirementSpec) {\n if (key) {\n var value = extraOptionReader(key);\n if ('string' === typeof value)\n value = Utils.parseRequirement(requirementSpec[key], value);\n extra[key] = value;\n } else {\n main = Utils.parseRequirement(requirementSpec[key], string);\n }\n }\n return [main, extra];\n};\n\n// A Validator needs to implement the methods `validate` and `parseRequirements`\n\nvar Validator = function(spec) {\n $.extend(true, this, spec);\n};\n\nValidator.prototype = {\n // Returns `true` iff the given `value` is valid according the given requirements.\n validate: function(value, requirementFirstArg) {\n if (this.fn) { // Legacy style validator\n\n if (arguments.length > 3) // If more args then value, requirement, instance...\n requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest\n return this.fn(value, requirementFirstArg);\n }\n\n if (Array.isArray(value)) {\n if (!this.validateMultiple)\n throw 'Validator `' + this.name + '` does not handle multiple values';\n return this.validateMultiple(...arguments);\n } else {\n let instance = arguments[arguments.length - 1];\n if (this.validateDate && instance._isDateInput()) {\n arguments[0] = Utils.parse.date(arguments[0]);\n if (arguments[0] === null)\n return false;\n return this.validateDate(...arguments);\n }\n if (this.validateNumber) {\n if (isNaN(value))\n return false;\n arguments[0] = parseFloat(arguments[0]);\n return this.validateNumber(...arguments);\n }\n if (this.validateString) {\n return this.validateString(...arguments);\n }\n throw 'Validator `' + this.name + '` only handles multiple values';\n }\n },\n\n // Parses `requirements` into an array of arguments,\n // according to `this.requirementType`\n parseRequirements: function(requirements, extraOptionReader) {\n if ('string' !== typeof requirements) {\n // Assume requirement already parsed\n // but make sure we return an array\n return Array.isArray(requirements) ? requirements : [requirements];\n }\n var type = this.requirementType;\n if (Array.isArray(type)) {\n var values = convertArrayRequirement(requirements, type.length);\n for (var i = 0; i < values.length; i++)\n values[i] = Utils.parseRequirement(type[i], values[i]);\n return values;\n } else if ($.isPlainObject(type)) {\n return convertExtraOptionRequirement(type, requirements, extraOptionReader);\n } else {\n return [Utils.parseRequirement(type, requirements)];\n }\n },\n // Defaults:\n requirementType: 'string',\n\n priority: 2\n\n};\n\nexport default Validator;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Defaults from './defaults';\nimport Validator from './validator';\n\nvar ValidatorRegistry = function (validators, catalog) {\n this.__class__ = 'ValidatorRegistry';\n\n // Default Parsley locale is en\n this.locale = 'en';\n\n this.init(validators || {}, catalog || {});\n};\n\nvar typeTesters = {\n email: /^((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/,\n\n // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers\n number: /^-?(\\d*\\.)?\\d+(e[-+]?\\d+)?$/i,\n\n integer: /^-?\\d+$/,\n\n digits: /^\\d+$/,\n\n alphanum: /^\\w+$/i,\n\n date: {\n test: value => Utils.parse.date(value) !== null\n },\n\n url: new RegExp(\n \"^\" +\n // protocol identifier\n \"(?:(?:https?|ftp)://)?\" + // ** mod: make scheme optional\n // user:pass authentication\n \"(?:\\\\S+(?::\\\\S*)?@)?\" +\n \"(?:\" +\n // IP address exclusion\n // private & local networks\n // \"(?!(?:10|127)(?:\\\\.\\\\d{1,3}){3})\" + // ** mod: allow local networks\n // \"(?!(?:169\\\\.254|192\\\\.168)(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // \"(?!172\\\\.(?:1[6-9]|2\\\\d|3[0-1])(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // IP address dotted notation octets\n // excludes loopback network 0.0.0.0\n // excludes reserved space >= 224.0.0.0\n // excludes network & broacast addresses\n // (first & last IP address of each class)\n \"(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])\" +\n \"(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}\" +\n \"(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))\" +\n \"|\" +\n // host name\n \"(?:(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)\" +\n // domain name\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)*\" +\n // TLD identifier\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff]{2,}))\" +\n \")\" +\n // port number\n \"(?::\\\\d{2,5})?\" +\n // resource path\n \"(?:/\\\\S*)?\" +\n \"$\"\n )\n};\ntypeTesters.range = typeTesters.number;\n\n// See http://stackoverflow.com/a/10454560/8279\nvar decimalPlaces = num => {\n var match = ('' + num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n if (!match) { return 0; }\n return Math.max(\n 0,\n // Number of digits right of decimal point.\n (match[1] ? match[1].length : 0) -\n // Adjust for scientific notation.\n (match[2] ? +match[2] : 0));\n};\n\n// parseArguments('number', ['1', '2']) => [1, 2]\nlet parseArguments = (type, args) => args.map(Utils.parse[type]);\n// operatorToValidator returns a validating function for an operator function, applied to the given type\nlet operatorToValidator = (type, operator) => {\n return (value, ...requirementsAndInput) => {\n requirementsAndInput.pop(); // Get rid of `input` argument\n return operator(value, ...parseArguments(type, requirementsAndInput));\n };\n};\n\nlet comparisonOperator = operator => ({\n validateDate: operatorToValidator('date', operator),\n validateNumber: operatorToValidator('number', operator),\n requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s)\n priority: 30\n});\n\nValidatorRegistry.prototype = {\n init: function (validators, catalog) {\n this.catalog = catalog;\n // Copy prototype's validators:\n this.validators = Object.assign({}, this.validators);\n\n for (var name in validators)\n this.addValidator(name, validators[name].fn, validators[name].priority);\n\n window.Parsley.trigger('parsley:validator:init');\n },\n\n // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n\n setLocale: function (locale) {\n if ('undefined' === typeof this.catalog[locale])\n throw new Error(locale + ' is not available in the catalog');\n\n this.locale = locale;\n\n return this;\n },\n\n // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true`\n addCatalog: function (locale, messages, set) {\n if ('object' === typeof messages)\n this.catalog[locale] = messages;\n\n if (true === set)\n return this.setLocale(locale);\n\n return this;\n },\n\n // Add a specific message for a given constraint in a given locale\n addMessage: function (locale, name, message) {\n if ('undefined' === typeof this.catalog[locale])\n this.catalog[locale] = {};\n\n this.catalog[locale][name] = message;\n\n return this;\n },\n\n // Add messages for a given locale\n addMessages: function (locale, nameMessageObject) {\n for (var name in nameMessageObject)\n this.addMessage(locale, name, nameMessageObject[name]);\n\n return this;\n },\n\n // Add a new validator\n //\n // addValidator('custom', {\n // requirementType: ['integer', 'integer'],\n // validateString: function(value, from, to) {},\n // priority: 22,\n // messages: {\n // en: \"Hey, that's no good\",\n // fr: \"Aye aye, pas bon du tout\",\n // }\n // })\n //\n // Old API was addValidator(name, function, priority)\n //\n addValidator: function (name, arg1, arg2) {\n if (this.validators[name])\n Utils.warn('Validator \"' + name + '\" is already defined.');\n else if (Defaults.hasOwnProperty(name)) {\n Utils.warn('\"' + name + '\" is a restricted keyword and is not a valid validator name.');\n return;\n }\n return this._setValidator(...arguments);\n },\n\n hasValidator: function (name) {\n return !!this.validators[name];\n },\n\n updateValidator: function (name, arg1, arg2) {\n if (!this.validators[name]) {\n Utils.warn('Validator \"' + name + '\" is not already defined.');\n return this.addValidator(...arguments);\n }\n return this._setValidator(...arguments);\n },\n\n removeValidator: function (name) {\n if (!this.validators[name])\n Utils.warn('Validator \"' + name + '\" is not defined.');\n\n delete this.validators[name];\n\n return this;\n },\n\n _setValidator: function (name, validator, priority) {\n if ('object' !== typeof validator) {\n // Old style validator, with `fn` and `priority`\n validator = {\n fn: validator,\n priority: priority\n };\n }\n if (!validator.validate) {\n validator = new Validator(validator);\n }\n this.validators[name] = validator;\n\n for (var locale in validator.messages || {})\n this.addMessage(locale, name, validator.messages[locale]);\n\n return this;\n },\n\n getErrorMessage: function (constraint) {\n var message;\n\n // Type constraints are a bit different, we have to match their requirements too to find right error message\n if ('type' === constraint.name) {\n var typeMessages = this.catalog[this.locale][constraint.name] || {};\n message = typeMessages[constraint.requirements];\n } else\n message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements);\n\n return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage;\n },\n\n // Kind of light `sprintf()` implementation\n formatMessage: function (string, parameters) {\n if ('object' === typeof parameters) {\n for (var i in parameters)\n string = this.formatMessage(string, parameters[i]);\n\n return string;\n }\n\n return 'string' === typeof string ? string.replace(/%s/i, parameters) : '';\n },\n\n // Here is the Parsley default validators list.\n // A validator is an object with the following key values:\n // - priority: an integer\n // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these\n // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise\n // Alternatively, a validator can be a function that returns such an object\n //\n validators: {\n notblank: {\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 2\n },\n required: {\n validateMultiple: function(values) {\n return values.length > 0;\n },\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 512\n },\n type: {\n validateString: function(value, type, {step = 'any', base = 0} = {}) {\n var tester = typeTesters[type];\n if (!tester) {\n throw new Error('validator type `' + type + '` is not supported');\n }\n if (!tester.test(value))\n return false;\n if ('number' === type) {\n if (!/^any$/i.test(step || '')) {\n var nb = Number(value);\n var decimals = Math.max(decimalPlaces(step), decimalPlaces(base));\n if (decimalPlaces(nb) > decimals) // Value can't have too many decimals\n return false;\n // Be careful of rounding errors by using integers.\n var toInt = f => Math.round(f * Math.pow(10, decimals));\n if ((toInt(nb) - toInt(base)) % toInt(step) != 0)\n return false;\n }\n }\n return true;\n },\n requirementType: {\n '': 'string',\n step: 'string',\n base: 'number'\n },\n priority: 256\n },\n pattern: {\n validateString: function(value, regexp) {\n return regexp.test(value);\n },\n requirementType: 'regexp',\n priority: 64\n },\n minlength: {\n validateString: function (value, requirement) {\n return value.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxlength: {\n validateString: function (value, requirement) {\n return value.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n length: {\n validateString: function (value, min, max) {\n return value.length >= min && value.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n mincheck: {\n validateMultiple: function (values, requirement) {\n return values.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxcheck: {\n validateMultiple: function (values, requirement) {\n return values.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n check: {\n validateMultiple: function (values, min, max) {\n return values.length >= min && values.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n min: comparisonOperator((value, requirement) => value >= requirement),\n max: comparisonOperator((value, requirement) => value <= requirement),\n range: comparisonOperator((value, min, max) => value >= min && value <= max),\n equalto: {\n validateString: function (value, refOrValue) {\n var $reference = $(refOrValue);\n if ($reference.length)\n return value === $reference.val();\n else\n return value === refOrValue;\n },\n priority: 256\n }\n }\n};\n\nexport default ValidatorRegistry;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar UI = {};\n\nvar diffResults = function (newResult, oldResult, deep) {\n var added = [];\n var kept = [];\n\n for (var i = 0; i < newResult.length; i++) {\n var found = false;\n\n for (var j = 0; j < oldResult.length; j++)\n if (newResult[i].assert.name === oldResult[j].assert.name) {\n found = true;\n break;\n }\n\n if (found)\n kept.push(newResult[i]);\n else\n added.push(newResult[i]);\n }\n\n return {\n kept: kept,\n added: added,\n removed: !deep ? diffResults(oldResult, newResult, true).added : []\n };\n};\n\nUI.Form = {\n\n _actualizeTriggers: function () {\n this.$element.on('submit.Parsley', evt => { this.onSubmitValidate(evt); });\n this.$element.on('click.Parsley', Utils._SubmitSelector, evt => { this.onSubmitButton(evt); });\n\n // UI could be disabled\n if (false === this.options.uiEnabled)\n return;\n\n this.element.setAttribute('novalidate', '');\n },\n\n focus: function () {\n this._focusedField = null;\n\n if (true === this.validationResult || 'none' === this.options.focus)\n return null;\n\n for (var i = 0; i < this.fields.length; i++) {\n var field = this.fields[i];\n if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) {\n this._focusedField = field.$element;\n if ('first' === this.options.focus)\n break;\n }\n }\n\n if (null === this._focusedField)\n return null;\n\n return this._focusedField.focus();\n },\n\n _destroyUI: function () {\n // Reset all event listeners\n this.$element.off('.Parsley');\n }\n\n};\n\nUI.Field = {\n\n _reflowUI: function () {\n this._buildUI();\n\n // If this field doesn't have an active UI don't bother doing something\n if (!this._ui)\n return;\n\n // Diff between two validation results\n var diff = diffResults(this.validationResult, this._ui.lastValidationResult);\n\n // Then store current validation result for next reflow\n this._ui.lastValidationResult = this.validationResult;\n\n // Handle valid / invalid / none field class\n this._manageStatusClass();\n\n // Add, remove, updated errors messages\n this._manageErrorsMessages(diff);\n\n // Triggers impl\n this._actualizeTriggers();\n\n // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user\n if ((diff.kept.length || diff.added.length) && !this._failedOnce) {\n this._failedOnce = true;\n this._actualizeTriggers();\n }\n },\n\n // Returns an array of field's error message(s)\n getErrorsMessages: function () {\n // No error message, field is valid\n if (true === this.validationResult)\n return [];\n\n var messages = [];\n\n for (var i = 0; i < this.validationResult.length; i++)\n messages.push(this.validationResult[i].errorMessage ||\n this._getErrorMessage(this.validationResult[i].assert));\n\n return messages;\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n addError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._addError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n updateError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._updateError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n removeError: function (name, {updateClass = true} = {}) {\n this._buildUI();\n this._removeError(name);\n\n // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult\n // but highly improbable cuz' manually removing a well Parsley handled error makes no sense.\n if (updateClass)\n this._manageStatusClass();\n },\n\n _manageStatusClass: function () {\n if (this.hasConstraints() && this.needsValidation() && true === this.validationResult)\n this._successClass();\n else if (this.validationResult.length > 0)\n this._errorClass();\n else\n this._resetClass();\n },\n\n _manageErrorsMessages: function (diff) {\n if ('undefined' !== typeof this.options.errorsMessagesDisabled)\n return;\n\n // Case where we have errorMessage option that configure an unique field error message, regardless failing validators\n if ('undefined' !== typeof this.options.errorMessage) {\n if ((diff.added.length || diff.kept.length)) {\n this._insertErrorWrapper();\n\n if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length)\n this._ui.$errorsWrapper\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-custom-error-message')\n );\n\n return this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-custom-error-message')\n .html(this.options.errorMessage);\n }\n\n return this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-custom-error-message')\n .remove();\n }\n\n // Show, hide, update failing constraints messages\n for (var i = 0; i < diff.removed.length; i++)\n this._removeError(diff.removed[i].assert.name);\n\n for (i = 0; i < diff.added.length; i++)\n this._addError(diff.added[i].assert.name, {message: diff.added[i].errorMessage, assert: diff.added[i].assert});\n\n for (i = 0; i < diff.kept.length; i++)\n this._updateError(diff.kept[i].assert.name, {message: diff.kept[i].errorMessage, assert: diff.kept[i].assert});\n },\n\n\n _addError: function (name, {message, assert}) {\n this._insertErrorWrapper();\n this._ui.$errorClassHandler\n .attr('aria-describedby', this._ui.errorsWrapperId);\n this._ui.$errorsWrapper\n .addClass('filled')\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-' + name)\n .html(message || this._getErrorMessage(assert))\n );\n },\n\n _updateError: function (name, {message, assert}) {\n this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-' + name)\n .html(message || this._getErrorMessage(assert));\n },\n\n _removeError: function (name) {\n this._ui.$errorClassHandler\n .removeAttr('aria-describedby');\n this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-' + name)\n .remove();\n },\n\n _getErrorMessage: function (constraint) {\n var customConstraintErrorMessage = constraint.name + 'Message';\n\n if ('undefined' !== typeof this.options[customConstraintErrorMessage])\n return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements);\n\n return window.Parsley.getErrorMessage(constraint);\n },\n\n _buildUI: function () {\n // UI could be already built or disabled\n if (this._ui || false === this.options.uiEnabled)\n return;\n\n var _ui = {};\n\n // Give field its Parsley id in DOM\n this.element.setAttribute(this.options.namespace + 'id', this.__id__);\n\n /** Generate important UI elements and store them in this **/\n // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes\n _ui.$errorClassHandler = this._manageClassHandler();\n\n // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer\n _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__);\n _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId);\n\n // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly\n _ui.lastValidationResult = [];\n _ui.validationInformationVisible = false;\n\n // Store it in this for later\n this._ui = _ui;\n },\n\n // Determine which element will have `parsley-error` and `parsley-success` classes\n _manageClassHandler: function () {\n // Class handled could also be determined by function given in Parsley options\n if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length)\n return $(this.options.classHandler);\n\n // Class handled could also be determined by function given in Parsley options\n var $handlerFunction = this.options.classHandler;\n\n // It might also be the function name of a global function\n if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler])\n $handlerFunction = window[this.options.classHandler];\n\n if ('function' === typeof $handlerFunction) {\n var $handler = $handlerFunction.call(this, this);\n\n // If this function returned a valid existing DOM element, go for it\n if ('undefined' !== typeof $handler && $handler.length)\n return $handler;\n } else if ('object' === typeof $handlerFunction && $handlerFunction instanceof jQuery && $handlerFunction.length) {\n return $handlerFunction;\n } else if ($handlerFunction) {\n Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function');\n }\n\n return this._inputHolder();\n },\n\n _inputHolder: function() {\n // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container\n if (!this.options.multiple || this.element.nodeName === 'SELECT')\n return this.$element;\n\n // But if multiple element (radio, checkbox), that would be their parent\n return this.$element.parent();\n },\n\n _insertErrorWrapper: function () {\n var $errorsContainer = this.options.errorsContainer;\n\n // Nothing to do if already inserted\n if (0 !== this._ui.$errorsWrapper.parent().length)\n return this._ui.$errorsWrapper.parent();\n\n if ('string' === typeof $errorsContainer) {\n if ($($errorsContainer).length)\n return $($errorsContainer).append(this._ui.$errorsWrapper);\n else if ('function' === typeof window[$errorsContainer])\n $errorsContainer = window[$errorsContainer];\n else\n Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function');\n }\n\n if ('function' === typeof $errorsContainer)\n $errorsContainer = $errorsContainer.call(this, this);\n\n if ('object' === typeof $errorsContainer && $errorsContainer.length)\n return $errorsContainer.append(this._ui.$errorsWrapper);\n\n return this._inputHolder().after(this._ui.$errorsWrapper);\n },\n\n _actualizeTriggers: function () {\n var $toBind = this._findRelated();\n var trigger;\n\n // Remove Parsley events already bound on this field\n $toBind.off('.Parsley');\n if (this._failedOnce)\n $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), () => {\n this._validateIfNeeded();\n });\n else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) {\n $toBind.on(trigger, event => {\n this._validateIfNeeded(event);\n });\n }\n },\n\n _validateIfNeeded: function (event) {\n // For keyup, keypress, keydown, input... events that could be a little bit obstrusive\n // do not validate if val length < min threshold on first validation. Once field have been validated once and info\n // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.\n if (event && /key|input/.test(event.type))\n if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold)\n return;\n\n if (this.options.debounce) {\n window.clearTimeout(this._debounced);\n this._debounced = window.setTimeout(() => this.validate(), this.options.debounce);\n } else\n this.validate();\n },\n\n _resetUI: function () {\n // Reset all event listeners\n this._failedOnce = false;\n this._actualizeTriggers();\n\n // Nothing to do if UI never initialized for this field\n if ('undefined' === typeof this._ui)\n return;\n\n // Reset all errors' li\n this._ui.$errorsWrapper\n .removeClass('filled')\n .children()\n .remove();\n\n // Reset validation class\n this._resetClass();\n\n // Reset validation flags and last validation result\n this._ui.lastValidationResult = [];\n this._ui.validationInformationVisible = false;\n },\n\n _destroyUI: function () {\n this._resetUI();\n\n if ('undefined' !== typeof this._ui)\n this._ui.$errorsWrapper.remove();\n\n delete this._ui;\n },\n\n _successClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass);\n },\n _errorClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass);\n },\n _resetClass: function () {\n this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass);\n }\n};\n\nexport default UI;\n","import $ from 'jquery';\nimport Base from './base';\nimport Utils from './utils';\n\nvar Form = function (element, domOptions, options) {\n this.__class__ = 'Form';\n\n this.element = element;\n this.$element = $(element);\n this.domOptions = domOptions;\n this.options = options;\n this.parent = window.Parsley;\n\n this.fields = [];\n this.validationResult = null;\n};\n\nvar statusMapping = {pending: null, resolved: true, rejected: false};\n\nForm.prototype = {\n onSubmitValidate: function (event) {\n // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior\n if (true === event.parsley)\n return;\n\n // If we didn't come here through a submit button, use the first one in the form\n var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0];\n this._submitSource = null;\n this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true);\n if (submitSource && null !== submitSource.getAttribute('formnovalidate'))\n return;\n\n window.Parsley._remoteCache = {};\n\n var promise = this.whenValidate({event});\n\n if ('resolved' === promise.state() && false !== this._trigger('submit')) {\n // All good, let event go through. We make this distinction because browsers\n // differ in their handling of `submit` being called from inside a submit event [#1047]\n } else {\n // Rejected or pending: cancel this submit\n event.stopImmediatePropagation();\n event.preventDefault();\n if ('pending' === promise.state())\n promise.done(() => { this._submit(submitSource); });\n }\n },\n\n onSubmitButton: function(event) {\n this._submitSource = event.currentTarget;\n },\n // internal\n // _submit submits the form, this time without going through the validations.\n // Care must be taken to \"fake\" the actual submit button being clicked.\n _submit: function (submitSource) {\n if (false === this._trigger('submit'))\n return;\n // Add submit button's data\n if (submitSource) {\n var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false);\n if (0 === $synthetic.length)\n $synthetic = $('').appendTo(this.$element);\n $synthetic.attr({\n name: submitSource.getAttribute('name'),\n value: submitSource.getAttribute('value')\n });\n }\n\n this.$element.trigger(Object.assign($.Event('submit'), {parsley: true}));\n },\n\n // Performs validation on fields while triggering events.\n // @returns `true` if all validations succeeds, `false`\n // if a failure is immediately detected, or `null`\n // if dependant on a promise.\n // Consider using `whenValidate` instead.\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.');\n var [group, force, event] = arguments;\n options = {group, force, event};\n }\n return statusMapping[ this.whenValidate(options).state() ];\n },\n\n whenValidate: function ({group, force, event} = {}) {\n this.submitEvent = event;\n if (event) {\n this.submitEvent = Object.assign({}, event, {preventDefault: () => {\n Utils.warnOnce(\"Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`\");\n this.validationResult = false;\n }});\n }\n this.validationResult = true;\n\n // fire validate event to eventually modify things before every validation\n this._trigger('validate');\n\n // Refresh form DOM options and form's fields that could have changed\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValidate({force, group}));\n });\n\n return Utils.all(promises)\n .done( () => { this._trigger('success'); })\n .fail( () => {\n this.validationResult = false;\n this.focus();\n this._trigger('error');\n })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n // Iterate over refreshed fields, and stop on first failure.\n // Returns `true` if all fields are valid, `false` if a failure is detected\n // or `null` if the result depends on an unresolved promise.\n // Prefer using `whenValid` instead.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.');\n var [group, force] = arguments;\n options = {group, force};\n }\n return statusMapping[ this.whenValid(options).state() ];\n },\n\n // Iterate over refreshed fields and validate them.\n // Returns a promise.\n // A validation that immediately fails will interrupt the validations.\n whenValid: function ({group, force} = {}) {\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValid({group, force}));\n });\n return Utils.all(promises);\n },\n\n refresh: function() {\n this._refreshFields();\n return this;\n },\n\n // Reset UI\n reset: function () {\n // Form case: emit a reset event for each field\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].reset();\n\n this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n\n // Form case: destroy all its fields and then destroy stored instance\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].destroy();\n\n this.$element.removeData('Parsley');\n this._trigger('destroy');\n },\n\n _refreshFields: function () {\n return this.actualizeOptions()._bindFields();\n },\n\n _bindFields: function () {\n var oldFields = this.fields;\n\n this.fields = [];\n this.fieldsMappedById = {};\n\n this._withoutReactualizingFormOptions(() => {\n this.$element\n .find(this.options.inputs)\n .not(this.options.excluded)\n .each((_, element) => {\n var fieldInstance = new window.Parsley.Factory(element, {}, this);\n\n // Only add valid and not excluded `Field` and `FieldMultiple` children\n if (('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) && (true !== fieldInstance.options.excluded)) {\n let uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__;\n if ('undefined' === typeof this.fieldsMappedById[uniqueId]) {\n this.fieldsMappedById[uniqueId] = fieldInstance;\n this.fields.push(fieldInstance);\n }\n }\n });\n\n $.each(Utils.difference(oldFields, this.fields), (_, field) => {\n field.reset();\n });\n });\n return this;\n },\n\n // Internal only.\n // Looping on a form's fields to do validation or similar\n // will trigger reactualizing options on all of them, which\n // in turn will reactualize the form's options.\n // To avoid calling actualizeOptions so many times on the form\n // for nothing, _withoutReactualizingFormOptions temporarily disables\n // the method actualizeOptions on this form while `fn` is called.\n _withoutReactualizingFormOptions: function (fn) {\n var oldActualizeOptions = this.actualizeOptions;\n this.actualizeOptions = function () { return this; };\n var result = fn();\n this.actualizeOptions = oldActualizeOptions;\n return result;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n // Returns true iff event is not interrupted and default not prevented.\n _trigger: function (eventName) {\n return this.trigger('form:' + eventName);\n }\n\n};\n\nexport default Form;\n","import Utils from './utils';\nimport Validator from './validator';\n\nconst Constraint = function(parsleyField, name, requirements, priority, isDomConstraint) {\n const validatorSpec = window.Parsley._validatorRegistry.validators[name];\n const validator = new Validator(validatorSpec);\n priority = priority || parsleyField.options[name + 'Priority'] || validator.priority;\n isDomConstraint = (true === isDomConstraint);\n\n Object.assign(this, {\n validator,\n name,\n requirements,\n priority,\n isDomConstraint\n });\n this._parseRequirements(parsleyField.options);\n};\n\nconst capitalize = function(str) {\n const cap = str[0].toUpperCase();\n return cap + str.slice(1);\n};\n\nConstraint.prototype = {\n validate: function(value, instance) {\n return this.validator.validate(value, ...this.requirementList, instance);\n },\n\n _parseRequirements: function(options) {\n this.requirementList = this.validator.parseRequirements(this.requirements,\n key => options[this.name + capitalize(key)]\n );\n }\n};\n\nexport default Constraint;\n","import $ from 'jquery';\nimport Constraint from './constraint';\nimport UI from './ui';\nimport Utils from './utils';\n\nvar Field = function (field, domOptions, options, parsleyFormInstance) {\n this.__class__ = 'Field';\n\n this.element = field;\n this.$element = $(field);\n\n // Set parent if we have one\n if ('undefined' !== typeof parsleyFormInstance) {\n this.parent = parsleyFormInstance;\n }\n\n this.options = options;\n this.domOptions = domOptions;\n\n // Initialize some properties\n this.constraints = [];\n this.constraintsByName = {};\n this.validationResult = true;\n\n // Bind constraints\n this._bindConstraints();\n};\n\nvar statusMapping = {pending: null, resolved: true, rejected: false};\n\nField.prototype = {\n // # Public API\n // Validate field and trigger some events for mainly `UI`\n // @returns `true`, an array of the validators that failed, or\n // `null` if validation is not finished. Prefer using whenValidate\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.');\n options = {options};\n }\n var promise = this.whenValidate(options);\n if (!promise) // If excluded with `group` option\n return true;\n switch (promise.state()) {\n case 'pending': return null;\n case 'resolved': return true;\n case 'rejected': return this.validationResult;\n }\n },\n\n // Validate field and trigger some events for mainly `UI`\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if field is not in the given `group`.\n whenValidate: function ({force, group} = {}) {\n // do not validate a field if not the same as given validation group\n this.refresh();\n if (group && !this._isInGroup(group))\n return;\n\n this.value = this.getValue();\n\n // Field Validate event. `this.value` could be altered for custom needs\n this._trigger('validate');\n\n return this.whenValid({force, value: this.value, _refreshed: true})\n .always(() => { this._reflowUI(); })\n .done(() => { this._trigger('success'); })\n .fail(() => { this._trigger('error'); })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n hasConstraints: function () {\n return 0 !== this.constraints.length;\n },\n\n // An empty optional field does not need validation\n needsValidation: function (value) {\n if ('undefined' === typeof value)\n value = this.getValue();\n\n // If a field is empty and not required, it is valid\n // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators\n if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty)\n return false;\n\n return true;\n },\n\n _isInGroup: function (group) {\n if (Array.isArray(this.options.group))\n return -1 !== $.inArray(group, this.options.group);\n return this.options.group === group;\n },\n\n // Just validate field. Do not trigger any event.\n // Returns `true` iff all constraints pass, `false` if there are failures,\n // or `null` if the result can not be determined yet (depends on a promise)\n // See also `whenValid`.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.');\n var [force, value] = arguments;\n options = {force, value};\n }\n var promise = this.whenValid(options);\n if (!promise) // Excluded via `group`\n return true;\n return statusMapping[promise.state()];\n },\n\n // Just validate field. Do not trigger any event.\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if the field is not in the given `group`.\n // The argument `force` will force validation of empty fields.\n // If a `value` is given, it will be validated instead of the value of the input.\n whenValid: function ({force = false, value, group, _refreshed} = {}) {\n // Recompute options and rebind constraints to have latest changes\n if (!_refreshed)\n this.refresh();\n // do not validate a field if not the same as given validation group\n if (group && !this._isInGroup(group))\n return;\n\n this.validationResult = true;\n\n // A field without constraint is valid\n if (!this.hasConstraints())\n return $.when();\n\n // Value could be passed as argument, needed to add more power to 'field:validate'\n if ('undefined' === typeof value || null === value)\n value = this.getValue();\n\n if (!this.needsValidation(value) && true !== force)\n return $.when();\n\n var groupedConstraints = this._getGroupedConstraints();\n var promises = [];\n $.each(groupedConstraints, (_, constraints) => {\n // Process one group of constraints at a time, we validate the constraints\n // and combine the promises together.\n var promise = Utils.all(\n $.map(constraints, constraint => this._validateConstraint(value, constraint))\n );\n promises.push(promise);\n if (promise.state() === 'rejected')\n return false; // Interrupt processing if a group has already failed\n });\n return Utils.all(promises);\n },\n\n // @returns a promise\n _validateConstraint: function(value, constraint) {\n var result = constraint.validate(value, this);\n // Map false to a failed promise\n if (false === result)\n result = $.Deferred().reject();\n // Make sure we return a promise and that we record failures\n return Utils.all([result]).fail(errorMessage => {\n if (!(this.validationResult instanceof Array))\n this.validationResult = [];\n this.validationResult.push({\n assert: constraint,\n errorMessage: 'string' === typeof errorMessage && errorMessage\n });\n });\n },\n\n // @returns Parsley field computed value that could be overrided or configured in DOM\n getValue: function () {\n var value;\n\n // Value could be overriden in DOM or with explicit options\n if ('function' === typeof this.options.value)\n value = this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n value = this.options.value;\n else\n value = this.$element.val();\n\n // Handle wrong DOM or configurations\n if ('undefined' === typeof value || null === value)\n return '';\n\n return this._handleWhitespace(value);\n },\n\n // Reset UI\n reset: function () {\n this._resetUI();\n return this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n this.$element.removeData('Parsley');\n this.$element.removeData('FieldMultiple');\n this._trigger('destroy');\n },\n\n // Actualize options and rebind constraints\n refresh: function () {\n this._refreshConstraints();\n return this;\n },\n\n _refreshConstraints: function () {\n return this.actualizeOptions()._bindConstraints();\n },\n\n refreshConstraints: function() {\n Utils.warnOnce(\"Parsley's refreshConstraints is deprecated. Please use refresh\");\n return this.refresh();\n },\n\n /**\n * Add a new constraint to a field\n *\n * @param {String} name\n * @param {Mixed} requirements optional\n * @param {Number} priority optional\n * @param {Boolean} isDomConstraint optional\n */\n addConstraint: function (name, requirements, priority, isDomConstraint) {\n\n if (window.Parsley._validatorRegistry.validators[name]) {\n var constraint = new Constraint(this, name, requirements, priority, isDomConstraint);\n\n // if constraint already exist, delete it and push new version\n if ('undefined' !== this.constraintsByName[constraint.name])\n this.removeConstraint(constraint.name);\n\n this.constraints.push(constraint);\n this.constraintsByName[constraint.name] = constraint;\n }\n\n return this;\n },\n\n // Remove a constraint\n removeConstraint: function (name) {\n for (var i = 0; i < this.constraints.length; i++)\n if (name === this.constraints[i].name) {\n this.constraints.splice(i, 1);\n break;\n }\n delete this.constraintsByName[name];\n return this;\n },\n\n // Update a constraint (Remove + re-add)\n updateConstraint: function (name, parameters, priority) {\n return this.removeConstraint(name)\n .addConstraint(name, parameters, priority);\n },\n\n // # Internals\n\n // Internal only.\n // Bind constraints from config + options + DOM\n _bindConstraints: function () {\n var constraints = [];\n var constraintsByName = {};\n\n // clean all existing DOM constraints to only keep javascript user constraints\n for (var i = 0; i < this.constraints.length; i++)\n if (false === this.constraints[i].isDomConstraint) {\n constraints.push(this.constraints[i]);\n constraintsByName[this.constraints[i].name] = this.constraints[i];\n }\n\n this.constraints = constraints;\n this.constraintsByName = constraintsByName;\n\n // then re-add Parsley DOM-API constraints\n for (var name in this.options)\n this.addConstraint(name, this.options[name], undefined, true);\n\n // finally, bind special HTML5 constraints\n return this._bindHtml5Constraints();\n },\n\n // Internal only.\n // Bind specific HTML5 constraints to be HTML5 compliant\n _bindHtml5Constraints: function () {\n // html5 required\n if (null !== this.element.getAttribute('required'))\n this.addConstraint('required', true, undefined, true);\n\n // html5 pattern\n if (null !== this.element.getAttribute('pattern'))\n this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true);\n\n // range\n let min = this.element.getAttribute('min');\n let max = this.element.getAttribute('max');\n if (null !== min && null !== max)\n this.addConstraint('range', [min, max], undefined, true);\n\n // HTML5 min\n else if (null !== min)\n this.addConstraint('min', min, undefined, true);\n\n // HTML5 max\n else if (null !== max)\n this.addConstraint('max', max, undefined, true);\n\n\n // length\n if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength'))\n this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true);\n\n // HTML5 minlength\n else if (null !== this.element.getAttribute('minlength'))\n this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true);\n\n // HTML5 maxlength\n else if (null !== this.element.getAttribute('maxlength'))\n this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true);\n\n\n // html5 types\n var type = Utils.getType(this.element);\n\n // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise\n if ('number' === type) {\n return this.addConstraint('type', ['number', {\n step: this.element.getAttribute('step') || '1',\n base: min || this.element.getAttribute('value')\n }], undefined, true);\n // Regular other HTML5 supported types\n } else if (/^(email|url|range|date)$/i.test(type)) {\n return this.addConstraint('type', type, undefined, true);\n }\n return this;\n },\n\n // Internal only.\n // Field is required if have required constraint without `false` value\n _isRequired: function () {\n if ('undefined' === typeof this.constraintsByName.required)\n return false;\n\n return false !== this.constraintsByName.required.requirements;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n _trigger: function (eventName) {\n return this.trigger('field:' + eventName);\n },\n\n // Internal only\n // Handles whitespace in a value\n // Use `data-parsley-whitespace=\"squish\"` to auto squish input value\n // Use `data-parsley-whitespace=\"trim\"` to auto trim input value\n _handleWhitespace: function (value) {\n if (true === this.options.trimValue)\n Utils.warnOnce('data-parsley-trim-value=\"true\" is deprecated, please use data-parsley-whitespace=\"trim\"');\n\n if ('squish' === this.options.whitespace)\n value = value.replace(/\\s{2,}/g, ' ');\n\n if (('trim' === this.options.whitespace) || ('squish' === this.options.whitespace) || (true === this.options.trimValue))\n value = Utils.trimString(value);\n\n return value;\n },\n\n _isDateInput: function() {\n var c = this.constraintsByName.type;\n return c && c.requirements === 'date';\n },\n\n // Internal only.\n // Returns the constraints, grouped by descending priority.\n // The result is thus an array of arrays of constraints.\n _getGroupedConstraints: function () {\n if (false === this.options.priorityEnabled)\n return [this.constraints];\n\n var groupedConstraints = [];\n var index = {};\n\n // Create array unique of priorities\n for (var i = 0; i < this.constraints.length; i++) {\n var p = this.constraints[i].priority;\n if (!index[p])\n groupedConstraints.push(index[p] = []);\n index[p].push(this.constraints[i]);\n }\n // Sort them by priority DESC\n groupedConstraints.sort(function (a, b) { return b[0].priority - a[0].priority; });\n\n return groupedConstraints;\n }\n\n};\n\nexport default Field;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar Multiple = function () {\n this.__class__ = 'FieldMultiple';\n};\n\nMultiple.prototype = {\n // Add new `$element` sibling for multiple field\n addElement: function ($element) {\n this.$elements.push($element);\n\n return this;\n },\n\n // See `Field._refreshConstraints()`\n _refreshConstraints: function () {\n var fieldConstraints;\n\n this.constraints = [];\n\n // Select multiple special treatment\n if (this.element.nodeName === 'SELECT') {\n this.actualizeOptions()._bindConstraints();\n\n return this;\n }\n\n // Gather all constraints for each input in the multiple group\n for (var i = 0; i < this.$elements.length; i++) {\n\n // Check if element have not been dynamically removed since last binding\n if (!$('html').has(this.$elements[i]).length) {\n this.$elements.splice(i, 1);\n continue;\n }\n\n fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints;\n\n for (var j = 0; j < fieldConstraints.length; j++)\n this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint);\n }\n\n return this;\n },\n\n // See `Field.getValue()`\n getValue: function () {\n // Value could be overriden in DOM\n if ('function' === typeof this.options.value)\n return this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n return this.options.value;\n\n // Radio input case\n if (this.element.nodeName === 'INPUT') {\n var type = Utils.getType(this.element);\n if (type === 'radio')\n return this._findRelated().filter(':checked').val() || '';\n\n // checkbox input case\n if (type === 'checkbox') {\n var values = [];\n\n this._findRelated().filter(':checked').each(function () {\n values.push($(this).val());\n });\n\n return values;\n }\n }\n\n // Select multiple case\n if (this.element.nodeName === 'SELECT' && null === this.$element.val())\n return [];\n\n // Default case that should never happen\n return this.$element.val();\n },\n\n _init: function () {\n this.$elements = [this.$element];\n\n return this;\n }\n};\n\nexport default Multiple;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Base from './base';\nimport Form from './form';\nimport Field from './field';\nimport Multiple from './multiple';\n\nvar Factory = function (element, options, parsleyFormInstance) {\n this.element = element;\n this.$element = $(element);\n\n // If the element has already been bound, returns its saved Parsley instance\n var savedparsleyFormInstance = this.$element.data('Parsley');\n if (savedparsleyFormInstance) {\n\n // If the saved instance has been bound without a Form parent and there is one given in this call, add it\n if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) {\n savedparsleyFormInstance.parent = parsleyFormInstance;\n savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);\n }\n\n if ('object' === typeof options) {\n Object.assign(savedparsleyFormInstance.options, options);\n }\n\n return savedparsleyFormInstance;\n }\n\n // Parsley must be instantiated with a DOM element or jQuery $element\n if (!this.$element.length)\n throw new Error('You must bind Parsley on an existing element.');\n\n if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__)\n throw new Error('Parent instance must be a Form instance');\n\n this.parent = parsleyFormInstance || window.Parsley;\n return this.init(options);\n};\n\nFactory.prototype = {\n init: function (options) {\n this.__class__ = 'Parsley';\n this.__version__ = '@@version';\n this.__id__ = Utils.generateID();\n\n // Pre-compute options\n this._resetOptions(options);\n\n // A Form instance is obviously a `` element but also every node that is not an input and has the `data-parsley-validate` attribute\n if (this.element.nodeName === 'FORM' || (Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)))\n return this.bind('parsleyForm');\n\n // Every other element is bound as a `Field` or `FieldMultiple`\n return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField');\n },\n\n isMultiple: function () {\n var type = Utils.getType(this.element);\n return ((type === 'radio' || type === 'checkbox') ||\n (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')));\n },\n\n // Multiples fields are a real nightmare :(\n // Maybe some refactoring would be appreciated here...\n handleMultiple: function () {\n var name;\n var multiple;\n var parsleyMultipleInstance;\n\n // Handle multiple name\n this.options.multiple = this.options.multiple ||\n (name = this.element.getAttribute('name')) ||\n this.element.getAttribute('id');\n\n // Special select multiple input\n if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) {\n this.options.multiple = this.options.multiple || this.__id__;\n return this.bind('parsleyFieldMultiple');\n\n // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it\n } else if (!this.options.multiple) {\n Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element);\n return this;\n }\n\n // Remove special chars\n this.options.multiple = this.options.multiple.replace(/(:|\\.|\\[|\\]|\\{|\\}|\\$)/g, '');\n\n // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name\n if (name) {\n $('input[name=\"' + name + '\"]').each((i, input) => {\n var type = Utils.getType(input);\n if ((type === 'radio' || type === 'checkbox'))\n input.setAttribute(this.options.namespace + 'multiple', this.options.multiple);\n });\n }\n\n // Check here if we don't already have a related multiple instance saved\n var $previouslyRelated = this._findRelated();\n for (var i = 0; i < $previouslyRelated.length; i++) {\n parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley');\n if ('undefined' !== typeof parsleyMultipleInstance) {\n\n if (!this.$element.data('FieldMultiple')) {\n parsleyMultipleInstance.addElement(this.$element);\n }\n\n break;\n }\n }\n\n // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')`\n // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance\n this.bind('parsleyField', true);\n\n return parsleyMultipleInstance || this.bind('parsleyFieldMultiple');\n },\n\n // Return proper `Form`, `Field` or `FieldMultiple`\n bind: function (type, doNotStore) {\n var parsleyInstance;\n\n switch (type) {\n case 'parsleyForm':\n parsleyInstance = $.extend(\n new Form(this.element, this.domOptions, this.options),\n new Base(),\n window.ParsleyExtend\n )._bindFields();\n break;\n case 'parsleyField':\n parsleyInstance = $.extend(\n new Field(this.element, this.domOptions, this.options, this.parent),\n new Base(),\n window.ParsleyExtend\n );\n break;\n case 'parsleyFieldMultiple':\n parsleyInstance = $.extend(\n new Field(this.element, this.domOptions, this.options, this.parent),\n new Multiple(),\n new Base(),\n window.ParsleyExtend\n )._init();\n break;\n default:\n throw new Error(type + 'is not a supported Parsley type');\n }\n\n if (this.options.multiple)\n Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple);\n\n if ('undefined' !== typeof doNotStore) {\n this.$element.data('FieldMultiple', parsleyInstance);\n\n return parsleyInstance;\n }\n\n // Store the freshly bound instance in a DOM element for later access using jQuery `data()`\n this.$element.data('Parsley', parsleyInstance);\n\n // Tell the world we have a new Form or Field instance!\n parsleyInstance._actualizeTriggers();\n parsleyInstance._trigger('init');\n\n return parsleyInstance;\n }\n};\n\nexport default Factory;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Defaults from './defaults';\nimport Base from './base';\nimport ValidatorRegistry from './validator_registry';\nimport UI from './ui';\nimport Form from './form';\nimport Field from './field';\nimport Multiple from './multiple';\nimport Factory from './factory';\n\nvar vernums = $.fn.jquery.split('.');\nif (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) {\n throw \"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.\";\n}\nif (!vernums.forEach) {\n Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim');\n}\n// Inherit `on`, `off` & `trigger` to Parsley:\nvar Parsley = Object.assign(new Base(), {\n element: document,\n $element: $(document),\n actualizeOptions: null,\n _resetOptions: null,\n Factory: Factory,\n version: '@@version'\n });\n\n// Supplement Field and Form with Base\n// This way, the constructors will have access to those methods\nObject.assign(Field.prototype, UI.Field, Base.prototype);\nObject.assign(Form.prototype, UI.Form, Base.prototype);\n// Inherit actualizeOptions and _resetOptions:\nObject.assign(Factory.prototype, Base.prototype);\n\n// ### jQuery API\n// `$('.elem').parsley(options)` or `$('.elem').psly(options)`\n$.fn.parsley = $.fn.psly = function (options) {\n if (this.length > 1) {\n var instances = [];\n\n this.each(function () {\n instances.push($(this).parsley(options));\n });\n\n return instances;\n }\n\n // Return undefined if applied to non existing DOM element\n if (this.length == 0) {\n return;\n }\n\n return new Factory(this[0], options);\n};\n\n// ### Field and Form extension\n// Ensure the extension is now defined if it wasn't previously\nif ('undefined' === typeof window.ParsleyExtend)\n window.ParsleyExtend = {};\n\n// ### Parsley config\n// Inherit from ParsleyDefault, and copy over any existing values\nParsley.options = Object.assign(Utils.objectCreate(Defaults), window.ParsleyConfig);\nwindow.ParsleyConfig = Parsley.options; // Old way of accessing global options\n\n// ### Globals\nwindow.Parsley = window.psly = Parsley;\nParsley.Utils = Utils;\nwindow.ParsleyUtils = {};\n$.each(Utils, (key, value) => {\n if ('function' === typeof value) {\n window.ParsleyUtils[key] = (...args) => {\n Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.');\n return Utils[key](...args);\n };\n }\n});\n\n// ### Define methods that forward to the registry, and deprecate all access except through window.Parsley\nvar registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n);\nwindow.ParsleyValidator = {};\n$.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) {\n window.Parsley[method] = (...args) => registry[method](...args);\n window.ParsleyValidator[method] = function () {\n Utils.warnOnce(`Accessing the method '${method}' through Validator is deprecated. Simply call 'window.Parsley.${method}(...)'`);\n return window.Parsley[method](...arguments);\n };\n});\n\n// ### UI\n// Deprecated global object\nwindow.Parsley.UI = UI;\nwindow.ParsleyUI = {\n removeError: function (instance, name, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance.removeError(name, {updateClass});\n },\n getErrorsMessages: function (instance) {\n Utils.warnOnce(`Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly.`);\n return instance.getErrorsMessages();\n }\n};\n$.each('addError updateError'.split(' '), function (i, method) {\n window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call '${method}' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance[method](name, {message, assert, updateClass});\n };\n});\n\n// ### PARSLEY auto-binding\n// Prevent it by setting `ParsleyConfig.autoBind` to `false`\nif (false !== window.ParsleyConfig.autoBind) {\n $(function () {\n // Works only on `data-parsley-validate`.\n if ($('[data-parsley-validate]').length)\n $('[data-parsley-validate]').parsley();\n });\n}\n\nexport default Parsley;\n","import $ from 'jquery';\nimport Field from './field';\nimport Form from './form';\nimport Utils from './utils';\n\nvar o = $({});\nvar deprecated = function () {\n Utils.warnOnce(\"Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley\");\n};\n\n// Returns an event handler that calls `fn` with the arguments it expects\nfunction adapt(fn, context) {\n // Store to allow unbinding\n if (!fn.parsleyAdaptedCallback) {\n fn.parsleyAdaptedCallback = function () {\n var args = Array.prototype.slice.call(arguments, 0);\n args.unshift(this);\n fn.apply(context || o, args);\n };\n }\n return fn.parsleyAdaptedCallback;\n}\n\nvar eventPrefix = 'parsley:';\n// Converts 'parsley:form:validate' into 'form:validate'\nfunction eventName(name) {\n if (name.lastIndexOf(eventPrefix, 0) === 0)\n return name.substr(eventPrefix.length);\n return name;\n}\n\n// $.listen is deprecated. Use Parsley.on instead.\n$.listen = function (name, callback) {\n var context;\n deprecated();\n if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) {\n context = arguments[1];\n callback = arguments[2];\n }\n\n if ('function' !== typeof callback)\n throw new Error('Wrong parameters');\n\n window.Parsley.on(eventName(name), adapt(callback, context));\n};\n\n$.listenTo = function (instance, name, fn) {\n deprecated();\n if (!(instance instanceof Field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong parameters');\n\n instance.on(eventName(name), adapt(fn));\n};\n\n$.unsubscribe = function (name, fn) {\n deprecated();\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong arguments');\n window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback);\n};\n\n$.unsubscribeTo = function (instance, name) {\n deprecated();\n if (!(instance instanceof Field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n instance.off(eventName(name));\n};\n\n$.unsubscribeAll = function (name) {\n deprecated();\n window.Parsley.off(eventName(name));\n $('form,input,textarea,select').each(function () {\n var instance = $(this).data('Parsley');\n if (instance) {\n instance.off(eventName(name));\n }\n });\n};\n\n// $.emit is deprecated. Use jQuery events instead.\n$.emit = function (name, instance) {\n deprecated();\n var instanceGiven = (instance instanceof Field) || (instance instanceof Form);\n var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1);\n args.unshift(eventName(name));\n if (!instanceGiven) {\n instance = window.Parsley;\n }\n instance.trigger(...args);\n};\n\nexport default {};\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Base from './base';\n\nimport Parsley from './main';\n\n$.extend(true, Parsley, {\n asyncValidators: {\n 'default': {\n fn: function (xhr) {\n // By default, only status 2xx are deemed successful.\n // Note: we use status instead of state() because responses with status 200\n // but invalid messages (e.g. an empty body for content type set to JSON) will\n // result in state() === 'rejected'.\n return xhr.status >= 200 && xhr.status < 300;\n },\n url: false\n },\n reverse: {\n fn: function (xhr) {\n // If reverse option is set, a failing ajax request is considered successful\n return xhr.status < 200 || xhr.status >= 300;\n },\n url: false\n }\n },\n\n addAsyncValidator: function (name, fn, url, options) {\n Parsley.asyncValidators[name] = {\n fn: fn,\n url: url || false,\n options: options || {}\n };\n\n return this;\n }\n\n});\n\nParsley.addValidator('remote', {\n requirementType: {\n '': 'string',\n 'validator': 'string',\n 'reverse': 'boolean',\n 'options': 'object'\n },\n\n validateString: function (value, url, options, instance) {\n var data = {};\n var ajaxOptions;\n var csr;\n var validator = options.validator || (true === options.reverse ? 'reverse' : 'default');\n\n if ('undefined' === typeof Parsley.asyncValidators[validator])\n throw new Error('Calling an undefined async validator: `' + validator + '`');\n\n url = Parsley.asyncValidators[validator].url || url;\n\n // Fill current value\n if (url.indexOf('{value}') > -1) {\n url = url.replace('{value}', encodeURIComponent(value));\n } else {\n data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value;\n }\n\n // Merge options passed in from the function with the ones in the attribute\n var remoteOptions = $.extend(true, options.options || {} , Parsley.asyncValidators[validator].options);\n\n // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options`\n ajaxOptions = $.extend(true, {}, {\n url: url,\n data: data,\n type: 'GET'\n }, remoteOptions);\n\n // Generate store key based on ajax options\n instance.trigger('field:ajaxoptions', instance, ajaxOptions);\n\n csr = $.param(ajaxOptions);\n\n // Initialise querry cache\n if ('undefined' === typeof Parsley._remoteCache)\n Parsley._remoteCache = {};\n\n // Try to retrieve stored xhr\n var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions);\n\n var handleXhr = function () {\n var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options);\n if (!result) // Map falsy results to rejected promise\n result = $.Deferred().reject();\n return $.when(result);\n };\n\n return xhr.then(handleXhr, handleXhr);\n },\n\n priority: -1\n});\n\nParsley.on('form:submit', function () {\n Parsley._remoteCache = {};\n});\n\nBase.prototype.addAsyncValidator = function () {\n Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`');\n return Parsley.addAsyncValidator(...arguments);\n};\n","// This is included with the Parsley library itself,\n// thus there is no use in adding it to your project.\nimport Parsley from '../parsley/main';\n\nParsley.addMessages('en', {\n defaultMessage: \"This value seems to be invalid.\",\n type: {\n email: \"This value should be a valid email.\",\n url: \"This value should be a valid url.\",\n number: \"This value should be a valid number.\",\n integer: \"This value should be a valid integer.\",\n digits: \"This value should be digits.\",\n alphanum: \"This value should be alphanumeric.\"\n },\n notblank: \"This value should not be blank.\",\n required: \"This value is required.\",\n pattern: \"This value seems to be invalid.\",\n min: \"This value should be greater than or equal to %s.\",\n max: \"This value should be lower than or equal to %s.\",\n range: \"This value should be between %s and %s.\",\n minlength: \"This value is too short. It should have %s characters or more.\",\n maxlength: \"This value is too long. It should have %s characters or fewer.\",\n length: \"This value length is invalid. It should be between %s and %s characters long.\",\n mincheck: \"You must select at least %s choices.\",\n maxcheck: \"You must select %s choices or fewer.\",\n check: \"You must select between %s and %s choices.\",\n equalto: \"This value should be the same.\"\n});\n\nParsley.setLocale('en');\n","/**\n * inputevent - Alleviate browser bugs for input events\n * https://github.com/marcandre/inputevent\n * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm)\n * @author Marc-Andre Lafortune \n * @license MIT\n */\n\nimport $ from 'jquery';\n\nfunction InputEvent() {\n let globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n Object.assign(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: evt => {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: evt => {\n if (this.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: evt => {\n if (this.isNativeEvent(evt)) {\n this.behavesOk(evt);\n $(document)\n .on('change.inputevent', evt.data.selector, this.fakeInputEvent);\n this.fakeInputEvent(evt);\n }\n },\n\n behavesOk: evt => {\n if (this.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, this.behavesOk)\n .off('change.inputevent', evt.data.selector, this.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: () => {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n for (let selector of ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]']) {\n $(document)\n .on('input.inputevent', selector, {selector}, this.behavesOk)\n .on('change.inputevent', selector, {selector}, this.misbehaves);\n }\n },\n\n uninstall: () => {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n};\n\nexport default new InputEvent();\n","import $ from 'jquery';\nimport Parsley from './parsley/main';\nimport './parsley/pubsub';\nimport './parsley/remote';\nimport './i18n/en';\nimport inputevent from './vendor/inputevent';\n\ninputevent.install();\n\nexport default Parsley;\n"]} \ No newline at end of file diff --git a/public/js/parsley/parsley.min.js b/public/js/parsley/parsley.min.js new file mode 100644 index 00000000..8048fbc3 --- /dev/null +++ b/public/js/parsley/parsley.min.js @@ -0,0 +1,18 @@ +/*! +* Parsley.js +* Version 2.8.1 - built Sat, Feb 3rd 2018, 2:27 pm +* http://parsleyjs.org +* Guillaume Potier - +* Marc-Andre Lafortune - +* MIT Licensed +*/ +function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t + * @license MIT + */ +function n(){var t=this,i=window||global;_extends(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger("input")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on("change.inputevent",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off("input.inputevent",i.data.selector,t.behavesOk).off("change.inputevent",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched="0.0.3";for(var n=["select",'input[type="checkbox"]','input[type="radio"]','input[type="file"]'],r=0;r1)throw Error("Second argument not supported");if("object"!=typeof t)throw TypeError("Argument must be an object");e.prototype=t;var i=new e;return e.prototype=null,i}}(),_SubmitSelector:'input[type="submit"], button:submit'},o={namespace:"data-parsley-",inputs:"input, textarea, select",excluded:"input[type=button], input[type=submit], input[type=reset], input[type=hidden]",priorityEnabled:!0,multiple:null,group:null,uiEnabled:!0,validationThreshold:3,focus:"first",trigger:!1,triggerAfterFailure:"input",errorClass:"parsley-error",successClass:"parsley-success",classHandler:function(e){},errorsContainer:function(e){},errorsWrapper:'
          ',errorTemplate:"
        • "},l=function(){this.__id__=a.generateID()};l.prototype={asyncSupport:!0,_pipeAccordingToValidationResult:function(){var t=this,i=function(){var i=e.Deferred();return!0!==t.validationResult&&i.reject(),i.resolve().promise()};return[i,i]},actualizeOptions:function(){return a.attr(this.element,this.options.namespace,this.domOptions),this.parent&&this.parent.actualizeOptions&&this.parent.actualizeOptions(),this},_resetOptions:function(e){this.domOptions=a.objectCreate(this.parent.options),this.options=a.objectCreate(this.domOptions);for(var t in e)e.hasOwnProperty(t)&&(this.options[t]=e[t]);this.actualizeOptions()},_listeners:null,on:function(e,t){this._listeners=this._listeners||{};var i=this._listeners[e]=this._listeners[e]||[];return i.push(t),this},subscribe:function(t,i){e.listenTo(this,t.toLowerCase(),i)},off:function(e,t){var i=this._listeners&&this._listeners[e];if(i)if(t)for(var n=i.length;n--;)i[n]===t&&i.splice(n,1);else delete this._listeners[e];return this},unsubscribe:function(t,i){e.unsubscribeTo(this,t.toLowerCase())},trigger:function(e,t,i){t=t||this;var n,r=this._listeners&&this._listeners[e];if(r)for(var s=r.length;s--;)if(n=r[s].call(t,t,i),n===!1)return n;return!this.parent||this.parent.trigger(e,t,i)},asyncIsValid:function(e,t){return a.warnOnce("asyncIsValid is deprecated; please use whenValid instead"),this.whenValid({group:e,force:t})},_findRelated:function(){return this.options.multiple?e(this.parent.element.querySelectorAll("["+this.options.namespace+'multiple="'+this.options.multiple+'"]')):this.$element}};var u=function(e,t){var i=e.match(/^\s*\[(.*)\]\s*$/);if(!i)throw'Requirement is not an array: "'+e+'"';var n=i[1].split(",").map(a.trimString);if(n.length!==t)throw"Requirement has "+n.length+" values when "+t+" are needed";return n},d=function(e,t,i){var n=null,r={};for(var s in e)if(s){var o=i(s);"string"==typeof o&&(o=a.parseRequirement(e[s],o)),r[s]=o}else n=a.parseRequirement(e[s],t);return[n,r]},h=function(t){e.extend(!0,this,t)};h.prototype={validate:function(e,t){if(this.fn)return arguments.length>3&&(t=[].slice.call(arguments,1,-1)),this.fn(e,t);if(Array.isArray(e)){if(!this.validateMultiple)throw"Validator `"+this.name+"` does not handle multiple values";return this.validateMultiple.apply(this,arguments)}var i=arguments[arguments.length-1];if(this.validateDate&&i._isDateInput())return arguments[0]=a.parse.date(arguments[0]),null!==arguments[0]&&this.validateDate.apply(this,arguments);if(this.validateNumber)return!isNaN(e)&&(arguments[0]=parseFloat(arguments[0]),this.validateNumber.apply(this,arguments));if(this.validateString)return this.validateString.apply(this,arguments);throw"Validator `"+this.name+"` only handles multiple values"},parseRequirements:function(t,i){if("string"!=typeof t)return Array.isArray(t)?t:[t];var n=this.requirementType;if(Array.isArray(n)){for(var r=u(t,n.length),s=0;s1?n-1:0),s=1;s0},validateString:function(e){return/\S/.test(e)},priority:512},type:{validateString:function(e,t){var i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=i.step,r=void 0===n?"any":n,s=i.base,a=void 0===s?0:s,o=c[t];if(!o)throw new Error("validator type `"+t+"` is not supported");if(!o.test(e))return!1;if("number"===t&&!/^any$/i.test(r||"")){var l=Number(e),u=Math.max(f(r),f(a));if(f(l)>u)return!1;var d=function(e){return Math.round(e*Math.pow(10,u))};if((d(l)-d(a))%d(r)!=0)return!1}return!0},requirementType:{"":"string",step:"string",base:"number"},priority:256},pattern:{validateString:function(e,t){return t.test(e)},requirementType:"regexp",priority:64},minlength:{validateString:function(e,t){return e.length>=t},requirementType:"integer",priority:30},maxlength:{validateString:function(e,t){return e.length<=t},requirementType:"integer",priority:30},length:{validateString:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:["integer","integer"],priority:30},mincheck:{validateMultiple:function(e,t){return e.length>=t},requirementType:"integer",priority:30},maxcheck:{validateMultiple:function(e,t){return e.length<=t},requirementType:"integer",priority:30},check:{validateMultiple:function(e,t,i){return e.length>=t&&e.length<=i},requirementType:["integer","integer"],priority:30},min:v(function(e,t){return e>=t}),max:v(function(e,t){return e<=t}),range:v(function(e,t,i){return e>=t&&e<=i}),equalto:{validateString:function(t,i){var n=e(i);return n.length?t===n.val():t===i},priority:256}}};var y={},_=function k(e,t,i){for(var n=[],r=[],s=0;s0&&"undefined"==typeof t.options.noFocus&&(this._focusedField=t.$element,"first"===this.options.focus))break}return null===this._focusedField?null:this._focusedField.focus()},_destroyUI:function(){this.$element.off(".Parsley")}},y.Field={_reflowUI:function(){if(this._buildUI(),this._ui){var e=_(this.validationResult,this._ui.lastValidationResult);this._ui.lastValidationResult=this.validationResult,this._manageStatusClass(),this._manageErrorsMessages(e),this._actualizeTriggers(),!e.kept.length&&!e.added.length||this._failedOnce||(this._failedOnce=!0,this._actualizeTriggers())}},getErrorsMessages:function(){if(!0===this.validationResult)return[];for(var e=[],t=0;t0?this._errorClass():this._resetClass()},_manageErrorsMessages:function(t){if("undefined"==typeof this.options.errorsMessagesDisabled){if("undefined"!=typeof this.options.errorMessage)return t.added.length||t.kept.length?(this._insertErrorWrapper(),0===this._ui.$errorsWrapper.find(".parsley-custom-error-message").length&&this._ui.$errorsWrapper.append(e(this.options.errorTemplate).addClass("parsley-custom-error-message")),this._ui.$errorsWrapper.addClass("filled").find(".parsley-custom-error-message").html(this.options.errorMessage)):this._ui.$errorsWrapper.removeClass("filled").find(".parsley-custom-error-message").remove();for(var i=0;i').appendTo(this.$element)),i.attr({name:t.getAttribute("name"),value:t.getAttribute("value")})}this.$element.trigger(_extends(e.Event("submit"),{parsley:!0}))}},validate:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){a.warnOnce("Calling validate on a parsley form without passing arguments as an object is deprecated.");var i=_slice.call(arguments),n=i[0],r=i[1],s=i[2];t={group:n,force:r,event:s}}return b[this.whenValidate(t).state()]},whenValidate:function(){var t,i=this,n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=n.group,s=n.force,o=n.event;this.submitEvent=o,o&&(this.submitEvent=_extends({},o,{preventDefault:function(){a.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`"),i.validationResult=!1}})),this.validationResult=!0,this._trigger("validate"),this._refreshFields();var l=this._withoutReactualizingFormOptions(function(){return e.map(i.fields,function(e){return e.whenValidate({force:s,group:r})})});return(t=a.all(l).done(function(){i._trigger("success")}).fail(function(){i.validationResult=!1,i.focus(),i._trigger("error")}).always(function(){i._trigger("validated")})).pipe.apply(t,_toConsumableArray(this._pipeAccordingToValidationResult()))},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){a.warnOnce("Calling isValid on a parsley form without passing arguments as an object is deprecated.");var i=_slice.call(arguments),n=i[0],r=i[1];t={group:n,force:r}}return b[this.whenValid(t).state()]},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.group,r=i.force;this._refreshFields();var s=this._withoutReactualizingFormOptions(function(){return e.map(t.fields,function(e){return e.whenValid({group:n,force:r})})});return a.all(s)},refresh:function(){return this._refreshFields(),this},reset:function(){for(var e=0;e=1&&!e.isPlainObject(t)&&(a.warnOnce("Calling validate on a parsley field without passing arguments as an object is deprecated."),t={options:t});var i=this.whenValidate(t);if(!i)return!0;switch(i.state()){case"pending":return null;case"resolved":return!0;case"rejected":return this.validationResult}},whenValidate:function(){var e,t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.force,r=i.group;if(this.refresh(),!r||this._isInGroup(r))return this.value=this.getValue(),this._trigger("validate"),(e=this.whenValid({force:n,value:this.value,_refreshed:!0}).always(function(){t._reflowUI()}).done(function(){t._trigger("success")}).fail(function(){t._trigger("error")}).always(function(){t._trigger("validated")})).pipe.apply(e,_toConsumableArray(this._pipeAccordingToValidationResult()))},hasConstraints:function(){return 0!==this.constraints.length},needsValidation:function(e){return"undefined"==typeof e&&(e=this.getValue()),!(!e.length&&!this._isRequired()&&"undefined"==typeof this.options.validateIfEmpty)},_isInGroup:function(t){return Array.isArray(this.options.group)?-1!==e.inArray(t,this.options.group):this.options.group===t},isValid:function(t){if(arguments.length>=1&&!e.isPlainObject(t)){a.warnOnce("Calling isValid on a parsley field without passing arguments as an object is deprecated.");var i=_slice.call(arguments),n=i[0],r=i[1];t={force:n,value:r}}var s=this.whenValid(t);return!s||E[s.state()]},whenValid:function(){var t=this,i=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=i.force,r=void 0!==n&&n,s=i.value,o=i.group,l=i._refreshed;if(l||this.refresh(),!o||this._isInGroup(o)){if(this.validationResult=!0,!this.hasConstraints())return e.when();if("undefined"!=typeof s&&null!==s||(s=this.getValue()),!this.needsValidation(s)&&!0!==r)return e.when();var u=this._getGroupedConstraints(),d=[];return e.each(u,function(i,n){var r=a.all(e.map(n,function(e){return t._validateConstraint(s,e)}));if(d.push(r),"rejected"===r.state())return!1}),a.all(d)}},_validateConstraint:function(t,i){var n=this,r=i.validate(t,this);return!1===r&&(r=e.Deferred().reject()),a.all([r]).fail(function(e){n.validationResult instanceof Array||(n.validationResult=[]),n.validationResult.push({assert:i,errorMessage:"string"==typeof e&&e})})},getValue:function(){var e;return e="function"==typeof this.options.value?this.options.value(this):"undefined"!=typeof this.options.value?this.options.value:this.$element.val(),"undefined"==typeof e||null===e?"":this._handleWhitespace(e)},reset:function(){return this._resetUI(),this._trigger("reset")},destroy:function(){this._destroyUI(),this.$element.removeData("Parsley"),this.$element.removeData("FieldMultiple"),this._trigger("destroy")},refresh:function(){return this._refreshConstraints(),this},_refreshConstraints:function(){return this.actualizeOptions()._bindConstraints()},refreshConstraints:function(){return a.warnOnce("Parsley's refreshConstraints is deprecated. Please use refresh"),this.refresh()},addConstraint:function(e,t,i,n){if(window.Parsley._validatorRegistry.validators[e]){var r=new F(this,e,t,i,n);"undefined"!==this.constraintsByName[r.name]&&this.removeConstraint(r.name),this.constraints.push(r),this.constraintsByName[r.name]=r}return this},removeConstraint:function(e){for(var t=0;t1){var i=[];return this.each(function(){i.push(e(this).parsley(t))}),i}if(0!=this.length)return new P(this[0],t)},"undefined"==typeof window.ParsleyExtend&&(window.ParsleyExtend={}),T.options=_extends(a.objectCreate(o),window.ParsleyConfig),window.ParsleyConfig=T.options,window.Parsley=window.psly=T,T.Utils=a,window.ParsleyUtils={},e.each(a,function(e,t){"function"==typeof t&&(window.ParsleyUtils[e]=function(){return a.warnOnce("Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead."),a[e].apply(a,arguments)})});var O=window.Parsley._validatorRegistry=new p(window.ParsleyConfig.validators,window.ParsleyConfig.i18n);window.ParsleyValidator={},e.each("setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator".split(" "),function(e,t){window.Parsley[t]=function(){return O[t].apply(O,arguments)},window.ParsleyValidator[t]=function(){var e;return a.warnOnce("Accessing the method '"+t+"' through Validator is deprecated. Simply call 'window.Parsley."+t+"(...)'"),(e=window.Parsley)[t].apply(e,arguments)}}),window.Parsley.UI=y,window.ParsleyUI={removeError:function(e,t,i){var n=!0!==i;return a.warnOnce("Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method."),e.removeError(t,{updateClass:n})},getErrorsMessages:function(e){return a.warnOnce("Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly."),e.getErrorsMessages()}},e.each("addError updateError".split(" "),function(e,t){window.ParsleyUI[t]=function(e,i,n,r,s){var o=!0!==s;return a.warnOnce("Accessing UI is deprecated. Call '"+t+"' on the instance directly. Please comment in issue 1073 as to your need to call this method."),e[t](i,{message:n,assert:r,updateClass:o})}}),!1!==window.ParsleyConfig.autoBind&&e(function(){e("[data-parsley-validate]").length&&e("[data-parsley-validate]").parsley()});var M=e({}),R=function(){a.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley")},D="parsley:";e.listen=function(e,n){var r;if(R(),"object"==typeof arguments[1]&&"function"==typeof arguments[2]&&(r=arguments[1],n=arguments[2]),"function"!=typeof n)throw new Error("Wrong parameters");window.Parsley.on(i(e),t(n,r))},e.listenTo=function(e,n,r){if(R(),!(e instanceof x||e instanceof w))throw new Error("Must give Parsley instance");if("string"!=typeof n||"function"!=typeof r)throw new Error("Wrong parameters");e.on(i(n),t(r))},e.unsubscribe=function(e,t){if(R(),"string"!=typeof e||"function"!=typeof t)throw new Error("Wrong arguments");window.Parsley.off(i(e),t.parsleyAdaptedCallback)},e.unsubscribeTo=function(e,t){if(R(),!(e instanceof x||e instanceof w))throw new Error("Must give Parsley instance");e.off(i(t))},e.unsubscribeAll=function(t){R(),window.Parsley.off(i(t)),e("form,input,textarea,select").each(function(){var n=e(this).data("Parsley");n&&n.off(i(t))})},e.emit=function(e,t){var n;R();var r=t instanceof x||t instanceof w,s=Array.prototype.slice.call(arguments,r?2:1);s.unshift(i(e)),r||(t=window.Parsley),(n=t).trigger.apply(n,_toConsumableArray(s))};e.extend(!0,T,{asyncValidators:{"default":{fn:function(e){return e.status>=200&&e.status<300},url:!1},reverse:{fn:function(e){return e.status<200||e.status>=300},url:!1}},addAsyncValidator:function(e,t,i,n){return T.asyncValidators[e]={fn:t,url:i||!1,options:n||{}},this}}),T.addValidator("remote",{requirementType:{"":"string",validator:"string",reverse:"boolean",options:"object"},validateString:function(t,i,n,r){var s,a,o={},l=n.validator||(!0===n.reverse?"reverse":"default");if("undefined"==typeof T.asyncValidators[l])throw new Error("Calling an undefined async validator: `"+l+"`");i=T.asyncValidators[l].url||i,i.indexOf("{value}")>-1?i=i.replace("{value}",encodeURIComponent(t)):o[r.element.getAttribute("name")||r.element.getAttribute("id")]=t;var u=e.extend(!0,n.options||{},T.asyncValidators[l].options);s=e.extend(!0,{},{url:i,data:o,type:"GET"},u),r.trigger("field:ajaxoptions",r,s),a=e.param(s),"undefined"==typeof T._remoteCache&&(T._remoteCache={});var d=T._remoteCache[a]=T._remoteCache[a]||e.ajax(s),h=function(){var t=T.asyncValidators[l].fn.call(r,d,i,n);return t||(t=e.Deferred().reject()),e.when(t)};return d.then(h,h)},priority:-1}),T.on("form:submit",function(){T._remoteCache={}}),l.prototype.addAsyncValidator=function(){return a.warnOnce("Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`"),T.addAsyncValidator.apply(T,arguments)},T.addMessages("en",{defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",number:"This value should be a valid number.",integer:"This value should be a valid integer.",digits:"This value should be digits.",alphanum:"This value should be alphanumeric."},notblank:"This value should not be blank.",required:"This value is required.",pattern:"This value seems to be invalid.",min:"This value should be greater than or equal to %s.",max:"This value should be lower than or equal to %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or fewer.",length:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or fewer.",check:"You must select between %s and %s choices.",equalto:"This value should be the same."}),T.setLocale("en");var I=new n;I.install();var q=T;return q}); +//# sourceMappingURL=parsley.min.js.map diff --git a/public/js/parsley/parsley.min.js.map b/public/js/parsley/parsley.min.js.map new file mode 100644 index 00000000..add68e9e --- /dev/null +++ b/public/js/parsley/parsley.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["parsley.min.js","parsley.js","src/parsley/pubsub.js","src/vendor/inputevent.js","src/parsley/utils.js","src/parsley/defaults.js","src/parsley/base.js","src/parsley/validator.js","src/parsley/validator_registry.js","src/parsley/ui.js","src/parsley/form.js","src/parsley/constraint.js","src/parsley/field.js","src/parsley/multiple.js","src/parsley/factory.js","src/parsley/main.js","src/parsley/remote.js","src/i18n/en.js","src/parsley.js"],"names":["_toConsumableArray","arr","Array","isArray","i","arr2","length","from","_slice","prototype","slice","_slicedToArray","sliceIterator","_arr","_n","_d","_e","undefined","_s","_i","Symbol","iterator","next","done","push","value","err","Object","TypeError","_extends","assign","target","arguments","source","key","hasOwnProperty","call","global","factory","exports","module","require","define","amd","parsley","jQuery","this","$","adapt","fn","context","parsleyAdaptedCallback","args","unshift","apply","o","eventName","name","lastIndexOf","eventPrefix","substr","InputEvent","_this14","globals","window","isNativeEvent","evt","originalEvent","isTrusted","fakeInputEvent","trigger","misbehaves","behavesOk","document","on","data","selector","off","install","inputEventPatched","uninstall","globalID","pastWarnings","Utils","attr","element","namespace","obj","attribute","attributes","regex","RegExp","specified","test","camelize","deserializeValue","checkAttr","_checkAttr","hasAttribute","setAttr","setAttribute","dasherize","String","getType","getAttribute","generateID","num","isNaN","Number","JSON","parse","e","str","replace","match","chr","toUpperCase","toLowerCase","warn","_window$console","console","warnOnce","msg","_resetWarnings","trimString","string","date","parsed","_parsed$map","map","x","parseInt","_parsed$map2","year","month","day","Date","getFullYear","getMonth","getDate","_string","integer","number","parseFloat","boolean","object","regexp","_regexp","flags","parseRequirement","requirementType","converter","converted","namespaceEvents","events","split","join","difference","array","remove","result","each","_","elem","indexOf","all","promises","when","concat","objectCreate","create","Error","_SubmitSelector","Defaults","inputs","excluded","priorityEnabled","multiple","group","uiEnabled","validationThreshold","focus","triggerAfterFailure","errorClass","successClass","classHandler","Field","errorsContainer","errorsWrapper","errorTemplate","Base","__id__","asyncSupport","_pipeAccordingToValidationResult","_this","pipe","r","Deferred","validationResult","reject","resolve","promise","actualizeOptions","options","domOptions","parent","_resetOptions","initOptions","_listeners","queue","subscribe","listenTo","splice","unsubscribe","unsubscribeTo","extraArg","asyncIsValid","force","whenValid","_findRelated","querySelectorAll","$element","convertArrayRequirement","m","values","convertExtraOptionRequirement","requirementSpec","extraOptionReader","main","extra","Validator","spec","extend","validate","requirementFirstArg","validateMultiple","instance","validateDate","_isDateInput","validateNumber","validateString","parseRequirements","requirements","type","isPlainObject","priority","ValidatorRegistry","validators","catalog","__class__","locale","init","typeTesters","email","digits","alphanum","url","range","decimalPlaces","Math","max","ValidatorRegistry__parseArguments","ValidatorRegistry__operatorToValidator","operator","_len","requirementsAndInput","_key","pop","ValidatorRegistry__comparisonOperator","addValidator","Parsley","setLocale","addCatalog","messages","set","addMessage","message","addMessages","nameMessageObject","arg1","arg2","_setValidator","hasValidator","updateValidator","removeValidator","validator","getErrorMessage","constraint","typeMessages","formatMessage","defaultMessage","en","parameters","notblank","required","_ref","_ref$step","step","_ref$base","base","tester","nb","decimals","toInt","f","round","pow","","pattern","minlength","requirement","maxlength","min","mincheck","maxcheck","check","equalto","refOrValue","$reference","val","UI","diffResults","newResult","oldResult","deep","added","kept","found","j","assert","removed","Form","_actualizeTriggers","_this2","onSubmitValidate","onSubmitButton","_focusedField","fields","field","noFocus","_destroyUI","_reflowUI","_buildUI","_ui","diff","lastValidationResult","_manageStatusClass","_manageErrorsMessages","_failedOnce","getErrorsMessages","errorMessage","_getErrorMessage","addError","_ref2","_ref2$updateClass","updateClass","_addError","_errorClass","updateError","_ref3","_ref3$updateClass","_updateError","removeError","_ref4","_ref4$updateClass","_removeError","hasConstraints","needsValidation","_successClass","_resetClass","errorsMessagesDisabled","_insertErrorWrapper","$errorsWrapper","find","append","addClass","html","removeClass","_ref5","$errorClassHandler","errorsWrapperId","_ref6","removeAttr","customConstraintErrorMessage","_manageClassHandler","validationInformationVisible","$handlerFunction","$handler","_inputHolder","nodeName","$errorsContainer","after","_this3","$toBind","_validateIfNeeded","event","_this4","getValue","debounce","clearTimeout","_debounced","setTimeout","_resetUI","children","Form__statusMapping","pending","resolved","rejected","_this5","submitSource","_submitSource","prop","_remoteCache","whenValidate","state","_trigger","stopImmediatePropagation","preventDefault","_submit","currentTarget","$synthetic","appendTo","Event","_arguments","_Utils$all$done$fail$always","_this6","_ref7","submitEvent","_refreshFields","_withoutReactualizingFormOptions","fail","always","isValid","_arguments2","_this7","_ref8","refresh","reset","destroy","removeData","_bindFields","_this8","oldFields","fieldsMappedById","not","fieldInstance","Factory","uniqueId","oldActualizeOptions","Constraint","parsleyField","isDomConstraint","validatorSpec","_validatorRegistry","_parseRequirements","capitalize","cap","_validator","requirementList","_this9","parsleyFormInstance","constraints","constraintsByName","_bindConstraints","parsley_field__statusMapping","_whenValid$always$done$fail$always","_this10","_ref9","_isInGroup","_refreshed","_isRequired","validateIfEmpty","inArray","_arguments3","_this11","_ref10","_ref10$force","groupedConstraints","_getGroupedConstraints","_validateConstraint","_this12","_handleWhitespace","_refreshConstraints","refreshConstraints","addConstraint","removeConstraint","updateConstraint","_bindHtml5Constraints","trimValue","whitespace","c","index","p","sort","a","b","parsley_field","Multiple","addElement","$elements","fieldConstraints","has","filter","_init","savedparsleyFormInstance","__version__","is","bind","isMultiple","handleMultiple","parsleyMultipleInstance","_this13","input","$previouslyRelated","get","doNotStore","parsleyInstance","ParsleyExtend","vernums","jquery","forEach","version","psly","instances","ParsleyConfig","ParsleyUtils","registry","i18n","ParsleyValidator","method","_window$Parsley","ParsleyUI","doNotUpdateClass","autoBind","deprecated","listen","callback","unsubscribeAll","emit","_instance","instanceGiven","asyncValidators","default","xhr","status","reverse","addAsyncValidator","ajaxOptions","csr","encodeURIComponent","remoteOptions","param","ajax","handleXhr","then","inputevent"],"mappings":";;;;;;;;AAkBA,QAASA,oBAAmBC,GAAO,GAAIC,MAAMC,QAAQF,GAAM,CAAE,IAAK,GAAIG,GAAI,EAAGC,EAAOH,MAAMD,EAAIK,QAASF,EAAIH,EAAIK,OAAQF,IAAKC,EAAKD,GAAKH,EAAIG,EAAI,OAAOC,GAAe,MAAOH,OAAMK,KAAKN,GANtL,GAAIO,QAASN,MAAMO,UAAUC,MAEzBC,eAAiB,WAAe,QAASC,GAAcX,EAAKG,GAAK,GAAIS,MAAeC,GAAK,EAAUC,GAAK,EAAWC,EAAKC,MAAW,KAAM,IAAK,GAAiCC,GAA7BC,EAAKlB,EAAImB,OAAOC,cAAmBP,GAAMI,EAAKC,EAAGG,QAAQC,QAAoBV,EAAK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Eyf,KAAKL,GAEtEM,EAAY,WACd,GAAIzY,GAAS8G,EAAQ+Q,gBAAgBhQ,GAAW5O,GAAGb,KAAKwM,EAAUmT,EAAK/R,EAAKrD,EAG5E,OAFK3C,KACHA,EAASjH,EAAEsJ,WAAWE,UACjBxJ,EAAEwH,KAAKP,GAGhB,OAAO+X,GAAIW,KAAKD,EAAWA,IAG7BpT,cAGFyB,EAAQpM,GAAG,cAAe,WACxBoM,EAAQ8I,kBAGV9N,EAAKrL,UAAUyhB,kBAAoB,WAEjC,MADA/c,GAAMsC,SAAS,4HACRqJ,EAAQoR,kBAAA5e,MAARwN,EAA6B9O,YCtGtC8O,EAAQO,YAAY,MAClBa,eAAgB,kCAChB/C,MACEU,MAAc,sCACdG,IAAc,oCACdlH,OAAc,uCACdD,QAAc,wCACdiH,OAAc,+BACdC,SAAc,sCAEhBsC,SAAgB,kCAChBC,SAAgB,0BAChBc,QAAgB,kCAChBI,IAAgB,oDAChBpD,IAAgB,kDAChBH,MAAgB,0CAChBoD,UAAgB,iEAChBE,UAAgB,iEAChBjT,OAAgB,gFAChBmT,SAAgB,uCAChBC,SAAgB,uCAChBC,MAAgB,6CAChBC,QAAgB,mCAGlB9C,EAAQC,UAAU,Kd7BlB,IAAA4R,GAkEe,GAAI9e,Ee3DnB8e,GAAW7d,SAPX,IAAAlC,GAAAkO,CjB89EE,OAAOlO","file":"parsley.min.js","sourcesContent":["/*!\n* Parsley.js\n* Version 2.8.1 - built Sat, Feb 3rd 2018, 2:27 pm\n* http://parsleyjs.org\n* Guillaume Potier - \n* Marc-Andre Lafortune - \n* MIT Licensed\n*/\n\n// The source code below is generated by babel as\n// Parsley is written in ECMAScript 6\n//\nvar _slice = Array.prototype.slice;\n\nvar _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : typeof define === 'function' && define.amd ? define(['jquery'], factory) : global.parsley = factory(global.jQuery);\n})(this, function ($) {\n 'use strict';\n\n var globalID = 1;\n var pastWarnings = {};\n\n var Utils = {\n // Parsley DOM-API\n // returns object from dom attributes and values\n attr: function attr(element, namespace, obj) {\n var i;\n var attribute;\n var attributes;\n var regex = new RegExp('^' + namespace, 'i');\n\n if ('undefined' === typeof obj) obj = {};else {\n // Clear all own properties. This won't affect prototype's values\n for (i in obj) {\n if (obj.hasOwnProperty(i)) delete obj[i];\n }\n }\n\n if (!element) return obj;\n\n attributes = element.attributes;\n for (i = attributes.length; i--;) {\n attribute = attributes[i];\n\n if (attribute && attribute.specified && regex.test(attribute.name)) {\n obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value);\n }\n }\n\n return obj;\n },\n\n checkAttr: function checkAttr(element, namespace, _checkAttr) {\n return element.hasAttribute(namespace + _checkAttr);\n },\n\n setAttr: function setAttr(element, namespace, attr, value) {\n element.setAttribute(this.dasherize(namespace + attr), String(value));\n },\n\n getType: function getType(element) {\n return element.getAttribute('type') || 'text';\n },\n\n generateID: function generateID() {\n return '' + globalID++;\n },\n\n /** Third party functions **/\n deserializeValue: function deserializeValue(value) {\n var num;\n\n try {\n return value ? value == \"true\" || (value == \"false\" ? false : value == \"null\" ? null : !isNaN(num = Number(value)) ? num : /^[\\[\\{]/.test(value) ? JSON.parse(value) : value) : value;\n } catch (e) {\n return value;\n }\n },\n\n // Zepto camelize function\n camelize: function camelize(str) {\n return str.replace(/-+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n // Zepto dasherize function\n dasherize: function dasherize(str) {\n return str.replace(/::/g, '/').replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2').replace(/([a-z\\d])([A-Z])/g, '$1_$2').replace(/_/g, '-').toLowerCase();\n },\n\n warn: function warn() {\n var _window$console;\n\n if (window.console && 'function' === typeof window.console.warn) (_window$console = window.console).warn.apply(_window$console, arguments);\n },\n\n warnOnce: function warnOnce(msg) {\n if (!pastWarnings[msg]) {\n pastWarnings[msg] = true;\n this.warn.apply(this, arguments);\n }\n },\n\n _resetWarnings: function _resetWarnings() {\n pastWarnings = {};\n },\n\n trimString: function trimString(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n },\n\n parse: {\n date: function date(string) {\n var parsed = string.match(/^(\\d{4,})-(\\d\\d)-(\\d\\d)$/);\n if (!parsed) return null;\n\n var _parsed$map = parsed.map(function (x) {\n return parseInt(x, 10);\n });\n\n var _parsed$map2 = _slicedToArray(_parsed$map, 4);\n\n var _ = _parsed$map2[0];\n var year = _parsed$map2[1];\n var month = _parsed$map2[2];\n var day = _parsed$map2[3];\n\n var date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) return null;\n return date;\n },\n string: function string(_string) {\n return _string;\n },\n integer: function integer(string) {\n if (isNaN(string)) return null;\n return parseInt(string, 10);\n },\n number: function number(string) {\n if (isNaN(string)) throw null;\n return parseFloat(string);\n },\n 'boolean': function _boolean(string) {\n return !/^\\s*false\\s*$/i.test(string);\n },\n object: function object(string) {\n return Utils.deserializeValue(string);\n },\n regexp: function regexp(_regexp) {\n var flags = '';\n\n // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern\n if (/^\\/.*\\/(?:[gimy]*)$/.test(_regexp)) {\n // Replace the regexp literal string with the first match group: ([gimy]*)\n // If no flag is present, this will be a blank string\n flags = _regexp.replace(/.*\\/([gimy]*)$/, '$1');\n // Again, replace the regexp literal string with the first match group:\n // everything excluding the opening and closing slashes and the flags\n _regexp = _regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');\n } else {\n // Anchor regexp:\n _regexp = '^' + _regexp + '$';\n }\n return new RegExp(_regexp, flags);\n }\n },\n\n parseRequirement: function parseRequirement(requirementType, string) {\n var converter = this.parse[requirementType || 'string'];\n if (!converter) throw 'Unknown requirement specification: \"' + requirementType + '\"';\n var converted = converter(string);\n if (converted === null) throw 'Requirement is not a ' + requirementType + ': \"' + string + '\"';\n return converted;\n },\n\n namespaceEvents: function namespaceEvents(events, namespace) {\n events = this.trimString(events || '').split(/\\s+/);\n if (!events[0]) return '';\n return $.map(events, function (evt) {\n return evt + '.' + namespace;\n }).join(' ');\n },\n\n difference: function difference(array, remove) {\n // This is O(N^2), should be optimized\n var result = [];\n $.each(array, function (_, elem) {\n if (remove.indexOf(elem) == -1) result.push(elem);\n });\n return result;\n },\n\n // Alter-ego to native Promise.all, but for jQuery\n all: function all(promises) {\n // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements\n return $.when.apply($, _toConsumableArray(promises).concat([42, 42]));\n },\n\n // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill\n objectCreate: Object.create || (function () {\n var Object = function Object() {};\n return function (prototype) {\n if (arguments.length > 1) {\n throw Error('Second argument not supported');\n }\n if (typeof prototype != 'object') {\n throw TypeError('Argument must be an object');\n }\n Object.prototype = prototype;\n var result = new Object();\n Object.prototype = null;\n return result;\n };\n })(),\n\n _SubmitSelector: 'input[type=\"submit\"], button:submit'\n };\n\n // All these options could be overriden and specified directly in DOM using\n // `data-parsley-` default DOM-API\n // eg: `inputs` can be set in DOM using `data-parsley-inputs=\"input, textarea\"`\n // eg: `data-parsley-stop-on-first-failing-constraint=\"false\"`\n\n var Defaults = {\n // ### General\n\n // Default data-namespace for DOM API\n namespace: 'data-parsley-',\n\n // Supported inputs by default\n inputs: 'input, textarea, select',\n\n // Excluded inputs by default\n excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',\n\n // Stop validating field on highest priority failing constraint\n priorityEnabled: true,\n\n // ### Field only\n\n // identifier used to group together inputs (e.g. radio buttons...)\n multiple: null,\n\n // identifier (or array of identifiers) used to validate only a select group of inputs\n group: null,\n\n // ### UI\n // Enable\\Disable error messages\n uiEnabled: true,\n\n // Key events threshold before validation\n validationThreshold: 3,\n\n // Focused field on form validation error. 'first'|'last'|'none'\n focus: 'first',\n\n // event(s) that will trigger validation before first failure. eg: `input`...\n trigger: false,\n\n // event(s) that will trigger validation after first failure.\n triggerAfterFailure: 'input',\n\n // Class that would be added on every failing validation Parsley field\n errorClass: 'parsley-error',\n\n // Same for success validation\n successClass: 'parsley-success',\n\n // Return the `$element` that will receive these above success or error classes\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n classHandler: function classHandler(Field) {},\n\n // Return the `$element` where errors will be appended\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n errorsContainer: function errorsContainer(Field) {},\n\n // ul elem that would receive errors' list\n errorsWrapper: '
            ',\n\n // li elem that would receive error message\n errorTemplate: '
          • '\n };\n\n var Base = function Base() {\n this.__id__ = Utils.generateID();\n };\n\n Base.prototype = {\n asyncSupport: true, // Deprecated\n\n _pipeAccordingToValidationResult: function _pipeAccordingToValidationResult() {\n var _this = this;\n\n var pipe = function pipe() {\n var r = $.Deferred();\n if (true !== _this.validationResult) r.reject();\n return r.resolve().promise();\n };\n return [pipe, pipe];\n },\n\n actualizeOptions: function actualizeOptions() {\n Utils.attr(this.element, this.options.namespace, this.domOptions);\n if (this.parent && this.parent.actualizeOptions) this.parent.actualizeOptions();\n return this;\n },\n\n _resetOptions: function _resetOptions(initOptions) {\n this.domOptions = Utils.objectCreate(this.parent.options);\n this.options = Utils.objectCreate(this.domOptions);\n // Shallow copy of ownProperties of initOptions:\n for (var i in initOptions) {\n if (initOptions.hasOwnProperty(i)) this.options[i] = initOptions[i];\n }\n this.actualizeOptions();\n },\n\n _listeners: null,\n\n // Register a callback for the given event name\n // Callback is called with context as the first argument and the `this`\n // The context is the current parsley instance, or window.Parsley if global\n // A return value of `false` will interrupt the calls\n on: function on(name, fn) {\n this._listeners = this._listeners || {};\n var queue = this._listeners[name] = this._listeners[name] || [];\n queue.push(fn);\n\n return this;\n },\n\n // Deprecated. Use `on` instead\n subscribe: function subscribe(name, fn) {\n $.listenTo(this, name.toLowerCase(), fn);\n },\n\n // Unregister a callback (or all if none is given) for the given event name\n off: function off(name, fn) {\n var queue = this._listeners && this._listeners[name];\n if (queue) {\n if (!fn) {\n delete this._listeners[name];\n } else {\n for (var i = queue.length; i--;) if (queue[i] === fn) queue.splice(i, 1);\n }\n }\n return this;\n },\n\n // Deprecated. Use `off`\n unsubscribe: function unsubscribe(name, fn) {\n $.unsubscribeTo(this, name.toLowerCase());\n },\n\n // Trigger an event of the given name\n // A return value of `false` interrupts the callback chain\n // Returns false if execution was interrupted\n trigger: function trigger(name, target, extraArg) {\n target = target || this;\n var queue = this._listeners && this._listeners[name];\n var result;\n var parentResult;\n if (queue) {\n for (var i = queue.length; i--;) {\n result = queue[i].call(target, target, extraArg);\n if (result === false) return result;\n }\n }\n if (this.parent) {\n return this.parent.trigger(name, target, extraArg);\n }\n return true;\n },\n\n asyncIsValid: function asyncIsValid(group, force) {\n Utils.warnOnce(\"asyncIsValid is deprecated; please use whenValid instead\");\n return this.whenValid({ group: group, force: force });\n },\n\n _findRelated: function _findRelated() {\n return this.options.multiple ? $(this.parent.element.querySelectorAll('[' + this.options.namespace + 'multiple=\"' + this.options.multiple + '\"]')) : this.$element;\n }\n };\n\n var convertArrayRequirement = function convertArrayRequirement(string, length) {\n var m = string.match(/^\\s*\\[(.*)\\]\\s*$/);\n if (!m) throw 'Requirement is not an array: \"' + string + '\"';\n var values = m[1].split(',').map(Utils.trimString);\n if (values.length !== length) throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed';\n return values;\n };\n\n var convertExtraOptionRequirement = function convertExtraOptionRequirement(requirementSpec, string, extraOptionReader) {\n var main = null;\n var extra = {};\n for (var key in requirementSpec) {\n if (key) {\n var value = extraOptionReader(key);\n if ('string' === typeof value) value = Utils.parseRequirement(requirementSpec[key], value);\n extra[key] = value;\n } else {\n main = Utils.parseRequirement(requirementSpec[key], string);\n }\n }\n return [main, extra];\n };\n\n // A Validator needs to implement the methods `validate` and `parseRequirements`\n\n var Validator = function Validator(spec) {\n $.extend(true, this, spec);\n };\n\n Validator.prototype = {\n // Returns `true` iff the given `value` is valid according the given requirements.\n validate: function validate(value, requirementFirstArg) {\n if (this.fn) {\n // Legacy style validator\n\n if (arguments.length > 3) // If more args then value, requirement, instance...\n requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest\n return this.fn(value, requirementFirstArg);\n }\n\n if (Array.isArray(value)) {\n if (!this.validateMultiple) throw 'Validator `' + this.name + '` does not handle multiple values';\n return this.validateMultiple.apply(this, arguments);\n } else {\n var instance = arguments[arguments.length - 1];\n if (this.validateDate && instance._isDateInput()) {\n arguments[0] = Utils.parse.date(arguments[0]);\n if (arguments[0] === null) return false;\n return this.validateDate.apply(this, arguments);\n }\n if (this.validateNumber) {\n if (isNaN(value)) return false;\n arguments[0] = parseFloat(arguments[0]);\n return this.validateNumber.apply(this, arguments);\n }\n if (this.validateString) {\n return this.validateString.apply(this, arguments);\n }\n throw 'Validator `' + this.name + '` only handles multiple values';\n }\n },\n\n // Parses `requirements` into an array of arguments,\n // according to `this.requirementType`\n parseRequirements: function parseRequirements(requirements, extraOptionReader) {\n if ('string' !== typeof requirements) {\n // Assume requirement already parsed\n // but make sure we return an array\n return Array.isArray(requirements) ? requirements : [requirements];\n }\n var type = this.requirementType;\n if (Array.isArray(type)) {\n var values = convertArrayRequirement(requirements, type.length);\n for (var i = 0; i < values.length; i++) values[i] = Utils.parseRequirement(type[i], values[i]);\n return values;\n } else if ($.isPlainObject(type)) {\n return convertExtraOptionRequirement(type, requirements, extraOptionReader);\n } else {\n return [Utils.parseRequirement(type, requirements)];\n }\n },\n // Defaults:\n requirementType: 'string',\n\n priority: 2\n\n };\n\n var ValidatorRegistry = function ValidatorRegistry(validators, catalog) {\n this.__class__ = 'ValidatorRegistry';\n\n // Default Parsley locale is en\n this.locale = 'en';\n\n this.init(validators || {}, catalog || {});\n };\n\n var typeTesters = {\n email: /^((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/,\n\n // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers\n number: /^-?(\\d*\\.)?\\d+(e[-+]?\\d+)?$/i,\n\n integer: /^-?\\d+$/,\n\n digits: /^\\d+$/,\n\n alphanum: /^\\w+$/i,\n\n date: {\n test: function test(value) {\n return Utils.parse.date(value) !== null;\n }\n },\n\n url: new RegExp(\"^\" +\n // protocol identifier\n \"(?:(?:https?|ftp)://)?\" + // ** mod: make scheme optional\n // user:pass authentication\n \"(?:\\\\S+(?::\\\\S*)?@)?\" + \"(?:\" +\n // IP address exclusion\n // private & local networks\n // \"(?!(?:10|127)(?:\\\\.\\\\d{1,3}){3})\" + // ** mod: allow local networks\n // \"(?!(?:169\\\\.254|192\\\\.168)(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // \"(?!172\\\\.(?:1[6-9]|2\\\\d|3[0-1])(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // IP address dotted notation octets\n // excludes loopback network 0.0.0.0\n // excludes reserved space >= 224.0.0.0\n // excludes network & broacast addresses\n // (first & last IP address of each class)\n \"(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])\" + \"(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}\" + \"(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))\" + \"|\" +\n // host name\n '(?:(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)' +\n // domain name\n '(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)*' +\n // TLD identifier\n '(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff]{2,}))' + \")\" +\n // port number\n \"(?::\\\\d{2,5})?\" +\n // resource path\n \"(?:/\\\\S*)?\" + \"$\")\n };\n typeTesters.range = typeTesters.number;\n\n // See http://stackoverflow.com/a/10454560/8279\n var decimalPlaces = function decimalPlaces(num) {\n var match = ('' + num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n if (!match) {\n return 0;\n }\n return Math.max(0,\n // Number of digits right of decimal point.\n (match[1] ? match[1].length : 0) - (\n // Adjust for scientific notation.\n match[2] ? +match[2] : 0));\n };\n\n // parseArguments('number', ['1', '2']) => [1, 2]\n var ValidatorRegistry__parseArguments = function ValidatorRegistry__parseArguments(type, args) {\n return args.map(Utils.parse[type]);\n };\n // operatorToValidator returns a validating function for an operator function, applied to the given type\n var ValidatorRegistry__operatorToValidator = function ValidatorRegistry__operatorToValidator(type, operator) {\n return function (value) {\n for (var _len = arguments.length, requirementsAndInput = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n requirementsAndInput[_key - 1] = arguments[_key];\n }\n\n requirementsAndInput.pop(); // Get rid of `input` argument\n return operator.apply(undefined, [value].concat(_toConsumableArray(ValidatorRegistry__parseArguments(type, requirementsAndInput))));\n };\n };\n\n var ValidatorRegistry__comparisonOperator = function ValidatorRegistry__comparisonOperator(operator) {\n return {\n validateDate: ValidatorRegistry__operatorToValidator('date', operator),\n validateNumber: ValidatorRegistry__operatorToValidator('number', operator),\n requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s)\n priority: 30\n };\n };\n\n ValidatorRegistry.prototype = {\n init: function init(validators, catalog) {\n this.catalog = catalog;\n // Copy prototype's validators:\n this.validators = _extends({}, this.validators);\n\n for (var name in validators) this.addValidator(name, validators[name].fn, validators[name].priority);\n\n window.Parsley.trigger('parsley:validator:init');\n },\n\n // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n\n setLocale: function setLocale(locale) {\n if ('undefined' === typeof this.catalog[locale]) throw new Error(locale + ' is not available in the catalog');\n\n this.locale = locale;\n\n return this;\n },\n\n // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true`\n addCatalog: function addCatalog(locale, messages, set) {\n if ('object' === typeof messages) this.catalog[locale] = messages;\n\n if (true === set) return this.setLocale(locale);\n\n return this;\n },\n\n // Add a specific message for a given constraint in a given locale\n addMessage: function addMessage(locale, name, message) {\n if ('undefined' === typeof this.catalog[locale]) this.catalog[locale] = {};\n\n this.catalog[locale][name] = message;\n\n return this;\n },\n\n // Add messages for a given locale\n addMessages: function addMessages(locale, nameMessageObject) {\n for (var name in nameMessageObject) this.addMessage(locale, name, nameMessageObject[name]);\n\n return this;\n },\n\n // Add a new validator\n //\n // addValidator('custom', {\n // requirementType: ['integer', 'integer'],\n // validateString: function(value, from, to) {},\n // priority: 22,\n // messages: {\n // en: \"Hey, that's no good\",\n // fr: \"Aye aye, pas bon du tout\",\n // }\n // })\n //\n // Old API was addValidator(name, function, priority)\n //\n addValidator: function addValidator(name, arg1, arg2) {\n if (this.validators[name]) Utils.warn('Validator \"' + name + '\" is already defined.');else if (Defaults.hasOwnProperty(name)) {\n Utils.warn('\"' + name + '\" is a restricted keyword and is not a valid validator name.');\n return;\n }\n return this._setValidator.apply(this, arguments);\n },\n\n hasValidator: function hasValidator(name) {\n return !!this.validators[name];\n },\n\n updateValidator: function updateValidator(name, arg1, arg2) {\n if (!this.validators[name]) {\n Utils.warn('Validator \"' + name + '\" is not already defined.');\n return this.addValidator.apply(this, arguments);\n }\n return this._setValidator.apply(this, arguments);\n },\n\n removeValidator: function removeValidator(name) {\n if (!this.validators[name]) Utils.warn('Validator \"' + name + '\" is not defined.');\n\n delete this.validators[name];\n\n return this;\n },\n\n _setValidator: function _setValidator(name, validator, priority) {\n if ('object' !== typeof validator) {\n // Old style validator, with `fn` and `priority`\n validator = {\n fn: validator,\n priority: priority\n };\n }\n if (!validator.validate) {\n validator = new Validator(validator);\n }\n this.validators[name] = validator;\n\n for (var locale in validator.messages || {}) this.addMessage(locale, name, validator.messages[locale]);\n\n return this;\n },\n\n getErrorMessage: function getErrorMessage(constraint) {\n var message;\n\n // Type constraints are a bit different, we have to match their requirements too to find right error message\n if ('type' === constraint.name) {\n var typeMessages = this.catalog[this.locale][constraint.name] || {};\n message = typeMessages[constraint.requirements];\n } else message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements);\n\n return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage;\n },\n\n // Kind of light `sprintf()` implementation\n formatMessage: function formatMessage(string, parameters) {\n if ('object' === typeof parameters) {\n for (var i in parameters) string = this.formatMessage(string, parameters[i]);\n\n return string;\n }\n\n return 'string' === typeof string ? string.replace(/%s/i, parameters) : '';\n },\n\n // Here is the Parsley default validators list.\n // A validator is an object with the following key values:\n // - priority: an integer\n // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these\n // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise\n // Alternatively, a validator can be a function that returns such an object\n //\n validators: {\n notblank: {\n validateString: function validateString(value) {\n return (/\\S/.test(value)\n );\n },\n priority: 2\n },\n required: {\n validateMultiple: function validateMultiple(values) {\n return values.length > 0;\n },\n validateString: function validateString(value) {\n return (/\\S/.test(value)\n );\n },\n priority: 512\n },\n type: {\n validateString: function validateString(value, type) {\n var _ref = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];\n\n var _ref$step = _ref.step;\n var step = _ref$step === undefined ? 'any' : _ref$step;\n var _ref$base = _ref.base;\n var base = _ref$base === undefined ? 0 : _ref$base;\n\n var tester = typeTesters[type];\n if (!tester) {\n throw new Error('validator type `' + type + '` is not supported');\n }\n if (!tester.test(value)) return false;\n if ('number' === type) {\n if (!/^any$/i.test(step || '')) {\n var nb = Number(value);\n var decimals = Math.max(decimalPlaces(step), decimalPlaces(base));\n if (decimalPlaces(nb) > decimals) // Value can't have too many decimals\n return false;\n // Be careful of rounding errors by using integers.\n var toInt = function toInt(f) {\n return Math.round(f * Math.pow(10, decimals));\n };\n if ((toInt(nb) - toInt(base)) % toInt(step) != 0) return false;\n }\n }\n return true;\n },\n requirementType: {\n '': 'string',\n step: 'string',\n base: 'number'\n },\n priority: 256\n },\n pattern: {\n validateString: function validateString(value, regexp) {\n return regexp.test(value);\n },\n requirementType: 'regexp',\n priority: 64\n },\n minlength: {\n validateString: function validateString(value, requirement) {\n return value.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxlength: {\n validateString: function validateString(value, requirement) {\n return value.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n length: {\n validateString: function validateString(value, min, max) {\n return value.length >= min && value.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n mincheck: {\n validateMultiple: function validateMultiple(values, requirement) {\n return values.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxcheck: {\n validateMultiple: function validateMultiple(values, requirement) {\n return values.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n check: {\n validateMultiple: function validateMultiple(values, min, max) {\n return values.length >= min && values.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n min: ValidatorRegistry__comparisonOperator(function (value, requirement) {\n return value >= requirement;\n }),\n max: ValidatorRegistry__comparisonOperator(function (value, requirement) {\n return value <= requirement;\n }),\n range: ValidatorRegistry__comparisonOperator(function (value, min, max) {\n return value >= min && value <= max;\n }),\n equalto: {\n validateString: function validateString(value, refOrValue) {\n var $reference = $(refOrValue);\n if ($reference.length) return value === $reference.val();else return value === refOrValue;\n },\n priority: 256\n }\n }\n };\n\n var UI = {};\n\n var diffResults = function diffResults(newResult, oldResult, deep) {\n var added = [];\n var kept = [];\n\n for (var i = 0; i < newResult.length; i++) {\n var found = false;\n\n for (var j = 0; j < oldResult.length; j++) if (newResult[i].assert.name === oldResult[j].assert.name) {\n found = true;\n break;\n }\n\n if (found) kept.push(newResult[i]);else added.push(newResult[i]);\n }\n\n return {\n kept: kept,\n added: added,\n removed: !deep ? diffResults(oldResult, newResult, true).added : []\n };\n };\n\n UI.Form = {\n\n _actualizeTriggers: function _actualizeTriggers() {\n var _this2 = this;\n\n this.$element.on('submit.Parsley', function (evt) {\n _this2.onSubmitValidate(evt);\n });\n this.$element.on('click.Parsley', Utils._SubmitSelector, function (evt) {\n _this2.onSubmitButton(evt);\n });\n\n // UI could be disabled\n if (false === this.options.uiEnabled) return;\n\n this.element.setAttribute('novalidate', '');\n },\n\n focus: function focus() {\n this._focusedField = null;\n\n if (true === this.validationResult || 'none' === this.options.focus) return null;\n\n for (var i = 0; i < this.fields.length; i++) {\n var field = this.fields[i];\n if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) {\n this._focusedField = field.$element;\n if ('first' === this.options.focus) break;\n }\n }\n\n if (null === this._focusedField) return null;\n\n return this._focusedField.focus();\n },\n\n _destroyUI: function _destroyUI() {\n // Reset all event listeners\n this.$element.off('.Parsley');\n }\n\n };\n\n UI.Field = {\n\n _reflowUI: function _reflowUI() {\n this._buildUI();\n\n // If this field doesn't have an active UI don't bother doing something\n if (!this._ui) return;\n\n // Diff between two validation results\n var diff = diffResults(this.validationResult, this._ui.lastValidationResult);\n\n // Then store current validation result for next reflow\n this._ui.lastValidationResult = this.validationResult;\n\n // Handle valid / invalid / none field class\n this._manageStatusClass();\n\n // Add, remove, updated errors messages\n this._manageErrorsMessages(diff);\n\n // Triggers impl\n this._actualizeTriggers();\n\n // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user\n if ((diff.kept.length || diff.added.length) && !this._failedOnce) {\n this._failedOnce = true;\n this._actualizeTriggers();\n }\n },\n\n // Returns an array of field's error message(s)\n getErrorsMessages: function getErrorsMessages() {\n // No error message, field is valid\n if (true === this.validationResult) return [];\n\n var messages = [];\n\n for (var i = 0; i < this.validationResult.length; i++) messages.push(this.validationResult[i].errorMessage || this._getErrorMessage(this.validationResult[i].assert));\n\n return messages;\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n addError: function addError(name) {\n var _ref2 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n var message = _ref2.message;\n var assert = _ref2.assert;\n var _ref2$updateClass = _ref2.updateClass;\n var updateClass = _ref2$updateClass === undefined ? true : _ref2$updateClass;\n\n this._buildUI();\n this._addError(name, { message: message, assert: assert });\n\n if (updateClass) this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n updateError: function updateError(name) {\n var _ref3 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n var message = _ref3.message;\n var assert = _ref3.assert;\n var _ref3$updateClass = _ref3.updateClass;\n var updateClass = _ref3$updateClass === undefined ? true : _ref3$updateClass;\n\n this._buildUI();\n this._updateError(name, { message: message, assert: assert });\n\n if (updateClass) this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n removeError: function removeError(name) {\n var _ref4 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n var _ref4$updateClass = _ref4.updateClass;\n var updateClass = _ref4$updateClass === undefined ? true : _ref4$updateClass;\n\n this._buildUI();\n this._removeError(name);\n\n // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult\n // but highly improbable cuz' manually removing a well Parsley handled error makes no sense.\n if (updateClass) this._manageStatusClass();\n },\n\n _manageStatusClass: function _manageStatusClass() {\n if (this.hasConstraints() && this.needsValidation() && true === this.validationResult) this._successClass();else if (this.validationResult.length > 0) this._errorClass();else this._resetClass();\n },\n\n _manageErrorsMessages: function _manageErrorsMessages(diff) {\n if ('undefined' !== typeof this.options.errorsMessagesDisabled) return;\n\n // Case where we have errorMessage option that configure an unique field error message, regardless failing validators\n if ('undefined' !== typeof this.options.errorMessage) {\n if (diff.added.length || diff.kept.length) {\n this._insertErrorWrapper();\n\n if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length) this._ui.$errorsWrapper.append($(this.options.errorTemplate).addClass('parsley-custom-error-message'));\n\n return this._ui.$errorsWrapper.addClass('filled').find('.parsley-custom-error-message').html(this.options.errorMessage);\n }\n\n return this._ui.$errorsWrapper.removeClass('filled').find('.parsley-custom-error-message').remove();\n }\n\n // Show, hide, update failing constraints messages\n for (var i = 0; i < diff.removed.length; i++) this._removeError(diff.removed[i].assert.name);\n\n for (i = 0; i < diff.added.length; i++) this._addError(diff.added[i].assert.name, { message: diff.added[i].errorMessage, assert: diff.added[i].assert });\n\n for (i = 0; i < diff.kept.length; i++) this._updateError(diff.kept[i].assert.name, { message: diff.kept[i].errorMessage, assert: diff.kept[i].assert });\n },\n\n _addError: function _addError(name, _ref5) {\n var message = _ref5.message;\n var assert = _ref5.assert;\n\n this._insertErrorWrapper();\n this._ui.$errorClassHandler.attr('aria-describedby', this._ui.errorsWrapperId);\n this._ui.$errorsWrapper.addClass('filled').append($(this.options.errorTemplate).addClass('parsley-' + name).html(message || this._getErrorMessage(assert)));\n },\n\n _updateError: function _updateError(name, _ref6) {\n var message = _ref6.message;\n var assert = _ref6.assert;\n\n this._ui.$errorsWrapper.addClass('filled').find('.parsley-' + name).html(message || this._getErrorMessage(assert));\n },\n\n _removeError: function _removeError(name) {\n this._ui.$errorClassHandler.removeAttr('aria-describedby');\n this._ui.$errorsWrapper.removeClass('filled').find('.parsley-' + name).remove();\n },\n\n _getErrorMessage: function _getErrorMessage(constraint) {\n var customConstraintErrorMessage = constraint.name + 'Message';\n\n if ('undefined' !== typeof this.options[customConstraintErrorMessage]) return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements);\n\n return window.Parsley.getErrorMessage(constraint);\n },\n\n _buildUI: function _buildUI() {\n // UI could be already built or disabled\n if (this._ui || false === this.options.uiEnabled) return;\n\n var _ui = {};\n\n // Give field its Parsley id in DOM\n this.element.setAttribute(this.options.namespace + 'id', this.__id__);\n\n /** Generate important UI elements and store them in this **/\n // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes\n _ui.$errorClassHandler = this._manageClassHandler();\n\n // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer\n _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__);\n _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId);\n\n // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly\n _ui.lastValidationResult = [];\n _ui.validationInformationVisible = false;\n\n // Store it in this for later\n this._ui = _ui;\n },\n\n // Determine which element will have `parsley-error` and `parsley-success` classes\n _manageClassHandler: function _manageClassHandler() {\n // Class handled could also be determined by function given in Parsley options\n if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length) return $(this.options.classHandler);\n\n // Class handled could also be determined by function given in Parsley options\n var $handlerFunction = this.options.classHandler;\n\n // It might also be the function name of a global function\n if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler]) $handlerFunction = window[this.options.classHandler];\n\n if ('function' === typeof $handlerFunction) {\n var $handler = $handlerFunction.call(this, this);\n\n // If this function returned a valid existing DOM element, go for it\n if ('undefined' !== typeof $handler && $handler.length) return $handler;\n } else if ('object' === typeof $handlerFunction && $handlerFunction instanceof jQuery && $handlerFunction.length) {\n return $handlerFunction;\n } else if ($handlerFunction) {\n Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function');\n }\n\n return this._inputHolder();\n },\n\n _inputHolder: function _inputHolder() {\n // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container\n if (!this.options.multiple || this.element.nodeName === 'SELECT') return this.$element;\n\n // But if multiple element (radio, checkbox), that would be their parent\n return this.$element.parent();\n },\n\n _insertErrorWrapper: function _insertErrorWrapper() {\n var $errorsContainer = this.options.errorsContainer;\n\n // Nothing to do if already inserted\n if (0 !== this._ui.$errorsWrapper.parent().length) return this._ui.$errorsWrapper.parent();\n\n if ('string' === typeof $errorsContainer) {\n if ($($errorsContainer).length) return $($errorsContainer).append(this._ui.$errorsWrapper);else if ('function' === typeof window[$errorsContainer]) $errorsContainer = window[$errorsContainer];else Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function');\n }\n\n if ('function' === typeof $errorsContainer) $errorsContainer = $errorsContainer.call(this, this);\n\n if ('object' === typeof $errorsContainer && $errorsContainer.length) return $errorsContainer.append(this._ui.$errorsWrapper);\n\n return this._inputHolder().after(this._ui.$errorsWrapper);\n },\n\n _actualizeTriggers: function _actualizeTriggers() {\n var _this3 = this;\n\n var $toBind = this._findRelated();\n var trigger;\n\n // Remove Parsley events already bound on this field\n $toBind.off('.Parsley');\n if (this._failedOnce) $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), function () {\n _this3._validateIfNeeded();\n });else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) {\n $toBind.on(trigger, function (event) {\n _this3._validateIfNeeded(event);\n });\n }\n },\n\n _validateIfNeeded: function _validateIfNeeded(event) {\n var _this4 = this;\n\n // For keyup, keypress, keydown, input... events that could be a little bit obstrusive\n // do not validate if val length < min threshold on first validation. Once field have been validated once and info\n // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.\n if (event && /key|input/.test(event.type)) if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold) return;\n\n if (this.options.debounce) {\n window.clearTimeout(this._debounced);\n this._debounced = window.setTimeout(function () {\n return _this4.validate();\n }, this.options.debounce);\n } else this.validate();\n },\n\n _resetUI: function _resetUI() {\n // Reset all event listeners\n this._failedOnce = false;\n this._actualizeTriggers();\n\n // Nothing to do if UI never initialized for this field\n if ('undefined' === typeof this._ui) return;\n\n // Reset all errors' li\n this._ui.$errorsWrapper.removeClass('filled').children().remove();\n\n // Reset validation class\n this._resetClass();\n\n // Reset validation flags and last validation result\n this._ui.lastValidationResult = [];\n this._ui.validationInformationVisible = false;\n },\n\n _destroyUI: function _destroyUI() {\n this._resetUI();\n\n if ('undefined' !== typeof this._ui) this._ui.$errorsWrapper.remove();\n\n delete this._ui;\n },\n\n _successClass: function _successClass() {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass);\n },\n _errorClass: function _errorClass() {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass);\n },\n _resetClass: function _resetClass() {\n this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass);\n }\n };\n\n var Form = function Form(element, domOptions, options) {\n this.__class__ = 'Form';\n\n this.element = element;\n this.$element = $(element);\n this.domOptions = domOptions;\n this.options = options;\n this.parent = window.Parsley;\n\n this.fields = [];\n this.validationResult = null;\n };\n\n var Form__statusMapping = { pending: null, resolved: true, rejected: false };\n\n Form.prototype = {\n onSubmitValidate: function onSubmitValidate(event) {\n var _this5 = this;\n\n // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior\n if (true === event.parsley) return;\n\n // If we didn't come here through a submit button, use the first one in the form\n var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0];\n this._submitSource = null;\n this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true);\n if (submitSource && null !== submitSource.getAttribute('formnovalidate')) return;\n\n window.Parsley._remoteCache = {};\n\n var promise = this.whenValidate({ event: event });\n\n if ('resolved' === promise.state() && false !== this._trigger('submit')) {\n // All good, let event go through. We make this distinction because browsers\n // differ in their handling of `submit` being called from inside a submit event [#1047]\n } else {\n // Rejected or pending: cancel this submit\n event.stopImmediatePropagation();\n event.preventDefault();\n if ('pending' === promise.state()) promise.done(function () {\n _this5._submit(submitSource);\n });\n }\n },\n\n onSubmitButton: function onSubmitButton(event) {\n this._submitSource = event.currentTarget;\n },\n // internal\n // _submit submits the form, this time without going through the validations.\n // Care must be taken to \"fake\" the actual submit button being clicked.\n _submit: function _submit(submitSource) {\n if (false === this._trigger('submit')) return;\n // Add submit button's data\n if (submitSource) {\n var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false);\n if (0 === $synthetic.length) $synthetic = $('').appendTo(this.$element);\n $synthetic.attr({\n name: submitSource.getAttribute('name'),\n value: submitSource.getAttribute('value')\n });\n }\n\n this.$element.trigger(_extends($.Event('submit'), { parsley: true }));\n },\n\n // Performs validation on fields while triggering events.\n // @returns `true` if all validations succeeds, `false`\n // if a failure is immediately detected, or `null`\n // if dependant on a promise.\n // Consider using `whenValidate` instead.\n validate: function validate(options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.');\n\n var _arguments = _slice.call(arguments);\n\n var group = _arguments[0];\n var force = _arguments[1];\n var event = _arguments[2];\n\n options = { group: group, force: force, event: event };\n }\n return Form__statusMapping[this.whenValidate(options).state()];\n },\n\n whenValidate: function whenValidate() {\n var _Utils$all$done$fail$always,\n _this6 = this;\n\n var _ref7 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var group = _ref7.group;\n var force = _ref7.force;\n var event = _ref7.event;\n\n this.submitEvent = event;\n if (event) {\n this.submitEvent = _extends({}, event, { preventDefault: function preventDefault() {\n Utils.warnOnce(\"Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`\");\n _this6.validationResult = false;\n } });\n }\n this.validationResult = true;\n\n // fire validate event to eventually modify things before every validation\n this._trigger('validate');\n\n // Refresh form DOM options and form's fields that could have changed\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(function () {\n return $.map(_this6.fields, function (field) {\n return field.whenValidate({ force: force, group: group });\n });\n });\n\n return (_Utils$all$done$fail$always = Utils.all(promises).done(function () {\n _this6._trigger('success');\n }).fail(function () {\n _this6.validationResult = false;\n _this6.focus();\n _this6._trigger('error');\n }).always(function () {\n _this6._trigger('validated');\n })).pipe.apply(_Utils$all$done$fail$always, _toConsumableArray(this._pipeAccordingToValidationResult()));\n },\n\n // Iterate over refreshed fields, and stop on first failure.\n // Returns `true` if all fields are valid, `false` if a failure is detected\n // or `null` if the result depends on an unresolved promise.\n // Prefer using `whenValid` instead.\n isValid: function isValid(options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.');\n\n var _arguments2 = _slice.call(arguments);\n\n var group = _arguments2[0];\n var force = _arguments2[1];\n\n options = { group: group, force: force };\n }\n return Form__statusMapping[this.whenValid(options).state()];\n },\n\n // Iterate over refreshed fields and validate them.\n // Returns a promise.\n // A validation that immediately fails will interrupt the validations.\n whenValid: function whenValid() {\n var _this7 = this;\n\n var _ref8 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var group = _ref8.group;\n var force = _ref8.force;\n\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(function () {\n return $.map(_this7.fields, function (field) {\n return field.whenValid({ group: group, force: force });\n });\n });\n return Utils.all(promises);\n },\n\n refresh: function refresh() {\n this._refreshFields();\n return this;\n },\n\n // Reset UI\n reset: function reset() {\n // Form case: emit a reset event for each field\n for (var i = 0; i < this.fields.length; i++) this.fields[i].reset();\n\n this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function destroy() {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n\n // Form case: destroy all its fields and then destroy stored instance\n for (var i = 0; i < this.fields.length; i++) this.fields[i].destroy();\n\n this.$element.removeData('Parsley');\n this._trigger('destroy');\n },\n\n _refreshFields: function _refreshFields() {\n return this.actualizeOptions()._bindFields();\n },\n\n _bindFields: function _bindFields() {\n var _this8 = this;\n\n var oldFields = this.fields;\n\n this.fields = [];\n this.fieldsMappedById = {};\n\n this._withoutReactualizingFormOptions(function () {\n _this8.$element.find(_this8.options.inputs).not(_this8.options.excluded).each(function (_, element) {\n var fieldInstance = new window.Parsley.Factory(element, {}, _this8);\n\n // Only add valid and not excluded `Field` and `FieldMultiple` children\n if (('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) && true !== fieldInstance.options.excluded) {\n var uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__;\n if ('undefined' === typeof _this8.fieldsMappedById[uniqueId]) {\n _this8.fieldsMappedById[uniqueId] = fieldInstance;\n _this8.fields.push(fieldInstance);\n }\n }\n });\n\n $.each(Utils.difference(oldFields, _this8.fields), function (_, field) {\n field.reset();\n });\n });\n return this;\n },\n\n // Internal only.\n // Looping on a form's fields to do validation or similar\n // will trigger reactualizing options on all of them, which\n // in turn will reactualize the form's options.\n // To avoid calling actualizeOptions so many times on the form\n // for nothing, _withoutReactualizingFormOptions temporarily disables\n // the method actualizeOptions on this form while `fn` is called.\n _withoutReactualizingFormOptions: function _withoutReactualizingFormOptions(fn) {\n var oldActualizeOptions = this.actualizeOptions;\n this.actualizeOptions = function () {\n return this;\n };\n var result = fn();\n this.actualizeOptions = oldActualizeOptions;\n return result;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n // Returns true iff event is not interrupted and default not prevented.\n _trigger: function _trigger(eventName) {\n return this.trigger('form:' + eventName);\n }\n\n };\n\n var Constraint = function Constraint(parsleyField, name, requirements, priority, isDomConstraint) {\n var validatorSpec = window.Parsley._validatorRegistry.validators[name];\n var validator = new Validator(validatorSpec);\n priority = priority || parsleyField.options[name + 'Priority'] || validator.priority;\n isDomConstraint = true === isDomConstraint;\n\n _extends(this, {\n validator: validator,\n name: name,\n requirements: requirements,\n priority: priority,\n isDomConstraint: isDomConstraint\n });\n this._parseRequirements(parsleyField.options);\n };\n\n var capitalize = function capitalize(str) {\n var cap = str[0].toUpperCase();\n return cap + str.slice(1);\n };\n\n Constraint.prototype = {\n validate: function validate(value, instance) {\n var _validator;\n\n return (_validator = this.validator).validate.apply(_validator, [value].concat(_toConsumableArray(this.requirementList), [instance]));\n },\n\n _parseRequirements: function _parseRequirements(options) {\n var _this9 = this;\n\n this.requirementList = this.validator.parseRequirements(this.requirements, function (key) {\n return options[_this9.name + capitalize(key)];\n });\n }\n };\n\n var Field = function Field(field, domOptions, options, parsleyFormInstance) {\n this.__class__ = 'Field';\n\n this.element = field;\n this.$element = $(field);\n\n // Set parent if we have one\n if ('undefined' !== typeof parsleyFormInstance) {\n this.parent = parsleyFormInstance;\n }\n\n this.options = options;\n this.domOptions = domOptions;\n\n // Initialize some properties\n this.constraints = [];\n this.constraintsByName = {};\n this.validationResult = true;\n\n // Bind constraints\n this._bindConstraints();\n };\n\n var parsley_field__statusMapping = { pending: null, resolved: true, rejected: false };\n\n Field.prototype = {\n // # Public API\n // Validate field and trigger some events for mainly `UI`\n // @returns `true`, an array of the validators that failed, or\n // `null` if validation is not finished. Prefer using whenValidate\n validate: function validate(options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.');\n options = { options: options };\n }\n var promise = this.whenValidate(options);\n if (!promise) // If excluded with `group` option\n return true;\n switch (promise.state()) {\n case 'pending':\n return null;\n case 'resolved':\n return true;\n case 'rejected':\n return this.validationResult;\n }\n },\n\n // Validate field and trigger some events for mainly `UI`\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if field is not in the given `group`.\n whenValidate: function whenValidate() {\n var _whenValid$always$done$fail$always,\n _this10 = this;\n\n var _ref9 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var force = _ref9.force;\n var group = _ref9.group;\n\n // do not validate a field if not the same as given validation group\n this.refresh();\n if (group && !this._isInGroup(group)) return;\n\n this.value = this.getValue();\n\n // Field Validate event. `this.value` could be altered for custom needs\n this._trigger('validate');\n\n return (_whenValid$always$done$fail$always = this.whenValid({ force: force, value: this.value, _refreshed: true }).always(function () {\n _this10._reflowUI();\n }).done(function () {\n _this10._trigger('success');\n }).fail(function () {\n _this10._trigger('error');\n }).always(function () {\n _this10._trigger('validated');\n })).pipe.apply(_whenValid$always$done$fail$always, _toConsumableArray(this._pipeAccordingToValidationResult()));\n },\n\n hasConstraints: function hasConstraints() {\n return 0 !== this.constraints.length;\n },\n\n // An empty optional field does not need validation\n needsValidation: function needsValidation(value) {\n if ('undefined' === typeof value) value = this.getValue();\n\n // If a field is empty and not required, it is valid\n // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators\n if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty) return false;\n\n return true;\n },\n\n _isInGroup: function _isInGroup(group) {\n if (Array.isArray(this.options.group)) return -1 !== $.inArray(group, this.options.group);\n return this.options.group === group;\n },\n\n // Just validate field. Do not trigger any event.\n // Returns `true` iff all constraints pass, `false` if there are failures,\n // or `null` if the result can not be determined yet (depends on a promise)\n // See also `whenValid`.\n isValid: function isValid(options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.');\n\n var _arguments3 = _slice.call(arguments);\n\n var force = _arguments3[0];\n var value = _arguments3[1];\n\n options = { force: force, value: value };\n }\n var promise = this.whenValid(options);\n if (!promise) // Excluded via `group`\n return true;\n return parsley_field__statusMapping[promise.state()];\n },\n\n // Just validate field. Do not trigger any event.\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if the field is not in the given `group`.\n // The argument `force` will force validation of empty fields.\n // If a `value` is given, it will be validated instead of the value of the input.\n whenValid: function whenValid() {\n var _this11 = this;\n\n var _ref10 = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];\n\n var _ref10$force = _ref10.force;\n var force = _ref10$force === undefined ? false : _ref10$force;\n var value = _ref10.value;\n var group = _ref10.group;\n var _refreshed = _ref10._refreshed;\n\n // Recompute options and rebind constraints to have latest changes\n if (!_refreshed) this.refresh();\n // do not validate a field if not the same as given validation group\n if (group && !this._isInGroup(group)) return;\n\n this.validationResult = true;\n\n // A field without constraint is valid\n if (!this.hasConstraints()) return $.when();\n\n // Value could be passed as argument, needed to add more power to 'field:validate'\n if ('undefined' === typeof value || null === value) value = this.getValue();\n\n if (!this.needsValidation(value) && true !== force) return $.when();\n\n var groupedConstraints = this._getGroupedConstraints();\n var promises = [];\n $.each(groupedConstraints, function (_, constraints) {\n // Process one group of constraints at a time, we validate the constraints\n // and combine the promises together.\n var promise = Utils.all($.map(constraints, function (constraint) {\n return _this11._validateConstraint(value, constraint);\n }));\n promises.push(promise);\n if (promise.state() === 'rejected') return false; // Interrupt processing if a group has already failed\n });\n return Utils.all(promises);\n },\n\n // @returns a promise\n _validateConstraint: function _validateConstraint(value, constraint) {\n var _this12 = this;\n\n var result = constraint.validate(value, this);\n // Map false to a failed promise\n if (false === result) result = $.Deferred().reject();\n // Make sure we return a promise and that we record failures\n return Utils.all([result]).fail(function (errorMessage) {\n if (!(_this12.validationResult instanceof Array)) _this12.validationResult = [];\n _this12.validationResult.push({\n assert: constraint,\n errorMessage: 'string' === typeof errorMessage && errorMessage\n });\n });\n },\n\n // @returns Parsley field computed value that could be overrided or configured in DOM\n getValue: function getValue() {\n var value;\n\n // Value could be overriden in DOM or with explicit options\n if ('function' === typeof this.options.value) value = this.options.value(this);else if ('undefined' !== typeof this.options.value) value = this.options.value;else value = this.$element.val();\n\n // Handle wrong DOM or configurations\n if ('undefined' === typeof value || null === value) return '';\n\n return this._handleWhitespace(value);\n },\n\n // Reset UI\n reset: function reset() {\n this._resetUI();\n return this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function destroy() {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n this.$element.removeData('Parsley');\n this.$element.removeData('FieldMultiple');\n this._trigger('destroy');\n },\n\n // Actualize options and rebind constraints\n refresh: function refresh() {\n this._refreshConstraints();\n return this;\n },\n\n _refreshConstraints: function _refreshConstraints() {\n return this.actualizeOptions()._bindConstraints();\n },\n\n refreshConstraints: function refreshConstraints() {\n Utils.warnOnce(\"Parsley's refreshConstraints is deprecated. Please use refresh\");\n return this.refresh();\n },\n\n /**\n * Add a new constraint to a field\n *\n * @param {String} name\n * @param {Mixed} requirements optional\n * @param {Number} priority optional\n * @param {Boolean} isDomConstraint optional\n */\n addConstraint: function addConstraint(name, requirements, priority, isDomConstraint) {\n\n if (window.Parsley._validatorRegistry.validators[name]) {\n var constraint = new Constraint(this, name, requirements, priority, isDomConstraint);\n\n // if constraint already exist, delete it and push new version\n if ('undefined' !== this.constraintsByName[constraint.name]) this.removeConstraint(constraint.name);\n\n this.constraints.push(constraint);\n this.constraintsByName[constraint.name] = constraint;\n }\n\n return this;\n },\n\n // Remove a constraint\n removeConstraint: function removeConstraint(name) {\n for (var i = 0; i < this.constraints.length; i++) if (name === this.constraints[i].name) {\n this.constraints.splice(i, 1);\n break;\n }\n delete this.constraintsByName[name];\n return this;\n },\n\n // Update a constraint (Remove + re-add)\n updateConstraint: function updateConstraint(name, parameters, priority) {\n return this.removeConstraint(name).addConstraint(name, parameters, priority);\n },\n\n // # Internals\n\n // Internal only.\n // Bind constraints from config + options + DOM\n _bindConstraints: function _bindConstraints() {\n var constraints = [];\n var constraintsByName = {};\n\n // clean all existing DOM constraints to only keep javascript user constraints\n for (var i = 0; i < this.constraints.length; i++) if (false === this.constraints[i].isDomConstraint) {\n constraints.push(this.constraints[i]);\n constraintsByName[this.constraints[i].name] = this.constraints[i];\n }\n\n this.constraints = constraints;\n this.constraintsByName = constraintsByName;\n\n // then re-add Parsley DOM-API constraints\n for (var name in this.options) this.addConstraint(name, this.options[name], undefined, true);\n\n // finally, bind special HTML5 constraints\n return this._bindHtml5Constraints();\n },\n\n // Internal only.\n // Bind specific HTML5 constraints to be HTML5 compliant\n _bindHtml5Constraints: function _bindHtml5Constraints() {\n // html5 required\n if (null !== this.element.getAttribute('required')) this.addConstraint('required', true, undefined, true);\n\n // html5 pattern\n if (null !== this.element.getAttribute('pattern')) this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true);\n\n // range\n var min = this.element.getAttribute('min');\n var max = this.element.getAttribute('max');\n if (null !== min && null !== max) this.addConstraint('range', [min, max], undefined, true);\n\n // HTML5 min\n else if (null !== min) this.addConstraint('min', min, undefined, true);\n\n // HTML5 max\n else if (null !== max) this.addConstraint('max', max, undefined, true);\n\n // length\n if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength')) this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true);\n\n // HTML5 minlength\n else if (null !== this.element.getAttribute('minlength')) this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true);\n\n // HTML5 maxlength\n else if (null !== this.element.getAttribute('maxlength')) this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true);\n\n // html5 types\n var type = Utils.getType(this.element);\n\n // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise\n if ('number' === type) {\n return this.addConstraint('type', ['number', {\n step: this.element.getAttribute('step') || '1',\n base: min || this.element.getAttribute('value')\n }], undefined, true);\n // Regular other HTML5 supported types\n } else if (/^(email|url|range|date)$/i.test(type)) {\n return this.addConstraint('type', type, undefined, true);\n }\n return this;\n },\n\n // Internal only.\n // Field is required if have required constraint without `false` value\n _isRequired: function _isRequired() {\n if ('undefined' === typeof this.constraintsByName.required) return false;\n\n return false !== this.constraintsByName.required.requirements;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n _trigger: function _trigger(eventName) {\n return this.trigger('field:' + eventName);\n },\n\n // Internal only\n // Handles whitespace in a value\n // Use `data-parsley-whitespace=\"squish\"` to auto squish input value\n // Use `data-parsley-whitespace=\"trim\"` to auto trim input value\n _handleWhitespace: function _handleWhitespace(value) {\n if (true === this.options.trimValue) Utils.warnOnce('data-parsley-trim-value=\"true\" is deprecated, please use data-parsley-whitespace=\"trim\"');\n\n if ('squish' === this.options.whitespace) value = value.replace(/\\s{2,}/g, ' ');\n\n if ('trim' === this.options.whitespace || 'squish' === this.options.whitespace || true === this.options.trimValue) value = Utils.trimString(value);\n\n return value;\n },\n\n _isDateInput: function _isDateInput() {\n var c = this.constraintsByName.type;\n return c && c.requirements === 'date';\n },\n\n // Internal only.\n // Returns the constraints, grouped by descending priority.\n // The result is thus an array of arrays of constraints.\n _getGroupedConstraints: function _getGroupedConstraints() {\n if (false === this.options.priorityEnabled) return [this.constraints];\n\n var groupedConstraints = [];\n var index = {};\n\n // Create array unique of priorities\n for (var i = 0; i < this.constraints.length; i++) {\n var p = this.constraints[i].priority;\n if (!index[p]) groupedConstraints.push(index[p] = []);\n index[p].push(this.constraints[i]);\n }\n // Sort them by priority DESC\n groupedConstraints.sort(function (a, b) {\n return b[0].priority - a[0].priority;\n });\n\n return groupedConstraints;\n }\n\n };\n\n var parsley_field = Field;\n\n var Multiple = function Multiple() {\n this.__class__ = 'FieldMultiple';\n };\n\n Multiple.prototype = {\n // Add new `$element` sibling for multiple field\n addElement: function addElement($element) {\n this.$elements.push($element);\n\n return this;\n },\n\n // See `Field._refreshConstraints()`\n _refreshConstraints: function _refreshConstraints() {\n var fieldConstraints;\n\n this.constraints = [];\n\n // Select multiple special treatment\n if (this.element.nodeName === 'SELECT') {\n this.actualizeOptions()._bindConstraints();\n\n return this;\n }\n\n // Gather all constraints for each input in the multiple group\n for (var i = 0; i < this.$elements.length; i++) {\n\n // Check if element have not been dynamically removed since last binding\n if (!$('html').has(this.$elements[i]).length) {\n this.$elements.splice(i, 1);\n continue;\n }\n\n fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints;\n\n for (var j = 0; j < fieldConstraints.length; j++) this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint);\n }\n\n return this;\n },\n\n // See `Field.getValue()`\n getValue: function getValue() {\n // Value could be overriden in DOM\n if ('function' === typeof this.options.value) return this.options.value(this);else if ('undefined' !== typeof this.options.value) return this.options.value;\n\n // Radio input case\n if (this.element.nodeName === 'INPUT') {\n var type = Utils.getType(this.element);\n if (type === 'radio') return this._findRelated().filter(':checked').val() || '';\n\n // checkbox input case\n if (type === 'checkbox') {\n var values = [];\n\n this._findRelated().filter(':checked').each(function () {\n values.push($(this).val());\n });\n\n return values;\n }\n }\n\n // Select multiple case\n if (this.element.nodeName === 'SELECT' && null === this.$element.val()) return [];\n\n // Default case that should never happen\n return this.$element.val();\n },\n\n _init: function _init() {\n this.$elements = [this.$element];\n\n return this;\n }\n };\n\n var Factory = function Factory(element, options, parsleyFormInstance) {\n this.element = element;\n this.$element = $(element);\n\n // If the element has already been bound, returns its saved Parsley instance\n var savedparsleyFormInstance = this.$element.data('Parsley');\n if (savedparsleyFormInstance) {\n\n // If the saved instance has been bound without a Form parent and there is one given in this call, add it\n if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) {\n savedparsleyFormInstance.parent = parsleyFormInstance;\n savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);\n }\n\n if ('object' === typeof options) {\n _extends(savedparsleyFormInstance.options, options);\n }\n\n return savedparsleyFormInstance;\n }\n\n // Parsley must be instantiated with a DOM element or jQuery $element\n if (!this.$element.length) throw new Error('You must bind Parsley on an existing element.');\n\n if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__) throw new Error('Parent instance must be a Form instance');\n\n this.parent = parsleyFormInstance || window.Parsley;\n return this.init(options);\n };\n\n Factory.prototype = {\n init: function init(options) {\n this.__class__ = 'Parsley';\n this.__version__ = '2.8.1';\n this.__id__ = Utils.generateID();\n\n // Pre-compute options\n this._resetOptions(options);\n\n // A Form instance is obviously a `` element but also every node that is not an input and has the `data-parsley-validate` attribute\n if (this.element.nodeName === 'FORM' || Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)) return this.bind('parsleyForm');\n\n // Every other element is bound as a `Field` or `FieldMultiple`\n return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField');\n },\n\n isMultiple: function isMultiple() {\n var type = Utils.getType(this.element);\n return type === 'radio' || type === 'checkbox' || this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple');\n },\n\n // Multiples fields are a real nightmare :(\n // Maybe some refactoring would be appreciated here...\n handleMultiple: function handleMultiple() {\n var _this13 = this;\n\n var name;\n var multiple;\n var parsleyMultipleInstance;\n\n // Handle multiple name\n this.options.multiple = this.options.multiple || (name = this.element.getAttribute('name')) || this.element.getAttribute('id');\n\n // Special select multiple input\n if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) {\n this.options.multiple = this.options.multiple || this.__id__;\n return this.bind('parsleyFieldMultiple');\n\n // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it\n } else if (!this.options.multiple) {\n Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element);\n return this;\n }\n\n // Remove special chars\n this.options.multiple = this.options.multiple.replace(/(:|\\.|\\[|\\]|\\{|\\}|\\$)/g, '');\n\n // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name\n if (name) {\n $('input[name=\"' + name + '\"]').each(function (i, input) {\n var type = Utils.getType(input);\n if (type === 'radio' || type === 'checkbox') input.setAttribute(_this13.options.namespace + 'multiple', _this13.options.multiple);\n });\n }\n\n // Check here if we don't already have a related multiple instance saved\n var $previouslyRelated = this._findRelated();\n for (var i = 0; i < $previouslyRelated.length; i++) {\n parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley');\n if ('undefined' !== typeof parsleyMultipleInstance) {\n\n if (!this.$element.data('FieldMultiple')) {\n parsleyMultipleInstance.addElement(this.$element);\n }\n\n break;\n }\n }\n\n // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')`\n // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance\n this.bind('parsleyField', true);\n\n return parsleyMultipleInstance || this.bind('parsleyFieldMultiple');\n },\n\n // Return proper `Form`, `Field` or `FieldMultiple`\n bind: function bind(type, doNotStore) {\n var parsleyInstance;\n\n switch (type) {\n case 'parsleyForm':\n parsleyInstance = $.extend(new Form(this.element, this.domOptions, this.options), new Base(), window.ParsleyExtend)._bindFields();\n break;\n case 'parsleyField':\n parsleyInstance = $.extend(new parsley_field(this.element, this.domOptions, this.options, this.parent), new Base(), window.ParsleyExtend);\n break;\n case 'parsleyFieldMultiple':\n parsleyInstance = $.extend(new parsley_field(this.element, this.domOptions, this.options, this.parent), new Multiple(), new Base(), window.ParsleyExtend)._init();\n break;\n default:\n throw new Error(type + 'is not a supported Parsley type');\n }\n\n if (this.options.multiple) Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple);\n\n if ('undefined' !== typeof doNotStore) {\n this.$element.data('FieldMultiple', parsleyInstance);\n\n return parsleyInstance;\n }\n\n // Store the freshly bound instance in a DOM element for later access using jQuery `data()`\n this.$element.data('Parsley', parsleyInstance);\n\n // Tell the world we have a new Form or Field instance!\n parsleyInstance._actualizeTriggers();\n parsleyInstance._trigger('init');\n\n return parsleyInstance;\n }\n };\n\n var vernums = $.fn.jquery.split('.');\n if (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) {\n throw \"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.\";\n }\n if (!vernums.forEach) {\n Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim');\n }\n // Inherit `on`, `off` & `trigger` to Parsley:\n var Parsley = _extends(new Base(), {\n element: document,\n $element: $(document),\n actualizeOptions: null,\n _resetOptions: null,\n Factory: Factory,\n version: '2.8.1'\n });\n\n // Supplement Field and Form with Base\n // This way, the constructors will have access to those methods\n _extends(parsley_field.prototype, UI.Field, Base.prototype);\n _extends(Form.prototype, UI.Form, Base.prototype);\n // Inherit actualizeOptions and _resetOptions:\n _extends(Factory.prototype, Base.prototype);\n\n // ### jQuery API\n // `$('.elem').parsley(options)` or `$('.elem').psly(options)`\n $.fn.parsley = $.fn.psly = function (options) {\n if (this.length > 1) {\n var instances = [];\n\n this.each(function () {\n instances.push($(this).parsley(options));\n });\n\n return instances;\n }\n\n // Return undefined if applied to non existing DOM element\n if (this.length == 0) {\n return;\n }\n\n return new Factory(this[0], options);\n };\n\n // ### Field and Form extension\n // Ensure the extension is now defined if it wasn't previously\n if ('undefined' === typeof window.ParsleyExtend) window.ParsleyExtend = {};\n\n // ### Parsley config\n // Inherit from ParsleyDefault, and copy over any existing values\n Parsley.options = _extends(Utils.objectCreate(Defaults), window.ParsleyConfig);\n window.ParsleyConfig = Parsley.options; // Old way of accessing global options\n\n // ### Globals\n window.Parsley = window.psly = Parsley;\n Parsley.Utils = Utils;\n window.ParsleyUtils = {};\n $.each(Utils, function (key, value) {\n if ('function' === typeof value) {\n window.ParsleyUtils[key] = function () {\n Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.');\n return Utils[key].apply(Utils, arguments);\n };\n }\n });\n\n // ### Define methods that forward to the registry, and deprecate all access except through window.Parsley\n var registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n);\n window.ParsleyValidator = {};\n $.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) {\n window.Parsley[method] = function () {\n return registry[method].apply(registry, arguments);\n };\n window.ParsleyValidator[method] = function () {\n var _window$Parsley;\n\n Utils.warnOnce('Accessing the method \\'' + method + '\\' through Validator is deprecated. Simply call \\'window.Parsley.' + method + '(...)\\'');\n return (_window$Parsley = window.Parsley)[method].apply(_window$Parsley, arguments);\n };\n });\n\n // ### UI\n // Deprecated global object\n window.Parsley.UI = UI;\n window.ParsleyUI = {\n removeError: function removeError(instance, name, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce('Accessing UI is deprecated. Call \\'removeError\\' on the instance directly. Please comment in issue 1073 as to your need to call this method.');\n return instance.removeError(name, { updateClass: updateClass });\n },\n getErrorsMessages: function getErrorsMessages(instance) {\n Utils.warnOnce('Accessing UI is deprecated. Call \\'getErrorsMessages\\' on the instance directly.');\n return instance.getErrorsMessages();\n }\n };\n $.each('addError updateError'.split(' '), function (i, method) {\n window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce('Accessing UI is deprecated. Call \\'' + method + '\\' on the instance directly. Please comment in issue 1073 as to your need to call this method.');\n return instance[method](name, { message: message, assert: assert, updateClass: updateClass });\n };\n });\n\n // ### PARSLEY auto-binding\n // Prevent it by setting `ParsleyConfig.autoBind` to `false`\n if (false !== window.ParsleyConfig.autoBind) {\n $(function () {\n // Works only on `data-parsley-validate`.\n if ($('[data-parsley-validate]').length) $('[data-parsley-validate]').parsley();\n });\n }\n\n var o = $({});\n var deprecated = function deprecated() {\n Utils.warnOnce(\"Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley\");\n };\n\n // Returns an event handler that calls `fn` with the arguments it expects\n function adapt(fn, context) {\n // Store to allow unbinding\n if (!fn.parsleyAdaptedCallback) {\n fn.parsleyAdaptedCallback = function () {\n var args = Array.prototype.slice.call(arguments, 0);\n args.unshift(this);\n fn.apply(context || o, args);\n };\n }\n return fn.parsleyAdaptedCallback;\n }\n\n var eventPrefix = 'parsley:';\n // Converts 'parsley:form:validate' into 'form:validate'\n function eventName(name) {\n if (name.lastIndexOf(eventPrefix, 0) === 0) return name.substr(eventPrefix.length);\n return name;\n }\n\n // $.listen is deprecated. Use Parsley.on instead.\n $.listen = function (name, callback) {\n var context;\n deprecated();\n if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) {\n context = arguments[1];\n callback = arguments[2];\n }\n\n if ('function' !== typeof callback) throw new Error('Wrong parameters');\n\n window.Parsley.on(eventName(name), adapt(callback, context));\n };\n\n $.listenTo = function (instance, name, fn) {\n deprecated();\n if (!(instance instanceof parsley_field) && !(instance instanceof Form)) throw new Error('Must give Parsley instance');\n\n if ('string' !== typeof name || 'function' !== typeof fn) throw new Error('Wrong parameters');\n\n instance.on(eventName(name), adapt(fn));\n };\n\n $.unsubscribe = function (name, fn) {\n deprecated();\n if ('string' !== typeof name || 'function' !== typeof fn) throw new Error('Wrong arguments');\n window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback);\n };\n\n $.unsubscribeTo = function (instance, name) {\n deprecated();\n if (!(instance instanceof parsley_field) && !(instance instanceof Form)) throw new Error('Must give Parsley instance');\n instance.off(eventName(name));\n };\n\n $.unsubscribeAll = function (name) {\n deprecated();\n window.Parsley.off(eventName(name));\n $('form,input,textarea,select').each(function () {\n var instance = $(this).data('Parsley');\n if (instance) {\n instance.off(eventName(name));\n }\n });\n };\n\n // $.emit is deprecated. Use jQuery events instead.\n $.emit = function (name, instance) {\n var _instance;\n\n deprecated();\n var instanceGiven = instance instanceof parsley_field || instance instanceof Form;\n var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1);\n args.unshift(eventName(name));\n if (!instanceGiven) {\n instance = window.Parsley;\n }\n (_instance = instance).trigger.apply(_instance, _toConsumableArray(args));\n };\n\n var pubsub = {};\n\n $.extend(true, Parsley, {\n asyncValidators: {\n 'default': {\n fn: function fn(xhr) {\n // By default, only status 2xx are deemed successful.\n // Note: we use status instead of state() because responses with status 200\n // but invalid messages (e.g. an empty body for content type set to JSON) will\n // result in state() === 'rejected'.\n return xhr.status >= 200 && xhr.status < 300;\n },\n url: false\n },\n reverse: {\n fn: function fn(xhr) {\n // If reverse option is set, a failing ajax request is considered successful\n return xhr.status < 200 || xhr.status >= 300;\n },\n url: false\n }\n },\n\n addAsyncValidator: function addAsyncValidator(name, fn, url, options) {\n Parsley.asyncValidators[name] = {\n fn: fn,\n url: url || false,\n options: options || {}\n };\n\n return this;\n }\n\n });\n\n Parsley.addValidator('remote', {\n requirementType: {\n '': 'string',\n 'validator': 'string',\n 'reverse': 'boolean',\n 'options': 'object'\n },\n\n validateString: function validateString(value, url, options, instance) {\n var data = {};\n var ajaxOptions;\n var csr;\n var validator = options.validator || (true === options.reverse ? 'reverse' : 'default');\n\n if ('undefined' === typeof Parsley.asyncValidators[validator]) throw new Error('Calling an undefined async validator: `' + validator + '`');\n\n url = Parsley.asyncValidators[validator].url || url;\n\n // Fill current value\n if (url.indexOf('{value}') > -1) {\n url = url.replace('{value}', encodeURIComponent(value));\n } else {\n data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value;\n }\n\n // Merge options passed in from the function with the ones in the attribute\n var remoteOptions = $.extend(true, options.options || {}, Parsley.asyncValidators[validator].options);\n\n // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options`\n ajaxOptions = $.extend(true, {}, {\n url: url,\n data: data,\n type: 'GET'\n }, remoteOptions);\n\n // Generate store key based on ajax options\n instance.trigger('field:ajaxoptions', instance, ajaxOptions);\n\n csr = $.param(ajaxOptions);\n\n // Initialise querry cache\n if ('undefined' === typeof Parsley._remoteCache) Parsley._remoteCache = {};\n\n // Try to retrieve stored xhr\n var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions);\n\n var handleXhr = function handleXhr() {\n var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options);\n if (!result) // Map falsy results to rejected promise\n result = $.Deferred().reject();\n return $.when(result);\n };\n\n return xhr.then(handleXhr, handleXhr);\n },\n\n priority: -1\n });\n\n Parsley.on('form:submit', function () {\n Parsley._remoteCache = {};\n });\n\n Base.prototype.addAsyncValidator = function () {\n Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`');\n return Parsley.addAsyncValidator.apply(Parsley, arguments);\n };\n\n // This is included with the Parsley library itself,\n // thus there is no use in adding it to your project.\n Parsley.addMessages('en', {\n defaultMessage: \"This value seems to be invalid.\",\n type: {\n email: \"This value should be a valid email.\",\n url: \"This value should be a valid url.\",\n number: \"This value should be a valid number.\",\n integer: \"This value should be a valid integer.\",\n digits: \"This value should be digits.\",\n alphanum: \"This value should be alphanumeric.\"\n },\n notblank: \"This value should not be blank.\",\n required: \"This value is required.\",\n pattern: \"This value seems to be invalid.\",\n min: \"This value should be greater than or equal to %s.\",\n max: \"This value should be lower than or equal to %s.\",\n range: \"This value should be between %s and %s.\",\n minlength: \"This value is too short. It should have %s characters or more.\",\n maxlength: \"This value is too long. It should have %s characters or fewer.\",\n length: \"This value length is invalid. It should be between %s and %s characters long.\",\n mincheck: \"You must select at least %s choices.\",\n maxcheck: \"You must select %s choices or fewer.\",\n check: \"You must select between %s and %s choices.\",\n equalto: \"This value should be the same.\"\n });\n\n Parsley.setLocale('en');\n\n /**\n * inputevent - Alleviate browser bugs for input events\n * https://github.com/marcandre/inputevent\n * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm)\n * @author Marc-Andre Lafortune \n * @license MIT\n */\n\n function InputEvent() {\n var _this14 = this;\n\n var globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n _extends(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: function isNativeEvent(evt) {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: function fakeInputEvent(evt) {\n if (_this14.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: function misbehaves(evt) {\n if (_this14.isNativeEvent(evt)) {\n _this14.behavesOk(evt);\n $(document).on('change.inputevent', evt.data.selector, _this14.fakeInputEvent);\n _this14.fakeInputEvent(evt);\n }\n },\n\n behavesOk: function behavesOk(evt) {\n if (_this14.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, _this14.behavesOk).off('change.inputevent', evt.data.selector, _this14.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: function install() {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n var _arr = ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]'];\n for (var _i = 0; _i < _arr.length; _i++) {\n var selector = _arr[_i];\n $(document).on('input.inputevent', selector, { selector: selector }, _this14.behavesOk).on('change.inputevent', selector, { selector: selector }, _this14.misbehaves);\n }\n },\n\n uninstall: function uninstall() {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n };\n\n var inputevent = new InputEvent();\n\n inputevent.install();\n\n var parsley = Parsley;\n\n return parsley;\n});\n//# sourceMappingURL=parsley.js.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :\n typeof define === 'function' && define.amd ? define(['jquery'], factory) :\n global.parsley = factory(global.$)\n}(this, function ($) { 'use strict';\n\n var globalID = 1;\n var pastWarnings = {};\n\n var Utils = {\n // Parsley DOM-API\n // returns object from dom attributes and values\n attr: function (element, namespace, obj) {\n var i;\n var attribute;\n var attributes;\n var regex = new RegExp('^' + namespace, 'i');\n\n if ('undefined' === typeof obj)\n obj = {};\n else {\n // Clear all own properties. This won't affect prototype's values\n for (i in obj) {\n if (obj.hasOwnProperty(i))\n delete obj[i];\n }\n }\n\n if (!element)\n return obj;\n\n attributes = element.attributes;\n for (i = attributes.length; i--; ) {\n attribute = attributes[i];\n\n if (attribute && attribute.specified && regex.test(attribute.name)) {\n obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value);\n }\n }\n\n return obj;\n },\n\n checkAttr: function (element, namespace, checkAttr) {\n return element.hasAttribute(namespace + checkAttr);\n },\n\n setAttr: function (element, namespace, attr, value) {\n element.setAttribute(this.dasherize(namespace + attr), String(value));\n },\n\n getType: function(element) {\n return element.getAttribute('type') || 'text';\n },\n\n generateID: function () {\n return '' + globalID++;\n },\n\n /** Third party functions **/\n deserializeValue: function (value) {\n var num;\n\n try {\n return value ?\n value == \"true\" ||\n (value == \"false\" ? false :\n value == \"null\" ? null :\n !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? JSON.parse(value) :\n value)\n : value;\n } catch (e) { return value; }\n },\n\n // Zepto camelize function\n camelize: function (str) {\n return str.replace(/-+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n // Zepto dasherize function\n dasherize: function (str) {\n return str.replace(/::/g, '/')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .replace(/([a-z\\d])([A-Z])/g, '$1_$2')\n .replace(/_/g, '-')\n .toLowerCase();\n },\n\n warn: function () {\n if (window.console && 'function' === typeof window.console.warn)\n window.console.warn(...arguments);\n },\n\n warnOnce: function(msg) {\n if (!pastWarnings[msg]) {\n pastWarnings[msg] = true;\n this.warn(...arguments);\n }\n },\n\n _resetWarnings: function () {\n pastWarnings = {};\n },\n\n trimString: function(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n },\n\n parse: {\n date: function(string) {\n let parsed = string.match(/^(\\d{4,})-(\\d\\d)-(\\d\\d)$/);\n if (!parsed)\n return null;\n let [_, year, month, day] = parsed.map(x => parseInt(x, 10));\n let date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day)\n return null;\n return date;\n },\n string: function(string) {\n return string;\n },\n integer: function(string) {\n if (isNaN(string))\n return null;\n return parseInt(string, 10);\n },\n number: function(string) {\n if (isNaN(string))\n throw null;\n return parseFloat(string);\n },\n 'boolean': function _boolean(string) {\n return !(/^\\s*false\\s*$/i.test(string));\n },\n object: function(string) {\n return Utils.deserializeValue(string);\n },\n regexp: function(regexp) {\n var flags = '';\n\n // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern\n if (/^\\/.*\\/(?:[gimy]*)$/.test(regexp)) {\n // Replace the regexp literal string with the first match group: ([gimy]*)\n // If no flag is present, this will be a blank string\n flags = regexp.replace(/.*\\/([gimy]*)$/, '$1');\n // Again, replace the regexp literal string with the first match group:\n // everything excluding the opening and closing slashes and the flags\n regexp = regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');\n } else {\n // Anchor regexp:\n regexp = '^' + regexp + '$';\n }\n return new RegExp(regexp, flags);\n }\n },\n\n parseRequirement: function(requirementType, string) {\n var converter = this.parse[requirementType || 'string'];\n if (!converter)\n throw 'Unknown requirement specification: \"' + requirementType + '\"';\n let converted = converter(string);\n if (converted === null)\n throw `Requirement is not a ${requirementType}: \"${string}\"`;\n return converted;\n },\n\n namespaceEvents: function(events, namespace) {\n events = this.trimString(events || '').split(/\\s+/);\n if (!events[0])\n return '';\n return $.map(events, evt => `${evt}.${namespace}`).join(' ');\n },\n\n difference: function(array, remove) {\n // This is O(N^2), should be optimized\n let result = [];\n $.each(array, (_, elem) => {\n if (remove.indexOf(elem) == -1)\n result.push(elem);\n });\n return result;\n },\n\n // Alter-ego to native Promise.all, but for jQuery\n all: function(promises) {\n // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements\n return $.when(...promises, 42, 42);\n },\n\n // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill\n objectCreate: Object.create || (function () {\n var Object = function () {};\n return function (prototype) {\n if (arguments.length > 1) {\n throw Error('Second argument not supported');\n }\n if (typeof prototype != 'object') {\n throw TypeError('Argument must be an object');\n }\n Object.prototype = prototype;\n var result = new Object();\n Object.prototype = null;\n return result;\n };\n })(),\n\n _SubmitSelector: 'input[type=\"submit\"], button:submit'\n };\n\n // All these options could be overriden and specified directly in DOM using\n // `data-parsley-` default DOM-API\n // eg: `inputs` can be set in DOM using `data-parsley-inputs=\"input, textarea\"`\n // eg: `data-parsley-stop-on-first-failing-constraint=\"false\"`\n\n var Defaults = {\n // ### General\n\n // Default data-namespace for DOM API\n namespace: 'data-parsley-',\n\n // Supported inputs by default\n inputs: 'input, textarea, select',\n\n // Excluded inputs by default\n excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',\n\n // Stop validating field on highest priority failing constraint\n priorityEnabled: true,\n\n // ### Field only\n\n // identifier used to group together inputs (e.g. radio buttons...)\n multiple: null,\n\n // identifier (or array of identifiers) used to validate only a select group of inputs\n group: null,\n\n // ### UI\n // Enable\\Disable error messages\n uiEnabled: true,\n\n // Key events threshold before validation\n validationThreshold: 3,\n\n // Focused field on form validation error. 'first'|'last'|'none'\n focus: 'first',\n\n // event(s) that will trigger validation before first failure. eg: `input`...\n trigger: false,\n\n // event(s) that will trigger validation after first failure.\n triggerAfterFailure: 'input',\n\n // Class that would be added on every failing validation Parsley field\n errorClass: 'parsley-error',\n\n // Same for success validation\n successClass: 'parsley-success',\n\n // Return the `$element` that will receive these above success or error classes\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n classHandler: function (Field) {},\n\n // Return the `$element` where errors will be appended\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n errorsContainer: function (Field) {},\n\n // ul elem that would receive errors' list\n errorsWrapper: '
              ',\n\n // li elem that would receive error message\n errorTemplate: '
            • '\n };\n\n var Base = function () {\n this.__id__ = Utils.generateID();\n };\n\n Base.prototype = {\n asyncSupport: true, // Deprecated\n\n _pipeAccordingToValidationResult: function () {\n var pipe = () => {\n var r = $.Deferred();\n if (true !== this.validationResult)\n r.reject();\n return r.resolve().promise();\n };\n return [pipe, pipe];\n },\n\n actualizeOptions: function () {\n Utils.attr(this.element, this.options.namespace, this.domOptions);\n if (this.parent && this.parent.actualizeOptions)\n this.parent.actualizeOptions();\n return this;\n },\n\n _resetOptions: function (initOptions) {\n this.domOptions = Utils.objectCreate(this.parent.options);\n this.options = Utils.objectCreate(this.domOptions);\n // Shallow copy of ownProperties of initOptions:\n for (var i in initOptions) {\n if (initOptions.hasOwnProperty(i))\n this.options[i] = initOptions[i];\n }\n this.actualizeOptions();\n },\n\n _listeners: null,\n\n // Register a callback for the given event name\n // Callback is called with context as the first argument and the `this`\n // The context is the current parsley instance, or window.Parsley if global\n // A return value of `false` will interrupt the calls\n on: function (name, fn) {\n this._listeners = this._listeners || {};\n var queue = this._listeners[name] = this._listeners[name] || [];\n queue.push(fn);\n\n return this;\n },\n\n // Deprecated. Use `on` instead\n subscribe: function(name, fn) {\n $.listenTo(this, name.toLowerCase(), fn);\n },\n\n // Unregister a callback (or all if none is given) for the given event name\n off: function (name, fn) {\n var queue = this._listeners && this._listeners[name];\n if (queue) {\n if (!fn) {\n delete this._listeners[name];\n } else {\n for (var i = queue.length; i--; )\n if (queue[i] === fn)\n queue.splice(i, 1);\n }\n }\n return this;\n },\n\n // Deprecated. Use `off`\n unsubscribe: function(name, fn) {\n $.unsubscribeTo(this, name.toLowerCase());\n },\n\n // Trigger an event of the given name\n // A return value of `false` interrupts the callback chain\n // Returns false if execution was interrupted\n trigger: function (name, target, extraArg) {\n target = target || this;\n var queue = this._listeners && this._listeners[name];\n var result;\n var parentResult;\n if (queue) {\n for (var i = queue.length; i--; ) {\n result = queue[i].call(target, target, extraArg);\n if (result === false) return result;\n }\n }\n if (this.parent) {\n return this.parent.trigger(name, target, extraArg);\n }\n return true;\n },\n\n asyncIsValid: function (group, force) {\n Utils.warnOnce(\"asyncIsValid is deprecated; please use whenValid instead\");\n return this.whenValid({group, force});\n },\n\n _findRelated: function () {\n return this.options.multiple ?\n $(this.parent.element.querySelectorAll(`[${this.options.namespace}multiple=\"${this.options.multiple}\"]`))\n : this.$element;\n }\n };\n\n var convertArrayRequirement = function(string, length) {\n var m = string.match(/^\\s*\\[(.*)\\]\\s*$/);\n if (!m)\n throw 'Requirement is not an array: \"' + string + '\"';\n var values = m[1].split(',').map(Utils.trimString);\n if (values.length !== length)\n throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed';\n return values;\n };\n\n var convertExtraOptionRequirement = function(requirementSpec, string, extraOptionReader) {\n var main = null;\n var extra = {};\n for (var key in requirementSpec) {\n if (key) {\n var value = extraOptionReader(key);\n if ('string' === typeof value)\n value = Utils.parseRequirement(requirementSpec[key], value);\n extra[key] = value;\n } else {\n main = Utils.parseRequirement(requirementSpec[key], string);\n }\n }\n return [main, extra];\n };\n\n // A Validator needs to implement the methods `validate` and `parseRequirements`\n\n var Validator = function(spec) {\n $.extend(true, this, spec);\n };\n\n Validator.prototype = {\n // Returns `true` iff the given `value` is valid according the given requirements.\n validate: function(value, requirementFirstArg) {\n if (this.fn) { // Legacy style validator\n\n if (arguments.length > 3) // If more args then value, requirement, instance...\n requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest\n return this.fn(value, requirementFirstArg);\n }\n\n if (Array.isArray(value)) {\n if (!this.validateMultiple)\n throw 'Validator `' + this.name + '` does not handle multiple values';\n return this.validateMultiple(...arguments);\n } else {\n let instance = arguments[arguments.length - 1];\n if (this.validateDate && instance._isDateInput()) {\n arguments[0] = Utils.parse.date(arguments[0]);\n if (arguments[0] === null)\n return false;\n return this.validateDate(...arguments);\n }\n if (this.validateNumber) {\n if (isNaN(value))\n return false;\n arguments[0] = parseFloat(arguments[0]);\n return this.validateNumber(...arguments);\n }\n if (this.validateString) {\n return this.validateString(...arguments);\n }\n throw 'Validator `' + this.name + '` only handles multiple values';\n }\n },\n\n // Parses `requirements` into an array of arguments,\n // according to `this.requirementType`\n parseRequirements: function(requirements, extraOptionReader) {\n if ('string' !== typeof requirements) {\n // Assume requirement already parsed\n // but make sure we return an array\n return Array.isArray(requirements) ? requirements : [requirements];\n }\n var type = this.requirementType;\n if (Array.isArray(type)) {\n var values = convertArrayRequirement(requirements, type.length);\n for (var i = 0; i < values.length; i++)\n values[i] = Utils.parseRequirement(type[i], values[i]);\n return values;\n } else if ($.isPlainObject(type)) {\n return convertExtraOptionRequirement(type, requirements, extraOptionReader);\n } else {\n return [Utils.parseRequirement(type, requirements)];\n }\n },\n // Defaults:\n requirementType: 'string',\n\n priority: 2\n\n };\n\n var ValidatorRegistry = function (validators, catalog) {\n this.__class__ = 'ValidatorRegistry';\n\n // Default Parsley locale is en\n this.locale = 'en';\n\n this.init(validators || {}, catalog || {});\n };\n\n var typeTesters = {\n email: /^((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/,\n\n // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers\n number: /^-?(\\d*\\.)?\\d+(e[-+]?\\d+)?$/i,\n\n integer: /^-?\\d+$/,\n\n digits: /^\\d+$/,\n\n alphanum: /^\\w+$/i,\n\n date: {\n test: value => Utils.parse.date(value) !== null\n },\n\n url: new RegExp(\n \"^\" +\n // protocol identifier\n \"(?:(?:https?|ftp)://)?\" + // ** mod: make scheme optional\n // user:pass authentication\n \"(?:\\\\S+(?::\\\\S*)?@)?\" +\n \"(?:\" +\n // IP address exclusion\n // private & local networks\n // \"(?!(?:10|127)(?:\\\\.\\\\d{1,3}){3})\" + // ** mod: allow local networks\n // \"(?!(?:169\\\\.254|192\\\\.168)(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // \"(?!172\\\\.(?:1[6-9]|2\\\\d|3[0-1])(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // IP address dotted notation octets\n // excludes loopback network 0.0.0.0\n // excludes reserved space >= 224.0.0.0\n // excludes network & broacast addresses\n // (first & last IP address of each class)\n \"(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])\" +\n \"(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}\" +\n \"(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))\" +\n \"|\" +\n // host name\n \"(?:(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)\" +\n // domain name\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)*\" +\n // TLD identifier\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff]{2,}))\" +\n \")\" +\n // port number\n \"(?::\\\\d{2,5})?\" +\n // resource path\n \"(?:/\\\\S*)?\" +\n \"$\"\n )\n };\n typeTesters.range = typeTesters.number;\n\n // See http://stackoverflow.com/a/10454560/8279\n var decimalPlaces = num => {\n var match = ('' + num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n if (!match) { return 0; }\n return Math.max(\n 0,\n // Number of digits right of decimal point.\n (match[1] ? match[1].length : 0) -\n // Adjust for scientific notation.\n (match[2] ? +match[2] : 0));\n };\n\n // parseArguments('number', ['1', '2']) => [1, 2]\n let ValidatorRegistry__parseArguments = (type, args) => args.map(Utils.parse[type]);\n // operatorToValidator returns a validating function for an operator function, applied to the given type\n let ValidatorRegistry__operatorToValidator = (type, operator) => {\n return (value, ...requirementsAndInput) => {\n requirementsAndInput.pop(); // Get rid of `input` argument\n return operator(value, ...ValidatorRegistry__parseArguments(type, requirementsAndInput));\n };\n };\n\n let ValidatorRegistry__comparisonOperator = operator => ({\n validateDate: ValidatorRegistry__operatorToValidator('date', operator),\n validateNumber: ValidatorRegistry__operatorToValidator('number', operator),\n requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s)\n priority: 30\n });\n\n ValidatorRegistry.prototype = {\n init: function (validators, catalog) {\n this.catalog = catalog;\n // Copy prototype's validators:\n this.validators = Object.assign({}, this.validators);\n\n for (var name in validators)\n this.addValidator(name, validators[name].fn, validators[name].priority);\n\n window.Parsley.trigger('parsley:validator:init');\n },\n\n // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n\n setLocale: function (locale) {\n if ('undefined' === typeof this.catalog[locale])\n throw new Error(locale + ' is not available in the catalog');\n\n this.locale = locale;\n\n return this;\n },\n\n // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true`\n addCatalog: function (locale, messages, set) {\n if ('object' === typeof messages)\n this.catalog[locale] = messages;\n\n if (true === set)\n return this.setLocale(locale);\n\n return this;\n },\n\n // Add a specific message for a given constraint in a given locale\n addMessage: function (locale, name, message) {\n if ('undefined' === typeof this.catalog[locale])\n this.catalog[locale] = {};\n\n this.catalog[locale][name] = message;\n\n return this;\n },\n\n // Add messages for a given locale\n addMessages: function (locale, nameMessageObject) {\n for (var name in nameMessageObject)\n this.addMessage(locale, name, nameMessageObject[name]);\n\n return this;\n },\n\n // Add a new validator\n //\n // addValidator('custom', {\n // requirementType: ['integer', 'integer'],\n // validateString: function(value, from, to) {},\n // priority: 22,\n // messages: {\n // en: \"Hey, that's no good\",\n // fr: \"Aye aye, pas bon du tout\",\n // }\n // })\n //\n // Old API was addValidator(name, function, priority)\n //\n addValidator: function (name, arg1, arg2) {\n if (this.validators[name])\n Utils.warn('Validator \"' + name + '\" is already defined.');\n else if (Defaults.hasOwnProperty(name)) {\n Utils.warn('\"' + name + '\" is a restricted keyword and is not a valid validator name.');\n return;\n }\n return this._setValidator(...arguments);\n },\n\n hasValidator: function (name) {\n return !!this.validators[name];\n },\n\n updateValidator: function (name, arg1, arg2) {\n if (!this.validators[name]) {\n Utils.warn('Validator \"' + name + '\" is not already defined.');\n return this.addValidator(...arguments);\n }\n return this._setValidator(...arguments);\n },\n\n removeValidator: function (name) {\n if (!this.validators[name])\n Utils.warn('Validator \"' + name + '\" is not defined.');\n\n delete this.validators[name];\n\n return this;\n },\n\n _setValidator: function (name, validator, priority) {\n if ('object' !== typeof validator) {\n // Old style validator, with `fn` and `priority`\n validator = {\n fn: validator,\n priority: priority\n };\n }\n if (!validator.validate) {\n validator = new Validator(validator);\n }\n this.validators[name] = validator;\n\n for (var locale in validator.messages || {})\n this.addMessage(locale, name, validator.messages[locale]);\n\n return this;\n },\n\n getErrorMessage: function (constraint) {\n var message;\n\n // Type constraints are a bit different, we have to match their requirements too to find right error message\n if ('type' === constraint.name) {\n var typeMessages = this.catalog[this.locale][constraint.name] || {};\n message = typeMessages[constraint.requirements];\n } else\n message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements);\n\n return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage;\n },\n\n // Kind of light `sprintf()` implementation\n formatMessage: function (string, parameters) {\n if ('object' === typeof parameters) {\n for (var i in parameters)\n string = this.formatMessage(string, parameters[i]);\n\n return string;\n }\n\n return 'string' === typeof string ? string.replace(/%s/i, parameters) : '';\n },\n\n // Here is the Parsley default validators list.\n // A validator is an object with the following key values:\n // - priority: an integer\n // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these\n // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise\n // Alternatively, a validator can be a function that returns such an object\n //\n validators: {\n notblank: {\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 2\n },\n required: {\n validateMultiple: function(values) {\n return values.length > 0;\n },\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 512\n },\n type: {\n validateString: function(value, type, {step = 'any', base = 0} = {}) {\n var tester = typeTesters[type];\n if (!tester) {\n throw new Error('validator type `' + type + '` is not supported');\n }\n if (!tester.test(value))\n return false;\n if ('number' === type) {\n if (!/^any$/i.test(step || '')) {\n var nb = Number(value);\n var decimals = Math.max(decimalPlaces(step), decimalPlaces(base));\n if (decimalPlaces(nb) > decimals) // Value can't have too many decimals\n return false;\n // Be careful of rounding errors by using integers.\n var toInt = f => Math.round(f * Math.pow(10, decimals));\n if ((toInt(nb) - toInt(base)) % toInt(step) != 0)\n return false;\n }\n }\n return true;\n },\n requirementType: {\n '': 'string',\n step: 'string',\n base: 'number'\n },\n priority: 256\n },\n pattern: {\n validateString: function(value, regexp) {\n return regexp.test(value);\n },\n requirementType: 'regexp',\n priority: 64\n },\n minlength: {\n validateString: function (value, requirement) {\n return value.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxlength: {\n validateString: function (value, requirement) {\n return value.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n length: {\n validateString: function (value, min, max) {\n return value.length >= min && value.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n mincheck: {\n validateMultiple: function (values, requirement) {\n return values.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxcheck: {\n validateMultiple: function (values, requirement) {\n return values.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n check: {\n validateMultiple: function (values, min, max) {\n return values.length >= min && values.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n min: ValidatorRegistry__comparisonOperator((value, requirement) => value >= requirement),\n max: ValidatorRegistry__comparisonOperator((value, requirement) => value <= requirement),\n range: ValidatorRegistry__comparisonOperator((value, min, max) => value >= min && value <= max),\n equalto: {\n validateString: function (value, refOrValue) {\n var $reference = $(refOrValue);\n if ($reference.length)\n return value === $reference.val();\n else\n return value === refOrValue;\n },\n priority: 256\n }\n }\n };\n\n var UI = {};\n\n var diffResults = function (newResult, oldResult, deep) {\n var added = [];\n var kept = [];\n\n for (var i = 0; i < newResult.length; i++) {\n var found = false;\n\n for (var j = 0; j < oldResult.length; j++)\n if (newResult[i].assert.name === oldResult[j].assert.name) {\n found = true;\n break;\n }\n\n if (found)\n kept.push(newResult[i]);\n else\n added.push(newResult[i]);\n }\n\n return {\n kept: kept,\n added: added,\n removed: !deep ? diffResults(oldResult, newResult, true).added : []\n };\n };\n\n UI.Form = {\n\n _actualizeTriggers: function () {\n this.$element.on('submit.Parsley', evt => { this.onSubmitValidate(evt); });\n this.$element.on('click.Parsley', Utils._SubmitSelector, evt => { this.onSubmitButton(evt); });\n\n // UI could be disabled\n if (false === this.options.uiEnabled)\n return;\n\n this.element.setAttribute('novalidate', '');\n },\n\n focus: function () {\n this._focusedField = null;\n\n if (true === this.validationResult || 'none' === this.options.focus)\n return null;\n\n for (var i = 0; i < this.fields.length; i++) {\n var field = this.fields[i];\n if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) {\n this._focusedField = field.$element;\n if ('first' === this.options.focus)\n break;\n }\n }\n\n if (null === this._focusedField)\n return null;\n\n return this._focusedField.focus();\n },\n\n _destroyUI: function () {\n // Reset all event listeners\n this.$element.off('.Parsley');\n }\n\n };\n\n UI.Field = {\n\n _reflowUI: function () {\n this._buildUI();\n\n // If this field doesn't have an active UI don't bother doing something\n if (!this._ui)\n return;\n\n // Diff between two validation results\n var diff = diffResults(this.validationResult, this._ui.lastValidationResult);\n\n // Then store current validation result for next reflow\n this._ui.lastValidationResult = this.validationResult;\n\n // Handle valid / invalid / none field class\n this._manageStatusClass();\n\n // Add, remove, updated errors messages\n this._manageErrorsMessages(diff);\n\n // Triggers impl\n this._actualizeTriggers();\n\n // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user\n if ((diff.kept.length || diff.added.length) && !this._failedOnce) {\n this._failedOnce = true;\n this._actualizeTriggers();\n }\n },\n\n // Returns an array of field's error message(s)\n getErrorsMessages: function () {\n // No error message, field is valid\n if (true === this.validationResult)\n return [];\n\n var messages = [];\n\n for (var i = 0; i < this.validationResult.length; i++)\n messages.push(this.validationResult[i].errorMessage ||\n this._getErrorMessage(this.validationResult[i].assert));\n\n return messages;\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n addError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._addError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n updateError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._updateError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n removeError: function (name, {updateClass = true} = {}) {\n this._buildUI();\n this._removeError(name);\n\n // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult\n // but highly improbable cuz' manually removing a well Parsley handled error makes no sense.\n if (updateClass)\n this._manageStatusClass();\n },\n\n _manageStatusClass: function () {\n if (this.hasConstraints() && this.needsValidation() && true === this.validationResult)\n this._successClass();\n else if (this.validationResult.length > 0)\n this._errorClass();\n else\n this._resetClass();\n },\n\n _manageErrorsMessages: function (diff) {\n if ('undefined' !== typeof this.options.errorsMessagesDisabled)\n return;\n\n // Case where we have errorMessage option that configure an unique field error message, regardless failing validators\n if ('undefined' !== typeof this.options.errorMessage) {\n if ((diff.added.length || diff.kept.length)) {\n this._insertErrorWrapper();\n\n if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length)\n this._ui.$errorsWrapper\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-custom-error-message')\n );\n\n return this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-custom-error-message')\n .html(this.options.errorMessage);\n }\n\n return this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-custom-error-message')\n .remove();\n }\n\n // Show, hide, update failing constraints messages\n for (var i = 0; i < diff.removed.length; i++)\n this._removeError(diff.removed[i].assert.name);\n\n for (i = 0; i < diff.added.length; i++)\n this._addError(diff.added[i].assert.name, {message: diff.added[i].errorMessage, assert: diff.added[i].assert});\n\n for (i = 0; i < diff.kept.length; i++)\n this._updateError(diff.kept[i].assert.name, {message: diff.kept[i].errorMessage, assert: diff.kept[i].assert});\n },\n\n\n _addError: function (name, {message, assert}) {\n this._insertErrorWrapper();\n this._ui.$errorClassHandler\n .attr('aria-describedby', this._ui.errorsWrapperId);\n this._ui.$errorsWrapper\n .addClass('filled')\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-' + name)\n .html(message || this._getErrorMessage(assert))\n );\n },\n\n _updateError: function (name, {message, assert}) {\n this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-' + name)\n .html(message || this._getErrorMessage(assert));\n },\n\n _removeError: function (name) {\n this._ui.$errorClassHandler\n .removeAttr('aria-describedby');\n this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-' + name)\n .remove();\n },\n\n _getErrorMessage: function (constraint) {\n var customConstraintErrorMessage = constraint.name + 'Message';\n\n if ('undefined' !== typeof this.options[customConstraintErrorMessage])\n return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements);\n\n return window.Parsley.getErrorMessage(constraint);\n },\n\n _buildUI: function () {\n // UI could be already built or disabled\n if (this._ui || false === this.options.uiEnabled)\n return;\n\n var _ui = {};\n\n // Give field its Parsley id in DOM\n this.element.setAttribute(this.options.namespace + 'id', this.__id__);\n\n /** Generate important UI elements and store them in this **/\n // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes\n _ui.$errorClassHandler = this._manageClassHandler();\n\n // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer\n _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__);\n _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId);\n\n // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly\n _ui.lastValidationResult = [];\n _ui.validationInformationVisible = false;\n\n // Store it in this for later\n this._ui = _ui;\n },\n\n // Determine which element will have `parsley-error` and `parsley-success` classes\n _manageClassHandler: function () {\n // Class handled could also be determined by function given in Parsley options\n if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length)\n return $(this.options.classHandler);\n\n // Class handled could also be determined by function given in Parsley options\n var $handlerFunction = this.options.classHandler;\n\n // It might also be the function name of a global function\n if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler])\n $handlerFunction = window[this.options.classHandler];\n\n if ('function' === typeof $handlerFunction) {\n var $handler = $handlerFunction.call(this, this);\n\n // If this function returned a valid existing DOM element, go for it\n if ('undefined' !== typeof $handler && $handler.length)\n return $handler;\n } else if ('object' === typeof $handlerFunction && $handlerFunction instanceof jQuery && $handlerFunction.length) {\n return $handlerFunction;\n } else if ($handlerFunction) {\n Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function');\n }\n\n return this._inputHolder();\n },\n\n _inputHolder: function() {\n // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container\n if (!this.options.multiple || this.element.nodeName === 'SELECT')\n return this.$element;\n\n // But if multiple element (radio, checkbox), that would be their parent\n return this.$element.parent();\n },\n\n _insertErrorWrapper: function () {\n var $errorsContainer = this.options.errorsContainer;\n\n // Nothing to do if already inserted\n if (0 !== this._ui.$errorsWrapper.parent().length)\n return this._ui.$errorsWrapper.parent();\n\n if ('string' === typeof $errorsContainer) {\n if ($($errorsContainer).length)\n return $($errorsContainer).append(this._ui.$errorsWrapper);\n else if ('function' === typeof window[$errorsContainer])\n $errorsContainer = window[$errorsContainer];\n else\n Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function');\n }\n\n if ('function' === typeof $errorsContainer)\n $errorsContainer = $errorsContainer.call(this, this);\n\n if ('object' === typeof $errorsContainer && $errorsContainer.length)\n return $errorsContainer.append(this._ui.$errorsWrapper);\n\n return this._inputHolder().after(this._ui.$errorsWrapper);\n },\n\n _actualizeTriggers: function () {\n var $toBind = this._findRelated();\n var trigger;\n\n // Remove Parsley events already bound on this field\n $toBind.off('.Parsley');\n if (this._failedOnce)\n $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), () => {\n this._validateIfNeeded();\n });\n else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) {\n $toBind.on(trigger, event => {\n this._validateIfNeeded(event);\n });\n }\n },\n\n _validateIfNeeded: function (event) {\n // For keyup, keypress, keydown, input... events that could be a little bit obstrusive\n // do not validate if val length < min threshold on first validation. Once field have been validated once and info\n // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.\n if (event && /key|input/.test(event.type))\n if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold)\n return;\n\n if (this.options.debounce) {\n window.clearTimeout(this._debounced);\n this._debounced = window.setTimeout(() => this.validate(), this.options.debounce);\n } else\n this.validate();\n },\n\n _resetUI: function () {\n // Reset all event listeners\n this._failedOnce = false;\n this._actualizeTriggers();\n\n // Nothing to do if UI never initialized for this field\n if ('undefined' === typeof this._ui)\n return;\n\n // Reset all errors' li\n this._ui.$errorsWrapper\n .removeClass('filled')\n .children()\n .remove();\n\n // Reset validation class\n this._resetClass();\n\n // Reset validation flags and last validation result\n this._ui.lastValidationResult = [];\n this._ui.validationInformationVisible = false;\n },\n\n _destroyUI: function () {\n this._resetUI();\n\n if ('undefined' !== typeof this._ui)\n this._ui.$errorsWrapper.remove();\n\n delete this._ui;\n },\n\n _successClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass);\n },\n _errorClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass);\n },\n _resetClass: function () {\n this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass);\n }\n };\n\n var Form = function (element, domOptions, options) {\n this.__class__ = 'Form';\n\n this.element = element;\n this.$element = $(element);\n this.domOptions = domOptions;\n this.options = options;\n this.parent = window.Parsley;\n\n this.fields = [];\n this.validationResult = null;\n };\n\n var Form__statusMapping = {pending: null, resolved: true, rejected: false};\n\n Form.prototype = {\n onSubmitValidate: function (event) {\n // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior\n if (true === event.parsley)\n return;\n\n // If we didn't come here through a submit button, use the first one in the form\n var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0];\n this._submitSource = null;\n this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true);\n if (submitSource && null !== submitSource.getAttribute('formnovalidate'))\n return;\n\n window.Parsley._remoteCache = {};\n\n var promise = this.whenValidate({event});\n\n if ('resolved' === promise.state() && false !== this._trigger('submit')) {\n // All good, let event go through. We make this distinction because browsers\n // differ in their handling of `submit` being called from inside a submit event [#1047]\n } else {\n // Rejected or pending: cancel this submit\n event.stopImmediatePropagation();\n event.preventDefault();\n if ('pending' === promise.state())\n promise.done(() => { this._submit(submitSource); });\n }\n },\n\n onSubmitButton: function(event) {\n this._submitSource = event.currentTarget;\n },\n // internal\n // _submit submits the form, this time without going through the validations.\n // Care must be taken to \"fake\" the actual submit button being clicked.\n _submit: function (submitSource) {\n if (false === this._trigger('submit'))\n return;\n // Add submit button's data\n if (submitSource) {\n var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false);\n if (0 === $synthetic.length)\n $synthetic = $('').appendTo(this.$element);\n $synthetic.attr({\n name: submitSource.getAttribute('name'),\n value: submitSource.getAttribute('value')\n });\n }\n\n this.$element.trigger(Object.assign($.Event('submit'), {parsley: true}));\n },\n\n // Performs validation on fields while triggering events.\n // @returns `true` if all validations succeeds, `false`\n // if a failure is immediately detected, or `null`\n // if dependant on a promise.\n // Consider using `whenValidate` instead.\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.');\n var [group, force, event] = arguments;\n options = {group, force, event};\n }\n return Form__statusMapping[ this.whenValidate(options).state() ];\n },\n\n whenValidate: function ({group, force, event} = {}) {\n this.submitEvent = event;\n if (event) {\n this.submitEvent = Object.assign({}, event, {preventDefault: () => {\n Utils.warnOnce(\"Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`\");\n this.validationResult = false;\n }});\n }\n this.validationResult = true;\n\n // fire validate event to eventually modify things before every validation\n this._trigger('validate');\n\n // Refresh form DOM options and form's fields that could have changed\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValidate({force, group}));\n });\n\n return Utils.all(promises)\n .done( () => { this._trigger('success'); })\n .fail( () => {\n this.validationResult = false;\n this.focus();\n this._trigger('error');\n })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n // Iterate over refreshed fields, and stop on first failure.\n // Returns `true` if all fields are valid, `false` if a failure is detected\n // or `null` if the result depends on an unresolved promise.\n // Prefer using `whenValid` instead.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.');\n var [group, force] = arguments;\n options = {group, force};\n }\n return Form__statusMapping[ this.whenValid(options).state() ];\n },\n\n // Iterate over refreshed fields and validate them.\n // Returns a promise.\n // A validation that immediately fails will interrupt the validations.\n whenValid: function ({group, force} = {}) {\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValid({group, force}));\n });\n return Utils.all(promises);\n },\n\n refresh: function() {\n this._refreshFields();\n return this;\n },\n\n // Reset UI\n reset: function () {\n // Form case: emit a reset event for each field\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].reset();\n\n this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n\n // Form case: destroy all its fields and then destroy stored instance\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].destroy();\n\n this.$element.removeData('Parsley');\n this._trigger('destroy');\n },\n\n _refreshFields: function () {\n return this.actualizeOptions()._bindFields();\n },\n\n _bindFields: function () {\n var oldFields = this.fields;\n\n this.fields = [];\n this.fieldsMappedById = {};\n\n this._withoutReactualizingFormOptions(() => {\n this.$element\n .find(this.options.inputs)\n .not(this.options.excluded)\n .each((_, element) => {\n var fieldInstance = new window.Parsley.Factory(element, {}, this);\n\n // Only add valid and not excluded `Field` and `FieldMultiple` children\n if (('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) && (true !== fieldInstance.options.excluded)) {\n let uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__;\n if ('undefined' === typeof this.fieldsMappedById[uniqueId]) {\n this.fieldsMappedById[uniqueId] = fieldInstance;\n this.fields.push(fieldInstance);\n }\n }\n });\n\n $.each(Utils.difference(oldFields, this.fields), (_, field) => {\n field.reset();\n });\n });\n return this;\n },\n\n // Internal only.\n // Looping on a form's fields to do validation or similar\n // will trigger reactualizing options on all of them, which\n // in turn will reactualize the form's options.\n // To avoid calling actualizeOptions so many times on the form\n // for nothing, _withoutReactualizingFormOptions temporarily disables\n // the method actualizeOptions on this form while `fn` is called.\n _withoutReactualizingFormOptions: function (fn) {\n var oldActualizeOptions = this.actualizeOptions;\n this.actualizeOptions = function () { return this; };\n var result = fn();\n this.actualizeOptions = oldActualizeOptions;\n return result;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n // Returns true iff event is not interrupted and default not prevented.\n _trigger: function (eventName) {\n return this.trigger('form:' + eventName);\n }\n\n };\n\n const Constraint = function(parsleyField, name, requirements, priority, isDomConstraint) {\n const validatorSpec = window.Parsley._validatorRegistry.validators[name];\n const validator = new Validator(validatorSpec);\n priority = priority || parsleyField.options[name + 'Priority'] || validator.priority;\n isDomConstraint = (true === isDomConstraint);\n\n Object.assign(this, {\n validator,\n name,\n requirements,\n priority,\n isDomConstraint\n });\n this._parseRequirements(parsleyField.options);\n };\n\n const capitalize = function(str) {\n const cap = str[0].toUpperCase();\n return cap + str.slice(1);\n };\n\n Constraint.prototype = {\n validate: function(value, instance) {\n return this.validator.validate(value, ...this.requirementList, instance);\n },\n\n _parseRequirements: function(options) {\n this.requirementList = this.validator.parseRequirements(this.requirements,\n key => options[this.name + capitalize(key)]\n );\n }\n };\n\n var Field = function (field, domOptions, options, parsleyFormInstance) {\n this.__class__ = 'Field';\n\n this.element = field;\n this.$element = $(field);\n\n // Set parent if we have one\n if ('undefined' !== typeof parsleyFormInstance) {\n this.parent = parsleyFormInstance;\n }\n\n this.options = options;\n this.domOptions = domOptions;\n\n // Initialize some properties\n this.constraints = [];\n this.constraintsByName = {};\n this.validationResult = true;\n\n // Bind constraints\n this._bindConstraints();\n };\n\n var parsley_field__statusMapping = {pending: null, resolved: true, rejected: false};\n\n Field.prototype = {\n // # Public API\n // Validate field and trigger some events for mainly `UI`\n // @returns `true`, an array of the validators that failed, or\n // `null` if validation is not finished. Prefer using whenValidate\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.');\n options = {options};\n }\n var promise = this.whenValidate(options);\n if (!promise) // If excluded with `group` option\n return true;\n switch (promise.state()) {\n case 'pending': return null;\n case 'resolved': return true;\n case 'rejected': return this.validationResult;\n }\n },\n\n // Validate field and trigger some events for mainly `UI`\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if field is not in the given `group`.\n whenValidate: function ({force, group} = {}) {\n // do not validate a field if not the same as given validation group\n this.refresh();\n if (group && !this._isInGroup(group))\n return;\n\n this.value = this.getValue();\n\n // Field Validate event. `this.value` could be altered for custom needs\n this._trigger('validate');\n\n return this.whenValid({force, value: this.value, _refreshed: true})\n .always(() => { this._reflowUI(); })\n .done(() => { this._trigger('success'); })\n .fail(() => { this._trigger('error'); })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n hasConstraints: function () {\n return 0 !== this.constraints.length;\n },\n\n // An empty optional field does not need validation\n needsValidation: function (value) {\n if ('undefined' === typeof value)\n value = this.getValue();\n\n // If a field is empty and not required, it is valid\n // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators\n if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty)\n return false;\n\n return true;\n },\n\n _isInGroup: function (group) {\n if (Array.isArray(this.options.group))\n return -1 !== $.inArray(group, this.options.group);\n return this.options.group === group;\n },\n\n // Just validate field. Do not trigger any event.\n // Returns `true` iff all constraints pass, `false` if there are failures,\n // or `null` if the result can not be determined yet (depends on a promise)\n // See also `whenValid`.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.');\n var [force, value] = arguments;\n options = {force, value};\n }\n var promise = this.whenValid(options);\n if (!promise) // Excluded via `group`\n return true;\n return parsley_field__statusMapping[promise.state()];\n },\n\n // Just validate field. Do not trigger any event.\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if the field is not in the given `group`.\n // The argument `force` will force validation of empty fields.\n // If a `value` is given, it will be validated instead of the value of the input.\n whenValid: function ({force = false, value, group, _refreshed} = {}) {\n // Recompute options and rebind constraints to have latest changes\n if (!_refreshed)\n this.refresh();\n // do not validate a field if not the same as given validation group\n if (group && !this._isInGroup(group))\n return;\n\n this.validationResult = true;\n\n // A field without constraint is valid\n if (!this.hasConstraints())\n return $.when();\n\n // Value could be passed as argument, needed to add more power to 'field:validate'\n if ('undefined' === typeof value || null === value)\n value = this.getValue();\n\n if (!this.needsValidation(value) && true !== force)\n return $.when();\n\n var groupedConstraints = this._getGroupedConstraints();\n var promises = [];\n $.each(groupedConstraints, (_, constraints) => {\n // Process one group of constraints at a time, we validate the constraints\n // and combine the promises together.\n var promise = Utils.all(\n $.map(constraints, constraint => this._validateConstraint(value, constraint))\n );\n promises.push(promise);\n if (promise.state() === 'rejected')\n return false; // Interrupt processing if a group has already failed\n });\n return Utils.all(promises);\n },\n\n // @returns a promise\n _validateConstraint: function(value, constraint) {\n var result = constraint.validate(value, this);\n // Map false to a failed promise\n if (false === result)\n result = $.Deferred().reject();\n // Make sure we return a promise and that we record failures\n return Utils.all([result]).fail(errorMessage => {\n if (!(this.validationResult instanceof Array))\n this.validationResult = [];\n this.validationResult.push({\n assert: constraint,\n errorMessage: 'string' === typeof errorMessage && errorMessage\n });\n });\n },\n\n // @returns Parsley field computed value that could be overrided or configured in DOM\n getValue: function () {\n var value;\n\n // Value could be overriden in DOM or with explicit options\n if ('function' === typeof this.options.value)\n value = this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n value = this.options.value;\n else\n value = this.$element.val();\n\n // Handle wrong DOM or configurations\n if ('undefined' === typeof value || null === value)\n return '';\n\n return this._handleWhitespace(value);\n },\n\n // Reset UI\n reset: function () {\n this._resetUI();\n return this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n this.$element.removeData('Parsley');\n this.$element.removeData('FieldMultiple');\n this._trigger('destroy');\n },\n\n // Actualize options and rebind constraints\n refresh: function () {\n this._refreshConstraints();\n return this;\n },\n\n _refreshConstraints: function () {\n return this.actualizeOptions()._bindConstraints();\n },\n\n refreshConstraints: function() {\n Utils.warnOnce(\"Parsley's refreshConstraints is deprecated. Please use refresh\");\n return this.refresh();\n },\n\n /**\n * Add a new constraint to a field\n *\n * @param {String} name\n * @param {Mixed} requirements optional\n * @param {Number} priority optional\n * @param {Boolean} isDomConstraint optional\n */\n addConstraint: function (name, requirements, priority, isDomConstraint) {\n\n if (window.Parsley._validatorRegistry.validators[name]) {\n var constraint = new Constraint(this, name, requirements, priority, isDomConstraint);\n\n // if constraint already exist, delete it and push new version\n if ('undefined' !== this.constraintsByName[constraint.name])\n this.removeConstraint(constraint.name);\n\n this.constraints.push(constraint);\n this.constraintsByName[constraint.name] = constraint;\n }\n\n return this;\n },\n\n // Remove a constraint\n removeConstraint: function (name) {\n for (var i = 0; i < this.constraints.length; i++)\n if (name === this.constraints[i].name) {\n this.constraints.splice(i, 1);\n break;\n }\n delete this.constraintsByName[name];\n return this;\n },\n\n // Update a constraint (Remove + re-add)\n updateConstraint: function (name, parameters, priority) {\n return this.removeConstraint(name)\n .addConstraint(name, parameters, priority);\n },\n\n // # Internals\n\n // Internal only.\n // Bind constraints from config + options + DOM\n _bindConstraints: function () {\n var constraints = [];\n var constraintsByName = {};\n\n // clean all existing DOM constraints to only keep javascript user constraints\n for (var i = 0; i < this.constraints.length; i++)\n if (false === this.constraints[i].isDomConstraint) {\n constraints.push(this.constraints[i]);\n constraintsByName[this.constraints[i].name] = this.constraints[i];\n }\n\n this.constraints = constraints;\n this.constraintsByName = constraintsByName;\n\n // then re-add Parsley DOM-API constraints\n for (var name in this.options)\n this.addConstraint(name, this.options[name], undefined, true);\n\n // finally, bind special HTML5 constraints\n return this._bindHtml5Constraints();\n },\n\n // Internal only.\n // Bind specific HTML5 constraints to be HTML5 compliant\n _bindHtml5Constraints: function () {\n // html5 required\n if (null !== this.element.getAttribute('required'))\n this.addConstraint('required', true, undefined, true);\n\n // html5 pattern\n if (null !== this.element.getAttribute('pattern'))\n this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true);\n\n // range\n let min = this.element.getAttribute('min');\n let max = this.element.getAttribute('max');\n if (null !== min && null !== max)\n this.addConstraint('range', [min, max], undefined, true);\n\n // HTML5 min\n else if (null !== min)\n this.addConstraint('min', min, undefined, true);\n\n // HTML5 max\n else if (null !== max)\n this.addConstraint('max', max, undefined, true);\n\n\n // length\n if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength'))\n this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true);\n\n // HTML5 minlength\n else if (null !== this.element.getAttribute('minlength'))\n this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true);\n\n // HTML5 maxlength\n else if (null !== this.element.getAttribute('maxlength'))\n this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true);\n\n\n // html5 types\n var type = Utils.getType(this.element);\n\n // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise\n if ('number' === type) {\n return this.addConstraint('type', ['number', {\n step: this.element.getAttribute('step') || '1',\n base: min || this.element.getAttribute('value')\n }], undefined, true);\n // Regular other HTML5 supported types\n } else if (/^(email|url|range|date)$/i.test(type)) {\n return this.addConstraint('type', type, undefined, true);\n }\n return this;\n },\n\n // Internal only.\n // Field is required if have required constraint without `false` value\n _isRequired: function () {\n if ('undefined' === typeof this.constraintsByName.required)\n return false;\n\n return false !== this.constraintsByName.required.requirements;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n _trigger: function (eventName) {\n return this.trigger('field:' + eventName);\n },\n\n // Internal only\n // Handles whitespace in a value\n // Use `data-parsley-whitespace=\"squish\"` to auto squish input value\n // Use `data-parsley-whitespace=\"trim\"` to auto trim input value\n _handleWhitespace: function (value) {\n if (true === this.options.trimValue)\n Utils.warnOnce('data-parsley-trim-value=\"true\" is deprecated, please use data-parsley-whitespace=\"trim\"');\n\n if ('squish' === this.options.whitespace)\n value = value.replace(/\\s{2,}/g, ' ');\n\n if (('trim' === this.options.whitespace) || ('squish' === this.options.whitespace) || (true === this.options.trimValue))\n value = Utils.trimString(value);\n\n return value;\n },\n\n _isDateInput: function() {\n var c = this.constraintsByName.type;\n return c && c.requirements === 'date';\n },\n\n // Internal only.\n // Returns the constraints, grouped by descending priority.\n // The result is thus an array of arrays of constraints.\n _getGroupedConstraints: function () {\n if (false === this.options.priorityEnabled)\n return [this.constraints];\n\n var groupedConstraints = [];\n var index = {};\n\n // Create array unique of priorities\n for (var i = 0; i < this.constraints.length; i++) {\n var p = this.constraints[i].priority;\n if (!index[p])\n groupedConstraints.push(index[p] = []);\n index[p].push(this.constraints[i]);\n }\n // Sort them by priority DESC\n groupedConstraints.sort(function (a, b) { return b[0].priority - a[0].priority; });\n\n return groupedConstraints;\n }\n\n };\n\n var parsley_field = Field;\n\n var Multiple = function () {\n this.__class__ = 'FieldMultiple';\n };\n\n Multiple.prototype = {\n // Add new `$element` sibling for multiple field\n addElement: function ($element) {\n this.$elements.push($element);\n\n return this;\n },\n\n // See `Field._refreshConstraints()`\n _refreshConstraints: function () {\n var fieldConstraints;\n\n this.constraints = [];\n\n // Select multiple special treatment\n if (this.element.nodeName === 'SELECT') {\n this.actualizeOptions()._bindConstraints();\n\n return this;\n }\n\n // Gather all constraints for each input in the multiple group\n for (var i = 0; i < this.$elements.length; i++) {\n\n // Check if element have not been dynamically removed since last binding\n if (!$('html').has(this.$elements[i]).length) {\n this.$elements.splice(i, 1);\n continue;\n }\n\n fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints;\n\n for (var j = 0; j < fieldConstraints.length; j++)\n this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint);\n }\n\n return this;\n },\n\n // See `Field.getValue()`\n getValue: function () {\n // Value could be overriden in DOM\n if ('function' === typeof this.options.value)\n return this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n return this.options.value;\n\n // Radio input case\n if (this.element.nodeName === 'INPUT') {\n var type = Utils.getType(this.element);\n if (type === 'radio')\n return this._findRelated().filter(':checked').val() || '';\n\n // checkbox input case\n if (type === 'checkbox') {\n var values = [];\n\n this._findRelated().filter(':checked').each(function () {\n values.push($(this).val());\n });\n\n return values;\n }\n }\n\n // Select multiple case\n if (this.element.nodeName === 'SELECT' && null === this.$element.val())\n return [];\n\n // Default case that should never happen\n return this.$element.val();\n },\n\n _init: function () {\n this.$elements = [this.$element];\n\n return this;\n }\n };\n\n var Factory = function (element, options, parsleyFormInstance) {\n this.element = element;\n this.$element = $(element);\n\n // If the element has already been bound, returns its saved Parsley instance\n var savedparsleyFormInstance = this.$element.data('Parsley');\n if (savedparsleyFormInstance) {\n\n // If the saved instance has been bound without a Form parent and there is one given in this call, add it\n if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) {\n savedparsleyFormInstance.parent = parsleyFormInstance;\n savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);\n }\n\n if ('object' === typeof options) {\n Object.assign(savedparsleyFormInstance.options, options);\n }\n\n return savedparsleyFormInstance;\n }\n\n // Parsley must be instantiated with a DOM element or jQuery $element\n if (!this.$element.length)\n throw new Error('You must bind Parsley on an existing element.');\n\n if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__)\n throw new Error('Parent instance must be a Form instance');\n\n this.parent = parsleyFormInstance || window.Parsley;\n return this.init(options);\n };\n\n Factory.prototype = {\n init: function (options) {\n this.__class__ = 'Parsley';\n this.__version__ = '2.8.1';\n this.__id__ = Utils.generateID();\n\n // Pre-compute options\n this._resetOptions(options);\n\n // A Form instance is obviously a `` element but also every node that is not an input and has the `data-parsley-validate` attribute\n if (this.element.nodeName === 'FORM' || (Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)))\n return this.bind('parsleyForm');\n\n // Every other element is bound as a `Field` or `FieldMultiple`\n return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField');\n },\n\n isMultiple: function () {\n var type = Utils.getType(this.element);\n return ((type === 'radio' || type === 'checkbox') ||\n (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')));\n },\n\n // Multiples fields are a real nightmare :(\n // Maybe some refactoring would be appreciated here...\n handleMultiple: function () {\n var name;\n var multiple;\n var parsleyMultipleInstance;\n\n // Handle multiple name\n this.options.multiple = this.options.multiple ||\n (name = this.element.getAttribute('name')) ||\n this.element.getAttribute('id');\n\n // Special select multiple input\n if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) {\n this.options.multiple = this.options.multiple || this.__id__;\n return this.bind('parsleyFieldMultiple');\n\n // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it\n } else if (!this.options.multiple) {\n Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element);\n return this;\n }\n\n // Remove special chars\n this.options.multiple = this.options.multiple.replace(/(:|\\.|\\[|\\]|\\{|\\}|\\$)/g, '');\n\n // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name\n if (name) {\n $('input[name=\"' + name + '\"]').each((i, input) => {\n var type = Utils.getType(input);\n if ((type === 'radio' || type === 'checkbox'))\n input.setAttribute(this.options.namespace + 'multiple', this.options.multiple);\n });\n }\n\n // Check here if we don't already have a related multiple instance saved\n var $previouslyRelated = this._findRelated();\n for (var i = 0; i < $previouslyRelated.length; i++) {\n parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley');\n if ('undefined' !== typeof parsleyMultipleInstance) {\n\n if (!this.$element.data('FieldMultiple')) {\n parsleyMultipleInstance.addElement(this.$element);\n }\n\n break;\n }\n }\n\n // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')`\n // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance\n this.bind('parsleyField', true);\n\n return parsleyMultipleInstance || this.bind('parsleyFieldMultiple');\n },\n\n // Return proper `Form`, `Field` or `FieldMultiple`\n bind: function (type, doNotStore) {\n var parsleyInstance;\n\n switch (type) {\n case 'parsleyForm':\n parsleyInstance = $.extend(\n new Form(this.element, this.domOptions, this.options),\n new Base(),\n window.ParsleyExtend\n )._bindFields();\n break;\n case 'parsleyField':\n parsleyInstance = $.extend(\n new parsley_field(this.element, this.domOptions, this.options, this.parent),\n new Base(),\n window.ParsleyExtend\n );\n break;\n case 'parsleyFieldMultiple':\n parsleyInstance = $.extend(\n new parsley_field(this.element, this.domOptions, this.options, this.parent),\n new Multiple(),\n new Base(),\n window.ParsleyExtend\n )._init();\n break;\n default:\n throw new Error(type + 'is not a supported Parsley type');\n }\n\n if (this.options.multiple)\n Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple);\n\n if ('undefined' !== typeof doNotStore) {\n this.$element.data('FieldMultiple', parsleyInstance);\n\n return parsleyInstance;\n }\n\n // Store the freshly bound instance in a DOM element for later access using jQuery `data()`\n this.$element.data('Parsley', parsleyInstance);\n\n // Tell the world we have a new Form or Field instance!\n parsleyInstance._actualizeTriggers();\n parsleyInstance._trigger('init');\n\n return parsleyInstance;\n }\n };\n\n var vernums = $.fn.jquery.split('.');\n if (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) {\n throw \"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.\";\n }\n if (!vernums.forEach) {\n Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim');\n }\n // Inherit `on`, `off` & `trigger` to Parsley:\n var Parsley = Object.assign(new Base(), {\n element: document,\n $element: $(document),\n actualizeOptions: null,\n _resetOptions: null,\n Factory: Factory,\n version: '2.8.1'\n });\n\n // Supplement Field and Form with Base\n // This way, the constructors will have access to those methods\n Object.assign(parsley_field.prototype, UI.Field, Base.prototype);\n Object.assign(Form.prototype, UI.Form, Base.prototype);\n // Inherit actualizeOptions and _resetOptions:\n Object.assign(Factory.prototype, Base.prototype);\n\n // ### jQuery API\n // `$('.elem').parsley(options)` or `$('.elem').psly(options)`\n $.fn.parsley = $.fn.psly = function (options) {\n if (this.length > 1) {\n var instances = [];\n\n this.each(function () {\n instances.push($(this).parsley(options));\n });\n\n return instances;\n }\n\n // Return undefined if applied to non existing DOM element\n if (this.length == 0) {\n return;\n }\n\n return new Factory(this[0], options);\n };\n\n // ### Field and Form extension\n // Ensure the extension is now defined if it wasn't previously\n if ('undefined' === typeof window.ParsleyExtend)\n window.ParsleyExtend = {};\n\n // ### Parsley config\n // Inherit from ParsleyDefault, and copy over any existing values\n Parsley.options = Object.assign(Utils.objectCreate(Defaults), window.ParsleyConfig);\n window.ParsleyConfig = Parsley.options; // Old way of accessing global options\n\n // ### Globals\n window.Parsley = window.psly = Parsley;\n Parsley.Utils = Utils;\n window.ParsleyUtils = {};\n $.each(Utils, (key, value) => {\n if ('function' === typeof value) {\n window.ParsleyUtils[key] = (...args) => {\n Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.');\n return Utils[key](...args);\n };\n }\n });\n\n // ### Define methods that forward to the registry, and deprecate all access except through window.Parsley\n var registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n);\n window.ParsleyValidator = {};\n $.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) {\n window.Parsley[method] = (...args) => registry[method](...args);\n window.ParsleyValidator[method] = function () {\n Utils.warnOnce(`Accessing the method '${method}' through Validator is deprecated. Simply call 'window.Parsley.${method}(...)'`);\n return window.Parsley[method](...arguments);\n };\n });\n\n // ### UI\n // Deprecated global object\n window.Parsley.UI = UI;\n window.ParsleyUI = {\n removeError: function (instance, name, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance.removeError(name, {updateClass});\n },\n getErrorsMessages: function (instance) {\n Utils.warnOnce(`Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly.`);\n return instance.getErrorsMessages();\n }\n };\n $.each('addError updateError'.split(' '), function (i, method) {\n window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call '${method}' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance[method](name, {message, assert, updateClass});\n };\n });\n\n // ### PARSLEY auto-binding\n // Prevent it by setting `ParsleyConfig.autoBind` to `false`\n if (false !== window.ParsleyConfig.autoBind) {\n $(function () {\n // Works only on `data-parsley-validate`.\n if ($('[data-parsley-validate]').length)\n $('[data-parsley-validate]').parsley();\n });\n }\n\n var o = $({});\n var deprecated = function () {\n Utils.warnOnce(\"Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley\");\n };\n\n // Returns an event handler that calls `fn` with the arguments it expects\n function adapt(fn, context) {\n // Store to allow unbinding\n if (!fn.parsleyAdaptedCallback) {\n fn.parsleyAdaptedCallback = function () {\n var args = Array.prototype.slice.call(arguments, 0);\n args.unshift(this);\n fn.apply(context || o, args);\n };\n }\n return fn.parsleyAdaptedCallback;\n }\n\n var eventPrefix = 'parsley:';\n // Converts 'parsley:form:validate' into 'form:validate'\n function eventName(name) {\n if (name.lastIndexOf(eventPrefix, 0) === 0)\n return name.substr(eventPrefix.length);\n return name;\n }\n\n // $.listen is deprecated. Use Parsley.on instead.\n $.listen = function (name, callback) {\n var context;\n deprecated();\n if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) {\n context = arguments[1];\n callback = arguments[2];\n }\n\n if ('function' !== typeof callback)\n throw new Error('Wrong parameters');\n\n window.Parsley.on(eventName(name), adapt(callback, context));\n };\n\n $.listenTo = function (instance, name, fn) {\n deprecated();\n if (!(instance instanceof parsley_field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong parameters');\n\n instance.on(eventName(name), adapt(fn));\n };\n\n $.unsubscribe = function (name, fn) {\n deprecated();\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong arguments');\n window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback);\n };\n\n $.unsubscribeTo = function (instance, name) {\n deprecated();\n if (!(instance instanceof parsley_field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n instance.off(eventName(name));\n };\n\n $.unsubscribeAll = function (name) {\n deprecated();\n window.Parsley.off(eventName(name));\n $('form,input,textarea,select').each(function () {\n var instance = $(this).data('Parsley');\n if (instance) {\n instance.off(eventName(name));\n }\n });\n };\n\n // $.emit is deprecated. Use jQuery events instead.\n $.emit = function (name, instance) {\n deprecated();\n var instanceGiven = (instance instanceof parsley_field) || (instance instanceof Form);\n var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1);\n args.unshift(eventName(name));\n if (!instanceGiven) {\n instance = window.Parsley;\n }\n instance.trigger(...args);\n };\n\n var pubsub = {};\n\n $.extend(true, Parsley, {\n asyncValidators: {\n 'default': {\n fn: function (xhr) {\n // By default, only status 2xx are deemed successful.\n // Note: we use status instead of state() because responses with status 200\n // but invalid messages (e.g. an empty body for content type set to JSON) will\n // result in state() === 'rejected'.\n return xhr.status >= 200 && xhr.status < 300;\n },\n url: false\n },\n reverse: {\n fn: function (xhr) {\n // If reverse option is set, a failing ajax request is considered successful\n return xhr.status < 200 || xhr.status >= 300;\n },\n url: false\n }\n },\n\n addAsyncValidator: function (name, fn, url, options) {\n Parsley.asyncValidators[name] = {\n fn: fn,\n url: url || false,\n options: options || {}\n };\n\n return this;\n }\n\n });\n\n Parsley.addValidator('remote', {\n requirementType: {\n '': 'string',\n 'validator': 'string',\n 'reverse': 'boolean',\n 'options': 'object'\n },\n\n validateString: function (value, url, options, instance) {\n var data = {};\n var ajaxOptions;\n var csr;\n var validator = options.validator || (true === options.reverse ? 'reverse' : 'default');\n\n if ('undefined' === typeof Parsley.asyncValidators[validator])\n throw new Error('Calling an undefined async validator: `' + validator + '`');\n\n url = Parsley.asyncValidators[validator].url || url;\n\n // Fill current value\n if (url.indexOf('{value}') > -1) {\n url = url.replace('{value}', encodeURIComponent(value));\n } else {\n data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value;\n }\n\n // Merge options passed in from the function with the ones in the attribute\n var remoteOptions = $.extend(true, options.options || {} , Parsley.asyncValidators[validator].options);\n\n // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options`\n ajaxOptions = $.extend(true, {}, {\n url: url,\n data: data,\n type: 'GET'\n }, remoteOptions);\n\n // Generate store key based on ajax options\n instance.trigger('field:ajaxoptions', instance, ajaxOptions);\n\n csr = $.param(ajaxOptions);\n\n // Initialise querry cache\n if ('undefined' === typeof Parsley._remoteCache)\n Parsley._remoteCache = {};\n\n // Try to retrieve stored xhr\n var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions);\n\n var handleXhr = function () {\n var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options);\n if (!result) // Map falsy results to rejected promise\n result = $.Deferred().reject();\n return $.when(result);\n };\n\n return xhr.then(handleXhr, handleXhr);\n },\n\n priority: -1\n });\n\n Parsley.on('form:submit', function () {\n Parsley._remoteCache = {};\n });\n\n Base.prototype.addAsyncValidator = function () {\n Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`');\n return Parsley.addAsyncValidator(...arguments);\n };\n\n // This is included with the Parsley library itself,\n // thus there is no use in adding it to your project.\n Parsley.addMessages('en', {\n defaultMessage: \"This value seems to be invalid.\",\n type: {\n email: \"This value should be a valid email.\",\n url: \"This value should be a valid url.\",\n number: \"This value should be a valid number.\",\n integer: \"This value should be a valid integer.\",\n digits: \"This value should be digits.\",\n alphanum: \"This value should be alphanumeric.\"\n },\n notblank: \"This value should not be blank.\",\n required: \"This value is required.\",\n pattern: \"This value seems to be invalid.\",\n min: \"This value should be greater than or equal to %s.\",\n max: \"This value should be lower than or equal to %s.\",\n range: \"This value should be between %s and %s.\",\n minlength: \"This value is too short. It should have %s characters or more.\",\n maxlength: \"This value is too long. It should have %s characters or fewer.\",\n length: \"This value length is invalid. It should be between %s and %s characters long.\",\n mincheck: \"You must select at least %s choices.\",\n maxcheck: \"You must select %s choices or fewer.\",\n check: \"You must select between %s and %s choices.\",\n equalto: \"This value should be the same.\"\n });\n\n Parsley.setLocale('en');\n\n /**\n * inputevent - Alleviate browser bugs for input events\n * https://github.com/marcandre/inputevent\n * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm)\n * @author Marc-Andre Lafortune \n * @license MIT\n */\n\n function InputEvent() {\n let globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n Object.assign(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: evt => {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: evt => {\n if (this.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: evt => {\n if (this.isNativeEvent(evt)) {\n this.behavesOk(evt);\n $(document)\n .on('change.inputevent', evt.data.selector, this.fakeInputEvent);\n this.fakeInputEvent(evt);\n }\n },\n\n behavesOk: evt => {\n if (this.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, this.behavesOk)\n .off('change.inputevent', evt.data.selector, this.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: () => {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n for (let selector of ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]']) {\n $(document)\n .on('input.inputevent', selector, {selector}, this.behavesOk)\n .on('change.inputevent', selector, {selector}, this.misbehaves);\n }\n },\n\n uninstall: () => {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n };\n\n var inputevent = new InputEvent();\n\n inputevent.install();\n\n var parsley = Parsley;\n\n return parsley;\n\n}));\n","import $ from 'jquery';\nimport Field from './field';\nimport Form from './form';\nimport Utils from './utils';\n\nvar o = $({});\nvar deprecated = function () {\n Utils.warnOnce(\"Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley\");\n};\n\n// Returns an event handler that calls `fn` with the arguments it expects\nfunction adapt(fn, context) {\n // Store to allow unbinding\n if (!fn.parsleyAdaptedCallback) {\n fn.parsleyAdaptedCallback = function () {\n var args = Array.prototype.slice.call(arguments, 0);\n args.unshift(this);\n fn.apply(context || o, args);\n };\n }\n return fn.parsleyAdaptedCallback;\n}\n\nvar eventPrefix = 'parsley:';\n// Converts 'parsley:form:validate' into 'form:validate'\nfunction eventName(name) {\n if (name.lastIndexOf(eventPrefix, 0) === 0)\n return name.substr(eventPrefix.length);\n return name;\n}\n\n// $.listen is deprecated. Use Parsley.on instead.\n$.listen = function (name, callback) {\n var context;\n deprecated();\n if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) {\n context = arguments[1];\n callback = arguments[2];\n }\n\n if ('function' !== typeof callback)\n throw new Error('Wrong parameters');\n\n window.Parsley.on(eventName(name), adapt(callback, context));\n};\n\n$.listenTo = function (instance, name, fn) {\n deprecated();\n if (!(instance instanceof Field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong parameters');\n\n instance.on(eventName(name), adapt(fn));\n};\n\n$.unsubscribe = function (name, fn) {\n deprecated();\n if ('string' !== typeof name || 'function' !== typeof fn)\n throw new Error('Wrong arguments');\n window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback);\n};\n\n$.unsubscribeTo = function (instance, name) {\n deprecated();\n if (!(instance instanceof Field) && !(instance instanceof Form))\n throw new Error('Must give Parsley instance');\n instance.off(eventName(name));\n};\n\n$.unsubscribeAll = function (name) {\n deprecated();\n window.Parsley.off(eventName(name));\n $('form,input,textarea,select').each(function () {\n var instance = $(this).data('Parsley');\n if (instance) {\n instance.off(eventName(name));\n }\n });\n};\n\n// $.emit is deprecated. Use jQuery events instead.\n$.emit = function (name, instance) {\n deprecated();\n var instanceGiven = (instance instanceof Field) || (instance instanceof Form);\n var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1);\n args.unshift(eventName(name));\n if (!instanceGiven) {\n instance = window.Parsley;\n }\n instance.trigger(...args);\n};\n\nexport default {};\n","/**\n * inputevent - Alleviate browser bugs for input events\n * https://github.com/marcandre/inputevent\n * @version v0.0.3 - (built Thu, Apr 14th 2016, 5:58 pm)\n * @author Marc-Andre Lafortune \n * @license MIT\n */\n\nimport $ from 'jquery';\n\nfunction InputEvent() {\n let globals = window || global;\n\n // Slightly odd way construct our object. This way methods are force bound.\n // Used to test for duplicate library.\n Object.assign(this, {\n\n // For browsers that do not support isTrusted, assumes event is native.\n isNativeEvent: evt => {\n return evt.originalEvent && evt.originalEvent.isTrusted !== false;\n },\n\n fakeInputEvent: evt => {\n if (this.isNativeEvent(evt)) {\n $(evt.target).trigger('input');\n }\n },\n\n misbehaves: evt => {\n if (this.isNativeEvent(evt)) {\n this.behavesOk(evt);\n $(document)\n .on('change.inputevent', evt.data.selector, this.fakeInputEvent);\n this.fakeInputEvent(evt);\n }\n },\n\n behavesOk: evt => {\n if (this.isNativeEvent(evt)) {\n $(document) // Simply unbinds the testing handler\n .off('input.inputevent', evt.data.selector, this.behavesOk)\n .off('change.inputevent', evt.data.selector, this.misbehaves);\n }\n },\n\n // Bind the testing handlers\n install: () => {\n if (globals.inputEventPatched) {\n return;\n }\n globals.inputEventPatched = '0.0.3';\n for (let selector of ['select', 'input[type=\"checkbox\"]', 'input[type=\"radio\"]', 'input[type=\"file\"]']) {\n $(document)\n .on('input.inputevent', selector, {selector}, this.behavesOk)\n .on('change.inputevent', selector, {selector}, this.misbehaves);\n }\n },\n\n uninstall: () => {\n delete globals.inputEventPatched;\n $(document).off('.inputevent');\n }\n\n });\n};\n\nexport default new InputEvent();\n","import $ from 'jquery';\n\nvar globalID = 1;\nvar pastWarnings = {};\n\nvar Utils = {\n // Parsley DOM-API\n // returns object from dom attributes and values\n attr: function (element, namespace, obj) {\n var i;\n var attribute;\n var attributes;\n var regex = new RegExp('^' + namespace, 'i');\n\n if ('undefined' === typeof obj)\n obj = {};\n else {\n // Clear all own properties. This won't affect prototype's values\n for (i in obj) {\n if (obj.hasOwnProperty(i))\n delete obj[i];\n }\n }\n\n if (!element)\n return obj;\n\n attributes = element.attributes;\n for (i = attributes.length; i--; ) {\n attribute = attributes[i];\n\n if (attribute && attribute.specified && regex.test(attribute.name)) {\n obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value);\n }\n }\n\n return obj;\n },\n\n checkAttr: function (element, namespace, checkAttr) {\n return element.hasAttribute(namespace + checkAttr);\n },\n\n setAttr: function (element, namespace, attr, value) {\n element.setAttribute(this.dasherize(namespace + attr), String(value));\n },\n\n getType: function(element) {\n return element.getAttribute('type') || 'text';\n },\n\n generateID: function () {\n return '' + globalID++;\n },\n\n /** Third party functions **/\n deserializeValue: function (value) {\n var num;\n\n try {\n return value ?\n value == \"true\" ||\n (value == \"false\" ? false :\n value == \"null\" ? null :\n !isNaN(num = Number(value)) ? num :\n /^[\\[\\{]/.test(value) ? JSON.parse(value) :\n value)\n : value;\n } catch (e) { return value; }\n },\n\n // Zepto camelize function\n camelize: function (str) {\n return str.replace(/-+(.)?/g, function (match, chr) {\n return chr ? chr.toUpperCase() : '';\n });\n },\n\n // Zepto dasherize function\n dasherize: function (str) {\n return str.replace(/::/g, '/')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n .replace(/([a-z\\d])([A-Z])/g, '$1_$2')\n .replace(/_/g, '-')\n .toLowerCase();\n },\n\n warn: function () {\n if (window.console && 'function' === typeof window.console.warn)\n window.console.warn(...arguments);\n },\n\n warnOnce: function(msg) {\n if (!pastWarnings[msg]) {\n pastWarnings[msg] = true;\n this.warn(...arguments);\n }\n },\n\n _resetWarnings: function () {\n pastWarnings = {};\n },\n\n trimString: function(string) {\n return string.replace(/^\\s+|\\s+$/g, '');\n },\n\n parse: {\n date: function(string) {\n let parsed = string.match(/^(\\d{4,})-(\\d\\d)-(\\d\\d)$/);\n if (!parsed)\n return null;\n let [_, year, month, day] = parsed.map(x => parseInt(x, 10));\n let date = new Date(year, month - 1, day);\n if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day)\n return null;\n return date;\n },\n string: function(string) {\n return string;\n },\n integer: function(string) {\n if (isNaN(string))\n return null;\n return parseInt(string, 10);\n },\n number: function(string) {\n if (isNaN(string))\n throw null;\n return parseFloat(string);\n },\n 'boolean': function _boolean(string) {\n return !(/^\\s*false\\s*$/i.test(string));\n },\n object: function(string) {\n return Utils.deserializeValue(string);\n },\n regexp: function(regexp) {\n var flags = '';\n\n // Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern\n if (/^\\/.*\\/(?:[gimy]*)$/.test(regexp)) {\n // Replace the regexp literal string with the first match group: ([gimy]*)\n // If no flag is present, this will be a blank string\n flags = regexp.replace(/.*\\/([gimy]*)$/, '$1');\n // Again, replace the regexp literal string with the first match group:\n // everything excluding the opening and closing slashes and the flags\n regexp = regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');\n } else {\n // Anchor regexp:\n regexp = '^' + regexp + '$';\n }\n return new RegExp(regexp, flags);\n }\n },\n\n parseRequirement: function(requirementType, string) {\n var converter = this.parse[requirementType || 'string'];\n if (!converter)\n throw 'Unknown requirement specification: \"' + requirementType + '\"';\n let converted = converter(string);\n if (converted === null)\n throw `Requirement is not a ${requirementType}: \"${string}\"`;\n return converted;\n },\n\n namespaceEvents: function(events, namespace) {\n events = this.trimString(events || '').split(/\\s+/);\n if (!events[0])\n return '';\n return $.map(events, evt => `${evt}.${namespace}`).join(' ');\n },\n\n difference: function(array, remove) {\n // This is O(N^2), should be optimized\n let result = [];\n $.each(array, (_, elem) => {\n if (remove.indexOf(elem) == -1)\n result.push(elem);\n });\n return result;\n },\n\n // Alter-ego to native Promise.all, but for jQuery\n all: function(promises) {\n // jQuery treats $.when() and $.when(singlePromise) differently; let's avoid that and add spurious elements\n return $.when(...promises, 42, 42);\n },\n\n // Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill\n objectCreate: Object.create || (function () {\n var Object = function () {};\n return function (prototype) {\n if (arguments.length > 1) {\n throw Error('Second argument not supported');\n }\n if (typeof prototype != 'object') {\n throw TypeError('Argument must be an object');\n }\n Object.prototype = prototype;\n var result = new Object();\n Object.prototype = null;\n return result;\n };\n })(),\n\n _SubmitSelector: 'input[type=\"submit\"], button:submit'\n};\n\nexport default Utils;\n","// All these options could be overriden and specified directly in DOM using\n// `data-parsley-` default DOM-API\n// eg: `inputs` can be set in DOM using `data-parsley-inputs=\"input, textarea\"`\n// eg: `data-parsley-stop-on-first-failing-constraint=\"false\"`\n\nvar Defaults = {\n // ### General\n\n // Default data-namespace for DOM API\n namespace: 'data-parsley-',\n\n // Supported inputs by default\n inputs: 'input, textarea, select',\n\n // Excluded inputs by default\n excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',\n\n // Stop validating field on highest priority failing constraint\n priorityEnabled: true,\n\n // ### Field only\n\n // identifier used to group together inputs (e.g. radio buttons...)\n multiple: null,\n\n // identifier (or array of identifiers) used to validate only a select group of inputs\n group: null,\n\n // ### UI\n // Enable\\Disable error messages\n uiEnabled: true,\n\n // Key events threshold before validation\n validationThreshold: 3,\n\n // Focused field on form validation error. 'first'|'last'|'none'\n focus: 'first',\n\n // event(s) that will trigger validation before first failure. eg: `input`...\n trigger: false,\n\n // event(s) that will trigger validation after first failure.\n triggerAfterFailure: 'input',\n\n // Class that would be added on every failing validation Parsley field\n errorClass: 'parsley-error',\n\n // Same for success validation\n successClass: 'parsley-success',\n\n // Return the `$element` that will receive these above success or error classes\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n classHandler: function (Field) {},\n\n // Return the `$element` where errors will be appended\n // Could also be (and given directly from DOM) a valid selector like `'#div'`\n errorsContainer: function (Field) {},\n\n // ul elem that would receive errors' list\n errorsWrapper: '
                ',\n\n // li elem that would receive error message\n errorTemplate: '
              • '\n};\n\nexport default Defaults;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar Base = function () {\n this.__id__ = Utils.generateID();\n};\n\nBase.prototype = {\n asyncSupport: true, // Deprecated\n\n _pipeAccordingToValidationResult: function () {\n var pipe = () => {\n var r = $.Deferred();\n if (true !== this.validationResult)\n r.reject();\n return r.resolve().promise();\n };\n return [pipe, pipe];\n },\n\n actualizeOptions: function () {\n Utils.attr(this.element, this.options.namespace, this.domOptions);\n if (this.parent && this.parent.actualizeOptions)\n this.parent.actualizeOptions();\n return this;\n },\n\n _resetOptions: function (initOptions) {\n this.domOptions = Utils.objectCreate(this.parent.options);\n this.options = Utils.objectCreate(this.domOptions);\n // Shallow copy of ownProperties of initOptions:\n for (var i in initOptions) {\n if (initOptions.hasOwnProperty(i))\n this.options[i] = initOptions[i];\n }\n this.actualizeOptions();\n },\n\n _listeners: null,\n\n // Register a callback for the given event name\n // Callback is called with context as the first argument and the `this`\n // The context is the current parsley instance, or window.Parsley if global\n // A return value of `false` will interrupt the calls\n on: function (name, fn) {\n this._listeners = this._listeners || {};\n var queue = this._listeners[name] = this._listeners[name] || [];\n queue.push(fn);\n\n return this;\n },\n\n // Deprecated. Use `on` instead\n subscribe: function(name, fn) {\n $.listenTo(this, name.toLowerCase(), fn);\n },\n\n // Unregister a callback (or all if none is given) for the given event name\n off: function (name, fn) {\n var queue = this._listeners && this._listeners[name];\n if (queue) {\n if (!fn) {\n delete this._listeners[name];\n } else {\n for (var i = queue.length; i--; )\n if (queue[i] === fn)\n queue.splice(i, 1);\n }\n }\n return this;\n },\n\n // Deprecated. Use `off`\n unsubscribe: function(name, fn) {\n $.unsubscribeTo(this, name.toLowerCase());\n },\n\n // Trigger an event of the given name\n // A return value of `false` interrupts the callback chain\n // Returns false if execution was interrupted\n trigger: function (name, target, extraArg) {\n target = target || this;\n var queue = this._listeners && this._listeners[name];\n var result;\n var parentResult;\n if (queue) {\n for (var i = queue.length; i--; ) {\n result = queue[i].call(target, target, extraArg);\n if (result === false) return result;\n }\n }\n if (this.parent) {\n return this.parent.trigger(name, target, extraArg);\n }\n return true;\n },\n\n asyncIsValid: function (group, force) {\n Utils.warnOnce(\"asyncIsValid is deprecated; please use whenValid instead\");\n return this.whenValid({group, force});\n },\n\n _findRelated: function () {\n return this.options.multiple ?\n $(this.parent.element.querySelectorAll(`[${this.options.namespace}multiple=\"${this.options.multiple}\"]`))\n : this.$element;\n }\n};\n\nexport default Base;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar convertArrayRequirement = function(string, length) {\n var m = string.match(/^\\s*\\[(.*)\\]\\s*$/);\n if (!m)\n throw 'Requirement is not an array: \"' + string + '\"';\n var values = m[1].split(',').map(Utils.trimString);\n if (values.length !== length)\n throw 'Requirement has ' + values.length + ' values when ' + length + ' are needed';\n return values;\n};\n\nvar convertExtraOptionRequirement = function(requirementSpec, string, extraOptionReader) {\n var main = null;\n var extra = {};\n for (var key in requirementSpec) {\n if (key) {\n var value = extraOptionReader(key);\n if ('string' === typeof value)\n value = Utils.parseRequirement(requirementSpec[key], value);\n extra[key] = value;\n } else {\n main = Utils.parseRequirement(requirementSpec[key], string);\n }\n }\n return [main, extra];\n};\n\n// A Validator needs to implement the methods `validate` and `parseRequirements`\n\nvar Validator = function(spec) {\n $.extend(true, this, spec);\n};\n\nValidator.prototype = {\n // Returns `true` iff the given `value` is valid according the given requirements.\n validate: function(value, requirementFirstArg) {\n if (this.fn) { // Legacy style validator\n\n if (arguments.length > 3) // If more args then value, requirement, instance...\n requirementFirstArg = [].slice.call(arguments, 1, -1); // Skip first arg (value) and last (instance), combining the rest\n return this.fn(value, requirementFirstArg);\n }\n\n if (Array.isArray(value)) {\n if (!this.validateMultiple)\n throw 'Validator `' + this.name + '` does not handle multiple values';\n return this.validateMultiple(...arguments);\n } else {\n let instance = arguments[arguments.length - 1];\n if (this.validateDate && instance._isDateInput()) {\n arguments[0] = Utils.parse.date(arguments[0]);\n if (arguments[0] === null)\n return false;\n return this.validateDate(...arguments);\n }\n if (this.validateNumber) {\n if (isNaN(value))\n return false;\n arguments[0] = parseFloat(arguments[0]);\n return this.validateNumber(...arguments);\n }\n if (this.validateString) {\n return this.validateString(...arguments);\n }\n throw 'Validator `' + this.name + '` only handles multiple values';\n }\n },\n\n // Parses `requirements` into an array of arguments,\n // according to `this.requirementType`\n parseRequirements: function(requirements, extraOptionReader) {\n if ('string' !== typeof requirements) {\n // Assume requirement already parsed\n // but make sure we return an array\n return Array.isArray(requirements) ? requirements : [requirements];\n }\n var type = this.requirementType;\n if (Array.isArray(type)) {\n var values = convertArrayRequirement(requirements, type.length);\n for (var i = 0; i < values.length; i++)\n values[i] = Utils.parseRequirement(type[i], values[i]);\n return values;\n } else if ($.isPlainObject(type)) {\n return convertExtraOptionRequirement(type, requirements, extraOptionReader);\n } else {\n return [Utils.parseRequirement(type, requirements)];\n }\n },\n // Defaults:\n requirementType: 'string',\n\n priority: 2\n\n};\n\nexport default Validator;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Defaults from './defaults';\nimport Validator from './validator';\n\nvar ValidatorRegistry = function (validators, catalog) {\n this.__class__ = 'ValidatorRegistry';\n\n // Default Parsley locale is en\n this.locale = 'en';\n\n this.init(validators || {}, catalog || {});\n};\n\nvar typeTesters = {\n email: /^((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-zA-Z]|\\d|-|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-zA-Z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/,\n\n // Follow https://www.w3.org/TR/html5/infrastructure.html#floating-point-numbers\n number: /^-?(\\d*\\.)?\\d+(e[-+]?\\d+)?$/i,\n\n integer: /^-?\\d+$/,\n\n digits: /^\\d+$/,\n\n alphanum: /^\\w+$/i,\n\n date: {\n test: value => Utils.parse.date(value) !== null\n },\n\n url: new RegExp(\n \"^\" +\n // protocol identifier\n \"(?:(?:https?|ftp)://)?\" + // ** mod: make scheme optional\n // user:pass authentication\n \"(?:\\\\S+(?::\\\\S*)?@)?\" +\n \"(?:\" +\n // IP address exclusion\n // private & local networks\n // \"(?!(?:10|127)(?:\\\\.\\\\d{1,3}){3})\" + // ** mod: allow local networks\n // \"(?!(?:169\\\\.254|192\\\\.168)(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // \"(?!172\\\\.(?:1[6-9]|2\\\\d|3[0-1])(?:\\\\.\\\\d{1,3}){2})\" + // ** mod: allow local networks\n // IP address dotted notation octets\n // excludes loopback network 0.0.0.0\n // excludes reserved space >= 224.0.0.0\n // excludes network & broacast addresses\n // (first & last IP address of each class)\n \"(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])\" +\n \"(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}\" +\n \"(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))\" +\n \"|\" +\n // host name\n \"(?:(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)\" +\n // domain name\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff0-9]-*)*[a-zA-Z\\\\u00a1-\\\\uffff0-9]+)*\" +\n // TLD identifier\n \"(?:\\\\.(?:[a-zA-Z\\\\u00a1-\\\\uffff]{2,}))\" +\n \")\" +\n // port number\n \"(?::\\\\d{2,5})?\" +\n // resource path\n \"(?:/\\\\S*)?\" +\n \"$\"\n )\n};\ntypeTesters.range = typeTesters.number;\n\n// See http://stackoverflow.com/a/10454560/8279\nvar decimalPlaces = num => {\n var match = ('' + num).match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n if (!match) { return 0; }\n return Math.max(\n 0,\n // Number of digits right of decimal point.\n (match[1] ? match[1].length : 0) -\n // Adjust for scientific notation.\n (match[2] ? +match[2] : 0));\n};\n\n// parseArguments('number', ['1', '2']) => [1, 2]\nlet parseArguments = (type, args) => args.map(Utils.parse[type]);\n// operatorToValidator returns a validating function for an operator function, applied to the given type\nlet operatorToValidator = (type, operator) => {\n return (value, ...requirementsAndInput) => {\n requirementsAndInput.pop(); // Get rid of `input` argument\n return operator(value, ...parseArguments(type, requirementsAndInput));\n };\n};\n\nlet comparisonOperator = operator => ({\n validateDate: operatorToValidator('date', operator),\n validateNumber: operatorToValidator('number', operator),\n requirementType: operator.length <= 2 ? 'string' : ['string', 'string'], // Support operators with a 1 or 2 requirement(s)\n priority: 30\n});\n\nValidatorRegistry.prototype = {\n init: function (validators, catalog) {\n this.catalog = catalog;\n // Copy prototype's validators:\n this.validators = Object.assign({}, this.validators);\n\n for (var name in validators)\n this.addValidator(name, validators[name].fn, validators[name].priority);\n\n window.Parsley.trigger('parsley:validator:init');\n },\n\n // Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n\n setLocale: function (locale) {\n if ('undefined' === typeof this.catalog[locale])\n throw new Error(locale + ' is not available in the catalog');\n\n this.locale = locale;\n\n return this;\n },\n\n // Add a new messages catalog for a given locale. Set locale for this catalog if set === `true`\n addCatalog: function (locale, messages, set) {\n if ('object' === typeof messages)\n this.catalog[locale] = messages;\n\n if (true === set)\n return this.setLocale(locale);\n\n return this;\n },\n\n // Add a specific message for a given constraint in a given locale\n addMessage: function (locale, name, message) {\n if ('undefined' === typeof this.catalog[locale])\n this.catalog[locale] = {};\n\n this.catalog[locale][name] = message;\n\n return this;\n },\n\n // Add messages for a given locale\n addMessages: function (locale, nameMessageObject) {\n for (var name in nameMessageObject)\n this.addMessage(locale, name, nameMessageObject[name]);\n\n return this;\n },\n\n // Add a new validator\n //\n // addValidator('custom', {\n // requirementType: ['integer', 'integer'],\n // validateString: function(value, from, to) {},\n // priority: 22,\n // messages: {\n // en: \"Hey, that's no good\",\n // fr: \"Aye aye, pas bon du tout\",\n // }\n // })\n //\n // Old API was addValidator(name, function, priority)\n //\n addValidator: function (name, arg1, arg2) {\n if (this.validators[name])\n Utils.warn('Validator \"' + name + '\" is already defined.');\n else if (Defaults.hasOwnProperty(name)) {\n Utils.warn('\"' + name + '\" is a restricted keyword and is not a valid validator name.');\n return;\n }\n return this._setValidator(...arguments);\n },\n\n hasValidator: function (name) {\n return !!this.validators[name];\n },\n\n updateValidator: function (name, arg1, arg2) {\n if (!this.validators[name]) {\n Utils.warn('Validator \"' + name + '\" is not already defined.');\n return this.addValidator(...arguments);\n }\n return this._setValidator(...arguments);\n },\n\n removeValidator: function (name) {\n if (!this.validators[name])\n Utils.warn('Validator \"' + name + '\" is not defined.');\n\n delete this.validators[name];\n\n return this;\n },\n\n _setValidator: function (name, validator, priority) {\n if ('object' !== typeof validator) {\n // Old style validator, with `fn` and `priority`\n validator = {\n fn: validator,\n priority: priority\n };\n }\n if (!validator.validate) {\n validator = new Validator(validator);\n }\n this.validators[name] = validator;\n\n for (var locale in validator.messages || {})\n this.addMessage(locale, name, validator.messages[locale]);\n\n return this;\n },\n\n getErrorMessage: function (constraint) {\n var message;\n\n // Type constraints are a bit different, we have to match their requirements too to find right error message\n if ('type' === constraint.name) {\n var typeMessages = this.catalog[this.locale][constraint.name] || {};\n message = typeMessages[constraint.requirements];\n } else\n message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements);\n\n return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage;\n },\n\n // Kind of light `sprintf()` implementation\n formatMessage: function (string, parameters) {\n if ('object' === typeof parameters) {\n for (var i in parameters)\n string = this.formatMessage(string, parameters[i]);\n\n return string;\n }\n\n return 'string' === typeof string ? string.replace(/%s/i, parameters) : '';\n },\n\n // Here is the Parsley default validators list.\n // A validator is an object with the following key values:\n // - priority: an integer\n // - requirement: 'string' (default), 'integer', 'number', 'regexp' or an Array of these\n // - validateString, validateMultiple, validateNumber: functions returning `true`, `false` or a promise\n // Alternatively, a validator can be a function that returns such an object\n //\n validators: {\n notblank: {\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 2\n },\n required: {\n validateMultiple: function(values) {\n return values.length > 0;\n },\n validateString: function(value) {\n return /\\S/.test(value);\n },\n priority: 512\n },\n type: {\n validateString: function(value, type, {step = 'any', base = 0} = {}) {\n var tester = typeTesters[type];\n if (!tester) {\n throw new Error('validator type `' + type + '` is not supported');\n }\n if (!tester.test(value))\n return false;\n if ('number' === type) {\n if (!/^any$/i.test(step || '')) {\n var nb = Number(value);\n var decimals = Math.max(decimalPlaces(step), decimalPlaces(base));\n if (decimalPlaces(nb) > decimals) // Value can't have too many decimals\n return false;\n // Be careful of rounding errors by using integers.\n var toInt = f => Math.round(f * Math.pow(10, decimals));\n if ((toInt(nb) - toInt(base)) % toInt(step) != 0)\n return false;\n }\n }\n return true;\n },\n requirementType: {\n '': 'string',\n step: 'string',\n base: 'number'\n },\n priority: 256\n },\n pattern: {\n validateString: function(value, regexp) {\n return regexp.test(value);\n },\n requirementType: 'regexp',\n priority: 64\n },\n minlength: {\n validateString: function (value, requirement) {\n return value.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxlength: {\n validateString: function (value, requirement) {\n return value.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n length: {\n validateString: function (value, min, max) {\n return value.length >= min && value.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n mincheck: {\n validateMultiple: function (values, requirement) {\n return values.length >= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n maxcheck: {\n validateMultiple: function (values, requirement) {\n return values.length <= requirement;\n },\n requirementType: 'integer',\n priority: 30\n },\n check: {\n validateMultiple: function (values, min, max) {\n return values.length >= min && values.length <= max;\n },\n requirementType: ['integer', 'integer'],\n priority: 30\n },\n min: comparisonOperator((value, requirement) => value >= requirement),\n max: comparisonOperator((value, requirement) => value <= requirement),\n range: comparisonOperator((value, min, max) => value >= min && value <= max),\n equalto: {\n validateString: function (value, refOrValue) {\n var $reference = $(refOrValue);\n if ($reference.length)\n return value === $reference.val();\n else\n return value === refOrValue;\n },\n priority: 256\n }\n }\n};\n\nexport default ValidatorRegistry;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar UI = {};\n\nvar diffResults = function (newResult, oldResult, deep) {\n var added = [];\n var kept = [];\n\n for (var i = 0; i < newResult.length; i++) {\n var found = false;\n\n for (var j = 0; j < oldResult.length; j++)\n if (newResult[i].assert.name === oldResult[j].assert.name) {\n found = true;\n break;\n }\n\n if (found)\n kept.push(newResult[i]);\n else\n added.push(newResult[i]);\n }\n\n return {\n kept: kept,\n added: added,\n removed: !deep ? diffResults(oldResult, newResult, true).added : []\n };\n};\n\nUI.Form = {\n\n _actualizeTriggers: function () {\n this.$element.on('submit.Parsley', evt => { this.onSubmitValidate(evt); });\n this.$element.on('click.Parsley', Utils._SubmitSelector, evt => { this.onSubmitButton(evt); });\n\n // UI could be disabled\n if (false === this.options.uiEnabled)\n return;\n\n this.element.setAttribute('novalidate', '');\n },\n\n focus: function () {\n this._focusedField = null;\n\n if (true === this.validationResult || 'none' === this.options.focus)\n return null;\n\n for (var i = 0; i < this.fields.length; i++) {\n var field = this.fields[i];\n if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) {\n this._focusedField = field.$element;\n if ('first' === this.options.focus)\n break;\n }\n }\n\n if (null === this._focusedField)\n return null;\n\n return this._focusedField.focus();\n },\n\n _destroyUI: function () {\n // Reset all event listeners\n this.$element.off('.Parsley');\n }\n\n};\n\nUI.Field = {\n\n _reflowUI: function () {\n this._buildUI();\n\n // If this field doesn't have an active UI don't bother doing something\n if (!this._ui)\n return;\n\n // Diff between two validation results\n var diff = diffResults(this.validationResult, this._ui.lastValidationResult);\n\n // Then store current validation result for next reflow\n this._ui.lastValidationResult = this.validationResult;\n\n // Handle valid / invalid / none field class\n this._manageStatusClass();\n\n // Add, remove, updated errors messages\n this._manageErrorsMessages(diff);\n\n // Triggers impl\n this._actualizeTriggers();\n\n // If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user\n if ((diff.kept.length || diff.added.length) && !this._failedOnce) {\n this._failedOnce = true;\n this._actualizeTriggers();\n }\n },\n\n // Returns an array of field's error message(s)\n getErrorsMessages: function () {\n // No error message, field is valid\n if (true === this.validationResult)\n return [];\n\n var messages = [];\n\n for (var i = 0; i < this.validationResult.length; i++)\n messages.push(this.validationResult[i].errorMessage ||\n this._getErrorMessage(this.validationResult[i].assert));\n\n return messages;\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n addError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._addError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n updateError: function (name, {message, assert, updateClass = true} = {}) {\n this._buildUI();\n this._updateError(name, {message, assert});\n\n if (updateClass)\n this._errorClass();\n },\n\n // It's a goal of Parsley that this method is no longer required [#1073]\n removeError: function (name, {updateClass = true} = {}) {\n this._buildUI();\n this._removeError(name);\n\n // edge case possible here: remove a standard Parsley error that is still failing in this.validationResult\n // but highly improbable cuz' manually removing a well Parsley handled error makes no sense.\n if (updateClass)\n this._manageStatusClass();\n },\n\n _manageStatusClass: function () {\n if (this.hasConstraints() && this.needsValidation() && true === this.validationResult)\n this._successClass();\n else if (this.validationResult.length > 0)\n this._errorClass();\n else\n this._resetClass();\n },\n\n _manageErrorsMessages: function (diff) {\n if ('undefined' !== typeof this.options.errorsMessagesDisabled)\n return;\n\n // Case where we have errorMessage option that configure an unique field error message, regardless failing validators\n if ('undefined' !== typeof this.options.errorMessage) {\n if ((diff.added.length || diff.kept.length)) {\n this._insertErrorWrapper();\n\n if (0 === this._ui.$errorsWrapper.find('.parsley-custom-error-message').length)\n this._ui.$errorsWrapper\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-custom-error-message')\n );\n\n return this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-custom-error-message')\n .html(this.options.errorMessage);\n }\n\n return this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-custom-error-message')\n .remove();\n }\n\n // Show, hide, update failing constraints messages\n for (var i = 0; i < diff.removed.length; i++)\n this._removeError(diff.removed[i].assert.name);\n\n for (i = 0; i < diff.added.length; i++)\n this._addError(diff.added[i].assert.name, {message: diff.added[i].errorMessage, assert: diff.added[i].assert});\n\n for (i = 0; i < diff.kept.length; i++)\n this._updateError(diff.kept[i].assert.name, {message: diff.kept[i].errorMessage, assert: diff.kept[i].assert});\n },\n\n\n _addError: function (name, {message, assert}) {\n this._insertErrorWrapper();\n this._ui.$errorClassHandler\n .attr('aria-describedby', this._ui.errorsWrapperId);\n this._ui.$errorsWrapper\n .addClass('filled')\n .append(\n $(this.options.errorTemplate)\n .addClass('parsley-' + name)\n .html(message || this._getErrorMessage(assert))\n );\n },\n\n _updateError: function (name, {message, assert}) {\n this._ui.$errorsWrapper\n .addClass('filled')\n .find('.parsley-' + name)\n .html(message || this._getErrorMessage(assert));\n },\n\n _removeError: function (name) {\n this._ui.$errorClassHandler\n .removeAttr('aria-describedby');\n this._ui.$errorsWrapper\n .removeClass('filled')\n .find('.parsley-' + name)\n .remove();\n },\n\n _getErrorMessage: function (constraint) {\n var customConstraintErrorMessage = constraint.name + 'Message';\n\n if ('undefined' !== typeof this.options[customConstraintErrorMessage])\n return window.Parsley.formatMessage(this.options[customConstraintErrorMessage], constraint.requirements);\n\n return window.Parsley.getErrorMessage(constraint);\n },\n\n _buildUI: function () {\n // UI could be already built or disabled\n if (this._ui || false === this.options.uiEnabled)\n return;\n\n var _ui = {};\n\n // Give field its Parsley id in DOM\n this.element.setAttribute(this.options.namespace + 'id', this.__id__);\n\n /** Generate important UI elements and store them in this **/\n // $errorClassHandler is the $element that woul have parsley-error and parsley-success classes\n _ui.$errorClassHandler = this._manageClassHandler();\n\n // $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer\n _ui.errorsWrapperId = 'parsley-id-' + (this.options.multiple ? 'multiple-' + this.options.multiple : this.__id__);\n _ui.$errorsWrapper = $(this.options.errorsWrapper).attr('id', _ui.errorsWrapperId);\n\n // ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly\n _ui.lastValidationResult = [];\n _ui.validationInformationVisible = false;\n\n // Store it in this for later\n this._ui = _ui;\n },\n\n // Determine which element will have `parsley-error` and `parsley-success` classes\n _manageClassHandler: function () {\n // Class handled could also be determined by function given in Parsley options\n if ('string' === typeof this.options.classHandler && $(this.options.classHandler).length)\n return $(this.options.classHandler);\n\n // Class handled could also be determined by function given in Parsley options\n var $handlerFunction = this.options.classHandler;\n\n // It might also be the function name of a global function\n if ('string' === typeof this.options.classHandler && 'function' === typeof window[this.options.classHandler])\n $handlerFunction = window[this.options.classHandler];\n\n if ('function' === typeof $handlerFunction) {\n var $handler = $handlerFunction.call(this, this);\n\n // If this function returned a valid existing DOM element, go for it\n if ('undefined' !== typeof $handler && $handler.length)\n return $handler;\n } else if ('object' === typeof $handlerFunction && $handlerFunction instanceof jQuery && $handlerFunction.length) {\n return $handlerFunction;\n } else if ($handlerFunction) {\n Utils.warn('The class handler `' + $handlerFunction + '` does not exist in DOM nor as a global JS function');\n }\n\n return this._inputHolder();\n },\n\n _inputHolder: function() {\n // if simple element (input, texatrea, select...) it will perfectly host the classes and precede the error container\n if (!this.options.multiple || this.element.nodeName === 'SELECT')\n return this.$element;\n\n // But if multiple element (radio, checkbox), that would be their parent\n return this.$element.parent();\n },\n\n _insertErrorWrapper: function () {\n var $errorsContainer = this.options.errorsContainer;\n\n // Nothing to do if already inserted\n if (0 !== this._ui.$errorsWrapper.parent().length)\n return this._ui.$errorsWrapper.parent();\n\n if ('string' === typeof $errorsContainer) {\n if ($($errorsContainer).length)\n return $($errorsContainer).append(this._ui.$errorsWrapper);\n else if ('function' === typeof window[$errorsContainer])\n $errorsContainer = window[$errorsContainer];\n else\n Utils.warn('The errors container `' + $errorsContainer + '` does not exist in DOM nor as a global JS function');\n }\n\n if ('function' === typeof $errorsContainer)\n $errorsContainer = $errorsContainer.call(this, this);\n\n if ('object' === typeof $errorsContainer && $errorsContainer.length)\n return $errorsContainer.append(this._ui.$errorsWrapper);\n\n return this._inputHolder().after(this._ui.$errorsWrapper);\n },\n\n _actualizeTriggers: function () {\n var $toBind = this._findRelated();\n var trigger;\n\n // Remove Parsley events already bound on this field\n $toBind.off('.Parsley');\n if (this._failedOnce)\n $toBind.on(Utils.namespaceEvents(this.options.triggerAfterFailure, 'Parsley'), () => {\n this._validateIfNeeded();\n });\n else if (trigger = Utils.namespaceEvents(this.options.trigger, 'Parsley')) {\n $toBind.on(trigger, event => {\n this._validateIfNeeded(event);\n });\n }\n },\n\n _validateIfNeeded: function (event) {\n // For keyup, keypress, keydown, input... events that could be a little bit obstrusive\n // do not validate if val length < min threshold on first validation. Once field have been validated once and info\n // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.\n if (event && /key|input/.test(event.type))\n if (!(this._ui && this._ui.validationInformationVisible) && this.getValue().length <= this.options.validationThreshold)\n return;\n\n if (this.options.debounce) {\n window.clearTimeout(this._debounced);\n this._debounced = window.setTimeout(() => this.validate(), this.options.debounce);\n } else\n this.validate();\n },\n\n _resetUI: function () {\n // Reset all event listeners\n this._failedOnce = false;\n this._actualizeTriggers();\n\n // Nothing to do if UI never initialized for this field\n if ('undefined' === typeof this._ui)\n return;\n\n // Reset all errors' li\n this._ui.$errorsWrapper\n .removeClass('filled')\n .children()\n .remove();\n\n // Reset validation class\n this._resetClass();\n\n // Reset validation flags and last validation result\n this._ui.lastValidationResult = [];\n this._ui.validationInformationVisible = false;\n },\n\n _destroyUI: function () {\n this._resetUI();\n\n if ('undefined' !== typeof this._ui)\n this._ui.$errorsWrapper.remove();\n\n delete this._ui;\n },\n\n _successClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass);\n },\n _errorClass: function () {\n this._ui.validationInformationVisible = true;\n this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass);\n },\n _resetClass: function () {\n this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass);\n }\n};\n\nexport default UI;\n","import $ from 'jquery';\nimport Base from './base';\nimport Utils from './utils';\n\nvar Form = function (element, domOptions, options) {\n this.__class__ = 'Form';\n\n this.element = element;\n this.$element = $(element);\n this.domOptions = domOptions;\n this.options = options;\n this.parent = window.Parsley;\n\n this.fields = [];\n this.validationResult = null;\n};\n\nvar statusMapping = {pending: null, resolved: true, rejected: false};\n\nForm.prototype = {\n onSubmitValidate: function (event) {\n // This is a Parsley generated submit event, do not validate, do not prevent, simply exit and keep normal behavior\n if (true === event.parsley)\n return;\n\n // If we didn't come here through a submit button, use the first one in the form\n var submitSource = this._submitSource || this.$element.find(Utils._SubmitSelector)[0];\n this._submitSource = null;\n this.$element.find('.parsley-synthetic-submit-button').prop('disabled', true);\n if (submitSource && null !== submitSource.getAttribute('formnovalidate'))\n return;\n\n window.Parsley._remoteCache = {};\n\n var promise = this.whenValidate({event});\n\n if ('resolved' === promise.state() && false !== this._trigger('submit')) {\n // All good, let event go through. We make this distinction because browsers\n // differ in their handling of `submit` being called from inside a submit event [#1047]\n } else {\n // Rejected or pending: cancel this submit\n event.stopImmediatePropagation();\n event.preventDefault();\n if ('pending' === promise.state())\n promise.done(() => { this._submit(submitSource); });\n }\n },\n\n onSubmitButton: function(event) {\n this._submitSource = event.currentTarget;\n },\n // internal\n // _submit submits the form, this time without going through the validations.\n // Care must be taken to \"fake\" the actual submit button being clicked.\n _submit: function (submitSource) {\n if (false === this._trigger('submit'))\n return;\n // Add submit button's data\n if (submitSource) {\n var $synthetic = this.$element.find('.parsley-synthetic-submit-button').prop('disabled', false);\n if (0 === $synthetic.length)\n $synthetic = $('').appendTo(this.$element);\n $synthetic.attr({\n name: submitSource.getAttribute('name'),\n value: submitSource.getAttribute('value')\n });\n }\n\n this.$element.trigger(Object.assign($.Event('submit'), {parsley: true}));\n },\n\n // Performs validation on fields while triggering events.\n // @returns `true` if all validations succeeds, `false`\n // if a failure is immediately detected, or `null`\n // if dependant on a promise.\n // Consider using `whenValidate` instead.\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley form without passing arguments as an object is deprecated.');\n var [group, force, event] = arguments;\n options = {group, force, event};\n }\n return statusMapping[ this.whenValidate(options).state() ];\n },\n\n whenValidate: function ({group, force, event} = {}) {\n this.submitEvent = event;\n if (event) {\n this.submitEvent = Object.assign({}, event, {preventDefault: () => {\n Utils.warnOnce(\"Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`\");\n this.validationResult = false;\n }});\n }\n this.validationResult = true;\n\n // fire validate event to eventually modify things before every validation\n this._trigger('validate');\n\n // Refresh form DOM options and form's fields that could have changed\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValidate({force, group}));\n });\n\n return Utils.all(promises)\n .done( () => { this._trigger('success'); })\n .fail( () => {\n this.validationResult = false;\n this.focus();\n this._trigger('error');\n })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n // Iterate over refreshed fields, and stop on first failure.\n // Returns `true` if all fields are valid, `false` if a failure is detected\n // or `null` if the result depends on an unresolved promise.\n // Prefer using `whenValid` instead.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley form without passing arguments as an object is deprecated.');\n var [group, force] = arguments;\n options = {group, force};\n }\n return statusMapping[ this.whenValid(options).state() ];\n },\n\n // Iterate over refreshed fields and validate them.\n // Returns a promise.\n // A validation that immediately fails will interrupt the validations.\n whenValid: function ({group, force} = {}) {\n this._refreshFields();\n\n var promises = this._withoutReactualizingFormOptions(() => {\n return $.map(this.fields, field => field.whenValid({group, force}));\n });\n return Utils.all(promises);\n },\n\n refresh: function() {\n this._refreshFields();\n return this;\n },\n\n // Reset UI\n reset: function () {\n // Form case: emit a reset event for each field\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].reset();\n\n this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n\n // Form case: destroy all its fields and then destroy stored instance\n for (var i = 0; i < this.fields.length; i++)\n this.fields[i].destroy();\n\n this.$element.removeData('Parsley');\n this._trigger('destroy');\n },\n\n _refreshFields: function () {\n return this.actualizeOptions()._bindFields();\n },\n\n _bindFields: function () {\n var oldFields = this.fields;\n\n this.fields = [];\n this.fieldsMappedById = {};\n\n this._withoutReactualizingFormOptions(() => {\n this.$element\n .find(this.options.inputs)\n .not(this.options.excluded)\n .each((_, element) => {\n var fieldInstance = new window.Parsley.Factory(element, {}, this);\n\n // Only add valid and not excluded `Field` and `FieldMultiple` children\n if (('Field' === fieldInstance.__class__ || 'FieldMultiple' === fieldInstance.__class__) && (true !== fieldInstance.options.excluded)) {\n let uniqueId = fieldInstance.__class__ + '-' + fieldInstance.__id__;\n if ('undefined' === typeof this.fieldsMappedById[uniqueId]) {\n this.fieldsMappedById[uniqueId] = fieldInstance;\n this.fields.push(fieldInstance);\n }\n }\n });\n\n $.each(Utils.difference(oldFields, this.fields), (_, field) => {\n field.reset();\n });\n });\n return this;\n },\n\n // Internal only.\n // Looping on a form's fields to do validation or similar\n // will trigger reactualizing options on all of them, which\n // in turn will reactualize the form's options.\n // To avoid calling actualizeOptions so many times on the form\n // for nothing, _withoutReactualizingFormOptions temporarily disables\n // the method actualizeOptions on this form while `fn` is called.\n _withoutReactualizingFormOptions: function (fn) {\n var oldActualizeOptions = this.actualizeOptions;\n this.actualizeOptions = function () { return this; };\n var result = fn();\n this.actualizeOptions = oldActualizeOptions;\n return result;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n // Returns true iff event is not interrupted and default not prevented.\n _trigger: function (eventName) {\n return this.trigger('form:' + eventName);\n }\n\n};\n\nexport default Form;\n","import Utils from './utils';\nimport Validator from './validator';\n\nconst Constraint = function(parsleyField, name, requirements, priority, isDomConstraint) {\n const validatorSpec = window.Parsley._validatorRegistry.validators[name];\n const validator = new Validator(validatorSpec);\n priority = priority || parsleyField.options[name + 'Priority'] || validator.priority;\n isDomConstraint = (true === isDomConstraint);\n\n Object.assign(this, {\n validator,\n name,\n requirements,\n priority,\n isDomConstraint\n });\n this._parseRequirements(parsleyField.options);\n};\n\nconst capitalize = function(str) {\n const cap = str[0].toUpperCase();\n return cap + str.slice(1);\n};\n\nConstraint.prototype = {\n validate: function(value, instance) {\n return this.validator.validate(value, ...this.requirementList, instance);\n },\n\n _parseRequirements: function(options) {\n this.requirementList = this.validator.parseRequirements(this.requirements,\n key => options[this.name + capitalize(key)]\n );\n }\n};\n\nexport default Constraint;\n","import $ from 'jquery';\nimport Constraint from './constraint';\nimport UI from './ui';\nimport Utils from './utils';\n\nvar Field = function (field, domOptions, options, parsleyFormInstance) {\n this.__class__ = 'Field';\n\n this.element = field;\n this.$element = $(field);\n\n // Set parent if we have one\n if ('undefined' !== typeof parsleyFormInstance) {\n this.parent = parsleyFormInstance;\n }\n\n this.options = options;\n this.domOptions = domOptions;\n\n // Initialize some properties\n this.constraints = [];\n this.constraintsByName = {};\n this.validationResult = true;\n\n // Bind constraints\n this._bindConstraints();\n};\n\nvar statusMapping = {pending: null, resolved: true, rejected: false};\n\nField.prototype = {\n // # Public API\n // Validate field and trigger some events for mainly `UI`\n // @returns `true`, an array of the validators that failed, or\n // `null` if validation is not finished. Prefer using whenValidate\n validate: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling validate on a parsley field without passing arguments as an object is deprecated.');\n options = {options};\n }\n var promise = this.whenValidate(options);\n if (!promise) // If excluded with `group` option\n return true;\n switch (promise.state()) {\n case 'pending': return null;\n case 'resolved': return true;\n case 'rejected': return this.validationResult;\n }\n },\n\n // Validate field and trigger some events for mainly `UI`\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if field is not in the given `group`.\n whenValidate: function ({force, group} = {}) {\n // do not validate a field if not the same as given validation group\n this.refresh();\n if (group && !this._isInGroup(group))\n return;\n\n this.value = this.getValue();\n\n // Field Validate event. `this.value` could be altered for custom needs\n this._trigger('validate');\n\n return this.whenValid({force, value: this.value, _refreshed: true})\n .always(() => { this._reflowUI(); })\n .done(() => { this._trigger('success'); })\n .fail(() => { this._trigger('error'); })\n .always(() => { this._trigger('validated'); })\n .pipe(...this._pipeAccordingToValidationResult());\n },\n\n hasConstraints: function () {\n return 0 !== this.constraints.length;\n },\n\n // An empty optional field does not need validation\n needsValidation: function (value) {\n if ('undefined' === typeof value)\n value = this.getValue();\n\n // If a field is empty and not required, it is valid\n // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators\n if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty)\n return false;\n\n return true;\n },\n\n _isInGroup: function (group) {\n if (Array.isArray(this.options.group))\n return -1 !== $.inArray(group, this.options.group);\n return this.options.group === group;\n },\n\n // Just validate field. Do not trigger any event.\n // Returns `true` iff all constraints pass, `false` if there are failures,\n // or `null` if the result can not be determined yet (depends on a promise)\n // See also `whenValid`.\n isValid: function (options) {\n if (arguments.length >= 1 && !$.isPlainObject(options)) {\n Utils.warnOnce('Calling isValid on a parsley field without passing arguments as an object is deprecated.');\n var [force, value] = arguments;\n options = {force, value};\n }\n var promise = this.whenValid(options);\n if (!promise) // Excluded via `group`\n return true;\n return statusMapping[promise.state()];\n },\n\n // Just validate field. Do not trigger any event.\n // @returns a promise that succeeds only when all validations do\n // or `undefined` if the field is not in the given `group`.\n // The argument `force` will force validation of empty fields.\n // If a `value` is given, it will be validated instead of the value of the input.\n whenValid: function ({force = false, value, group, _refreshed} = {}) {\n // Recompute options and rebind constraints to have latest changes\n if (!_refreshed)\n this.refresh();\n // do not validate a field if not the same as given validation group\n if (group && !this._isInGroup(group))\n return;\n\n this.validationResult = true;\n\n // A field without constraint is valid\n if (!this.hasConstraints())\n return $.when();\n\n // Value could be passed as argument, needed to add more power to 'field:validate'\n if ('undefined' === typeof value || null === value)\n value = this.getValue();\n\n if (!this.needsValidation(value) && true !== force)\n return $.when();\n\n var groupedConstraints = this._getGroupedConstraints();\n var promises = [];\n $.each(groupedConstraints, (_, constraints) => {\n // Process one group of constraints at a time, we validate the constraints\n // and combine the promises together.\n var promise = Utils.all(\n $.map(constraints, constraint => this._validateConstraint(value, constraint))\n );\n promises.push(promise);\n if (promise.state() === 'rejected')\n return false; // Interrupt processing if a group has already failed\n });\n return Utils.all(promises);\n },\n\n // @returns a promise\n _validateConstraint: function(value, constraint) {\n var result = constraint.validate(value, this);\n // Map false to a failed promise\n if (false === result)\n result = $.Deferred().reject();\n // Make sure we return a promise and that we record failures\n return Utils.all([result]).fail(errorMessage => {\n if (!(this.validationResult instanceof Array))\n this.validationResult = [];\n this.validationResult.push({\n assert: constraint,\n errorMessage: 'string' === typeof errorMessage && errorMessage\n });\n });\n },\n\n // @returns Parsley field computed value that could be overrided or configured in DOM\n getValue: function () {\n var value;\n\n // Value could be overriden in DOM or with explicit options\n if ('function' === typeof this.options.value)\n value = this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n value = this.options.value;\n else\n value = this.$element.val();\n\n // Handle wrong DOM or configurations\n if ('undefined' === typeof value || null === value)\n return '';\n\n return this._handleWhitespace(value);\n },\n\n // Reset UI\n reset: function () {\n this._resetUI();\n return this._trigger('reset');\n },\n\n // Destroy Parsley instance (+ UI)\n destroy: function () {\n // Field case: emit destroy event to clean UI and then destroy stored instance\n this._destroyUI();\n this.$element.removeData('Parsley');\n this.$element.removeData('FieldMultiple');\n this._trigger('destroy');\n },\n\n // Actualize options and rebind constraints\n refresh: function () {\n this._refreshConstraints();\n return this;\n },\n\n _refreshConstraints: function () {\n return this.actualizeOptions()._bindConstraints();\n },\n\n refreshConstraints: function() {\n Utils.warnOnce(\"Parsley's refreshConstraints is deprecated. Please use refresh\");\n return this.refresh();\n },\n\n /**\n * Add a new constraint to a field\n *\n * @param {String} name\n * @param {Mixed} requirements optional\n * @param {Number} priority optional\n * @param {Boolean} isDomConstraint optional\n */\n addConstraint: function (name, requirements, priority, isDomConstraint) {\n\n if (window.Parsley._validatorRegistry.validators[name]) {\n var constraint = new Constraint(this, name, requirements, priority, isDomConstraint);\n\n // if constraint already exist, delete it and push new version\n if ('undefined' !== this.constraintsByName[constraint.name])\n this.removeConstraint(constraint.name);\n\n this.constraints.push(constraint);\n this.constraintsByName[constraint.name] = constraint;\n }\n\n return this;\n },\n\n // Remove a constraint\n removeConstraint: function (name) {\n for (var i = 0; i < this.constraints.length; i++)\n if (name === this.constraints[i].name) {\n this.constraints.splice(i, 1);\n break;\n }\n delete this.constraintsByName[name];\n return this;\n },\n\n // Update a constraint (Remove + re-add)\n updateConstraint: function (name, parameters, priority) {\n return this.removeConstraint(name)\n .addConstraint(name, parameters, priority);\n },\n\n // # Internals\n\n // Internal only.\n // Bind constraints from config + options + DOM\n _bindConstraints: function () {\n var constraints = [];\n var constraintsByName = {};\n\n // clean all existing DOM constraints to only keep javascript user constraints\n for (var i = 0; i < this.constraints.length; i++)\n if (false === this.constraints[i].isDomConstraint) {\n constraints.push(this.constraints[i]);\n constraintsByName[this.constraints[i].name] = this.constraints[i];\n }\n\n this.constraints = constraints;\n this.constraintsByName = constraintsByName;\n\n // then re-add Parsley DOM-API constraints\n for (var name in this.options)\n this.addConstraint(name, this.options[name], undefined, true);\n\n // finally, bind special HTML5 constraints\n return this._bindHtml5Constraints();\n },\n\n // Internal only.\n // Bind specific HTML5 constraints to be HTML5 compliant\n _bindHtml5Constraints: function () {\n // html5 required\n if (null !== this.element.getAttribute('required'))\n this.addConstraint('required', true, undefined, true);\n\n // html5 pattern\n if (null !== this.element.getAttribute('pattern'))\n this.addConstraint('pattern', this.element.getAttribute('pattern'), undefined, true);\n\n // range\n let min = this.element.getAttribute('min');\n let max = this.element.getAttribute('max');\n if (null !== min && null !== max)\n this.addConstraint('range', [min, max], undefined, true);\n\n // HTML5 min\n else if (null !== min)\n this.addConstraint('min', min, undefined, true);\n\n // HTML5 max\n else if (null !== max)\n this.addConstraint('max', max, undefined, true);\n\n\n // length\n if (null !== this.element.getAttribute('minlength') && null !== this.element.getAttribute('maxlength'))\n this.addConstraint('length', [this.element.getAttribute('minlength'), this.element.getAttribute('maxlength')], undefined, true);\n\n // HTML5 minlength\n else if (null !== this.element.getAttribute('minlength'))\n this.addConstraint('minlength', this.element.getAttribute('minlength'), undefined, true);\n\n // HTML5 maxlength\n else if (null !== this.element.getAttribute('maxlength'))\n this.addConstraint('maxlength', this.element.getAttribute('maxlength'), undefined, true);\n\n\n // html5 types\n var type = Utils.getType(this.element);\n\n // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise\n if ('number' === type) {\n return this.addConstraint('type', ['number', {\n step: this.element.getAttribute('step') || '1',\n base: min || this.element.getAttribute('value')\n }], undefined, true);\n // Regular other HTML5 supported types\n } else if (/^(email|url|range|date)$/i.test(type)) {\n return this.addConstraint('type', type, undefined, true);\n }\n return this;\n },\n\n // Internal only.\n // Field is required if have required constraint without `false` value\n _isRequired: function () {\n if ('undefined' === typeof this.constraintsByName.required)\n return false;\n\n return false !== this.constraintsByName.required.requirements;\n },\n\n // Internal only.\n // Shortcut to trigger an event\n _trigger: function (eventName) {\n return this.trigger('field:' + eventName);\n },\n\n // Internal only\n // Handles whitespace in a value\n // Use `data-parsley-whitespace=\"squish\"` to auto squish input value\n // Use `data-parsley-whitespace=\"trim\"` to auto trim input value\n _handleWhitespace: function (value) {\n if (true === this.options.trimValue)\n Utils.warnOnce('data-parsley-trim-value=\"true\" is deprecated, please use data-parsley-whitespace=\"trim\"');\n\n if ('squish' === this.options.whitespace)\n value = value.replace(/\\s{2,}/g, ' ');\n\n if (('trim' === this.options.whitespace) || ('squish' === this.options.whitespace) || (true === this.options.trimValue))\n value = Utils.trimString(value);\n\n return value;\n },\n\n _isDateInput: function() {\n var c = this.constraintsByName.type;\n return c && c.requirements === 'date';\n },\n\n // Internal only.\n // Returns the constraints, grouped by descending priority.\n // The result is thus an array of arrays of constraints.\n _getGroupedConstraints: function () {\n if (false === this.options.priorityEnabled)\n return [this.constraints];\n\n var groupedConstraints = [];\n var index = {};\n\n // Create array unique of priorities\n for (var i = 0; i < this.constraints.length; i++) {\n var p = this.constraints[i].priority;\n if (!index[p])\n groupedConstraints.push(index[p] = []);\n index[p].push(this.constraints[i]);\n }\n // Sort them by priority DESC\n groupedConstraints.sort(function (a, b) { return b[0].priority - a[0].priority; });\n\n return groupedConstraints;\n }\n\n};\n\nexport default Field;\n","import $ from 'jquery';\nimport Utils from './utils';\n\nvar Multiple = function () {\n this.__class__ = 'FieldMultiple';\n};\n\nMultiple.prototype = {\n // Add new `$element` sibling for multiple field\n addElement: function ($element) {\n this.$elements.push($element);\n\n return this;\n },\n\n // See `Field._refreshConstraints()`\n _refreshConstraints: function () {\n var fieldConstraints;\n\n this.constraints = [];\n\n // Select multiple special treatment\n if (this.element.nodeName === 'SELECT') {\n this.actualizeOptions()._bindConstraints();\n\n return this;\n }\n\n // Gather all constraints for each input in the multiple group\n for (var i = 0; i < this.$elements.length; i++) {\n\n // Check if element have not been dynamically removed since last binding\n if (!$('html').has(this.$elements[i]).length) {\n this.$elements.splice(i, 1);\n continue;\n }\n\n fieldConstraints = this.$elements[i].data('FieldMultiple')._refreshConstraints().constraints;\n\n for (var j = 0; j < fieldConstraints.length; j++)\n this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint);\n }\n\n return this;\n },\n\n // See `Field.getValue()`\n getValue: function () {\n // Value could be overriden in DOM\n if ('function' === typeof this.options.value)\n return this.options.value(this);\n else if ('undefined' !== typeof this.options.value)\n return this.options.value;\n\n // Radio input case\n if (this.element.nodeName === 'INPUT') {\n var type = Utils.getType(this.element);\n if (type === 'radio')\n return this._findRelated().filter(':checked').val() || '';\n\n // checkbox input case\n if (type === 'checkbox') {\n var values = [];\n\n this._findRelated().filter(':checked').each(function () {\n values.push($(this).val());\n });\n\n return values;\n }\n }\n\n // Select multiple case\n if (this.element.nodeName === 'SELECT' && null === this.$element.val())\n return [];\n\n // Default case that should never happen\n return this.$element.val();\n },\n\n _init: function () {\n this.$elements = [this.$element];\n\n return this;\n }\n};\n\nexport default Multiple;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Base from './base';\nimport Form from './form';\nimport Field from './field';\nimport Multiple from './multiple';\n\nvar Factory = function (element, options, parsleyFormInstance) {\n this.element = element;\n this.$element = $(element);\n\n // If the element has already been bound, returns its saved Parsley instance\n var savedparsleyFormInstance = this.$element.data('Parsley');\n if (savedparsleyFormInstance) {\n\n // If the saved instance has been bound without a Form parent and there is one given in this call, add it\n if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) {\n savedparsleyFormInstance.parent = parsleyFormInstance;\n savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);\n }\n\n if ('object' === typeof options) {\n Object.assign(savedparsleyFormInstance.options, options);\n }\n\n return savedparsleyFormInstance;\n }\n\n // Parsley must be instantiated with a DOM element or jQuery $element\n if (!this.$element.length)\n throw new Error('You must bind Parsley on an existing element.');\n\n if ('undefined' !== typeof parsleyFormInstance && 'Form' !== parsleyFormInstance.__class__)\n throw new Error('Parent instance must be a Form instance');\n\n this.parent = parsleyFormInstance || window.Parsley;\n return this.init(options);\n};\n\nFactory.prototype = {\n init: function (options) {\n this.__class__ = 'Parsley';\n this.__version__ = '@@version';\n this.__id__ = Utils.generateID();\n\n // Pre-compute options\n this._resetOptions(options);\n\n // A Form instance is obviously a `` element but also every node that is not an input and has the `data-parsley-validate` attribute\n if (this.element.nodeName === 'FORM' || (Utils.checkAttr(this.element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)))\n return this.bind('parsleyForm');\n\n // Every other element is bound as a `Field` or `FieldMultiple`\n return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField');\n },\n\n isMultiple: function () {\n var type = Utils.getType(this.element);\n return ((type === 'radio' || type === 'checkbox') ||\n (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')));\n },\n\n // Multiples fields are a real nightmare :(\n // Maybe some refactoring would be appreciated here...\n handleMultiple: function () {\n var name;\n var multiple;\n var parsleyMultipleInstance;\n\n // Handle multiple name\n this.options.multiple = this.options.multiple ||\n (name = this.element.getAttribute('name')) ||\n this.element.getAttribute('id');\n\n // Special select multiple input\n if (this.element.nodeName === 'SELECT' && null !== this.element.getAttribute('multiple')) {\n this.options.multiple = this.options.multiple || this.__id__;\n return this.bind('parsleyFieldMultiple');\n\n // Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it\n } else if (!this.options.multiple) {\n Utils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element);\n return this;\n }\n\n // Remove special chars\n this.options.multiple = this.options.multiple.replace(/(:|\\.|\\[|\\]|\\{|\\}|\\$)/g, '');\n\n // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name\n if (name) {\n $('input[name=\"' + name + '\"]').each((i, input) => {\n var type = Utils.getType(input);\n if ((type === 'radio' || type === 'checkbox'))\n input.setAttribute(this.options.namespace + 'multiple', this.options.multiple);\n });\n }\n\n // Check here if we don't already have a related multiple instance saved\n var $previouslyRelated = this._findRelated();\n for (var i = 0; i < $previouslyRelated.length; i++) {\n parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley');\n if ('undefined' !== typeof parsleyMultipleInstance) {\n\n if (!this.$element.data('FieldMultiple')) {\n parsleyMultipleInstance.addElement(this.$element);\n }\n\n break;\n }\n }\n\n // Create a secret Field instance for every multiple field. It will be stored in `data('FieldMultiple')`\n // And will be useful later to access classic `Field` stuff while being in a `FieldMultiple` instance\n this.bind('parsleyField', true);\n\n return parsleyMultipleInstance || this.bind('parsleyFieldMultiple');\n },\n\n // Return proper `Form`, `Field` or `FieldMultiple`\n bind: function (type, doNotStore) {\n var parsleyInstance;\n\n switch (type) {\n case 'parsleyForm':\n parsleyInstance = $.extend(\n new Form(this.element, this.domOptions, this.options),\n new Base(),\n window.ParsleyExtend\n )._bindFields();\n break;\n case 'parsleyField':\n parsleyInstance = $.extend(\n new Field(this.element, this.domOptions, this.options, this.parent),\n new Base(),\n window.ParsleyExtend\n );\n break;\n case 'parsleyFieldMultiple':\n parsleyInstance = $.extend(\n new Field(this.element, this.domOptions, this.options, this.parent),\n new Multiple(),\n new Base(),\n window.ParsleyExtend\n )._init();\n break;\n default:\n throw new Error(type + 'is not a supported Parsley type');\n }\n\n if (this.options.multiple)\n Utils.setAttr(this.element, this.options.namespace, 'multiple', this.options.multiple);\n\n if ('undefined' !== typeof doNotStore) {\n this.$element.data('FieldMultiple', parsleyInstance);\n\n return parsleyInstance;\n }\n\n // Store the freshly bound instance in a DOM element for later access using jQuery `data()`\n this.$element.data('Parsley', parsleyInstance);\n\n // Tell the world we have a new Form or Field instance!\n parsleyInstance._actualizeTriggers();\n parsleyInstance._trigger('init');\n\n return parsleyInstance;\n }\n};\n\nexport default Factory;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Defaults from './defaults';\nimport Base from './base';\nimport ValidatorRegistry from './validator_registry';\nimport UI from './ui';\nimport Form from './form';\nimport Field from './field';\nimport Multiple from './multiple';\nimport Factory from './factory';\n\nvar vernums = $.fn.jquery.split('.');\nif (parseInt(vernums[0]) <= 1 && parseInt(vernums[1]) < 8) {\n throw \"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.\";\n}\nif (!vernums.forEach) {\n Utils.warn('Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim');\n}\n// Inherit `on`, `off` & `trigger` to Parsley:\nvar Parsley = Object.assign(new Base(), {\n element: document,\n $element: $(document),\n actualizeOptions: null,\n _resetOptions: null,\n Factory: Factory,\n version: '@@version'\n });\n\n// Supplement Field and Form with Base\n// This way, the constructors will have access to those methods\nObject.assign(Field.prototype, UI.Field, Base.prototype);\nObject.assign(Form.prototype, UI.Form, Base.prototype);\n// Inherit actualizeOptions and _resetOptions:\nObject.assign(Factory.prototype, Base.prototype);\n\n// ### jQuery API\n// `$('.elem').parsley(options)` or `$('.elem').psly(options)`\n$.fn.parsley = $.fn.psly = function (options) {\n if (this.length > 1) {\n var instances = [];\n\n this.each(function () {\n instances.push($(this).parsley(options));\n });\n\n return instances;\n }\n\n // Return undefined if applied to non existing DOM element\n if (this.length == 0) {\n return;\n }\n\n return new Factory(this[0], options);\n};\n\n// ### Field and Form extension\n// Ensure the extension is now defined if it wasn't previously\nif ('undefined' === typeof window.ParsleyExtend)\n window.ParsleyExtend = {};\n\n// ### Parsley config\n// Inherit from ParsleyDefault, and copy over any existing values\nParsley.options = Object.assign(Utils.objectCreate(Defaults), window.ParsleyConfig);\nwindow.ParsleyConfig = Parsley.options; // Old way of accessing global options\n\n// ### Globals\nwindow.Parsley = window.psly = Parsley;\nParsley.Utils = Utils;\nwindow.ParsleyUtils = {};\n$.each(Utils, (key, value) => {\n if ('function' === typeof value) {\n window.ParsleyUtils[key] = (...args) => {\n Utils.warnOnce('Accessing `window.ParsleyUtils` is deprecated. Use `window.Parsley.Utils` instead.');\n return Utils[key](...args);\n };\n }\n});\n\n// ### Define methods that forward to the registry, and deprecate all access except through window.Parsley\nvar registry = window.Parsley._validatorRegistry = new ValidatorRegistry(window.ParsleyConfig.validators, window.ParsleyConfig.i18n);\nwindow.ParsleyValidator = {};\n$.each('setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator hasValidator'.split(' '), function (i, method) {\n window.Parsley[method] = (...args) => registry[method](...args);\n window.ParsleyValidator[method] = function () {\n Utils.warnOnce(`Accessing the method '${method}' through Validator is deprecated. Simply call 'window.Parsley.${method}(...)'`);\n return window.Parsley[method](...arguments);\n };\n});\n\n// ### UI\n// Deprecated global object\nwindow.Parsley.UI = UI;\nwindow.ParsleyUI = {\n removeError: function (instance, name, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance.removeError(name, {updateClass});\n },\n getErrorsMessages: function (instance) {\n Utils.warnOnce(`Accessing UI is deprecated. Call 'getErrorsMessages' on the instance directly.`);\n return instance.getErrorsMessages();\n }\n};\n$.each('addError updateError'.split(' '), function (i, method) {\n window.ParsleyUI[method] = function (instance, name, message, assert, doNotUpdateClass) {\n var updateClass = true !== doNotUpdateClass;\n Utils.warnOnce(`Accessing UI is deprecated. Call '${method}' on the instance directly. Please comment in issue 1073 as to your need to call this method.`);\n return instance[method](name, {message, assert, updateClass});\n };\n});\n\n// ### PARSLEY auto-binding\n// Prevent it by setting `ParsleyConfig.autoBind` to `false`\nif (false !== window.ParsleyConfig.autoBind) {\n $(function () {\n // Works only on `data-parsley-validate`.\n if ($('[data-parsley-validate]').length)\n $('[data-parsley-validate]').parsley();\n });\n}\n\nexport default Parsley;\n","import $ from 'jquery';\nimport Utils from './utils';\nimport Base from './base';\n\nimport Parsley from './main';\n\n$.extend(true, Parsley, {\n asyncValidators: {\n 'default': {\n fn: function (xhr) {\n // By default, only status 2xx are deemed successful.\n // Note: we use status instead of state() because responses with status 200\n // but invalid messages (e.g. an empty body for content type set to JSON) will\n // result in state() === 'rejected'.\n return xhr.status >= 200 && xhr.status < 300;\n },\n url: false\n },\n reverse: {\n fn: function (xhr) {\n // If reverse option is set, a failing ajax request is considered successful\n return xhr.status < 200 || xhr.status >= 300;\n },\n url: false\n }\n },\n\n addAsyncValidator: function (name, fn, url, options) {\n Parsley.asyncValidators[name] = {\n fn: fn,\n url: url || false,\n options: options || {}\n };\n\n return this;\n }\n\n});\n\nParsley.addValidator('remote', {\n requirementType: {\n '': 'string',\n 'validator': 'string',\n 'reverse': 'boolean',\n 'options': 'object'\n },\n\n validateString: function (value, url, options, instance) {\n var data = {};\n var ajaxOptions;\n var csr;\n var validator = options.validator || (true === options.reverse ? 'reverse' : 'default');\n\n if ('undefined' === typeof Parsley.asyncValidators[validator])\n throw new Error('Calling an undefined async validator: `' + validator + '`');\n\n url = Parsley.asyncValidators[validator].url || url;\n\n // Fill current value\n if (url.indexOf('{value}') > -1) {\n url = url.replace('{value}', encodeURIComponent(value));\n } else {\n data[instance.element.getAttribute('name') || instance.element.getAttribute('id')] = value;\n }\n\n // Merge options passed in from the function with the ones in the attribute\n var remoteOptions = $.extend(true, options.options || {} , Parsley.asyncValidators[validator].options);\n\n // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options`\n ajaxOptions = $.extend(true, {}, {\n url: url,\n data: data,\n type: 'GET'\n }, remoteOptions);\n\n // Generate store key based on ajax options\n instance.trigger('field:ajaxoptions', instance, ajaxOptions);\n\n csr = $.param(ajaxOptions);\n\n // Initialise querry cache\n if ('undefined' === typeof Parsley._remoteCache)\n Parsley._remoteCache = {};\n\n // Try to retrieve stored xhr\n var xhr = Parsley._remoteCache[csr] = Parsley._remoteCache[csr] || $.ajax(ajaxOptions);\n\n var handleXhr = function () {\n var result = Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options);\n if (!result) // Map falsy results to rejected promise\n result = $.Deferred().reject();\n return $.when(result);\n };\n\n return xhr.then(handleXhr, handleXhr);\n },\n\n priority: -1\n});\n\nParsley.on('form:submit', function () {\n Parsley._remoteCache = {};\n});\n\nBase.prototype.addAsyncValidator = function () {\n Utils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`');\n return Parsley.addAsyncValidator(...arguments);\n};\n","// This is included with the Parsley library itself,\n// thus there is no use in adding it to your project.\nimport Parsley from '../parsley/main';\n\nParsley.addMessages('en', {\n defaultMessage: \"This value seems to be invalid.\",\n type: {\n email: \"This value should be a valid email.\",\n url: \"This value should be a valid url.\",\n number: \"This value should be a valid number.\",\n integer: \"This value should be a valid integer.\",\n digits: \"This value should be digits.\",\n alphanum: \"This value should be alphanumeric.\"\n },\n notblank: \"This value should not be blank.\",\n required: \"This value is required.\",\n pattern: \"This value seems to be invalid.\",\n min: \"This value should be greater than or equal to %s.\",\n max: \"This value should be lower than or equal to %s.\",\n range: \"This value should be between %s and %s.\",\n minlength: \"This value is too short. It should have %s characters or more.\",\n maxlength: \"This value is too long. It should have %s characters or fewer.\",\n length: \"This value length is invalid. It should be between %s and %s characters long.\",\n mincheck: \"You must select at least %s choices.\",\n maxcheck: \"You must select %s choices or fewer.\",\n check: \"You must select between %s and %s choices.\",\n equalto: \"This value should be the same.\"\n});\n\nParsley.setLocale('en');\n","import $ from 'jquery';\nimport Parsley from './parsley/main';\nimport './parsley/pubsub';\nimport './parsley/remote';\nimport './i18n/en';\nimport inputevent from './vendor/inputevent';\n\ninputevent.install();\n\nexport default Parsley;\n"]} \ No newline at end of file diff --git a/public/js/vars.js b/public/js/vars.js index 6e168a62..1bf4946c 100644 --- a/public/js/vars.js +++ b/public/js/vars.js @@ -1,3 +1,8 @@ +/** + * This file has been generated by console command: php artisan freescout:generate-vars-js + * If you need to make changes, please edit /resources/views/js/vars.js template. + */ + var Vars = { }; diff --git a/resources/views/conversations/create.blade.php b/resources/views/conversations/create.blade.php index 1fd8f15e..975c6e6d 100644 --- a/resources/views/conversations/create.blade.php +++ b/resources/views/conversations/create.blade.php @@ -25,7 +25,7 @@
                - # {{ __("Pending") }} + #{{ __("Pending") }}
                @@ -37,10 +37,11 @@
                - + {{ csrf_field() }} - -
                + + +
                @@ -54,40 +55,42 @@ Cc/Bcc
                -
                -
                -
                - {{ $conversation->subject }} +
                +
                +
                + {{ $conversation->subject }} +
                +
                +   # {{ $conversation->number }} +
                -
                -   # {{ $conversation->number }} +
                + +
                @@ -159,7 +200,7 @@ @include('conversations/thread_by') @endif - @if ($loop->index == 0) + @if ($loop->last) {{ __("started the conversation") }} @else {{ __("replied") }} @@ -238,7 +279,10 @@
                @endsection +@include('partials/editor') + @section('javascript') @parent conversationInit(); + newConversationInit(); @endsection \ No newline at end of file diff --git a/resources/views/customers/profile_snippet.blade.php b/resources/views/customers/profile_snippet.blade.php index 86318a24..4c672afc 100644 --- a/resources/views/customers/profile_snippet.blade.php +++ b/resources/views/customers/profile_snippet.blade.php @@ -3,7 +3,9 @@
                - {{ $customer->getFullName() }} + @if ($customer->getFullName(false)) + {{ $customer->getFullName() }} + @endif {{-- todo: display full customer info --}}
                  @foreach ($customer->emails as $email) diff --git a/resources/views/js/vars.blade.php b/resources/views/js/vars.blade.php index 205af104..102e68eb 100644 --- a/resources/views/js/vars.blade.php +++ b/resources/views/js/vars.blade.php @@ -3,7 +3,10 @@ After changing this file make sure to run: php artisan freescout:generate-vars-js --}} - +/** + * This file has been generated by console command: php artisan freescout:generate-vars-js + * If you need to make changes, please edit /resources/views/js/vars.js template. + */ {{-- Global vars for JS. Set in /app/Console/Commands/GenerateJs.php --}} var Vars = { diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 9c7c1a52..598c5984 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -167,7 +167,7 @@ @yield('body_bottom') - {!! Minify::javascript(array('/js/jquery.js', '/js/bootstrap.js', '/js/laroute.js', '/js/lang.js', '/js/vars.js', '/js/main.js')) !!} + {!! Minify::javascript(array('/js/jquery.js', '/js/bootstrap.js', '/js/laroute.js', '/js/lang.js', '/js/vars.js', '/js/parsley/parsley.min.js', '/js/parsley/i18n/'.Config::get('app.locale').'.js', '/js/main.js')) !!} @yield('javascripts') @if ($__env->yieldContent('javascript'))