LI.define('JSBeacon');

(function () {

  /**
   * JSBeacon module which can send analytics info
   *
   * @class JSBeacon
   * @constructor
   */
  LI.JSBeacon = function () {
  };

  var JSBeacon = LI.JSBeacon,

    // Refer http://viewvc.corp.linkedin.com/netrepo/network/trunk/ui/chrome/jsp/_li_guest_beacon.jsp for jsp version of JSBeacon which tracks guest viewing
    CONST = {
      LEO_PAGE_TRACKING: 'leo.pageTracking',
      FULL_PAGE: 'full_page',
      PAGE_KEY_SUFFIX: '_jsbeacon',
      BCOOKIE: 'bcookie'
    };

  /**
   * Sends a GET request to the specified analytics url
   *
   * @method sendRequest
   * @param {String} analyticsNoauthUrl - analytics tracking url
   * @param {String} trackingInfo - Optional tracking info string
   * @param {Boolean} addReferrer - Optional boolean param which adds referrer url to tracking info
   */
  JSBeacon.sendRequest = function (analyticsNoauthUrl, trackingInfo, addReferrer) {
    var params,
      analyticsNoauthUrlWithParams;

    if (analyticsNoauthUrl && LI.NuxUtil.readCookie(CONST.BCOOKIE)) {

      if (addReferrer) {
        trackingInfo = (trackingInfo ? trackingInfo + ',' : '') + document.referrer.substr(0, 128);
      }

      params = {
        type: CONST.LEO_PAGE_TRACKING,
        pageType: CONST.FULL_PAGE,
        pageKey: LI.NuxUtil.getPageKey() + CONST.PAGE_KEY_SUFFIX,
        trackingInfo: trackingInfo
      };
      analyticsNoauthUrlWithParams = analyticsNoauthUrl + '?' + $.param(params);
      $.ajax(analyticsNoauthUrlWithParams);
    }
  };

}());LI.define('FormValidator');

(function () {

  /**
   * Helper class for validating form fields
   * Example Usage:
   *
   *    var validator = new LI.FormValidator($('join'), {
   *      validateOnSubmit: true,
   *      errorClass: 'error',
   *      removeErrorOn: 'focus',
   *      fields: [
   *        {
   *          name: 'firstName',
   *          selector: '#first-name',
   *          rules: {
   *            required: true
   *          }
   *        },
   *        {
   *          name: 'lastName',
   *          selector: '#lastName,
   *          rules: {
   *            required: true
   *          }
   *        },
   *        {
   *          name: 'email',
   *          selector: '#email',
   *          rules: {
   *            required: true,
   *            type: 'email'
   *          }
   *        },
   *        {
   *          name: 'password',
   *          selector: '#password',
   *          rules: {
   *            required: true,
   *            size: [6]
   *          }
   *        }
   *      ],
   *      callback: function(data) {
   *        if (data.passed) {
   *          // Submit Form
   *        } else {
   *          // Show Error Message
   *        }
   *      }
   *    });
   *
   *
   *
   * @param {JQuery} __$formEl - Form element to be validated
   * @param {Object} __config - Config for validation. Following config is accepted
   *
   *        callback            {Function}  Required  - Callback to be called after validation is done.
   *                                                    Callback is called with parameter data of type object. It consists:
   *                                                    {
   *                                                      passed: Boolean,
   *                                                      errorFields: [
   *                                                        {
   *                                                          errors: Array, //Array of errors eg. ["required", "size"]
   *                                                          name: String,  //Name of field that was passed in fields config
   *                                                          value:  String,//Value of field
   *                                                          fieldEl: JQuery//Field Element itself
   *                                                        },
   *                                                        {
   *                                                          errors: Array,
   *                                                          name: String,
   *                                                          value:  String,
   *                                                          fieldEl: JQuery
   *                                                        }
   *                                                      ]
   *                                                      validatedFields: [
   *                                                        {
   *                                                          name: String,
   *                                                          value:  String,
   *                                                          fieldEl: JQuery
   *                                                        },
   *                                                        {
   *                                                          name: String,
   *                                                          value:  String,
   *                                                          fieldEl: JQuery
   *                                                        }
   *                                                      ]
   *                                                    }
   *
   *
   *        validateOnSubmit    {Boolean}   Optional  - If true, submit event is added and validation is handeled on submit
   *                                                    @default false
   *        errorClass          {String}    Optional  - If passed, this class is added to the field if validation fails
   *        removeErrorOn       {String}    Optional  - If passed, error class will be removed on that event in field
   *        fields              {Object}    Required  - Hash containing selector and rules for validation.
   *                                                    Key of hash should be name for field.
   *
   *                            name    {String}        Name of field. This is needed so that callback gets back name and value
   *                                                    and doesn't have to make additional DOM queries to get field's value
   *                            rules   {Object}        Validation rules for the field. Following rules are suported:
   *
   *                                    size        {Array}     Min/Max characters for the field. If check should be made against
   *                                                            max characters only pass 0 for min. eg. [0, 10]
   *                                    required    {Boolean}   If true, field is checked against empty value.
   *                                                            Using HTML5 required attribute is recommended
   *                                    test        {Function}  If you want to test the field against some function
   *                                    type        {String}    type of field. Using HTML5 type attribute is recommended.
   *                                                            Supported types for now are: email, number,
   *                                                            If type is mentioned in markup or in config. Check for 'required'
   *                                                            is enforced
   *
   * @dependency JQuery or Zepto
   * @author Bikramjit Singh (bsingh@linkedin.com)
   */
  LI.FormValidator = function (__$formEl, __config) {

    //////////////////////
    // PRIVATE VARS
    //////////////////////

    var __fields = [],

      __errorClass = __config.errorClass || '',

      EVENT = {
        BLUR: 'blur',
        SUBMIT: 'submit'
      },

      CONST = {
        TYPE: 'type',
        PASSWORD: 'password'
      };

    //////////////////////
    // PRIVATE METHODS
    //////////////////////

    /**
     * Utility method that checks if passed value is valid email
     *
     * @method testEmail
     * @param value
     * @returns {boolean}
     */
    function testEmail(value) {
      return /^([a-zA-Z0-9_\-=\.\'\+]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,10}|[0-9]{1,3})(\]?)$/.test(value);
    }

    /**
     * Utility method to validate size of characters in the field
     *
     * @method testSize
     * @param {String} value
     * @param {Array} size - Array containing min and max size of the field
     * @returns {boolean}
     */
    function testSize(value, size) {
      var passed = true,
        valueLength = value.length;

      if (valueLength < size[0]) {
        //Min size not reached
        passed =  false;
      } else {
        //If min size reached, check for max size
        if (size.length > 1) {
          if (valueLength > size[1]) {
            passed = false;
          }
        }
      }

      return passed;
    }

    /**
     * Test the passed with given options
     *
     * @method __test
     * @param {Object} field - Field with some options to test
     * @returns {Object} {{value: String, errors: Array}} - Returns object containing value of field and validation
     *                                                      errors (if any)
     * @private
     */
    function __test(field) {
      var $fieldEl = field.fieldEl,
        fieldValue = (field.isPassword) ? $fieldEl.val() : $.trim($fieldEl.val()),
        valueLength = fieldValue.length,
        data = {
          value: fieldValue,
          errors: []
        };

      //if user provided their own custom test function, test the field against is
      if (field.test && $.isFunction(field.test)) {
        data.errors =  field.test($fieldEl) || [];
        return data;
      }

      //Check if field was required and it is empty
      if (field.isRequired) {
        if (valueLength === 0) {
          data.errors.push(LI.FormValidator.RULES.REQUIRED);
          //Return errors as field was empty and we don't need to check for other errors
          return data;
        }
      }

      //Check if field is of type email and it passes validation
      if (field.isEmail) {
        if (!testEmail(fieldValue)) {
          data.errors.push(LI.FormValidator.RULES.TYPE);
        }
      }

      //Validate field size
      if (field.size && $.isArray(field.size)) {
        if (!testSize(fieldValue, field.size)) {
          data.errors.push(LI.FormValidator.RULES.SIZE);
        }
      }

      return data;
    }

    /**
     * Handler for removing error event
     *
     * @method __handleErrorRemoveEvt
     * @param {Event} evt - Event Object
     * @private
     */
    function __handleErrorRemoveEvt(evt) {
      var $fieldEl = evt.data.$fieldEl;

      $fieldEl.removeClass(__config.errorClass);
      //We don't need error event now. Lets unbind it
      __bindRemoveErrorEvt($fieldEl, false);
    }

    /**
     * Binds/Unbinds the event for removing error
     *
     * @method __bindRemoveErrorEvt
     * @param {JQuery} $fieldEl - Field element on which event is to be bind/unbind
     * @param {Booloean} bind - If true binds else unbinds event
     * @private
     */
    function __bindRemoveErrorEvt($fieldEl, bind) {
      if (bind) {
        $fieldEl.on(__config.removeErrorOn, {$fieldEl: $fieldEl}, __handleErrorRemoveEvt);
      } else {
        $fieldEl.unbind(__config.removeErrorOn, __handleErrorRemoveEvt);
      }
    }

    /**
     * Runs the validation on form fields that need to be validated
     *
     * @method __validate
     * @private
     */
    function __validate() {
      var data,
        field,
        $fieldEl,
        errorFields = [],
        validatedFields = [],
        fieldsSize = __fields.length,
        hasErrors = false,
        idx;

      if (!__config.callback || !fieldsSize) {
        return;
      }

      for (idx = 0; idx < fieldsSize; idx++) {
        field = __fields[idx];
        $fieldEl = field.fieldEl;

        //Test the field
        data = __test(field);

        if (data.errors.length) {
          hasErrors = true;
          if (__errorClass && !field.fieldEl.hasClass(__errorClass)) {
            $fieldEl.addClass(__config.errorClass);

            //Attach event on which error is to be removed
            if (__config.removeErrorOn) {
              __bindRemoveErrorEvt($fieldEl, true);
            }
          }
          //Add error fields
          errorFields.push({
            name:     field.name,
            fieldEl:  $fieldEl,
            value:    data.value,
            errors:   data.errors
          });

        } else {
          if (__errorClass && field.fieldEl.hasClass(__errorClass)) {
            $fieldEl.removeClass(__config.errorClass);

            //Unbind error removal event
            if (__config.removeErrorOn) {
              __bindRemoveErrorEvt($fieldEl, false);
            }
          }
          //Add validated fields
          validatedFields.push({
            name:     field.name,
            fieldEl:  $fieldEl,
            value:    data.value
          });
        }
      }

      __config.callback({
        passed: !hasErrors,
        errorFields: errorFields,
        validatedFields: validatedFields
      });
    }

    /**
     * Handler for submit form.
     * - Prevents the default action
     * - Runs validation on the fields
     *
     * @param {Event} ev - Event object
     * @private
     */
    function __handleSubmit(ev) {
      ev.preventDefault();

      __validate();
    }

    /**
     * Sanitize passed in fields and build array of fields to cache some data so that we don't query node un-necessarily
     * on each attempt to validate
     *
     * @method __initFields
     * @private
     */
    function __initFields() {
      var fields = __config.fields,
        fieldsSize,
        field,
        $fieldEl,
        rules,
        idx;


      for (idx = 0, fieldsSize = fields.length; idx < fieldsSize; idx++) {
        field = fields[idx];
        rules = field.rules;

        $fieldEl = $(field.selector);
        __fields.push({
          name:       field.name,
          fieldEl:    $fieldEl,
          isRequired: !!rules[LI.FormValidator.RULES.REQUIRED],
          isPassword: ($fieldEl.attr(CONST.TYPE) === CONST.PASSWORD),
          isEmail:    (rules[LI.FormValidator.RULES.TYPE] === LI.FormValidator.FIELD_TYPE.EMAIL ||
                      $fieldEl.attr(CONST.TYPE) === LI.FormValidator.FIELD_TYPE.EMAIL),
          test:       rules.test,
          size:       rules.size
        });
      }
    }

    /**
     * Initialize events
     *
     * @method __initEvents
     */
    function __initEvents() {
      __$formEl.on(EVENT.SUBMIT, __handleSubmit);
    }

    /**
     * Initalize the class
     *
     * @method __init
     */
    function __init() {
      __initFields();

      if (!!__config.validateOnSubmit) {
        __initEvents();
      }
    }


    //////////////////////
    // KICK START
    //////////////////////

    __init();


    //////////////////////
    // PUBLIC METHODS
    //////////////////////

    //Expose validate method so that users can call it when needed if not using validateOnSubmit option
    this.validate = __validate;
  };


  //////////////////////
  // PUBLIC CONSTANTS
  //////////////////////

  /**
   * Rules that can be passed in config
   *
   * @property RULES
   */
  LI.FormValidator.RULES = {
    RANGE: 'range',
    REGEX: 'regex',
    REQUIRED: 'required',
    SIZE: 'size',
    TEST: 'test',
    TYPE: 'type'
  };

  /**
   * Field types that can be passed in rule 'type'. It is usually type of field
   *
   * @property FIELD_TYPE
   */
  LI.FormValidator.FIELD_TYPE = {
    EMAIL: 'email'
  };
}());
LI.define('Account');

(function () {

  /**
   * Model Class for Account. All Account related requests are handled by this class.
   *
   * @constructor
   * @author Bikramjit Singh (bsingh@linkedin.com)
   */
  LI.Account = function () {
  };


  ///////////////////////////
  // PUBLIC STATIC METHODS
  ///////////////////////////

  /**
   * Sends a new LI account creation request to Server.
   *  - If successful, creates a new user account with passed information and server sets LI cookie.
   *
   *  Note: Validation is not handled by this method. Callee should do validation
   *
   * @method create
   * @param {Object} params - Following params are supported:
   *
   *        callback        {Function}  optional    -   Callback function if account is successfully created
   *        errorCallback   {Function}  optional    -   Callback method to be called in case of any errors
   *        data            {Object}    required    -   Account data needed to create account. Following data can be passed:
   *
   *                 firstName        {String}    required    -     First Name of user
   *                 lastName         {String}    required    -     Last Name of user
   *                 emailAddress     {String}    required    -     Email of user.
   *                                                                Callee should validate the email. This method won't
   *                                                                validate if the String is a valid email or not
   *                 password         {String}    required    -     Account password for user. Must be 6 characters or more.
   *                                                                Must be validated by callee
   *                 submissionId     {String}    optional    -     ID for the account creation request. If not present,
   *                                                                will be generated by the server and returned with the
   *                                                                response and must be sent back with subsequent account
   *                                                                creation requests from the same user.
   *                 challengeToken   {String}    optional    -     Challenge verification token provided by the captcha page
   *                 invitationInfo   {Object}    optional    -     Information about the invitation that the member received.
   *                                                                Following required fileds are supported
   *                            invitationId                  {String}    -     ID for the invitation
   *                            sharedKey                     {String}    -     Shared key for the invitation
   *
   *
   *                 botDetectionData {Object}    optional    -     Additional information that's used to detect whether the user is a bot.
   *                                                                Following fields must be passed if bot detection is needed
   *
   *                            requestId                     {String}    -   Client side javascript execution output.
   *                            clientOutput                  {String}    -   Client side javascript execution output.
   *                            nonce                         {String}    -   Nonce generated from client side javascript.
   *                            clientTimestampParamValue     {String}    -   Client side timestamp.
   *                            jsVersion                     {String}    -   Version of Javascript function
   *
   *
   *                 redirectInfo     {Object}    optional    -     Information about where to redirect the user during or after onboarding.
   *
   *                            postOnboardingRedirectUrl     {String}    optional    -     The URL to return the user to at the end of the
   *                                                                                        registration flow
   *                            postConfirmationRedirectUrl   {String}    optional    -     The APP URI to return the user to after email confirmation.
   *
   **/
  LI.Account.create = function (params) {
    var PARAM_TRK = 'trk',
      data = params.data || {},
      joinUrl = window.play.url({alias: 'com.linkedin.uno.reg.RegApiController.createAccount'}),
      reqData,
      trkToken,
      botDetectionInput,
      thirdPartyCredentials = {};

    //Do some basic validation
    if (!data.firstName || !data.lastName || !data.emailAddress || !data.password) {
      //If error callback passed, call it
      if (params.errorCallback) {
        params.errorCallback();
      }
      //Otherwise fail silently
      return;
    }

    //Populate bot detection
    if (!window._.isEmpty(data.botDetectionData) && window._.isObject(data.botDetectionData)) {
      botDetectionInput = data.botDetectionData;
      botDetectionInput.email = data.emailAddress;
    }

    reqData = LI.NuxUtil.hashMap({
      firstName: data.firstName,
      lastName: data.lastName,
      emailAddress: data.emailAddress,
      password: data.password
    });

    //Add captcha fields
    reqData.addIfNotEmpty('submissionId', data.submissionId);
    reqData.addIfNotEmpty('challengeVerificationToken', data.challengeToken);

    reqData.addIfNotEmpty('botDetectionInput', botDetectionInput);

    //Add redirect information
    reqData.addIfNotEmpty('redirectInfo', data.redirectInfo);

    //Add invitation data
    reqData.addIfNotEmpty('invitationInfo', data.invitationInfo);

    //If trk param is there, pass it to Server
    trkToken = LI.NuxUtil.getQueryParams(PARAM_TRK);
    if (trkToken) {
      joinUrl = window.play.addQueryParameter(joinUrl, PARAM_TRK, trkToken);
    }

    //Add Genie Provider if it exists
    if (data.thirdPartyProvider) {
      thirdPartyCredentials['thirdPartyProvider'] = data.thirdPartyProvider;
    }

    //Add encrypted handle if it exists
    if (data.genieEncryptedQueryParam) {
      thirdPartyCredentials['genieEncryptedQueryParam'] = data.genieEncryptedQueryParam;
    }

    reqData.addIfNotEmpty('thirdPartyCredentials', thirdPartyCredentials);

    window.app.api.sendRequest({
      url:            joinUrl,
      method:         LI.NuxAsyncRequest.HTTP_METHOD.POST,
      contentType:    LI.NuxAsyncRequest.CONTENT_TYPE.JSON,
      data:           reqData.data,
      callback:       params.callback,
      errorCallback:  params.errorCallback
    });
  };

  /**
   * Sends a request to server querying for the state of a task that is running to fetch a user's profile from a third party provider
   *
   * @method getThirdPartyProfileTaskState
   * @param {Object} params - Following params are supported:
   *
   *        taskId        {String}    required    -   Task id of the task whose state we want to find
   *        callback      {Function}  required    -   Callback function if task state is successfully returned
   *        errorCallback {Function}  required    -   Callback function to be called in case of any errors
   **/
  LI.Account.getThirdPartyProfileTaskState = function (params) {
    var reqData = {taskId: params.taskId};
    window.app.api.sendRequest({
      url:            window.play.url({alias: 'com.linkedin.uno.reg.ThirdPartyProfileApiController.getThirdPartyProfileTaskState'}),
      method:         LI.NuxAsyncRequest.HTTP_METHOD.POST,
      contentType:    LI.NuxAsyncRequest.CONTENT_TYPE.JSON,
      data:           reqData,
      callback:       params.callback,
      errorCallback:  params.errorCallback
    });
  };

  /**
   * Sends a request to server querying for the result of a task that is running to fetch a user's profile from a third party provider
   *
   * @method getThirdPartyProfileTaskResult
   * @param {Object} params - Following params are supported:
   *
   *        taskId        {String}     required    -   Task id of the task whose results we want to find
   *        callback      {Function}   required    -   Callback function if task result is successfully returned
   *        errorCallback {Function}   required    -   Callback function to be called in case of any errors
   **/
  LI.Account.getThirdPartyProfileTaskResult = function (params) {
    var reqData = {taskId: params.taskId};
    window.app.api.sendRequest({
      url:            window.play.url({alias: 'com.linkedin.uno.reg.ThirdPartyProfileApiController.getThirdPartyProfileTaskResult'}),
      method:         LI.NuxAsyncRequest.HTTP_METHOD.POST,
      contentType:    LI.NuxAsyncRequest.CONTENT_TYPE.JSON,
      data:           reqData,
      callback:       params.callback,
      errorCallback:  params.errorCallback
    });
  };


}());$(function(){function l(b){b.on("submit",function(){var c=b.find("#session_key-login"),d=b.find("input[name\x3demail]"),a,e,f;a=c.length?c[0].value:d.length?d[0].value:"";Date.now||(Date.now=function(){return(new Date).getTime()});c=Date.now();d=m().join(":");f=a+":"+d;window.jsRandomCalculator?(e=window.jsRandomCalculator.computeJson?window.jsRandomCalculator.computeJson({ts:c,n:d,email:a}):window.jsRandomCalculator.compute(d,a,c),a=window.jsRandomCalculator.version):a=e="";g("client_ts",c,b);g("client_r",
f,b);g("client_output",e,b);g("client_n",d,b);g("client_v",a,b)})}function m(){var b=[],c;for(c=0;3>c;c++)b[c]=Math.floor(9E8*Math.random())+1E8;return b}function g(b,c,d){var a=$("input[name\x3d"+b+"]",d);a.length?a.val(c):(a=document.createElement("input"),a.setAttribute("type","hidden"),a.setAttribute("name",b),a.setAttribute("value",c),d.append(a))}for(var k=$("[data-jsenabled\x3dcheck]"),e,f,h=0,n=k.length;h<n;h++)e=k.eq(h),f=e.find("input[name\x3disJsEnabled]"),1===f.length&&f.val("true"),l(e)});LI.define("JoinView");
(function(){LI.JoinView=function(){function r(a){a=a||!1;A||(A=e.find(c.JOIN_BTN));A.prop(L.DISABLED,a)}function v(a){k||(k=$(c.LOADER));a?k.fadeIn?k.fadeIn():k.removeClass(f.HIDDEN):k.fadeOut?k.fadeOut():k.addClass(f.HIDDEN)}function M(a){window.dust.render(p.MOBILE_CHALLENGE,{},function(b,c){b||(y.append(c),H(a),w.hide())})}function O(a){B=new LI.ModalDialogBox($(null),{width:540,dustContentTemplate:p.CHALLENGE,dustContentTemplateData:{challengeUrl:a},title:q.getStaticString(s.SECURITY_VERIFICATION,p.CHALLENGE),
decorators:["scripts/shared/Dialog/AjaxDustTemplateLoading"]});B.open().then(_.bind(H,this,a))}function H(a){if(window.app.isMobileWeb)$(c.CHALLENGE_IFRAME).on("load",function(){var a=$(c.CHALLENGE_IFRAME)[0];P($(a.contentWindow?a.contentWindow.document:a.contentDocument?a.contentDocument:a.document))});$(c.CHALLENGE_IFRAME).attr("src",a)}function Q(){var a=$(this);return!(!a.width()&&!a.height())&&"none"!==a.css("display")}function P(a){var b=$(c.CHALLENGE_CONT),N=/Safari/.test(navigator.userAgent)&&
/Apple Computer/.test(navigator.vendor);if(b.length&&(y.addClass(f.UNO_CHALLENGE),N))a.on(I.TOUCHEND,function(b){$(b.target).is("input,select,button,a")||a.find(c.SUBMIT_BUTTON).filter(Q).eq(0).focus()})}function J(a,b){var c=b?a.errorFields:a.validatedFields,h,e,g={},f=c.length;for(e=0;e<f;e++)h=c[e],g[h.name]=h.name===d.FIELD_NAME_PASSWORD?"":h.value,b&&(g[h.name+"_errors"]=h.errors.join(","));window.app.track.entityActivityEvent({pageKey:n,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:b?
l.VALIDATION_FAILURE:l.JOIN_REQUEST,customData:g})}function R(a,b){var c=a.responseJSON||{},e=c.translatedMessage||q.getStaticString(s.ERROR_MESSAGE_REQUEST,p.JOIN_FORM);window.app.alert.inject({message:e,node:t});r(!1);v(!1);window.app.track.entityActivityEvent({pageKey:n,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:l.JOIN_REQUEST_FAILURE,customData:{errorMessage:c.debugMessage||e}})}function S(a,b,c){a.memberUrn?(a=window.play.url({alias:"com.linkedin.uno.onboarding.OnboardingWebController.editProfile"}),
a=window.play.addQueryParameter(a,LI.UnoTracking.TRK_PARAM,l.EDIT_PROFILE),C&&(a=window.play.addQueryParameter(a,d.PARAM_TASK_ID,C)),window.location.href=a):a.challenge&&(b=window.play.addQueryParameter(a.challenge.url,x.CALLBACK_PARAM_NAME,x.CALLBACK_METHOD_NAME),b=window.play.addQueryParameter(b,x.FUA_PARAM_NAME,x.FUA_PARAM_VALUE),r(!1),v(!1),window.app.isMobileWeb?M(b):O(b),window.app.track.entityActivityEvent({pageKey:n,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:l.SHOW_CHALLENGE}),
u.submissionId=a.submissionId,u.challengeToken&&(u.challengeToken=""))}function K(){v(!0);LI.Account.create({data:u,callback:S,errorCallback:R})}function T(a){var b;a.errorFields&&a.errorFields.length&&(b=a.errorFields[0],a=LI.NuxUtil.format(s.FORM_ERROR_FORMAT,b.errors[0],b.name.toLowerCase()),a=q.getStaticString(a,p.JOIN_FORM),window.app.alert.inject({message:a,node:t,handleDismiss:function(){var a={};a[b.name]=b.name===d.FIELD_NAME_PASSWORD?"":b.value;a[b.name+"_errors"]=b.errors.join(",");window.app.track.entityActivityEvent({pageKey:n,
activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:l.DISMISS_VALIDATION_ERROR,customData:a})}}))}function U(a){if(a.passed){r(!0);var b=a.validatedFields,d,h,f,g={};h=0;for(f=b.length;h<f;h++)d=b[h],g[d.name]=d.value;b=e.find(c.POST_ONBOARDING_REDIRECT_URL);b.length&&(g.redirectInfo={postOnboardingRedirectUrl:b.val()});d=e.find(c.SHARED_KEY);b=e.find(c.INVITATION_ID);d.length&&b.length&&(g.invitationInfo={invitationId:b.val(),sharedKey:d.val()});m||(m={$clientTS:e.find(c.CLIENT_TS),$clientR:e.find(c.CLIENT_R),
$clientOutput:e.find(c.CLIENT_OUTPUT),$clientN:e.find(c.CLIENT_N),$clientV:e.find(c.CLIENT_V)});b={requestId:m.$clientR.val(),clientOutput:m.$clientOutput.val(),nonce:m.$clientN.val(),clientTimestampParamValue:m.$clientTS.val(),jsVersion:m.$clientV.val()};g.botDetectionData=b;D&&(g.thirdPartyProvider=D);E&&(g.genieEncryptedQueryParam=E);u=g;K();J(a,!1);window.app.alert.remove(t)}else T(a),J(a,!0)}function F(a){a=LI.NuxUtil.format(c.LABEL,a.attr("id"));return e.find(a)}function V(a){var b=a.results.identificationData,
d=b.FIRST_NAME,h=b.LAST_NAME,b=b.EMAIL,k=e.find(c.FIRST_NAME),g=e.find(c.LAST_NAME),m=e.find(c.JOIN_EMAIL);d&&(k.val(d),k.removeClass(f.ERROR),F(k).addClass(f.SHOW));h&&(g.val(h),g.removeClass(f.ERROR),F(g).addClass(f.SHOW));b&&(m.val(b),m.removeClass(f.ERROR),F(m).addClass(f.SHOW));a.win.close();$(c.FB_BTN_CONTAINER).fadeOut("fast");$(c.JOIN_BTN).text(q.getStaticString(s.CONTINUE,p.JOIN_FORM));D=W.FACEBOOK;a=q.getStaticString(s.SUCCESS_MESSAGE_FACEBOOK,p.JOIN_FORM);window.app.alert.inject({message:a,
type:LI.UnoAlert.TYPE.SUCCESS,node:t});r(!1);v(!1);window.app.track.entityActivityEvent({pageKey:n,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:l.FACEBOOK_SUCCESS})}function X(a){a.win.close();G(!1)}function Y(a){a.win.close();G(!1)}function Z(a){}function G(a){var b=q.getStaticString(s.ERROR_MESSAGE_FACEBOOK,p.JOIN_FORM);window.app.alert.inject({message:b,node:t});r(!1);v(!1);window.app.track.entityActivityEvent({pageKey:n,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:a?
l.GAAP_ERROR:l.FACEBOOK_ERROR})}var y,w,e,A,t,k,n,m,B,u,q,z,C,E,D,l,x={CALLBACK_PARAM_NAME:"cb",CALLBACK_METHOD_NAME:"unoRegChallengeSuccessCallback",FUA_PARAM_NAME:"fua",FUA_PARAM_VALUE:"reg-challenge-landing-page",IFRAME_NAME:"challenge-iframe"},d={FIELD_NAME_FIRST_NAME:"firstName",FIELD_NAME_LAST_NAME:"lastName",FIELD_NAME_EMAIL:"emailAddress",FIELD_NAME_PASSWORD:"password",MAX_LENGTH_EMAIL:128,MAX_LENGTH_FIRST_NAME:20,MAX_LENGTH_LAST_NAME:40,MIN_LENGTH_EMAIL:3,MIN_LENGTH_FIRST_NAME:1,MIN_LENGTH_LAST_NAME:1,
MIN_LENGTH_PASSWORD:6,PARAM_TASK_ID:"taskId"},f={ANIMATE:"animate",ERROR:"error",HIDDEN:"hidden",SHOW:"show",UNO_CHALLENGE:"uno-challenge"},I={FOCUS:"focus",KEYUP:"keyup",TOUCHEND:"touchend"},s={ERROR_MESSAGE_REQUEST:"error_message_request",ERROR_MESSAGE_FACEBOOK:"error_message_facebook",SUCCESS_MESSAGE_FACEBOOK:"success_message_facebook",CONTINUE:"continue",FORM_ERROR_FORMAT:"error_message_{0}_{1}",SECURITY_VERIFICATION:"security_verification"},L={DISABLED:"disabled"},W={FACEBOOK:"FACEBOOK"},c={ALERTS_CONT:".alerts-cont",
BODY:"body",CAPTCHA_PAGE:".page",CHALLENGE_CONT:".challenge-container",CHALLENGE_IFRAME:".challenge-iframe",CHANGE_DOCUMENT_DOMAIN:"#changeDocumentDomain",CLIENT_TS:'input[name\x3d"client_ts"]',CLIENT_R:'input[name\x3d"client_r"]',CLIENT_OUTPUT:'input[name\x3d"client_output"]',CLIENT_N:'input[name\x3d"client_n"]',CLIENT_V:'input[name\x3d"client_v"]',CONTAINER:".join-container",FB_BTN:".fb-btn",FB_BTN_CONTAINER:".fb-btn-container",FIRST_NAME:"#first-name",INVITATION_ID:"#invitation-id",JOIN_BTN:".join-btn",
JOIN_EMAIL:"#join-email",JOIN_FORM:".join-linkedin-form",JOIN_PASSWORD:"#join-password",LABEL:'label[for\x3d"{0}"]',LAST_NAME:"#last-name",LOADER:".loading-indicator",LOADER_MOBILE:".loader-container",SUBMIT_BUTTON:'input[type\x3d"submit"],button[type\x3d"submit"]',POST_ONBOARDING_REDIRECT_URL:"#post-onboarding-redirect-url",SHARED_KEY:"#shared-key",URL_MAP:"#urlMap"},p={CHALLENGE:"templates/desktop/pages/home/partials/_captcha_dialog",MOBILE_CHALLENGE:"templates/mobile/pages/home/partials/_captcha_dialog",
JOIN_FORM:"templates/shared/pages/home/_join_form"};window[x.CALLBACK_METHOD_NAME]=function(a){r(!0);window.app.isMobileWeb?(y.removeClass(f.UNO_CHALLENGE),$(c.CHALLENGE_CONT).remove(),w.show()):B.close();u.challengeToken=a;window.app.track.entityActivityEvent({pageKey:n,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:l.CHALLENGE_SUCCESS});K()};window.unoRegGaapTaskCompleteCallback=function(a,b){C=a;E=b};window.unoRegGaapTaskFailedCallback=function(){G(!0)};(function(){var a;y=$(c.BODY);
w=$(c.CONTAINER);e=w.find(c.JOIN_FORM);t=w.find(c.ALERTS_CONT);n=LI.NuxUtil.getPageKey();$(c.CHANGE_DOCUMENT_DOMAIN).length&&(a=document.domain.replace("www.",""),document.domain=a);l=LI.UnoTracking.TRACKING_CODES.JOIN_PAGE;q=new window.t8.Resources(window.dust.i18n,window.dust);z=$(c.URL_MAP).length?window.play.getEmbeddedContent("urlMap"):{};new LI.FormValidator(e,{validateOnSubmit:!0,errorClass:f.ERROR,fields:[{name:d.FIELD_NAME_FIRST_NAME,selector:c.FIRST_NAME,rules:{required:!0,size:[d.MIN_LENGTH_FIRST_NAME,
d.MAX_LENGTH_FIRST_NAME]}},{name:d.FIELD_NAME_LAST_NAME,selector:c.LAST_NAME,rules:{required:!0,size:[d.MIN_LENGTH_LAST_NAME,d.MAX_LENGTH_LAST_NAME]}},{name:d.FIELD_NAME_EMAIL,selector:c.JOIN_EMAIL,rules:{required:!0,type:LI.FormValidator.FIELD_TYPE.EMAIL,size:[d.MIN_LENGTH_EMAIL,d.MAX_LENGTH_EMAIL]}},{name:d.FIELD_NAME_PASSWORD,selector:c.JOIN_PASSWORD,rules:{required:!0,size:[d.MIN_LENGTH_PASSWORD]}}],removeErrorOn:I.KEYUP,callback:U});a=$(c.FB_BTN);a.click(function(){window.app.track.entityActivityEvent({pageKey:n,
activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:l.FACEBOOK_ATTEMPT})});a.length&&new LI.Genie(a,{url:z.genieUrl,useNewGenie:!0,onAllow:V,onDeny:X,onError:Y,onClose:Z,scope:null});z.analyticsNoauthSecureUrl&&LI.JSBeacon.sendRequest(z.analyticsNoauthSecureUrl)})()}})();$(document).ready(function(){window.app=new LI.UnoApp;new LI.JoinView});