WordPress.org

Plugin Directory

Changeset 1554164


Ignore:
Timestamp:
12/14/16 01:05:49 (12 months ago)
Author:
core37
Message:

bug fix

Location:
core37-form-builder/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • core37-form-builder/trunk/inc/lib/gump.class.php

    r1501752 r1554164  
    485485            switch ($e['rule']) { 
    486486                case 'mismatch' : 
    487                     $resp[] = array('name'=>$field, 'message'=>"There is no validation rule for <span class=\"$field_class\">$field</span>"); 
     487//                    $resp[] = array('name'=>$field, 'message'=>"There is no validation rule for <span class=\"$field_class\">$field</span>"); 
    488488                    break; 
    489489                case 'validate_required' : 
     
    617617            switch ($e['rule']) { 
    618618                case 'mismatch' : 
    619                     $resp[$field] = "There is no validation rule for $field"; 
     619//                    $resp[$field] = "There is no validation rule for $field"; 
    620620                    break; 
    621621                case 'validate_required': 
  • core37-form-builder/trunk/inc/process.php

    r1553983 r1554164  
    4848 
    4949/** 
    50  * Filter the mail content type. 
     50 * Filter the mail content type. Make the file sending in HTML format 
    5151 */ 
    5252function core37_wpdocs_set_html_mail_content_type() { 
     
    101101    } 
    102102 
    103  
    104     //validate input data 
    105     $validationRules = json_decode(get_post_meta($data['form_id'],C37FormManager::C37_FORM_META_VALIDATION, true)); 
     103    $formSettingsString = get_post_meta($data['form_id'], C37FormManager::C37_FORM_META_SETTINGS, true); 
     104    $formSettings = json_decode($formSettingsString, true); 
     105 
     106    //  //the core37submit purpose is to convey the error message in non-ajax form submit 
     107    $submit = Core37Submit::getInstance(); 
     108    $submit->setFormID($data['form_id']); 
     109 
     110 
    106111    $gump = new C37FormGump(); 
    107112    $gumpRules = array(); 
    108113 
    109  
    110  
    111     $data= $gump->sanitize($data); 
    112 // 
    113 //  foreach($validationRules as $item=>$rule) 
    114 //  { 
    115 //      $name = $rule->name; 
    116 //      $ruleString = ''; 
    117 //      foreach($rule->rules as $r => $content) 
    118 //      { 
    119 //          $ruleString.=$content . "|"; 
    120 //      } 
    121 // 
    122 //      $ruleString = rtrim($ruleString, "|"); 
    123 // 
    124 //      //set rule 
    125 //      if($ruleString!='') 
    126 //          $gumpRules[$name] = $ruleString; 
    127 //  } 
    128 // 
    129 //  $validatedData = C37FormGump::is_valid(array_merge($data, $fileUpload), $gumpRules); 
    130 // 
    131 //  //the core37submit purpose is to convey the error message in non-ajax form submit 
    132     $submit = Core37Submit::getInstance(); 
    133     $submit->setFormID($data['form_id']); 
    134 // 
    135 //  if ($validatedData !== true) 
    136 //  { 
    137 //      //if the form is submitted by ajax, print the error out and stop script execution 
    138 //      if (isset($data['by_ajax'])) 
    139 //      { 
    140 //          echo json_encode(array( 
    141 //              "error" => 1, 
    142 //              "message" => $gump->get_readable_errors(false) 
    143 //          )); 
    144 // 
    145 //          die(); 
    146 //      } 
    147 // 
    148 // 
    149 //      //else, add the error to Submit array and display on site 
    150 //      $submit->addErrorMessages($gump->get_readable_errors(false)); 
    151 // 
    152 //      return; 
    153 //  } 
     114    //if the validation object is set (new version only) proceed with gump validation 
     115    if(isset($formSettings['GUMPString'])) 
     116    { 
     117        $gumpRules = $formSettings['GUMPString']; 
     118 
     119        $data= $gump->sanitize($data); 
     120 
     121        $gump->validation_rules($gumpRules); 
     122 
     123 
     124        $validatedData = $gump->run($data, true); 
     125 
     126 
     127        if ($validatedData === false) 
     128        { 
     129            //if the form is submitted by ajax, print the error out and stop script execution 
     130            if (isset($data['by_ajax'])) 
     131            { 
     132                echo json_encode(array( 
     133                    "error" => 1, 
     134                    "message" => $gump->get_readable_errors(true) 
     135                )); 
     136 
     137                die(); 
     138            } 
     139 
     140            //else, add the error to Submit array and display on site 
     141            $submit->addErrorMessages($gump->get_readable_errors(false)); 
     142 
     143            return; 
     144        } 
     145 
     146    } 
    154147 
    155148 
    156149    $filesPath = array(); 
    157150    $uploadFieldName = ""; 
    158  
    159  
    160  
    161     $formSettingsString = get_post_meta($data['form_id'], C37FormManager::C37_FORM_META_SETTINGS, true); 
    162     $formSettings = json_decode($formSettingsString); 
    163151 
    164152 
     
    172160     */ 
    173161 
    174     if (count($fileUpload) > 0 && isset($fileUpload['error']) && $fileUpload['error'] === 0) 
     162 
     163    if (count($fileUpload) > 0) 
    175164    { 
    176165        /** 
     
    228217 
    229218 
    230             if ( $movefile && ! isset( $movefile['error'] ) ) { 
     219            if ( $movefile && !isset( $movefile['error'] ) ) { 
    231220                $filesPath[] = $movefile['url']; 
    232221            } else { 
    233222 
    234                 $uploadError[] = array( 
    235                     'name' => $uploadData['name'], 
    236                     'message' => $movefile['error'] 
    237                 ); 
     223                /** 
     224                 * don't add the error message (missing file) if: 
     225                 * 1. There is no rule 
     226                 * 2. There is no rule for the file 
     227                 * 3. The file is not required 
     228                 */ 
     229 
     230                if ($singleFile['error'] == 4) 
     231                { 
     232                    //do nothing 
     233                } else 
     234                { 
     235                    $uploadError[] = array( 
     236                        'name' => $uploadData['name'], 
     237                        'message' => $movefile['error'] 
     238                    ); 
     239                } 
     240 
     241 
     242 
     243 
    238244 
    239245            } 
    240         } else 
     246        } else //in case of multiple file uploads 
    241247        { 
    242248            //check if any error available 
     
    269275                $movefile = wp_handle_upload( $singleFile , $uploadOverrides ); 
    270276 
    271  
    272277                if ( $movefile && ! isset( $movefile['error'] ) ) { 
    273278                    $filesPath[] = $movefile['url']; 
    274                 } else { 
    275                     $uploadError[$uploadData['name'][$i]] =  $movefile['error']; 
     279                } else if ($movefile['error']){ 
     280                    /** 
     281                     * don't add the error message (missing file) if: 
     282                     * 1. There is no rule 
     283                     * 2. There is no rule for the file 
     284                     * 3. The file is not required 
     285                     */ 
     286                    if ($singleFile['error'] == 4) 
     287                    { 
     288                        //do nothing 
     289                    } else 
     290                    { 
     291                        $uploadError[$uploadData['name'][$i]] =  $movefile['error']; 
     292                    } 
     293 
     294 
    276295                } 
    277296            } 
     
    324343    $replyToEmail = ''; 
    325344 
    326     if (isset($formSettings->subjectField) && ($formSettings->subjectField != "") && isset($data[$formSettings->subjectField])) 
    327         $subjectInput = $data[$formSettings->subjectField]; 
    328  
    329     if (isset($formSettings->replyToField) && ($formSettings->replyToField != "") && isset($data[$formSettings->replyToField])) 
    330         $replyToEmail = $data[$formSettings->replyToField]; 
     345    if (isset($formSettings['subjectField']) && ($formSettings['subjectField'] != "") && isset($data[$formSettings['subjectField']])) 
     346        $subjectInput = $data[$formSettings['subjectField']]; 
     347 
     348    if (isset($formSettings['replyToField']) && ($formSettings['replyToField'] != "") && isset($data[$formSettings['replyToField']])) 
     349        $replyToEmail = $data[$formSettings['replyToField']]; 
    331350 
    332351 
     
    346365 
    347366 
    348     if ($formSettings->afterSubmitMessage == null) 
    349     { 
    350         $formSettings->afterSubmitMessage = 'Your form was successfully submitted!'; 
     367    if ($formSettings['afterSubmitMessage'] == null) 
     368    { 
     369        $formSettings['afterSubmitMessage'] = 'Your form was successfully submitted!'; 
    351370    } 
    352371 
     
    354373     * Send notification to user if it is set to be true 
    355374     */ 
    356     if ($formSettings->sendNotification) 
     375    if ($formSettings['sendNotification']) 
    357376    { 
    358377        $toEmail = get_option('c37_receiving_email'); 
     
    430449    { 
    431450        echo json_encode(array( 
    432             'url'=> $formSettings->afterSubmitURL, 
    433             'message' => $formSettings->afterSubmitMessage, 
     451            'url'=> $formSettings['afterSubmitURL'], 
     452            'message' => $formSettings['afterSubmitMessage'], 
    434453            'error' => 0 
    435454        )); 
     
    440459    { 
    441460 
    442         if ($formSettings->afterSubmitURL != '') 
    443             header('Location: '. $formSettings->afterSubmitURL); 
     461        if ($formSettings['afterSubmitURL'] != '') 
     462            header('Location: '. $formSettings['afterSubmitURL']); 
    444463    } 
    445464 
  • core37-form-builder/trunk/index.php

    r1553983 r1554164  
    55    Description: Create forms easily with drag, drop form builder. Unlimited responsive forms with beautiful designs 
    66    Author: core37, codingpuss 
    7     Version: 1.2.14 
     7    Version: 1.2.15 
    88    Author URI: http://www.core37.com/ 
    99    Text Domain: core37-form-builder 
  • core37-form-builder/trunk/js/back/validation.js

    r1501752 r1554164  
    2020    { 
    2121        common: '<label>Validation</label>'+ 
    22         '<input data-for="required" type="checkbox" <%= this.model.get("vali").required=="required"? "checked" : "" %> /> Required', 
     22        '<% var elementValidation = validation[this.model.get("name")] || {}; %><input data-for="required" type="checkbox" <%= elementValidation.required? "checked" : "" %> /> Required', 
    2323        min_length: '<label>Min length (characters)</label>', 
    2424        max_length: '<label>Max length (characters)</label>', 
     
    2626        textarea: '', 
    2727        file:   '<label>File type</label>' +//for file, file type validation is needed 
    28         '<select <% var value=this.model.get(\'file_type\');console.log(value); %> data-for="file-type">' + 
     28        '<select <% var value=elementValidation.fileType %> data-for="file-type">' + 
    2929            '<option <%= value==""? "selected" : "" %> value="">Any</option>' + 
    3030            '<option <%= value=="image/*"? "selected" : "" %> value="image/*">Images</option>' + 
  • core37-form-builder/trunk/js/backend.min.js

    r1553949 r1554164  
    1 function makeFromDroppable(a){var b=a(".c37-step-container");b.droppable({accept:".c37-form-multi-element",activeClass:"active-zone",hoverClass:"drop-zone",drop:function(b,c){if("false"!=c.draggable.attr("data-original")){var d=c.draggable.attr("data-c37-type"),e=Templates[d],f=new e;f.render(),c.draggable.html(f.$el);var g="c37-step-id-"+Math.floor(1e4*Math.random());c.draggable.attr("id",g),c.draggable.attr("data-original","false"),makeC37StepDroppable(a),makeC37BoxDroppable(a)}}})}function makeC37BoxDroppable(a){var b=a(".c37-box");b.sortable({revert:!0,connectWith:[".c37-box"],handle:".cm-move",beforeStop:function(a,b){if("false"!=b.item.attr("data-original")){var c=b.item.attr("data-c37-type"),d=Templates[c],e=new d;e.render(),b.item.html(e.$el);var f="c37_id_"+Math.floor(1e4*Math.random());b.item.attr("id",f),b.item.attr("data-original","false"),b.item.removeAttr("style")}},stop:function(a,b){b.item.css("width",""),b.item.css("height","")},out:function(b,c){a(c.sender).removeClass("box-hover-zone")}}),b.droppable({accept:".c37-item-element",activeClass:"box-active-zone",hoverClass:"box-hover-zone",out:function(){console.log(a(this))}})}function makeC37StepDroppable(a){var b=a(".c37-step");b.sortable({revert:!0,handle:".cm-row-move",connectWith:[".c37-step"],stop:function(a,b){b.item.css("width",""),b.item.css("height","")},receive:function(a,b){}}),b.droppable({accept:".c37-container-element",activeClass:"row-active-zone",hoverClass:"row-drop-zone",greedy:!0,drop:function(b,c){if("false"!=c.draggable.attr("data-original")){var d=c.draggable.attr("data-c37-type"),e=Templates[d],f=new e;f.render(),c.draggable.html(f.$el),c.draggable.attr("id","c37_id_"+Math.floor(1e3*Math.random())),c.draggable.attr("data-original","false"),makeC37BoxDroppable(a)}}})}function rgb2hex(a){return a=a.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),a&&4===a.length?"#"+("0"+parseInt(a[1],10).toString(16)).slice(-2)+("0"+parseInt(a[2],10).toString(16)).slice(-2)+("0"+parseInt(a[3],10).toString(16)).slice(-2):""}function resetFormSettings(){core37Form={formID:0,formName:"",formContent:{},formSettings:{action:"",method:"",cssID:"",afterSubmitURL:"",sendEmail:!1,sendAutoReply:!1}}}function getTextColor(a){var b=a.get("editingElementID");return"undefined"==typeof elementsStyles[b]||"undefined"==typeof elementsStyles[b].color?(console.log("no txt color"),"#000000"):elementsStyles[b].color}function getBackgroundColor(a){var b=a.get("editingElementID");return console.log(b),"undefined"==typeof elementsStyles[b]||"undefined"==typeof elementsStyles[b]["background-color"]?(console.log("no bg color"),"#ffffff"):elementsStyles[b]["background-color"]}function restoreStarsRating(a){a(function(){_.each(a(".c37-form .c37-star-rating"),function(b){var c=a(b);c.siblings(".br-widget").remove(),console.log(c.find(".br-wrapper").length),console.log("star rendered");var d=c.attr("data-theme"),e="true"==c.attr("data-show-selected"),f="true"==c.attr("data-show-values"),g=c.attr("data-initial-rating"),h=c.attr("id"),i={theme:d,showSelectedRating:e,showValues:f,initialRating:g,allowEmpty:!0};console.log(i),a("#"+h).barrating(i)})})}function renderFontAwesome(a){var b=["fa-fort-awesome","fa-font-awesome","fa-bars","fa-caret-down","fa-flag","fa-wheelchair-alt","fa-camera-retro","fa-universal-access","fa-hand-spock-o","fa-ship","fa-venus","fa-file-image-o","fa-spinner","fa-check-square","fa-credit-card","fa-pie-chart","fa-won","fa-file-text-o","fa-arrow-right","fa-play-circle","fa-facebook-official","fa-medkit","fa-shopping-cart","fa-envelope","fa-search","fa-american-sign-language-interpreting","fa-asl-interpreting","fa-assistive-listening-systems","fa-audio-description","fa-blind","fa-braille","fa-deaf","fa-deafness","fa-envira","fa-fa","fa-first-order","fa-gitlab","fa-glide","fa-glide-g","fa-google-plus-circle","fa-google-plus-official","fa-hard-of-hearing","fa-instagram","fa-low-vision","fa-pied-piper","fa-question-circle-o","fa-sign-language","fa-signing","fa-snapchat","fa-snapchat-ghost","fa-snapchat-square","fa-themeisle","fa-viadeo","fa-viadeo-square","fa-volume-control-phone","fa-wpbeginner","fa-wpforms","fa-yoast","fa-adjust","fa-anchor","fa-archive","fa-area-chart","fa-arrows","fa-arrows-h","fa-arrows-v","fa-asterisk","fa-at","fa-automobile","fa-balance-scale","fa-ban","fa-bank","fa-bar-chart","fa-bar-chart-o","fa-barcode","fa-battery-0","fa-battery-1","fa-battery-2","fa-battery-3","fa-battery-4","fa-battery-empty","fa-battery-full","fa-battery-half","fa-battery-quarter","fa-battery-three-quarters","fa-bed","fa-beer","fa-bell","fa-bell-o","fa-bell-slash","fa-bell-slash-o","fa-bicycle","fa-binoculars","fa-birthday-cake","fa-bluetooth","fa-bluetooth-b","fa-bolt","fa-bomb","fa-book","fa-bookmark","fa-bookmark-o","fa-briefcase","fa-bug","fa-building","fa-building-o","fa-bullhorn","fa-bullseye","fa-bus","fa-cab","fa-calculator","fa-calendar","fa-calendar-check-o","fa-calendar-minus-o","fa-calendar-o","fa-calendar-plus-o","fa-calendar-times-o","fa-camera","fa-car","fa-caret-square-o-down","fa-caret-square-o-left","fa-caret-square-o-right","fa-caret-square-o-up","fa-cart-arrow-down","fa-cart-plus","fa-cc","fa-certificate","fa-check","fa-check-circle","fa-check-circle-o","fa-check-square-o","fa-child","fa-circle","fa-circle-o","fa-circle-o-notch","fa-circle-thin","fa-clock-o","fa-clone","fa-close","fa-cloud","fa-cloud-download","fa-cloud-upload","fa-code","fa-code-fork","fa-coffee","fa-cog","fa-cogs","fa-comment","fa-comment-o","fa-commenting","fa-commenting-o","fa-comments","fa-comments-o","fa-compass","fa-copyright","fa-creative-commons","fa-credit-card-alt","fa-crop","fa-crosshairs","fa-cube","fa-cubes","fa-cutlery","fa-dashboard","fa-database","fa-desktop","fa-diamond","fa-dot-circle-o","fa-download","fa-edit","fa-ellipsis-h","fa-ellipsis-v","fa-envelope-o","fa-envelope-square","fa-eraser","fa-exchange","fa-exclamation","fa-exclamation-circle","fa-exclamation-triangle","fa-external-link","fa-external-link-square","fa-eye","fa-eye-slash","fa-eyedropper","fa-fax","fa-feed","fa-female","fa-fighter-jet","fa-file-archive-o","fa-file-audio-o","fa-file-code-o","fa-file-excel-o","fa-file-movie-o","fa-file-pdf-o","fa-file-photo-o","fa-file-picture-o","fa-file-powerpoint-o","fa-file-sound-o","fa-file-video-o","fa-file-word-o","fa-file-zip-o","fa-film","fa-filter","fa-fire","fa-fire-extinguisher","fa-flag-checkered","fa-flag-o","fa-flash","fa-flask","fa-folder","fa-folder-o","fa-folder-open","fa-folder-open-o","fa-frown-o","fa-futbol-o","fa-gamepad","fa-gavel","fa-gear","fa-gears","fa-gift","fa-glass","fa-globe","fa-graduation-cap","fa-group","fa-hand-grab-o","fa-hand-lizard-o","fa-hand-paper-o","fa-hand-peace-o","fa-hand-pointer-o","fa-hand-rock-o","fa-hand-scissors-o","fa-hand-stop-o","fa-hashtag","fa-hdd-o","fa-headphones","fa-heart","fa-heart-o","fa-heartbeat","fa-history","fa-home","fa-hotel","fa-hourglass","fa-hourglass-1","fa-hourglass-2","fa-hourglass-3","fa-hourglass-end","fa-hourglass-half","fa-hourglass-o","fa-hourglass-start","fa-i-cursor","fa-image","fa-inbox","fa-industry","fa-info","fa-info-circle","fa-institution","fa-key","fa-keyboard-o","fa-language","fa-laptop","fa-leaf","fa-legal","fa-lemon-o","fa-level-down","fa-level-up","fa-life-bouy","fa-life-buoy","fa-life-ring","fa-life-saver","fa-lightbulb-o","fa-line-chart","fa-location-arrow","fa-lock","fa-magic","fa-magnet","fa-mail-forward","fa-mail-reply","fa-mail-reply-all","fa-male","fa-map","fa-map-marker","fa-map-o","fa-map-pin","fa-map-signs","fa-meh-o","fa-microphone","fa-microphone-slash","fa-minus","fa-minus-circle","fa-minus-square","fa-minus-square-o","fa-mobile","fa-mobile-phone","fa-money","fa-moon-o","fa-mortar-board","fa-motorcycle","fa-mouse-pointer","fa-music","fa-navicon","fa-newspaper-o","fa-object-group","fa-object-ungroup","fa-paint-brush","fa-paper-plane","fa-paper-plane-o","fa-paw","fa-pencil","fa-pencil-square","fa-pencil-square-o","fa-percent","fa-phone","fa-phone-square","fa-photo","fa-picture-o","fa-plane","fa-plug","fa-plus","fa-plus-circle","fa-plus-square","fa-plus-square-o","fa-power-off","fa-print","fa-puzzle-piece","fa-qrcode","fa-question","fa-question-circle","fa-quote-left","fa-quote-right","fa-random","fa-recycle","fa-refresh","fa-registered","fa-remove","fa-reorder","fa-reply","fa-reply-all","fa-retweet","fa-road","fa-rocket","fa-rss","fa-rss-square","fa-search-minus","fa-search-plus","fa-send","fa-send-o","fa-server","fa-share","fa-share-alt","fa-share-alt-square","fa-share-square","fa-share-square-o","fa-shield","fa-shopping-bag","fa-shopping-basket","fa-sign-in","fa-sign-out","fa-signal","fa-sitemap","fa-sliders","fa-smile-o","fa-soccer-ball-o","fa-sort","fa-sort-alpha-asc","fa-sort-alpha-desc","fa-sort-amount-asc","fa-sort-amount-desc","fa-sort-asc","fa-sort-desc","fa-sort-down","fa-sort-numeric-asc","fa-sort-numeric-desc","fa-sort-up","fa-space-shuttle","fa-spoon","fa-square","fa-square-o","fa-star","fa-star-half","fa-star-half-empty","fa-star-half-full","fa-star-half-o","fa-star-o","fa-sticky-note","fa-sticky-note-o","fa-street-view","fa-suitcase","fa-sun-o","fa-support","fa-tablet","fa-tachometer","fa-tag","fa-tags","fa-tasks","fa-taxi","fa-television","fa-terminal","fa-thumb-tack","fa-thumbs-down","fa-thumbs-o-down","fa-thumbs-o-up","fa-thumbs-up","fa-ticket","fa-times","fa-times-circle","fa-times-circle-o","fa-tint","fa-toggle-down","fa-toggle-left","fa-toggle-off","fa-toggle-on","fa-toggle-right","fa-toggle-up","fa-trademark","fa-trash","fa-trash-o","fa-tree","fa-trophy","fa-truck","fa-tty","fa-tv","fa-umbrella","fa-university","fa-unlock","fa-unlock-alt","fa-unsorted","fa-upload","fa-user","fa-user-plus","fa-user-secret","fa-user-times","fa-users","fa-video-camera","fa-volume-down","fa-volume-off","fa-volume-up","fa-warning","fa-wheelchair","fa-wifi","fa-wrench","fa-hand-o-down","fa-hand-o-left","fa-hand-o-right","fa-hand-o-up","fa-ambulance","fa-subway","fa-train","fa-genderless","fa-intersex","fa-mars","fa-mars-double","fa-mars-stroke","fa-mars-stroke-h","fa-mars-stroke-v","fa-mercury","fa-neuter","fa-transgender","fa-transgender-alt","fa-venus-double","fa-venus-mars","fa-file","fa-file-o","fa-file-text","fa-cc-amex","fa-cc-diners-club","fa-cc-discover","fa-cc-jcb","fa-cc-mastercard","fa-cc-paypal","fa-cc-stripe","fa-cc-visa","fa-google-wallet","fa-paypal","fa-bitcoin","fa-btc","fa-cny","fa-dollar","fa-eur","fa-euro","fa-gbp","fa-gg","fa-gg-circle","fa-ils","fa-inr","fa-jpy","fa-krw","fa-rmb","fa-rouble","fa-rub","fa-ruble","fa-rupee","fa-shekel","fa-sheqel","fa-try","fa-turkish-lira","fa-usd","fa-yen","fa-align-center","fa-align-justify","fa-align-left","fa-align-right","fa-bold","fa-chain","fa-chain-broken","fa-clipboard","fa-columns","fa-copy","fa-cut","fa-dedent","fa-files-o","fa-floppy-o","fa-font","fa-header","fa-indent","fa-italic","fa-link","fa-list","fa-list-alt","fa-list-ol","fa-list-ul","fa-outdent","fa-paperclip","fa-paragraph","fa-paste","fa-repeat","fa-rotate-left","fa-rotate-right","fa-save","fa-scissors","fa-strikethrough","fa-subscript","fa-superscript","fa-table","fa-text-height","fa-text-width","fa-th","fa-th-large","fa-th-list","fa-underline","fa-undo","fa-unlink","fa-angle-double-down","fa-angle-double-left","fa-angle-double-right","fa-angle-double-up","fa-angle-down","fa-angle-left","fa-angle-right","fa-angle-up","fa-arrow-circle-down","fa-arrow-circle-left","fa-arrow-circle-o-down","fa-arrow-circle-o-left","fa-arrow-circle-o-right","fa-arrow-circle-o-up","fa-arrow-circle-right","fa-arrow-circle-up","fa-arrow-down","fa-arrow-left","fa-arrow-up","fa-arrows-alt","fa-caret-left","fa-caret-right","fa-caret-up","fa-chevron-circle-down","fa-chevron-circle-left","fa-chevron-circle-right","fa-chevron-circle-up","fa-chevron-down","fa-chevron-left","fa-chevron-right","fa-chevron-up","fa-long-arrow-down","fa-long-arrow-left","fa-long-arrow-right","fa-long-arrow-up","fa-backward","fa-compress","fa-eject","fa-expand","fa-fast-backward","fa-fast-forward","fa-forward","fa-pause","fa-pause-circle","fa-pause-circle-o","fa-play","fa-play-circle-o","fa-step-backward","fa-step-forward","fa-stop","fa-stop-circle","fa-stop-circle-o","fa-youtube-play","fa-500px","fa-adn","fa-amazon","fa-android","fa-angellist","fa-apple","fa-behance","fa-behance-square","fa-bitbucket","fa-bitbucket-square","fa-black-tie","fa-buysellads","fa-chrome","fa-codepen","fa-codiepie","fa-connectdevelop","fa-contao","fa-css3","fa-dashcube","fa-delicious","fa-deviantart","fa-digg","fa-dribbble","fa-dropbox","fa-drupal","fa-edge","fa-empire","fa-expeditedssl","fa-facebook","fa-facebook-f","fa-facebook-square","fa-firefox","fa-flickr","fa-fonticons","fa-forumbee","fa-foursquare","fa-ge","fa-get-pocket","fa-git","fa-git-square","fa-github","fa-github-alt","fa-github-square","fa-gittip","fa-google","fa-google-plus","fa-google-plus-square","fa-gratipay","fa-hacker-news","fa-houzz","fa-html5","fa-internet-explorer","fa-ioxhost","fa-joomla","fa-jsfiddle","fa-lastfm","fa-lastfm-square","fa-leanpub","fa-linkedin","fa-linkedin-square","fa-linux","fa-maxcdn","fa-meanpath","fa-medium","fa-mixcloud","fa-modx","fa-odnoklassniki","fa-odnoklassniki-square","fa-opencart","fa-openid","fa-opera","fa-optin-monster","fa-pagelines","fa-pied-piper-alt","fa-pied-piper-pp","fa-pinterest","fa-pinterest-p","fa-pinterest-square","fa-product-hunt","fa-qq","fa-ra","fa-rebel","fa-reddit","fa-reddit-alien","fa-reddit-square","fa-renren","fa-resistance","fa-safari","fa-scribd","fa-sellsy","fa-shirtsinbulk","fa-simplybuilt","fa-skyatlas","fa-skype","fa-slack","fa-slideshare","fa-soundcloud","fa-spotify","fa-stack-exchange","fa-stack-overflow","fa-steam","fa-steam-square","fa-stumbleupon","fa-stumbleupon-circle","fa-tencent-weibo","fa-trello","fa-tripadvisor","fa-tumblr","fa-tumblr-square","fa-twitch","fa-twitter","fa-twitter-square","fa-usb","fa-viacoin","fa-vimeo","fa-vimeo-square","fa-vine","fa-vk","fa-wechat","fa-weibo","fa-weixin","fa-whatsapp","fa-wikipedia-w","fa-windows","fa-wordpress","fa-xing","fa-xing-square","fa-y-combinator","fa-y-combinator-square","fa-yahoo","fa-yc","fa-yc-square","fa-yelp","fa-youtube","fa-youtube-square","fa-h-square","fa-hospital-o","fa-stethoscope","fa-user-md"];jQuery("[data-for=icon]").autocomplete({source:b,html:!0,select:function(a,b){jQuery(this).siblings("i").first().attr("class","fa "+b.item.value)}}).data("ui-autocomplete")._renderItem=function(a,b){var c='<li><i class="fa '+b.value+'"></i> '+b.value+"</li>";return jQuery(c).appendTo(a)}}function hideOptionsWindow(a){a("#options-window").hide()}function showOptionsWindow(a){a("#options-window").show()}function getEditForm(a){var b=Forms[a],c=[];""!=b.general&&c.push({tab:'<li><a class="active-tab" href="#general-tab">General</a></li>',tabContent:'<div id="general-tab">'+b.general+"</div>"}),""!=b.advanced&&c.push({tab:'<li><a href="#advanced-tab">Advanced</a></li>',tabContent:'<div id="advanced-tab">'+b.advanced+"</div>"}),""!=b.style&&c.push({tab:'<li><a href="#style-tab">Styles</a></li>',tabContent:'<% var styles = elementsStyles[this.model.get(\'editingElementID\')]; if (typeof styles == "undefined") { styles = {}; } %><div id="style-tab">'+b.style+"</div>"}),""!=b.action&&c.push({tab:'<li><a href="#action-tab">Action</a></li>',tabContent:'<div id="action-tab">'+b.action+"</div>"});var d="",e="",f=100/c.length;return _.each(c,function(a){d+=a.tab.replace("<li>",'<li style="width: '+f+'%;">'),e+=a.tabContent}),'<div class="'+b.parentClass+'" id="setting-tabs"><div id="settings-micro-panel"><span class="close-panel"><i class="fa fa-close"></i> </span><span id="move-panel"><i class="fa fa-arrows"></i> </span></div><ul>'+d+"</ul>"+e+'</div><div class="clear"></div>'}function removeElement(){console.log("start removing"),this.editingElement().remove(),jQuery("#element-settings").html("")}function removeSizeClass(a){return a.attr("class",function(a,b){return b.replace(/(^|\s)c37-col-md\S+/g,"")}),a}function renderCSS(){var a=this.model.get("editingElementID"),b=this.$el.find("[data-for=text-color] input").first().val(),c=this.$el.find("[data-for=background-color] input").first().val();"undefined"==typeof elementsStyles[a]&&(elementsStyles[a]={}),elementsStyles[a]["background-color"]=c,elementsStyles[a].color=b,applyCSS()}function applyCSS(){var a="";for(var b in elementsStyles){var c=elementsStyles[b],d="";for(var e in c)d+=e+":"+c[e]+";";a+="#"+core37Form.formSettings.cssID+" #"+b+" .c37-child{"+d+"}"}0==jQuery("#element-styles").length&&jQuery("head").append('<style id="element-styles"></style>'),jQuery("#element-styles").text(""),jQuery("#element-styles").text(a)}function renderAction(){var a=this,b=a.$el,c=a.model.get("editingElementID"),d=b.find(".element-action [data-for=trigger]").first(),e=b.find(".element-action [data-for=action]").first(),f=b.find('.element-action [data-for="trigger-value"]').first(),g=b.find(".element-action [data-for=target-url]").first(),h=b.find(".element-action [data-for=target-element]").first();if("undefined"!=typeof c){if("no-trigger"==d.val())return console.log("null-action"),delete elementsActions[c],e.hide(),f.parent().hide(),void g.hide();"click"==d.val()?(e.show(),f.parent().hide()):"change"==d.val()&&(e.show(),f.parent().show()),"open-link"!==e.val()?g.parent().hide():g.parent().show(),"show-element"==e.val()||"hide-element"==e.val()?h.parent().show():h.parent().hide();var i={},j=jQuery("#"+c);i["element-type"]=j.attr("data-c37-type"),i.trigger=d.val(),i.action=e.val(),"open-link"==e.val()?i.target=g.val():"show-element"!=e.val()&&"hide-element"!=e.val()||(i.target=h.val()),"change"==d.val()&&(i["trigger-value"]=f.val()),elementsActions[c]=i}}!function(a){a(["jquery"],function(a){return function(){function b(a,b,c){return o({type:v.error,iconClass:p().iconClasses.error,message:a,optionsOverride:c,title:b})}function c(b,c){return b||(b=p()),r=a("#"+b.containerId),r.length?r:(c&&(r=l(b)),r)}function d(a,b,c){return o({type:v.info,iconClass:p().iconClasses.info,message:a,optionsOverride:c,title:b})}function e(a){s=a}function f(a,b,c){return o({type:v.success,iconClass:p().iconClasses.success,message:a,optionsOverride:c,title:b})}function g(a,b,c){return o({type:v.warning,iconClass:p().iconClasses.warning,message:a,optionsOverride:c,title:b})}function h(a,b){var d=p();r||c(d),k(a,d,b)||j(d)}function i(b){var d=p();return r||c(d),b&&0===a(":focus",b).length?void q(b):void(r.children().length&&r.remove())}function j(b){for(var c=r.children(),d=c.length-1;d>=0;d--)k(a(c[d]),b)}function k(b,c,d){var e=!(!d||!d.force)&&d.force;return!(!b||!e&&0!==a(":focus",b).length||(b[c.hideMethod]({duration:c.hideDuration,easing:c.hideEasing,complete:function(){q(b)}}),0))}function l(b){return r=a("<div/>").attr("id",b.containerId).addClass(b.positionClass),r.appendTo(a(b.target)),r}function m(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">&times;</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function n(a){s&&s(a)}function o(b){function d(a){return null==a&&(a=""),a.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e(){i(),k(),l(),m(),o(),s(),j(),f()}function f(){var a="";switch(b.iconClass){case"toast-success":case"toast-info":a="polite";break;default:a="assertive"}D.attr("aria-live",a)}function g(){A.closeOnHover&&D.hover(y,x),!A.onclick&&A.tapToDismiss&&D.click(w),A.closeButton&&H&&H.click(function(a){a.stopPropagation?a.stopPropagation():void 0!==a.cancelBubble&&a.cancelBubble!==!0&&(a.cancelBubble=!0),A.onCloseClick&&A.onCloseClick(a),w(!0)}),A.onclick&&D.click(function(a){A.onclick(a),w()})}function h(){D.hide(),D[A.showMethod]({duration:A.showDuration,easing:A.showEasing,complete:A.onShown}),A.timeOut>0&&(C=setTimeout(w,A.timeOut),I.maxHideTime=parseFloat(A.timeOut),I.hideEta=(new Date).getTime()+I.maxHideTime,A.progressBar&&(I.intervalId=setInterval(z,10)))}function i(){b.iconClass&&D.addClass(A.toastClass).addClass(B)}function j(){A.newestOnTop?r.prepend(D):r.append(D)}function k(){if(b.title){var a=b.title;A.escapeHtml&&(a=d(b.title)),E.append(a).addClass(A.titleClass),D.append(E)}}function l(){if(b.message){var a=b.message;A.escapeHtml&&(a=d(b.message)),F.append(a).addClass(A.messageClass),D.append(F)}}function m(){A.closeButton&&(H.addClass(A.closeClass).attr("role","button"),D.prepend(H))}function o(){A.progressBar&&(G.addClass(A.progressClass),D.prepend(G))}function s(){A.rtl&&D.addClass("rtl")}function v(a,b){if(a.preventDuplicates){if(b.message===t)return!0;t=b.message}return!1}function w(b){var c=b&&A.closeMethod!==!1?A.closeMethod:A.hideMethod,d=b&&A.closeDuration!==!1?A.closeDuration:A.hideDuration,e=b&&A.closeEasing!==!1?A.closeEasing:A.hideEasing;if(!a(":focus",D).length||b)return clearTimeout(I.intervalId),D[c]({duration:d,easing:e,complete:function(){q(D),clearTimeout(C),A.onHidden&&"hidden"!==J.state&&A.onHidden(),J.state="hidden",J.endTime=new Date,n(J)}})}function x(){(A.timeOut>0||A.extendedTimeOut>0)&&(C=setTimeout(w,A.extendedTimeOut),I.maxHideTime=parseFloat(A.extendedTimeOut),I.hideEta=(new Date).getTime()+I.maxHideTime)}function y(){clearTimeout(C),I.hideEta=0,D.stop(!0,!0)[A.showMethod]({duration:A.showDuration,easing:A.showEasing})}function z(){var a=(I.hideEta-(new Date).getTime())/I.maxHideTime*100;G.width(a+"%")}var A=p(),B=b.iconClass||A.iconClass;if("undefined"!=typeof b.optionsOverride&&(A=a.extend(A,b.optionsOverride),B=b.optionsOverride.iconClass||B),!v(A,b)){u++,r=c(A,!0);var C=null,D=a("<div/>"),E=a("<div/>"),F=a("<div/>"),G=a("<div/>"),H=a(A.closeHtml),I={intervalId:null,hideEta:null,maxHideTime:null},J={toastId:u,state:"visible",startTime:new Date,options:A,map:b};return e(),h(),g(),n(J),A.debug&&console&&console.log(J),D}}function p(){return a.extend({},m(),w.options)}function q(a){r||(r=c()),a.is(":visible")||(a.remove(),a=null,0===r.children().length&&(r.remove(),t=void 0))}var r,s,t,u=0,v={error:"error",info:"info",success:"success",warning:"warning"},w={clear:h,remove:i,error:b,getContainer:c,info:d,options:{},subscribe:e,success:f,version:"2.1.3",warning:g};return w}()})}("function"==typeof define&&define.amd?define:function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("jquery")):window.toastr=b(window.jQuery)}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){var b=function(){function b(){var b=this,c=function(){var c=["br-wrapper"];""!==b.options.theme&&c.push("br-theme-"+b.options.theme),b.$elem.wrap(a("<div />",{class:c.join(" ")}))},d=function(){b.$elem.unwrap()},e=function(c){return a.isNumeric(c)&&(c=Math.floor(c)),a('option[value="'+c+'"]',b.$elem)},f=function(){var c=b.options.initialRating;return c?e(c):a("option:selected",b.$elem)},g=function(){var c=b.$elem.find('option[value="'+b.options.emptyValue+'"]');return!c.length&&b.options.allowEmpty?(c=a("<option />",{value:b.options.emptyValue}),c.prependTo(b.$elem)):c},h=function(a){var c=b.$elem.data("barrating");return"undefined"!=typeof a?c[a]:c},i=function(a,c){null!==c&&"object"==typeof c?b.$elem.data("barrating",c):b.$elem.data("barrating")[a]=c},j=function(){var a=f(),c=g(),d=a.val(),e=a.data("html")?a.data("html"):a.text(),h=null!==b.options.allowEmpty?b.options.allowEmpty:!!c.length,j=c.length?c.val():null,k=c.length?c.text():null;i(null,{userOptions:b.options,ratingValue:d,ratingText:e,originalRatingValue:d,originalRatingText:e,allowEmpty:h,emptyRatingValue:j,emptyRatingText:k,readOnly:b.options.readonly,ratingMade:!1})},k=function(){b.$elem.removeData("barrating")},l=function(){return h("ratingText")},m=function(){return h("ratingValue")},n=function(){var c=a("<div />",{class:"br-widget"});return b.$elem.find("option").each(function(){var d,e,f,g;d=a(this).val(),d!==h("emptyRatingValue")&&(e=a(this).text(),f=a(this).data("html"),f&&(e=f),g=a("<a />",{href:"#","data-rating-value":d,"data-rating-text":e,html:b.options.showValues?e:""}),c.append(g))}),b.options.showSelectedRating&&c.append(a("<div />",{text:"",class:"br-current-rating"})),b.options.reverse&&c.addClass("br-reverse"),b.options.readonly&&c.addClass("br-readonly"),c},o=function(){return h("userOptions").reverse?"nextAll":"prevAll"},p=function(a){e(a).prop("selected",!0),b.$elem.change()},q=function(){a("option",b.$elem).prop("selected",function(){return this.defaultSelected}),b.$elem.change()},r=function(a){a=a?a:l(),a==h("emptyRatingText")&&(a=""),b.options.showSelectedRating&&b.$elem.parent().find(".br-current-rating").text(a)},s=function(a){return Math.round(Math.floor(10*a)/10%1*100)},t=function(){b.$widget.find("a").removeClass(function(a,b){return(b.match(/(^|\s)br-\S+/g)||[]).join(" ")})},u=function(){var c,d,e=b.$widget.find('a[data-rating-value="'+m()+'"]'),f=h("userOptions").initialRating,g=a.isNumeric(m())?m():0,i=s(f);if(t(),e.addClass("br-selected br-current")[o()]().addClass("br-selected"),!h("ratingMade")&&a.isNumeric(f)){if(f<=g||!i)return;c=b.$widget.find("a"),d=e.length?e[h("userOptions").reverse?"prev":"next"]():c[h("userOptions").reverse?"last":"first"](),d.addClass("br-fractional"),d.addClass("br-fractional-"+i)}},v=function(a){return!(!h("allowEmpty")||!h("userOptions").deselectable)&&m()==a.attr("data-rating-value")},w=function(c){c.on("click.barrating",function(c){var d,e,f=a(this),g=h("userOptions");return c.preventDefault(),d=f.attr("data-rating-value"),e=f.attr("data-rating-text"),v(f)&&(d=h("emptyRatingValue"),e=h("emptyRatingText")),i("ratingValue",d),i("ratingText",e),i("ratingMade",!0),p(d),r(e),u(),g.onSelect.call(b,m(),l(),c),!1})},x=function(b){b.on("mouseenter.barrating",function(){var b=a(this);t(),b.addClass("br-active")[o()]().addClass("br-active"),r(b.attr("data-rating-text"))})},y=function(a){b.$widget.on("mouseleave.barrating blur.barrating",function(){r(),u()})},z=function(b){b.on("touchstart.barrating",function(b){b.preventDefault(),b.stopPropagation(),a(this).click()})},A=function(a){a.on("click.barrating",function(a){a.preventDefault()})},B=function(a){w(a),b.options.hoverState&&(x(a),y(a))},C=function(a){a.off(".barrating")},D=function(a){var c=b.$widget.find("a");z&&z(c),a?(C(c),A(c)):B(c)};this.show=function(){h()||(c(),j(),b.$widget=n(),b.$widget.insertAfter(b.$elem),u(),r(),D(b.options.readonly),b.$elem.hide())},this.readonly=function(a){"boolean"==typeof a&&h("readOnly")!=a&&(D(a),i("readOnly",a),b.$widget.toggleClass("br-readonly"))},this.set=function(a){var c=h("userOptions");b.$elem.find('option[value="'+a+'"]').val()&&(i("ratingValue",a),i("ratingText",b.$elem.find('option[value="'+a+'"]').text()),i("ratingMade",!0),p(m()),r(l()),u(),c.silent||c.onSelect.call(this,m(),l()))},this.clear=function(){var a=h("userOptions");i("ratingValue",h("originalRatingValue")),i("ratingText",h("originalRatingText")),i("ratingMade",!1),q(),r(l()),u(),a.onClear.call(this,m(),l())},this.destroy=function(){var a=m(),c=l(),e=h("userOptions");C(b.$widget.find("a")),b.$widget.remove(),k(),d(),b.$elem.show(),e.onDestroy.call(this,a,c)}}return b.prototype.init=function(b,c){return this.$elem=a(c),this.options=a.extend({},a.fn.barrating.defaults,b),this.options},b}();a.fn.barrating=function(c,d){return this.each(function(){var e=new b;if(a(this).is("select")||a.error("Sorry, this plugin only works with select fields."),e.hasOwnProperty(c)){if(e.init(d,this),"show"===c)return e.show(d);if(e.$elem.data("barrating"))return e.$widget=a(this).next(".br-widget"),e[c](d)}else{if("object"==typeof c||!c)return d=c,e.init(d,this),e.show();a.error("Method "+c+" does not exist on jQuery.barrating")}})},a.fn.barrating.defaults={theme:"",initialRating:null,allowEmpty:null,emptyValue:"",showValues:!1,showSelectedRating:!0,deselectable:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,onSelect:function(a,b,c){},onClear:function(a,b){},onDestroy:function(a,b){}},a.fn.barrating.BarRating=b}),!function(a,b,c){"use strict";!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(d,e,f){var g=function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(f,"__esModule",{value:!0});var h,i,j,k,l=d("./modules/handle-dom"),m=d("./modules/utils"),n=d("./modules/handle-swal-dom"),o=d("./modules/handle-click"),p=d("./modules/handle-key"),q=g(p),r=d("./modules/default-params"),s=g(r),t=d("./modules/set-params"),u=g(t);f.default=j=k=function(){function d(a){var b=e;return b[a]===c?s.default[a]:b[a]}var e=arguments[0];if(l.addClass(b.body,"stop-scrolling"),n.resetInput(),e===c)return m.logStr("SweetAlert expects at least 1 attribute!"),!1;var f=m.extend({},s.default);switch(typeof e){case"string":f.title=e,f.text=arguments[1]||"",f.type=arguments[2]||"";break;case"object":if(e.title===c)return m.logStr('Missing "title" argument!'),!1;f.title=e.title;for(var g in s.default)f[g]=d(g);f.confirmButtonText=f.showCancelButton?"Confirm":s.default.confirmButtonText,f.confirmButtonText=d("confirmButtonText"),f.doneFunction=arguments[1]||null;break;default:return m.logStr('Unexpected type of argument! Expected "string" or "object", got '+typeof e),!1}u.default(f),n.fixVerticalPosition(),n.openModal(arguments[1]);for(var j=n.getModal(),p=j.querySelectorAll("button"),r=["onclick","onmouseover","onmouseout","onmousedown","onmouseup","onfocus"],t=function(a){return o.handleButton(a,f,j)},v=0;v<p.length;v++)for(var w=0;w<r.length;w++){var x=r[w];p[v][x]=t}n.getOverlay().onclick=t,h=a.onkeydown;var y=function(a){return q.default(a,f,j)};a.onkeydown=y,a.onfocus=function(){setTimeout(function(){i!==c&&(i.focus(),i=c)},0)},k.enableButtons()},j.setDefaults=k.setDefaults=function(a){if(!a)throw new Error("userParams is required");if("object"!=typeof a)throw new Error("userParams has to be a object");m.extend(s.default,a)},j.close=k.close=function(){var d=n.getModal();l.fadeOut(n.getOverlay(),5),l.fadeOut(d,5),l.removeClass(d,"showSweetAlert"),l.addClass(d,"hideSweetAlert"),l.removeClass(d,"visible");var e=d.querySelector(".sa-icon.sa-success");l.removeClass(e,"animate"),l.removeClass(e.querySelector(".sa-tip"),"animateSuccessTip"),l.removeClass(e.querySelector(".sa-long"),"animateSuccessLong");var f=d.querySelector(".sa-icon.sa-error");l.removeClass(f,"animateErrorIcon"),l.removeClass(f.querySelector(".sa-x-mark"),"animateXMark");var g=d.querySelector(".sa-icon.sa-warning");return l.removeClass(g,"pulseWarning"),l.removeClass(g.querySelector(".sa-body"),"pulseWarningIns"),l.removeClass(g.querySelector(".sa-dot"),"pulseWarningIns"),setTimeout(function(){var a=d.getAttribute("data-custom-class");l.removeClass(d,a)},300),l.removeClass(b.body,"stop-scrolling"),a.onkeydown=h,a.previousActiveElement&&a.previousActiveElement.focus(),i=c,clearTimeout(d.timeout),!0},j.showInputError=k.showInputError=function(a){var b=n.getModal(),c=b.querySelector(".sa-input-error");l.addClass(c,"show");var d=b.querySelector(".sa-error-container");l.addClass(d,"show"),d.querySelector("p").innerHTML=a,setTimeout(function(){j.enableButtons()},1),b.querySelector("input").focus(); 
    2 },j.resetInputError=k.resetInputError=function(a){if(a&&13===a.keyCode)return!1;var b=n.getModal(),c=b.querySelector(".sa-input-error");l.removeClass(c,"show");var d=b.querySelector(".sa-error-container");l.removeClass(d,"show")},j.disableButtons=k.disableButtons=function(){var a=n.getModal(),b=a.querySelector("button.confirm"),c=a.querySelector("button.cancel");b.disabled=!0,c.disabled=!0},j.enableButtons=k.enableButtons=function(){var a=n.getModal(),b=a.querySelector("button.confirm"),c=a.querySelector("button.cancel");b.disabled=!1,c.disabled=!1},"undefined"!=typeof a?a.sweetAlert=a.swal=j:m.logStr("SweetAlert is a frontend module!"),e.exports=f.default},{"./modules/default-params":2,"./modules/handle-click":3,"./modules/handle-dom":4,"./modules/handle-key":5,"./modules/handle-swal-dom":6,"./modules/set-params":8,"./modules/utils":9}],2:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var d={title:"",text:"",type:null,allowOutsideClick:!1,showConfirmButton:!0,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#8CD4F5",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0,inputType:"text",inputPlaceholder:"",inputValue:"",showLoaderOnConfirm:!1};c.default=d,b.exports=c.default},{}],3:[function(b,c,d){Object.defineProperty(d,"__esModule",{value:!0});var e=b("./utils"),f=(b("./handle-swal-dom"),b("./handle-dom")),g=function(b,c,d){function g(a){o&&c.confirmButtonColor&&(n.style.backgroundColor=a)}var j,k,l,m=b||a.event,n=m.target||m.srcElement,o=-1!==n.className.indexOf("confirm"),p=-1!==n.className.indexOf("sweet-overlay"),q=f.hasClass(d,"visible"),r=c.doneFunction&&"true"===d.getAttribute("data-has-done-function");switch(o&&c.confirmButtonColor&&(j=c.confirmButtonColor,k=e.colorLuminance(j,-.04),l=e.colorLuminance(j,-.14)),m.type){case"mouseover":g(k);break;case"mouseout":g(j);break;case"mousedown":g(l);break;case"mouseup":g(k);break;case"focus":var s=d.querySelector("button.confirm"),t=d.querySelector("button.cancel");o?t.style.boxShadow="none":s.style.boxShadow="none";break;case"click":var u=d===n,v=f.isDescendant(d,n);if(!u&&!v&&q&&!c.allowOutsideClick)break;o&&r&&q?h(d,c):r&&q||p?i(d,c):f.isDescendant(d,n)&&"BUTTON"===n.tagName&&sweetAlert.close()}},h=function(a,b){var c=!0;f.hasClass(a,"show-input")&&(c=a.querySelector("input").value,c||(c="")),b.doneFunction(c),b.closeOnConfirm&&sweetAlert.close(),b.showLoaderOnConfirm&&sweetAlert.disableButtons()},i=function(a,b){var c=String(b.doneFunction).replace(/\s/g,""),d="function("===c.substring(0,9)&&")"!==c.substring(9,10);d&&b.doneFunction(!1),b.closeOnCancel&&sweetAlert.close()};d.default={handleButton:g,handleConfirm:h,handleCancel:i},c.exports=d.default},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],4:[function(c,d,e){Object.defineProperty(e,"__esModule",{value:!0});var f=function(a,b){return new RegExp(" "+b+" ").test(" "+a.className+" ")},g=function(a,b){f(a,b)||(a.className+=" "+b)},h=function(a,b){var c=" "+a.className.replace(/[\t\r\n]/g," ")+" ";if(f(a,b)){for(;c.indexOf(" "+b+" ")>=0;)c=c.replace(" "+b+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")}},i=function(a){var c=b.createElement("div");return c.appendChild(b.createTextNode(a)),c.innerHTML},j=function(a){a.style.opacity="",a.style.display="block"},k=function(a){if(a&&!a.length)return j(a);for(var b=0;b<a.length;++b)j(a[b])},l=function(a){a.style.opacity="",a.style.display="none"},m=function(a){if(a&&!a.length)return l(a);for(var b=0;b<a.length;++b)l(a[b])},n=function(a,b){for(var c=b.parentNode;null!==c;){if(c===a)return!0;c=c.parentNode}return!1},o=function(a){a.style.left="-9999px",a.style.display="block";var b,c=a.clientHeight;return b="undefined"!=typeof getComputedStyle?parseInt(getComputedStyle(a).getPropertyValue("padding-top"),10):parseInt(a.currentStyle.padding),a.style.left="",a.style.display="none","-"+parseInt((c+b)/2)+"px"},p=function(a,b){if(+a.style.opacity<1){b=b||16,a.style.opacity=0,a.style.display="block";var c=+new Date,d=function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(){a.style.opacity=+a.style.opacity+(new Date-c)/100,c=+new Date,+a.style.opacity<1&&setTimeout(d,b)});d()}a.style.display="block"},q=function(a,b){b=b||16,a.style.opacity=1;var c=+new Date,d=function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(){a.style.opacity=+a.style.opacity-(new Date-c)/100,c=+new Date,+a.style.opacity>0?setTimeout(d,b):a.style.display="none"});d()},r=function(c){if("function"==typeof MouseEvent){var d=new MouseEvent("click",{view:a,bubbles:!1,cancelable:!0});c.dispatchEvent(d)}else if(b.createEvent){var e=b.createEvent("MouseEvents");e.initEvent("click",!1,!1),c.dispatchEvent(e)}else b.createEventObject?c.fireEvent("onclick"):"function"==typeof c.onclick&&c.onclick()},s=function(b){"function"==typeof b.stopPropagation?(b.stopPropagation(),b.preventDefault()):a.event&&a.event.hasOwnProperty("cancelBubble")&&(a.event.cancelBubble=!0)};e.hasClass=f,e.addClass=g,e.removeClass=h,e.escapeHtml=i,e._show=j,e.show=k,e._hide=l,e.hide=m,e.isDescendant=n,e.getTopMargin=o,e.fadeIn=p,e.fadeOut=q,e.fireClick=r,e.stopEventPropagation=s},{}],5:[function(b,d,e){Object.defineProperty(e,"__esModule",{value:!0});var f=b("./handle-dom"),g=b("./handle-swal-dom"),h=function(b,d,e){var h=b||a.event,i=h.keyCode||h.which,j=e.querySelector("button.confirm"),k=e.querySelector("button.cancel"),l=e.querySelectorAll("button[tabindex]");if(-1!==[9,13,32,27].indexOf(i)){for(var m=h.target||h.srcElement,n=-1,o=0;o<l.length;o++)if(m===l[o]){n=o;break}9===i?(m=-1===n?j:n===l.length-1?l[0]:l[n+1],f.stopEventPropagation(h),m.focus(),d.confirmButtonColor&&g.setFocusStyle(m,d.confirmButtonColor)):13===i?("INPUT"===m.tagName&&(m=j,j.focus()),m=-1===n?j:c):27===i&&d.allowEscapeKey===!0?(m=k,f.fireClick(m,h)):m=c}};e.default=h,d.exports=e.default},{"./handle-dom":4,"./handle-swal-dom":6}],6:[function(c,d,e){var f=function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0});var g=c("./utils"),h=c("./handle-dom"),i=c("./default-params"),j=f(i),k=c("./injected-html"),l=f(k),m=".sweet-alert",n=".sweet-overlay",o=function(){var a=b.createElement("div");for(a.innerHTML=l.default;a.firstChild;)b.body.appendChild(a.firstChild)},p=function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(){var a=b.querySelector(m);return a||(o(),a=p()),a}),q=function(){var a=p();return a?a.querySelector("input"):void 0},r=function(){return b.querySelector(n)},s=function(a,b){var c=g.hexToRgb(b);a.style.boxShadow="0 0 2px rgba("+c+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"},t=function(c){var d=p();h.fadeIn(r(),10),h.show(d),h.addClass(d,"showSweetAlert"),h.removeClass(d,"hideSweetAlert"),a.previousActiveElement=b.activeElement;var e=d.querySelector("button.confirm");e.focus(),setTimeout(function(){h.addClass(d,"visible")},500);var f=d.getAttribute("data-timer");if("null"!==f&&""!==f){var g=c;d.timeout=setTimeout(function(){var a=(g||null)&&"true"===d.getAttribute("data-has-done-function");a?g(null):sweetAlert.close()},f)}},u=function(){var a=p(),b=q();h.removeClass(a,"show-input"),b.value=j.default.inputValue,b.setAttribute("type",j.default.inputType),b.setAttribute("placeholder",j.default.inputPlaceholder),v()},v=function(a){if(a&&13===a.keyCode)return!1;var b=p(),c=b.querySelector(".sa-input-error");h.removeClass(c,"show");var d=b.querySelector(".sa-error-container");h.removeClass(d,"show")},w=function(){var a=p();a.style.marginTop=h.getTopMargin(p())};e.sweetAlertInitialize=o,e.getModal=p,e.getOverlay=r,e.getInput=q,e.setFocusStyle=s,e.openModal=t,e.resetInput=u,e.resetInputError=v,e.fixVerticalPosition=w},{"./default-params":2,"./handle-dom":4,"./injected-html":7,"./utils":9}],7:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var d='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error">\n      <span class="sa-x-mark">\n        <span class="sa-line sa-left"></span>\n        <span class="sa-line sa-right"></span>\n      </span>\n    </div><div class="sa-icon sa-warning">\n      <span class="sa-body"></span>\n      <span class="sa-dot"></span>\n    </div><div class="sa-icon sa-info"></div><div class="sa-icon sa-success">\n      <span class="sa-line sa-tip"></span>\n      <span class="sa-line sa-long"></span>\n\n      <div class="sa-placeholder"></div>\n      <div class="sa-fix"></div>\n    </div><div class="sa-icon sa-custom"></div><h2>Title</h2>\n    <p>Text</p>\n    <fieldset>\n      <input type="text" tabIndex="3" />\n      <div class="sa-input-error"></div>\n    </fieldset><div class="sa-error-container">\n      <div class="icon">!</div>\n      <p>Not valid!</p>\n    </div><div class="sa-button-container">\n      <button class="cancel" tabIndex="2">Cancel</button>\n      <div class="sa-confirm-button-container">\n        <button class="confirm" tabIndex="1">OK</button><div class="la-ball-fall">\n          <div></div>\n          <div></div>\n          <div></div>\n        </div>\n      </div>\n    </div></div>';c.default=d,b.exports=c.default},{}],8:[function(a,b,d){Object.defineProperty(d,"__esModule",{value:!0});var e=a("./utils"),f=a("./handle-swal-dom"),g=a("./handle-dom"),h=["error","warning","info","success","input","prompt"],i=function(a){var b=f.getModal(),d=b.querySelector("h2"),i=b.querySelector("p"),j=b.querySelector("button.cancel"),k=b.querySelector("button.confirm");if(d.innerHTML=a.html?a.title:g.escapeHtml(a.title).split("\n").join("<br>"),i.innerHTML=a.html?a.text:g.escapeHtml(a.text||"").split("\n").join("<br>"),a.text&&g.show(i),a.customClass)g.addClass(b,a.customClass),b.setAttribute("data-custom-class",a.customClass);else{var l=b.getAttribute("data-custom-class");g.removeClass(b,l),b.setAttribute("data-custom-class","")}if(g.hide(b.querySelectorAll(".sa-icon")),a.type&&!e.isIE8()){var m=function(){for(var d=!1,e=0;e<h.length;e++)if(a.type===h[e]){d=!0;break}if(!d)return logStr("Unknown alert type: "+a.type),{v:!1};var i=["success","error","warning","info"],j=c;-1!==i.indexOf(a.type)&&(j=b.querySelector(".sa-icon.sa-"+a.type),g.show(j));var k=f.getInput();switch(a.type){case"success":g.addClass(j,"animate"),g.addClass(j.querySelector(".sa-tip"),"animateSuccessTip"),g.addClass(j.querySelector(".sa-long"),"animateSuccessLong");break;case"error":g.addClass(j,"animateErrorIcon"),g.addClass(j.querySelector(".sa-x-mark"),"animateXMark");break;case"warning":g.addClass(j,"pulseWarning"),g.addClass(j.querySelector(".sa-body"),"pulseWarningIns"),g.addClass(j.querySelector(".sa-dot"),"pulseWarningIns");break;case"input":case"prompt":k.setAttribute("type",a.inputType),k.value=a.inputValue,k.setAttribute("placeholder",a.inputPlaceholder),g.addClass(b,"show-input"),setTimeout(function(){k.focus(),k.addEventListener("keyup",swal.resetInputError)},400)}}();if("object"==typeof m)return m.v}if(a.imageUrl){var n=b.querySelector(".sa-icon.sa-custom");n.style.backgroundImage="url("+a.imageUrl+")",g.show(n);var o=80,p=80;if(a.imageSize){var q=a.imageSize.toString().split("x"),r=q[0],s=q[1];r&&s?(o=r,p=s):logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+a.imageSize)}n.setAttribute("style",n.getAttribute("style")+"width:"+o+"px; height:"+p+"px")}b.setAttribute("data-has-cancel-button",a.showCancelButton),a.showCancelButton?j.style.display="inline-block":g.hide(j),b.setAttribute("data-has-confirm-button",a.showConfirmButton),a.showConfirmButton?k.style.display="inline-block":g.hide(k),a.cancelButtonText&&(j.innerHTML=g.escapeHtml(a.cancelButtonText)),a.confirmButtonText&&(k.innerHTML=g.escapeHtml(a.confirmButtonText)),a.confirmButtonColor&&(k.style.backgroundColor=a.confirmButtonColor,k.style.borderLeftColor=a.confirmLoadingButtonColor,k.style.borderRightColor=a.confirmLoadingButtonColor,f.setFocusStyle(k,a.confirmButtonColor)),b.setAttribute("data-allow-outside-click",a.allowOutsideClick);var t=!!a.doneFunction;b.setAttribute("data-has-done-function",t),a.animation?"string"==typeof a.animation?b.setAttribute("data-animation",a.animation):b.setAttribute("data-animation","pop"):b.setAttribute("data-animation","none"),b.setAttribute("data-timer",a.timer)};d.default=i,b.exports=d.default},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],9:[function(b,c,d){Object.defineProperty(d,"__esModule",{value:!0});var e=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a},f=function(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?parseInt(b[1],16)+", "+parseInt(b[2],16)+", "+parseInt(b[3],16):null},g=function(){return a.attachEvent&&!a.addEventListener},h=function(b){a.console&&a.console.log("SweetAlert: "+b)},i=function(a,b){a=String(a).replace(/[^0-9a-f]/gi,""),a.length<6&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),b=b||0;var c,d,e="#";for(d=0;3>d;d++)c=parseInt(a.substr(2*d,2),16),c=Math.round(Math.min(Math.max(0,c+c*b),255)).toString(16),e+=("00"+c).substr(c.length);return e};d.extend=e,d.hexToRgb=f,d.isIE8=g,d.logStr=h,d.colorLuminance=i},{}]},{},[1]),"function"==typeof define&&define.amd?define(function(){return sweetAlert}):"undefined"!=typeof module&&module.exports&&(module.exports=sweetAlert)}(window,document);var C37BackendValidation={makeValidationArea:function(a){return'<div class="validation">'+a+"</div>"},validationHTML:{common:'<label>Validation</label><input data-for="required" type="checkbox" <%= this.model.get("vali").required=="required"? "checked" : "" %> /> Required',min_length:"<label>Min length (characters)</label>",max_length:"<label>Max length (characters)</label>",textInput:"",textarea:"",file:'<label>File type</label><select <% var value=this.model.get(\'file_type\');console.log(value); %> data-for="file-type"><option <%= value==""? "selected" : "" %> value="">Any</option><option <%= value=="image/*"? "selected" : "" %> value="image/*">Images</option><option <%= value=="audio/*"? "selected" : "" %> value="audio/*">Audios</option><option <%= value=="video/*"? "selected" : "" %> value="video/*">Videos</option><option <%= value=="text/html"? "selected" : "" %> value="text/html">HTML Files</option><option <%= value==".doc,.docx,.pdf"? "selected" : "" %> value=".doc,.docx,.pdf">Documents</option></select>'},textValidation:function(){return this.makeValidationArea(this.validationHTML.common+this.validationHTML.textInput)},textAreaValidation:function(){return this.makeValidationArea(this.validationHTML.common)},fileValidation:function(){return this.makeValidationArea(this.validationHTML.common+this.validationHTML.file)}},UPGRADE_TO_UNLOCK_TEMPLATE="This style is in the pro version only. Please get the pro version to access all styles.",UPGRADE_TO_USE_IMAGE="Image element is available in the PRO version only. Please upgrade to use image in your form",UPGRADE_TO_USE_RATING="Stars rating is available in the PRO version only. Please upgrade to use ratings in your form",ERROR_MISSING_FORM_NAME="Please enter a name for your form",SUCCESS_FORM_SAVED="Form saved!",SUCCESS_CODE_SAVED="Code saved!",SUCCESS_EMAIL_SAVED="Email saved!",SUCCESS_SUBSCRIBER_DATA_CLEARED="Subscribers data for currently selected form cleared!",INFO_LOADING_SUBSCRIBERS_DATA="Loading subscribers data",ERROR_PLEASE_SOLVE_CAPTCHA="Please solve the captcha",ERROR_INPUT_NOT_VALID="Your input is not valid! ",INFO_CLEAR_SUBSCRIBERS="Clear subscribers data?",INFO_CLEAR_SUBSCRIBERS_EXPLAIN="You are going to clear subscribers data for currently selected form. This cannot be undone",INFO_SUBSCRIBERS_CLEARED="Subscribers data cleared!",versionNangCap=!0,core37Form={formID:0,formName:"",formContent:{},formSettings:{action:"",width:"500",method:"post",cssID:"c37-form-"+Math.floor(9999*Math.random()),presetCSSStyle:"c37-form-style-1",afterSubmitURL:"",sendNotification:!1,sendAutoReply:!1,afterSubmitMessage:"",replyToField:"",subjectField:""},friendlyNames:{}},defaultValues={};jQuery.post(ajaxurl,{action:"core37_get_form_styles"},function(a){core37Form.styles=JSON.parse(a)}),jQuery.post(ajaxurl,{action:"core37_get_default_parameters"},function(a){Object.assign(defaultValues,JSON.parse(a))}),defaultValues.starsRatingOptions={theme:"fontawesome-stars",initialRating:1,showValues:!1,showSelectedRating:!0,allowEmpty:!0};var elementsActions={};toastr.options={closeButton:!0,debug:!1,newestOnTop:!1,progressBar:!0,positionClass:"toast-top-center",preventDuplicates:!1,onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut"};var elementsStyles={},validation={},math=[{}],C37ElementModel=Backbone.Model.extend({defaults:{style:{},action:{},size:{}}}),elementStyle={textColor:'<div class="css-styles"><label class="section-header">Text color:</label><div data-for="text-color"><input data-for="color" type="color" value="<%= styles["color"] == null || styles[\'color\'] ==\'\' ? "#fffffa" : styles[\'color\'] %>"> <i data-for="clear-text-color" class="fa fa-hand-paper-o reset-color"></i></div></div>',background:'<div class="css-styles"><div id="c37-background-settings"><label class="section-header">Background</label><div><div class="c37-col-xs-4"  data-for="background-color"><label>Color:</label><input type="color" value="<%= styles["background-color"] == null || styles[\'background-color\'] == ""? "#fffffa" : styles[\'background-color\'] %>" > <i class="fa fa-hand-paper-o reset-color"></i></div><div class="c37-col-xs-4"  data-for="background-image"><label>Image:</label><img src="<%= styles[\'background-image\'] %>" id="c37-image-preview" /><br /><input type="hidden" value="<%= styles[\'background-image\'] %>" /><i href="#" id="change-background-image" class="fa fa-folder-open"></i><i href="#" id="remove-background-image" class="fa fa-close"></i></div><div class="c37-col-xs-4"  data-for="background-image-style"><label>Style:</label><select><option <%= styles[\'background-image-style\'] == "no-repeat" ? "selected" : "" %> value="no-repeat">no repeat</option><option <%= styles[\'background-image-style\'] == "repeat" ? "selected" : "" %> value="repeat">repeat</option><option <%= styles[\'background-image-style\'] == "repeat-x" ? "selected" : "" %> value="repeat-x">repeat x</option><option <%= styles[\'background-image-style\'] == "repeat-y" ? "selected" : "" %> value="repeat-y">repeat y</option><option <%= styles[\'background-image-style\'] == "cover" ? "selected" : "" %> value="cover">cover</option><option <%= styles[\'background-image-style\'] == "contain" ? "selected" : "" %> value="cover">contain</option></select></div><div class="clearfix"></div></div></div></div>',elementSize:'<div class="c37-col-xs-12"><label class="section-header">Element width:</label><div><select <% var size = (this.model.get(\'size\')); %> data-for="element-width"><option <%= size.size == 2 ? "selected": "" %> value="2">2</option><option <%= size.size == 3 ? "selected": "" %>  value="3">3</option><option <%= size.size == 4 ? "selected": "" %>  value="4">4</option><option <%= size.size == 5 ? "selected": "" %>  value="5">5</option><option <%= size.size == 6 ? "selected": "" %>  value="6">6</option><option <%= size.size == 7 ? "selected": "" %>  value="7">7</option><option <%= size.size == 8 ? "selected": "" %>  value="8">8</option><option <%= size.size == 9 ? "selected": "" %>  value="9">9</option><option <%= size.size == 10 ? "selected": "" %>  value="10">10</option><option <%= size.size == 11 ? "selected": "" %>  value="11">11</option><option <%= size.size == 12 ? "selected": "" %>  value="12">12</option></select><br /><span><input type="checkbox" <%= size.expand? "checked" : "" %>  data-for="expand" /> Expand full on small screen</span></div></div>',border:'<div class="css-styles"><div id="c37-border-settings"><label class="section-header">Border</label><div><div class="c37-col-xs-3"><label>Style:  <select data-for="border-style"><option  <%= styles[\'border-style\'] == "none" ? "selected" : "" %>  value="none">none</option><option  <%= styles[\'border-style\'] == "solid" ? "selected" : "" %>  value="solid">solid</option><option  <%= styles[\'border-style\'] == "dashed" ? "selected" : "" %>  value="dashed">dashed</option><option  <%= styles[\'border-style\'] == "dotted" ? "selected" : "" %>  value="dotted">dotted</option></select></label></div><div class="c37-col-xs-3"><label>Width: <input value="<%= styles[\'border-width\'] %>" type="number" data-for="border-width" /></label></div><div class="c37-col-xs-3"><label>Color: <input value="<%= styles[\'border-color\'] == null || styles[\'border-color\'] ==\'\' ? \'#fffffa\' : styles[\'border-color\'] %>" type="color" data-for="border-color" /></label></div><div class="c37-col-xs-3"><label>Radius: <input value="<%= styles[\'border-radius\'] %>" type="number" data-for="border-radius" /></label></div><div id="c37-border-width-settings"><label class="c37-col-xs-3">Top: <input data-for="border-top-width" value="<%= styles[\'border-top-width\'] %>" type="number"/></label><label class="c37-col-xs-3">Right: <input data-for="border-right-width" value="<%= styles[\'border-right-width\'] %>" type="number"/></label><label class="c37-col-xs-3">Bottom: <input data-for="border-bottom-width" value="<%= styles[\'border-bottom-width\'] %>" type="number"/></label><label class="c37-col-xs-3">Left: <input data-for="border-left-width" value="<%= styles[\'border-left-width\'] %>" type="number"/></label></div><div id="c37-border-radius-settings"><label class="c37-col-xs-3">T-L: <input data-for="border-top-left-radius" value="<%= styles[\'border-top-left-radius\'] %>" type="number"/></label><label class="c37-col-xs-3">T-R: <input data-for="border-top-right-radius" value="<%= styles[\'border-top-right-radius\'] %>" type="number" /></label><label class="c37-col-xs-3">B-L: <input data-for="border-bottom-left-radius" value="<%= styles[\'border-bottom-left-radius\'] %>" type="number"/></label><label class="c37-col-xs-3">B-R: <input data-for="border-bottom-right-radius" value="<%= styles[\'border-bottom-right-radius\'] %>" type="number"/></label></div></div></div></div>',margin:'<div class="css-styles"><div id="c37-margin-padding-settings"><label class="section-header">Margin</label><div id="c37-margin-settings" data-for="margin"><label class="c37-col-xs-3">Top: <input value="<%= styles[\'margin-top\'] %>" type="number" class="top" /></label><label class="c37-col-xs-3">Right: <input value="<%= styles[\'margin-right\'] %>" type="number" class="right" /></label><label class="c37-col-xs-3">Bottom: <input value="<%= styles[\'margin-bottom\'] %>" type="number" class="bottom" /></label><label class="c37-col-xs-3">Left: <input value="<%= styles[\'margin-left\'] %>" type="number" class="left" /></label></div><label class="section-header">Padding</label><div id="c37-padding-settings" data-for="padding"><label class="c37-col-xs-3">Top: <input value="<%= styles[\'padding-top\'] %>" type="number" class="top" /></label><label class="c37-col-xs-3">Right: <input value="<%= styles[\'padding-right\'] %>" type="number" class="right" /></label><label class="c37-col-xs-3">Bottom: <input value="<%= styles[\'padding-bottom\'] %>" type="number" class="bottom" /></label><label class="c37-col-xs-3">Left: <input value="<%= styles[\'padding-left\'] %>" type="number" class="left" /></label></div></div></div>'},actionArea='<div class="element-action"><label>Trigger</label><select data-for="trigger"><option value="no-trigger"></option><option <%= this.model.get("action").trigger=="click" ? "selected" : "" %> value="click">On this element click</option></select><label>Action</label><select data-for="action"><option  value="do-nothing"></option><option <%= this.model.get("action").action=="submit-form" ? "selected" : "" %> value="submit-form">Submit form</option></select></div>',textEditOptions={general:'<label>Placeholder: </label><input type="text" data-for="placeholder" value="<%= this.model.get(\'placeholder\') %>" /><label>Label</label><input type="text" value="<%= this.model.get(\'label\') %>" data-for="input-label" placeholder="enter label" /><label>Type:</label><select <% var type = this.model.get(\'type\') %> data-for="input-type"><option <%= type=="text"? "selected" : "" %> value="text">Text</option><option <%= type=="email"? "selected" : "" %> value="email">Email</option><option <%= type=="url"? "selected" : "" %> value="url">URL</option><option <%= type=="number"? "selected" : "" %> value="number">Number</option><option <%= type=="password"? "selected" : "" %> value="password">Password</option><option <%= type=="tel"? "selected" : "" %> value="tel">Phone</option></select><span class="reply-to <%= type==\'email\' ? \'\':\'hidden\' %> "><input  <%= core37Form.formSettings.replyToField == this.model.get("name")? "checked" : ""  %> type="checkbox" data-for="reply-to" /> Reply to this email</span><span  class="email-subject <%= type==\'text\' ? \'\':\'hidden\' %>"><input <%= core37Form.formSettings.subjectField == this.model.get("name")? "checked" : ""  %> type="checkbox" data-for="email-subject" /> This is email\'s subject</span><label>Icon</label><div class="fa-icon"><i class="fa <%= this.model.get(\'icon\') ? this.model.get(\'icon\'): \'\' %>"></i><input data-for="icon" value="<%= this.model.get(\'icon\')? this.model.get(\'icon\'): \'\' %> " type="text" id="fa-icon-input" /> </div>',advanced:'<label>Field name:</label><input type="text" data-for="name" value="<%= this.model.get(\'name\') %>" />'+C37BackendValidation.textValidation(),action:actionArea,style:elementStyle.textColor+elementStyle.elementSize},fileEditOptions={general:'<label>Upload multiple files?</label><input <%= this.model.get(\'multiple\')? "checked" : "" %> type="checkbox" data-for="multiple" /><label>Text</label><input data-for="text" type="text" value="<%= this.model.get(\'text\') %>" placeholder="upload text" /><label>Icon</label><div class="fa-icon"><i class="fa <%= this.model.get(\'icon\') ? this.model.get(\'icon\'): \'\' %>"></i><input <%= versionNangCap ? ""  : "disabled" %> data-for="icon" value="<%= this.model.get(\'icon\')? this.model.get(\'icon\'): \'\' %> " type="text" id="fa-icon-input" /> </div>',advanced:"<label>Field name: </label><input type=\"text\" data-for=\"name\" value=\"<%= this.model.get('name').replace('[','').replace(']','') %>\" />"+C37BackendValidation.fileValidation(this.model),style:"",action:""},checkboxEditOptions={general:'<div class="row options"><span class="c37-col-xs-8"><label>Value</label></span><span class="c37-col-xs-4"><label>Check</label></span><% var options = this.model.get(\'options\'); _.each(options, function(o){ %>  <div><span class="c37-col-xs-8"><input type="text" data-for="value" value="<%= decodeURIComponent(o.value) %>" />  </span><span class="c37-col-xs-4 check"><input type="checkbox" data-for="checked" <%= o.checked? "checked" : "" %> />  </span><span class="hidden"><input type="text" data-for="id" value="<%= o.id %>" /></span></div><%}) %></div><button class="add-option"><i class="fa fa-plus"></i> Add option</button>',advanced:'<label>Name</label><input data-for="name" type="text" value="<%= this.model.get(\'name\') %>" placeholder="enter a name for your field" /><label>Options alignment</label><select <% var alignment = this.model.get(\'alignment\'); %> data-for="alignment"><option <%= alignment=="c37-vertical"? "selected" : "" %> value="c37-vertical">Vertical</option><option <%= alignment=="c37-horizontal"? "selected" : "" %> value="c37-horizontal">Horizontal</option></select>',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},radioEditOptions={general:'<div class="row options"><span class="c37-col-xs-8"><label>Value</label></span><span class="c37-col-xs-4"><label>Select</label></span><% var options = this.model.get(\'options\'); _.each(options, function(o){ %>  <div><span class="c37-col-xs-8"><input type="text" data-for="value" value="<%= decodeURIComponent(o.value) %>" />  </span><span class="c37-col-xs-4 check"><input type="radio" data-for="checked" name="radio-settings" <%= o.checked? "checked" : "" %> />  </span><span class="hidden"><input type="text" data-for="id" value="<%= o.id %>" /></span></div><%}) %></div><button class="add-option"><i class="fa fa-plus"></i> Add option</button>',advanced:'<label>Name</label><input data-for="name" type="text" value="<%= this.model.get(\'name\') %>" placeholder="enter a name for your field" /><label>Options alignment</label><select <% var alignment = this.model.get(\'alignment\'); %> data-for="alignment"><option <%= alignment=="c37-vertical"? "selected" : "" %> value="c37-vertical">Vertical</option><option <%= alignment=="c37-horizontal"? "selected" : "" %> value="c37-horizontal">Horizontal</option></select>',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},labelEditOptions={general:'<label>Content: </label><input type="text" data-for="label" placeholder="enter your label" value="<%= this.model.get(\'content\') %>" /> <input type="checkbox" <%= this.model.get("required") ? "checked" : "" %> data-for="required"> Field is required',advanced:"",style:elementStyle.textColor+elementStyle.elementSize,action:null},headingEditOptions={general:'<label>Content: </label><input type="text" data-for="heading" placeholder="enter text content" value="<%= this.model.get(\'content\') %>" /> <label>Type: </label><select <% var tagName = this.model.get(\'tagName\'); %> data-for="tagName"><option <%= tagName=="h1"? "selected" : ""  %> value="h1">h1</option><option <%= tagName=="h2"? "selected" : ""  %>  value="h2">h2</option><option <%= tagName=="h3"? "selected" : ""  %>  value="h3">h3</option><option <%= tagName=="h4"? "selected" : ""  %>  value="h4">h4</option><option <%= tagName=="h5"? "selected" : ""  %>  value="h5">h5</option><option <%= tagName=="h6"? "selected" : ""  %>  value="h6">h6</option></select>',advanced:"",style:elementStyle.textColor+elementStyle.elementSize,action:null},paragraphEditOptions={general:'<label>Content: </label><textarea data-for="paragraph" placeholder="enter text content"><%= this.model.get(\'content\') %></textarea> ',advanced:"",style:"",action:""},textAreaEditOptions={general:'<label>Placeholder: </label><input type="text" data-for="placeholder" placeholder="enter placeholder" value="<%= this.model.get(\'placeholder\') %>" /> <label>Label</label><input value="<%= this.model.get(\'label\') %>" type="text" data-for="input-label" placeholder="enter label" />',advanced:'<label>Field name: </label><input type="text" data-for="name" placeholder="enter field name" value="<%= this.model.get(\'name\') %>" /> '+C37BackendValidation.textAreaValidation(),style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},buttonEditOptions={general:'<label>Button Text: </label><input type="text" data-for="text" placeholder="button text" value="<%= this.model.get(\'text\') %>" /> ',advanced:"",style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},dateEditOptions={general:'<label <% var type = this.model.get(\'type\'); %> >Default value: </label><input type="<%= type %>" data-for="default-value" value="<%= this.model.get(\'value\') %>" /><label>Type:</label><select data-for="date-type"><option <%= type=="date"? "selected" : "" %> value="date">Date</option></select>',advanced:'<label>Field name:</label><input type="text" data-for="name" value="<%= this.model.get(\'name\') %>" />',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},selectEditOptions={general:"<div class=\"row options\"><span class=\"c37-col-xs-12\"><label>Values</label></span><% var options = this.model.get('options'); var allValue= ''; _.each(options, function(o){ %>  <% allValue+=o.value+'\\n';  %><%}) %><textarea data-for=\"value\"><%= decodeURIComponent(allValue) %></textarea></div><label>Selected value</label><select data-for=\"selected\"><% var selected_value = this.model.get('selected_value'); _.each(options, function(option){ %><option <%= option.value == selected_value? 'selected': '' %> value=\"<%= option.value %>\"><%= decodeURIComponent(option.value) %></option><% }) %></select>", 
    3 advanced:'<label>Name</label><input data-for="name" type="text" value="<%= this.model.get(\'name\') %>" placeholder="enter a name for your field" />',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},acceptanceEditOptions={general:'<label>Text: </label><input type="text" data-for="text" placeholder="enter acceptance text" value="<%= this.model.get(\'text\') %>" /><label>Error message(<small>When not checked</small>)</label><input type="text" data-for="error" placeholder="enter error message" value="<%= this.model.get(\'error_message\') %>" /> ',advanced:'<label>Field name:</label><input disabled type="text" data-for="name" value="<%= this.model.get(\'name\') %>" />',style:elementStyle.textColor,action:actionArea},rowEditOptions={general:'<label>Row layout</label><select data-for="layout"><option <%= layout=="12"? "selected" : "" %> value="12">1</option><option <%= layout=="6-6"? "selected" : "" %> value="6-6">1/2 + 1/2</option><option <%= layout=="4-4-4"? "selected" : "" %> value="4-4-4">1/3 + 1/3 + 1/3</option><option <%= layout=="4-8"? "selected" : "" %> value="4-8">1/3 + 2/3</option><option <%= layout=="8-4"? "selected" : "" %> value="8-4">2/3 + 1/3</option><option <%= layout=="3-3-3-3"? "selected" : "" %> value="3-3-3-3">1/4 + 1/4 + 1/4 + 1/4</option><option <%= layout=="3-3-6"? "selected" : "" %> value="3-3-6">1/4 + 1/4 + 2/4</option><option <%= layout=="3-9"? "selected" : "" %> value="3-9">1/4 + 3/4</option><option <%= layout=="3-6-3"? "selected" : "" %> value="3-6-3">1/4 + 2/4 + 1/4</option><option <%= layout=="6-3-3"? "selected" : "" %> value="6-3-3">2/4 + 1/4 + 1/4</option><option <%= layout=="9-3"? "selected" : "" %> value="9-3">3/4 + 1/4</option></select>',advanced:"",style:elementStyle.textColor,action:actionArea},formEditOptions={general:'<label>Form name</label><input id="form-name" type="text" value="<%= core37Form.formName %>" placeholder="form name" data-for="name" /><label>Form width (<small><em>in px, leave blank for full width</em></small>)</label><span><input type="number" value="<%= this.model.get("width") %>" data-for="width" /></span>',advanced:'<label>After-submit message</label><input type="text" data-for="afterSubmitMessage" value="<%= this.model.get(\'afterSubmitMessage\') %>" placeholder="enter your message" /><label>After-submit URL</label><input type="text" placeholder="enter your URL" class="c37-col-xs-12" value="<%= this.model.get(\'afterSubmitURL\') %>" data-for="afterSubmitURL" /><label><input <%= this.model.get("sendNotification") ? "checked" : "" %> type="checkbox" data-for="sendNotification" <span>Send notification (to your email) when form submitted</span></label><label><input disabled <%= this.model.get("sendAutoReply") ? "checked" : "" %> type="checkbox" data-for="sendAutoReply" <span>Send auto-reply to people who submit form</span></label>',style:'<label>Preset styles</label><select data-for="form-style"><% _.each(core37Form.styles, function(s){  %><option <%= s.class==core37Form.formSettings.presetCSSStyle? \'selected\' : \'\' %> value="<%= s.class %>" > <%= "Style "+ s.class.slice(-1) %> </option><% }) %></select>',action:""},imageEditOptions={general:'<label>Select image</label><img class="c37-image-preview" src="<%= this.model.get( \'imgSrc\')%>" /><button id="c37-image-picker">Change image...</button>',advanced:"",style:elementStyle.textColor+elementStyle.background+elementStyle.border+elementStyle.margin,action:""},starsEditOptions={general:'<% var initialRating = this.model.get("initialRating"); var theme = this.model.get("theme"); var id = this.model.get("id"); var optionsString = ""; var options = this.model.get("options"); _.each(options, function(option){ optionsString += option.value + "\\n"; }) %><label>Select style</label><select data-for="theme"><option <%= theme == "fontawesome-stars" ? "selected" : ""  %> value="fontawesome-stars">Round-edges Stars</option><option <%= theme == "css-stars" ? "selected" : ""  %> value="css-stars">Sharp-edges Stars</option><option <%= theme == "bars-1to10" ? "selected" : ""  %> value="bars-1to10">Bars</option><option <%= theme == "bars-horizontal" ? "selected" : ""  %> value="bars-horizontal">Stack bars</option><option <%= theme == "bars-movie" ? "selected" : ""  %> value="bars-movie">Flat bar</option><option <%= theme == "bars-pill" ? "selected" : ""  %> value="bars-pill">Pills</option><option <%= theme == "bars-square" ? "selected" : ""  %> value="bars-square">Blue boxes</option></select><label>Values</label><textarea data-for="options"><%= jQuery.trim(optionsString) %></textarea><label>Initial value</label><select data-for="initial-rating"><% _.each(options, function(option) {  %><option <%= option.value == initialRating ? "selected" : "" %>  value="<%= option.value %>"> <%= option.text %> </option><% }) %></select><label>Show values</label><input <%= this.model.get("showValues")? "checked" : ""%> type="checkbox" data-for="show-labels" /> Show values for each rating<label>Show selected value</label><input <%= this.model.get("showSelectedRating")? "checked" : ""%>  type="checkbox" data-for="show-selected" /> Show currently selected value',advanced:'<label>Field name</label><input data-for="name" type="text" placeholder="set a name for your field" value="<%= this.model.get(\'name\') %>" />',style:'<label>Stars color</label><input type="color" data-for="star-color" />',action:""},Forms={textEdit:{general:textEditOptions.general,advanced:textEditOptions.advanced,style:textEditOptions.style,action:textEditOptions.action,parentClass:"for-text"},checkboxEdit:{general:checkboxEditOptions.general,advanced:checkboxEditOptions.advanced,style:checkboxEditOptions.style,action:checkboxEditOptions.action,parentClass:"for-checkbox"},radioEdit:{general:radioEditOptions.general,advanced:radioEditOptions.advanced,style:radioEditOptions.style,action:radioEditOptions.action,parentClass:"for-radio"},labelEdit:{general:labelEditOptions.general,advanced:labelEditOptions.advanced,style:labelEditOptions.style,action:labelEditOptions.action,parentClass:"for-label"},headingEdit:{general:headingEditOptions.general,advanced:headingEditOptions.advanced,style:headingEditOptions.style,action:headingEditOptions.action,parentClass:"for-heading"},paragraphEdit:{general:paragraphEditOptions.general,advanced:paragraphEditOptions.advanced,style:paragraphEditOptions.style,action:paragraphEditOptions.action,parentClass:"for-paragraph"},textAreaEdit:{general:textAreaEditOptions.general,advanced:textAreaEditOptions.advanced,style:textAreaEditOptions.style,action:textAreaEditOptions.action,parentClass:"for-textarea"},buttonEdit:{general:buttonEditOptions.general,advanced:buttonEditOptions.advanced,style:buttonEditOptions.style,action:buttonEditOptions.action,parentClass:"for-button"},dateEdit:{general:dateEditOptions.general,advanced:dateEditOptions.advanced,style:dateEditOptions.style,action:dateEditOptions.action,parentClass:"for-date"},selectEdit:{general:selectEditOptions.general,advanced:selectEditOptions.advanced,style:selectEditOptions.style,action:selectEditOptions.action,parentClass:"for-select"},acceptanceEdit:{general:acceptanceEditOptions.general,advanced:acceptanceEditOptions.advanced,style:acceptanceEditOptions.style,action:acceptanceEditOptions.action,parentClass:"for-acceptance"},formEdit:{general:formEditOptions.general,advanced:formEditOptions.advanced,style:formEditOptions.style,action:formEditOptions.action,parentClass:"for-form"},rowEdit:{general:rowEditOptions.general,advanced:rowEditOptions.advanced,style:rowEditOptions.style,action:"",parentClass:"for-row"},fileEdit:{general:fileEditOptions.general,advanced:fileEditOptions.advanced,style:fileEditOptions.style,action:fileEditOptions.action,parentClass:"for-file"},imageEdit:{general:imageEditOptions.general,advanced:"",style:"",action:"",parentClass:"for-image"},starsEdit:{general:starsEditOptions.general,advanced:starsEditOptions.advanced,style:"",action:starsEditOptions.action,parentClass:"for-stars"}},C37FormElement=Backbone.View.extend({renderSize:function(){if(this.model&&this.model.get("size")){var a="c37-col-md-"+this.model.get("size").size;this.model.get("size").expand&&(a+=" c37-col-xs-12");for(var b=1;b<=12;b++)this.$el.removeClass("c37-col-md-"+b);this.$el.addClass(a)}}}),Heading=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<h1 class="c37-child">This is heading</h1>'),render:function(){if(this.model){var a="<"+this.model.get("tagName")+'  class="c37-child">'+this.model.get("content")+"</"+this.model.get("tagName")+">";console.log("tagName"+this.model.get("tagName")),this.$el.html(a)}else this.$el.html(this.template)}}),Paragraph=C37FormElement.extend({initialize:function(){this.render()},template:_.template("<p>This is paragraph</p>"),render:function(){this.model?this.$el.html("<p>"+this.model.get("content")+"</p>"):this.$el.html(this.template())}}),Row=Backbone.View.extend({initialize:function(){this.render()},template:_.template('<div class="c37-box c37-col-xs-12"></div>'),render:function(){this.setElement(this.template({}))}}),Step=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<div class="c37-step c37-style-1 c37-container"><div class="c37-row" id="c37-row-0" data-c37-layout="12"><div class="c37-box c37-col-md-12"></div></div></div>'),render:function(){this.setElement(this.template({}))}}),CheckBox=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<span class="c37-single-checkbox" class="c37-child" <% var cid= \'checkbox_id_\' + Math.floor(Math.random() * 10000) %> ><input id="<%= cid %>" type="checkbox" name="<%= name %>" value="First"/><label class="c37-blank-label" for="<%= cid %>"></label> <span> First</span></span> <span class="c37-single-checkbox" class="c37-child" <% var cid= \'checkbox_id_\' + Math.floor(Math.random() * 10000) %> ><input id="<%= cid %>" type="checkbox" name="<%= name %>" value="Second"/><label class="c37-blank-label" for="<%= cid %>"></label> <span> Second</span></span> '),render:function(){if(this.model){var a="",b=this.model.get("name");_.each(this.model.get("options"),function(c){var d=c.checked?"checked":"";a+='<span class="c37-child c37-single-checkbox"><input id="'+c.id+'"  type="checkbox" '+d+'  name="'+b+'" value="'+c.value+'"/><label class="c37-blank-label" for="'+c.id+'"></label> <span>'+decodeURIComponent(c.value)+"</span></span> "}),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-vertical"),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-horizontal"),jQuery(this.$el).closest(".c37-form-element").addClass(this.model.get("alignment")),this.$el.html(a)}else this.$el.html(this.template({name:"checkbox_"+Math.floor(1e3*Math.random())}))}}),Radio=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<span class="c37-single-radio c37-child" <% var cid= \'radio_id_\' + Math.floor(Math.random() * 10000) %>><input id="<%= cid %>" type="radio" name="<%= name %>" value="First" /><label class="c37-blank-label" for="<%= cid %>"></label> <span >First</span></span> <span class="c37-single-radio c37-child" <% var cid= \'radio_id_\' + Math.floor(Math.random() * 10000) %>><input id="<%= cid %>" type="radio" name="<%= name %>" value="Second" /><label class="c37-blank-label" for="<%= cid %>"></label> <span >Second</span></span> '),render:function(){if(this.model){var a="",b=this.model.get("name");_.each(this.model.get("options"),function(c){var d=c.checked?"checked":"";a+='<span class="c37-child c37-single-radio"><input id="'+c.id+'"  type="radio" '+d+'  name="'+b+'" value="'+c.value+'"/> <label class="c37-blank-label" for="'+c.id+'"></label> <span>'+decodeURIComponent(c.value)+"</span></span> "}),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-vertical"),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-horizontal"),jQuery(this.$el).closest(".c37-form-element").addClass(this.model.get("alignment")),this.$el.html(a)}else this.$el.html(this.template({name:"radio_"+Math.floor(1e3*Math.random())}))}}),Text=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<i class="fa fa-envelope c37-suggest-icon"></i><input class="c37-child" id="<%= id %>" name="<%= name %>" type="text" placeholder="enter something" />'),render:function(){if(this.model){"name"!=this.model.get("name")&&"email"!=this.model.get("name")||(console.log("what"),this.model.set({name:"_"+this.model.get("name")}));var a=this.model.get("required")?"required":"",b="";"undefined"!=typeof this.model.get("label")&&""!=this.model.get("label")&&(b+='<label for="'+this.model.get("cssID")+'">'+this.model.get("label")+"</label>"),b+='<i class="fa '+this.model.get("icon")+' c37-suggest-icon"></i><input id="'+this.model.get("cssID")+'" class="c37-child" type="'+this.model.get("type")+'" name="'+this.model.get("name")+'" '+a+' placeholder="'+this.model.get("placeholder")+'" />',this.$el.html(b),this.renderSize()}else this.$el.html(this.template({name:"input_"+Math.floor(1e3*Math.random()),id:"input_"+Math.floor(1e3*Math.random())}))}}),DateInput=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<i class="fa fa-calendar c37-suggest-icon"></i><input class="c37-child" name="<%= name %>" type="date"/>'),render:function(){if(this.model){var a='<i class="fa fa-calendar c37-suggest-icon"></i><input name="'+this.model.get("name")+'" type="'+this.model.get("type")+'" value="'+this.model.get("value")+'"/>';this.$el.html(a)}else this.$el.html(this.template({name:"date_input_"+Math.floor(1e3*Math.random())}))}}),Select=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<select class="c37-child" name="<%= name %>"><option value="Cat">Cat</option><option value="Dog">Dog</option><option value="Chicken">Chicken</option></select>'),render:function(){if(this.model){var a="",b=this.model;_.each(this.model.get("options"),function(c){var d=c.value==b.get("selected_value")?"selected":"";a+="<option "+d+' value="'+c.value+'">'+decodeURIComponent(c.value)+"</option>"}),a='<select name="'+name+'">'+a+"</select>",this.$el.html(a)}else this.$el.html(this.template({name:"select_"+Math.floor(1e3*Math.random())}))}}),Label=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<label for="<%= forID %>"><%= content %></label>'),render:function(){if(this.model)if(this.model.get("required"))this.$el.html("<label>"+this.model.get("content")+'<sup class="required">*</sup></label>');else{var a=this.model.get("content");this.$el.html(this.template({forID:"input_"+Math.floor(1e3*Math.random()),content:a}))}else this.$el.html(this.template({forID:"input_"+Math.floor(1e3*Math.random()),content:"Label"}));this.renderSize()}}),Button=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<button data-role="submit" class="c37-child">Button</button>'),render:function(){if(this.model){var a='<button data-role="submit" class="c37-child">'+this.model.get("text")+"</button>";this.$el.html(a),this.renderSize()}else this.$el.html(this.template())}}),TextArea=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<i class="fa fa-edit c37-suggest-icon"></i><textarea id="<%= id %>" class="c37-child" name="<%= name %>" placeholder="enter something"></textarea>'),render:function(){if(this.model){var a=this.model.get("required")?"required":"",b="";"undefined"!=typeof this.model.get("label")&&""!=this.model.get("label")&&(b+='<label for="'+this.model.get("cssID")+'">'+this.model.get("label")+"</label>"),b+='<i class="fa fa-edit c37-suggest-icon"></i><textarea id="'+this.model.get("cssID")+'" class="c37-child" '+a+' name="'+this.model.get("name")+'" placeholder="'+this.model.get("placeholder")+'"></textarea>',this.$el.html(b),this.renderSize()}else this.$el.html(this.template({name:"textarea_"+Math.floor(1e3*Math.random()),id:"textarea_"+Math.floor(1e3*Math.random())}))}}),File=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<div class="c37-child"></label><input id="<%= field_id %>" class="c37-child" name="<%= name %>" type="file" /><label class="c37-file-label" for="<%= field_id %>"><i class="fa fa-cloud-upload"></i> <%= text %> </div>'),render:function(){if(this.model){var a=this.model.get("multiple")?"multiple":"",b=this.model.get("multiple")?this.model.get("name"):this.model.get("name"),c=this.model.get("required")?"required":"";console.log("require is: "+c);var d=this.model.get("file_type")?'accept="'+this.model.get("file_type").type+'"':"",e=this.model.get("icon"),f=this.model.get("text"),g='<div class="c37-child"><label class="c37-file-label" for="'+this.model.get("field_id")+'"><i class="fa '+e+'"></i>'+f+"</label><input "+c+' type="file" id="'+this.model.get("field_id")+'" name="'+b+'" '+a+" "+d+" /></div>";this.$el.html(g)}else this.$el.html(this.template({name:"attachment_"+Math.floor(1e3*Math.random()),field_id:"c37_attachment_"+Math.floor(1e4*Math.random()),text:"Select file..."}))}}),Acceptance=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<input class="c37-acceptance" id="<%= id %>" data-error="Please accept this" name="<%= name %>" type="checkbox" /><label for="<%= id %>" class="c37-acceptance-label"></label> <span class="c37-child">I agree with terms of service</span>'),render:function(){if(this.model){console.log(this.model);var a='<input id="'+this.model.get("id")+'" data-error="'+this.model.get("error_message")+'" class="c37-acceptance" name="'+this.model.get("name")+'" type="checkbox" /><label for="'+this.model.get("id")+'" class="c37-acceptance-label"></label> <span class="c37-child">'+this.model.get("text")+"</span>";this.$el.html(a)}else this.$el.html(this.template({name:"acceptance",id:"acceptance_id_"+Math.floor(1e4*Math.random())}))}}),ReCaptcha=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<div class="g-recaptcha" data-sitekey="<%= site_key %>"></div>'),render:function(){serverSettings.recaptchaSiteKey||swal("You haven't configured recaptcha settings. Please get reCaptcha keys first"),this.$el.html(this.template({site_key:serverSettings.recaptchaSiteKey}))}}),FieldSet=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<fieldset class="c37-box"><legend>Fieldset legend:</legend></fieldset>'),render:function(){this.setElement(this.template({}))}}),Image=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<img src="<%= imgSrc %>"/>'),render:function(){this.model?this.$el.html(this.template({imgSrc:this.model.get("imgSrc")})):this.$el.html(this.template({imgSrc:defaultValues.imagePlaceholder}))}}),Stars=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<select name="<%= name %>" data-show-selected="false" data-show-values="false" data-initial-rating="1" data-theme="<%= theme %>" class="c37-star-rating" id="<%= id %>"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>'),render:function(){var a="";if(this.model){var b="",c=this.model;_.each(this.model.get("options"),function(a){b+='<option value="'+a.value+'">'+a.text+"</option>"}),this.$el.html('<select data-theme="'+c.get("theme")+'" class="c37-star-rating" id="'+c.get("id")+'"data-initial-rating="'+c.get("initialRating")+'"data-show-selected="'+c.get("showSelectedRating")+'"data-show-values="'+c.get("showValues")+'"name="'+c.get("name")+'"">'+b+"</select>"),a=c.get("id"),console.log("render with model")}else a="star-id-"+Math.floor(1e4*Math.random()),this.$el.html(this.template({id:a,theme:defaultValues.starsRatingOptions.theme,name:"star-"+Math.round(1e4*Math.random())}));this.renderRating(a)},renderRating:function(a){var b=this;jQuery(function(){a="#"+a,b.model&&(console.log("rendering with theme: "+b.model.get("theme")),defaultValues.starsRatingOptions.theme=b.model.get("theme"),defaultValues.starsRatingOptions.showValues=b.model.get("showValues"),defaultValues.starsRatingOptions.initialRating=b.model.get("initialRating"),defaultValues.starsRatingOptions.showSelectedRating=b.model.get("showSelectedRating")),setTimeout(function(){jQuery(a).barrating(defaultValues.starsRatingOptions)},0)})}}),Templates={checkbox:CheckBox,radio:Radio,textarea:TextArea,text:Text,date:DateInput,select:Select,label:Label,file:File,button:Button,acceptance:Acceptance,row:Row,heading:Heading,paragraph:Paragraph,step:Step,fieldset:FieldSet,recaptcha:ReCaptcha,image:Image,stars:Stars},ElementEditView=Backbone.View.extend({el:"#element-settings",originalEvents:{"change .validation input":"renderValidation","change .validation select":"renderValidation","change .element-action select":renderAction,"input .element-action input":renderAction,"input .css-styles input":"renderStyle","change .css-styles select":"renderStyle","blur [data-for=custom-css]":"renderStyle","blur [data-for=extra-classes]":"applyExtraClass","click #change-background-image":"changeImageBg","click #remove-background-image":"removeImageBg","click [data-for=background-color] .reset-color":"clearBgColor"},additionalEvents:{},events:function(){return _.extend({},this.originalEvents,this.additionalEvents)},renderSizeObject:function(){var a={};a.size=this.$el.find("select[data-for=element-width]").val(),a.expand=!1,this.$el.find("input[data-for=expand]").is(":checked")&&(a.expand=!0),this.model.set({size:a})},renderValidation:function(){console.log("render in parent, change event");var a=this.$el.find(".validation").first(),b=jQuery(a).find("input[data-for=required]").first().is(":checked"),c=this.model.get("editingElementID"),d=this.$el.find("[data-for=name]").val();this.model.set({required:b});var e=this.$el.find(".validation select[data-for=file-type]").first().val();this.model.set({file_type:e}),validation[c]={name:d,rules:{required:b}}},renderAction:function(){},renderStyle:function(){var a=this.model.get("editingElementID");console.log("id is: "+a);var b=this.$el.find("[data-for=text-color] input").first().val(),c=this.$el.find("[data-for=background-color] input").first().val();"undefined"==typeof elementsStyles[a]&&(elementsStyles[a]={}),elementsStyles[a]["background-color"]=c,elementsStyles[a].color=b,this.applyStyle()},applyStyle:function(){var a="";for(var b in elementsStyles){var c=elementsStyles[b],d="";for(var e in c)d+=e+":"+c[e]+";";a+="#"+core37Form.formSettings.cssID+" #"+b+" .c37-child{"+d+"}"}0==jQuery("#element-styles").length&&jQuery("head").append('<style id="element-styles"></style>'),jQuery("#element-styles").text(""),jQuery("#element-styles").text(a)}}),TextEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("textEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-text [data-for=placeholder]":"updateModel","input .for-text [data-for=name]":"updateModel","blur .for-text [data-for=icon]":"updateModel","input .for-text [data-for=input-label]":"updateModel","change .for-text select[data-for=input-type]":"updateModel","change .for-text select[data-for=element-width]":"updateModel","change .for-text input[data-for=expand]":"updateModel","change .validation input":"renderValidation","change .for-text input[data-for=reply-to]":"updateModel","change .for-text input[data-for=email-subject]":"updateModel"},updateModel:function(){ElementEditView.prototype.renderValidation.apply(this);var a=this.$el.find("[data-for=placeholder]").first().val(),b=this.$el.find("[data-for=input-label]").first().val(),c=this.$el.find("select[data-for=input-type]").first().find(":selected").val(),d=this.$el.find("[data-for=name]").first().val(),e=this.$el.find(".validation input[type=checkbox]").first().is(":checked"),f=this.$el.find("[data-for=icon]").first().val(),g=this.$el.find("[data-for=email-subject]").first().is(":checked"),h=this.$el.find("[data-for=reply-to]").first().is(":checked"),i=jQuery(".reply-to"),j=jQuery(".email-subject");"email"==c?(i.show(),i.removeClass("hidden"),h&&(core37Form.formSettings.replyToField=d)):i.hide(),"text"==c?(j.removeClass("hidden"),j.show(),g&&(core37Form.formSettings.subjectField=d)):j.hide(),this.renderSizeObject(),this.model.set({name:d,required:e,type:c,placeholder:a,label:b,icon:f})}}),CheckBoxEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("checkboxEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"click .for-checkbox .add-option":"addOption","input .for-checkbox .options input":"updateModel","change .for-checkbox .options input[type=checkbox]":"updateModel","input .for-checkbox [data-for=name]":"updateModel","change .for-checkbox select[data-for=alignment]":"updateModel","change .for-checkbox select[data-for=element-width]":"updateModel","change .for-checkbox input[data-for=expand]":"updateModel","change .element-action select":renderAction,"input .element-action input":renderAction,"input [data-for=text-color] input":"renderStyle","input [data-for=background-color] input":"renderStyle"},addOption:function(){this.$el.find(".options").append('<div><span class="c37-col-xs-8"><input data-for="value" type="text" placeholder="value" />  </span><span class="c37-col-xs-4 check"><input data-for="checked" type="checkbox" /> </span><span class="hidden"><input type="text" data-for="id" value="checkbox_id_'+Math.floor(1e4*Math.random())+'" /> </span></div>')},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=alignment]").first().val(),c=[];this.$el.find(".options > div").each(function(){var a=jQuery(this).find("[data-for=value]").first(),b=jQuery(this).find("[data-for=checked]").first().is(":checked"),d=jQuery(this).find("[data-for=id]").first();if(console.log(a.val()),""!=a.val()){var e={value:encodeURIComponent(a.val()),checked:b,id:d.val()};c.push(e)}}),this.renderSizeObject(),this.model.set({name:a,options:c,alignment:b})}}),RadioEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("radioEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"click .for-radio .add-option":"addOption","input .for-radio .options input":"updateModel","change .for-radio .options input[type=radio]":"updateModel","input .for-radio [data-for=name]":"updateModel","change .for-radio select[data-for=alignment]":"updateModel","change .for-radio select[data-for=element-width]":"updateModel","change .for-radio input[data-for=expand]":"updateModel","change .element-action select":renderAction,"input .element-action input":renderAction,"input [data-for=text-color] input":renderCSS,"input [data-for=background-color] input":renderCSS},removeElement:removeElement,addOption:function(){this.$el.find(".options").append('<div><span class="c37-col-xs-8"><input data-for="value" type="text" placeholder="value" />  </span><span class="c37-col-xs-4 check"><input data-for="checked" type="radio" /> </span><span class="hidden"><input data-for="id" type="text" value="radio_id_'+Math.floor(1e4*Math.random())+'" /> </span></div>')},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=alignment]").first().val(),c=[];this.$el.find(".options > div").each(function(){var a=jQuery(this).find("[data-for=value]").first(),b=jQuery(this).find("[data-for=checked]").first().is(":checked"),d=jQuery(this).find("[data-for=id]");if(""!=a.val()){var e={value:encodeURIComponent(a.val()),checked:b,id:d.val()};c.push(e)}}),this.renderSizeObject(),this.model.set({name:a,options:c,alignment:b})}}),LabelEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("labelEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-label [data-for=label]":"updateModel","change .for-label [data-for=required]":"updateModel","change .for-label select[data-for=element-width]":"updateModel","change .for-label input[data-for=expand]":"updateModel","input [data-for=text-color] input":renderCSS,"input [data-for=background-color] input":renderCSS},updateModel:function(){var a=this.$el.find("input[data-for=label]").first().val(),b=this.$el.find("input[data-for=required]").first().is(":checked");console.log(b),console.log("label update"),this.renderSizeObject(),this.model.set({content:a,required:b})}}),HeadingEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("headingEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-heading [data-for=heading]":"updateModel","change .for-heading [data-for=tagName]":"updateModel","change .for-heading select[data-for=element-width]":"updateModel","change .for-heading input[data-for=expand]":"updateModel","input [data-for=text-color] input":"renderStyle","input [data-for=background-color] input":"renderStyle"},updateModel:function(){var a=this.$el.find("input[data-for=heading]").first().val(),b=this.$el.find("[data-for=tagName]").val();console.log(b),this.model.set({content:a,tagName:b}),this.renderSizeObject()}}),ParagraphEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("paragraphEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-paragraph textarea[data-for=paragraph]":"updateModel","change .for-paragraph select[data-for=element-width]":"updateModel","change .for-paragraph input[data-for=expand]":"updateModel","input [data-for=text-color] input":"renderStyle","input [data-for=background-color] input":"renderStyle"},updateModel:function(){var a=this.$el.find("textarea[data-for=paragraph]").first().val();this.model.set({content:a}),this.renderSizeObject()}}),TextAreaEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("textAreaEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-textarea input[type=text]":"updateModel","change .for-textarea input[type=checkbox]":"updateModel","change .for-textarea input[data-for=required]":"updateModel","input .for-textarea [data-for=input-label]":"updateModel","change .for-textarea select[data-for=element-width]":"updateModel","change .for-textarea input[data-for=expand]":"updateModel","change .element-action select":renderAction,"input .element-action input":renderAction,"input [data-for=text-color] input":"renderStyle","input [data-for=background-color] input":"renderStyle"},updateModel:function(){var a=this.$el.find("input[data-for=placeholder]").first().val(),b=this.$el.find("input[data-for=name]").first().val(),c=this.$el.find("input[data-for=required]").first().is(":checked"),d=this.$el.find("[data-for=input-label]").first().val();this.model.set({name:b,required:c,placeholder:a,label:d}),this.renderSizeObject()}}),DateEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("dateEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-date [data-for=default-value]":"renderDateElement", 
    4 "input .for-date [data-for=name]":"renderDateElement","change .for-date select[data-for=element-width]":"renderDateElement","change .for-date input[data-for=expand]":"renderDateElement","click .for-date .remove-element":"removeElement","change .for-date [data-for=date-type]":"renderDateElement","change .element-action select":renderAction,"input .element-action input":renderAction,"input [data-for=text-color] input":renderCSS,"input [data-for=background-color] input":renderCSS},renderDateElement:function(){var a=(this.editingElement(),this.$el.find("[data-for=default-value]").first().val()),b=this.$el.find("select[data-for=date-type]").first().find(":selected").val(),c=this.$el.find("[data-for=name]").first().val();this.model.set({value:a,type:b,name:c}),this.renderSizeObject(),this.$el.find("[data-for=default-value]").attr("type",b)}}),ButtonEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("buttonEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-button input[data-for=text]":"updateModel","input .for-button input[data-for=url]":"updateModel","input .for-button input[data-for=name]":"updateModel","change .for-button select[data-for=element-width]":"updateModel","change .for-button input[data-for=expand]":"updateModel"},updateModel:function(){var a=this.$el.find("input[data-for=text]").first().val(),b=this.$el.find("input[data-for=name]").first().val();this.model.set({name:b,text:a}),this.renderSizeObject()}}),SelectEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("selectEdit")),render:function(){this.$el.html(this.template())},events:{"input .for-select .options input":"updateModel","input .for-select [data-for=name]":"updateModel","input .for-select [data-for=value]":"updateModel","input .for-select [data-for=selected]":"updateSelected","change .for-select select[data-for=element-width]":"updateModel","change .for-select input[data-for=expand]":"updateModel","change .element-action select":renderAction,"input .element-action input":renderAction,"input [data-for=text-color] input":"renderStyle","input [data-for=background-color] input":"renderStyle"},updateSelected:function(){var a=this.$el.find("[data-for=selected]").val();this.model.set({selected_value:a})},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=value]").first().val().split("\n"),c=this.model.get("selected_value"),d="";_.each(b,function(a){var b=a==c?"selected":"";d+="<option "+b+'  value="'+encodeURIComponent(a)+'">'+a+"</option>"}),this.$el.find("[data-for=selected]").first().html(d);var e=[];_.each(b,function(a){var b={value:encodeURIComponent(a)};e.push(b)}),this.model.set({name:a,options:e}),this.renderSizeObject()}}),AcceptanceEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("acceptanceEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-acceptance [data-for=text]":"updateModel","input .for-acceptance [data-for=error]":"updateModel","change .for-acceptance input[data-for=expand]":"updateModel","change .for-acceptance select[data-for=element-width]":"updateModel","change .element-action select":renderAction,"input .element-action input":renderAction,"input [data-for=text-color] input":"renderStyle","input [data-for=background-color] input":"renderStyle"},updateModel:function(){var a=this.$el.find("input[data-for=text]").first().val(),b=this.$el.find("[data-for=name]").first().val(),c=this.$el.find("[data-for=error]").first().val();this.model.set({name:b,text:a,error_message:c}),this.renderSizeObject()}}),FileEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},template:_.template(getEditForm("fileEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-file [data-for=name]":"updateModel","change .for-file input[data-for=multiple]":"updateModel","blur .for-file [data-for=icon]":"updateModel","blur .for-file [data-for=file-type]":"updateModel","input .for-file [data-for=text]":"updateModel"},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=multiple]").is(":checked"),c=this.$el.find("[data-for=text]").first().val(),d=this.$el.find("[data-for=icon]").first().val(),e={type:this.$el.find("[data-for=file-type]").first().find(":selected").val(),details:""};this.model.set({name:a,multiple:b,file_type:e,text:c,icon:d}),this.renderSizeObject()}}),ImageEdit=ElementEditView.extend({el:"#element-settings",frame:null,initialize:function(){this.render()},template:_.template(getEditForm("imageEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"click .for-image #c37-image-picker":"openImageSelector"},updateModel:function(){},openImageSelector:function(){if(!versionNangCap)return void toastr.info(UPGRADE_TO_USE_IMAGE);if(console.log("image"),this.frame)return void this.frame.open();var a=this.$el,b=this.frame,c=this.model;b=wp.media({title:"select an image",button:{text:"Use this image"},multiple:!1}),b.on("select",function(){var d=b.state().get("selection").first().toJSON();console.log(d.url),a.find(".c37-image-preview").first().attr("src",d.url),c.set({imgSrc:d.url})}),b.open()}}),StarsEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render(),console.log(this.model.get("theme")),console.log(this.model.get("id"))},template:_.template(getEditForm("starsEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"change .for-stars [data-for=theme]":"updateModel","input .for-stars [data-for=options]":"updateModel","change .for-stars [data-for=initial-rating]":"updateInitialValue","change .for-stars [data-for=show-labels]":"updateModel","change .for-stars [data-for=show-selected]":"updateModel","change .for-stars [data-for=name]":"updateModel"},updateInitialValue:function(){return versionNangCap?void this.model.set({initialRating:this.$el.find("[data-for=initial-rating]").first().val()}):void toastr.info(UPGRADE_TO_USE_RATING)},updateModel:function(){if(!versionNangCap)return void toastr.info(UPGRADE_TO_USE_RATING);var a=this.model,b=this.$el.find("[data-for=theme]").first().val(),c=this.$el.find("[data-for=name]").first().val(),d=this.$el.find("[data-for=show-labels]").first().is(":checked"),e=this.$el.find("[data-for=show-selected]").first().is(":checked"),f=[],g=jQuery.trim(this.$el.find("[data-for=options]").first().val());_.each(g.split("\n"),function(a){f.push({value:a,text:a})});var h="";_.each(f,function(b){var c=b.value==a.get("initialRating")?"selected":"";h+="<option "+c+' value="'+b.value+'"  >'+b.text+"</option>"}),this.$el.find("select[data-for=initial-rating]").first().html(h);var i=this.$el.find("[data-for=initial-rating]").first().val();this.model.set({showValues:d,options:f,theme:b,initialRating:i,showSelectedRating:e,name:c})}}),RowEdit=ElementEditView.extend({el:"#row-settings",initialize:function(){this.render()},editingRow:function(){return jQuery("#"+this.model.get("rowID"))},template:_.template(getEditForm("rowEdit")),reset:function(){this.$el.html(""),this.unbind(),this.model.unbind()},render:function(){this.$el.html(this.template({layout:this.model.get("layout")}))},additionalEvents:{"change .for-row select[data-for=layout]":"renderRow","click .for-row .remove-element":"removeRow"},removeRow:function(){var a=this.editingRow().parent(".c37-step");a.find(".c37-row").length>1?this.editingRow().remove():(this.editingRow().find("*").remove(),this.editingRow().append('<div class="c37-box c37-col-md-12"></div>'),makeC37BoxDroppable(jQuery))},renderRow:function(){function a(a){var b=a.attr("class").split(/\s+/),c="";return _.each(b,function(a){a.indexOf("c37-col-md-")!=-1&&(c=a)}),c}function b(a){var b=[],c=a.find(".c37-box");return _.each(c,function(a){0==jQuery(a).find(".c37-item-element").length&&b.push(a)}),b}function c(b,c){b.find(".c37-box").each(function(b){console.log(a(jQuery(this))),console.log("Index: ",c[b]),jQuery(this).removeClass(a(jQuery(this))).addClass("c37-col-md-"+c[b])})}console.log("calling render row");var d=this.editingRow(),e=d.attr("data-c37-layout"),f=this.$el.find("select[data-for=layout]").first().val();if(e!=f){var g=e.split("-"),h=f.split("-");if(g.length==h.length)c(d,h);else if(g.length>h.length){var i=g.length-h.length,j=b(d);if(i>j.length)return void alert("You do not have enough blank box"+i+"---"+j.length);for(var k=i;k>0;k--)jQuery(j[j.length-k]).remove();console.log(h),c(d,h)}else if(g.length<h.length){var l=h.length-g.length;console.log("column to add: "+l);for(var k=0;k<l;k++)d.append('<div class="c37-box"></div>');c(d,h),makeC37BoxDroppable(jQuery)}d.attr("data-c37-layout",f)}}}),FormEdit=ElementEditView.extend({el:"#form-settings",initialize:function(){this.render()},template:_.template(getEditForm("formEdit")),render:function(){this.$el.html(this.template({}))},additionalEvents:{"change .for-form input":"renderForm","input .for-form input":"renderForm","change .for-form select[data-for=form-style]":"updateStyle"},updateStyle:function(){for(var a=jQuery("#construction-site > form"),b=this.$el.find("[data-for=form-style]").first().val(),c=!1,d=0;d<core37Form.styles.length;d++)if(core37Form.styles[d].class==b){c=core37Form.styles[d].is_pro;break}c&&!versionNangCap?toastr.info(UPGRADE_TO_UNLOCK_TEMPLATE):core37Form.formSettings.presetCSSStyle=b,core37Form.formSettings.presetCSSStyle=b,_.each(core37Form.styles,function(b){a.removeClass(b.class)}),a.addClass(b)},renderForm:function(){var a=this.$el.find("[data-for=width]").first().val(),b=(this.$el.find("[data-for=bgColor]").first().val(),this.$el.find("[data-for=afterSubmitURL]").first().val()),c=this.$el.find("[data-for=sendNotification]").is(":checked"),d=this.$el.find("[data-for=sendAutoReply]").is(":checked"),e=this.$el.find("[data-for=afterSubmitMessage]").val();core37Form.formSettings.afterSubmitURL=b,core37Form.formSettings.sendNotification=c,core37Form.formSettings.sendAutoReply=d,core37Form.formSettings.afterSubmitMessage=e,core37Form.formName=this.$el.find("[data-for=name]").first().val(),core37Form.formSettings.width=a;var f=jQuery("#construction-site > form");""!=a?f.css("width",a):(f.css("width",""),f.attr("data-c37-full-width",""))}}),FormsList=Backbone.View.extend({default:{forms:{}},el:"#forms-list",initialize:function(){console.log("loading forms"),this.render()},template:_.template('<h4><i class="fa fa-close close-panel"></i> All forms</h4><ul><% _.each(forms, function(form) { %><li class="form-edit" form-id="<%= form.id %>"> <i class="fa fa-pencil"></i>  <i class="fa fa-code"></i> <i class="fa fa-trash"></i> <%= form.title %></li><% }) %></ul>'),render:function(){this.$el.html(this.template({forms:this.model.get("forms")}))}});!function(a){a(function(){versionNangCap&&a("#c37-go-pro").hide(),makeFromDroppable(a),makeC37BoxDroppable(a),makeC37StepDroppable(a),a("#construction-site form").attr("id",core37Form.formSettings.cssID),a(document).on("click",".c37-step .c37-item-element",function(a){a.preventDefault()}),a("#elements-panel").accordion(),a(".c37-container-element").draggable({connectToSortable:".c37-step",helper:"clone",revert:"invalid",addClasses:!1}),a(".c37-form-multi-element").draggable({connectToSortable:".c37-step-container",helper:"clone",revert:"invalid",addClasses:!1}),a(".c37-item-element").draggable({connectToSortable:".c37-box",helper:"clone",revert:"invalid",iframeFix:!0,addClasses:!1,refreshPositions:!0,stop:function(){localStorage.setItem("dragging-stop",!0)},start:function(){localStorage.setItem("dragging-stop",!1)}})})}(jQuery),function(a){function b(b){var c,d=a("#"+b),e=d.attr("data-c37-type"),i=f(d);"undefined"!=typeof h&&h.remove();var j={};"undefined"!=typeof elementsActions[b]&&(j=elementsActions[b]);var k=[];if(_.each(a("#construction-site .c37-item-element"),function(c){var d=a(c).attr("id");d!=b&&k.push({id:a(c).attr("id"),name:a(c).find("[name]").first().attr("name")})}),g=new C37ElementModel({action:j,allElements:k}),"undefined"!=typeof validation[b]?g.set({vali:validation[b].rules}):g.set({vali:{}}),"text"==e){var l=!1;d.find(".c37-suggest-icon").length>0&&(console.log("found"),l=d.find(".c37-suggest-icon").first().attr("class").split(" ")[1],console.log(l)),g.set({placeholder:d.find("input").first().attr("placeholder"),editingElementID:b,type:d.find("input").first().attr("type"),name:d.find("input").first().attr("name"),size:i,label:d.find("label").first().html(),cssID:d.find("input").first().attr("id"),icon:l}),c=new Text({model:g,el:"#"+b}),c.render(),g.on("change",function(){c.render()}),h=new TextEdit({model:g}),renderFontAwesome("fa-icon-input")}else if("checkbox"==e){var m=[];d.find(".c37-single-checkbox").each(function(){var b={value:a(this).find("input").first().attr("value"),checked:a(this).find("input").first().prop("checked"),id:a(this).find("input").first().attr("id")};m.push(b)}),g.set({options:m,name:d.find("input").first().attr("name").replace("[","").replace("]",""),editingElementID:b,size:i,alignment:d.hasClass("c37-vertical")?"c37-vertical":"c37-horizontal"}),c=new CheckBox({model:g,el:"#"+b}),c.render(),g.on("change",function(){c.render()}),h=new CheckBoxEdit({model:g})}else if("radio"==e){var m=[];d.find(".c37-single-radio").each(function(){var b={value:a(this).find("input").first().attr("value"),checked:a(this).find("input").first().prop("checked"),id:a(this).find("input").first().attr("id")};m.push(b)}),g.set({options:m,name:d.find("input").first().attr("name"),size:i,alignment:d.hasClass("c37-vertical")?"c37-vertical":"c37-horizontal"}),c=new Radio({model:g,el:"#"+b}),c.render(),g.on("change",function(){c.render()}),h=new RadioEdit({model:g})}else if("label"==e)g.set({content:d.find("label").first().html().replace('<sup class="required">*</sup>',"")}),g.set({required:d.find("sup").length>0}),g.set({editingElementID:b}),g.set({size:i}),c=new Label({model:g,el:"#"+b}),h=new LabelEdit({model:g});else if("heading"==e)g.set({content:d.find(":header").first().html()}),g.set({tagName:d.find(":header").first().prop("tagName").toLowerCase()}),g.set({editingElementID:b}),g.set({size:i}),c=new Heading({model:g,el:"#"+b}),h=new HeadingEdit({model:g});else if("paragraph"==e)g.set({content:d.find("p").first().html()}),g.set({editingElementID:b}),g.set({size:i}),c=new Paragraph({model:g,el:"#"+b}),h=new ParagraphEdit({model:g});else if("date"==e)g.set({value:d.find("input").first().attr("value")}),g.set({required:0==d.find("input").first().prop("required")?"":"required"}),g.set({editingElementID:b}),g.set({type:d.find("input").first().attr("type")}),g.set({name:d.find("input").first().attr("name")}),g.set({size:i}),c=new DateInput({model:g,el:"#"+b}),h=new DateEdit({model:g});else if("textarea"==e)g.set({editingElementID:b,name:d.find("textarea").first().attr("name"),placeholder:d.find("textarea").first().attr("placeholder"),label:d.find("label").first().html(),cssID:d.find("textarea").first().attr("id"),size:i}),c=new TextArea({model:g,el:"#"+b}),h=new TextAreaEdit({model:g});else if("button"==e){var n=d.find("button").first();g.set({text:n.html()}),g.set({name:n.attr("name")}),g.set({editingElementID:b}),g.set({size:i}),c=new Button({model:g,el:"#"+b}),h=new ButtonEdit({model:g})}else if("select"==e){var m=[];d.find("option").each(function(){var b={value:a(this).attr("value")};m.push(b)}),g.set({options:m,name:d.find("select").first().attr("name"),editingElementID:b,size:i,selected_value:d.find("select").first().val()}),c=new Select({model:g,el:"#"+b}),h=new SelectEdit({model:g})}else if("acceptance"==e)g.set({error_message:d.find("input").first().attr("data-error"),name:d.find("input").first().attr("name"),text:d.find("span").first().html(),editingElementID:b,id:d.find("input").first().attr("id"),size:i}),c=new Acceptance({model:g,el:"#"+b}),h=new AcceptanceEdit({model:g});else if("file"==e)g.set({name:d.find("input").first().attr("name").replace("[","").replace("]",""),multiple:d.find("input").first().prop("multiple"),required:d.find("input").first().prop("required"),field_id:d.find("input").first().attr("id"),editingElementID:b,text:d.find(".c37-file-label").first().text(),icon:d.find("i").attr("class"),file_type:d.find("input").first().attr("accept")}),c=new File({model:g,el:"#"+b}),h=new FileEdit({model:g}),renderFontAwesome("fa-icon-input");else if("image"==e)g.set({imgSrc:d.find("img").first().attr("src")}),c=new Image({model:g,el:"#"+b}),h=new ImageEdit({model:g});else if("stars"==e){var o=d.find("select").first(),p=o.attr("data-theme"),q=o.attr("id"),m=[],r=o.attr("data-initial-rating"),s="true"==o.attr("data-show-values"),t="true"==o.attr("data-show-selected"),u=o.attr("name");_.each(o.find("option"),function(b){m.push({value:a(b).val(),text:a(b).html()})}),g.set({theme:p,id:q,options:m,initialRating:r,showValues:s,showSelectedRating:t,name:u}),c=new Stars({model:g,el:"#"+b}),h=new StarsEdit({model:g})}c.render(),g.on("change",function(){c.render()}),a("#setting-tabs").tabs({active:0}),a(document).on("click","#setting-tabs ul li a",function(){a("#setting-tabs ul li a").removeClass("active-tab"),a(this).addClass("active-tab")})}function c(b){swal({title:"Delete this element?",text:"This action cannot be undone. Be very careful",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",closeOnConfirm:!0},function(c){if(c){var d=a("#"+b);"undefined"!=typeof validation[b]&&delete validation[b],d.remove(),console.log("deleted")}})}function d(){k=new FormEdit({model:new C37ElementModel(core37Form.formSettings)}),a("#setting-tabs").tabs({active:0}),a(document).on("click","#setting-tabs ul li a",function(){a("#setting-tabs ul li a").removeClass("active-tab"),a(this).addClass("active-tab")})}function e(b,c){"undefined"!=typeof i&&i.clear(),i=new C37ElementModel({rowID:b,layout:c}),"undefined"!=typeof j&&j.remove(),j=new RowEdit({model:i}),a("#setting-tabs").tabs({active:0}),a(document).on("click","#setting-tabs ul li a",function(){a("#setting-tabs ul li a").removeClass("active-tab"),a(this).addClass("active-tab")})}function f(a){var b=a.hasClass("c37-col-xs-12"),c=a.attr("class"),d=12;if(c.indexOf("c37-col-md-")!=-1){var e=c.split("c37-col-md-");d=e[1].split(" ")[0]}return{expand:b,size:d}}var g,h,i,j,k,l=a("#options-window"),m='<div class="c37-element-cm"><span class="cm-move"><i class="fa fa-arrows"></i></span><span class="cm-edit"><i class="fa fa-pencil"></i></span><span class="cm-del"><i class="fa fa-trash"></i></span></div>',n='<div class="c37-row-cm"><span class="cm-row-move"><i class="fa fa-arrows"></i></span><span class="cm-row-edit"><i class="fa fa-pencil"></i></span><span class="cm-box-edit"><i class="fa fa-square"></i></span><span class="cm-row-del"><i class="fa fa-trash"></i></span></div>';a(document).on("click",".close-panel",function(){hideOptionsWindow(a)}),a(document).on("mouseover",".c37-step .c37-item-element",function(){0==a(this).find(".c37-element-cm").length&&a(this).append(m)}),a(document).on("mouseleave",".c37-step .c37-item-element",function(){a(this).find(".c37-element-cm").remove()}),a(document).on("mouseover",".c37-step .c37-box",function(){0==a(this).find(".c37-row-cm").length&&a(this).append(n)}),a(document).on("mouseleave",".c37-step .c37-box",function(){a(this).find(".c37-row-cm").remove()}),a(document).on("click",".cm-del",function(){var b=a(this).closest(".c37-item-element");console.log("about to delete"),swal({title:"Delete this element?",text:"This action cannot be undone. Be very careful",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",closeOnConfirm:!0},function(a){if(a){var c=b.attr("id");console.log(c),"undefined"!=typeof validation[c]&&delete validation[c],b.remove(),console.log("deleted")}})}),a(document).on("click",".c37-element-cm .cm-edit",function(){a("#options-window").html(""),a("#options-window").append('<div id="element-settings"></div>');var c=a(this).closest(".c37-item-element").attr("id");b(c),l.hide(),showOptionsWindow(a),a("#options-window").draggable({handle:"#move-panel"})}),a(document).on("click",".c37-element-cm .cm-del",function(){var b=a(this).closest(".c37-item-element").attr("id");c(b)}),a(document).on("click",".c37-row-cm .cm-row-edit",function(b){a("#options-window").html(""),a("#options-window").append('<div id="row-settings"></div>');var c=a(this).closest(".c37-row").attr("id"),d=a(this).closest(".c37-row").attr("data-c37-layout");e(c,d),hideOptionsWindow(a),showOptionsWindow(a),a("#options-window").draggable({handle:"#move-panel"})}),a(document).on("click",".c37-row-cm .cm-row-del",function(){var b=a(this).closest(".c37-row").attr("id");c(b)}),a(document).on("click","#open-form-settings",function(){a("#options-window").html(""),a("#options-window").append('<div id="form-settings"></div>'),d(),hideOptionsWindow(a),showOptionsWindow(a)})}(jQuery),function(a){a(document).on("click","#save-form",function(){if(console.log(core37Form),""==a.trim(core37Form.formName))return void toastr.error(ERROR_MISSING_FORM_NAME);var b="",c=a("#construction-site .c37-step");_.each(c,function(a){b+=encodeURIComponent(a.outerHTML)}),a.post(ajaxurl,{formContent:b,elementsActions:JSON.stringify(elementsActions),formID:core37Form.formID,formSettings:JSON.stringify(core37Form.formSettings),formName:core37Form.formName,action:"core37_save_form",formValidation:JSON.stringify(validation),formCSSCode:encodeURIComponent(a("#element-styles").text()),formCSSObject:JSON.stringify(elementsStyles)},function(a){core37Form.formID=parseInt(a),toastr.success(SUCCESS_FORM_SAVED)})}),a(document).on("click","#get-forms",function(b){a.post(ajaxurl,{action:"core37_list_forms"},function(b){var c=a("#options-window");c.html(""),c.append('<div id="forms-list"></div>');var d=new C37ElementModel({});d.set("forms",JSON.parse(b)),new FormsList({model:d}),c.show()})}),a(document).on("click",".form-edit i.fa-pencil",function(){var b=a(this).closest("li").attr("form-id");a.post(ajaxurl,{action:"core37_load_form",formID:b},function(c){var d=JSON.parse(c);elementsActions=JSON.parse(d.elementsActions),core37Form.formSettings=JSON.parse(d.formSettings),validation=JSON.parse(d.formValidation),elementsStyles=JSON.parse(d.formCSSObject),a("#element-styles").remove(),a("head").append('<style id="element-styles"></style>'),a("#element-styles").text(decodeURIComponent(d.formCSSCode));var e='<form class="c37-form c37-container '+core37Form.formSettings.presetCSSStyle+' " method="'+core37Form.formSettings.method+'" action="'+core37Form.formSettings.action+'" enctype="application/x-www-form-urlencoded" id="'+core37Form.formSettings.cssID+'" style="width: '+core37Form.formSettings.width+'px;">'+decodeURIComponent(d.formData.post_content)+"</form>";a("#construction-site").html(e),core37Form.formName=d.formData.post_title,core37Form.formID=b,makeFromDroppable(a),makeC37BoxDroppable(a),makeC37StepDroppable(a),restoreStarsRating(a),hideOptionsWindow(a)})}),a(document).on("click",".form-edit i.fa-trash",function(){var b=a(this).closest("li").attr("form-id"),c=a(this);swal({title:"Are you sure?",text:"You will not be able to recover this form!",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",closeOnConfirm:!1,html:!1},function(){a.post(ajaxurl,{action:"core37_delete_form",formID:b},function(){c.closest(".form-edit").hide("slide",{direction:"up"},200)}),swal("Deleted!","Your form has been deleted.","success")})}),a(document).on("click",".form-edit i.fa-code",function(){var b=a(this).closest("li").attr("form-id");swal("Here is your shortcode","[core37_form id="+b+"]","success")})}(jQuery),function(){jQuery(function(){jQuery(".c37-form input[type=file]").on("change",function(){for(var a="",b=0;b<jQuery(this).get(0).files.length;++b)a+='<span class="c37-selected-file">'+jQuery(this).get(0).files[b].name+"</span>";a="<div class='all-selected-files'>"+a+"</div>",jQuery(".all-selected-files").remove(),console.log("item: "+jQuery(this).closest(".c37-child").length),jQuery(this).is(":visible")||(console.log("appending-file"),jQuery(this).closest("div.c37-child").append(a))}),_.each(jQuery(".c37-star-rating"),function(a){var b=jQuery(a);b.siblings(".br-widget").remove(),console.log(b.find(".br-wrapper").length),console.log("star rendered");var c=b.attr("data-theme"),d="true"==b.attr("data-show-selected"),e="true"==b.attr("data-show-values"),f=b.attr("data-initial-rating"),g=b.attr("id"),h={theme:c,showSelectedRating:d,showValues:e,initialRating:f,allowEmpty:!0,onSelect:function(a,c){console.log("value is : "+a),_.each(b.find("option"),function(b){var c=jQuery(b);c.val()==a&&c.prop("selected",!0)})}};console.log(h),jQuery("#"+g).barrating(h)})})}(jQuery); 
     1function makeFromDroppable(a){var b=a(".c37-step-container");b.droppable({accept:".c37-form-multi-element",activeClass:"active-zone",hoverClass:"drop-zone",drop:function(b,c){if("false"!=c.draggable.attr("data-original")){var d=c.draggable.attr("data-c37-type"),e=Templates[d],f=new e;f.render(),c.draggable.html(f.$el);var g="c37-step-id-"+Math.floor(1e4*Math.random());c.draggable.attr("id",g),c.draggable.attr("data-original","false"),makeC37StepDroppable(a),makeC37BoxDroppable(a)}}})}function makeC37BoxDroppable(a){var b=a(".c37-box");b.sortable({revert:!0,connectWith:[".c37-box"],handle:".cm-move",beforeStop:function(a,b){if("false"!=b.item.attr("data-original")){var c=b.item.attr("data-c37-type"),d=Templates[c],e=new d;e.render(),b.item.html(e.$el);var f="c37_id_"+Math.floor(1e4*Math.random());b.item.attr("id",f),b.item.attr("data-original","false"),b.item.removeAttr("style")}},stop:function(a,b){b.item.css("width",""),b.item.css("height","")},out:function(b,c){a(c.sender).removeClass("box-hover-zone")}}),b.droppable({accept:".c37-item-element",activeClass:"box-active-zone",hoverClass:"box-hover-zone",out:function(){console.log(a(this))}})}function makeC37StepDroppable(a){var b=a(".c37-step");b.sortable({revert:!0,handle:".cm-row-move",connectWith:[".c37-step"],stop:function(a,b){b.item.css("width",""),b.item.css("height","")},receive:function(a,b){}}),b.droppable({accept:".c37-container-element",activeClass:"row-active-zone",hoverClass:"row-drop-zone",greedy:!0,drop:function(b,c){if("false"!=c.draggable.attr("data-original")){var d=c.draggable.attr("data-c37-type"),e=Templates[d],f=new e;f.render(),c.draggable.html(f.$el),c.draggable.attr("id","c37_id_"+Math.floor(1e3*Math.random())),c.draggable.attr("data-original","false"),makeC37BoxDroppable(a)}}})}function rgb2hex(a){return a=a.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),a&&4===a.length?"#"+("0"+parseInt(a[1],10).toString(16)).slice(-2)+("0"+parseInt(a[2],10).toString(16)).slice(-2)+("0"+parseInt(a[3],10).toString(16)).slice(-2):""}function resetFormSettings(){core37Form={formID:0,formName:"",formContent:{},formSettings:{action:"",method:"",cssID:"",afterSubmitURL:"",sendEmail:!1,sendAutoReply:!1}}}function getTextColor(a){var b=a.get("editingElementID");return"undefined"==typeof elementsStyles[b]||"undefined"==typeof elementsStyles[b].color?(console.log("no txt color"),"#000000"):elementsStyles[b].color}function getBackgroundColor(a){var b=a.get("editingElementID");return console.log(b),"undefined"==typeof elementsStyles[b]||"undefined"==typeof elementsStyles[b]["background-color"]?(console.log("no bg color"),"#ffffff"):elementsStyles[b]["background-color"]}function restoreStarsRating(a){a(function(){_.each(a(".c37-form .c37-star-rating"),function(b){var c=a(b);c.siblings(".br-widget").remove(),console.log(c.find(".br-wrapper").length),console.log("star rendered");var d=c.attr("data-theme"),e="true"==c.attr("data-show-selected"),f="true"==c.attr("data-show-values"),g=c.attr("data-initial-rating"),h=c.attr("id"),i={theme:d,showSelectedRating:e,showValues:f,initialRating:g,allowEmpty:!0};console.log(i),a("#"+h).barrating(i)})})}function renderFontAwesome(a){var b=["fa-fort-awesome","fa-font-awesome","fa-bars","fa-caret-down","fa-flag","fa-wheelchair-alt","fa-camera-retro","fa-universal-access","fa-hand-spock-o","fa-ship","fa-venus","fa-file-image-o","fa-spinner","fa-check-square","fa-credit-card","fa-pie-chart","fa-won","fa-file-text-o","fa-arrow-right","fa-play-circle","fa-facebook-official","fa-medkit","fa-shopping-cart","fa-envelope","fa-search","fa-american-sign-language-interpreting","fa-asl-interpreting","fa-assistive-listening-systems","fa-audio-description","fa-blind","fa-braille","fa-deaf","fa-deafness","fa-envira","fa-fa","fa-first-order","fa-gitlab","fa-glide","fa-glide-g","fa-google-plus-circle","fa-google-plus-official","fa-hard-of-hearing","fa-instagram","fa-low-vision","fa-pied-piper","fa-question-circle-o","fa-sign-language","fa-signing","fa-snapchat","fa-snapchat-ghost","fa-snapchat-square","fa-themeisle","fa-viadeo","fa-viadeo-square","fa-volume-control-phone","fa-wpbeginner","fa-wpforms","fa-yoast","fa-adjust","fa-anchor","fa-archive","fa-area-chart","fa-arrows","fa-arrows-h","fa-arrows-v","fa-asterisk","fa-at","fa-automobile","fa-balance-scale","fa-ban","fa-bank","fa-bar-chart","fa-bar-chart-o","fa-barcode","fa-battery-0","fa-battery-1","fa-battery-2","fa-battery-3","fa-battery-4","fa-battery-empty","fa-battery-full","fa-battery-half","fa-battery-quarter","fa-battery-three-quarters","fa-bed","fa-beer","fa-bell","fa-bell-o","fa-bell-slash","fa-bell-slash-o","fa-bicycle","fa-binoculars","fa-birthday-cake","fa-bluetooth","fa-bluetooth-b","fa-bolt","fa-bomb","fa-book","fa-bookmark","fa-bookmark-o","fa-briefcase","fa-bug","fa-building","fa-building-o","fa-bullhorn","fa-bullseye","fa-bus","fa-cab","fa-calculator","fa-calendar","fa-calendar-check-o","fa-calendar-minus-o","fa-calendar-o","fa-calendar-plus-o","fa-calendar-times-o","fa-camera","fa-car","fa-caret-square-o-down","fa-caret-square-o-left","fa-caret-square-o-right","fa-caret-square-o-up","fa-cart-arrow-down","fa-cart-plus","fa-cc","fa-certificate","fa-check","fa-check-circle","fa-check-circle-o","fa-check-square-o","fa-child","fa-circle","fa-circle-o","fa-circle-o-notch","fa-circle-thin","fa-clock-o","fa-clone","fa-close","fa-cloud","fa-cloud-download","fa-cloud-upload","fa-code","fa-code-fork","fa-coffee","fa-cog","fa-cogs","fa-comment","fa-comment-o","fa-commenting","fa-commenting-o","fa-comments","fa-comments-o","fa-compass","fa-copyright","fa-creative-commons","fa-credit-card-alt","fa-crop","fa-crosshairs","fa-cube","fa-cubes","fa-cutlery","fa-dashboard","fa-database","fa-desktop","fa-diamond","fa-dot-circle-o","fa-download","fa-edit","fa-ellipsis-h","fa-ellipsis-v","fa-envelope-o","fa-envelope-square","fa-eraser","fa-exchange","fa-exclamation","fa-exclamation-circle","fa-exclamation-triangle","fa-external-link","fa-external-link-square","fa-eye","fa-eye-slash","fa-eyedropper","fa-fax","fa-feed","fa-female","fa-fighter-jet","fa-file-archive-o","fa-file-audio-o","fa-file-code-o","fa-file-excel-o","fa-file-movie-o","fa-file-pdf-o","fa-file-photo-o","fa-file-picture-o","fa-file-powerpoint-o","fa-file-sound-o","fa-file-video-o","fa-file-word-o","fa-file-zip-o","fa-film","fa-filter","fa-fire","fa-fire-extinguisher","fa-flag-checkered","fa-flag-o","fa-flash","fa-flask","fa-folder","fa-folder-o","fa-folder-open","fa-folder-open-o","fa-frown-o","fa-futbol-o","fa-gamepad","fa-gavel","fa-gear","fa-gears","fa-gift","fa-glass","fa-globe","fa-graduation-cap","fa-group","fa-hand-grab-o","fa-hand-lizard-o","fa-hand-paper-o","fa-hand-peace-o","fa-hand-pointer-o","fa-hand-rock-o","fa-hand-scissors-o","fa-hand-stop-o","fa-hashtag","fa-hdd-o","fa-headphones","fa-heart","fa-heart-o","fa-heartbeat","fa-history","fa-home","fa-hotel","fa-hourglass","fa-hourglass-1","fa-hourglass-2","fa-hourglass-3","fa-hourglass-end","fa-hourglass-half","fa-hourglass-o","fa-hourglass-start","fa-i-cursor","fa-image","fa-inbox","fa-industry","fa-info","fa-info-circle","fa-institution","fa-key","fa-keyboard-o","fa-language","fa-laptop","fa-leaf","fa-legal","fa-lemon-o","fa-level-down","fa-level-up","fa-life-bouy","fa-life-buoy","fa-life-ring","fa-life-saver","fa-lightbulb-o","fa-line-chart","fa-location-arrow","fa-lock","fa-magic","fa-magnet","fa-mail-forward","fa-mail-reply","fa-mail-reply-all","fa-male","fa-map","fa-map-marker","fa-map-o","fa-map-pin","fa-map-signs","fa-meh-o","fa-microphone","fa-microphone-slash","fa-minus","fa-minus-circle","fa-minus-square","fa-minus-square-o","fa-mobile","fa-mobile-phone","fa-money","fa-moon-o","fa-mortar-board","fa-motorcycle","fa-mouse-pointer","fa-music","fa-navicon","fa-newspaper-o","fa-object-group","fa-object-ungroup","fa-paint-brush","fa-paper-plane","fa-paper-plane-o","fa-paw","fa-pencil","fa-pencil-square","fa-pencil-square-o","fa-percent","fa-phone","fa-phone-square","fa-photo","fa-picture-o","fa-plane","fa-plug","fa-plus","fa-plus-circle","fa-plus-square","fa-plus-square-o","fa-power-off","fa-print","fa-puzzle-piece","fa-qrcode","fa-question","fa-question-circle","fa-quote-left","fa-quote-right","fa-random","fa-recycle","fa-refresh","fa-registered","fa-remove","fa-reorder","fa-reply","fa-reply-all","fa-retweet","fa-road","fa-rocket","fa-rss","fa-rss-square","fa-search-minus","fa-search-plus","fa-send","fa-send-o","fa-server","fa-share","fa-share-alt","fa-share-alt-square","fa-share-square","fa-share-square-o","fa-shield","fa-shopping-bag","fa-shopping-basket","fa-sign-in","fa-sign-out","fa-signal","fa-sitemap","fa-sliders","fa-smile-o","fa-soccer-ball-o","fa-sort","fa-sort-alpha-asc","fa-sort-alpha-desc","fa-sort-amount-asc","fa-sort-amount-desc","fa-sort-asc","fa-sort-desc","fa-sort-down","fa-sort-numeric-asc","fa-sort-numeric-desc","fa-sort-up","fa-space-shuttle","fa-spoon","fa-square","fa-square-o","fa-star","fa-star-half","fa-star-half-empty","fa-star-half-full","fa-star-half-o","fa-star-o","fa-sticky-note","fa-sticky-note-o","fa-street-view","fa-suitcase","fa-sun-o","fa-support","fa-tablet","fa-tachometer","fa-tag","fa-tags","fa-tasks","fa-taxi","fa-television","fa-terminal","fa-thumb-tack","fa-thumbs-down","fa-thumbs-o-down","fa-thumbs-o-up","fa-thumbs-up","fa-ticket","fa-times","fa-times-circle","fa-times-circle-o","fa-tint","fa-toggle-down","fa-toggle-left","fa-toggle-off","fa-toggle-on","fa-toggle-right","fa-toggle-up","fa-trademark","fa-trash","fa-trash-o","fa-tree","fa-trophy","fa-truck","fa-tty","fa-tv","fa-umbrella","fa-university","fa-unlock","fa-unlock-alt","fa-unsorted","fa-upload","fa-user","fa-user-plus","fa-user-secret","fa-user-times","fa-users","fa-video-camera","fa-volume-down","fa-volume-off","fa-volume-up","fa-warning","fa-wheelchair","fa-wifi","fa-wrench","fa-hand-o-down","fa-hand-o-left","fa-hand-o-right","fa-hand-o-up","fa-ambulance","fa-subway","fa-train","fa-genderless","fa-intersex","fa-mars","fa-mars-double","fa-mars-stroke","fa-mars-stroke-h","fa-mars-stroke-v","fa-mercury","fa-neuter","fa-transgender","fa-transgender-alt","fa-venus-double","fa-venus-mars","fa-file","fa-file-o","fa-file-text","fa-cc-amex","fa-cc-diners-club","fa-cc-discover","fa-cc-jcb","fa-cc-mastercard","fa-cc-paypal","fa-cc-stripe","fa-cc-visa","fa-google-wallet","fa-paypal","fa-bitcoin","fa-btc","fa-cny","fa-dollar","fa-eur","fa-euro","fa-gbp","fa-gg","fa-gg-circle","fa-ils","fa-inr","fa-jpy","fa-krw","fa-rmb","fa-rouble","fa-rub","fa-ruble","fa-rupee","fa-shekel","fa-sheqel","fa-try","fa-turkish-lira","fa-usd","fa-yen","fa-align-center","fa-align-justify","fa-align-left","fa-align-right","fa-bold","fa-chain","fa-chain-broken","fa-clipboard","fa-columns","fa-copy","fa-cut","fa-dedent","fa-files-o","fa-floppy-o","fa-font","fa-header","fa-indent","fa-italic","fa-link","fa-list","fa-list-alt","fa-list-ol","fa-list-ul","fa-outdent","fa-paperclip","fa-paragraph","fa-paste","fa-repeat","fa-rotate-left","fa-rotate-right","fa-save","fa-scissors","fa-strikethrough","fa-subscript","fa-superscript","fa-table","fa-text-height","fa-text-width","fa-th","fa-th-large","fa-th-list","fa-underline","fa-undo","fa-unlink","fa-angle-double-down","fa-angle-double-left","fa-angle-double-right","fa-angle-double-up","fa-angle-down","fa-angle-left","fa-angle-right","fa-angle-up","fa-arrow-circle-down","fa-arrow-circle-left","fa-arrow-circle-o-down","fa-arrow-circle-o-left","fa-arrow-circle-o-right","fa-arrow-circle-o-up","fa-arrow-circle-right","fa-arrow-circle-up","fa-arrow-down","fa-arrow-left","fa-arrow-up","fa-arrows-alt","fa-caret-left","fa-caret-right","fa-caret-up","fa-chevron-circle-down","fa-chevron-circle-left","fa-chevron-circle-right","fa-chevron-circle-up","fa-chevron-down","fa-chevron-left","fa-chevron-right","fa-chevron-up","fa-long-arrow-down","fa-long-arrow-left","fa-long-arrow-right","fa-long-arrow-up","fa-backward","fa-compress","fa-eject","fa-expand","fa-fast-backward","fa-fast-forward","fa-forward","fa-pause","fa-pause-circle","fa-pause-circle-o","fa-play","fa-play-circle-o","fa-step-backward","fa-step-forward","fa-stop","fa-stop-circle","fa-stop-circle-o","fa-youtube-play","fa-500px","fa-adn","fa-amazon","fa-android","fa-angellist","fa-apple","fa-behance","fa-behance-square","fa-bitbucket","fa-bitbucket-square","fa-black-tie","fa-buysellads","fa-chrome","fa-codepen","fa-codiepie","fa-connectdevelop","fa-contao","fa-css3","fa-dashcube","fa-delicious","fa-deviantart","fa-digg","fa-dribbble","fa-dropbox","fa-drupal","fa-edge","fa-empire","fa-expeditedssl","fa-facebook","fa-facebook-f","fa-facebook-square","fa-firefox","fa-flickr","fa-fonticons","fa-forumbee","fa-foursquare","fa-ge","fa-get-pocket","fa-git","fa-git-square","fa-github","fa-github-alt","fa-github-square","fa-gittip","fa-google","fa-google-plus","fa-google-plus-square","fa-gratipay","fa-hacker-news","fa-houzz","fa-html5","fa-internet-explorer","fa-ioxhost","fa-joomla","fa-jsfiddle","fa-lastfm","fa-lastfm-square","fa-leanpub","fa-linkedin","fa-linkedin-square","fa-linux","fa-maxcdn","fa-meanpath","fa-medium","fa-mixcloud","fa-modx","fa-odnoklassniki","fa-odnoklassniki-square","fa-opencart","fa-openid","fa-opera","fa-optin-monster","fa-pagelines","fa-pied-piper-alt","fa-pied-piper-pp","fa-pinterest","fa-pinterest-p","fa-pinterest-square","fa-product-hunt","fa-qq","fa-ra","fa-rebel","fa-reddit","fa-reddit-alien","fa-reddit-square","fa-renren","fa-resistance","fa-safari","fa-scribd","fa-sellsy","fa-shirtsinbulk","fa-simplybuilt","fa-skyatlas","fa-skype","fa-slack","fa-slideshare","fa-soundcloud","fa-spotify","fa-stack-exchange","fa-stack-overflow","fa-steam","fa-steam-square","fa-stumbleupon","fa-stumbleupon-circle","fa-tencent-weibo","fa-trello","fa-tripadvisor","fa-tumblr","fa-tumblr-square","fa-twitch","fa-twitter","fa-twitter-square","fa-usb","fa-viacoin","fa-vimeo","fa-vimeo-square","fa-vine","fa-vk","fa-wechat","fa-weibo","fa-weixin","fa-whatsapp","fa-wikipedia-w","fa-windows","fa-wordpress","fa-xing","fa-xing-square","fa-y-combinator","fa-y-combinator-square","fa-yahoo","fa-yc","fa-yc-square","fa-yelp","fa-youtube","fa-youtube-square","fa-h-square","fa-hospital-o","fa-stethoscope","fa-user-md"];jQuery("[data-for=icon]").autocomplete({source:b,html:!0,select:function(a,b){jQuery(this).siblings("i").first().attr("class","fa "+b.item.value)}}).data("ui-autocomplete")._renderItem=function(a,b){var c='<li><i class="fa '+b.value+'"></i> '+b.value+"</li>";return jQuery(c).appendTo(a)}}function hideOptionsWindow(a){a("#options-window").hide()}function showOptionsWindow(a){a("#options-window").show()}function getEditForm(a){var b=Forms[a],c=[];""!=b.general&&c.push({tab:'<li><a class="active-tab" href="#general-tab">General</a></li>',tabContent:'<div id="general-tab">'+b.general+"</div>"}),""!=b.advanced&&c.push({tab:'<li><a href="#advanced-tab">Advanced</a></li>',tabContent:'<div id="advanced-tab">'+b.advanced+"</div>"}),""!=b.style&&c.push({tab:'<li><a href="#style-tab">Styles</a></li>',tabContent:'<% var styles = elementsStyles[this.model.get(\'editingElementID\')]; if (typeof styles == "undefined") { styles = {}; } %><div id="style-tab">'+b.style+"</div>"}),""!=b.action&&c.push({tab:'<li><a href="#action-tab">Action</a></li>',tabContent:'<div id="action-tab">'+b.action+"</div>"});var d="",e="",f=100/c.length;return _.each(c,function(a){d+=a.tab.replace("<li>",'<li style="width: '+f+'%;">'),e+=a.tabContent}),'<div class="'+b.parentClass+'" id="setting-tabs"><div id="settings-micro-panel"><span class="close-panel"><i class="fa fa-close"></i> </span><span id="move-panel"><i class="fa fa-arrows"></i> </span></div><ul>'+d+"</ul>"+e+'</div><div class="clear"></div>'}function removeElement(){console.log("start removing"),this.editingElement().remove(),jQuery("#element-settings").html("")}function removeSizeClass(a){return a.attr("class",function(a,b){return b.replace(/(^|\s)c37-col-md\S+/g,"")}),a}function renderCSS(){var a=this.model.get("editingElementID"),b=this.$el.find("[data-for=text-color] input").first().val(),c=this.$el.find("[data-for=background-color] input").first().val();"undefined"==typeof elementsStyles[a]&&(elementsStyles[a]={}),elementsStyles[a]["background-color"]=c,elementsStyles[a].color=b,applyCSS()}function applyCSS(){var a="";for(var b in elementsStyles){var c=elementsStyles[b],d="";for(var e in c)d+=e+":"+c[e]+";";a+="#"+core37Form.formSettings.cssID+" #"+b+" .c37-child{"+d+"}"}0==jQuery("#element-styles").length&&jQuery("head").append('<style id="element-styles"></style>'),jQuery("#element-styles").text(""),jQuery("#element-styles").text(a)}!function(a){a(["jquery"],function(a){return function(){function b(a,b,c){return o({type:v.error,iconClass:p().iconClasses.error,message:a,optionsOverride:c,title:b})}function c(b,c){return b||(b=p()),r=a("#"+b.containerId),r.length?r:(c&&(r=l(b)),r)}function d(a,b,c){return o({type:v.info,iconClass:p().iconClasses.info,message:a,optionsOverride:c,title:b})}function e(a){s=a}function f(a,b,c){return o({type:v.success,iconClass:p().iconClasses.success,message:a,optionsOverride:c,title:b})}function g(a,b,c){return o({type:v.warning,iconClass:p().iconClasses.warning,message:a,optionsOverride:c,title:b})}function h(a,b){var d=p();r||c(d),k(a,d,b)||j(d)}function i(b){var d=p();return r||c(d),b&&0===a(":focus",b).length?void q(b):void(r.children().length&&r.remove())}function j(b){for(var c=r.children(),d=c.length-1;d>=0;d--)k(a(c[d]),b)}function k(b,c,d){var e=!(!d||!d.force)&&d.force;return!(!b||!e&&0!==a(":focus",b).length||(b[c.hideMethod]({duration:c.hideDuration,easing:c.hideEasing,complete:function(){q(b)}}),0))}function l(b){return r=a("<div/>").attr("id",b.containerId).addClass(b.positionClass),r.appendTo(a(b.target)),r}function m(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">&times;</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function n(a){s&&s(a)}function o(b){function d(a){return null==a&&(a=""),a.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e(){i(),k(),l(),m(),o(),s(),j(),f()}function f(){var a="";switch(b.iconClass){case"toast-success":case"toast-info":a="polite";break;default:a="assertive"}D.attr("aria-live",a)}function g(){A.closeOnHover&&D.hover(y,x),!A.onclick&&A.tapToDismiss&&D.click(w),A.closeButton&&H&&H.click(function(a){a.stopPropagation?a.stopPropagation():void 0!==a.cancelBubble&&a.cancelBubble!==!0&&(a.cancelBubble=!0),A.onCloseClick&&A.onCloseClick(a),w(!0)}),A.onclick&&D.click(function(a){A.onclick(a),w()})}function h(){D.hide(),D[A.showMethod]({duration:A.showDuration,easing:A.showEasing,complete:A.onShown}),A.timeOut>0&&(C=setTimeout(w,A.timeOut),I.maxHideTime=parseFloat(A.timeOut),I.hideEta=(new Date).getTime()+I.maxHideTime,A.progressBar&&(I.intervalId=setInterval(z,10)))}function i(){b.iconClass&&D.addClass(A.toastClass).addClass(B)}function j(){A.newestOnTop?r.prepend(D):r.append(D)}function k(){if(b.title){var a=b.title;A.escapeHtml&&(a=d(b.title)),E.append(a).addClass(A.titleClass),D.append(E)}}function l(){if(b.message){var a=b.message;A.escapeHtml&&(a=d(b.message)),F.append(a).addClass(A.messageClass),D.append(F)}}function m(){A.closeButton&&(H.addClass(A.closeClass).attr("role","button"),D.prepend(H))}function o(){A.progressBar&&(G.addClass(A.progressClass),D.prepend(G))}function s(){A.rtl&&D.addClass("rtl")}function v(a,b){if(a.preventDuplicates){if(b.message===t)return!0;t=b.message}return!1}function w(b){var c=b&&A.closeMethod!==!1?A.closeMethod:A.hideMethod,d=b&&A.closeDuration!==!1?A.closeDuration:A.hideDuration,e=b&&A.closeEasing!==!1?A.closeEasing:A.hideEasing;if(!a(":focus",D).length||b)return clearTimeout(I.intervalId),D[c]({duration:d,easing:e,complete:function(){q(D),clearTimeout(C),A.onHidden&&"hidden"!==J.state&&A.onHidden(),J.state="hidden",J.endTime=new Date,n(J)}})}function x(){(A.timeOut>0||A.extendedTimeOut>0)&&(C=setTimeout(w,A.extendedTimeOut),I.maxHideTime=parseFloat(A.extendedTimeOut),I.hideEta=(new Date).getTime()+I.maxHideTime)}function y(){clearTimeout(C),I.hideEta=0,D.stop(!0,!0)[A.showMethod]({duration:A.showDuration,easing:A.showEasing})}function z(){var a=(I.hideEta-(new Date).getTime())/I.maxHideTime*100;G.width(a+"%")}var A=p(),B=b.iconClass||A.iconClass;if("undefined"!=typeof b.optionsOverride&&(A=a.extend(A,b.optionsOverride),B=b.optionsOverride.iconClass||B),!v(A,b)){u++,r=c(A,!0);var C=null,D=a("<div/>"),E=a("<div/>"),F=a("<div/>"),G=a("<div/>"),H=a(A.closeHtml),I={intervalId:null,hideEta:null,maxHideTime:null},J={toastId:u,state:"visible",startTime:new Date,options:A,map:b};return e(),h(),g(),n(J),A.debug&&console&&console.log(J),D}}function p(){return a.extend({},m(),w.options)}function q(a){r||(r=c()),a.is(":visible")||(a.remove(),a=null,0===r.children().length&&(r.remove(),t=void 0))}var r,s,t,u=0,v={error:"error",info:"info",success:"success",warning:"warning"},w={clear:h,remove:i,error:b,getContainer:c,info:d,options:{},subscribe:e,success:f,version:"2.1.3",warning:g};return w}()})}("function"==typeof define&&define.amd?define:function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("jquery")):window.toastr=b(window.jQuery)}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){var b=function(){function b(){var b=this,c=function(){var c=["br-wrapper"];""!==b.options.theme&&c.push("br-theme-"+b.options.theme),b.$elem.wrap(a("<div />",{class:c.join(" ")}))},d=function(){b.$elem.unwrap()},e=function(c){return a.isNumeric(c)&&(c=Math.floor(c)),a('option[value="'+c+'"]',b.$elem)},f=function(){var c=b.options.initialRating;return c?e(c):a("option:selected",b.$elem)},g=function(){var c=b.$elem.find('option[value="'+b.options.emptyValue+'"]');return!c.length&&b.options.allowEmpty?(c=a("<option />",{value:b.options.emptyValue}),c.prependTo(b.$elem)):c},h=function(a){var c=b.$elem.data("barrating");return"undefined"!=typeof a?c[a]:c},i=function(a,c){null!==c&&"object"==typeof c?b.$elem.data("barrating",c):b.$elem.data("barrating")[a]=c},j=function(){var a=f(),c=g(),d=a.val(),e=a.data("html")?a.data("html"):a.text(),h=null!==b.options.allowEmpty?b.options.allowEmpty:!!c.length,j=c.length?c.val():null,k=c.length?c.text():null;i(null,{userOptions:b.options,ratingValue:d,ratingText:e,originalRatingValue:d,originalRatingText:e,allowEmpty:h,emptyRatingValue:j,emptyRatingText:k,readOnly:b.options.readonly,ratingMade:!1})},k=function(){b.$elem.removeData("barrating")},l=function(){return h("ratingText")},m=function(){return h("ratingValue")},n=function(){var c=a("<div />",{class:"br-widget"});return b.$elem.find("option").each(function(){var d,e,f,g;d=a(this).val(),d!==h("emptyRatingValue")&&(e=a(this).text(),f=a(this).data("html"),f&&(e=f),g=a("<a />",{href:"#","data-rating-value":d,"data-rating-text":e,html:b.options.showValues?e:""}),c.append(g))}),b.options.showSelectedRating&&c.append(a("<div />",{text:"",class:"br-current-rating"})),b.options.reverse&&c.addClass("br-reverse"),b.options.readonly&&c.addClass("br-readonly"),c},o=function(){return h("userOptions").reverse?"nextAll":"prevAll"},p=function(a){e(a).prop("selected",!0),b.$elem.change()},q=function(){a("option",b.$elem).prop("selected",function(){return this.defaultSelected}),b.$elem.change()},r=function(a){a=a?a:l(),a==h("emptyRatingText")&&(a=""),b.options.showSelectedRating&&b.$elem.parent().find(".br-current-rating").text(a)},s=function(a){return Math.round(Math.floor(10*a)/10%1*100)},t=function(){b.$widget.find("a").removeClass(function(a,b){return(b.match(/(^|\s)br-\S+/g)||[]).join(" ")})},u=function(){var c,d,e=b.$widget.find('a[data-rating-value="'+m()+'"]'),f=h("userOptions").initialRating,g=a.isNumeric(m())?m():0,i=s(f);if(t(),e.addClass("br-selected br-current")[o()]().addClass("br-selected"),!h("ratingMade")&&a.isNumeric(f)){if(f<=g||!i)return;c=b.$widget.find("a"),d=e.length?e[h("userOptions").reverse?"prev":"next"]():c[h("userOptions").reverse?"last":"first"](),d.addClass("br-fractional"),d.addClass("br-fractional-"+i)}},v=function(a){return!(!h("allowEmpty")||!h("userOptions").deselectable)&&m()==a.attr("data-rating-value")},w=function(c){c.on("click.barrating",function(c){var d,e,f=a(this),g=h("userOptions");return c.preventDefault(),d=f.attr("data-rating-value"),e=f.attr("data-rating-text"),v(f)&&(d=h("emptyRatingValue"),e=h("emptyRatingText")),i("ratingValue",d),i("ratingText",e),i("ratingMade",!0),p(d),r(e),u(),g.onSelect.call(b,m(),l(),c),!1})},x=function(b){b.on("mouseenter.barrating",function(){var b=a(this);t(),b.addClass("br-active")[o()]().addClass("br-active"),r(b.attr("data-rating-text"))})},y=function(a){b.$widget.on("mouseleave.barrating blur.barrating",function(){r(),u()})},z=function(b){b.on("touchstart.barrating",function(b){b.preventDefault(),b.stopPropagation(),a(this).click()})},A=function(a){a.on("click.barrating",function(a){a.preventDefault()})},B=function(a){w(a),b.options.hoverState&&(x(a),y(a))},C=function(a){a.off(".barrating")},D=function(a){var c=b.$widget.find("a");z&&z(c),a?(C(c),A(c)):B(c)};this.show=function(){h()||(c(),j(),b.$widget=n(),b.$widget.insertAfter(b.$elem),u(),r(),D(b.options.readonly),b.$elem.hide())},this.readonly=function(a){"boolean"==typeof a&&h("readOnly")!=a&&(D(a),i("readOnly",a),b.$widget.toggleClass("br-readonly"))},this.set=function(a){var c=h("userOptions");b.$elem.find('option[value="'+a+'"]').val()&&(i("ratingValue",a),i("ratingText",b.$elem.find('option[value="'+a+'"]').text()),i("ratingMade",!0),p(m()),r(l()),u(),c.silent||c.onSelect.call(this,m(),l()))},this.clear=function(){var a=h("userOptions");i("ratingValue",h("originalRatingValue")),i("ratingText",h("originalRatingText")),i("ratingMade",!1),q(),r(l()),u(),a.onClear.call(this,m(),l())},this.destroy=function(){var a=m(),c=l(),e=h("userOptions");C(b.$widget.find("a")),b.$widget.remove(),k(),d(),b.$elem.show(),e.onDestroy.call(this,a,c)}}return b.prototype.init=function(b,c){return this.$elem=a(c),this.options=a.extend({},a.fn.barrating.defaults,b),this.options},b}();a.fn.barrating=function(c,d){return this.each(function(){var e=new b;if(a(this).is("select")||a.error("Sorry, this plugin only works with select fields."),e.hasOwnProperty(c)){if(e.init(d,this),"show"===c)return e.show(d);if(e.$elem.data("barrating"))return e.$widget=a(this).next(".br-widget"),e[c](d)}else{if("object"==typeof c||!c)return d=c,e.init(d,this),e.show();a.error("Method "+c+" does not exist on jQuery.barrating")}})},a.fn.barrating.defaults={theme:"",initialRating:null,allowEmpty:null,emptyValue:"",showValues:!1,showSelectedRating:!0,deselectable:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,onSelect:function(a,b,c){},onClear:function(a,b){},onDestroy:function(a,b){}},a.fn.barrating.BarRating=b}),!function(a,b,c){"use strict";!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(d,e,f){var g=function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(f,"__esModule",{value:!0});var h,i,j,k,l=d("./modules/handle-dom"),m=d("./modules/utils"),n=d("./modules/handle-swal-dom"),o=d("./modules/handle-click"),p=d("./modules/handle-key"),q=g(p),r=d("./modules/default-params"),s=g(r),t=d("./modules/set-params"),u=g(t);f.default=j=k=function(){function d(a){var b=e;return b[a]===c?s.default[a]:b[a]}var e=arguments[0];if(l.addClass(b.body,"stop-scrolling"),n.resetInput(),e===c)return m.logStr("SweetAlert expects at least 1 attribute!"),!1;var f=m.extend({},s.default);switch(typeof e){case"string":f.title=e,f.text=arguments[1]||"",f.type=arguments[2]||"";break;case"object":if(e.title===c)return m.logStr('Missing "title" argument!'),!1;f.title=e.title;for(var g in s.default)f[g]=d(g);f.confirmButtonText=f.showCancelButton?"Confirm":s.default.confirmButtonText,f.confirmButtonText=d("confirmButtonText"),f.doneFunction=arguments[1]||null;break;default:return m.logStr('Unexpected type of argument! Expected "string" or "object", got '+typeof e),!1}u.default(f),n.fixVerticalPosition(),n.openModal(arguments[1]);for(var j=n.getModal(),p=j.querySelectorAll("button"),r=["onclick","onmouseover","onmouseout","onmousedown","onmouseup","onfocus"],t=function(a){return o.handleButton(a,f,j)},v=0;v<p.length;v++)for(var w=0;w<r.length;w++){var x=r[w];p[v][x]=t}n.getOverlay().onclick=t,h=a.onkeydown;var y=function(a){return q.default(a,f,j)};a.onkeydown=y,a.onfocus=function(){setTimeout(function(){i!==c&&(i.focus(),i=c)},0)},k.enableButtons()},j.setDefaults=k.setDefaults=function(a){if(!a)throw new Error("userParams is required");if("object"!=typeof a)throw new Error("userParams has to be a object");m.extend(s.default,a)},j.close=k.close=function(){var d=n.getModal();l.fadeOut(n.getOverlay(),5),l.fadeOut(d,5),l.removeClass(d,"showSweetAlert"),l.addClass(d,"hideSweetAlert"),l.removeClass(d,"visible");var e=d.querySelector(".sa-icon.sa-success");l.removeClass(e,"animate"),l.removeClass(e.querySelector(".sa-tip"),"animateSuccessTip"),l.removeClass(e.querySelector(".sa-long"),"animateSuccessLong");var f=d.querySelector(".sa-icon.sa-error");l.removeClass(f,"animateErrorIcon"),l.removeClass(f.querySelector(".sa-x-mark"),"animateXMark");var g=d.querySelector(".sa-icon.sa-warning");return l.removeClass(g,"pulseWarning"),l.removeClass(g.querySelector(".sa-body"),"pulseWarningIns"),l.removeClass(g.querySelector(".sa-dot"),"pulseWarningIns"),setTimeout(function(){var a=d.getAttribute("data-custom-class");l.removeClass(d,a)},300),l.removeClass(b.body,"stop-scrolling"),a.onkeydown=h,a.previousActiveElement&&a.previousActiveElement.focus(),i=c,clearTimeout(d.timeout),!0},j.showInputError=k.showInputError=function(a){var b=n.getModal(),c=b.querySelector(".sa-input-error");l.addClass(c,"show");var d=b.querySelector(".sa-error-container");l.addClass(d,"show"),d.querySelector("p").innerHTML=a,setTimeout(function(){j.enableButtons()},1),b.querySelector("input").focus()},j.resetInputError=k.resetInputError=function(a){if(a&&13===a.keyCode)return!1;var b=n.getModal(),c=b.querySelector(".sa-input-error");l.removeClass(c,"show");var d=b.querySelector(".sa-error-container");l.removeClass(d,"show")},j.disableButtons=k.disableButtons=function(){var a=n.getModal(),b=a.querySelector("button.confirm"),c=a.querySelector("button.cancel");b.disabled=!0,c.disabled=!0},j.enableButtons=k.enableButtons=function(){var a=n.getModal(),b=a.querySelector("button.confirm"),c=a.querySelector("button.cancel");b.disabled=!1,c.disabled=!1},"undefined"!=typeof a?a.sweetAlert=a.swal=j:m.logStr("SweetAlert is a frontend module!"),e.exports=f.default},{"./modules/default-params":2,"./modules/handle-click":3,"./modules/handle-dom":4,"./modules/handle-key":5,"./modules/handle-swal-dom":6,"./modules/set-params":8,"./modules/utils":9}],2:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var d={title:"",text:"",type:null,allowOutsideClick:!1,showConfirmButton:!0,showCancelButton:!1,closeOnConfirm:!0, 
     2closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#8CD4F5",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0,inputType:"text",inputPlaceholder:"",inputValue:"",showLoaderOnConfirm:!1};c.default=d,b.exports=c.default},{}],3:[function(b,c,d){Object.defineProperty(d,"__esModule",{value:!0});var e=b("./utils"),f=(b("./handle-swal-dom"),b("./handle-dom")),g=function(b,c,d){function g(a){o&&c.confirmButtonColor&&(n.style.backgroundColor=a)}var j,k,l,m=b||a.event,n=m.target||m.srcElement,o=-1!==n.className.indexOf("confirm"),p=-1!==n.className.indexOf("sweet-overlay"),q=f.hasClass(d,"visible"),r=c.doneFunction&&"true"===d.getAttribute("data-has-done-function");switch(o&&c.confirmButtonColor&&(j=c.confirmButtonColor,k=e.colorLuminance(j,-.04),l=e.colorLuminance(j,-.14)),m.type){case"mouseover":g(k);break;case"mouseout":g(j);break;case"mousedown":g(l);break;case"mouseup":g(k);break;case"focus":var s=d.querySelector("button.confirm"),t=d.querySelector("button.cancel");o?t.style.boxShadow="none":s.style.boxShadow="none";break;case"click":var u=d===n,v=f.isDescendant(d,n);if(!u&&!v&&q&&!c.allowOutsideClick)break;o&&r&&q?h(d,c):r&&q||p?i(d,c):f.isDescendant(d,n)&&"BUTTON"===n.tagName&&sweetAlert.close()}},h=function(a,b){var c=!0;f.hasClass(a,"show-input")&&(c=a.querySelector("input").value,c||(c="")),b.doneFunction(c),b.closeOnConfirm&&sweetAlert.close(),b.showLoaderOnConfirm&&sweetAlert.disableButtons()},i=function(a,b){var c=String(b.doneFunction).replace(/\s/g,""),d="function("===c.substring(0,9)&&")"!==c.substring(9,10);d&&b.doneFunction(!1),b.closeOnCancel&&sweetAlert.close()};d.default={handleButton:g,handleConfirm:h,handleCancel:i},c.exports=d.default},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],4:[function(c,d,e){Object.defineProperty(e,"__esModule",{value:!0});var f=function(a,b){return new RegExp(" "+b+" ").test(" "+a.className+" ")},g=function(a,b){f(a,b)||(a.className+=" "+b)},h=function(a,b){var c=" "+a.className.replace(/[\t\r\n]/g," ")+" ";if(f(a,b)){for(;c.indexOf(" "+b+" ")>=0;)c=c.replace(" "+b+" "," ");a.className=c.replace(/^\s+|\s+$/g,"")}},i=function(a){var c=b.createElement("div");return c.appendChild(b.createTextNode(a)),c.innerHTML},j=function(a){a.style.opacity="",a.style.display="block"},k=function(a){if(a&&!a.length)return j(a);for(var b=0;b<a.length;++b)j(a[b])},l=function(a){a.style.opacity="",a.style.display="none"},m=function(a){if(a&&!a.length)return l(a);for(var b=0;b<a.length;++b)l(a[b])},n=function(a,b){for(var c=b.parentNode;null!==c;){if(c===a)return!0;c=c.parentNode}return!1},o=function(a){a.style.left="-9999px",a.style.display="block";var b,c=a.clientHeight;return b="undefined"!=typeof getComputedStyle?parseInt(getComputedStyle(a).getPropertyValue("padding-top"),10):parseInt(a.currentStyle.padding),a.style.left="",a.style.display="none","-"+parseInt((c+b)/2)+"px"},p=function(a,b){if(+a.style.opacity<1){b=b||16,a.style.opacity=0,a.style.display="block";var c=+new Date,d=function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(){a.style.opacity=+a.style.opacity+(new Date-c)/100,c=+new Date,+a.style.opacity<1&&setTimeout(d,b)});d()}a.style.display="block"},q=function(a,b){b=b||16,a.style.opacity=1;var c=+new Date,d=function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(){a.style.opacity=+a.style.opacity-(new Date-c)/100,c=+new Date,+a.style.opacity>0?setTimeout(d,b):a.style.display="none"});d()},r=function(c){if("function"==typeof MouseEvent){var d=new MouseEvent("click",{view:a,bubbles:!1,cancelable:!0});c.dispatchEvent(d)}else if(b.createEvent){var e=b.createEvent("MouseEvents");e.initEvent("click",!1,!1),c.dispatchEvent(e)}else b.createEventObject?c.fireEvent("onclick"):"function"==typeof c.onclick&&c.onclick()},s=function(b){"function"==typeof b.stopPropagation?(b.stopPropagation(),b.preventDefault()):a.event&&a.event.hasOwnProperty("cancelBubble")&&(a.event.cancelBubble=!0)};e.hasClass=f,e.addClass=g,e.removeClass=h,e.escapeHtml=i,e._show=j,e.show=k,e._hide=l,e.hide=m,e.isDescendant=n,e.getTopMargin=o,e.fadeIn=p,e.fadeOut=q,e.fireClick=r,e.stopEventPropagation=s},{}],5:[function(b,d,e){Object.defineProperty(e,"__esModule",{value:!0});var f=b("./handle-dom"),g=b("./handle-swal-dom"),h=function(b,d,e){var h=b||a.event,i=h.keyCode||h.which,j=e.querySelector("button.confirm"),k=e.querySelector("button.cancel"),l=e.querySelectorAll("button[tabindex]");if(-1!==[9,13,32,27].indexOf(i)){for(var m=h.target||h.srcElement,n=-1,o=0;o<l.length;o++)if(m===l[o]){n=o;break}9===i?(m=-1===n?j:n===l.length-1?l[0]:l[n+1],f.stopEventPropagation(h),m.focus(),d.confirmButtonColor&&g.setFocusStyle(m,d.confirmButtonColor)):13===i?("INPUT"===m.tagName&&(m=j,j.focus()),m=-1===n?j:c):27===i&&d.allowEscapeKey===!0?(m=k,f.fireClick(m,h)):m=c}};e.default=h,d.exports=e.default},{"./handle-dom":4,"./handle-swal-dom":6}],6:[function(c,d,e){var f=function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0});var g=c("./utils"),h=c("./handle-dom"),i=c("./default-params"),j=f(i),k=c("./injected-html"),l=f(k),m=".sweet-alert",n=".sweet-overlay",o=function(){var a=b.createElement("div");for(a.innerHTML=l.default;a.firstChild;)b.body.appendChild(a.firstChild)},p=function(a){function b(){return a.apply(this,arguments)}return b.toString=function(){return a.toString()},b}(function(){var a=b.querySelector(m);return a||(o(),a=p()),a}),q=function(){var a=p();return a?a.querySelector("input"):void 0},r=function(){return b.querySelector(n)},s=function(a,b){var c=g.hexToRgb(b);a.style.boxShadow="0 0 2px rgba("+c+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"},t=function(c){var d=p();h.fadeIn(r(),10),h.show(d),h.addClass(d,"showSweetAlert"),h.removeClass(d,"hideSweetAlert"),a.previousActiveElement=b.activeElement;var e=d.querySelector("button.confirm");e.focus(),setTimeout(function(){h.addClass(d,"visible")},500);var f=d.getAttribute("data-timer");if("null"!==f&&""!==f){var g=c;d.timeout=setTimeout(function(){var a=(g||null)&&"true"===d.getAttribute("data-has-done-function");a?g(null):sweetAlert.close()},f)}},u=function(){var a=p(),b=q();h.removeClass(a,"show-input"),b.value=j.default.inputValue,b.setAttribute("type",j.default.inputType),b.setAttribute("placeholder",j.default.inputPlaceholder),v()},v=function(a){if(a&&13===a.keyCode)return!1;var b=p(),c=b.querySelector(".sa-input-error");h.removeClass(c,"show");var d=b.querySelector(".sa-error-container");h.removeClass(d,"show")},w=function(){var a=p();a.style.marginTop=h.getTopMargin(p())};e.sweetAlertInitialize=o,e.getModal=p,e.getOverlay=r,e.getInput=q,e.setFocusStyle=s,e.openModal=t,e.resetInput=u,e.resetInputError=v,e.fixVerticalPosition=w},{"./default-params":2,"./handle-dom":4,"./injected-html":7,"./utils":9}],7:[function(a,b,c){Object.defineProperty(c,"__esModule",{value:!0});var d='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error">\n      <span class="sa-x-mark">\n        <span class="sa-line sa-left"></span>\n        <span class="sa-line sa-right"></span>\n      </span>\n    </div><div class="sa-icon sa-warning">\n      <span class="sa-body"></span>\n      <span class="sa-dot"></span>\n    </div><div class="sa-icon sa-info"></div><div class="sa-icon sa-success">\n      <span class="sa-line sa-tip"></span>\n      <span class="sa-line sa-long"></span>\n\n      <div class="sa-placeholder"></div>\n      <div class="sa-fix"></div>\n    </div><div class="sa-icon sa-custom"></div><h2>Title</h2>\n    <p>Text</p>\n    <fieldset>\n      <input type="text" tabIndex="3" />\n      <div class="sa-input-error"></div>\n    </fieldset><div class="sa-error-container">\n      <div class="icon">!</div>\n      <p>Not valid!</p>\n    </div><div class="sa-button-container">\n      <button class="cancel" tabIndex="2">Cancel</button>\n      <div class="sa-confirm-button-container">\n        <button class="confirm" tabIndex="1">OK</button><div class="la-ball-fall">\n          <div></div>\n          <div></div>\n          <div></div>\n        </div>\n      </div>\n    </div></div>';c.default=d,b.exports=c.default},{}],8:[function(a,b,d){Object.defineProperty(d,"__esModule",{value:!0});var e=a("./utils"),f=a("./handle-swal-dom"),g=a("./handle-dom"),h=["error","warning","info","success","input","prompt"],i=function(a){var b=f.getModal(),d=b.querySelector("h2"),i=b.querySelector("p"),j=b.querySelector("button.cancel"),k=b.querySelector("button.confirm");if(d.innerHTML=a.html?a.title:g.escapeHtml(a.title).split("\n").join("<br>"),i.innerHTML=a.html?a.text:g.escapeHtml(a.text||"").split("\n").join("<br>"),a.text&&g.show(i),a.customClass)g.addClass(b,a.customClass),b.setAttribute("data-custom-class",a.customClass);else{var l=b.getAttribute("data-custom-class");g.removeClass(b,l),b.setAttribute("data-custom-class","")}if(g.hide(b.querySelectorAll(".sa-icon")),a.type&&!e.isIE8()){var m=function(){for(var d=!1,e=0;e<h.length;e++)if(a.type===h[e]){d=!0;break}if(!d)return logStr("Unknown alert type: "+a.type),{v:!1};var i=["success","error","warning","info"],j=c;-1!==i.indexOf(a.type)&&(j=b.querySelector(".sa-icon.sa-"+a.type),g.show(j));var k=f.getInput();switch(a.type){case"success":g.addClass(j,"animate"),g.addClass(j.querySelector(".sa-tip"),"animateSuccessTip"),g.addClass(j.querySelector(".sa-long"),"animateSuccessLong");break;case"error":g.addClass(j,"animateErrorIcon"),g.addClass(j.querySelector(".sa-x-mark"),"animateXMark");break;case"warning":g.addClass(j,"pulseWarning"),g.addClass(j.querySelector(".sa-body"),"pulseWarningIns"),g.addClass(j.querySelector(".sa-dot"),"pulseWarningIns");break;case"input":case"prompt":k.setAttribute("type",a.inputType),k.value=a.inputValue,k.setAttribute("placeholder",a.inputPlaceholder),g.addClass(b,"show-input"),setTimeout(function(){k.focus(),k.addEventListener("keyup",swal.resetInputError)},400)}}();if("object"==typeof m)return m.v}if(a.imageUrl){var n=b.querySelector(".sa-icon.sa-custom");n.style.backgroundImage="url("+a.imageUrl+")",g.show(n);var o=80,p=80;if(a.imageSize){var q=a.imageSize.toString().split("x"),r=q[0],s=q[1];r&&s?(o=r,p=s):logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+a.imageSize)}n.setAttribute("style",n.getAttribute("style")+"width:"+o+"px; height:"+p+"px")}b.setAttribute("data-has-cancel-button",a.showCancelButton),a.showCancelButton?j.style.display="inline-block":g.hide(j),b.setAttribute("data-has-confirm-button",a.showConfirmButton),a.showConfirmButton?k.style.display="inline-block":g.hide(k),a.cancelButtonText&&(j.innerHTML=g.escapeHtml(a.cancelButtonText)),a.confirmButtonText&&(k.innerHTML=g.escapeHtml(a.confirmButtonText)),a.confirmButtonColor&&(k.style.backgroundColor=a.confirmButtonColor,k.style.borderLeftColor=a.confirmLoadingButtonColor,k.style.borderRightColor=a.confirmLoadingButtonColor,f.setFocusStyle(k,a.confirmButtonColor)),b.setAttribute("data-allow-outside-click",a.allowOutsideClick);var t=!!a.doneFunction;b.setAttribute("data-has-done-function",t),a.animation?"string"==typeof a.animation?b.setAttribute("data-animation",a.animation):b.setAttribute("data-animation","pop"):b.setAttribute("data-animation","none"),b.setAttribute("data-timer",a.timer)};d.default=i,b.exports=d.default},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],9:[function(b,c,d){Object.defineProperty(d,"__esModule",{value:!0});var e=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a},f=function(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?parseInt(b[1],16)+", "+parseInt(b[2],16)+", "+parseInt(b[3],16):null},g=function(){return a.attachEvent&&!a.addEventListener},h=function(b){a.console&&a.console.log("SweetAlert: "+b)},i=function(a,b){a=String(a).replace(/[^0-9a-f]/gi,""),a.length<6&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),b=b||0;var c,d,e="#";for(d=0;3>d;d++)c=parseInt(a.substr(2*d,2),16),c=Math.round(Math.min(Math.max(0,c+c*b),255)).toString(16),e+=("00"+c).substr(c.length);return e};d.extend=e,d.hexToRgb=f,d.isIE8=g,d.logStr=h,d.colorLuminance=i},{}]},{},[1]),"function"==typeof define&&define.amd?define(function(){return sweetAlert}):"undefined"!=typeof module&&module.exports&&(module.exports=sweetAlert)}(window,document);var C37BackendValidation={makeValidationArea:function(a){return'<div class="validation">'+a+"</div>"},validationHTML:{common:'<label>Validation</label><% var elementValidation = validation[this.model.get("name")] || {}; %><input data-for="required" type="checkbox" <%= elementValidation.required? "checked" : "" %> /> Required',min_length:"<label>Min length (characters)</label>",max_length:"<label>Max length (characters)</label>",textInput:"",textarea:"",file:'<label>File type</label><select <% var value=elementValidation.fileType %> data-for="file-type"><option <%= value==""? "selected" : "" %> value="">Any</option><option <%= value=="image/*"? "selected" : "" %> value="image/*">Images</option><option <%= value=="audio/*"? "selected" : "" %> value="audio/*">Audios</option><option <%= value=="video/*"? "selected" : "" %> value="video/*">Videos</option><option <%= value=="text/html"? "selected" : "" %> value="text/html">HTML Files</option><option <%= value==".doc,.docx,.pdf"? "selected" : "" %> value=".doc,.docx,.pdf">Documents</option></select>'},textValidation:function(){return this.makeValidationArea(this.validationHTML.common+this.validationHTML.textInput)},textAreaValidation:function(){return this.makeValidationArea(this.validationHTML.common)},fileValidation:function(){return this.makeValidationArea(this.validationHTML.common+this.validationHTML.file)}},UPGRADE_TO_UNLOCK_TEMPLATE="This style is in the pro version only. Please get the pro version to access all styles.",UPGRADE_TO_USE_IMAGE="Image element is available in the PRO version only. Please upgrade to use image in your form",UPGRADE_TO_USE_RATING="Stars rating is available in the PRO version only. Please upgrade to use ratings in your form",ERROR_MISSING_FORM_NAME="Please enter a name for your form",SUCCESS_FORM_SAVED="Form saved!",SUCCESS_CODE_SAVED="Code saved!",SUCCESS_EMAIL_SAVED="Email saved!",SUCCESS_SUBSCRIBER_DATA_CLEARED="Subscribers data for currently selected form cleared!",INFO_LOADING_SUBSCRIBERS_DATA="Loading subscribers data",ERROR_PLEASE_SOLVE_CAPTCHA="Please solve the captcha",ERROR_INPUT_NOT_VALID="Your input is not valid! ",INFO_CLEAR_SUBSCRIBERS="Clear subscribers data?",INFO_CLEAR_SUBSCRIBERS_EXPLAIN="You are going to clear subscribers data for currently selected form. This cannot be undone",INFO_SUBSCRIBERS_CLEARED="Subscribers data cleared!",versionNangCap=!0,core37Form={formID:0,formName:"",formContent:{},formSettings:{action:"",width:"500",method:"post",cssID:"c37-form-"+Math.floor(9999*Math.random()),presetCSSStyle:"c37-form-style-1",afterSubmitURL:"",sendNotification:!1,sendAutoReply:!1,afterSubmitMessage:"",replyToField:"",subjectField:""},friendlyNames:{}},defaultValues={};jQuery.post(ajaxurl,{action:"core37_get_form_styles"},function(a){core37Form.styles=JSON.parse(a)}),jQuery.post(ajaxurl,{action:"core37_get_default_parameters"},function(a){Object.assign(defaultValues,JSON.parse(a))}),defaultValues.starsRatingOptions={theme:"fontawesome-stars",initialRating:1,showValues:!1,showSelectedRating:!0,allowEmpty:!0};var elementsActions={};toastr.options={closeButton:!0,debug:!1,newestOnTop:!1,progressBar:!0,positionClass:"toast-top-center",preventDuplicates:!1,onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut"};var elementsStyles={},validation={},math=[{}],C37ElementModel=Backbone.Model.extend({defaults:{style:{},action:{},size:{}}}),elementStyle={textColor:'<div class="css-styles"><label class="section-header">Text color:</label><div data-for="text-color"><input data-for="color" type="color" value="<%= styles["color"] == null || styles[\'color\'] ==\'\' ? "#fffffa" : styles[\'color\'] %>"> <i data-for="clear-text-color" class="fa fa-hand-paper-o reset-color"></i></div></div>',background:'<div class="css-styles"><div id="c37-background-settings"><label class="section-header">Background</label><div><div class="c37-col-xs-4"  data-for="background-color"><label>Color:</label><input type="color" value="<%= styles["background-color"] == null || styles[\'background-color\'] == ""? "#fffffa" : styles[\'background-color\'] %>" > <i class="fa fa-hand-paper-o reset-color"></i></div><div class="c37-col-xs-4"  data-for="background-image"><label>Image:</label><img src="<%= styles[\'background-image\'] %>" id="c37-image-preview" /><br /><input type="hidden" value="<%= styles[\'background-image\'] %>" /><i href="#" id="change-background-image" class="fa fa-folder-open"></i><i href="#" id="remove-background-image" class="fa fa-close"></i></div><div class="c37-col-xs-4"  data-for="background-image-style"><label>Style:</label><select><option <%= styles[\'background-image-style\'] == "no-repeat" ? "selected" : "" %> value="no-repeat">no repeat</option><option <%= styles[\'background-image-style\'] == "repeat" ? "selected" : "" %> value="repeat">repeat</option><option <%= styles[\'background-image-style\'] == "repeat-x" ? "selected" : "" %> value="repeat-x">repeat x</option><option <%= styles[\'background-image-style\'] == "repeat-y" ? "selected" : "" %> value="repeat-y">repeat y</option><option <%= styles[\'background-image-style\'] == "cover" ? "selected" : "" %> value="cover">cover</option><option <%= styles[\'background-image-style\'] == "contain" ? "selected" : "" %> value="cover">contain</option></select></div><div class="clearfix"></div></div></div></div>',elementSize:'<div class="c37-col-xs-12"><label class="section-header">Element width:</label><div><select <% var size = (this.model.get(\'size\')); %> data-for="element-width"><option <%= size.size == 2 ? "selected": "" %> value="2">2</option><option <%= size.size == 3 ? "selected": "" %>  value="3">3</option><option <%= size.size == 4 ? "selected": "" %>  value="4">4</option><option <%= size.size == 5 ? "selected": "" %>  value="5">5</option><option <%= size.size == 6 ? "selected": "" %>  value="6">6</option><option <%= size.size == 7 ? "selected": "" %>  value="7">7</option><option <%= size.size == 8 ? "selected": "" %>  value="8">8</option><option <%= size.size == 9 ? "selected": "" %>  value="9">9</option><option <%= size.size == 10 ? "selected": "" %>  value="10">10</option><option <%= size.size == 11 ? "selected": "" %>  value="11">11</option><option <%= size.size == 12 ? "selected": "" %>  value="12">12</option></select><br /><span><input type="checkbox" <%= size.expand? "checked" : "" %>  data-for="expand" /> Expand full on small screen</span></div></div>',border:'<div class="css-styles"><div id="c37-border-settings"><label class="section-header">Border</label><div><div class="c37-col-xs-3"><label>Style:  <select data-for="border-style"><option  <%= styles[\'border-style\'] == "none" ? "selected" : "" %>  value="none">none</option><option  <%= styles[\'border-style\'] == "solid" ? "selected" : "" %>  value="solid">solid</option><option  <%= styles[\'border-style\'] == "dashed" ? "selected" : "" %>  value="dashed">dashed</option><option  <%= styles[\'border-style\'] == "dotted" ? "selected" : "" %>  value="dotted">dotted</option></select></label></div><div class="c37-col-xs-3"><label>Width: <input value="<%= styles[\'border-width\'] %>" type="number" data-for="border-width" /></label></div><div class="c37-col-xs-3"><label>Color: <input value="<%= styles[\'border-color\'] == null || styles[\'border-color\'] ==\'\' ? \'#fffffa\' : styles[\'border-color\'] %>" type="color" data-for="border-color" /></label></div><div class="c37-col-xs-3"><label>Radius: <input value="<%= styles[\'border-radius\'] %>" type="number" data-for="border-radius" /></label></div><div id="c37-border-width-settings"><label class="c37-col-xs-3">Top: <input data-for="border-top-width" value="<%= styles[\'border-top-width\'] %>" type="number"/></label><label class="c37-col-xs-3">Right: <input data-for="border-right-width" value="<%= styles[\'border-right-width\'] %>" type="number"/></label><label class="c37-col-xs-3">Bottom: <input data-for="border-bottom-width" value="<%= styles[\'border-bottom-width\'] %>" type="number"/></label><label class="c37-col-xs-3">Left: <input data-for="border-left-width" value="<%= styles[\'border-left-width\'] %>" type="number"/></label></div><div id="c37-border-radius-settings"><label class="c37-col-xs-3">T-L: <input data-for="border-top-left-radius" value="<%= styles[\'border-top-left-radius\'] %>" type="number"/></label><label class="c37-col-xs-3">T-R: <input data-for="border-top-right-radius" value="<%= styles[\'border-top-right-radius\'] %>" type="number" /></label><label class="c37-col-xs-3">B-L: <input data-for="border-bottom-left-radius" value="<%= styles[\'border-bottom-left-radius\'] %>" type="number"/></label><label class="c37-col-xs-3">B-R: <input data-for="border-bottom-right-radius" value="<%= styles[\'border-bottom-right-radius\'] %>" type="number"/></label></div></div></div></div>',margin:'<div class="css-styles"><div id="c37-margin-padding-settings"><label class="section-header">Margin</label><div id="c37-margin-settings" data-for="margin"><label class="c37-col-xs-3">Top: <input value="<%= styles[\'margin-top\'] %>" type="number" class="top" /></label><label class="c37-col-xs-3">Right: <input value="<%= styles[\'margin-right\'] %>" type="number" class="right" /></label><label class="c37-col-xs-3">Bottom: <input value="<%= styles[\'margin-bottom\'] %>" type="number" class="bottom" /></label><label class="c37-col-xs-3">Left: <input value="<%= styles[\'margin-left\'] %>" type="number" class="left" /></label></div><label class="section-header">Padding</label><div id="c37-padding-settings" data-for="padding"><label class="c37-col-xs-3">Top: <input value="<%= styles[\'padding-top\'] %>" type="number" class="top" /></label><label class="c37-col-xs-3">Right: <input value="<%= styles[\'padding-right\'] %>" type="number" class="right" /></label><label class="c37-col-xs-3">Bottom: <input value="<%= styles[\'padding-bottom\'] %>" type="number" class="bottom" /></label><label class="c37-col-xs-3">Left: <input value="<%= styles[\'padding-left\'] %>" type="number" class="left" /></label></div></div></div>'},actionArea='<div class="element-action"><label>Trigger</label><select data-for="trigger"><option value="no-trigger"></option><option <%= this.model.get("action").trigger=="click" ? "selected" : "" %> value="click">On this element click</option></select><label>Action</label><select data-for="action"><option  value="do-nothing"></option><option <%= this.model.get("action").action=="submit-form" ? "selected" : "" %> value="submit-form">Submit form</option></select></div>',textEditOptions={general:'<label>Placeholder: </label><input type="text" data-for="placeholder" value="<%= this.model.get(\'placeholder\') %>" /><label>Label</label><input type="text" value="<%= this.model.get(\'label\') %>" data-for="input-label" placeholder="enter label" /><label>Type:</label><select <% var type = this.model.get(\'type\') %> data-for="input-type"><option <%= type=="text"? "selected" : "" %> value="text">Text</option><option <%= type=="email"? "selected" : "" %> value="email">Email</option><option <%= type=="url"? "selected" : "" %> value="url">URL</option><option <%= type=="number"? "selected" : "" %> value="number">Number</option><option <%= type=="password"? "selected" : "" %> value="password">Password</option><option <%= type=="tel"? "selected" : "" %> value="tel">Phone</option></select><span class="reply-to <%= type==\'email\' ? \'\':\'hidden\' %> "><input  <%= core37Form.formSettings.replyToField == this.model.get("name")? "checked" : ""  %> type="checkbox" data-for="reply-to" /> Reply to this email</span><span  class="email-subject <%= type==\'text\' ? \'\':\'hidden\' %>"><input <%= core37Form.formSettings.subjectField == this.model.get("name")? "checked" : ""  %> type="checkbox" data-for="email-subject" /> This is email\'s subject</span><label>Icon</label><div class="fa-icon"><i class="fa <%= this.model.get(\'icon\') ? this.model.get(\'icon\'): \'\' %>"></i><input data-for="icon" value="<%= this.model.get(\'icon\')? this.model.get(\'icon\'): \'\' %> " type="text" id="fa-icon-input" /> </div>',advanced:'<label>Field name:</label><input type="text" data-for="name" value="<%= this.model.get(\'name\') %>" />'+C37BackendValidation.textValidation(),action:actionArea,style:elementStyle.textColor+elementStyle.elementSize},fileEditOptions={general:'<label>Upload multiple files?</label><input <%= this.model.get(\'multiple\')? "checked" : "" %> type="checkbox" data-for="multiple" /><label>Text</label><input data-for="text" type="text" value="<%= this.model.get(\'text\') %>" placeholder="upload text" /><label>Icon</label><div class="fa-icon"><i class="<%= this.model.get(\'icon\') ? this.model.get(\'icon\'): \'\' %>"></i><input <%= versionNangCap ? ""  : "disabled" %> data-for="icon" value="<%= this.model.get(\'icon\')? this.model.get(\'icon\'): \'\' %> " type="text" id="fa-icon-input" /> </div>',advanced:"<label>Field name: </label><input type=\"text\" data-for=\"name\" value=\"<%= this.model.get('name').replace('[','').replace(']','') %>\" />"+C37BackendValidation.fileValidation(this.model),style:"",action:""},checkboxEditOptions={general:'<div class="row options"><span class="c37-col-xs-8"><label>Value</label></span><span class="c37-col-xs-4"><label>Check</label></span><% var options = this.model.get(\'options\'); _.each(options, function(o){ %>  <div><span class="c37-col-xs-8"><input type="text" data-for="value" value="<%= decodeURIComponent(o.value) %>" />  </span><span class="c37-col-xs-4 check"><input type="checkbox" data-for="checked" <%= o.checked? "checked" : "" %> />  </span><span class="hidden"><input type="text" data-for="id" value="<%= o.id %>" /></span></div><%}) %></div><button class="add-option"><i class="fa fa-plus"></i> Add option</button>',advanced:'<label>Name</label><input data-for="name" type="text" value="<%= this.model.get(\'name\') %>" placeholder="enter a name for your field" /><label>Options alignment</label><select <% var alignment = this.model.get(\'alignment\'); %> data-for="alignment"><option <%= alignment=="c37-vertical"? "selected" : "" %> value="c37-vertical">Vertical</option><option <%= alignment=="c37-horizontal"? "selected" : "" %> value="c37-horizontal">Horizontal</option></select>',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},radioEditOptions={general:'<div class="row options"><span class="c37-col-xs-8"><label>Value</label></span><span class="c37-col-xs-4"><label>Select</label></span><% var options = this.model.get(\'options\'); _.each(options, function(o){ %>  <div><span class="c37-col-xs-8"><input type="text" data-for="value" value="<%= decodeURIComponent(o.value) %>" />  </span><span class="c37-col-xs-4 check"><input type="radio" data-for="checked" name="radio-settings" <%= o.checked? "checked" : "" %> />  </span><span class="hidden"><input type="text" data-for="id" value="<%= o.id %>" /></span></div><%}) %></div><button class="add-option"><i class="fa fa-plus"></i> Add option</button>',advanced:'<label>Name</label><input data-for="name" type="text" value="<%= this.model.get(\'name\') %>" placeholder="enter a name for your field" /><label>Options alignment</label><select <% var alignment = this.model.get(\'alignment\'); %> data-for="alignment"><option <%= alignment=="c37-vertical"? "selected" : "" %> value="c37-vertical">Vertical</option><option <%= alignment=="c37-horizontal"? "selected" : "" %> value="c37-horizontal">Horizontal</option></select>',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},labelEditOptions={general:'<label>Content: </label><input type="text" data-for="label" placeholder="enter your label" value="<%= this.model.get(\'content\') %>" /> <input type="checkbox" <%= this.model.get("required") ? "checked" : "" %> data-for="required"> Field is required',advanced:"",style:elementStyle.textColor+elementStyle.elementSize,action:null},headingEditOptions={general:'<label>Content: </label><input type="text" data-for="heading" placeholder="enter text content" value="<%= this.model.get(\'content\') %>" /> <label>Type: </label><select <% var tagName = this.model.get(\'tagName\'); %> data-for="tagName"><option <%= tagName=="h1"? "selected" : ""  %> value="h1">h1</option><option <%= tagName=="h2"? "selected" : ""  %>  value="h2">h2</option><option <%= tagName=="h3"? "selected" : ""  %>  value="h3">h3</option><option <%= tagName=="h4"? "selected" : ""  %>  value="h4">h4</option><option <%= tagName=="h5"? "selected" : ""  %>  value="h5">h5</option><option <%= tagName=="h6"? "selected" : ""  %>  value="h6">h6</option></select>',advanced:"",style:elementStyle.textColor+elementStyle.elementSize,action:null},paragraphEditOptions={general:'<label>Content: </label><textarea data-for="paragraph" placeholder="enter text content"><%= this.model.get(\'content\') %></textarea> ',advanced:"",style:"",action:""},textAreaEditOptions={general:'<label>Placeholder: </label><input type="text" data-for="placeholder" placeholder="enter placeholder" value="<%= this.model.get(\'placeholder\') %>" /> <label>Label</label><input value="<%= this.model.get(\'label\') %>" type="text" data-for="input-label" placeholder="enter label" />',advanced:'<label>Field name: </label><input type="text" data-for="name" placeholder="enter field name" value="<%= this.model.get(\'name\') %>" /> '+C37BackendValidation.textAreaValidation(),style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},buttonEditOptions={general:'<label>Button Text: </label><input type="text" data-for="text" placeholder="button text" value="<%= this.model.get(\'text\') %>" /> ',advanced:"",style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},dateEditOptions={general:'<label <% var type = this.model.get(\'type\'); %> >Default value: </label><input type="<%= type %>" data-for="default-value" value="<%= this.model.get(\'value\') %>" /><label>Type:</label><select data-for="date-type"><option <%= type=="date"? "selected" : "" %> value="date">Date</option></select>',advanced:'<label>Field name:</label><input type="text" data-for="name" value="<%= this.model.get(\'name\') %>" />',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},selectEditOptions={general:"<div class=\"row options\"><span class=\"c37-col-xs-12\"><label>Values</label></span><% var options = this.model.get('options'); var allValue= ''; _.each(options, function(o){ %>  <% allValue+=o.value+'\\n';  %><%}) %><textarea data-for=\"value\"><%= decodeURIComponent(allValue) %></textarea></div><label>Selected value</label><select data-for=\"selected\"><% var selected_value = this.model.get('selected_value'); _.each(options, function(option){ %><option <%= option.value == selected_value? 'selected': '' %> value=\"<%= option.value %>\"><%= decodeURIComponent(option.value) %></option><% }) %></select>",advanced:'<label>Name</label><input data-for="name" type="text" value="<%= this.model.get(\'name\') %>" placeholder="enter a name for your field" />',style:elementStyle.textColor+elementStyle.elementSize,action:actionArea},acceptanceEditOptions={general:'<label>Text: </label><input type="text" data-for="text" placeholder="enter acceptance text" value="<%= this.model.get(\'text\') %>" /><label>Error message(<small>When not checked</small>)</label><input type="text" data-for="error" placeholder="enter error message" value="<%= this.model.get(\'error_message\') %>" /> ',advanced:'<label>Field name:</label><input disabled type="text" data-for="name" value="<%= this.model.get(\'name\') %>" />', 
     3style:elementStyle.textColor,action:actionArea},rowEditOptions={general:'<label>Row layout</label><select data-for="layout"><option <%= layout=="12"? "selected" : "" %> value="12">1</option><option <%= layout=="6-6"? "selected" : "" %> value="6-6">1/2 + 1/2</option><option <%= layout=="4-4-4"? "selected" : "" %> value="4-4-4">1/3 + 1/3 + 1/3</option><option <%= layout=="4-8"? "selected" : "" %> value="4-8">1/3 + 2/3</option><option <%= layout=="8-4"? "selected" : "" %> value="8-4">2/3 + 1/3</option><option <%= layout=="3-3-3-3"? "selected" : "" %> value="3-3-3-3">1/4 + 1/4 + 1/4 + 1/4</option><option <%= layout=="3-3-6"? "selected" : "" %> value="3-3-6">1/4 + 1/4 + 2/4</option><option <%= layout=="3-9"? "selected" : "" %> value="3-9">1/4 + 3/4</option><option <%= layout=="3-6-3"? "selected" : "" %> value="3-6-3">1/4 + 2/4 + 1/4</option><option <%= layout=="6-3-3"? "selected" : "" %> value="6-3-3">2/4 + 1/4 + 1/4</option><option <%= layout=="9-3"? "selected" : "" %> value="9-3">3/4 + 1/4</option></select>',advanced:"",style:elementStyle.textColor,action:actionArea},formEditOptions={general:'<label>Form name</label><input id="form-name" type="text" value="<%= core37Form.formName %>" placeholder="form name" data-for="name" /><label>Form width (<small><em>in px, leave blank for full width</em></small>)</label><span><input type="number" value="<%= this.model.get("width") %>" data-for="width" /></span>',advanced:'<label>After-submit message</label><input type="text" data-for="afterSubmitMessage" value="<%= this.model.get(\'afterSubmitMessage\') %>" placeholder="enter your message" /><label>After-submit URL</label><input type="text" placeholder="enter your URL" class="c37-col-xs-12" value="<%= this.model.get(\'afterSubmitURL\') %>" data-for="afterSubmitURL" /><label><input <%= this.model.get("sendNotification") ? "checked" : "" %> type="checkbox" data-for="sendNotification" <span>Send notification (to your email) when form submitted</span></label><label><input disabled <%= this.model.get("sendAutoReply") ? "checked" : "" %> type="checkbox" data-for="sendAutoReply" <span>Send auto-reply to people who submit form</span></label>',style:'<label>Preset styles</label><select data-for="form-style"><% _.each(core37Form.styles, function(s){  %><option <%= s.class==core37Form.formSettings.presetCSSStyle? \'selected\' : \'\' %> value="<%= s.class %>" > <%= "Style "+ s.class.slice(-1) %> </option><% }) %></select>',action:""},imageEditOptions={general:'<label>Select image</label><img class="c37-image-preview" src="<%= this.model.get( \'imgSrc\')%>" /><button id="c37-image-picker">Change image...</button>',advanced:"",style:elementStyle.textColor+elementStyle.background+elementStyle.border+elementStyle.margin,action:""},starsEditOptions={general:'<% var initialRating = this.model.get("initialRating"); var theme = this.model.get("theme"); var id = this.model.get("id"); var optionsString = ""; var options = this.model.get("options"); _.each(options, function(option){ optionsString += option.value + "\\n"; }) %><label>Select style</label><select data-for="theme"><option <%= theme == "fontawesome-stars" ? "selected" : ""  %> value="fontawesome-stars">Round-edges Stars</option><option <%= theme == "css-stars" ? "selected" : ""  %> value="css-stars">Sharp-edges Stars</option><option <%= theme == "bars-1to10" ? "selected" : ""  %> value="bars-1to10">Bars</option><option <%= theme == "bars-horizontal" ? "selected" : ""  %> value="bars-horizontal">Stack bars</option><option <%= theme == "bars-movie" ? "selected" : ""  %> value="bars-movie">Flat bar</option><option <%= theme == "bars-pill" ? "selected" : ""  %> value="bars-pill">Pills</option><option <%= theme == "bars-square" ? "selected" : ""  %> value="bars-square">Blue boxes</option></select><label>Values</label><textarea data-for="options"><%= jQuery.trim(optionsString) %></textarea><label>Initial value</label><select data-for="initial-rating"><% _.each(options, function(option) {  %><option <%= option.value == initialRating ? "selected" : "" %>  value="<%= option.value %>"> <%= option.text %> </option><% }) %></select><label>Show values</label><input <%= this.model.get("showValues")? "checked" : ""%> type="checkbox" data-for="show-labels" /> Show values for each rating<label>Show selected value</label><input <%= this.model.get("showSelectedRating")? "checked" : ""%>  type="checkbox" data-for="show-selected" /> Show currently selected value',advanced:'<label>Field name</label><input data-for="name" type="text" placeholder="set a name for your field" value="<%= this.model.get(\'name\') %>" />',style:'<label>Stars color</label><input type="color" data-for="star-color" />',action:""},Forms={textEdit:{general:textEditOptions.general,advanced:textEditOptions.advanced,style:textEditOptions.style,action:textEditOptions.action,parentClass:"for-text"},checkboxEdit:{general:checkboxEditOptions.general,advanced:checkboxEditOptions.advanced,style:checkboxEditOptions.style,action:checkboxEditOptions.action,parentClass:"for-checkbox"},radioEdit:{general:radioEditOptions.general,advanced:radioEditOptions.advanced,style:radioEditOptions.style,action:radioEditOptions.action,parentClass:"for-radio"},labelEdit:{general:labelEditOptions.general,advanced:labelEditOptions.advanced,style:labelEditOptions.style,action:labelEditOptions.action,parentClass:"for-label"},headingEdit:{general:headingEditOptions.general,advanced:headingEditOptions.advanced,style:headingEditOptions.style,action:headingEditOptions.action,parentClass:"for-heading"},paragraphEdit:{general:paragraphEditOptions.general,advanced:paragraphEditOptions.advanced,style:paragraphEditOptions.style,action:paragraphEditOptions.action,parentClass:"for-paragraph"},textAreaEdit:{general:textAreaEditOptions.general,advanced:textAreaEditOptions.advanced,style:textAreaEditOptions.style,action:textAreaEditOptions.action,parentClass:"for-textarea"},buttonEdit:{general:buttonEditOptions.general,advanced:buttonEditOptions.advanced,style:buttonEditOptions.style,action:buttonEditOptions.action,parentClass:"for-button"},dateEdit:{general:dateEditOptions.general,advanced:dateEditOptions.advanced,style:dateEditOptions.style,action:dateEditOptions.action,parentClass:"for-date"},selectEdit:{general:selectEditOptions.general,advanced:selectEditOptions.advanced,style:selectEditOptions.style,action:selectEditOptions.action,parentClass:"for-select"},acceptanceEdit:{general:acceptanceEditOptions.general,advanced:acceptanceEditOptions.advanced,style:acceptanceEditOptions.style,action:acceptanceEditOptions.action,parentClass:"for-acceptance"},formEdit:{general:formEditOptions.general,advanced:formEditOptions.advanced,style:formEditOptions.style,action:formEditOptions.action,parentClass:"for-form"},rowEdit:{general:rowEditOptions.general,advanced:rowEditOptions.advanced,style:rowEditOptions.style,action:"",parentClass:"for-row"},fileEdit:{general:fileEditOptions.general,advanced:fileEditOptions.advanced,style:fileEditOptions.style,action:fileEditOptions.action,parentClass:"for-file"},imageEdit:{general:imageEditOptions.general,advanced:"",style:"",action:"",parentClass:"for-image"},starsEdit:{general:starsEditOptions.general,advanced:starsEditOptions.advanced,style:"",action:starsEditOptions.action,parentClass:"for-stars"}},C37FormElement=Backbone.View.extend({renderSize:function(){if(this.model&&this.model.get("size")){var a="c37-col-md-"+this.model.get("size").size;this.model.get("size").expand&&(a+=" c37-col-xs-12");for(var b=1;b<=12;b++)this.$el.removeClass("c37-col-md-"+b);this.$el.addClass(a)}}}),Heading=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<h1 class="c37-child">This is heading</h1>'),render:function(){if(this.model){var a="<"+this.model.get("tagName")+'  class="c37-child">'+this.model.get("content")+"</"+this.model.get("tagName")+">";console.log("tagName"+this.model.get("tagName")),this.$el.html(a)}else this.$el.html(this.template)}}),Paragraph=C37FormElement.extend({initialize:function(){this.render()},template:_.template("<p>This is paragraph</p>"),render:function(){this.model?this.$el.html("<p>"+this.model.get("content")+"</p>"):this.$el.html(this.template())}}),Row=Backbone.View.extend({initialize:function(){this.render()},template:_.template('<div class="c37-box c37-col-xs-12"></div>'),render:function(){this.setElement(this.template({}))}}),Step=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<div class="c37-step c37-style-1 c37-container"><div class="c37-row" id="c37-row-0" data-c37-layout="12"><div class="c37-box c37-col-md-12"></div></div></div>'),render:function(){this.setElement(this.template({}))}}),CheckBox=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<span class="c37-single-checkbox" class="c37-child" <% var cid= \'checkbox_id_\' + Math.floor(Math.random() * 10000) %> ><input id="<%= cid %>" type="checkbox" name="<%= name %>" value="First"/><label class="c37-blank-label" for="<%= cid %>"></label> <span> First</span></span> <span class="c37-single-checkbox" class="c37-child" <% var cid= \'checkbox_id_\' + Math.floor(Math.random() * 10000) %> ><input id="<%= cid %>" type="checkbox" name="<%= name %>" value="Second"/><label class="c37-blank-label" for="<%= cid %>"></label> <span> Second</span></span> '),render:function(){if(this.model){var a="",b=this.model.get("name");_.each(this.model.get("options"),function(c){var d=c.checked?"checked":"";a+='<span class="c37-child c37-single-checkbox"><input id="'+c.id+'"  type="checkbox" '+d+'  name="'+b+'" value="'+c.value+'"/><label class="c37-blank-label" for="'+c.id+'"></label> <span>'+decodeURIComponent(c.value)+"</span></span> "}),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-vertical"),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-horizontal"),jQuery(this.$el).closest(".c37-form-element").addClass(this.model.get("alignment")),this.$el.html(a)}else this.$el.html(this.template({name:"checkbox_"+Math.floor(1e3*Math.random())}))}}),Radio=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<span class="c37-single-radio c37-child" <% var cid= \'radio_id_\' + Math.floor(Math.random() * 10000) %>><input id="<%= cid %>" type="radio" name="<%= name %>" value="First" /><label class="c37-blank-label" for="<%= cid %>"></label> <span >First</span></span> <span class="c37-single-radio c37-child" <% var cid= \'radio_id_\' + Math.floor(Math.random() * 10000) %>><input id="<%= cid %>" type="radio" name="<%= name %>" value="Second" /><label class="c37-blank-label" for="<%= cid %>"></label> <span >Second</span></span> '),render:function(){if(this.model){var a="",b=this.model.get("name");_.each(this.model.get("options"),function(c){var d=c.checked?"checked":"";a+='<span class="c37-child c37-single-radio"><input id="'+c.id+'"  type="radio" '+d+'  name="'+b+'" value="'+c.value+'"/> <label class="c37-blank-label" for="'+c.id+'"></label> <span>'+decodeURIComponent(c.value)+"</span></span> "}),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-vertical"),jQuery(this.$el).closest(".c37-form-element").removeClass("c37-horizontal"),jQuery(this.$el).closest(".c37-form-element").addClass(this.model.get("alignment")),this.$el.html(a)}else this.$el.html(this.template({name:"radio_"+Math.floor(1e3*Math.random())}))}}),Text=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<i class="fa fa-envelope c37-suggest-icon"></i><input class="c37-child" id="<%= id %>" name="<%= name %>" type="text" placeholder="enter something" />'),render:function(){if(this.model){console.log("has model..."),"name"!=this.model.get("name")&&"email"!=this.model.get("name")||(console.log("what"),this.model.set({name:"_"+this.model.get("name")}));var a="";"undefined"!=typeof this.model.get("label")&&""!=this.model.get("label")&&(a+='<label for="'+this.model.get("cssID")+'">'+this.model.get("label")+"</label>"),a+='<i class="fa '+this.model.get("icon")+' c37-suggest-icon"></i><input id="'+this.model.get("cssID")+'" class="c37-child" type="'+this.model.get("type")+'" name="'+this.model.get("name")+'" placeholder="'+this.model.get("placeholder")+'" />',this.$el.html(a),this.renderSize()}else this.$el.html(this.template({name:"input_"+Math.floor(1e3*Math.random()),id:"input_"+Math.floor(1e3*Math.random())}))}}),DateInput=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<i class="fa fa-calendar c37-suggest-icon"></i><input class="c37-child" name="<%= name %>" type="date"/>'),render:function(){if(this.model){var a='<i class="fa fa-calendar c37-suggest-icon"></i><input name="'+this.model.get("name")+'" type="'+this.model.get("type")+'" value="'+this.model.get("value")+'"/>';this.$el.html(a)}else this.$el.html(this.template({name:"date_input_"+Math.floor(1e3*Math.random())}))}}),Select=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<select class="c37-child" name="<%= name %>"><option value="Cat">Cat</option><option value="Dog">Dog</option><option value="Chicken">Chicken</option></select>'),render:function(){if(this.model){var a="",b=this.model;_.each(this.model.get("options"),function(c){var d=c.value==b.get("selected_value")?"selected":"";a+="<option "+d+' value="'+c.value+'">'+decodeURIComponent(c.value)+"</option>"}),a='<select name="'+name+'">'+a+"</select>",this.$el.html(a)}else this.$el.html(this.template({name:"select_"+Math.floor(1e3*Math.random())}))}}),Label=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<label for="<%= forID %>"><%= content %></label>'),render:function(){if(this.model)if(this.model.get("required"))this.$el.html("<label>"+this.model.get("content")+'<sup class="required">*</sup></label>');else{var a=this.model.get("content");this.$el.html(this.template({forID:"input_"+Math.floor(1e3*Math.random()),content:a}))}else this.$el.html(this.template({forID:"input_"+Math.floor(1e3*Math.random()),content:"Label"}));this.renderSize()}}),Button=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<button data-role="submit" class="c37-child">Button</button>'),render:function(){if(this.model){var a='<button data-role="submit" class="c37-child">'+this.model.get("text")+"</button>";this.$el.html(a),this.renderSize()}else this.$el.html(this.template())}}),TextArea=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<i class="fa fa-edit c37-suggest-icon"></i><textarea id="<%= id %>" class="c37-child" name="<%= name %>" placeholder="enter something"></textarea>'),render:function(){if(this.model){var a="";"undefined"!=typeof this.model.get("label")&&""!=this.model.get("label")&&(a+='<label for="'+this.model.get("cssID")+'">'+this.model.get("label")+"</label>"),a+='<i class="fa fa-edit c37-suggest-icon"></i><textarea id="'+this.model.get("cssID")+'" class="c37-child" name="'+this.model.get("name")+'" placeholder="'+this.model.get("placeholder")+'"></textarea>',this.$el.html(a),this.renderSize()}else this.$el.html(this.template({name:"textarea_"+Math.floor(1e3*Math.random()),id:"textarea_"+Math.floor(1e3*Math.random())}))}}),File=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<div class="c37-child"></label><input id="<%= field_id %>" class="c37-child" name="<%= name %>" type="file" /><label class="c37-file-label" for="<%= field_id %>"><i class="fa fa-cloud-upload"></i> <%= text %> </div>'),render:function(){if(this.model){var a=this.model.get("multiple")?"multiple":"",b=this.model.get("multiple")?this.model.get("name"):this.model.get("name"),c=this.model.get("file_type")?'accept="'+this.model.get("file_type").type+'"':"",d=this.model.get("icon"),e=this.model.get("text"),f='<div class="c37-child"><label class="c37-file-label" for="'+this.model.get("field_id")+'"><i class="fa '+d+'"></i>'+e+'</label><input type="file" id="'+this.model.get("field_id")+'" name="'+b+'" '+a+" "+c+" /></div>";this.$el.html(f)}else this.$el.html(this.template({name:"attachment_"+Math.floor(1e3*Math.random()),field_id:"c37_attachment_"+Math.floor(1e4*Math.random()),text:"Select file..."}))}}),Acceptance=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<input class="c37-acceptance" id="<%= id %>" data-error="Please accept this" name="<%= name %>" type="checkbox" /><label for="<%= id %>" class="c37-acceptance-label"></label> <span class="c37-child">I agree with terms of service</span>'),render:function(){if(this.model){console.log(this.model);var a='<input id="'+this.model.get("id")+'" data-error="'+this.model.get("error_message")+'" class="c37-acceptance" name="'+this.model.get("name")+'" type="checkbox" /><label for="'+this.model.get("id")+'" class="c37-acceptance-label"></label> <span class="c37-child">'+this.model.get("text")+"</span>";this.$el.html(a)}else this.$el.html(this.template({name:"acceptance",id:"acceptance_id_"+Math.floor(1e4*Math.random())}))}}),ReCaptcha=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<div class="g-recaptcha" data-sitekey="<%= site_key %>"></div>'),render:function(){serverSettings.recaptchaSiteKey||swal("You haven't configured recaptcha settings. Please get reCaptcha keys first"),this.$el.html(this.template({site_key:serverSettings.recaptchaSiteKey}))}}),FieldSet=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<fieldset class="c37-box"><legend>Fieldset legend:</legend></fieldset>'),render:function(){this.setElement(this.template({}))}}),Image=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<img src="<%= imgSrc %>"/>'),render:function(){this.model?this.$el.html(this.template({imgSrc:this.model.get("imgSrc")})):this.$el.html(this.template({imgSrc:defaultValues.imagePlaceholder}))}}),Stars=C37FormElement.extend({initialize:function(){this.render()},template:_.template('<select name="<%= name %>" data-show-selected="false" data-show-values="false" data-initial-rating="1" data-theme="<%= theme %>" class="c37-star-rating" id="<%= id %>"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>'),render:function(){var a="";if(this.model){var b="",c=this.model;_.each(this.model.get("options"),function(a){b+='<option value="'+a.value+'">'+a.text+"</option>"}),this.$el.html('<select data-theme="'+c.get("theme")+'" class="c37-star-rating" id="'+c.get("id")+'"data-initial-rating="'+c.get("initialRating")+'"data-show-selected="'+c.get("showSelectedRating")+'"data-show-values="'+c.get("showValues")+'"name="'+c.get("name")+'"">'+b+"</select>"),a=c.get("id"),console.log("render with model")}else a="star-id-"+Math.floor(1e4*Math.random()),this.$el.html(this.template({id:a,theme:defaultValues.starsRatingOptions.theme,name:"star-"+Math.round(1e4*Math.random())}));this.renderRating(a)},renderRating:function(a){var b=this;jQuery(function(){a="#"+a,b.model&&(console.log("rendering with theme: "+b.model.get("theme")),defaultValues.starsRatingOptions.theme=b.model.get("theme"),defaultValues.starsRatingOptions.showValues=b.model.get("showValues"),defaultValues.starsRatingOptions.initialRating=b.model.get("initialRating"),defaultValues.starsRatingOptions.showSelectedRating=b.model.get("showSelectedRating")),setTimeout(function(){jQuery(a).barrating(defaultValues.starsRatingOptions)},0)})}}),Templates={checkbox:CheckBox,radio:Radio,textarea:TextArea,text:Text,date:DateInput,select:Select,label:Label,file:File,button:Button,acceptance:Acceptance,row:Row,heading:Heading,paragraph:Paragraph,step:Step,fieldset:FieldSet,recaptcha:ReCaptcha,image:Image,stars:Stars},ElementEditView=Backbone.View.extend({el:"#element-settings",originalEvents:{"change .validation input":"renderValidation","change .validation select":"renderValidation","change .element-action select":"renderAction","input .element-action input":"renderAction","input .css-styles input":"renderStyle","change .css-styles select":"renderStyle","blur [data-for=custom-css]":"renderStyle","blur [data-for=extra-classes]":"applyExtraClass","click #change-background-image":"changeImageBg","click #remove-background-image":"removeImageBg","click [data-for=background-color] .reset-color":"clearBgColor","blur [data-for=name]":"updateName"},additionalEvents:{},cleanValidation:function(){var a=Object.keys(validation);_.each(a,function(a){0==jQuery("[name="+a+"]").length&&delete validation[a]})},updateName:function(){var a=this.model.get("name");if("undefined"!=typeof a){var b=this.$el.find("[data-for=name]").first().val();"undefined"!=typeof validation[a]&&(validation[b]=validation[a],delete validation[a]),this.model.set({name:b})}},events:function(){return _.extend({},this.originalEvents,this.additionalEvents)},renderSizeObject:function(){var a={};a.size=this.$el.find("select[data-for=element-width]").val(),a.expand=!1,this.$el.find("input[data-for=expand]").is(":checked")&&(a.expand=!0),this.model.set({size:a})},renderValidation:function(){console.log("render in parent, change event");var a=this.$el.find(".validation").first(),b=jQuery(a).find("input[data-for=required]").first().is(":checked"),c=this.$el.find("[data-for=name]").val(),d=!1,e="",f=this.$el.find(".validation select[data-for=file-type]");f.length>0&&(d=f.first().val(),e="file"),validation[c]={required:b,fileType:d,inputType:e},this.cleanValidation(),this.renderGUMPValidation()},renderGUMPValidation:function(){console.log("rendering gump");var a=Object.keys(validation);core37Form.formSettings.GUMPString={},_.each(a,function(a){var b="",c=validation[a];"file"==c.inputType?(c.required&&(b+="required_file"),c.fileType.length>3&&(console.log("worth adding"),b+="|extension,"+c.fileType)):c.required&&(b+="required"),core37Form.formSettings.GUMPString[a]=b})},renderAction:function(){console.log("rendering element actions");var a=this,b=a.$el,c=a.model.get("editingElementID"),d=b.find(".element-action [data-for=trigger]").first(),e=b.find(".element-action [data-for=action]").first(),f=b.find('.element-action [data-for="trigger-value"]').first(),g=b.find(".element-action [data-for=target-url]").first(),h=b.find(".element-action [data-for=target-element]").first();if("undefined"!=typeof c){if("no-trigger"==d.val())return console.log("null-action"),delete elementsActions[c],e.hide(),f.parent().hide(),void g.hide();"click"==d.val()?(e.show(),f.parent().hide()):"change"==d.val()&&(e.show(),f.parent().show()),"open-link"!==e.val()?g.parent().hide():g.parent().show(),"show-element"==e.val()||"hide-element"==e.val()?h.parent().show():h.parent().hide();var i={},j=jQuery("#"+c);i["element-type"]=j.attr("data-c37-type"),i.trigger=d.val(),i.action=e.val(),"open-link"==e.val()?i.target=g.val():"show-element"!=e.val()&&"hide-element"!=e.val()||(i.target=h.val()),"change"==d.val()&&(i["trigger-value"]=f.val()),elementsActions[c]=i}},renderStyle:function(){var a=this.model.get("editingElementID");console.log("id is: "+a);var b=this.$el.find("[data-for=text-color] input").first().val(),c=this.$el.find("[data-for=background-color] input").first().val();"undefined"==typeof elementsStyles[a]&&(elementsStyles[a]={}),elementsStyles[a]["background-color"]=c,elementsStyles[a].color=b,this.applyStyle()},applyStyle:function(){var a="";for(var b in elementsStyles){var c=elementsStyles[b],d="";for(var e in c)d+=e+":"+c[e]+";";a+="#"+core37Form.formSettings.cssID+" #"+b+" .c37-child{"+d+"}"}0==jQuery("#element-styles").length&&jQuery("head").append('<style id="element-styles"></style>'),jQuery("#element-styles").text(""),jQuery("#element-styles").text(a)}}),TextEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("textEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-text [data-for=placeholder]":"updateModel","blur .for-text [data-for=icon]":"updateModel","input .for-text [data-for=input-label]":"updateModel","change .for-text select[data-for=input-type]":"updateModel","change .for-text select[data-for=element-width]":"updateModel","change .for-text input[data-for=expand]":"updateModel","change .for-text input[data-for=reply-to]":"updateModel","change .for-text input[data-for=email-subject]":"updateModel"},updateModel:function(){var a=this.$el.find("[data-for=placeholder]").first().val(),b=this.$el.find("[data-for=input-label]").first().val(),c=this.$el.find("select[data-for=input-type]").first().find(":selected").val(),d=this.$el.find("[data-for=name]").first().val(),e=this.$el.find("[data-for=icon]").first().val(),f=this.$el.find("[data-for=email-subject]").first().is(":checked"),g=this.$el.find("[data-for=reply-to]").first().is(":checked"),h=jQuery(".reply-to"),i=jQuery(".email-subject");"email"==c?(h.show(),h.removeClass("hidden"),g&&(core37Form.formSettings.replyToField=d)):h.hide(),"text"==c?(i.removeClass("hidden"),i.show(),f&&(core37Form.formSettings.subjectField=d)):i.hide(),this.renderSizeObject(),this.model.set({name:d,type:c,placeholder:a,label:b,icon:e})}}),CheckBoxEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("checkboxEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"click .for-checkbox .add-option":"addOption","input .for-checkbox .options input":"updateModel","change .for-checkbox .options input[type=checkbox]":"updateModel","change .for-checkbox select[data-for=alignment]":"updateModel","change .for-checkbox select[data-for=element-width]":"updateModel","change .for-checkbox input[data-for=expand]":"updateModel"},addOption:function(){this.$el.find(".options").append('<div><span class="c37-col-xs-8"><input data-for="value" type="text" placeholder="value" />  </span><span class="c37-col-xs-4 check"><input data-for="checked" type="checkbox" /> </span><span class="hidden"><input type="text" data-for="id" value="checkbox_id_'+Math.floor(1e4*Math.random())+'" /> </span></div>')},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=alignment]").first().val(),c=[];this.$el.find(".options > div").each(function(){var a=jQuery(this).find("[data-for=value]").first(),b=jQuery(this).find("[data-for=checked]").first().is(":checked"),d=jQuery(this).find("[data-for=id]").first();if(console.log(a.val()),""!=a.val()){var e={value:encodeURIComponent(a.val()),checked:b,id:d.val()};c.push(e)}}),this.renderSizeObject(),this.model.set({name:a,options:c,alignment:b})}}),RadioEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("radioEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"click .for-radio .add-option":"addOption","input .for-radio .options input":"updateModel","change .for-radio .options input[type=radio]":"updateModel","change .for-radio select[data-for=alignment]":"updateModel","change .for-radio select[data-for=element-width]":"updateModel","change .for-radio input[data-for=expand]":"updateModel"},removeElement:removeElement,addOption:function(){this.$el.find(".options").append('<div><span class="c37-col-xs-8"><input data-for="value" type="text" placeholder="value" />  </span><span class="c37-col-xs-4 check"><input data-for="checked" type="radio" /> </span><span class="hidden"><input data-for="id" type="text" value="radio_id_'+Math.floor(1e4*Math.random())+'" /> </span></div>')},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=alignment]").first().val(),c=[];this.$el.find(".options > div").each(function(){var a=jQuery(this).find("[data-for=value]").first(),b=jQuery(this).find("[data-for=checked]").first().is(":checked"),d=jQuery(this).find("[data-for=id]");if(""!=a.val()){var e={value:encodeURIComponent(a.val()),checked:b,id:d.val()};c.push(e)}}),this.renderSizeObject(),this.model.set({name:a,options:c,alignment:b})}}),LabelEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("labelEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-label [data-for=label]":"updateModel","change .for-label [data-for=required]":"updateModel","change .for-label select[data-for=element-width]":"updateModel","change .for-label input[data-for=expand]":"updateModel"},updateModel:function(){var a=this.$el.find("input[data-for=label]").first().val(),b=this.$el.find("input[data-for=required]").first().is(":checked");console.log(b),console.log("label update"),this.renderSizeObject(),this.model.set({content:a,required:b})}}),HeadingEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("headingEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-heading [data-for=heading]":"updateModel","change .for-heading [data-for=tagName]":"updateModel","change .for-heading select[data-for=element-width]":"updateModel","change .for-heading input[data-for=expand]":"updateModel"},updateModel:function(){var a=this.$el.find("input[data-for=heading]").first().val(),b=this.$el.find("[data-for=tagName]").val();console.log(b),this.model.set({content:a,tagName:b}),this.renderSizeObject()}}),ParagraphEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("paragraphEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-paragraph textarea[data-for=paragraph]":"updateModel","change .for-paragraph select[data-for=element-width]":"updateModel","change .for-paragraph input[data-for=expand]":"updateModel"},updateModel:function(){var a=this.$el.find("textarea[data-for=paragraph]").first().val();this.model.set({content:a}),this.renderSizeObject()}}),TextAreaEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("textAreaEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"change .for-textarea input[data-for=required]":"updateModel","change .for-textarea input[data-for=placeholder]":"updateModel","input .for-textarea [data-for=input-label]":"updateModel","change .for-textarea select[data-for=element-width]":"updateModel","change .for-textarea input[data-for=expand]":"updateModel"},updateModel:function(){var a=this.$el.find("input[data-for=placeholder]").first().val(),b=this.$el.find("input[data-for=name]").first().val(),c=this.$el.find("input[data-for=required]").first().is(":checked"),d=this.$el.find("[data-for=input-label]").first().val();this.model.set({name:b,required:c,placeholder:a,label:d}),this.renderSizeObject()}}),DateEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("dateEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-date [data-for=default-value]":"updateModel","change .for-date select[data-for=element-width]":"updateModel","change .for-date input[data-for=expand]":"updateModel","click .for-date .remove-element":"updateModel","change .for-date [data-for=date-type]":"updateModel"},updateModel:function(){ 
     4var a=(this.editingElement(),this.$el.find("[data-for=default-value]").first().val()),b=this.$el.find("select[data-for=date-type]").first().find(":selected").val(),c=this.$el.find("[data-for=name]").first().val();this.model.set({value:a,type:b,name:c}),this.renderSizeObject(),this.$el.find("[data-for=default-value]").attr("type",b)}}),ButtonEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("buttonEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-button input[data-for=text]":"updateModel","input .for-button input[data-for=url]":"updateModel","change .for-button select[data-for=element-width]":"updateModel","change .for-button input[data-for=expand]":"updateModel"},updateModel:function(){var a=this.$el.find("input[data-for=text]").first().val(),b=this.$el.find("input[data-for=name]").first().val();this.model.set({name:b,text:a}),this.renderSizeObject()}}),SelectEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("selectEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-select .options input":"updateModel","input .for-select [data-for=value]":"updateModel","input .for-select [data-for=selected]":"updateSelected","change .for-select select[data-for=element-width]":"updateModel","change .for-select input[data-for=expand]":"updateModel"},updateSelected:function(){var a=this.$el.find("[data-for=selected]").val();this.model.set({selected_value:a})},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=value]").first().val().split("\n"),c=this.model.get("selected_value"),d="";_.each(b,function(a){var b=a==c?"selected":"";d+="<option "+b+'  value="'+encodeURIComponent(a)+'">'+a+"</option>"}),this.$el.find("[data-for=selected]").first().html(d);var e=[];_.each(b,function(a){var b={value:encodeURIComponent(a)};e.push(b)}),this.model.set({name:a,options:e}),this.renderSizeObject()}}),AcceptanceEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},editingElement:function(){return jQuery("#"+this.model.get("editingElementID"))},template:_.template(getEditForm("acceptanceEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"input .for-acceptance [data-for=text]":"updateModel","input .for-acceptance [data-for=error]":"updateModel","change .for-acceptance input[data-for=expand]":"updateModel","change .for-acceptance select[data-for=element-width]":"updateModel"},updateModel:function(){var a=this.$el.find("input[data-for=text]").first().val(),b=this.$el.find("[data-for=name]").first().val(),c=this.$el.find("[data-for=error]").first().val();this.model.set({name:b,text:a,error_message:c}),this.renderSizeObject()}}),FileEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render()},template:_.template(getEditForm("fileEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"change .for-file input[data-for=multiple]":"updateModel","blur .for-file [data-for=icon]":"updateModel","blur .for-file [data-for=file-type]":"updateModel","input .for-file [data-for=text]":"updateModel"},updateModel:function(){var a=this.$el.find("[data-for=name]").first().val(),b=this.$el.find("[data-for=multiple]").is(":checked"),c=this.$el.find("[data-for=text]").first().val(),d=this.$el.find("[data-for=icon]").first().val(),e={type:this.$el.find("[data-for=file-type]").first().find(":selected").val(),details:""};this.model.set({name:a,multiple:b,file_type:e,text:c,icon:d}),this.renderSizeObject(),this.renderValidation()}}),ImageEdit=ElementEditView.extend({el:"#element-settings",frame:null,initialize:function(){this.render()},template:_.template(getEditForm("imageEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"click .for-image #c37-image-picker":"openImageSelector"},updateModel:function(){},openImageSelector:function(){if(!versionNangCap)return void toastr.info(UPGRADE_TO_USE_IMAGE);if(console.log("image"),this.frame)return void this.frame.open();var a=this.$el,b=this.frame,c=this.model;b=wp.media({title:"select an image",button:{text:"Use this image"},multiple:!1}),b.on("select",function(){var d=b.state().get("selection").first().toJSON();console.log(d.url),a.find(".c37-image-preview").first().attr("src",d.url),c.set({imgSrc:d.url})}),b.open()}}),StarsEdit=ElementEditView.extend({el:"#element-settings",initialize:function(){this.render(),console.log(this.model.get("theme")),console.log(this.model.get("id"))},template:_.template(getEditForm("starsEdit")),render:function(){this.$el.html(this.template())},additionalEvents:{"change .for-stars [data-for=theme]":"updateModel","input .for-stars [data-for=options]":"updateModel","change .for-stars [data-for=initial-rating]":"updateInitialValue","change .for-stars [data-for=show-labels]":"updateModel","change .for-stars [data-for=show-selected]":"updateModel"},updateInitialValue:function(){return versionNangCap?void this.model.set({initialRating:this.$el.find("[data-for=initial-rating]").first().val()}):void toastr.info(UPGRADE_TO_USE_RATING)},updateModel:function(){if(!versionNangCap)return void toastr.info(UPGRADE_TO_USE_RATING);var a=this.model,b=this.$el.find("[data-for=theme]").first().val(),c=this.$el.find("[data-for=name]").first().val(),d=this.$el.find("[data-for=show-labels]").first().is(":checked"),e=this.$el.find("[data-for=show-selected]").first().is(":checked"),f=[],g=jQuery.trim(this.$el.find("[data-for=options]").first().val());_.each(g.split("\n"),function(a){f.push({value:a,text:a})});var h="";_.each(f,function(b){var c=b.value==a.get("initialRating")?"selected":"";h+="<option "+c+' value="'+b.value+'"  >'+b.text+"</option>"}),this.$el.find("select[data-for=initial-rating]").first().html(h);var i=this.$el.find("[data-for=initial-rating]").first().val();this.model.set({showValues:d,options:f,theme:b,initialRating:i,showSelectedRating:e,name:c})}}),RowEdit=ElementEditView.extend({el:"#row-settings",initialize:function(){this.render()},editingRow:function(){return jQuery("#"+this.model.get("rowID"))},template:_.template(getEditForm("rowEdit")),reset:function(){this.$el.html(""),this.unbind(),this.model.unbind()},render:function(){this.$el.html(this.template({layout:this.model.get("layout")}))},additionalEvents:{"change .for-row select[data-for=layout]":"renderRow","click .for-row .remove-element":"removeRow"},removeRow:function(){var a=this.editingRow().parent(".c37-step");a.find(".c37-row").length>1?this.editingRow().remove():(this.editingRow().find("*").remove(),this.editingRow().append('<div class="c37-box c37-col-md-12"></div>'),makeC37BoxDroppable(jQuery))},renderRow:function(){function a(a){var b=a.attr("class").split(/\s+/),c="";return _.each(b,function(a){a.indexOf("c37-col-md-")!=-1&&(c=a)}),c}function b(a){var b=[],c=a.find(".c37-box");return _.each(c,function(a){0==jQuery(a).find(".c37-item-element").length&&b.push(a)}),b}function c(b,c){b.find(".c37-box").each(function(b){console.log(a(jQuery(this))),console.log("Index: ",c[b]),jQuery(this).removeClass(a(jQuery(this))).addClass("c37-col-md-"+c[b])})}console.log("calling render row");var d=this.editingRow(),e=d.attr("data-c37-layout"),f=this.$el.find("select[data-for=layout]").first().val();if(e!=f){var g=e.split("-"),h=f.split("-");if(g.length==h.length)c(d,h);else if(g.length>h.length){var i=g.length-h.length,j=b(d);if(i>j.length)return void alert("You do not have enough blank box"+i+"---"+j.length);for(var k=i;k>0;k--)jQuery(j[j.length-k]).remove();console.log(h),c(d,h)}else if(g.length<h.length){var l=h.length-g.length;console.log("column to add: "+l);for(var k=0;k<l;k++)d.append('<div class="c37-box"></div>');c(d,h),makeC37BoxDroppable(jQuery)}d.attr("data-c37-layout",f)}}}),FormEdit=ElementEditView.extend({el:"#form-settings",initialize:function(){this.render()},template:_.template(getEditForm("formEdit")),render:function(){this.$el.html(this.template({}))},additionalEvents:{"change .for-form input":"renderForm","input .for-form input":"renderForm","change .for-form select[data-for=form-style]":"updateStyle"},updateStyle:function(){for(var a=jQuery("#construction-site > form"),b=this.$el.find("[data-for=form-style]").first().val(),c=!1,d=0;d<core37Form.styles.length;d++)if(core37Form.styles[d].class==b){c=core37Form.styles[d].is_pro;break}c&&!versionNangCap?toastr.info(UPGRADE_TO_UNLOCK_TEMPLATE):core37Form.formSettings.presetCSSStyle=b,core37Form.formSettings.presetCSSStyle=b,_.each(core37Form.styles,function(b){a.removeClass(b.class)}),a.addClass(b)},renderForm:function(){var a=this.$el.find("[data-for=width]").first().val(),b=(this.$el.find("[data-for=bgColor]").first().val(),this.$el.find("[data-for=afterSubmitURL]").first().val()),c=this.$el.find("[data-for=sendNotification]").is(":checked"),d=this.$el.find("[data-for=sendAutoReply]").is(":checked"),e=this.$el.find("[data-for=afterSubmitMessage]").val();core37Form.formSettings.afterSubmitURL=b,core37Form.formSettings.sendNotification=c,core37Form.formSettings.sendAutoReply=d,core37Form.formSettings.afterSubmitMessage=e,core37Form.formName=this.$el.find("[data-for=name]").first().val(),core37Form.formSettings.width=a;var f=jQuery("#construction-site > form");""!=a?f.css("width",a):(f.css("width",""),f.attr("data-c37-full-width",""))}}),FormsList=Backbone.View.extend({default:{forms:{}},el:"#forms-list",initialize:function(){console.log("loading forms"),this.render()},template:_.template('<h4><i class="fa fa-close close-panel"></i> All forms</h4><ul><% _.each(forms, function(form) { %><li class="form-edit" form-id="<%= form.id %>"> <i class="fa fa-pencil"></i>  <i class="fa fa-code"></i> <i class="fa fa-trash"></i> <%= form.title %></li><% }) %></ul>'),render:function(){this.$el.html(this.template({forms:this.model.get("forms")}))}});!function(a){a(function(){versionNangCap&&a("#c37-go-pro").hide(),makeFromDroppable(a),makeC37BoxDroppable(a),makeC37StepDroppable(a),a("#construction-site form").attr("id",core37Form.formSettings.cssID),a(document).on("click",".c37-step .c37-item-element",function(a){a.preventDefault()}),a("#elements-panel").accordion(),a(".c37-container-element").draggable({connectToSortable:".c37-step",helper:"clone",revert:"invalid",addClasses:!1}),a(".c37-form-multi-element").draggable({connectToSortable:".c37-step-container",helper:"clone",revert:"invalid",addClasses:!1}),a(".c37-item-element").draggable({connectToSortable:".c37-box",helper:"clone",revert:"invalid",iframeFix:!0,addClasses:!1,refreshPositions:!0,stop:function(){localStorage.setItem("dragging-stop",!0)},start:function(){localStorage.setItem("dragging-stop",!1)}})})}(jQuery),function(a){function b(b){var c,d=a("#"+b),e=d.attr("data-c37-type"),i=f(d);"undefined"!=typeof h&&h.remove();var j={};"undefined"!=typeof elementsActions[b]&&(j=elementsActions[b]);var k=[];if(_.each(a("#construction-site .c37-item-element"),function(c){var d=a(c).attr("id");d!=b&&k.push({id:a(c).attr("id"),name:a(c).find("[name]").first().attr("name")})}),g=new C37ElementModel({action:j,allElements:k}),"undefined"!=typeof validation[b]?g.set({vali:validation[b].rules}):g.set({vali:{}}),"text"==e){var l=!1;d.find(".c37-suggest-icon").length>0&&(console.log("found"),l=d.find(".c37-suggest-icon").first().attr("class").split(" ")[1],console.log(l)),g.set({placeholder:d.find("input").first().attr("placeholder"),editingElementID:b,type:d.find("input").first().attr("type"),name:d.find("input").first().attr("name"),size:i,label:d.find("label").first().html(),cssID:d.find("input").first().attr("id"),icon:l}),c=new Text({model:g,el:"#"+b}),c.render(),g.on("change",function(){c.render()}),h=new TextEdit({model:g}),renderFontAwesome("fa-icon-input")}else if("checkbox"==e){var m=[];d.find(".c37-single-checkbox").each(function(){var b={value:a(this).find("input").first().attr("value"),checked:a(this).find("input").first().prop("checked"),id:a(this).find("input").first().attr("id")};m.push(b)}),g.set({options:m,name:d.find("input").first().attr("name").replace("[","").replace("]",""),editingElementID:b,size:i,alignment:d.hasClass("c37-vertical")?"c37-vertical":"c37-horizontal"}),c=new CheckBox({model:g,el:"#"+b}),c.render(),g.on("change",function(){c.render()}),h=new CheckBoxEdit({model:g})}else if("radio"==e){var m=[];d.find(".c37-single-radio").each(function(){var b={value:a(this).find("input").first().attr("value"),checked:a(this).find("input").first().prop("checked"),id:a(this).find("input").first().attr("id")};m.push(b)}),g.set({options:m,name:d.find("input").first().attr("name"),size:i,alignment:d.hasClass("c37-vertical")?"c37-vertical":"c37-horizontal"}),c=new Radio({model:g,el:"#"+b}),c.render(),g.on("change",function(){c.render()}),h=new RadioEdit({model:g})}else if("label"==e)g.set({content:d.find("label").first().html().replace('<sup class="required">*</sup>',"")}),g.set({required:d.find("sup").length>0}),g.set({editingElementID:b}),g.set({size:i}),c=new Label({model:g,el:"#"+b}),h=new LabelEdit({model:g});else if("heading"==e)g.set({content:d.find(":header").first().html()}),g.set({tagName:d.find(":header").first().prop("tagName").toLowerCase()}),g.set({editingElementID:b}),g.set({size:i}),c=new Heading({model:g,el:"#"+b}),h=new HeadingEdit({model:g});else if("paragraph"==e)g.set({content:d.find("p").first().html()}),g.set({editingElementID:b}),g.set({size:i}),c=new Paragraph({model:g,el:"#"+b}),h=new ParagraphEdit({model:g});else if("date"==e)g.set({value:d.find("input").first().attr("value")}),g.set({editingElementID:b}),g.set({type:d.find("input").first().attr("type")}),g.set({name:d.find("input").first().attr("name")}),g.set({size:i}),c=new DateInput({model:g,el:"#"+b}),h=new DateEdit({model:g});else if("textarea"==e)g.set({editingElementID:b,name:d.find("textarea").first().attr("name"),placeholder:d.find("textarea").first().attr("placeholder"),label:d.find("label").first().html(),cssID:d.find("textarea").first().attr("id"),size:i}),c=new TextArea({model:g,el:"#"+b}),h=new TextAreaEdit({model:g});else if("button"==e){var n=d.find("button").first();g.set({text:n.html()}),g.set({name:n.attr("name")}),g.set({editingElementID:b}),g.set({size:i}),c=new Button({model:g,el:"#"+b}),h=new ButtonEdit({model:g})}else if("select"==e){var m=[];d.find("option").each(function(){var b={value:a(this).attr("value")};m.push(b)}),g.set({options:m,name:d.find("select").first().attr("name"),editingElementID:b,size:i,selected_value:d.find("select").first().val()}),c=new Select({model:g,el:"#"+b}),h=new SelectEdit({model:g})}else if("acceptance"==e)g.set({error_message:d.find("input").first().attr("data-error"),name:d.find("input").first().attr("name"),text:d.find("span").first().html(),editingElementID:b,id:d.find("input").first().attr("id"),size:i}),c=new Acceptance({model:g,el:"#"+b}),h=new AcceptanceEdit({model:g});else if("file"==e)g.set({name:d.find("input").first().attr("name").replace("[","").replace("]",""),multiple:d.find("input").first().prop("multiple"),field_id:d.find("input").first().attr("id"),editingElementID:b,text:d.find(".c37-file-label").first().text(),icon:d.find("i").attr("class"),file_type:d.find("input").first().attr("accept")}),c=new File({model:g,el:"#"+b}),h=new FileEdit({model:g}),renderFontAwesome("fa-icon-input");else if("image"==e)g.set({imgSrc:d.find("img").first().attr("src")}),c=new Image({model:g,el:"#"+b}),h=new ImageEdit({model:g});else if("stars"==e){var o=d.find("select").first(),p=o.attr("data-theme"),q=o.attr("id"),m=[],r=o.attr("data-initial-rating"),s="true"==o.attr("data-show-values"),t="true"==o.attr("data-show-selected"),u=o.attr("name");_.each(o.find("option"),function(b){m.push({value:a(b).val(),text:a(b).html()})}),g.set({theme:p,id:q,options:m,initialRating:r,showValues:s,showSelectedRating:t,name:u}),c=new Stars({model:g,el:"#"+b}),h=new StarsEdit({model:g})}c.render(),g.on("change",function(){c.render()}),a("#setting-tabs").tabs({active:0}),a(document).on("click","#setting-tabs ul li a",function(){a("#setting-tabs ul li a").removeClass("active-tab"),a(this).addClass("active-tab")})}function c(b){swal({title:"Delete this element?",text:"This action cannot be undone. Be very careful",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",closeOnConfirm:!0},function(c){if(c){var d=a("#"+b);"undefined"!=typeof validation[b]&&delete validation[b],d.remove(),console.log("deleted")}})}function d(){k=new FormEdit({model:new C37ElementModel(core37Form.formSettings)}),a("#setting-tabs").tabs({active:0}),a(document).on("click","#setting-tabs ul li a",function(){a("#setting-tabs ul li a").removeClass("active-tab"),a(this).addClass("active-tab")})}function e(b,c){"undefined"!=typeof i&&i.clear(),i=new C37ElementModel({rowID:b,layout:c}),"undefined"!=typeof j&&j.remove(),j=new RowEdit({model:i}),a("#setting-tabs").tabs({active:0}),a(document).on("click","#setting-tabs ul li a",function(){a("#setting-tabs ul li a").removeClass("active-tab"),a(this).addClass("active-tab")})}function f(a){var b=a.hasClass("c37-col-xs-12"),c=a.attr("class"),d=12;if(c.indexOf("c37-col-md-")!=-1){var e=c.split("c37-col-md-");d=e[1].split(" ")[0]}return{expand:b,size:d}}var g,h,i,j,k,l=(a("#options-window"),'<div class="c37-element-cm"><span class="cm-move"><i class="fa fa-arrows"></i></span><span class="cm-edit"><i class="fa fa-pencil"></i></span><span class="cm-del"><i class="fa fa-trash"></i></span></div>'),m='<div class="c37-row-cm"><span class="cm-row-move"><i class="fa fa-arrows"></i></span><span class="cm-row-edit"><i class="fa fa-pencil"></i></span><span class="cm-box-edit"><i class="fa fa-square"></i></span><span class="cm-row-del"><i class="fa fa-trash"></i></span></div>';a(document).on("click",".close-panel",function(){hideOptionsWindow(a)}),a(document).on("mouseover",".c37-step .c37-item-element",function(){0==a(this).find(".c37-element-cm").length&&a(this).append(l)}),a(document).on("mouseleave",".c37-step .c37-item-element",function(){a(this).find(".c37-element-cm").remove()}),a(document).on("mouseover",".c37-step .c37-box",function(){0==a(this).find(".c37-row-cm").length&&a(this).append(m)}),a(document).on("mouseleave",".c37-step .c37-box",function(){a(this).find(".c37-row-cm").remove()}),a(document).on("click",".cm-del",function(){var b=a(this).closest(".c37-item-element");console.log("about to delete"),swal({title:"Delete this element?",text:"This action cannot be undone. Be very careful",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",closeOnConfirm:!0},function(a){if(a){var c=b.attr("id");console.log(c),"undefined"!=typeof validation[c]&&delete validation[c],b.remove(),console.log("deleted")}})}),a(document).on("click",".c37-element-cm .cm-edit",function(){console.log("loading edit form...");var c=a("#options-window");c.html(""),c.append('<div id="element-settings"></div>');var d=a(this).closest(".c37-item-element").attr("id");b(d),c.hide(),showOptionsWindow(a),c.draggable({handle:"#move-panel"})}),a(document).on("click",".c37-element-cm .cm-del",function(){var b=a(this).closest(".c37-item-element").attr("id");c(b)}),a(document).on("click",".c37-row-cm .cm-row-edit",function(b){a("#options-window").html(""),a("#options-window").append('<div id="row-settings"></div>');var c=a(this).closest(".c37-row").attr("id"),d=a(this).closest(".c37-row").attr("data-c37-layout");e(c,d),hideOptionsWindow(a),showOptionsWindow(a),a("#options-window").draggable({handle:"#move-panel"})}),a(document).on("click",".c37-row-cm .cm-row-del",function(){var b=a(this).closest(".c37-row").attr("id");c(b)}),a(document).on("click","#open-form-settings",function(){a("#options-window").html(""),a("#options-window").append('<div id="form-settings"></div>'),d(),hideOptionsWindow(a),showOptionsWindow(a)})}(jQuery),function(a){a(document).on("click","#save-form",function(){if(console.log(core37Form),""==a.trim(core37Form.formName))return void toastr.error(ERROR_MISSING_FORM_NAME);var b="",c=a("#construction-site .c37-step");_.each(c,function(a){b+=encodeURIComponent(a.outerHTML)}),a.post(ajaxurl,{formContent:b,elementsActions:JSON.stringify(elementsActions),formID:core37Form.formID,formSettings:JSON.stringify(core37Form.formSettings),formName:core37Form.formName,action:"core37_save_form",formValidation:JSON.stringify(validation),formCSSCode:encodeURIComponent(a("#element-styles").text()),formCSSObject:JSON.stringify(elementsStyles)},function(a){core37Form.formID=parseInt(a),toastr.success(SUCCESS_FORM_SAVED)})}),a(document).on("click","#get-forms",function(b){a.post(ajaxurl,{action:"core37_list_forms"},function(b){var c=a("#options-window");c.html(""),c.append('<div id="forms-list"></div>');var d=new C37ElementModel({});d.set("forms",JSON.parse(b)),new FormsList({model:d}),c.show()})}),a(document).on("click",".form-edit i.fa-pencil",function(){var b=a(this).closest("li").attr("form-id");a.post(ajaxurl,{action:"core37_load_form",formID:b},function(c){var d=JSON.parse(c);elementsActions=JSON.parse(d.elementsActions),core37Form.formSettings=JSON.parse(d.formSettings),validation=JSON.parse(d.formValidation),elementsStyles=JSON.parse(d.formCSSObject),a("#element-styles").remove(),a("head").append('<style id="element-styles"></style>'),a("#element-styles").text(decodeURIComponent(d.formCSSCode));var e='<form class="c37-form c37-container '+core37Form.formSettings.presetCSSStyle+' " method="'+core37Form.formSettings.method+'" action="'+core37Form.formSettings.action+'" enctype="application/x-www-form-urlencoded" id="'+core37Form.formSettings.cssID+'" style="width: '+core37Form.formSettings.width+'px;">'+decodeURIComponent(d.formData.post_content)+"</form>";a("#construction-site").html(e),core37Form.formName=d.formData.post_title,core37Form.formID=b,makeFromDroppable(a),makeC37BoxDroppable(a),makeC37StepDroppable(a),restoreStarsRating(a),hideOptionsWindow(a)})}),a(document).on("click",".form-edit i.fa-trash",function(){var b=a(this).closest("li").attr("form-id"),c=a(this);swal({title:"Are you sure?",text:"You will not be able to recover this form!",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",closeOnConfirm:!1,html:!1},function(){a.post(ajaxurl,{action:"core37_delete_form",formID:b},function(){c.closest(".form-edit").hide("slide",{direction:"up"},200)}),swal("Deleted!","Your form has been deleted.","success")})}),a(document).on("click",".form-edit i.fa-code",function(){var b=a(this).closest("li").attr("form-id");swal("Here is your shortcode","[core37_form id="+b+"]","success")})}(jQuery),function(){jQuery(function(){jQuery(".c37-form input[type=file]").on("change",function(){for(var a="",b=0;b<jQuery(this).get(0).files.length;++b)a+='<span class="c37-selected-file">'+jQuery(this).get(0).files[b].name+"</span>";a="<div class='all-selected-files'>"+a+"</div>",jQuery(".all-selected-files").remove(),console.log("item: "+jQuery(this).closest(".c37-child").length),jQuery(this).is(":visible")||(console.log("appending-file"),jQuery(this).closest("div.c37-child").append(a))}),_.each(jQuery(".c37-star-rating"),function(a){var b=jQuery(a);b.siblings(".br-widget").remove(),console.log(b.find(".br-wrapper").length),console.log("star rendered");var c=b.attr("data-theme"),d="true"==b.attr("data-show-selected"),e="true"==b.attr("data-show-values"),f=b.attr("data-initial-rating"),g=b.attr("id"),h={theme:c,showSelectedRating:d,showValues:e,initialRating:f,allowEmpty:!0,onSelect:function(a,c){console.log("value is : "+a),_.each(b.find("option"),function(b){var c=jQuery(b);c.val()==a&&c.prop("selected",!0)})}};console.log(h),jQuery("#"+g).barrating(h)})})}(jQuery); 
  • core37-form-builder/trunk/js/front/process.js

    r1553983 r1554164  
    77    jQuery(function(){ 
    88 
    9         var parsleyObject; 
    10         //on submit button click, process the form 
    11         jQuery(document).on('click', '.c37-form [data-role=submit]', function(e){ 
    12             //e.preventDefault(); 
    13             console.log('submit button clicked'); 
    14             var form = jQuery(this).closest('.c37-form'); 
    15             parsleyObject = form.parsley(); 
    16         }); 
    179 
     10        //add validation data to elements of forms 
     11        _.each(jQuery('.c37-form'), function(form){ 
    1812 
    19         jQuery('.c37-form').bind('submit', function(e){ 
    20             e.preventDefault(); 
    21             var form = jQuery(this); 
    22             var formID = form.attr('id'); 
     13            var formID = jQuery(form).find('input[name=form_id]').first().val(); 
     14            console.log(formID); 
    2315 
    2416            var validationObject = formsValidation[formID]; 
     
    3224            if (typeof validationObject != 'undefined') 
    3325            { 
     26                var names = Object.keys(validationObject); 
    3427 
     28                _.each(names, function(name){ 
     29 
     30                    var vO = validationObject[name]; 
     31                    var element = jQuery('[name='+name+']'); 
     32 
     33                    if (vO.required) 
     34                        element.prop('required', true); 
     35 
     36                }); 
    3537            } 
    3638 
    37             if (typeof parsleyObject == 'undefined') 
    38                 parsleyObject = form.parsley(); 
     39            jQuery(form).parsley(); 
    3940 
    40             if (parsleyObject.isValid()) 
     41 
     42        }); 
     43 
     44        //on submit button click, process the form 
     45        jQuery(document).on('click', '.c37-form [data-role=submit]', function(e){ 
     46            //e.preventDefault(); 
     47            console.log('submit button clicked'); 
     48            var form = jQuery(this).closest('.c37-form'); 
     49            //form.submit(); 
     50        }); 
     51 
     52 
     53        jQuery('.c37-form').bind('submit', function(e){ 
     54            e.preventDefault(); 
     55            var form = jQuery(this); 
     56 
     57 
     58            if (form.parsley().isValid()) 
    4159            { 
    4260                console.log('form is valid! wow!'); 
    4361                submitForm(form); 
     62                return; 
     63            } else 
     64            { 
     65                return; 
    4466            } 
    4567 
     
    6486            form.unbind('submit'); 
    6587            form.submit(); 
    66             return true; 
     88            return; 
    6789        } 
    6890 
  • core37-form-builder/trunk/js/frontend.min.js

    r1553983 r1554164  
    11function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}!function(a){a(["jquery"],function(a){return function(){function b(a,b,c){return o({type:v.error,iconClass:p().iconClasses.error,message:a,optionsOverride:c,title:b})}function c(b,c){return b||(b=p()),r=a("#"+b.containerId),r.length?r:(c&&(r=l(b)),r)}function d(a,b,c){return o({type:v.info,iconClass:p().iconClasses.info,message:a,optionsOverride:c,title:b})}function e(a){s=a}function f(a,b,c){return o({type:v.success,iconClass:p().iconClasses.success,message:a,optionsOverride:c,title:b})}function g(a,b,c){return o({type:v.warning,iconClass:p().iconClasses.warning,message:a,optionsOverride:c,title:b})}function h(a,b){var d=p();r||c(d),k(a,d,b)||j(d)}function i(b){var d=p();return r||c(d),b&&0===a(":focus",b).length?void q(b):void(r.children().length&&r.remove())}function j(b){for(var c=r.children(),d=c.length-1;d>=0;d--)k(a(c[d]),b)}function k(b,c,d){var e=!(!d||!d.force)&&d.force;return!(!b||!e&&0!==a(":focus",b).length||(b[c.hideMethod]({duration:c.hideDuration,easing:c.hideEasing,complete:function(){q(b)}}),0))}function l(b){return r=a("<div/>").attr("id",b.containerId).addClass(b.positionClass),r.appendTo(a(b.target)),r}function m(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'<button type="button">&times;</button>',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function n(a){s&&s(a)}function o(b){function d(a){return null==a&&(a=""),a.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e(){i(),k(),l(),m(),o(),s(),j(),f()}function f(){var a="";switch(b.iconClass){case"toast-success":case"toast-info":a="polite";break;default:a="assertive"}D.attr("aria-live",a)}function g(){A.closeOnHover&&D.hover(y,x),!A.onclick&&A.tapToDismiss&&D.click(w),A.closeButton&&H&&H.click(function(a){a.stopPropagation?a.stopPropagation():void 0!==a.cancelBubble&&a.cancelBubble!==!0&&(a.cancelBubble=!0),A.onCloseClick&&A.onCloseClick(a),w(!0)}),A.onclick&&D.click(function(a){A.onclick(a),w()})}function h(){D.hide(),D[A.showMethod]({duration:A.showDuration,easing:A.showEasing,complete:A.onShown}),A.timeOut>0&&(C=setTimeout(w,A.timeOut),I.maxHideTime=parseFloat(A.timeOut),I.hideEta=(new Date).getTime()+I.maxHideTime,A.progressBar&&(I.intervalId=setInterval(z,10)))}function i(){b.iconClass&&D.addClass(A.toastClass).addClass(B)}function j(){A.newestOnTop?r.prepend(D):r.append(D)}function k(){if(b.title){var a=b.title;A.escapeHtml&&(a=d(b.title)),E.append(a).addClass(A.titleClass),D.append(E)}}function l(){if(b.message){var a=b.message;A.escapeHtml&&(a=d(b.message)),F.append(a).addClass(A.messageClass),D.append(F)}}function m(){A.closeButton&&(H.addClass(A.closeClass).attr("role","button"),D.prepend(H))}function o(){A.progressBar&&(G.addClass(A.progressClass),D.prepend(G))}function s(){A.rtl&&D.addClass("rtl")}function v(a,b){if(a.preventDuplicates){if(b.message===t)return!0;t=b.message}return!1}function w(b){var c=b&&A.closeMethod!==!1?A.closeMethod:A.hideMethod,d=b&&A.closeDuration!==!1?A.closeDuration:A.hideDuration,e=b&&A.closeEasing!==!1?A.closeEasing:A.hideEasing;if(!a(":focus",D).length||b)return clearTimeout(I.intervalId),D[c]({duration:d,easing:e,complete:function(){q(D),clearTimeout(C),A.onHidden&&"hidden"!==J.state&&A.onHidden(),J.state="hidden",J.endTime=new Date,n(J)}})}function x(){(A.timeOut>0||A.extendedTimeOut>0)&&(C=setTimeout(w,A.extendedTimeOut),I.maxHideTime=parseFloat(A.extendedTimeOut),I.hideEta=(new Date).getTime()+I.maxHideTime)}function y(){clearTimeout(C),I.hideEta=0,D.stop(!0,!0)[A.showMethod]({duration:A.showDuration,easing:A.showEasing})}function z(){var a=(I.hideEta-(new Date).getTime())/I.maxHideTime*100;G.width(a+"%")}var A=p(),B=b.iconClass||A.iconClass;if("undefined"!=typeof b.optionsOverride&&(A=a.extend(A,b.optionsOverride),B=b.optionsOverride.iconClass||B),!v(A,b)){u++,r=c(A,!0);var C=null,D=a("<div/>"),E=a("<div/>"),F=a("<div/>"),G=a("<div/>"),H=a(A.closeHtml),I={intervalId:null,hideEta:null,maxHideTime:null},J={toastId:u,state:"visible",startTime:new Date,options:A,map:b};return e(),h(),g(),n(J),A.debug&&console&&console.log(J),D}}function p(){return a.extend({},m(),w.options)}function q(a){r||(r=c()),a.is(":visible")||(a.remove(),a=null,0===r.children().length&&(r.remove(),t=void 0))}var r,s,t,u=0,v={error:"error",info:"info",success:"success",warning:"warning"},w={clear:h,remove:i,error:b,getContainer:c,info:d,options:{},subscribe:e,success:f,version:"2.1.3",warning:g};return w}()})}("function"==typeof define&&define.amd?define:function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("jquery")):window.toastr=b(window.jQuery)}),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){var b=function(){function b(){var b=this,c=function(){var c=["br-wrapper"];""!==b.options.theme&&c.push("br-theme-"+b.options.theme),b.$elem.wrap(a("<div />",{class:c.join(" ")}))},d=function(){b.$elem.unwrap()},e=function(c){return a.isNumeric(c)&&(c=Math.floor(c)),a('option[value="'+c+'"]',b.$elem)},f=function(){var c=b.options.initialRating;return c?e(c):a("option:selected",b.$elem)},g=function(){var c=b.$elem.find('option[value="'+b.options.emptyValue+'"]');return!c.length&&b.options.allowEmpty?(c=a("<option />",{value:b.options.emptyValue}),c.prependTo(b.$elem)):c},h=function(a){var c=b.$elem.data("barrating");return"undefined"!=typeof a?c[a]:c},i=function(a,c){null!==c&&"object"==typeof c?b.$elem.data("barrating",c):b.$elem.data("barrating")[a]=c},j=function(){var a=f(),c=g(),d=a.val(),e=a.data("html")?a.data("html"):a.text(),h=null!==b.options.allowEmpty?b.options.allowEmpty:!!c.length,j=c.length?c.val():null,k=c.length?c.text():null;i(null,{userOptions:b.options,ratingValue:d,ratingText:e,originalRatingValue:d,originalRatingText:e,allowEmpty:h,emptyRatingValue:j,emptyRatingText:k,readOnly:b.options.readonly,ratingMade:!1})},k=function(){b.$elem.removeData("barrating")},l=function(){return h("ratingText")},m=function(){return h("ratingValue")},n=function(){var c=a("<div />",{class:"br-widget"});return b.$elem.find("option").each(function(){var d,e,f,g;d=a(this).val(),d!==h("emptyRatingValue")&&(e=a(this).text(),f=a(this).data("html"),f&&(e=f),g=a("<a />",{href:"#","data-rating-value":d,"data-rating-text":e,html:b.options.showValues?e:""}),c.append(g))}),b.options.showSelectedRating&&c.append(a("<div />",{text:"",class:"br-current-rating"})),b.options.reverse&&c.addClass("br-reverse"),b.options.readonly&&c.addClass("br-readonly"),c},o=function(){return h("userOptions").reverse?"nextAll":"prevAll"},p=function(a){e(a).prop("selected",!0),b.$elem.change()},q=function(){a("option",b.$elem).prop("selected",function(){return this.defaultSelected}),b.$elem.change()},r=function(a){a=a?a:l(),a==h("emptyRatingText")&&(a=""),b.options.showSelectedRating&&b.$elem.parent().find(".br-current-rating").text(a)},s=function(a){return Math.round(Math.floor(10*a)/10%1*100)},t=function(){b.$widget.find("a").removeClass(function(a,b){return(b.match(/(^|\s)br-\S+/g)||[]).join(" ")})},u=function(){var c,d,e=b.$widget.find('a[data-rating-value="'+m()+'"]'),f=h("userOptions").initialRating,g=a.isNumeric(m())?m():0,i=s(f);if(t(),e.addClass("br-selected br-current")[o()]().addClass("br-selected"),!h("ratingMade")&&a.isNumeric(f)){if(f<=g||!i)return;c=b.$widget.find("a"),d=e.length?e[h("userOptions").reverse?"prev":"next"]():c[h("userOptions").reverse?"last":"first"](),d.addClass("br-fractional"),d.addClass("br-fractional-"+i)}},v=function(a){return!(!h("allowEmpty")||!h("userOptions").deselectable)&&m()==a.attr("data-rating-value")},w=function(c){c.on("click.barrating",function(c){var d,e,f=a(this),g=h("userOptions");return c.preventDefault(),d=f.attr("data-rating-value"),e=f.attr("data-rating-text"),v(f)&&(d=h("emptyRatingValue"),e=h("emptyRatingText")),i("ratingValue",d),i("ratingText",e),i("ratingMade",!0),p(d),r(e),u(),g.onSelect.call(b,m(),l(),c),!1})},x=function(b){b.on("mouseenter.barrating",function(){var b=a(this);t(),b.addClass("br-active")[o()]().addClass("br-active"),r(b.attr("data-rating-text"))})},y=function(a){b.$widget.on("mouseleave.barrating blur.barrating",function(){r(),u()})},z=function(b){b.on("touchstart.barrating",function(b){b.preventDefault(),b.stopPropagation(),a(this).click()})},A=function(a){a.on("click.barrating",function(a){a.preventDefault()})},B=function(a){w(a),b.options.hoverState&&(x(a),y(a))},C=function(a){a.off(".barrating")},D=function(a){var c=b.$widget.find("a");z&&z(c),a?(C(c),A(c)):B(c)};this.show=function(){h()||(c(),j(),b.$widget=n(),b.$widget.insertAfter(b.$elem),u(),r(),D(b.options.readonly),b.$elem.hide())},this.readonly=function(a){"boolean"==typeof a&&h("readOnly")!=a&&(D(a),i("readOnly",a),b.$widget.toggleClass("br-readonly"))},this.set=function(a){var c=h("userOptions");b.$elem.find('option[value="'+a+'"]').val()&&(i("ratingValue",a),i("ratingText",b.$elem.find('option[value="'+a+'"]').text()),i("ratingMade",!0),p(m()),r(l()),u(),c.silent||c.onSelect.call(this,m(),l()))},this.clear=function(){var a=h("userOptions");i("ratingValue",h("originalRatingValue")),i("ratingText",h("originalRatingText")),i("ratingMade",!1),q(),r(l()),u(),a.onClear.call(this,m(),l())},this.destroy=function(){var a=m(),c=l(),e=h("userOptions");C(b.$widget.find("a")),b.$widget.remove(),k(),d(),b.$elem.show(),e.onDestroy.call(this,a,c)}}return b.prototype.init=function(b,c){return this.$elem=a(c),this.options=a.extend({},a.fn.barrating.defaults,b),this.options},b}();a.fn.barrating=function(c,d){return this.each(function(){var e=new b;if(a(this).is("select")||a.error("Sorry, this plugin only works with select fields."),e.hasOwnProperty(c)){if(e.init(d,this),"show"===c)return e.show(d);if(e.$elem.data("barrating"))return e.$widget=a(this).next(".br-widget"),e[c](d)}else{if("object"==typeof c||!c)return d=c,e.init(d,this),e.show();a.error("Method "+c+" does not exist on jQuery.barrating")}})},a.fn.barrating.defaults={theme:"",initialRating:null,allowEmpty:null,emptyValue:"",showValues:!1,showSelectedRating:!0,deselectable:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,onSelect:function(a,b,c){},onClear:function(a,b){},onDestroy:function(a,b){}},a.fn.barrating.BarRating=b});var UPGRADE_TO_UNLOCK_TEMPLATE="This style is in the pro version only. Please get the pro version to access all styles.",UPGRADE_TO_USE_IMAGE="Image element is available in the PRO version only. Please upgrade to use image in your form",UPGRADE_TO_USE_RATING="Stars rating is available in the PRO version only. Please upgrade to use ratings in your form",ERROR_MISSING_FORM_NAME="Please enter a name for your form",SUCCESS_FORM_SAVED="Form saved!",SUCCESS_CODE_SAVED="Code saved!",SUCCESS_EMAIL_SAVED="Email saved!",SUCCESS_SUBSCRIBER_DATA_CLEARED="Subscribers data for currently selected form cleared!",INFO_LOADING_SUBSCRIBERS_DATA="Loading subscribers data",ERROR_PLEASE_SOLVE_CAPTCHA="Please solve the captcha",ERROR_INPUT_NOT_VALID="Your input is not valid! ",INFO_CLEAR_SUBSCRIBERS="Clear subscribers data?",INFO_CLEAR_SUBSCRIBERS_EXPLAIN="You are going to clear subscribers data for currently selected form. This cannot be undone",INFO_SUBSCRIBERS_CLEARED="Subscribers data cleared!";jQuery(function(){Modernizr.inputtypes.date||jQuery("input[type=date]").pikaday({firstDay:1})}),toastr.options={closeButton:!0,debug:!1,newestOnTop:!1,progressBar:!0,positionClass:"toast-top-center",preventDuplicates:!1,onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut"};var _slice=Array.prototype.slice;!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],b):a.parsley=b(a.jQuery)}(this,function(a){"use strict";function b(a,b){return a.parsleyAdaptedCallback||(a.parsleyAdaptedCallback=function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(this),a.apply(b||G,c)}),a.parsleyAdaptedCallback}function c(a){return 0===a.lastIndexOf(I,0)?a.substr(I.length):a}function d(){var b=this,c=window||global;a.extend(this,{isNativeEvent:function(a){return a.originalEvent&&a.originalEvent.isTrusted!==!1},fakeInputEvent:function(c){b.isNativeEvent(c)&&a(c.target).trigger("input")},misbehaves:function(c){b.isNativeEvent(c)&&(b.behavesOk(c),a(document).on("change.inputevent",c.data.selector,b.fakeInputEvent),b.fakeInputEvent(c))},behavesOk:function(c){b.isNativeEvent(c)&&a(document).off("input.inputevent",c.data.selector,b.behavesOk).off("change.inputevent",c.data.selector,b.misbehaves)},install:function(){if(!c.inputEventPatched){c.inputEventPatched="0.0.3";for(var d=["select",'input[type="checkbox"]','input[type="radio"]','input[type="file"]'],e=0;e<d.length;e++){var f=d[e];a(document).on("input.inputevent",f,{selector:f},b.behavesOk).on("change.inputevent",f,{selector:f},b.misbehaves)}}},uninstall:function(){delete c.inputEventPatched,a(document).off(".inputevent")}})}var e=1,f={},g={attr:function(a,b,c){var d,e,f,g=new RegExp("^"+b,"i");if("undefined"==typeof c)c={};else for(d in c)c.hasOwnProperty(d)&&delete c[d];if("undefined"==typeof a||"undefined"==typeof a[0])return c;for(f=a[0].attributes,d=f.length;d--;)e=f[d],e&&e.specified&&g.test(e.name)&&(c[this.camelize(e.name.slice(b.length))]=this.deserializeValue(e.value));return c},checkAttr:function(a,b,c){return a.is("["+b+c+"]")},setAttr:function(a,b,c,d){a[0].setAttribute(this.dasherize(b+c),String(d))},generateID:function(){return""+e++},deserializeValue:function(b){var c;try{return b?"true"==b||"false"!=b&&("null"==b?null:isNaN(c=Number(b))?/^[\[\{]/.test(b)?a.parseJSON(b):b:c):b}catch(a){return b}},camelize:function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},dasherize:function(a){return a.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(){var a;window.console&&"function"==typeof window.console.warn&&(a=window.console).warn.apply(a,arguments)},warnOnce:function(a){f[a]||(f[a]=!0,this.warn.apply(this,arguments))},_resetWarnings:function(){f={}},trimString:function(a){return a.replace(/^\s+|\s+$/g,"")},namespaceEvents:function(b,c){return b=this.trimString(b||"").split(/\s+/),b[0]?a.map(b,function(a){return a+"."+c}).join(" "):""},difference:function(b,c){var d=[];return a.each(b,function(a,b){c.indexOf(b)==-1&&d.push(b)}),d},all:function(b){return a.when.apply(a,_toConsumableArray(b).concat([42,42]))},objectCreate:Object.create||function(){var a=function(){};return function(b){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof b)throw TypeError("Argument must be an object");a.prototype=b;var c=new a;return a.prototype=null,c}}(),_SubmitSelector:'input[type="submit"], button:submit'},h=g,i={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(a){},errorsContainer:function(a){},errorsWrapper:'<ul class="parsley-errors-list"></ul>',errorTemplate:"<li></li>"},j=function(){this.__id__=h.generateID()};j.prototype={asyncSupport:!0,_pipeAccordingToValidationResult:function(){var b=this,c=function(){var c=a.Deferred();return!0!==b.validationResult&&c.reject(),c.resolve().promise()};return[c,c]},actualizeOptions:function(){return h.attr(this.$element,this.options.namespace,this.domOptions),this.parent&&this.parent.actualizeOptions&&this.parent.actualizeOptions(),this},_resetOptions:function(a){this.domOptions=h.objectCreate(this.parent.options),this.options=h.objectCreate(this.domOptions);for(var b in a)a.hasOwnProperty(b)&&(this.options[b]=a[b]);this.actualizeOptions()},_listeners:null,on:function(a,b){this._listeners=this._listeners||{};var c=this._listeners[a]=this._listeners[a]||[];return c.push(b),this},subscribe:function(b,c){a.listenTo(this,b.toLowerCase(),c)},off:function(a,b){var c=this._listeners&&this._listeners[a];if(c)if(b)for(var d=c.length;d--;)c[d]===b&&c.splice(d,1);else delete this._listeners[a];return this},unsubscribe:function(b,c){a.unsubscribeTo(this,b.toLowerCase())},trigger:function(a,b,c){b=b||this;var d,e=this._listeners&&this._listeners[a];if(e)for(var f=e.length;f--;)if(d=e[f].call(b,b,c),d===!1)return d;return!this.parent||this.parent.trigger(a,b,c)},reset:function(){if("ParsleyForm"!==this.__class__)return this._resetUI(),this._trigger("reset");for(var a=0;a<this.fields.length;a++)this.fields[a].reset();this._trigger("reset")},destroy:function(){if(this._destroyUI(),"ParsleyForm"!==this.__class__)return this.$element.removeData("Parsley"),this.$element.removeData("ParsleyFieldMultiple"),void this._trigger("destroy");for(var a=0;a<this.fields.length;a++)this.fields[a].destroy();this.$element.removeData("Parsley"),this._trigger("destroy")},asyncIsValid:function(a,b){return h.warnOnce("asyncIsValid is deprecated; please use whenValid instead"),this.whenValid({group:a,force:b})},_findRelated:function(){return this.options.multiple?this.parent.$element.find("["+this.options.namespace+'multiple="'+this.options.multiple+'"]'):this.$element}};var k={string:function(a){return a},integer:function(a){if(isNaN(a))throw'Requirement is not an integer: "'+a+'"';return parseInt(a,10)},number:function(a){if(isNaN(a))throw'Requirement is not a number: "'+a+'"';return parseFloat(a)},reference:function(b){var c=a(b);if(0===c.length)throw'No such reference: "'+b+'"';return c},boolean:function(a){return"false"!==a},object:function(a){return h.deserializeValue(a)},regexp:function(a){var b="";return/^\/.*\/(?:[gimy]*)$/.test(a)?(b=a.replace(/.*\/([gimy]*)$/,"$1"),a=a.replace(new RegExp("^/(.*?)/"+b+"$"),"$1")):a="^"+a+"$",new RegExp(a,b)}},l=function(a,b){var c=a.match(/^\s*\[(.*)\]\s*$/);if(!c)throw'Requirement is not an array: "'+a+'"';var d=c[1].split(",").map(h.trimString);if(d.length!==b)throw"Requirement has "+d.length+" values when "+b+" are needed";return d},m=function(a,b){var c=k[a||"string"];if(!c)throw'Unknown requirement specification: "'+a+'"';return c(b)},n=function(a,b,c){var d=null,e={};for(var f in a)if(f){var g=c(f);"string"==typeof g&&(g=m(a[f],g)),e[f]=g}else d=m(a[f],b);return[d,e]},o=function(b){a.extend(!0,this,b)};o.prototype={validate:function(b,c){if(this.fn)return arguments.length>3&&(c=[].slice.call(arguments,1,-1)),this.fn.call(this,b,c);if(a.isArray(b)){if(!this.validateMultiple)throw"Validator `"+this.name+"` does not handle multiple values";return this.validateMultiple.apply(this,arguments)}if(this.validateNumber)return!isNaN(b)&&(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(b,c){if("string"!=typeof b)return a.isArray(b)?b:[b];var d=this.requirementType;if(a.isArray(d)){for(var e=l(b,d.length),f=0;f<e.length;f++)e[f]=m(d[f],e[f]);return e}return a.isPlainObject(d)?n(d,b,c):[m(d,b)]},requirementType:"string",priority:2};var p=function(a,b){this.__class__="ParsleyValidatorRegistry",this.locale="en",this.init(a||{},b||{})},q={email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-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-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,number:/^-?(\d*\.)?\d+(e[-+]?\d+)?$/i,integer:/^-?\d+$/,digits:/^\d+$/,alphanum:/^\w+$/i,url:new RegExp("^(?:(?:https?|ftp)://)?(?:\\S+(?::\\S*)?@)?(?:(?:[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]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:/\\S*)?$","i")};q.range=q.number;var r=function(a){var b=(""+a).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return b?Math.max(0,(b[1]?b[1].length:0)-(b[2]?+b[2]:0)):0};p.prototype={init:function(b,c){this.catalog=c,this.validators=a.extend({},this.validators);for(var d in b)this.addValidator(d,b[d].fn,b[d].priority);window.Parsley.trigger("parsley:validator:init")},setLocale:function(a){if("undefined"==typeof this.catalog[a])throw new Error(a+" is not available in the catalog");return this.locale=a,this},addCatalog:function(a,b,c){return"object"==typeof b&&(this.catalog[a]=b),!0===c?this.setLocale(a):this},addMessage:function(a,b,c){return"undefined"==typeof this.catalog[a]&&(this.catalog[a]={}),this.catalog[a][b]=c,this},addMessages:function(a,b){for(var c in b)this.addMessage(a,c,b[c]);return this},addValidator:function(a,b,c){if(this.validators[a])h.warn('Validator "'+a+'" is already defined.');else if(i.hasOwnProperty(a))return void h.warn('"'+a+'" is a restricted keyword and is not a valid validator name.');return this._setValidator.apply(this,arguments)},updateValidator:function(a,b,c){return this.validators[a]?this._setValidator.apply(this,arguments):(h.warn('Validator "'+a+'" is not already defined.'),this.addValidator.apply(this,arguments))},removeValidator:function(a){return this.validators[a]||h.warn('Validator "'+a+'" is not defined.'),delete this.validators[a],this},_setValidator:function(a,b,c){"object"!=typeof b&&(b={fn:b,priority:c}),b.validate||(b=new o(b)),this.validators[a]=b;for(var d in b.messages||{})this.addMessage(d,a,b.messages[d]);return this},getErrorMessage:function(a){var b;if("type"===a.name){var c=this.catalog[this.locale][a.name]||{};b=c[a.requirements]}else b=this.formatMessage(this.catalog[this.locale][a.name],a.requirements);return b||this.catalog[this.locale].defaultMessage||this.catalog.en.defaultMessage},formatMessage:function(a,b){if("object"==typeof b){for(var c in b)a=this.formatMessage(a,b[c]);return a}return"string"==typeof a?a.replace(/%s/i,b):""},validators:{notblank:{validateString:function(a){return/\S/.test(a)},priority:2},required:{validateMultiple:function(a){return a.length>0},validateString:function(a){return/\S/.test(a)},priority:512},type:{validateString:function(a,b){var c=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],d=c.step,e=void 0===d?"any":d,f=c.base,g=void 0===f?0:f,h=q[b];if(!h)throw new Error("validator type `"+b+"` is not supported");if(!h.test(a))return!1;if("number"===b&&!/^any$/i.test(e||"")){var i=Number(a),j=Math.max(r(e),r(g));if(r(i)>j)return!1;var k=function(a){return Math.round(a*Math.pow(10,j))};if((k(i)-k(g))%k(e)!=0)return!1}return!0},requirementType:{"":"string",step:"string",base:"number"},priority:256},pattern:{validateString:function(a,b){return b.test(a)},requirementType:"regexp",priority:64},minlength:{validateString:function(a,b){return a.length>=b},requirementType:"integer",priority:30},maxlength:{validateString:function(a,b){return a.length<=b},requirementType:"integer",priority:30},length:{validateString:function(a,b,c){return a.length>=b&&a.length<=c},requirementType:["integer","integer"],priority:30},mincheck:{validateMultiple:function(a,b){return a.length>=b},requirementType:"integer",priority:30},maxcheck:{validateMultiple:function(a,b){return a.length<=b},requirementType:"integer",priority:30},check:{validateMultiple:function(a,b,c){return a.length>=b&&a.length<=c},requirementType:["integer","integer"],priority:30},min:{validateNumber:function(a,b){return a>=b},requirementType:"number",priority:30},max:{validateNumber:function(a,b){return a<=b},requirementType:"number",priority:30},range:{validateNumber:function(a,b,c){return a>=b&&a<=c},requirementType:["number","number"],priority:30},equalto:{validateString:function(b,c){var d=a(c);return d.length?b===d.val():b===c},priority:256}}};var s={},t=function a(b,c,d){for(var e=[],f=[],g=0;g<b.length;g++){for(var h=!1,i=0;i<c.length;i++)if(b[g].assert.name===c[i].assert.name){h=!0;break}h?f.push(b[g]):e.push(b[g])}return{kept:f,added:e,removed:d?[]:a(c,b,!0).added}};s.Form={_actualizeTriggers:function(){var a=this;this.$element.on("submit.Parsley",function(b){a.onSubmitValidate(b)}),this.$element.on("click.Parsley",h._SubmitSelector,function(b){a.onSubmitButton(b)}),!1!==this.options.uiEnabled&&this.$element.attr("novalidate","")},focus:function(){if(this._focusedField=null,!0===this.validationResult||"none"===this.options.focus)return null;for(var a=0;a<this.fields.length;a++){var b=this.fields[a];if(!0!==b.validationResult&&b.validationResult.length>0&&"undefined"==typeof b.options.noFocus&&(this._focusedField=b.$element,"first"===this.options.focus))break}return null===this._focusedField?null:this._focusedField.focus()},_destroyUI:function(){this.$element.off(".Parsley")}},s.Field={_reflowUI:function(){if(this._buildUI(),this._ui){var a=t(this.validationResult,this._ui.lastValidationResult);this._ui.lastValidationResult=this.validationResult,this._manageStatusClass(),this._manageErrorsMessages(a),this._actualizeTriggers(),!a.kept.length&&!a.added.length||this._failedOnce||(this._failedOnce=!0,this._actualizeTriggers())}},getErrorsMessages:function(){if(!0===this.validationResult)return[];for(var a=[],b=0;b<this.validationResult.length;b++)a.push(this.validationResult[b].errorMessage||this._getErrorMessage(this.validationResult[b].assert));return a},addError:function(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=b.message,d=b.assert,e=b.updateClass,f=void 0===e||e;this._buildUI(),this._addError(a,{message:c,assert:d}),f&&this._errorClass()},updateError:function(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=b.message,d=b.assert,e=b.updateClass,f=void 0===e||e;this._buildUI(),this._updateError(a,{message:c,assert:d}),f&&this._errorClass()},removeError:function(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],c=b.updateClass,d=void 0===c||c;this._buildUI(),this._removeError(a),d&&this._manageStatusClass()},_manageStatusClass:function(){this.hasConstraints()&&this.needsValidation()&&!0===this.validationResult?this._successClass():this.validationResult.length>0?this._errorClass():this._resetClass()},_manageErrorsMessages:function(b){if("undefined"==typeof this.options.errorsMessagesDisabled){if("undefined"!=typeof this.options.errorMessage)return b.added.length||b.kept.length?(this._insertErrorWrapper(),0===this._ui.$errorsWrapper.find(".parsley-custom-error-message").length&&this._ui.$errorsWrapper.append(a(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 c=0;c<b.removed.length;c++)this._removeError(b.removed[c].assert.name);for(c=0;c<b.added.length;c++)this._addError(b.added[c].assert.name,{message:b.added[c].errorMessage,assert:b.added[c].assert});for(c=0;c<b.kept.length;c++)this._updateError(b.kept[c].assert.name,{message:b.kept[c].errorMessage,assert:b.kept[c].assert})}},_addError:function(b,c){var d=c.message,e=c.assert;this._insertErrorWrapper(),this._ui.$errorsWrapper.addClass("filled").append(a(this.options.errorTemplate).addClass("parsley-"+b).html(d||this._getErrorMessage(e)))},_updateError:function(a,b){var c=b.message,d=b.assert;this._ui.$errorsWrapper.addClass("filled").find(".parsley-"+a).html(c||this._getErrorMessage(d))},_removeError:function(a){this._ui.$errorsWrapper.removeClass("filled").find(".parsley-"+a).remove()},_getErrorMessage:function(a){var b=a.name+"Message";return"undefined"!=typeof this.options[b]?window.Parsley.formatMessage(this.options[b],a.requirements):window.Parsley.getErrorMessage(a)},_buildUI:function(){if(!this._ui&&!1!==this.options.uiEnabled){var b={};this.$element.attr(this.options.namespace+"id",this.__id__),b.$errorClassHandler=this._manageClassHandler(),b.errorsWrapperId="parsley-id-"+(this.options.multiple?"multiple-"+this.options.multiple:this.__id__),b.$errorsWrapper=a(this.options.errorsWrapper).attr("id",b.errorsWrapperId),b.lastValidationResult=[],b.validationInformationVisible=!1,this._ui=b}},_manageClassHandler:function(){if("string"==typeof this.options.classHandler&&a(this.options.classHandler).length)return a(this.options.classHandler);var b=this.options.classHandler.call(this,this);return"undefined"!=typeof b&&b.length?b:this._inputHolder()},_inputHolder:function(){return!this.options.multiple||this.$element.is("select")?this.$element:this.$element.parent()},_insertErrorWrapper:function(){var b;if(0!==this._ui.$errorsWrapper.parent().length)return this._ui.$errorsWrapper.parent();if("string"==typeof this.options.errorsContainer){if(a(this.options.errorsContainer).length)return a(this.options.errorsContainer).append(this._ui.$errorsWrapper);h.warn("The errors container `"+this.options.errorsContainer+"` does not exist in DOM")}else"function"==typeof this.options.errorsContainer&&(b=this.options.errorsContainer.call(this,this));return"undefined"!=typeof b&&b.length?b.append(this._ui.$errorsWrapper):this._inputHolder().after(this._ui.$errorsWrapper)},_actualizeTriggers:function(){var a,b=this,c=this._findRelated();c.off(".Parsley"),this._failedOnce?c.on(h.namespaceEvents(this.options.triggerAfterFailure,"Parsley"),function(){b._validateIfNeeded()}):(a=h.namespaceEvents(this.options.trigger,"Parsley"))&&c.on(a,function(a){b._validateIfNeeded(a)})},_validateIfNeeded:function(a){var b=this;a&&/key|input/.test(a.type)&&(!this._ui||!this._ui.validationInformationVisible)&&this.getValue().length<=this.options.validationThreshold||(this.options.debounce?(window.clearTimeout(this._debounced),this._debounced=window.setTimeout(function(){return b.validate()},this.options.debounce)):this.validate())},_resetUI:function(){this._failedOnce=!1,this._actualizeTriggers(),"undefined"!=typeof this._ui&&(this._ui.$errorsWrapper.removeClass("filled").children().remove(),this._resetClass(),this._ui.lastValidationResult=[],this._ui.validationInformationVisible=!1)},_destroyUI:function(){this._resetUI(),"undefined"!=typeof this._ui&&this._ui.$errorsWrapper.remove(),delete this._ui},_successClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass); 
    22},_errorClass:function(){this._ui.validationInformationVisible=!0,this._ui.$errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass)},_resetClass:function(){this._ui.$errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass)}};var u=function(b,c,d){this.__class__="ParsleyForm",this.$element=a(b),this.domOptions=c,this.options=d,this.parent=window.Parsley,this.fields=[],this.validationResult=null},v={pending:null,resolved:!0,rejected:!1};u.prototype={onSubmitValidate:function(a){var b=this;if(!0!==a.parsley){var c=this._$submitSource||this.$element.find(h._SubmitSelector).first();if(this._$submitSource=null,this.$element.find(".parsley-synthetic-submit-button").prop("disabled",!0),!c.is("[formnovalidate]")){var d=this.whenValidate({event:a});"resolved"===d.state()&&!1!==this._trigger("submit")||(a.stopImmediatePropagation(),a.preventDefault(),"pending"===d.state()&&d.done(function(){b._submit(c)}))}}},onSubmitButton:function(b){this._$submitSource=a(b.currentTarget)},_submit:function(b){if(!1!==this._trigger("submit")){if(b){var c=this.$element.find(".parsley-synthetic-submit-button").prop("disabled",!1);0===c.length&&(c=a('<input class="parsley-synthetic-submit-button" type="hidden">').appendTo(this.$element)),c.attr({name:b.attr("name"),value:b.attr("value")})}this.$element.trigger(a.extend(a.Event("submit"),{parsley:!0}))}},validate:function(b){if(arguments.length>=1&&!a.isPlainObject(b)){h.warnOnce("Calling validate on a parsley form without passing arguments as an object is deprecated.");var c=_slice.call(arguments),d=c[0],e=c[1],f=c[2];b={group:d,force:e,event:f}}return v[this.whenValidate(b).state()]},whenValidate:function(){var b,c=this,d=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=d.group,f=d.force,g=d.event;this.submitEvent=g,g&&(this.submitEvent=a.extend({},g,{preventDefault:function(){h.warnOnce("Using `this.submitEvent.preventDefault()` is deprecated; instead, call `this.validationResult = false`"),c.validationResult=!1}})),this.validationResult=!0,this._trigger("validate"),this._refreshFields();var i=this._withoutReactualizingFormOptions(function(){return a.map(c.fields,function(a){return a.whenValidate({force:f,group:e})})});return(b=h.all(i).done(function(){c._trigger("success")}).fail(function(){c.validationResult=!1,c.focus(),c._trigger("error")}).always(function(){c._trigger("validated")})).pipe.apply(b,_toConsumableArray(this._pipeAccordingToValidationResult()))},isValid:function(b){if(arguments.length>=1&&!a.isPlainObject(b)){h.warnOnce("Calling isValid on a parsley form without passing arguments as an object is deprecated.");var c=_slice.call(arguments),d=c[0],e=c[1];b={group:d,force:e}}return v[this.whenValid(b).state()]},whenValid:function(){var b=this,c=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],d=c.group,e=c.force;this._refreshFields();var f=this._withoutReactualizingFormOptions(function(){return a.map(b.fields,function(a){return a.whenValid({group:d,force:e})})});return h.all(f)},_refreshFields:function(){return this.actualizeOptions()._bindFields()},_bindFields:function(){var b=this,c=this.fields;return this.fields=[],this.fieldsMappedById={},this._withoutReactualizingFormOptions(function(){b.$element.find(b.options.inputs).not(b.options.excluded).each(function(a,c){var d=new window.Parsley.Factory(c,{},b);"ParsleyField"!==d.__class__&&"ParsleyFieldMultiple"!==d.__class__||!0===d.options.excluded||"undefined"==typeof b.fieldsMappedById[d.__class__+"-"+d.__id__]&&(b.fieldsMappedById[d.__class__+"-"+d.__id__]=d,b.fields.push(d))}),a.each(h.difference(c,b.fields),function(a,b){b._trigger("reset")})}),this},_withoutReactualizingFormOptions:function(a){var b=this.actualizeOptions;this.actualizeOptions=function(){return this};var c=a();return this.actualizeOptions=b,c},_trigger:function(a){return this.trigger("form:"+a)}};var w=function(b,c,d,e,f){if(!/ParsleyField/.test(b.__class__))throw new Error("ParsleyField or ParsleyFieldMultiple instance expected");var g=window.Parsley._validatorRegistry.validators[c],h=new o(g);a.extend(this,{validator:h,name:c,requirements:d,priority:e||b.options[c+"Priority"]||h.priority,isDomConstraint:!0===f}),this._parseRequirements(b.options)},x=function(a){var b=a[0].toUpperCase();return b+a.slice(1)};w.prototype={validate:function(a,b){var c;return(c=this.validator).validate.apply(c,[a].concat(_toConsumableArray(this.requirementList),[b]))},_parseRequirements:function(a){var b=this;this.requirementList=this.validator.parseRequirements(this.requirements,function(c){return a[b.name+x(c)]})}};var y=function(b,c,d,e){this.__class__="ParsleyField",this.$element=a(b),"undefined"!=typeof e&&(this.parent=e),this.options=d,this.domOptions=c,this.constraints=[],this.constraintsByName={},this.validationResult=!0,this._bindConstraints()},z={pending:null,resolved:!0,rejected:!1};y.prototype={validate:function(b){arguments.length>=1&&!a.isPlainObject(b)&&(h.warnOnce("Calling validate on a parsley field without passing arguments as an object is deprecated."),b={options:b});var c=this.whenValidate(b);if(!c)return!0;switch(c.state()){case"pending":return null;case"resolved":return!0;case"rejected":return this.validationResult}},whenValidate:function(){var a,b=this,c=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],d=c.force,e=c.group;if(this.refreshConstraints(),!e||this._isInGroup(e))return this.value=this.getValue(),this._trigger("validate"),(a=this.whenValid({force:d,value:this.value,_refreshed:!0}).always(function(){b._reflowUI()}).done(function(){b._trigger("success")}).fail(function(){b._trigger("error")}).always(function(){b._trigger("validated")})).pipe.apply(a,_toConsumableArray(this._pipeAccordingToValidationResult()))},hasConstraints:function(){return 0!==this.constraints.length},needsValidation:function(a){return"undefined"==typeof a&&(a=this.getValue()),!(!a.length&&!this._isRequired()&&"undefined"==typeof this.options.validateIfEmpty)},_isInGroup:function(b){return a.isArray(this.options.group)?-1!==a.inArray(b,this.options.group):this.options.group===b},isValid:function(b){if(arguments.length>=1&&!a.isPlainObject(b)){h.warnOnce("Calling isValid on a parsley field without passing arguments as an object is deprecated.");var c=_slice.call(arguments),d=c[0],e=c[1];b={force:d,value:e}}var f=this.whenValid(b);return!f||z[f.state()]},whenValid:function(){var b=this,c=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],d=c.force,e=void 0!==d&&d,f=c.value,g=c.group,i=c._refreshed;if(i||this.refreshConstraints(),!g||this._isInGroup(g)){if(this.validationResult=!0,!this.hasConstraints())return a.when();if("undefined"!=typeof f&&null!==f||(f=this.getValue()),!this.needsValidation(f)&&!0!==e)return a.when();var j=this._getGroupedConstraints(),k=[];return a.each(j,function(c,d){var e=h.all(a.map(d,function(a){return b._validateConstraint(f,a)}));if(k.push(e),"rejected"===e.state())return!1}),h.all(k)}},_validateConstraint:function(b,c){var d=this,e=c.validate(b,this);return!1===e&&(e=a.Deferred().reject()),h.all([e]).fail(function(a){d.validationResult instanceof Array||(d.validationResult=[]),d.validationResult.push({assert:c,errorMessage:"string"==typeof a&&a})})},getValue:function(){var a;return a="function"==typeof this.options.value?this.options.value(this):"undefined"!=typeof this.options.value?this.options.value:this.$element.val(),"undefined"==typeof a||null===a?"":this._handleWhitespace(a)},refreshConstraints:function(){return this.actualizeOptions()._bindConstraints()},addConstraint:function(a,b,c,d){if(window.Parsley._validatorRegistry.validators[a]){var e=new w(this,a,b,c,d);"undefined"!==this.constraintsByName[e.name]&&this.removeConstraint(e.name),this.constraints.push(e),this.constraintsByName[e.name]=e}return this},removeConstraint:function(a){for(var b=0;b<this.constraints.length;b++)if(a===this.constraints[b].name){this.constraints.splice(b,1);break}return delete this.constraintsByName[a],this},updateConstraint:function(a,b,c){return this.removeConstraint(a).addConstraint(a,b,c)},_bindConstraints:function(){for(var a=[],b={},c=0;c<this.constraints.length;c++)!1===this.constraints[c].isDomConstraint&&(a.push(this.constraints[c]),b[this.constraints[c].name]=this.constraints[c]);this.constraints=a,this.constraintsByName=b;for(var d in this.options)this.addConstraint(d,this.options[d],void 0,!0);return this._bindHtml5Constraints()},_bindHtml5Constraints:function(){this.$element.attr("required")&&this.addConstraint("required",!0,void 0,!0),"string"==typeof this.$element.attr("pattern")&&this.addConstraint("pattern",this.$element.attr("pattern"),void 0,!0),"undefined"!=typeof this.$element.attr("min")&&"undefined"!=typeof this.$element.attr("max")?this.addConstraint("range",[this.$element.attr("min"),this.$element.attr("max")],void 0,!0):"undefined"!=typeof this.$element.attr("min")?this.addConstraint("min",this.$element.attr("min"),void 0,!0):"undefined"!=typeof this.$element.attr("max")&&this.addConstraint("max",this.$element.attr("max"),void 0,!0),"undefined"!=typeof this.$element.attr("minlength")&&"undefined"!=typeof this.$element.attr("maxlength")?this.addConstraint("length",[this.$element.attr("minlength"),this.$element.attr("maxlength")],void 0,!0):"undefined"!=typeof this.$element.attr("minlength")?this.addConstraint("minlength",this.$element.attr("minlength"),void 0,!0):"undefined"!=typeof this.$element.attr("maxlength")&&this.addConstraint("maxlength",this.$element.attr("maxlength"),void 0,!0);var a=this.$element.attr("type");return"undefined"==typeof a?this:"number"===a?this.addConstraint("type",["number",{step:this.$element.attr("step")||"1",base:this.$element.attr("min")||this.$element.attr("value")}],void 0,!0):/^(email|url|range)$/i.test(a)?this.addConstraint("type",a,void 0,!0):this},_isRequired:function(){return"undefined"!=typeof this.constraintsByName.required&&!1!==this.constraintsByName.required.requirements},_trigger:function(a){return this.trigger("field:"+a)},_handleWhitespace:function(a){return!0===this.options.trimValue&&h.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"'),"squish"===this.options.whitespace&&(a=a.replace(/\s{2,}/g," ")),"trim"!==this.options.whitespace&&"squish"!==this.options.whitespace&&!0!==this.options.trimValue||(a=h.trimString(a)),a},_getGroupedConstraints:function(){if(!1===this.options.priorityEnabled)return[this.constraints];for(var a=[],b={},c=0;c<this.constraints.length;c++){var d=this.constraints[c].priority;b[d]||a.push(b[d]=[]),b[d].push(this.constraints[c])}return a.sort(function(a,b){return b[0].priority-a[0].priority}),a}};var A=y,B=function(){this.__class__="ParsleyFieldMultiple"};B.prototype={addElement:function(a){return this.$elements.push(a),this},refreshConstraints:function(){var b;if(this.constraints=[],this.$element.is("select"))return this.actualizeOptions()._bindConstraints(),this;for(var c=0;c<this.$elements.length;c++)if(a("html").has(this.$elements[c]).length){b=this.$elements[c].data("ParsleyFieldMultiple").refreshConstraints().constraints;for(var d=0;d<b.length;d++)this.addConstraint(b[d].name,b[d].requirements,b[d].priority,b[d].isDomConstraint)}else this.$elements.splice(c,1);return this},getValue:function(){if("function"==typeof this.options.value)return this.options.value(this);if("undefined"!=typeof this.options.value)return this.options.value;if(this.$element.is("input[type=radio]"))return this._findRelated().filter(":checked").val()||"";if(this.$element.is("input[type=checkbox]")){var b=[];return this._findRelated().filter(":checked").each(function(){b.push(a(this).val())}),b}return this.$element.is("select")&&null===this.$element.val()?[]:this.$element.val()},_init:function(){return this.$elements=[this.$element],this}};var C=function(b,c,d){this.$element=a(b);var e=this.$element.data("Parsley");if(e)return"undefined"!=typeof d&&e.parent===window.Parsley&&(e.parent=d,e._resetOptions(e.options)),"object"==typeof c&&a.extend(e.options,c),e;if(!this.$element.length)throw new Error("You must bind Parsley on an existing element.");if("undefined"!=typeof d&&"ParsleyForm"!==d.__class__)throw new Error("Parent instance must be a ParsleyForm instance");return this.parent=d||window.Parsley,this.init(c)};C.prototype={init:function(a){return this.__class__="Parsley",this.__version__="2.6.0",this.__id__=h.generateID(),this._resetOptions(a),this.$element.is("form")||h.checkAttr(this.$element,this.options.namespace,"validate")&&!this.$element.is(this.options.inputs)?this.bind("parsleyForm"):this.isMultiple()?this.handleMultiple():this.bind("parsleyField")},isMultiple:function(){return this.$element.is("input[type=radio], input[type=checkbox]")||this.$element.is("select")&&"undefined"!=typeof this.$element.attr("multiple")},handleMultiple:function(){var b,c,d=this;if(this.options.multiple||("undefined"!=typeof this.$element.attr("name")&&this.$element.attr("name").length?this.options.multiple=b=this.$element.attr("name"):"undefined"!=typeof this.$element.attr("id")&&this.$element.attr("id").length&&(this.options.multiple=this.$element.attr("id"))),this.$element.is("select")&&"undefined"!=typeof this.$element.attr("multiple"))return this.options.multiple=this.options.multiple||this.__id__,this.bind("parsleyFieldMultiple");if(!this.options.multiple)return h.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),this;this.options.multiple=this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g,""),"undefined"!=typeof b&&a('input[name="'+b+'"]').each(function(b,c){a(c).is("input[type=radio], input[type=checkbox]")&&a(c).attr(d.options.namespace+"multiple",d.options.multiple)});for(var e=this._findRelated(),f=0;f<e.length;f++)if(c=a(e.get(f)).data("Parsley"),"undefined"!=typeof c){this.$element.data("ParsleyFieldMultiple")||c.addElement(this.$element);break}return this.bind("parsleyField",!0),c||this.bind("parsleyFieldMultiple")},bind:function(b,c){var d;switch(b){case"parsleyForm":d=a.extend(new u(this.$element,this.domOptions,this.options),new j,window.ParsleyExtend)._bindFields();break;case"parsleyField":d=a.extend(new A(this.$element,this.domOptions,this.options,this.parent),new j,window.ParsleyExtend);break;case"parsleyFieldMultiple":d=a.extend(new A(this.$element,this.domOptions,this.options,this.parent),new B,new j,window.ParsleyExtend)._init();break;default:throw new Error(b+"is not a supported Parsley type")}return this.options.multiple&&h.setAttr(this.$element,this.options.namespace,"multiple",this.options.multiple),"undefined"!=typeof c?(this.$element.data("ParsleyFieldMultiple",d),d):(this.$element.data("Parsley",d),d._actualizeTriggers(),d._trigger("init"),d)}};var D=a.fn.jquery.split(".");if(parseInt(D[0])<=1&&parseInt(D[1])<8)throw"The loaded version of jQuery is too old. Please upgrade to 1.8.x or better.";D.forEach||h.warn("Parsley requires ES5 to run properly. Please include https://github.com/es-shims/es5-shim");var E=a.extend(new j,{$element:a(document),actualizeOptions:null,_resetOptions:null,Factory:C,version:"2.6.0"});a.extend(A.prototype,s.Field,j.prototype),a.extend(u.prototype,s.Form,j.prototype),a.extend(C.prototype,j.prototype),a.fn.parsley=a.fn.psly=function(b){if(this.length>1){var c=[];return this.each(function(){c.push(a(this).parsley(b))}),c}return a(this).length?new C(this,b):void h.warn("You must bind Parsley on an existing element.")},"undefined"==typeof window.ParsleyExtend&&(window.ParsleyExtend={}),E.options=a.extend(h.objectCreate(i),window.ParsleyConfig),window.ParsleyConfig=E.options,window.Parsley=window.psly=E,window.ParsleyUtils=h;var F=window.Parsley._validatorRegistry=new p(window.ParsleyConfig.validators,window.ParsleyConfig.i18n);window.ParsleyValidator={},a.each("setLocale addCatalog addMessage addMessages getErrorMessage formatMessage addValidator updateValidator removeValidator".split(" "),function(b,c){window.Parsley[c]=a.proxy(F,c),window.ParsleyValidator[c]=function(){var a;return h.warnOnce("Accessing the method '"+c+"' through ParsleyValidator is deprecated. Simply call 'window.Parsley."+c+"(...)'"),(a=window.Parsley)[c].apply(a,arguments)}}),window.Parsley.UI=s,window.ParsleyUI={removeError:function(a,b,c){var d=!0!==c;return h.warnOnce("Accessing ParsleyUI is deprecated. Call 'removeError' on the instance directly. Please comment in issue 1073 as to your need to call this method."),a.removeError(b,{updateClass:d})},getErrorsMessages:function(a){return h.warnOnce("Accessing ParsleyUI is deprecated. Call 'getErrorsMessages' on the instance directly."),a.getErrorsMessages()}},a.each("addError updateError".split(" "),function(a,b){window.ParsleyUI[b]=function(a,c,d,e,f){var g=!0!==f;return h.warnOnce("Accessing ParsleyUI is deprecated. Call '"+b+"' on the instance directly. Please comment in issue 1073 as to your need to call this method."),a[b](c,{message:d,assert:e,updateClass:g})}}),!1!==window.ParsleyConfig.autoBind&&a(function(){a("[data-parsley-validate]").length&&a("[data-parsley-validate]").parsley()});var G=a({}),H=function(){h.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley")},I="parsley:";a.listen=function(a,d){var e;if(H(),"object"==typeof arguments[1]&&"function"==typeof arguments[2]&&(e=arguments[1],d=arguments[2]),"function"!=typeof d)throw new Error("Wrong parameters");window.Parsley.on(c(a),b(d,e))},a.listenTo=function(a,d,e){if(H(),!(a instanceof A||a instanceof u))throw new Error("Must give Parsley instance");if("string"!=typeof d||"function"!=typeof e)throw new Error("Wrong parameters");a.on(c(d),b(e))},a.unsubscribe=function(a,b){if(H(),"string"!=typeof a||"function"!=typeof b)throw new Error("Wrong arguments");window.Parsley.off(c(a),b.parsleyAdaptedCallback)},a.unsubscribeTo=function(a,b){if(H(),!(a instanceof A||a instanceof u))throw new Error("Must give Parsley instance");a.off(c(b))},a.unsubscribeAll=function(b){H(),window.Parsley.off(c(b)),a("form,input,textarea,select").each(function(){var d=a(this).data("Parsley");d&&d.off(c(b))})},a.emit=function(a,b){var d;H();var e=b instanceof A||b instanceof u,f=Array.prototype.slice.call(arguments,e?2:1);f.unshift(c(a)),e||(b=window.Parsley),(d=b).trigger.apply(d,_toConsumableArray(f))};a.extend(!0,E,{asyncValidators:{default:{fn:function(a){return a.status>=200&&a.status<300},url:!1},reverse:{fn:function(a){return a.status<200||a.status>=300},url:!1}},addAsyncValidator:function(a,b,c,d){return E.asyncValidators[a]={fn:b,url:c||!1,options:d||{}},this}}),E.addValidator("remote",{requirementType:{"":"string",validator:"string",reverse:"boolean",options:"object"},validateString:function(b,c,d,e){var f,g,h={},i=d.validator||(!0===d.reverse?"reverse":"default");if("undefined"==typeof E.asyncValidators[i])throw new Error("Calling an undefined async validator: `"+i+"`");c=E.asyncValidators[i].url||c,c.indexOf("{value}")>-1?c=c.replace("{value}",encodeURIComponent(b)):h[e.$element.attr("name")||e.$element.attr("id")]=b;var j=a.extend(!0,d.options||{},E.asyncValidators[i].options);f=a.extend(!0,{},{url:c,data:h,type:"GET"},j),e.trigger("field:ajaxoptions",e,f),g=a.param(f),"undefined"==typeof E._remoteCache&&(E._remoteCache={});var k=E._remoteCache[g]=E._remoteCache[g]||a.ajax(f),l=function(){var b=E.asyncValidators[i].fn.call(e,k,c,d);return b||(b=a.Deferred().reject()),a.when(b)};return k.then(l,l)},priority:-1}),E.on("form:submit",function(){E._remoteCache={}}),window.ParsleyExtend.addAsyncValidator=function(){return ParsleyUtils.warnOnce("Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `Parsley.addAsyncValidator(...)`"),E.addAsyncValidator.apply(E,arguments)},E.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."}),E.setLocale("en");var J=new d;J.install();var K=E;return K}),!function(a,b,c){function d(a,b){return typeof a===b}function e(){var a,b,c,e,f,g,j;for(var l in i)if(i.hasOwnProperty(l)){if(a=[],b=i[l],b.name&&(a.push(b.name.toLowerCase()),b.options&&b.options.aliases&&b.options.aliases.length))for(c=0;c<b.options.aliases.length;c++)a.push(b.options.aliases[c].toLowerCase());for(e=d(b.fn,"function")?b.fn():b.fn,f=0;f<a.length;f++)g=a[f],j=g.split("."),1===j.length?k[j[0]]=e:(!k[j[0]]||k[j[0]]instanceof Boolean||(k[j[0]]=new Boolean(k[j[0]])),k[j[0]][j[1]]=e),h.push((e?"":"no-")+j.join("-"))}}function f(a){var b=l.className,c=k._config.classPrefix||"";if(m&&(b=b.baseVal),k._config.enableJSClass){var d=new RegExp("(^|\\s)"+c+"no-js(\\s|$)");b=b.replace(d,"$1"+c+"js$2")}k._config.enableClasses&&(b+=" "+c+a.join(" "+c),m?l.className.baseVal=b:l.className=b)}function g(){return"function"!=typeof b.createElement?b.createElement(arguments[0]):m?b.createElementNS.call(b,"http://www.w3.org/2000/svg",arguments[0]):b.createElement.apply(b,arguments)}var h=[],i=[],j={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(a,b){var c=this;setTimeout(function(){b(c[a])},0)},addTest:function(a,b,c){i.push({name:a,fn:b,options:c})},addAsyncTest:function(a){i.push({name:null,fn:a})}},k=function(){};k.prototype=j,k=new k;var l=b.documentElement,m="svg"===l.nodeName.toLowerCase(),n=g("input"),o="search tel url email datetime date month week time datetime-local number range color".split(" "),p={};k.inputtypes=function(a){for(var d,e,f,g=a.length,h="1)",i=0;g>i;i++)n.setAttribute("type",d=a[i]),f="text"!==n.type&&"style"in n,f&&(n.value=h,n.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(d)&&n.style.WebkitAppearance!==c?(l.appendChild(n),e=b.defaultView,f=e.getComputedStyle&&"textfield"!==e.getComputedStyle(n,null).WebkitAppearance&&0!==n.offsetHeight,l.removeChild(n)):/^(search|tel)$/.test(d)||(f=/^(url|email)$/.test(d)?n.checkValidity&&n.checkValidity()===!1:n.value!=h)),p[a[i]]=!!f;return p}(o),e(),f(h),delete j.addTest,delete j.addAsyncTest;for(var q=0;q<k._q.length;q++)k._q[q]();a.Modernizr=k}(window,document),function(a,b){"use strict";var c;if("object"==typeof exports){try{c=require("moment")}catch(a){}module.exports=b(c)}else"function"==typeof define&&define.amd?define(function(a){var d="moment";try{c=a(d)}catch(a){}return b(c)}):a.Pikaday=b(a.moment)}(this,function(a){"use strict";var b="function"==typeof a,c=!!window.addEventListener,d=window.document,e=window.setTimeout,f=function(a,b,d,e){c?a.addEventListener(b,d,!!e):a.attachEvent("on"+b,d)},g=function(a,b,d,e){c?a.removeEventListener(b,d,!!e):a.detachEvent("on"+b,d)},h=function(a,b,c){var e;d.createEvent?(e=d.createEvent("HTMLEvents"),e.initEvent(b,!0,!1),e=t(e,c),a.dispatchEvent(e)):d.createEventObject&&(e=d.createEventObject(),e=t(e,c),a.fireEvent("on"+b,e))},i=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},j=function(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")!==-1},k=function(a,b){j(a,b)||(a.className=""===a.className?b:a.className+" "+b)},l=function(a,b){a.className=i((" "+a.className+" ").replace(" "+b+" "," "))},m=function(a){return/Array/.test(Object.prototype.toString.call(a))},n=function(a){return/Date/.test(Object.prototype.toString.call(a))&&!isNaN(a.getTime())},o=function(a){var b=a.getDay();return 0===b||6===b},p=function(a){return a%4===0&&a%100!==0||a%400===0},q=function(a,b){return[31,p(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},r=function(a){n(a)&&a.setHours(0,0,0,0)},s=function(a,b){return a.getTime()===b.getTime()},t=function(a,b,c){var d,e;for(d in b)e=void 0!==a[d],e&&"object"==typeof b[d]&&null!==b[d]&&void 0===b[d].nodeName?n(b[d])?c&&(a[d]=new Date(b[d].getTime())):m(b[d])?c&&(a[d]=b[d].slice(0)):a[d]=t({},b[d],c):!c&&e||(a[d]=b[d]);return a},u=function(a){return a.month<0&&(a.year-=Math.ceil(Math.abs(a.month)/12),a.month+=12),a.month>11&&(a.year+=Math.floor(Math.abs(a.month)/12),a.month-=12),a},v={field:null,bound:void 0,position:"bottom left",reposition:!0,format:"YYYY-MM-DD",defaultDate:null,setDefaultDate:!1,firstDay:0,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,numberOfMonths:1,mainCalendar:"left",container:void 0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},theme:null,onSelect:null,onOpen:null,onClose:null,onDraw:null},w=function(a,b,c){for(b+=a.firstDay;b>=7;)b-=7;return c?a.i18n.weekdaysShort[b]:a.i18n.weekdays[b]},x=function(a){var b=[],c="false";if(a.isEmpty){if(!a.showDaysInNextAndPreviousMonths)return'<td class="is-empty"></td>';b.push("is-outside-current-month")}return a.isDisabled&&b.push("is-disabled"),a.isToday&&b.push("is-today"),a.isSelected&&(b.push("is-selected"),c="true"),a.isInRange&&b.push("is-inrange"),a.isStartRange&&b.push("is-startrange"),a.isEndRange&&b.push("is-endrange"),'<td data-day="'+a.day+'" class="'+b.join(" ")+'" aria-selected="'+c+'"><button class="pika-button pika-day" type="button" data-pika-year="'+a.year+'" data-pika-month="'+a.month+'" data-pika-day="'+a.day+'">'+a.day+"</button></td>"},y=function(a,b,c){var d=new Date(c,0,1),e=Math.ceil(((new Date(c,b,a)-d)/864e5+d.getDay()+1)/7);return'<td class="pika-week">'+e+"</td>"},z=function(a,b){return"<tr>"+(b?a.reverse():a).join("")+"</tr>"},A=function(a){return"<tbody>"+a.join("")+"</tbody>"},B=function(a){var b,c=[];for(a.showWeekNumber&&c.push("<th></th>"),b=0;b<7;b++)c.push('<th scope="col"><abbr title="'+w(a,b)+'">'+w(a,b,!0)+"</abbr></th>");return"<thead><tr>"+(a.isRTL?c.reverse():c).join("")+"</tr></thead>"},C=function(a,b,c,d,e,f){var g,h,i,j,k,l=a._o,n=c===l.minYear,o=c===l.maxYear,p='<div id="'+f+'" class="pika-title" role="heading" aria-live="assertive">',q=!0,r=!0;for(i=[],g=0;g<12;g++)i.push('<option value="'+(c===e?g-b:12+g-b)+'"'+(g===d?' selected="selected"':"")+(n&&g<l.minMonth||o&&g>l.maxMonth?'disabled="disabled"':"")+">"+l.i18n.months[g]+"</option>");for(j='<div class="pika-label">'+l.i18n.months[d]+'<select class="pika-select pika-select-month" tabindex="-1">'+i.join("")+"</select></div>",m(l.yearRange)?(g=l.yearRange[0],h=l.yearRange[1]+1):(g=c-l.yearRange,h=1+c+l.yearRange),i=[];g<h&&g<=l.maxYear;g++)g>=l.minYear&&i.push('<option value="'+g+'"'+(g===c?' selected="selected"':"")+">"+g+"</option>");return k='<div class="pika-label">'+c+l.yearSuffix+'<select class="pika-select pika-select-year" tabindex="-1">'+i.join("")+"</select></div>",p+=l.showMonthAfterYear?k+j:j+k,n&&(0===d||l.minMonth>=d)&&(q=!1),o&&(11===d||l.maxMonth<=d)&&(r=!1),0===b&&(p+='<button class="pika-prev'+(q?"":" is-disabled")+'" type="button">'+l.i18n.previousMonth+"</button>"),b===a._o.numberOfMonths-1&&(p+='<button class="pika-next'+(r?"":" is-disabled")+'" type="button">'+l.i18n.nextMonth+"</button>"),p+="</div>"},D=function(a,b,c){return'<table cellpadding="0" cellspacing="0" class="pika-table" role="grid" aria-labelledby="'+c+'">'+B(a)+A(b)+"</table>"},E=function(g){var h=this,i=h.config(g);h._onMouseDown=function(a){if(h._v){a=a||window.event;var b=a.target||a.srcElement;if(b)if(j(b,"is-disabled")||(!j(b,"pika-button")||j(b,"is-empty")||j(b.parentNode,"is-disabled")?j(b,"pika-prev")?h.prevMonth():j(b,"pika-next")&&h.nextMonth():(h.setDate(new Date(b.getAttribute("data-pika-year"),b.getAttribute("data-pika-month"),b.getAttribute("data-pika-day"))),i.bound&&e(function(){h.hide(),i.field&&i.field.blur()},100))),j(b,"pika-select"))h._c=!0;else{if(!a.preventDefault)return a.returnValue=!1,!1;a.preventDefault()}}},h._onChange=function(a){a=a||window.event;var b=a.target||a.srcElement;b&&(j(b,"pika-select-month")?h.gotoMonth(b.value):j(b,"pika-select-year")&&h.gotoYear(b.value))},h._onKeyChange=function(a){if(a=a||window.event,h.isVisible())switch(a.keyCode){case 13:case 27:i.field.blur();break;case 37:a.preventDefault(),h.adjustDate("subtract",1);break;case 38:h.adjustDate("subtract",7);break;case 39:h.adjustDate("add",1);break;case 40:h.adjustDate("add",7)}},h._onInputChange=function(c){var d;c.firedBy!==h&&(b?(d=a(i.field.value,i.format,i.formatStrict),d=d&&d.isValid()?d.toDate():null):d=new Date(Date.parse(i.field.value)),n(d)&&h.setDate(d),h._v||h.show())},h._onInputFocus=function(){h.show()},h._onInputClick=function(){h.show()},h._onInputBlur=function(){var a=d.activeElement;do if(j(a,"pika-single"))return;while(a=a.parentNode);h._c||(h._b=e(function(){h.hide()},50)),h._c=!1},h._onClick=function(a){a=a||window.event;var b=a.target||a.srcElement,d=b;if(b){!c&&j(b,"pika-select")&&(b.onchange||(b.setAttribute("onchange","return;"),f(b,"change",h._onChange)));do if(j(d,"pika-single")||d===i.trigger)return;while(d=d.parentNode);h._v&&b!==i.trigger&&d!==i.trigger&&h.hide()}},h.el=d.createElement("div"),h.el.className="pika-single"+(i.isRTL?" is-rtl":"")+(i.theme?" "+i.theme:""),f(h.el,"mousedown",h._onMouseDown,!0),f(h.el,"touchend",h._onMouseDown,!0),f(h.el,"change",h._onChange),f(d,"keydown",h._onKeyChange),i.field&&(i.container?i.container.appendChild(h.el):i.bound?d.body.appendChild(h.el):i.field.parentNode.insertBefore(h.el,i.field.nextSibling),f(i.field,"change",h._onInputChange),i.defaultDate||(b&&i.field.value?i.defaultDate=a(i.field.value,i.format).toDate():i.defaultDate=new Date(Date.parse(i.field.value)),i.setDefaultDate=!0));var k=i.defaultDate;n(k)?i.setDefaultDate?h.setDate(k,!0):h.gotoDate(k):h.gotoDate(new Date),i.bound?(this.hide(),h.el.className+=" is-bound",f(i.trigger,"click",h._onInputClick),f(i.trigger,"focus",h._onInputFocus),f(i.trigger,"blur",h._onInputBlur)):this.show()};return E.prototype={config:function(a){this._o||(this._o=t({},v,!0));var b=t(this._o,a,!0);b.isRTL=!!b.isRTL,b.field=b.field&&b.field.nodeName?b.field:null,b.theme="string"==typeof b.theme&&b.theme?b.theme:null,b.bound=!!(void 0!==b.bound?b.field&&b.bound:b.field),b.trigger=b.trigger&&b.trigger.nodeName?b.trigger:b.field,b.disableWeekends=!!b.disableWeekends,b.disableDayFn="function"==typeof b.disableDayFn?b.disableDayFn:null;var c=parseInt(b.numberOfMonths,10)||1;if(b.numberOfMonths=c>4?4:c,n(b.minDate)||(b.minDate=!1),n(b.maxDate)||(b.maxDate=!1),b.minDate&&b.maxDate&&b.maxDate<b.minDate&&(b.maxDate=b.minDate=!1),b.minDate&&this.setMinDate(b.minDate),b.maxDate&&this.setMaxDate(b.maxDate),m(b.yearRange)){var d=(new Date).getFullYear()-10;b.yearRange[0]=parseInt(b.yearRange[0],10)||d,b.yearRange[1]=parseInt(b.yearRange[1],10)||d}else b.yearRange=Math.abs(parseInt(b.yearRange,10))||v.yearRange,b.yearRange>100&&(b.yearRange=100);return b},toString:function(c){return n(this._d)?b?a(this._d).format(c||this._o.format):this._d.toDateString():""},getMoment:function(){return b?a(this._d):null},setMoment:function(c,d){b&&a.isMoment(c)&&this.setDate(c.toDate(),d); 
    3 },getDate:function(){return n(this._d)?new Date(this._d.getTime()):new Date},setDate:function(a,b){if(!a)return this._d=null,this._o.field&&(this._o.field.value="",h(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof a&&(a=new Date(Date.parse(a))),n(a)){var c=this._o.minDate,d=this._o.maxDate;n(c)&&a<c?a=c:n(d)&&a>d&&(a=d),this._d=new Date(a.getTime()),r(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),h(this._o.field,"change",{firedBy:this})),b||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(a){var b=!0;if(n(a)){if(this.calendars){var c=new Date(this.calendars[0].year,this.calendars[0].month,1),d=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),e=a.getTime();d.setMonth(d.getMonth()+1),d.setDate(d.getDate()-1),b=e<c.getTime()||d.getTime()<e}b&&(this.calendars=[{month:a.getMonth(),year:a.getFullYear()}],"right"===this._o.mainCalendar&&(this.calendars[0].month+=1-this._o.numberOfMonths)),this.adjustCalendars()}},adjustDate:function(c,d){var e,f=this.getDate(),g=24*parseInt(d)*60*60*1e3;"add"===c?e=new Date(f.valueOf()+g):"subtract"===c&&(e=new Date(f.valueOf()-g)),b&&("add"===c?e=a(f).add(d,"days").toDate():"subtract"===c&&(e=a(f).subtract(d,"days").toDate())),this.setDate(e)},adjustCalendars:function(){this.calendars[0]=u(this.calendars[0]);for(var a=1;a<this._o.numberOfMonths;a++)this.calendars[a]=u({month:this.calendars[0].month+a,year:this.calendars[0].year});this.draw()},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(a){isNaN(a)||(this.calendars[0].month=parseInt(a,10),this.adjustCalendars())},nextMonth:function(){this.calendars[0].month++,this.adjustCalendars()},prevMonth:function(){this.calendars[0].month--,this.adjustCalendars()},gotoYear:function(a){isNaN(a)||(this.calendars[0].year=parseInt(a,10),this.adjustCalendars())},setMinDate:function(a){a instanceof Date?(r(a),this._o.minDate=a,this._o.minYear=a.getFullYear(),this._o.minMonth=a.getMonth()):(this._o.minDate=v.minDate,this._o.minYear=v.minYear,this._o.minMonth=v.minMonth,this._o.startRange=v.startRange),this.draw()},setMaxDate:function(a){a instanceof Date?(r(a),this._o.maxDate=a,this._o.maxYear=a.getFullYear(),this._o.maxMonth=a.getMonth()):(this._o.maxDate=v.maxDate,this._o.maxYear=v.maxYear,this._o.maxMonth=v.maxMonth,this._o.endRange=v.endRange),this.draw()},setStartRange:function(a){this._o.startRange=a},setEndRange:function(a){this._o.endRange=a},draw:function(a){if(this._v||a){var b,c=this._o,d=c.minYear,f=c.maxYear,g=c.minMonth,h=c.maxMonth,i="";this._y<=d&&(this._y=d,!isNaN(g)&&this._m<g&&(this._m=g)),this._y>=f&&(this._y=f,!isNaN(h)&&this._m>h&&(this._m=h)),b="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var j=0;j<c.numberOfMonths;j++)i+='<div class="pika-lendar">'+C(this,j,this.calendars[j].year,this.calendars[j].month,this.calendars[0].year,b)+this.render(this.calendars[j].year,this.calendars[j].month,b)+"</div>";this.el.innerHTML=i,c.bound&&"hidden"!==c.field.type&&e(function(){c.trigger.focus()},1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),this._o.field.setAttribute("aria-label","Use the arrow keys to pick a date")}},adjustPosition:function(){var a,b,c,e,f,g,h,i,j,k;if(!this._o.container){if(this.el.style.position="absolute",a=this._o.trigger,b=a,c=this.el.offsetWidth,e=this.el.offsetHeight,f=window.innerWidth||d.documentElement.clientWidth,g=window.innerHeight||d.documentElement.clientHeight,h=window.pageYOffset||d.body.scrollTop||d.documentElement.scrollTop,"function"==typeof a.getBoundingClientRect)k=a.getBoundingClientRect(),i=k.left+window.pageXOffset,j=k.bottom+window.pageYOffset;else for(i=b.offsetLeft,j=b.offsetTop+b.offsetHeight;b=b.offsetParent;)i+=b.offsetLeft,j+=b.offsetTop;(this._o.reposition&&i+c>f||this._o.position.indexOf("right")>-1&&i-c+a.offsetWidth>0)&&(i=i-c+a.offsetWidth),(this._o.reposition&&j+e>g+h||this._o.position.indexOf("top")>-1&&j-e-a.offsetHeight>0)&&(j=j-e-a.offsetHeight),this.el.style.left=i+"px",this.el.style.top=j+"px"}},render:function(a,b,c){var d=this._o,e=new Date,f=q(a,b),g=new Date(a,b,1).getDay(),h=[],i=[];r(e),d.firstDay>0&&(g-=d.firstDay,g<0&&(g+=7));for(var j=0===b?11:b-1,k=11===b?0:b+1,l=0===b?a-1:a,m=11===b?a+1:a,p=q(l,j),t=f+g,u=t;u>7;)u-=7;t+=7-u;for(var v=0,w=0;v<t;v++){var A=new Date(a,b,1+(v-g)),B=!!n(this._d)&&s(A,this._d),C=s(A,e),E=v<g||v>=f+g,F=1+(v-g),G=b,H=a,I=d.startRange&&s(d.startRange,A),J=d.endRange&&s(d.endRange,A),K=d.startRange&&d.endRange&&d.startRange<A&&A<d.endRange,L=d.minDate&&A<d.minDate||d.maxDate&&A>d.maxDate||d.disableWeekends&&o(A)||d.disableDayFn&&d.disableDayFn(A);E&&(v<g?(F=p+F,G=j,H=l):(F-=f,G=k,H=m));var M={day:F,month:G,year:H,isSelected:B,isToday:C,isDisabled:L,isEmpty:E,isStartRange:I,isEndRange:J,isInRange:K,showDaysInNextAndPreviousMonths:d.showDaysInNextAndPreviousMonths};i.push(x(M)),7===++w&&(d.showWeekNumber&&i.unshift(y(v-g,b,a)),h.push(z(i,d.isRTL)),i=[],w=0)}return D(d,h,c)},isVisible:function(){return this._v},show:function(){this.isVisible()||(l(this.el,"is-hidden"),this._v=!0,this.draw(),this._o.bound&&(f(d,"click",this._onClick),this.adjustPosition()),"function"==typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var a=this._v;a!==!1&&(this._o.bound&&g(d,"click",this._onClick),this.el.style.position="static",this.el.style.left="auto",this.el.style.top="auto",k(this.el,"is-hidden"),this._v=!1,void 0!==a&&"function"==typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){this.hide(),g(this.el,"mousedown",this._onMouseDown,!0),g(this.el,"touchend",this._onMouseDown,!0),g(this.el,"change",this._onChange),this._o.field&&(g(this._o.field,"change",this._onInputChange),this._o.bound&&(g(this._o.trigger,"click",this._onInputClick),g(this._o.trigger,"focus",this._onInputFocus),g(this._o.trigger,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}},E}),function(a,b){"use strict";"object"==typeof exports?b(require("jquery"),require("../pikaday")):"function"==typeof define&&define.amd?define(["jquery","pikaday"],b):b(a.jQuery,a.Pikaday)}(this,function(a,b){"use strict";a.fn.pikaday=function(){var c=arguments;return c&&c.length||(c=[{}]),this.each(function(){var d=a(this),e=d.data("pikaday");if(e instanceof b)"string"==typeof c[0]&&"function"==typeof e[c[0]]&&(e[c[0]].apply(e,Array.prototype.slice.call(c,1)),"destroy"===c[0]&&d.removeData("pikaday"));else if("object"==typeof c[0]){var f=a.extend({},c[0]);f.field=d[0],d.data("pikaday",new b(f))}})}}),jQuery(document).on("click",".c37-child",function(){var a=jQuery(this).closest("form"),b=jQuery(this).closest(".c37-item-element").attr("id"),c=elementsActions[a.find("input[name=form_id]").first().val()];if(!_.isEmpty(c)){var d=c[b];if("object"==typeof d)return"click"!=d.trigger?void console.log("not triggered by click"):void("submit-form"==d.action&&a.submit())}}),function(a){function b(b){if(b.find("input[type=file]").length>0)return b.unbind("submit"),b.submit(),!0;var c={},d=b.find("input"),e=b.find("select"),f=b.find("textarea"),g=b.attr("action");return _.each(d,function(b){var d=a(b);"checkbox"==d.attr("type")?("undefined"==typeof c[d.attr("name")]&&(console.log("init default array"),c[d.attr("name")]=[]),d.is(":checked")&&(c[d.attr("name")].push(d.val()),console.log(c[d.attr("name")]))):"radio"==d.attr("type")?("undefined"==typeof c[d.attr("name")]&&(c[d.attr("name")]=""),d.is(":checked")&&(c[d.attr("name")]=d.val())):c[d.attr("name")]=d.val()}),_.each(e,function(b){var d=a(b);c[d.attr("name")]=d.val()}),_.each(f,function(b){var d=a(b);c[d.attr("name")]=d.val()}),c.by_ajax=1,a.post(g,c,function(b){toastr.remove();var c=JSON.parse(b);if(1==c.error){if("string"==typeof c.message)return toastr.error(c.message),!1;for(var d=0;d<c.message.length;d++){var e=c.message[d].name,f=c.message[d].message,g=a("[name="+e+"]");g.closest(".c37-form-element").addClass("hint-right"),g.closest(".c37-form-element").addClass("hint-error"),g.closest(".c37-form-element").attr("data-hint",f),g.addClass("c37-field-error")}}else toastr.success(c.message),""!=c.url&&(window.location.href=c.url)}),!1}a(function(){var c;a(document).on("click",".c37-form [data-role=submit]",function(b){console.log("submit button clicked");var d=a(this).closest(".c37-form");c=d.parsley()}),a(".c37-form").bind("submit",function(d){d.preventDefault();var e=a(this),f=e.attr("id");formsValidation[f];"undefined"==typeof c&&(c=e.parsley()),c.isValid()&&(console.log("form is valid! wow!"),b(e))})})}(jQuery),function(){jQuery(function(){jQuery(".c37-form input[type=file]").on("change",function(){for(var a="",b=0;b<jQuery(this).get(0).files.length;++b)a+='<span class="c37-selected-file">'+jQuery(this).get(0).files[b].name+"</span>";a="<div class='all-selected-files'>"+a+"</div>",jQuery(".all-selected-files").remove(),console.log("item: "+jQuery(this).closest(".c37-child").length),jQuery(this).is(":visible")||(console.log("appending-file"),jQuery(this).closest("div.c37-child").append(a))}),_.each(jQuery(".c37-star-rating"),function(a){var b=jQuery(a);b.siblings(".br-widget").remove(),console.log(b.find(".br-wrapper").length),console.log("star rendered");var c=b.attr("data-theme"),d="true"==b.attr("data-show-selected"),e="true"==b.attr("data-show-values"),f=b.attr("data-initial-rating"),g=b.attr("id"),h={theme:c,showSelectedRating:d,showValues:e,initialRating:f,allowEmpty:!0,onSelect:function(a,c){console.log("value is : "+a),_.each(b.find("option"),function(b){var c=jQuery(b);c.val()==a&&c.prop("selected",!0)})}};console.log(h),jQuery("#"+g).barrating(h)})})}(jQuery); 
     3},getDate:function(){return n(this._d)?new Date(this._d.getTime()):new Date},setDate:function(a,b){if(!a)return this._d=null,this._o.field&&(this._o.field.value="",h(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof a&&(a=new Date(Date.parse(a))),n(a)){var c=this._o.minDate,d=this._o.maxDate;n(c)&&a<c?a=c:n(d)&&a>d&&(a=d),this._d=new Date(a.getTime()),r(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),h(this._o.field,"change",{firedBy:this})),b||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(a){var b=!0;if(n(a)){if(this.calendars){var c=new Date(this.calendars[0].year,this.calendars[0].month,1),d=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),e=a.getTime();d.setMonth(d.getMonth()+1),d.setDate(d.getDate()-1),b=e<c.getTime()||d.getTime()<e}b&&(this.calendars=[{month:a.getMonth(),year:a.getFullYear()}],"right"===this._o.mainCalendar&&(this.calendars[0].month+=1-this._o.numberOfMonths)),this.adjustCalendars()}},adjustDate:function(c,d){var e,f=this.getDate(),g=24*parseInt(d)*60*60*1e3;"add"===c?e=new Date(f.valueOf()+g):"subtract"===c&&(e=new Date(f.valueOf()-g)),b&&("add"===c?e=a(f).add(d,"days").toDate():"subtract"===c&&(e=a(f).subtract(d,"days").toDate())),this.setDate(e)},adjustCalendars:function(){this.calendars[0]=u(this.calendars[0]);for(var a=1;a<this._o.numberOfMonths;a++)this.calendars[a]=u({month:this.calendars[0].month+a,year:this.calendars[0].year});this.draw()},gotoToday:function(){this.gotoDate(new Date)},gotoMonth:function(a){isNaN(a)||(this.calendars[0].month=parseInt(a,10),this.adjustCalendars())},nextMonth:function(){this.calendars[0].month++,this.adjustCalendars()},prevMonth:function(){this.calendars[0].month--,this.adjustCalendars()},gotoYear:function(a){isNaN(a)||(this.calendars[0].year=parseInt(a,10),this.adjustCalendars())},setMinDate:function(a){a instanceof Date?(r(a),this._o.minDate=a,this._o.minYear=a.getFullYear(),this._o.minMonth=a.getMonth()):(this._o.minDate=v.minDate,this._o.minYear=v.minYear,this._o.minMonth=v.minMonth,this._o.startRange=v.startRange),this.draw()},setMaxDate:function(a){a instanceof Date?(r(a),this._o.maxDate=a,this._o.maxYear=a.getFullYear(),this._o.maxMonth=a.getMonth()):(this._o.maxDate=v.maxDate,this._o.maxYear=v.maxYear,this._o.maxMonth=v.maxMonth,this._o.endRange=v.endRange),this.draw()},setStartRange:function(a){this._o.startRange=a},setEndRange:function(a){this._o.endRange=a},draw:function(a){if(this._v||a){var b,c=this._o,d=c.minYear,f=c.maxYear,g=c.minMonth,h=c.maxMonth,i="";this._y<=d&&(this._y=d,!isNaN(g)&&this._m<g&&(this._m=g)),this._y>=f&&(this._y=f,!isNaN(h)&&this._m>h&&(this._m=h)),b="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var j=0;j<c.numberOfMonths;j++)i+='<div class="pika-lendar">'+C(this,j,this.calendars[j].year,this.calendars[j].month,this.calendars[0].year,b)+this.render(this.calendars[j].year,this.calendars[j].month,b)+"</div>";this.el.innerHTML=i,c.bound&&"hidden"!==c.field.type&&e(function(){c.trigger.focus()},1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),this._o.field.setAttribute("aria-label","Use the arrow keys to pick a date")}},adjustPosition:function(){var a,b,c,e,f,g,h,i,j,k;if(!this._o.container){if(this.el.style.position="absolute",a=this._o.trigger,b=a,c=this.el.offsetWidth,e=this.el.offsetHeight,f=window.innerWidth||d.documentElement.clientWidth,g=window.innerHeight||d.documentElement.clientHeight,h=window.pageYOffset||d.body.scrollTop||d.documentElement.scrollTop,"function"==typeof a.getBoundingClientRect)k=a.getBoundingClientRect(),i=k.left+window.pageXOffset,j=k.bottom+window.pageYOffset;else for(i=b.offsetLeft,j=b.offsetTop+b.offsetHeight;b=b.offsetParent;)i+=b.offsetLeft,j+=b.offsetTop;(this._o.reposition&&i+c>f||this._o.position.indexOf("right")>-1&&i-c+a.offsetWidth>0)&&(i=i-c+a.offsetWidth),(this._o.reposition&&j+e>g+h||this._o.position.indexOf("top")>-1&&j-e-a.offsetHeight>0)&&(j=j-e-a.offsetHeight),this.el.style.left=i+"px",this.el.style.top=j+"px"}},render:function(a,b,c){var d=this._o,e=new Date,f=q(a,b),g=new Date(a,b,1).getDay(),h=[],i=[];r(e),d.firstDay>0&&(g-=d.firstDay,g<0&&(g+=7));for(var j=0===b?11:b-1,k=11===b?0:b+1,l=0===b?a-1:a,m=11===b?a+1:a,p=q(l,j),t=f+g,u=t;u>7;)u-=7;t+=7-u;for(var v=0,w=0;v<t;v++){var A=new Date(a,b,1+(v-g)),B=!!n(this._d)&&s(A,this._d),C=s(A,e),E=v<g||v>=f+g,F=1+(v-g),G=b,H=a,I=d.startRange&&s(d.startRange,A),J=d.endRange&&s(d.endRange,A),K=d.startRange&&d.endRange&&d.startRange<A&&A<d.endRange,L=d.minDate&&A<d.minDate||d.maxDate&&A>d.maxDate||d.disableWeekends&&o(A)||d.disableDayFn&&d.disableDayFn(A);E&&(v<g?(F=p+F,G=j,H=l):(F-=f,G=k,H=m));var M={day:F,month:G,year:H,isSelected:B,isToday:C,isDisabled:L,isEmpty:E,isStartRange:I,isEndRange:J,isInRange:K,showDaysInNextAndPreviousMonths:d.showDaysInNextAndPreviousMonths};i.push(x(M)),7===++w&&(d.showWeekNumber&&i.unshift(y(v-g,b,a)),h.push(z(i,d.isRTL)),i=[],w=0)}return D(d,h,c)},isVisible:function(){return this._v},show:function(){this.isVisible()||(l(this.el,"is-hidden"),this._v=!0,this.draw(),this._o.bound&&(f(d,"click",this._onClick),this.adjustPosition()),"function"==typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var a=this._v;a!==!1&&(this._o.bound&&g(d,"click",this._onClick),this.el.style.position="static",this.el.style.left="auto",this.el.style.top="auto",k(this.el,"is-hidden"),this._v=!1,void 0!==a&&"function"==typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){this.hide(),g(this.el,"mousedown",this._onMouseDown,!0),g(this.el,"touchend",this._onMouseDown,!0),g(this.el,"change",this._onChange),this._o.field&&(g(this._o.field,"change",this._onInputChange),this._o.bound&&(g(this._o.trigger,"click",this._onInputClick),g(this._o.trigger,"focus",this._onInputFocus),g(this._o.trigger,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}},E}),function(a,b){"use strict";"object"==typeof exports?b(require("jquery"),require("../pikaday")):"function"==typeof define&&define.amd?define(["jquery","pikaday"],b):b(a.jQuery,a.Pikaday)}(this,function(a,b){"use strict";a.fn.pikaday=function(){var c=arguments;return c&&c.length||(c=[{}]),this.each(function(){var d=a(this),e=d.data("pikaday");if(e instanceof b)"string"==typeof c[0]&&"function"==typeof e[c[0]]&&(e[c[0]].apply(e,Array.prototype.slice.call(c,1)),"destroy"===c[0]&&d.removeData("pikaday"));else if("object"==typeof c[0]){var f=a.extend({},c[0]);f.field=d[0],d.data("pikaday",new b(f))}})}}),jQuery(document).on("click",".c37-child",function(){var a=jQuery(this).closest("form"),b=jQuery(this).closest(".c37-item-element").attr("id"),c=elementsActions[a.find("input[name=form_id]").first().val()];if(!_.isEmpty(c)){var d=c[b];if("object"==typeof d)return"click"!=d.trigger?void console.log("not triggered by click"):void("submit-form"==d.action&&a.submit())}}),function(a){function b(b){if(b.find("input[type=file]").length>0)return b.unbind("submit"),void b.submit();var c={},d=b.find("input"),e=b.find("select"),f=b.find("textarea"),g=b.attr("action");return _.each(d,function(b){var d=a(b);"checkbox"==d.attr("type")?("undefined"==typeof c[d.attr("name")]&&(console.log("init default array"),c[d.attr("name")]=[]),d.is(":checked")&&(c[d.attr("name")].push(d.val()),console.log(c[d.attr("name")]))):"radio"==d.attr("type")?("undefined"==typeof c[d.attr("name")]&&(c[d.attr("name")]=""),d.is(":checked")&&(c[d.attr("name")]=d.val())):c[d.attr("name")]=d.val()}),_.each(e,function(b){var d=a(b);c[d.attr("name")]=d.val()}),_.each(f,function(b){var d=a(b);c[d.attr("name")]=d.val()}),c.by_ajax=1,a.post(g,c,function(b){toastr.remove();var c=JSON.parse(b);if(1==c.error){if("string"==typeof c.message)return toastr.error(c.message),!1;for(var d=0;d<c.message.length;d++){var e=c.message[d].name,f=c.message[d].message,g=a("[name="+e+"]");g.closest(".c37-form-element").addClass("hint-right"),g.closest(".c37-form-element").addClass("hint-error"),g.closest(".c37-form-element").attr("data-hint",f),g.addClass("c37-field-error")}}else toastr.success(c.message),""!=c.url&&(window.location.href=c.url)}),!1}a(function(){_.each(a(".c37-form"),function(b){var c=a(b).find("input[name=form_id]").first().val();console.log(c);var d=formsValidation[c];if("undefined"!=typeof d){var e=Object.keys(d);_.each(e,function(b){var c=d[b],e=a("[name="+b+"]");c.required&&e.prop("required",!0)})}a(b).parsley()}),a(document).on("click",".c37-form [data-role=submit]",function(b){console.log("submit button clicked");a(this).closest(".c37-form")}),a(".c37-form").bind("submit",function(c){c.preventDefault();var d=a(this);return d.parsley().isValid()?(console.log("form is valid! wow!"),void b(d)):void 0})})}(jQuery),function(){jQuery(function(){jQuery(".c37-form input[type=file]").on("change",function(){for(var a="",b=0;b<jQuery(this).get(0).files.length;++b)a+='<span class="c37-selected-file">'+jQuery(this).get(0).files[b].name+"</span>";a="<div class='all-selected-files'>"+a+"</div>",jQuery(".all-selected-files").remove(),console.log("item: "+jQuery(this).closest(".c37-child").length),jQuery(this).is(":visible")||(console.log("appending-file"),jQuery(this).closest("div.c37-child").append(a))}),_.each(jQuery(".c37-star-rating"),function(a){var b=jQuery(a);b.siblings(".br-widget").remove(),console.log(b.find(".br-wrapper").length),console.log("star rendered");var c=b.attr("data-theme"),d="true"==b.attr("data-show-selected"),e="true"==b.attr("data-show-values"),f=b.attr("data-initial-rating"),g=b.attr("id"),h={theme:c,showSelectedRating:d,showValues:e,initialRating:f,allowEmpty:!0,onSelect:function(a,c){console.log("value is : "+a),_.each(b.find("option"),function(b){var c=jQuery(b);c.val()==a&&c.prop("selected",!0)})}};console.log(h),jQuery("#"+g).barrating(h)})})}(jQuery); 
  • core37-form-builder/trunk/pages/make-form.php

    r1553690 r1554164  
    5353                    <div data-original="true" data-c37-type="date" class="c37-form-element c37-item-element"><i class="fa fa-calendar"></i> Date input</div> 
    5454                    <div data-original="true" data-c37-type="select" class="c37-form-element c37-item-element"><i class="fa fa-list-ul"></i> Select box</div> 
    55 <!--                    <div data-original="true" data-c37-type="file" class="c37-form-element c37-item-element"><i class="fa fa-cloud-upload"></i> File upload</div>--> 
     55                    <div data-original="true" data-c37-type="file" class="c37-form-element c37-item-element"><i class="fa fa-cloud-upload"></i> File upload</div> 
    5656                    <div data-original="true" data-c37-type="recaptcha" class="c37-form-element c37-item-element"><i class="fa fa-unlock-alt"></i> ReCaptcha</div> 
    5757                    <div data-original="true" data-c37-type="acceptance" class="c37-form-element c37-item-element"><i class="fa fa-check-square-o"></i> Acceptance</div> 
Note: See TracChangeset for help on using the changeset viewer.