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
      };

      if (trackingInfo) {
        params.trackingInfo = trackingInfo;
      }

      analyticsNoauthUrlWithParams = analyticsNoauthUrl + '?' + $.param(params);

      $.ajax({
        url: 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 = {
    CHARACTERS: 'characters', //Character type
    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.
   *
   *  Reference: com/linkedin/uno/api/reg/CreateAccountRequest.pdsc
   *
   *  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
   *                 maidenName       {String}    optional    -     Maiden name of the user or English nickname for Chinese users
   *                 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.
   *
   *
   *                 basicProfileFormPrefillData {Object}    optional    -    Information used to populate the basic profile information reg page
   *
   *                            education                     {Object}    -   Education information such as schoolName, degree, start/end date.
   *                            position                      {Object}    -   Position information such as companyName and title.
   *
   *                 thirdPartyCredentials {Object}  optional - Credentials from 3rd party service providers if signup came from a third party
   *                                                            (Eg: Sign up with Facebook)
  **/

  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,
      educationData;

    //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;
    }

    //Populate profile prefill data
    if (data.basicProfileFormPrefillData) {
      educationData = data.basicProfileFormPrefillData.education;
      if (educationData) {
        var educationStartDate = LI.NuxUtil.hashMap({
          "year": educationData.schoolStartYear
        });
        var educationEndDate = LI.NuxUtil.hashMap({
          "year": educationData.schoolEndYear
        });
        educationData.start = educationStartDate.data;
        educationData.end = educationEndDate.data;
      }
    }

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

    //Add maidenName if exists
    reqData.addIfNotEmpty('maidenName', data.maidenName);

    //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);

    //Add profile prefill data
    reqData.addIfNotEmpty('basicProfileFormPrefillData', data.basicProfileFormPrefillData);

    //Add third party credential data
    reqData.addIfNotEmpty('thirdPartyCredentials', data.thirdPartyCredentials);

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

    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 w(a){a=a||!1;E||(E=f.find(c.JOIN_BTN));E.prop(U.DISABLED,a)}function x(a){r||(r=$(c.LOADER));a?r.fadeIn?r.fadeIn():r.removeClass(p.HIDDEN):r.fadeOut?r.fadeOut():r.addClass(p.HIDDEN)}function V(a){window.dust.render(s.MOBILE_CHALLENGE,{},function(b,c){b||(B.append(c),M(a),q.hide())})}function W(a){F=new LI.ModalDialogBox($(null),{width:540,dustContentTemplate:s.CHALLENGE,dustContentTemplateData:{challengeUrl:a},title:u.getStaticString(t.SECURITY_VERIFICATION,s.CHALLENGE),
decorators:["scripts/shared/Dialog/AjaxDustTemplateLoading"]});F.open().then(_.bind(M,this,a))}function M(a){if(window.app.isMobileWeb)$(c.CHALLENGE_IFRAME).on("load",function(){var a=$(c.CHALLENGE_IFRAME)[0];X($(a.contentWindow?a.contentWindow.document:a.contentDocument?a.contentDocument:a.document))});$(c.CHALLENGE_IFRAME).attr("src",a)}function Y(){var a=$(this);return!(!a.width()&&!a.height())&&"none"!==a.css("display")}function X(a){var b=$(c.CHALLENGE_CONT),m=/Safari/.test(navigator.userAgent)&&
/Apple Computer/.test(navigator.vendor);b.length&&(B.addClass(p.UNO_CHALLENGE),a.find(c.CHALLENGE_PAGE_REDUNDANT_SECTIONS).hide(),m&&(a.on(N.TOUCHEND,function(b){$(b.target).is("select,button,a")||a.find(c.SUBMIT_BUTTON).filter(Y).eq(0).focus()}),a.find(c.CHALLENGE_FORM_FIELDS).on("focus",function(b){setTimeout(function(){window.scrollTo(0,45+a.find(c.DESCRIPTOR_TEXT).height())},200)})))}function O(a,b){var c=b?a.errorFields:a.validatedFields,e,k,f={},n=c.length;for(k=0;k<n;k++)e=c[k],f[e.name]=e.name===
d.FIELD_NAME_PASSWORD?"":e.value,b&&(f[e.name+"_errors"]=e.errors.join(","));window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:b?g.VALIDATION_FAILURE:g.JOIN_REQUEST,customData:f})}function Z(a,b){var c=a.responseJSON||{},e=c.translatedMessage||u.getStaticString(t.ERROR_MESSAGE_REQUEST,s.JOIN_FORM);window.app.alert.inject({message:e,node:y});w(!1);x(!1);window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,
trackingCode:g.JOIN_REQUEST_FAILURE,customData:{errorMessage:c.debugMessage||e}})}function aa(a,b,m){b=!0;m="on"===f.attr(c.ATTR_CHECK_EMAIL);a.memberUrn?(m&&(b=!0===a.isFastImportEmailDomain),a=LI.NuxUtil.getPageKey()+"-"+g.TRK_CODE_URL_JOIN_NOW,b=window.play.url({alias:b?"com.linkedin.uno.onboarding.OnboardingWebController.editProfile":"com.linkedin.uno.onboarding.OnboardingWebController.abiStandalone"}),b=window.play.addQueryParameter(b,LI.UnoTracking.TRK_PARAM,a),window.location.href=b):a.challenge&&
(b=window.play.addQueryParameter(a.challenge.url,A.CALLBACK_PARAM_NAME,A.CALLBACK_METHOD_NAME),b=window.play.addQueryParameter(b,A.FUA_PARAM_NAME,A.FUA_PARAM_VALUE),w(!1),x(!1),window.app.isMobileWeb?V(b):W(b),window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:g.SHOW_CHALLENGE}),z.submissionId=a.submissionId,z.challengeToken&&(z.challengeToken=""))}function P(){x(!0);LI.Account.create({data:z,callback:aa,errorCallback:Z})}function ba(a){var b;
a.errorFields&&a.errorFields.length&&(b=a.errorFields[0],a=LI.NuxUtil.format(t.FORM_ERROR_FORMAT,b.errors[0],b.name.toLowerCase()),a=LI.NuxUtil.htmlUnencode(u.getStaticString(a,s.JOIN_FORM)),window.app.alert.inject({message:a,node:y,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:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:g.DISMISS_VALIDATION_ERROR,customData:a})}}))}
function ca(a){if(a.passed){w(!0);var b=a.validatedFields,m,e,k,g,n,h={},p={};e=0;for(k=b.length;e<k;e++)if(m=b[e],g=m.name,n=m.value,g===d.FIELD_NAME_REAL_NAME){try{p=window.ZhUtils.getFirstAndLastName(n),h[d.FIELD_NAME_FIRST_NAME]=p.firstName,h[d.FIELD_NAME_LAST_NAME]=p.lastName}catch(q){window.app.logger.error("Error splitting Chinese name for value: "+n,q)}h[d.FIELD_NAME_FOREIGN_NAME]=f.find(c.FOREIGN_NAME).val()}else h[m.name]=n;b=f.find(c.POST_ONBOARDING_REDIRECT_URL);b.length&&(h.redirectInfo=
{postOnboardingRedirectUrl:b.val()});m=f.find(c.SHARED_KEY);b=f.find(c.INVITATION_ID);m.length&&b.length&&(h.invitationInfo={invitationId:b.val(),sharedKey:m.val()});if(l===Q.PREFILL_DESKTOP||l===Q.PREFILL_MOBILE)n=LI.NuxUtil.getQueryParams(),b=n.schoolId||"",m=LI.NuxUtil.getUrnFromId(b,LI.NuxUtil.URN_TYPE.SCHOOL),e=n.startYear||"",k=n.endYear||"",g=n.degree||"",n=n.fieldOfStudy||"",h.basicProfileFormPrefillData={},b&&(h.basicProfileFormPrefillData.education={schoolUrn:m,schoolStartYear:e,schoolEndYear:k,
degree:g,fieldOfStudy:n});C&&(h.basicProfileFormPrefillData?h.basicProfileFormPrefillData.position=C:h.basicProfileFormPrefillData={position:C});D&&(h.basicProfileFormPrefillData?h.basicProfileFormPrefillData.location=D:h.basicProfileFormPrefillData={location:D});v||(v={$clientTS:f.find(c.CLIENT_TS),$clientR:f.find(c.CLIENT_R),$clientOutput:f.find(c.CLIENT_OUTPUT),$clientN:f.find(c.CLIENT_N),$clientV:f.find(c.CLIENT_V)});b={requestId:v.$clientR.val(),clientOutput:v.$clientOutput.val(),nonce:v.$clientN.val(),
clientTimestampParamValue:v.$clientTS.val(),jsVersion:v.$clientV.val()};h.botDetectionData=b;b={};G&&(b.thirdPartyProvider=G);H&&(b.gaapTaskId=H);b.isEmpty||(h.thirdPartyCredentials=b);z=h;P();O(a,!1);window.app.alert.remove(y)}else ba(a),O(a,!0)}function da(a){var b,c=[];a=a.val();b=a.length;a&&$.trim(a).length||c.push(LI.FormValidator.RULES.REQUIRED);window.ZhUtils.isChineseCharString(a)||c.push(LI.FormValidator.RULES.CHARACTERS);(b<d.MIN_LENGTH_REAL_NAME||b>d.MAX_LENGTH_REAL_NAME)&&c.push(LI.FormValidator.RULES.SIZE);
return c}function I(a){a=LI.NuxUtil.format(c.LABEL,a.attr("id"));return f.find(a)}function ea(a){var b=a.results.identificationData,m=b.FIRST_NAME,e=b.LAST_NAME,k=b.EMAIL,b=b.POSITION,d=f.find(c.FIRST_NAME),n=f.find(c.LAST_NAME),h=f.find(c.JOIN_EMAIL),l={};m&&(d.val(m),d.removeClass(p.ERROR),I(d).addClass(p.SHOW),l.prefilledFirstName=m);e&&(n.val(e),n.removeClass(p.ERROR),I(n).addClass(p.SHOW),l.prefilledLastName=e);k&&(h.val(k),h.removeClass(p.ERROR),I(h).addClass(p.SHOW),l.prefilledEmail=k);b&&
(C=b);a.win.close();$(c.FB_BTN_CONTAINER).fadeOut("fast");$(c.JOIN_BTN).text(u.getStaticString(t.CONTINUE,s.JOIN_FORM));R(S.FACEBOOK,t.SUCCESS_MESSAGE_FACEBOOK,g.FACEBOOK_SUCCESS,l,!0)}function R(a,b,c,e,d){G=a;d&&window.app.alert.inject({message:u.getStaticString(b,s.JOIN_FORM),type:LI.UnoAlert.TYPE.SUCCESS,node:y});w(!1);x(!1);window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:c,customData:e})}function T(a,b,c){a=u.getStaticString(a,s.JOIN_FORM);
c&&window.app.alert.inject({message:a,node:y});w(!1);x(!1);window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:b,customData:{errorMessage:a}})}function fa(a){a.win.close();J(!1)}function ga(a){a.win.close();J(!1)}function ha(a){}function J(a){T(t.ERROR_MESSAGE_FACEBOOK,a?g.GAAP_ERROR:g.FACEBOOK_ERROR,!0)}var B,q,f,E,y,r,l,v,F,z,u,K,L,H,G,C,D,g,A={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_FOREIGN_NAME:"maidenName",FIELD_NAME_REAL_NAME:"realName",FIELD_NAME_EMAIL:"emailAddress",FIELD_NAME_PASSWORD:"password",MAX_LENGTH_EMAIL:128,MAX_LENGTH_FIRST_NAME:20,MAX_LENGTH_LAST_NAME:40,MAX_LENGTH_REAL_NAME:4,MIN_LENGTH_EMAIL:3,MIN_LENGTH_FIRST_NAME:1,MIN_LENGTH_LAST_NAME:1,MIN_LENGTH_REAL_NAME:2,MIN_LENGTH_PASSWORD:6},p={ANIMATE:"animate",
ERROR:"error",HIDDEN:"hidden",SHOW:"show",UNO_CHALLENGE:"uno-challenge"},N={FOCUS:"focus",KEYUP:"keyup",TOUCHEND:"touchend"},t={ERROR_MESSAGE_REQUEST:"error_message_request",ERROR_MESSAGE_FACEBOOK:"error_message_facebook",ERROR_MESSAGE_WECHAT:"error_message_wechat",SUCCESS_MESSAGE_FACEBOOK:"success_message_facebook",SUCCESS_MESSAGE_WECHAT:"success_message_wechat",CONTINUE:"continue",FORM_ERROR_FORMAT:"error_message_{0}_{1}",SECURITY_VERIFICATION:"security_verification"},Q={PREFILL_DESKTOP:"uno-reg-join-prefill",
PREFILL_MOBILE:"uno-reg-join-prefill-mobile"},U={DISABLED:"disabled"},S={FACEBOOK:"FACEBOOK",WECHAT:"WECHAT"},c={ALERTS_CONT:".alerts-cont",BODY:"body",CAPTCHA_PAGE:".page",CHALLENGE_CONT:".challenge-container",CHALLENGE_IFRAME:".challenge-iframe",CHALLENGE_FORM_FIELDS:"input,select",CHALLENGE_PAGE_REDUNDANT_SECTIONS:".page-header, .logo_container",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",DESCRIPTOR_TEXT:".descriptor-text",FB_BTN:".fb-btn",FB_BTN_CONTAINER:".fb-btn-container",FOREIGN_NAME:"#foreign-name",FIRST_NAME:"#first-name",INVITATION_ID:"#invitation-id",INVITER_NAME:".inviter .inviter-name",INVITER_HEADLINE:".inviter .inviter-headline",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",REAL_NAME:"#real-name",SHARED_KEY:"#shared-key",URL_MAP:"#urlMap",ATTR_CHECK_EMAIL:"data-li-check-email"},s={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[A.CALLBACK_METHOD_NAME]=function(a){w(!0);
window.app.isMobileWeb?(B.removeClass(p.UNO_CHALLENGE),$(c.CHALLENGE_CONT).remove(),q.show()):F.close();z.challengeToken=a;window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:g.CHALLENGE_SUCCESS});P()};window.unoRegGaapTaskCompleteCallback=function(a){H=a};window.unoRegGaapTaskFailedCallback=function(){J(!0)};B=$(c.BODY);q=$(c.CONTAINER);f=q.find(c.JOIN_FORM);y=q.find(c.ALERTS_CONT);l=LI.NuxUtil.getPageKey();g=LI.UnoTracking.TRACKING_CODES.JOIN_PAGE;
u=new window.t8.Resources(window.dust.i18n,window.dust);L=LI.NuxUtil.getEmbeddedContent("langData");K=LI.NuxUtil.getEmbeddedContent("urlMap");(function(){var a=[{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]}}],b;b=L&&L.isChinaFlow?!0:!1;new LI.FormValidator(f,{validateOnSubmit:!0,errorClass:p.ERROR,
fields:(b?[{name:d.FIELD_NAME_REAL_NAME,selector:c.REAL_NAME,rules:{test:da}}]:[{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]}}]).concat(a),removeErrorOn:N.KEYUP,callback:ca})})();(function(){var a=$(c.FB_BTN);a.length&&LI.Genie&&(new LI.Genie(a,{url:a.data("genie-url"),useNewGenie:!0,onAllow:ea,
onDeny:fa,onError:ga,onClose:ha,scope:null}),a.click(function(){window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:g.FACEBOOK_ATTEMPT})}))})();(function(){var a;LI.NuxUtil.getEmbeddedContent("changeDocumentDomain")&&(a=document.domain.replace("www.",""),document.domain=a)})();K.analyticsNoauthSecureUrl&&LI.JSBeacon.sendRequest(K.analyticsNoauthSecureUrl);(function(){var a=f.find(c.INVITATION_ID);a.length&&(a={invitationId:a.val(),inviterFullName:q.find(c.INVITER_NAME).text(),
inviterHeadline:q.find(c.INVITER_HEADLINE).text(),prefilledFirstName:q.find(c.FIRST_NAME).val(),prefilledLastName:q.find(c.LAST_NAME).val(),prefilledEmail:q.find(c.JOIN_EMAIL).val()},window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.VIEW,trackingCode:g.WARM_REG_CONTEXT_INFO,customData:a}));$(c.FB_BTN_CONTAINER).length&&window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.VIEW,trackingCode:g.FACEBOOK_IMPRESSION})})();this.handleWeChatPrefill=
function(a){var b=a.firstName,d=a.lastName,e=d+b,k=f.find(c.REAL_NAME),q={};b&&(d&&k.length)&&(k.val(e),k.removeClass(p.ERROR),LI.FloatLabel&&k.trigger(LI.FloatLabel.EVENT.CUSTOM_SHOW_LABEL,[k]),q.prefilledRealName=e,window.app.track.entityActivityEvent({pageKey:l,activityType:LI.UnoTracking.ACTIVITY_TYPE.CLICK,trackingCode:g.WECHAT_EXTRACT_NAME}));a.location&&(D=a.location);R(S.WECHAT,t.SUCCESS_MESSAGE_WECHAT,g.WECHAT_SUCCESS,q,!1)};this.handleWeChatFailure=function(){T(t.ERROR_MESSAGE_WECHAT,g.WECHAT_ERROR,
!0)};this.showLoader=x}})();$(document).ready(function(){window.app=new LI.UnoApp;window.joinView=new LI.JoinView});