(self.webpackChunkacademia_app=self.webpackChunkacademia_app||[]).push([[4935],{16926:function(e,t,s){"use strict";s.d(t,{H:function(){return i},R:function(){return n}});const n=()=>{const e="apple-jssdk";if(document.getElementById(e))return;const t=document.getElementsByTagName("script")[0],s=document.createElement("script");s.id=e,s.src="proxy.php?u=//appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",t.parentNode.insertBefore(s,t)},i=()=>{(()=>{const e="facebook-jssdk";if(window.FB||document.getElementById(e))return;const t=document.getElementsByTagName("script")[0],s=document.createElement("script");s.id=e,s.src="proxy.php?u=//connect.facebook.net/en_US/sdk.js",t.parentNode.insertBefore(s,t)})(),(()=>{const e="google-jssdk";if(document.getElementById(e))return;const t=document.createElement("script");t.id=e,t.async=!0,t.onload=loadGoogle,t.src="proxy.php?u=https://accounts.google.com/gsi/client";const s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)})(),n()}},19300:function(e,t,s){"use strict";s.d(t,{q:function(){return A},c:function(){return j}});var n,i=s(23167),o=s(75683),r=s.n(o);void 0===(n=i.A).fn.each2&&n.fn.extend({each2:function(e){for(var t=n([0]),s=-1,i=this.length;++s=112&&e<=123}};a=e(document),o=function(){var e=1;return function(){return e++}}(),a.on("mousemove",(function(e){c.x=e.pageX,c.y=e.pageY})),s=P(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(s){var n,i,r,a,h,d,p,f,b,y=".select2-results";this.opts=s=this.prepareOpts(s),this.id=s.id,s.element.data("select2")!==t&&null!==s.element.data("select2")&&s.element.data("select2").destroy(),s.useExistingInput?this.container=this.createContainerForExistingInput():this.container=this.createContainer(),this.containerId="s2id_"+(s.element.attr("id")||"autogen"+o()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=(r=function(){return s.element.closest("body")},h=!1,function(){return!1===h&&(a=r(),h=!0),a}),s.useExistingInput||w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.css(x(s.containerCss)),this.container.addClass(x(s.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),s.useExistingInput?(this.container.insertBefore(this.opts.element),this.container.prepend(this.opts.element),this.opts.element.addClass("select2-input").attr("autocomplete","off").attr("autocorrect","off").attr("autocapitalize","off").attr("spellcheck",!1)):this.opts.element.attr("tabindex","-1").before(this.container),this.opts.element.data("select2",this),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),this.dropdown.addClass(x(s.dropdownCssClass)),this.dropdown.data("select2",this),this.results=n=this.container.find(y),this.search=i=this.container.find("input.select2-input"),this.resultsPage=0,this.context=null,this.initContainer(),this.results.on("mousemove",(function(s){var n=c;n!==t&&n.x===s.pageX&&n.y===s.pageY||e(s.target).trigger("mousemove-filtered",s)})),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",y,this.bind(this.highlightUnderEvent)),f=this.results,b=g(80,(function(e){f.trigger("scroll-debounced",e)})),f.on("scroll",(function(e){u(e.target,f.get())>=0&&b(e)})),this.dropdown.on("scroll-debounced",y,this.bind(this.loadMoreIfNeeded)),e(this.container).on("change",".select2-input",(function(e){e.stopPropagation()})),e(this.dropdown).on("change",".select2-input",(function(e){e.stopPropagation()})),e.fn.mousewheel&&n.mousewheel((function(e,t,s,i){var o=n.scrollTop();i>0&&o-i<=0?(n.scrollTop(0),v(e)):i<0&&n.get(0).scrollHeight-n.scrollTop()+i<=n.height()&&(n.scrollTop(n.get(0).scrollHeight-n.height()),v(e))})),m(i),i.on("keyup-change input paste",this.bind(this.updateResults)),i.on("focus",(function(){i.addClass("select2-focused")})),i.on("blur",(function(){i.removeClass("select2-focused")})),this.dropdown.on("mouseup",y,this.bind((function(t){e(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))}))),this.dropdown.on("click mouseup mousedown",(function(e){e.stopPropagation()})),e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==s.maximumInputLength&&this.search.attr("maxlength",s.maximumInputLength),(d=s.element.prop("disabled"))===t&&(d=!1),this.enable(!d),(p=s.element.prop("readonly"))===t&&(p=!1),this.readonly(p),l=l||function(){var t=e("
");t.appendTo("body");var s={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};return t.remove(),s}(),this.autofocus=s.element.prop("autofocus"),s.element.prop("autofocus",!1),this.autofocus&&this.focus()},destroy:function(){var e=this.opts.element,s=e.data("select2");this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),s!==t&&(s.container.remove(),s.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show())},createContainerForExistingInput:function(){return e(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["
"," ","
"].join(""))},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:d(e.attr("locked"),"locked")||d(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(s){var n,i,o,r,a=this;if("select"===(n=s.element).get(0).tagName.toLowerCase()&&(this.select=i=s.element),i&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],(function(){if(this in s)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
"," "," ","
"].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var t,s,n;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.search.focus(),(t=this.search.get(0)).createTextRange?((s=t.createTextRange()).collapse(!1),s.select()):t.setSelectionRange&&(n=this.search.val().length,t.setSelectionRange(n,n)),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},initContainer:function(){var t,s=this.container,n=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=s.find(".select2-choice"),this.focusser=s.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+o()),e("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind((function(e){if(this.isInterfaceEnabled())if(e.which!==h.PAGE_UP&&e.which!==h.PAGE_DOWN)switch(e.which){case h.UP:case h.DOWN:return this.moveHighlight(e.which===h.UP?-1:1),void v(e);case h.ENTER:return this.selectHighlighted(),void v(e);case h.TAB:return void this.selectHighlighted({noFocus:!0});case h.ESC:return this.cancel(e),void v(e)}else v(e)}))),this.search.on("blur",this.bind((function(e){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind((function(){this.search.focus()})),0)}))),this.focusser.on("keydown",this.bind((function(e){if(this.isInterfaceEnabled()&&e.which!==h.TAB&&!h.isControl(e)&&!h.isFunctionKey(e)&&e.which!==h.ESC){if(!1!==this.opts.openOnEnter||e.which!==h.ENTER){if(e.which==h.DOWN||e.which==h.UP||e.which==h.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void v(e)}return e.which==h.DELETE||e.which==h.BACKSPACE?(this.opts.allowClear&&this.clear(),void v(e)):void 0}v(e)}}))),m(this.focusser),this.focusser.on("keyup-change input",this.bind((function(e){if(this.opts.minimumResultsForSearch>=0){if(e.stopPropagation(),this.opened())return;this.open()}}))),t.on("mousedown","abbr",this.bind((function(e){var t;this.isInterfaceEnabled()&&(this.clear(),(t=e).preventDefault(),t.stopImmediatePropagation(),this.close(),this.selection.focus())}))),t.on("mousedown",this.bind((function(t){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),v(t)}))),n.on("mousedown",this.bind((function(){this.search.focus()}))),t.on("focus",this.bind((function(e){v(e)}))),this.focusser.on("focus",this.bind((function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")}))).on("blur",this.bind((function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(e.Event("select2-blur")))}))),this.search.on("focus",this.bind((function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active")}))),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var t=this.selection.data("select2-data");if(t){var s=this.getPlaceholderOption();this.opts.element.val(s?s.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==e&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection([]),this.close(),this.setPlaceholder();else{var e=this;this.opts.initSelection.call(null,this.opts.element,(function(s){s!==t&&null!==s&&(e.updateSelection(s),e.close(),e.setPlaceholder())}))}},isPlaceholderOptionSelected:function(){var e;return(e=this.getPlaceholderOption())!==t&&e.is(":selected")||""===this.opts.element.val()||this.opts.element.val()===t||null===this.opts.element.val()},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),s=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var n=e.find(":selected");t(s.optionToData(n))}:"data"in t&&(t.initSelection=t.initSelection||function(s,n){var i=s.val(),o=null;t.query({matcher:function(e,s,n){var r=d(i,t.id(n));return r&&(o=n),r},callback:e.isFunction(n)?function(){n(o)}:e.noop})}),t},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===t?t:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,s){var n=0,i=this;if(this.findHighlightableChoices().each2((function(e,t){if(d(i.id(t.data("select2-data")),i.opts.element.val()))return n=e,!1})),!1!==s&&(!0===t&&n>=0?this.highlight(n):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;o>=0&&this.showSearch(k(e.results)>=o)}},showSearch:function(t){this.showSearchInput!==t&&(this.showSearchInput=t,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t),e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t))},onSelect:function(e,t){if(this.triggerSelect(e)){var s=this.opts.element.val(),n=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.close(),t&&t.noFocus||this.selection.focus(),d(s,this.id(e))||this.triggerChange({added:e,removed:n})}},updateSelection:function(e){var s,n,i=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),i.empty(),(s=this.opts.formatSelection(e,i,this.opts.escapeMarkup))!==t&&i.append(s),(n=this.opts.formatSelectionCssClass(e,i))!==t&&i.addClass(n),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,s=!1,n=null,i=this,o=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],arguments.length>1&&(s=arguments[1]),this.select)this.select.val(e).find(":selected").each2((function(e,t){return n=i.optionToData(t),!1})),this.updateSelection(n),this.setPlaceholder(),s&&this.triggerChange({added:n,removed:o});else{if(!e&&0!==e)return void this.clear(s);if(this.opts.initSelection===t)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,(function(e){i.opts.element.val(e?i.id(e):""),i.updateSelection(e),i.setPlaceholder(),s&&i.triggerChange({added:e,removed:o})}))}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e,s){var n;if(0===arguments.length)return(n=this.selection.data("select2-data"))==t&&(n=null),n;e&&""!==e?(n=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),s&&this.triggerChange({added:e,removed:n})):this.clear(s)}}),i=P(s,{createContainer:function(){return e(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["","
"," ","
"].join(""))},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),s=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(e,t){var n=[];e.find(":selected").each2((function(e,t){n.push(s.optionToData(t))})),t(n)}:"data"in t&&(t.initSelection=t.initSelection||function(s,n){var i=p(s.val(),t.separator),o=[];t.query({matcher:function(s,n,r){var a=e.grep(i,(function(e){return d(e,t.id(r))})).length;return a&&o.push(r),a},callback:e.isFunction(n)?function(){for(var e=[],s=0;s0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.open(),this.focusSearch(),t.preventDefault()))}))),this.container.on("focus",s,this.bind((function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())}))),this.initContainerWidth(),this.opts.useExistingInput||this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var e=this;this.opts.initSelection.call(null,this.opts.element,(function(s){s!==t&&null!==s&&(e.updateSelection(s),e.close(),e.clearSearch())}))}},clearSearch:function(){if(!this.opts.useExistingInput){var e=this.getPlaceholder(),s=this.getMaxSearchWidth();e===t||0!==this.getVal().length&&!this.opts.forcePlaceholder||!1!==this.search.hasClass("select2-focused")?(this.search.val(""),this.searchWidthTen()):(this.search.val(e).addClass("select2-default"),this.search.width(s>0?s:this.container.css("width")))}},searchWidthTen:function(){this.opts.useExistingInput||this.search.width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(e.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var s=[],n=[],i=this;e(t).each((function(){u(i.id(this),s)<0&&(s.push(i.id(this)),n.push(this))})),t=n,this.selection.find(".select2-search-choice").remove(),e(t).each((function(){i.addSelectedChoice(this)})),i.postprocessResults()},tokenize:function(){var e=this.search.val();null!=(e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts))&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e,t){this.triggerSelect(e)&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),!this.select&&this.opts.closeOnSelect||this.postprocessResults(),this.opts.closeOnSelect?(this.close(),this.searchWidthTen()):this.countSelectableResults()>0?(this.searchWidthTen(),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.searchWidthTen()),this.triggerChange({added:e}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(s){var n,i,o=!s.locked,r=e("
  • "),a=e("
  • "),l=o?r:a,c=this.id(s),h=this.getVal();(n=this.opts.formatSelection(s,l.find("div"),this.opts.escapeMarkup))!=t&&l.find("div").replaceWith("
    "+n+"
    "),(i=this.opts.formatSelectionCssClass(s,l.find("div")))!=t&&l.addClass(i),o&&l.find(".select2-search-choice-close").on("mousedown",v).on("click dblclick",this.bind((function(t){this.isInterfaceEnabled()&&(e(t.target).closest(".select2-search-choice").fadeOut("fast",this.bind((function(){this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()}))).dequeue(),v(t))}))).on("focus",this.bind((function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))}))),l.data("select2-data",s),l.insertBefore(this.searchContainer),h.push(c),this.setVal(h)},unselect:function(e){var t,s,n=this.getVal();if(0===(e=e.closest(".select2-search-choice")).length)throw"Invalid argument: "+e+". Must be .select2-search-choice";(t=e.data("select2-data"))&&((s=u(this.id(t),n))>=0&&(n.splice(s,1),this.setVal(n),this.select&&this.postprocessResults()),e.remove(),this.opts.element.trigger({type:"removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))},postprocessResults:function(e,t,s){var n=this.getVal(),i=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),r=this;i.each2((function(e,t){u(r.id(t.data("select2-data")),n)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))})),o.each2((function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")})),-1==this.highlight()&&!1!==s&&r.highlight(0),!this.opts.createSearchChoice&&!i.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&E(r.opts.formatNoMatches,"formatNoMatches")&&this.results.append("
  • "+r.opts.formatNoMatches(r.search.val())+"
  • ")},getMaxSearchWidth:function(){return this.selection.width()-f(this.search)},resizeSearch:function(){if(!this.opts.useExistingInput){var t,s,n,i,o=f(this.search);t=function(t){if(!r){var s=t[0].currentStyle||window.getComputedStyle(t[0],null);(r=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:s.fontSize,fontFamily:s.fontFamily,fontStyle:s.fontStyle,fontWeight:s.fontWeight,letterSpacing:s.letterSpacing,textTransform:s.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),e("body").append(r)}return r.text(t.val()),r.width()}(this.search)+10,s=this.search.offset().left,(i=(n=this.selection.width())-(s-this.selection.offset().left)-o). Attach to instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var t=[],s=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each((function(){t.push(s.opts.id(e(this).data("select2-data")))})),this.setVal(t),this.triggerChange()},data:function(t,s){var n,i,o=this;if(0===arguments.length)return this.selection.find(".select2-search-choice").map((function(){return e(this).data("select2-data")})).get();i=this.data(),t||(t=[]),n=e.map(t,(function(e){return o.opts.id(e)})),this.setVal(n),this.updateSelection(t),this.clearSearch(),s&&this.triggerChange(this.buildChangeDetails(i,this.data()))}}),e.fn.select2=function(){var s,o,r,a,l,c=Array.prototype.slice.call(arguments,0),h=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","readonly","positionDropdown","data","search"],d=["val","opened","isFocused","container","data"],p={search:"externalSearch"};return this.each((function(){if(0===c.length||"object"==typeof c[0])(s=0===c.length?{}:e.extend({},c[0])).element=e(this),"select"===s.element.get(0).tagName.toLowerCase()?l=s.element.prop("multiple"):s.useExistingInput?(s.multiple||s.maximumSelectionSize||(s.maximumSelectionSize=1),l=s.multiple=!0):(l=s.multiple||!1,"tags"in s&&(s.multiple=l=!0)),(o=l?new i:new n).init(s);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(u(c[0],h)<0)throw"Unknown method: "+c[0];if(a=t,(o=e(this).data("select2"))===t)return;if("container"===(r=c[0])?a=o.container:"dropdown"===r?a=o.dropdown:(p[r]&&(r=p[r]),a=o[r].apply(o,c.slice(1))),u(c[0],d)>=0)return!1}})),a===t?this:a},e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,s,n){var i=[];return b(e.text,s.term,i,n),i.join("")},formatSelection:function(e,s,n){return e?n(e.text):t},sortResults:function(e,t,s){return e},formatResultCssClass:function(e){return t},formatSelectionCssClass:function(e,s){return t},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(e,t){var s=t-e.length;return"Please enter "+s+" more character"+(1==s?"":"s")},formatInputTooLong:function(e,t){var s=e.length-t;return"Please delete "+s+" character"+(1==s?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(e){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e.id},matcher:function(e,t){return(""+t).toUpperCase().indexOf((""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:function(e,s,n,i){var o,r,a,l,c,h=e,u=!1;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return t;for(;;){for(r=-1,a=0,l=i.tokenSeparators.length;a=0));a++);if(r<0)break;if(o=e.substring(0,r),e=e.substring(r+c.length),o.length>0&&(o=i.createSearchChoice.call(this,o,s))!==t&&null!==o&&i.id(o)!==t&&null!==i.id(o)){for(u=!1,a=0,l=s.length;a"),s.push(n(e.substring(i,i+o))),s.push(""),s.push(n(e.substring(i+o,e.length))))}function y(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,(function(e){return t[e]}))}function _(s){var n,i=0,o=null,r=s.quietMillis||100,a=s.url,l=this;return function(c){window.clearTimeout(n),n=window.setTimeout((function(){var n=i+=1,r=s.data,h=a,u=s.transport||e.fn.select2.ajaxDefaults.transport,d={type:s.type||"GET",cache:s.cache||!1,jsonpCallback:s.jsonpCallback||t,dataType:s.dataType||"json"},p=e.extend({},e.fn.select2.ajaxDefaults.params,d);r=r?r.call(l,c.term,c.page,c.context):null,h="function"==typeof h?h.call(l,c.term,c.page,c.context):h,o&&o.abort(),s.params&&(e.isFunction(s.params)?e.extend(p,s.params.call(l)):e.extend(p,s.params)),e.extend(p,{url:h,dataType:s.dataType,data:r,success:function(e){if(!(n{this.exiting||(this.exiting=!0,this.showPrompt())})),this.ui.$input.focus((()=>this.showPrompt()))}onImageLoad(e){return(0,i.A)("").attr("src",this.imagePath).on("load",e)}showOnLoadPopover(){return this.ui.$input.popover({template:m["core_post_webpack/sitewide_business_elements/navbar/templates/paper_search_popover_bootstrap_template"](),content:m["core_post_webpack/sitewide_business_elements/navbar/templates/paper_search_popover"]({imagePath:this.imagePath}),placement:"bottom",container:"body",html:!0,sanitize:!1}).popover("show"),this.onLoadSearchPopover=new OnLoadSearchPopover({el:(0,i.A)(".js-NavSearch-bootstrapPopover"),popoverContainer:this.ui.$input})}initializeSelect2(){return this.ui.$input.select2({useExistingInput:!0,closeOnSelect:!0,minimumInputLength:3,matcher(e,t){return!0},delay:250,dropdownCssClass:"js-SiteSearch-results SiteSearch-results bootstrap DesignSystem",formatResult:(e,t,s,n)=>this.formatResult(e),formatSelection:(e,t,s)=>this.redirectToResult(e),formatNoMatches:()=>this.formatNoMatches(),formatInputTooShort:()=>this.formatPrompt(),formatSearching:()=>this.formatSearching(),ajax:{url:"/ac_search",dataType:"json",quietMillis:500,data(e,t){return{q:e,limit:20}},results(e,t){return e}}})}preventOverflow(){if((0,i.A)(".js-PremiumIconContainerHoverWrapper").length>0)return this.ui.$input.addClass("hasPremiumIcon")}addOpenStyles(){return this.$el.addClass("SiteSearch--open"),this.addDropdownArrow()}removeOpenStyles(){return this.$el.removeClass("SiteSearch--open"),this.removeDropdownArrow()}redirectToResult(e){return $a.track_single_request({typeahead_hit:!0}),"Query"===e.type?this.$el.submit():window.location.href=e.entity_url}formatResult(e){return this.addViewAllButton(),m["core_post_webpack/sitewide_business_elements/navbar/templates/search_result"]({result:e})}formatPrompt(){if(this.suggestions){const e=this.suggestions.map((e=>`${e}`));return this.removeViewAllButton(),`
    \n Looking for something else?\n ${e.join("")}\n
    `}return this.formatStatusMessage("Type to search for Papers, People, Research Interests, Universities, Videos, and Courses")}formatNoMatches(){return this.formatStatusMessage('  No matches found')}formatSearching(){return this.formatStatusMessage('  Searching...')}formatStatusMessage(e){return this.removeViewAllButton(),`
    ${e}
    `}preventDefault(e){if(!e.isTrigger)return e.preventDefault()}showPrompt(){return this.ui.$input.select2("open"),this.onFocusPopoverShown=!0,null!=this.onLoadSearchPopover?this.onLoadSearchPopover.hide():void 0}addDropdownArrow(){return(0,i.A)(".js-SiteSearch-results").append('')}removeDropdownArrow(){return(0,i.A)(".js-SiteSearch-dropdownArrow.DropdownArrow").remove()}addViewAllButton(){const e=(0,i.A)(".js-SiteSearch-results");if(!(e.find(".js-SiteSearch-results-viewAll").length>0))return e.append(m["core_post_webpack/sitewide_business_elements/navbar/templates/view_all_button"]()),e.find(".js-SiteSearch-results-viewAll").click((e=>((0,i.A)(e.currentTarget).html(''),(0,i.A)("").attr("type","hidden").attr("name","nbs").attr("value","view").appendTo(this.$el),this.$el.submit())))}removeViewAllButton(){return(0,i.A)(".js-SiteSearch-results-viewAll").parent().remove()}updateMirroredQuery(e){const t=`Papers matching "${e.target.value}"`;return(0,i.A)(".js-Search-mirroredQuery").text(t)}}g.initClass();var v=s(25521),w=s(89657),b=s(16926),y=s(54539),_=s(7173),C=s(95370),S=s(76387),E=Object.defineProperty,x=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,T=(e,t,s)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,O=(e,t)=>{for(var s in t||(t={}))k.call(t,s)&&T(e,s,t[s]);if(x)for(var s of x(t))P.call(t,s)&&T(e,s,t[s]);return e};const A=({pageName:e,clickTrackingContext:t,loginModalText:s,registrationParams:n,postLoginRedirectUrl:i,forcePostLoginRedirectUrl:o})=>{const r=document.querySelectorAll(".react-login-modal-opener");"true"===window.userInChina?(0,b.R)():(0,b.H)();const a=document.getElementById("react-modal"),l="react-login-modal",c={id:l,clickTrackingContext:t,configuredText:s,registrationParams:O(O({},{user_source:"download",terms_shown:!0}),n),postLoginRedirectUrl:i,forcePostLoginRedirectUrl:o};S.render((0,C.createElement)(w.z,c),a);const h=document.getElementById(l);r.forEach((s=>{s.addEventListener("click",(n=>{n.preventDefault();const o=JSON.parse(s.getAttribute("data-signup-modal"));if((0,y.M)(O({source:`${e}--${o.location}`},t)),document.querySelector("[name='csrf-token']")||_.A.get("masked_csrf_token"))h.showModal();else{const e=i?encodeURIComponent(i):null;"string"==typeof o.location&&o.location.startsWith("signup")?window.location.href=e?v.default.signup_url({post_login_redirect_url:e,post_signup_redirect_url:e,modal_fallback:"true"}):v.default.signup_url({modal_fallback:"true"}):window.location.href=e?v.default.login_path({post_login_redirect_url:e,modal_fallback:"true"}):v.default.login_path({modal_fallback:"true"})}}))}))},j=()=>{var e;const t=document.querySelector(".js-header-dropdown-expand-button"),s=document.querySelector(".js-header-dropdown-collapse-button"),n=document.querySelector(".js-header-hamburger-button"),i=document.querySelector(".js-header-dropdown");null==n||n.addEventListener("click",(e=>{e.preventDefault(),null==i||i.classList.toggle("expanded")})),null==t||t.addEventListener("click",(e=>{e.preventDefault(),t.classList.toggle("hide"),null==i||i.classList.toggle("fully-expanded")})),null==s||s.addEventListener("click",(e=>{e.preventDefault(),null==t||t.classList.toggle("hide"),null==i||i.classList.toggle("fully-expanded")}));const o=v.default.login_url({post_login_redirect_url:encodeURIComponent(window.location.href)});null==(e=document.querySelector(".js-header-login-url"))||e.setAttribute("href",o),new g({el:".js-SiteSearch-form"})}},24784:function(e,t){"use strict";t.A={cls1:"Spinner-cls1_VDP",cls2:"Spinner-cls2__84 Spinner-cls1_VDP","rotate-spinner":"Spinner-rotate-spinner_AOU"}},29008:function(e,t,s){s(21676),e.exports=function(e){return""+''}},31899:function(e,t,s){s(21676),e.exports=function(e){return""+''}},36731:function(){},37673:function(e,t,s){"use strict";s.d(t,{OP:function(){return i},aO:function(){return n},yA:function(){return o}});const n=(e,t=!1)=>{("production"!==window.$rails_env||t)&&console.log(e)},i=(e,t=!1)=>{("production"!==window.$rails_env||t)&&console.warn(e)},o=(e,t=!1)=>{("production"!==window.$rails_env||t)&&console.error(e)}},39205:function(e,t,s){"use strict";s.d(t,{c:function(){return n}});const n=/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/},39735:function(e,t,s){"use strict";s.d(t,{U:function(){return b},w:function(){return v}});var n=s(52764),i=s(33761),o=s(25521),r=s(74689),a=Object.defineProperty,l=Object.defineProperties,c=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,p=(e,t,s)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;function f(e,t){const s=e.filter((e=>e.name===t));if(0!==s.length)return s.reduce(((e,t)=>t.value>e.value?t:e))}const m=/\/webpack_bundles\/js\/([\w_-]+)(\.wjs)?-[0-9a-f]{20}\.js$/;function g(){var e,t;const s=window.performance.getEntriesByType("resource").map((e=>{var t,s,n;return s=((e,t)=>{for(var s in t||(t={}))u.call(t,s)&&p(e,s,t[s]);if(h)for(var s of h(t))d.call(t,s)&&p(e,s,t[s]);return e})({},e.toJSON()),n={bundleName:null==(t=m.exec(e.name))?void 0:t[1]},l(s,c(n))})).filter((e=>"string"==typeof e.bundleName));return{firstBundleStartTime:null==(e=s[0])?void 0:e.startTime,lastBundleEndTime:null==(t=s[s.length-1])?void 0:t.responseEnd,bundleTimings:s.map((e=>({name:e.bundleName,duration:e.duration,startTime:e.startTime,transferSize:e.transferSize})))}}const v=e=>{const t=o.default.api_v0_record_cwv_path({subdomain_param:"api"}),s=new Set,a=e=>{s.add(e)},l=!i.currentUser;(0,n.IN)(a),(0,n.fK)(a),(0,n.Ck)(a),(0,n.rH)(a),function(e){const t=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",t))};document.addEventListener("visibilitychange",t),document.addEventListener("pagehide",e)}((()=>{var n,i,o,a,c,h;if(0===s.size)return;const u=Array.from(s),d={data:u.map((({name:e,value:t})=>({name:e,value:t}))),bundleData:g(),loggedOut:l,page:`${window.$controller_name}:${window.$action_name}`},p=f(u,"LCP");d.lcpElementRenderDelay=null==(n=null==p?void 0:p.attribution)?void 0:n.elementRenderDelay,d.lcpResourceLoadDelay=null==(i=null==p?void 0:p.attribution)?void 0:i.resourceLoadDelay,d.lcpResourceLoadDuration=null==(o=null==p?void 0:p.attribution)?void 0:o.resourceLoadDuration,d.lcpElement=null==(a=null==p?void 0:p.attribution)?void 0:a.target;const m=f(u,"TTFB");d.ttfbConnectDuration=null==(c=null==m?void 0:m.attribution)?void 0:c.connectionDuration,d.ttfbRequestDuration=null==(h=null==m?void 0:m.attribution)?void 0:h.requestDuration,null!=e?d.abTestBucket=e:null!=window.cwvAbTestBucket&&(d.abTestBucket=window.cwvAbTestBucket);const v=function(){const e=[];return window.performance.getEntriesByType("navigation").forEach((t=>{t.serverTiming&&t.serverTiming.forEach((t=>{e.push({name:t.name,duration:t.duration||0})}))})),e}();v.length>0&&(d.serverTiming=v),(0,r.A)(t,d)}))};let w=null;const b=()=>w||(w=new Promise((e=>{(0,n.fK)((()=>{e()}));const t=()=>{e(),window.removeEventListener("scroll",t)};window.addEventListener("scroll",t,{passive:!0})})),w)},57546:function(e,t,s){"use strict";s.d(t,{t:function(){return l}});var n=s(7173),i=s(80414),o=s(69241),r=s(37673),a=(e,t,s)=>new Promise(((n,i)=>{var o=e=>{try{a(s.next(e))}catch(e){i(e)}},r=e=>{try{a(s.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,r);a((s=s.apply(e,t)).next())}));const l=(...e)=>a(void 0,[...e],(function*(e=!1,t=document.referrer){var s;return window.Aedu=null!=(s=window.Aedu)?s:{},yield new Promise((e=>{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>e()),{once:!0}):setTimeout(e,0)})),c(e,t)})),c=(e,t)=>a(void 0,null,(function*(){h(),yield u(e,t),n.A.set("from_cache","")})),h=()=>{const e="auvid",t=n.A.get(e);if(t)window.$auvid=t;else{const t=btoa((new Date).getTime()+":"+Math.random()),s=window.location.hostname.match(/(?:www\.)?(.*)/);n.A.set(e,t,{path:"/",expires:30,domain:"."+s}),window.$auvid=t}},u=(e,t)=>a(void 0,null,(function*(){if(!e&&window.Aedu.hit_data)return;const s=e,n=yield(0,o.f)({url:window.location.href,referrer:t,request_id:(0,i.R)()},s);null!==n&&(window.Aedu.hit_data=n,n.auvid!==window.$auvid&&(0,r.aO)("Unexpected auvid mismatch: client="+window.$auvid+" & server="+n.auvid))}))},67822:function(e,t,s){var n=s(21676);e.exports=function(e){var t,s="",i=e||{};return function(e,i){s=s+'
    Looking for a paper?
    Search '+n.escape(null==(t=e.SiteStats.paper_count_in_millions)?"":t)+' million full-text papers
    Remind Me Later
    '}.call(this,"Aedu"in i?i.Aedu:"undefined"!=typeof Aedu?Aedu:void 0,"imagePath"in i?i.imagePath:"undefined"!=typeof imagePath?imagePath:void 0),s}},69241:function(e,t,s){"use strict";s.d(t,{f:function(){return r}});var n=s(14536),i=s(80414),o=(e,t,s)=>new Promise(((n,i)=>{var o=e=>{try{a(s.next(e))}catch(e){i(e)}},r=e=>{try{a(s.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,r);a((s=s.apply(e,t)).next())}));function r(e,t=!1){return o(this,null,(function*(){if($disableClientRecordHit&&!t)return Promise.resolve(null);const s=new URLSearchParams;for(const t in e){const n=e[t];n&&s.set(t,n)}const o=(0,i.R)();o&&s.set("request_id",o);const r=yield(0,n.A)(`/record_hit?${s.toString()}`,{method:"POST"});return r.ok?r.json():Promise.reject(r.statusText)}))}},69562:function(e,t,s){"use strict";s.d(t,{i:function(){return i}});var n=s(95370);function i(){return(0,n.useMemo)((()=>Date.now().toString(36)+Math.random().toString(36).slice(2)),[])}},80414:function(e,t,s){"use strict";s.d(t,{R:function(){return n}});const n=function(){const e=document.cookie.match("(^|; )request_id=([^;]*)"),t=e&&e[2];if(t)return decodeURIComponent(t)}},82903:function(e,t,s){"use strict";s.d(t,{t:function(){return c}});var n=s(36691),i=s.n(n),o=s(65772),r=s.n(o),a=s(25521),l=s(74689);function c(){const e=window.Aedu&&window.Aedu.hit_data&&window.Aedu.hit_data.id;if(!e)return!1;let t=new Date;try{const s=window.sessionStorage.getItem(`${e}:duration`);if(s){const e=parseInt(s,10);isNaN(e)||(t=new Date(Date.now()-e))}}catch(e){}i().initialize({idleTimeoutInSeconds:60,initialStartTime:t}),i().stopTimer();let s=window.innerHeight;function n(t){var n;const o=a.default.api_v0_record_page_activity_path({subdomain_param:"api"}),r=Math.round((null==(n=document.scrollingElement)?void 0:n.scrollHeight)||document.body.scrollHeight),c=Math.min(Math.round(s),r),h={hit_id:e,duration_ms:Math.round(i().getTimeOnCurrentPageInMilliseconds())||0,scroll_distance:c,scroll_distance_limit:r,source_event:t};window.sessionStorage.setItem(`${e}:duration`,String(h.duration_ms)),(0,l.A)(o,h)}window.addEventListener("scroll",r()((()=>{window.scrollY>s&&(s=window.scrollY+window.innerHeight)}),500),{passive:!0}),window.addEventListener("load",(()=>{"visible"===document.visibilityState&&document.hasFocus()&&i().startTimer()})),window.addEventListener("visibilitychange",(e=>{"visible"===document.visibilityState?i().startTimer():"hidden"===document.visibilityState&&n(e.type)})),window.addEventListener("pagehide",(e=>{n(e.type)})),n("bundleload")}},89657:function(e,t,s){"use strict";s.d(t,{z:function(){return Ut}});var n=s(95370),i=s(62502),o=s(62280),r=s(98109),a=s(12327),l=Object.defineProperty,c=Object.defineProperties,h=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,f=(e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,m=(e,t)=>{for(var s in t||(t={}))d.call(t,s)&&f(e,s,t[s]);if(u)for(var s of u(t))p.call(t,s)&&f(e,s,t[s]);return e},g=(e,t)=>c(e,h(t));const v=(0,o.Ay)(a.D,null,{displayName:"TitleText",styles:{cls1:"common-cls1_Lef",cls2:"common-cls2_Kk0 common-cls1_Lef"},attrs:e=>g(m({},e),{size:"md",fontFamily:"serif"})}),w=(0,o.Ay)(r.n,null,{displayName:"BodyText",styles:{cls1:"common-cls1__A4",cls2:"common-cls2_ewT common-cls1__A4"},attrs:e=>g(m({},e),{size:"xl",fontFamily:"sans-serif"})}),b=(0,o.Ay)(r.n,null,{displayName:"BodyTextSmall",styles:{cls1:"common-cls1_ydQ",cls2:"common-cls2__wY common-cls1_ydQ"},attrs:e=>g(m({},e),{size:"sm",fontFamily:"sans-serif"})});var y,_=s(17193),C=s(14536),S=s(25521),E=s(54539),x=s(37673),k=s(5447),P=Object.defineProperty,T=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,j=(e,t,s)=>t in e?P(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,I=(e,t)=>{for(var s in t||(t={}))O.call(t,s)&&j(e,s,t[s]);if(T)for(var s of T(t))A.call(t,s)&&j(e,s,t[s]);return e},L=(e,t,s)=>new Promise(((n,i)=>{var o=e=>{try{a(s.next(e))}catch(e){i(e)}},r=e=>{try{a(s.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,r);a((s=s.apply(e,t)).next())}));const R=e=>{let t="";for(let s=0;s{const t=e,{onAttempt:s,onAuthorized:i,onSuccess:o,onError:r,disabled:a,setLoading:l,clickTrackingContext:c,buttonText:h,registrationParams:u}=t,d=((e,t)=>{var s={};for(var n in e)O.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&T)for(var n of T(e))t.indexOf(n)<0&&A.call(e,n)&&(s[n]=e[n]);return s})(t,["onAttempt","onAuthorized","onSuccess","onError","disabled","setLoading","clickTrackingContext","buttonText","registrationParams"]),p=(0,n.useCallback)((()=>L(void 0,null,(function*(){var e;if(!a)try{s&&s(),l(!0),(0,E.M)(I({source:"login_modal_apple_oauth_button"},c)),yield L(void 0,null,(function*(){var e,t;!N&&(null==(e=window.loginModal)?void 0:e.appleClientId)&&(N=null==(t=window.loginModal)?void 0:t.appleClientId),yield window.AppleID.auth.init({clientId:N,scope:M,redirectURI:D,state:R(32)})}));const t=yield L(void 0,null,(function*(){try{return yield window.AppleID.auth.signIn({clientId:N,redirectURI:D,scope:M,state:"state",usePopup:!0})}catch(e){console.error(e)}}));i&&i();const n=I({provider:"apple",code:null==t?void 0:t.authorization.code,id_token:null==t?void 0:t.authorization.id_token,user:null==t?void 0:t.user,apple_web_sign_in:!0},u),a=yield(0,C.A)(S.default.api_v0_register_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),h=yield a.json();if(h.success)o&&o(h.redirect);else if(h.redirect)window.location.href=h.redirect;else if("account_already_exists"===h.error_codes[0]){const s={provider:"Apple",email_was_taken:!0};(null==(e=null==t?void 0:t.user)?void 0:e.email)&&(s.login=t.user.email),window.location.href=S.default.login_path(s)}else h.errors["user[first_name]"]||h.errors["user[last_name]"]?r({errorMessage:"Your Apple account is missing a first or last name. Please add one to your Apple account and try again, or use a different login method."}):h.error_codes?r({errorCodes:h.error_codes}):r()}catch(e){(0,x.yA)(e),l(!1)}}))),[a,s,l,c,i,u,o,r]);return n.createElement(_.$,I({secondary:!0,onClick:p,disabled:a},d),n.createElement("img",{src:(0,k.b8)("apple/apple-black.svg")}),h)};var F=s(94012),z=Object.defineProperty,$=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,W=(e,t,s)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,q=(e,t)=>{for(var s in t||(t={}))U.call(t,s)&&W(e,s,t[s]);if($)for(var s of $(t))H.call(t,s)&&W(e,s,t[s]);return e};const V=e=>{const t=e,{onClick:s,disabled:i,buttonText:o}=t,r=((e,t)=>{var s={};for(var n in e)U.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&$)for(var n of $(e))t.indexOf(n)<0&&H.call(e,n)&&(s[n]=e[n]);return s})(t,["onClick","disabled","buttonText"]),a="true"===window.userInChina,l=q({onClick:i?()=>{}:s,disabled:i,children:o},r);return a?n.createElement(_.$,q({},l)):n.createElement(F.Q,q({icon:"email"},l))};var G=s(23167),K=Object.defineProperty,Y=(e,t,s)=>(((e,t,s)=>{t in e?K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s})(e,"symbol"!=typeof t?t+"":t,s),s);function J(e){const t=G.A.Deferred();return e.then((e=>t.resolve(e))).catch((e=>t.reject(e))),t}const Q=new class{constructor(){Y(this,"scopes",["email","user_friends","public_profile","user_link"].join(",")),Y(this,"isReady",!1),Y(this,"readyListeners",[]),Y(this,"connectedUrl","/auth/connect"),Y(this,"disconnectedUrl","/auth/disconnect")}runReadyListeners(){let e;for(this.isReady=!0;e=this.readyListeners.shift();)e()}queueForExecution(e){this.isReady&&e(),this.readyListeners.push(e)}authorize(e=!1){return new Promise(((t,s)=>{const n={scope:this.scopes,return_scopes:!0};e&&(n.auth_type="rerequest"),this.queueForExecution((()=>{FB.login((e=>{this.loginPromiseResolver(e,t,s)}),n)}))}))}$authorize(e=!1){return J(this.authorize(e))}getLoginStatus(e){this.queueForExecution((()=>FB.getLoginStatus(e)))}checkLoginStatus(){return new Promise(((e,t)=>{this.getLoginStatus((s=>{this.loginPromiseResolver(s,e,t)}))}))}$check_login_status(){return J(this.checkLoginStatus())}checkPermissionsGranted(e){return new Promise((t=>{FB.api("/me/permissions",(s=>{if(s&&!s.error){const n=e.every((e=>null!=s.data.find((t=>t.permission===e&&"granted"===t.status))));t(n)}else t(!1)}))}))}$check_permissions_granted(e){return J(this.checkPermissionsGranted(e))}$register_connected(e){return G.A.post(this.connectedUrl,{provider:"facebook",uid:e.userID,"oauth[token]":e.accessToken,"oauth[expires]":e.expiresIn,"oauth[scopes]":e.grantedScopes})}deregister_connected_and_reload(){FB.login((e=>{e.authResponse&&FB.api("/me/permissions","delete",{},(()=>{G.A.post(this.disconnectedUrl,{provider:"facebook"},(()=>{window.location.reload()}))}))}))}loginPromiseResolver(e,t,s){e.authResponse?FB.api("/me/permissions",(n=>{n&&!n.error&&n.data.find((e=>"email"===e.permission&&"granted"===e.status))?t(e.authResponse):(FB.api("/me/permissions","delete",{},(()=>{})),s(n.error))})):s()}};window.Facebook=Q,window.academiaAuthReadyFacebook?(Q.runReadyListeners(),delete window.academiaAuthReadyFacebook):window.InitFacebook=Q.runReadyListeners.bind(Q);var Z=Q,X=Object.defineProperty,ee=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ie=(e,t)=>{for(var s in t||(t={}))te.call(t,s)&&ne(e,s,t[s]);if(ee)for(var s of ee(t))se.call(t,s)&&ne(e,s,t[s]);return e};const oe=e=>{const t=e,{onAttempt:s,onAuthorized:i,onSuccess:o,onError:r,disabled:a,setLoading:l,clickTrackingContext:c,buttonText:h,registrationParams:u,onClick:d}=t,p=((e,t)=>{var s={};for(var n in e)te.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&ee)for(var n of ee(e))t.indexOf(n)<0&&se.call(e,n)&&(s[n]=e[n]);return s})(t,["onAttempt","onAuthorized","onSuccess","onError","disabled","setLoading","clickTrackingContext","buttonText","registrationParams","onClick"]),f=(0,n.useCallback)((()=>{return e=function*(){if(!a)try{s&&s(),l(!0),(0,E.M)(ie({source:"login_modal_facebook_oauth_button"},c));const e=yield Z.authorize();i&&i();const t=ie({provider:"facebook",oauth:{token:e.accessToken,expires:e.expiresIn,scopes:e.grantedScopes}},u),n=yield(0,C.A)(S.default.api_v0_register_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=yield n.json();a.success?o&&o(a.redirect):a.redirect?window.location.href=a.redirect:a.errors["user[first_name]"]||a.errors["user[last_name]"]?r({errorMessage:"Your Facebook account is missing a first or last name. Please add one to your Facebook account and try again, or use a different login method."}):a.error_codes?r({errorCodes:a.error_codes}):r()}catch(e){(0,x.yA)(e),l(!1),r&&r()}},new Promise(((t,s)=>{var n=t=>{try{o(e.next(t))}catch(e){s(e)}},i=t=>{try{o(e.throw(t))}catch(e){s(e)}},o=e=>e.done?t(e.value):Promise.resolve(e.value).then(n,i);o((e=e.apply(undefined,null)).next())}));var e}),[a,s,l,c,i,u,o,r]);return n.createElement(_.$,ie({secondary:!0,onClick:d||f,disabled:a},p),n.createElement("img",{src:(0,k.b8)("facebook/facebook-color-transparent-bg-2.svg")}),h)};var re=s(80538),ae=Object.defineProperty,le=(e,t,s)=>(((e,t,s)=>{t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s})(e,"symbol"!=typeof t?t+"":t,s),s);const ce=class e{constructor(){le(this,"DISCONNECT_API_URL","https://accounts.google.com/o/oauth2/revoke?token="),le(this,"DISCONNECTED_URL","auth/disconnect"),le(this,"CONNECTED_URL","auth/connect"),le(this,"client"),le(this,"error"),le(this,"authResponse"),le(this,"deferred",G.A.Deferred()),le(this,"init",(e=>{(0,G.A)(document).ready(this.initTokenClient.bind(this,e))})),le(this,"setTokenClient",(e=>{this.client=e})),le(this,"handleError",(e=>{re.M("GoogleSigninError",{error_type:e.type,error_details:e.message}),this.deferred.reject({error:e.name,details:e.message||"Unknown error, please try again."})}))}initTokenClient(e){const t=google.accounts.oauth2.initTokenClient({client_id:e,scope:this.scope(),callback:this.handleCredentialResponse.bind(this),prompt:"",error_callback:this.handleError.bind(this)});this.setTokenClient(t)}authorize(){return this.deferred=G.A.Deferred(),this.client?this.authResponse?this.deferred.resolve(this.authResponse):this.client.requestAccessToken():(re.M("GoogleSigninError",{error_type:"initialization_error"}),this.deferred.reject({error:"Error setting up Google Authentication",details:"Please refresh the page and try again"})),this.deferred}scope(){return e.scopes}disconnectAndReload(){return this.authorize().done((e=>(google.accounts.oauth2.revoke(e.access_token,(()=>{})),G.A.post(this.DISCONNECTED_URL,{provider:"google","oauth[token]":e.access_token,"oauth[expires]":e.expires_in},(()=>window.location.reload())))))}handleCredentialResponse(e){e.error&&this.deferred.reject({error:e.error,details:e.error_description||"Unknown error, please try again."}),this.deferred.resolve(e)}};le(ce,"scopes",["openid","profile","email","https://www.googleapis.com/auth/userinfo.profile"].join(" "));const he=new ce;window.Google=he,window.GoogleClientID?he.init(window.GoogleClientID):window.InitGoogle=he.init;var ue=he,de=Object.defineProperty,pe=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,ge=(e,t,s)=>t in e?de(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ve=(e,t)=>{for(var s in t||(t={}))fe.call(t,s)&&ge(e,s,t[s]);if(pe)for(var s of pe(t))me.call(t,s)&&ge(e,s,t[s]);return e};const we=e=>{const t=e,{onAttempt:s,onAuthorized:i,onSuccess:o,onError:r,disabled:a,setLoading:l,clickTrackingContext:c,buttonText:h,registrationParams:u}=t,d=((e,t)=>{var s={};for(var n in e)fe.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&pe)for(var n of pe(e))t.indexOf(n)<0&&me.call(e,n)&&(s[n]=e[n]);return s})(t,["onAttempt","onAuthorized","onSuccess","onError","disabled","setLoading","clickTrackingContext","buttonText","registrationParams"]),p=(0,n.useCallback)((()=>{return e=function*(){if(!a)try{s&&s(),l(!0),(0,E.M)(ve({source:"login_modal_google_oauth_button"},c));const e=yield ue.authorize();i&&i();const t=ve({provider:"google",oauth:{token:e.access_token,expires:e.expires_in,scopes:e.scope}},u),n=yield(0,C.A)(S.default.api_v0_register_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=yield n.json();a.success?o&&o(a.redirect):a.redirect?window.location.href=a.redirect:a.errors["user[first_name]"]||a.errors["user[last_name]"]?r({errorMessage:"Your Google account is missing a first or last name. \nPlease add one to your Google account and try again, or use a different login method."}):a.error_codes?r({errorCodes:a.error_codes}):r()}catch(e){(0,x.yA)(e),r()}},new Promise(((t,s)=>{var n=t=>{try{o(e.next(t))}catch(e){s(e)}},i=t=>{try{o(e.throw(t))}catch(e){s(e)}},o=e=>e.done?t(e.value):Promise.resolve(e.value).then(n,i);o((e=e.apply(undefined,null)).next())}));var e}),[a,s,l,c,i,u,o,r]);return n.createElement(_.$,ve({secondary:!0,onClick:p,disabled:a},d),n.createElement("img",{src:(0,k.b8)("google/google-color-transparent-bg-2.svg")}),h)},be=(0,o.Ay)("div",null,{displayName:"SpacerDiv",styles:{cls1:"VerticalSpacer-cls1_t9h",cls2:"VerticalSpacer-cls2_ceP VerticalSpacer-cls1_t9h"}}),ye=({height:e})=>n.createElement(be,{style:{height:e}});var _e=s(13877),Ce=Object.defineProperty,Se=Object.defineProperties,Ee=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,Te=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const Oe=(0,o.Ay)(r.n,null,{displayName:"ErrorDiv",styles:{cls1:"ModalError-cls1_i7V",cls2:"ModalError-cls2__Iu ModalError-cls1_i7V"},attrs:e=>{return t=((e,t)=>{for(var s in t||(t={}))ke.call(t,s)&&Te(e,s,t[s]);if(xe)for(var s of xe(t))Pe.call(t,s)&&Te(e,s,t[s]);return e})({},e),Se(t,Ee({size:"sm"}));var t}}),Ae=(0,o.Ay)("div",null,{displayName:"IconDiv",styles:{cls1:"ModalError-cls1_VjV",cls2:"ModalError-cls2__GT ModalError-cls1_VjV"}}),je=({show:e=!0,errorMessage:t})=>e?n.createElement(n.Fragment,null,n.createElement(ye,{height:32}),n.createElement(Oe,null,n.createElement(Ae,null,n.createElement(_e.A,null)),null!=t?t:"Something went wrong. Please try again.")):n.createElement(n.Fragment,null),Ie=(0,o.Ay)("div",null,{displayName:"ButtonStyleContext",styles:{cls1:"ButtonsPage-cls1_Ibt",cls2:"ButtonsPage-cls2_MJs ButtonsPage-cls1_Ibt",show:"ButtonsPage-show_fL_"}}),Le="ButtonsPage-margins__I8",Re=(0,o.Ay)(v,null,{displayName:"StyledTitleText",styles:{cls1:"ButtonsPage-cls1_JTi",cls2:"ButtonsPage-cls2_PYU ButtonsPage-cls1_JTi",withThumbnail:"ButtonsPage-withThumbnail_xCE"}}),De=e=>{const{onAttempt:t,onSuccess:s,onError:i,loading:o,setLoading:r,errorMessage:a,onEmailButtonClick:l,show:c,clickTrackingContext:h,text:u,registrationParams:d,setPage:p}=e,f="true"===window.userInChina,m="true"===window.facebookLoginDisabled;return n.createElement(Ie,{show:c},n.createElement(Re,null,u.header),n.createElement(w,null,u.subheader),n.createElement(je,{errorMessage:a,show:Boolean(a)}),n.createElement(ye,{height:32}),n.createElement(b,null,"By clicking Continue, you agree to our"," ",n.createElement("a",{href:S.default.terms_path()},"Terms of Use")," and"," ",n.createElement("a",{href:S.default.privacy_path()},"Privacy Policy")),n.createElement(ye,{height:16}),!f&&n.createElement(we,{onAttempt:t,onError:i,onSuccess:s,disabled:o,className:Le,setLoading:r,clickTrackingContext:h,buttonText:u.googleButton,registrationParams:d}),n.createElement(B,{onAttempt:t,onError:i,onSuccess:s,disabled:o,className:Le,setLoading:r,clickTrackingContext:h,buttonText:u.appleButton,registrationParams:d}),!f&&(m?n.createElement(oe,{onClick:()=>{m&&p("facebook-disabled")},onError:i,onSuccess:s,disabled:o,className:Le,setLoading:r,clickTrackingContext:h,buttonText:u.facebookButton,registrationParams:d}):n.createElement(oe,{onAttempt:t,onError:i,onSuccess:s,disabled:o,className:Le,setLoading:r,clickTrackingContext:h,buttonText:u.facebookButton,registrationParams:d})),n.createElement(V,{onClick:l,disabled:o,className:Le,buttonText:u.emailButton}))};var Ne=s(39205),Me=s(17649),Be=s(79394);const Fe=(0,o.Ay)("button",null,{displayName:"StyledButton",styles:{cls1:"BackButton-cls1__di",cls2:"BackButton-cls2_n35 BackButton-cls1__di"}}),ze=({onClick:e})=>{const t=(0,n.useCallback)((t=>{return s=function*(){t.preventDefault(),e()},new Promise(((e,t)=>{var n=e=>{try{o(s.next(e))}catch(e){t(e)}},i=e=>{try{o(s.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(n,i);o((s=s.apply(undefined,null)).next())}));var s}),[e]);return n.createElement(Fe,{onClick:t,"aria-label":"Back",type:"button"},n.createElement(Be.I,{name:"arrow_back",size:24}))},$e=(0,o.Ay)("div",null,{displayName:"NewLine",styles:{cls1:"NewLine-cls1_Z1L",cls2:"NewLine-cls2__JF NewLine-cls1_Z1L"}}),Ue=(0,o.Ay)("div",null,{displayName:"ParentDiv",styles:{cls1:"CenteredDiv-cls1_CQT",cls2:"CenteredDiv-cls2_R32 CenteredDiv-cls1_CQT"}}),He=(0,o.Ay)("div",null,{displayName:"ChildDiv",styles:{cls1:"CenteredDiv-cls1_SZo",cls2:"CenteredDiv-cls2_DYN CenteredDiv-cls1_SZo"}}),We=e=>n.createElement(Ue,null,n.createElement(He,null,e.children));var qe=Object.defineProperty,Ve=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,Ye=(e,t,s)=>t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Je=(e,t)=>{for(var s in t||(t={}))Ge.call(t,s)&&Ye(e,s,t[s]);if(Ve)for(var s of Ve(t))Ke.call(t,s)&&Ye(e,s,t[s]);return e};const Qe=e=>{const{setPage:t,setUserEmail:s,setUserFirstName:i,show:o,clickTrackingContext:r,text:a}=e,l=(0,n.useRef)(null),[c,h]=(0,n.useState)("");(0,n.useEffect)((()=>{o&&l.current&&l.current.focus()}),[o]);const u=(0,n.useCallback)((e=>{return n=function*(){var n,o,a;e.preventDefault(),(0,E.M)(Je({source:"login_modal_email_entry_submit_button"},r));const c=null!=(o=null==(n=l.current)?void 0:n.value.toLowerCase())?o:"";if(!Ne.c.test(c))return void h("Please enter a valid email address.");h("");const u=yield(0,C.A)(S.default.api_v0_has_account_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:c})}),d=yield u.json();u.ok?(s(d.email?d.email:c),d.has_account?(i(null!=(a=d.first_name)?a:""),t("email-login")):t("email-registration")):d.message?h(d.message):h("An error occurred. Please try again later.")},new Promise(((e,t)=>{var s=e=>{try{o(n.next(e))}catch(e){t(e)}},i=e=>{try{o(n.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(s,i);o((n=n.apply(undefined,null)).next())}));var n}),[r,t,s,i]);return n.createElement("div",{style:{display:o?"initial":"none"}},n.createElement(ze,{onClick:()=>{(0,E.M)(Je({source:"login_modal_email_entry_back_button"},r)),t("buttons")}}),n.createElement(v,null,a.header),n.createElement(w,null,a.subheader),n.createElement(ye,{height:40}),n.createElement(Me.p,{label:"Email",name:"email",ref:l,type:"email",autoComplete:"username",placeholder:"name@example.com",required:o,hasError:!!c,errors:c?[c]:[]}),n.createElement($e,null),n.createElement(ye,{height:40}),n.createElement(We,null,n.createElement(_.$,{size:"lg",type:"submit",disabled:!o,iconRight:"arrow_forward",onClick:u},"Next")))};var Ze=Object.defineProperty,Xe=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,st=(e,t,s)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,nt=(e,t)=>{for(var s in t||(t={}))et.call(t,s)&&st(e,s,t[s]);if(Xe)for(var s of Xe(t))tt.call(t,s)&&st(e,s,t[s]);return e};const it=(0,o.Ay)("div",null,{displayName:"FlexDiv",styles:{cls1:"EmailRegistrationPage-cls1_qbO",cls2:"EmailRegistrationPage-cls2_T4X EmailRegistrationPage-cls1_qbO"}}),ot=e=>{const{userEmail:t,onSuccess:s,setPage:i,show:o,setLoading:r,clickTrackingContext:a,text:l,registrationParams:c}=e,[h,u]=(0,n.useState)(!1),d=(0,n.useRef)(null),p=(0,n.useRef)(null),f=(0,n.useRef)(null),[m,g]=(0,n.useState)(""),[b,y]=(0,n.useState)(""),[k,P]=(0,n.useState)(""),T=(0,n.useCallback)((()=>{u(!1),g(""),y(""),P("")}),[]),O=(0,n.useCallback)((e=>{return n=function*(){var n,i,o;e.preventDefault(),T(),r(!0),(0,E.M)(nt({source:"login_modal_email_registration_submit_button"},a));const l=yield(0,C.A)(S.default.api_v0_register_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(nt({user:{first_name:null==(n=d.current)?void 0:n.value,last_name:null==(i=p.current)?void 0:i.value,email:t,password:null==(o=f.current)?void 0:o.value},terms_shown:!0},c))});try{const e=yield l.json();if(e.success)s(e.redirect);else{(0,x.yA)(e),r(!1);let t=!1;e.errors["user[first_name]"]&&(g(e.errors["user[first_name]"]),t=!0),e.errors["user[last_name]"]&&(y(e.errors["user[last_name]"]),t=!0),e.errors["user[password]"]&&(P(e.errors["user[password]"]),t=!0),t||u(!0)}}catch(e){(0,x.yA)(e),r(!1),u(!0)}},new Promise(((e,t)=>{var s=e=>{try{o(n.next(e))}catch(e){t(e)}},i=e=>{try{o(n.throw(e))}catch(e){t(e)}},o=t=>t.done?e(t.value):Promise.resolve(t.value).then(s,i);o((n=n.apply(undefined,null)).next())}));var n}),[T,c,s,r,t,a]);return(0,n.useEffect)((()=>{o&&d.current&&d.current.focus()}),[o]),n.createElement("div",{style:{display:o?"initial":"none"}},n.createElement(ze,{onClick:()=>{(0,E.M)(nt({source:"login_modal_email_registration_back_button"},a)),i("email-entry")}}),n.createElement(v,null,l.header),n.createElement(w,null,l.subheader),n.createElement(je,{show:h}),n.createElement(ye,{height:16}),n.createElement(We,null,n.createElement(w,{style:{fontSize:"12px",textAlign:"center",color:"#666"}},"By clicking Sign Up, you agree to our"," ",n.createElement("a",{href:"/terms",style:{textDecoration:"underline"}},"Terms of Use")," ","and"," ",n.createElement("a",{href:"/privacy",style:{textDecoration:"underline"}},"Privacy Policy"))),n.createElement(ye,{height:16}),n.createElement(it,null,n.createElement(Me.p,{label:"First name",name:"given-name",ref:d,type:"text",autoComplete:"given-name",placeholder:"First name",required:o,hasError:!!m,errors:m?[m]:[]}),n.createElement(Me.p,{label:"Last name",name:"family-name",ref:p,autoComplete:"family-name",placeholder:"Last name",required:o,hasError:!!b,errors:b?[b]:[]})),n.createElement(ye,{height:16}),n.createElement(Me.p,{label:"Password",name:"new-password",ref:f,type:"password",autoComplete:"new-password",placeholder:"Create a password",required:o,hasError:!!k,errors:k?[k]:[]}),n.createElement(ye,{height:40}),n.createElement(We,null,n.createElement(_.$,{size:"lg",type:"submit",disabled:!o,iconRight:"arrow_forward",onClick:O},l.submit)))};var rt=Object.defineProperty,at=Object.defineProperties,lt=Object.getOwnPropertyDescriptors,ct=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,dt=(e,t,s)=>t in e?rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,pt=(e,t)=>{for(var s in t||(t={}))ht.call(t,s)&&dt(e,s,t[s]);if(ct)for(var s of ct(t))ut.call(t,s)&&dt(e,s,t[s]);return e},ft=(e,t,s)=>new Promise(((n,i)=>{var o=e=>{try{a(s.next(e))}catch(e){i(e)}},r=e=>{try{a(s.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(o,r);a((s=s.apply(e,t)).next())}));const mt=(0,o.Ay)(r.n,null,{displayName:"Link",styles:{cls1:"EmailLoginPage-cls1_by2",cls2:"EmailLoginPage-cls2__EW EmailLoginPage-cls1_by2"},attrs:e=>{return t=pt({},e),at(t,lt({size:"sm"}));var t}}),gt="That is not correct. Please try again.",vt="Failed to reset password. Please try again later.",wt=e=>{const{userFirstName:t,userEmail:s,onSuccess:i,setPage:o,setLoading:r,show:a,clickTrackingContext:l,text:c,registrationParams:h}=e,u=(0,n.useRef)(null),[d,p]=(0,n.useState)(""),[f,m]=(0,n.useState)(!1),[g,b]=(0,n.useState)(void 0),y=(0,n.useCallback)((()=>ft(void 0,null,(function*(){m(!1),b(void 0),r(!0),(0,E.M)(pt({source:"login_modal_email_login_reset_password_button"},l));const e=yield(0,C.A)(S.default.api_v0_reset_password_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s})});try{const t=yield e.json();t.success?(r(!1),o("password-reset")):(r(!1),m(!0),b(t.message||vt))}catch(e){r(!1),(0,x.yA)(e),m(!0),b(vt)}}))),[r,l,s,o]),k=(0,n.useCallback)((e=>ft(void 0,null,(function*(){var t,n,o,a;e.preventDefault(),p(""),m(!1),b(void 0),r(!0),null==(t=u.current)||t.setCustomValidity(""),(0,E.M)(pt({source:"login_modal_email_login_submit_button"},l));const c=yield(0,C.A)(S.default.api_v0_login_path({subdomain_param:"api"}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pt({login_email:s,password:null==(n=u.current)?void 0:n.value},h))});try{const e=yield c.json();e.success?i():("Invalid email address or password."===e.message?(p(gt),null==(o=u.current)||o.setCustomValidity(gt),null==(a=u.current)||a.checkValidity()):(429!==c.status&&"Please check your email to verify this login"!==e.message&&"Log in is currently disabled while we undergo important maintenance."!==e.message||b(e.message),(0,x.yA)(e)),m(!0),r(!1))}catch(e){(0,x.yA)(e),m(!0),r(!1)}}))),[l,h,i,r,s]);return(0,n.useEffect)((()=>{a&&u.current&&u.current.focus()}),[a]),n.createElement("div",{style:{display:a?"initial":"none"}},n.createElement(ze,{onClick:()=>{(0,E.M)(pt({source:"login_modal_email_login_back_button"},l)),o("email-entry")}}),n.createElement(v,null,"Hi, ",t),n.createElement(w,null,c.subheader),n.createElement(je,{show:f,errorMessage:g}),n.createElement(ye,{height:32}),n.createElement(Me.p,{label:"Password",name:"current-password",ref:u,type:"password",autoComplete:"current-password",required:a,placeholder:"Your password",hasError:!!d,errors:d?[d]:[]}),n.createElement($e,null),n.createElement(ye,{height:16}),n.createElement(We,null,n.createElement(mt,{onClick:y},"Reset password")),n.createElement(ye,{height:40}),n.createElement(We,null,n.createElement(_.$,{size:"lg",type:"submit",disabled:!a,iconRight:"arrow_forward",onClick:k},"download pdf button"===opener?"Start download":"Log in")))};var bt=Object.defineProperty,yt=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,St=(e,t,s)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const Et=e=>{const{userEmail:t,show:s,setPage:i,modalRef:o,clickTrackingContext:r}=e;return n.createElement("div",{style:{display:s?"initial":"none"}},n.createElement(ze,{onClick:()=>i("email-login")}),n.createElement(v,null,"Password reset"),n.createElement(w,null,"Check your email for your reset link."),n.createElement(ye,{height:40}),n.createElement(b,null,"Your link was sent to ",t),n.createElement(ye,{height:40}),n.createElement(We,null,n.createElement(_.$,{size:"lg",type:"submit",disabled:!s,onClick:()=>{var e;(0,E.M)(((e,t)=>{for(var s in t||(t={}))_t.call(t,s)&&St(e,s,t[s]);if(yt)for(var s of yt(t))Ct.call(t,s)&&St(e,s,t[s]);return e})({source:"login_modal_password_reset_done_button"},r)),null==(e=o.current)||e.close()}},"Done")))};var xt=s(25774);const kt=(0,o.Ay)("div",null,{displayName:"Container",styles:{cls1:"FacebookDisabledPage-cls1_YPA",cls2:"FacebookDisabledPage-cls2_hsg FacebookDisabledPage-cls1_YPA",show:"FacebookDisabledPage-show_xHz"}}),Pt=(0,o.Ay)("div",null,{displayName:"MessageText",styles:{cls1:"FacebookDisabledPage-cls1_h0w",cls2:"FacebookDisabledPage-cls2_VUV FacebookDisabledPage-cls1_h0w"}}),Tt=e=>{const{setPage:t,show:s}=e,i=(0,n.useCallback)((()=>{t("buttons")}),[t]);return n.createElement(kt,{show:s},n.createElement(ze,{onClick:i}),n.createElement(ye,{height:24}),n.createElement(a.D,{size:"md",fontFamily:"serif"},"Facebook login is no longer available"),n.createElement(ye,{height:16}),n.createElement(We,null,n.createElement(Pt,null,n.createElement(r.n,{size:"xl"},"Reset your password to access your account:"),n.createElement(xt.v,{href:"/reset_password"},"Reset Password"))),n.createElement(ye,{height:40}))};var Ot=s(52558);const At=e=>{const{show:t}=e;return n.createElement("div",{style:{display:t?"initial":"none"}},n.createElement(v,null,"Please hold while we log you in"),n.createElement(ye,{height:40}),n.createElement(We,null,n.createElement(Ot.y,null)))};var jt=Object.defineProperty,It=Object.getOwnPropertySymbols,Lt=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable,Dt=(e,t,s)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Nt=(e,t)=>{for(var s in t||(t={}))Lt.call(t,s)&&Dt(e,s,t[s]);if(It)for(var s of It(t))Rt.call(t,s)&&Dt(e,s,t[s]);return e};const Mt={header:"Welcome to Academia",subheader:"Sign up to get access to over 50 million papers",googleButton:"Continue with Google",appleButton:"Continue with Apple",facebookButton:"Continue with Facebook",emailButton:"Continue with Email"},Bt={header:"Continue with Email",subheader:"Sign up or log in to continue."},Ft={header:"Welcome to Academia",subheader:"Sign up to continue.",submit:"Sign Up"},zt={subheader:"Log in to continue."},$t="LoginModal-nogap_nHS",Ut=e=>{const t=e,{postLoginRedirectUrl:s,forcePostLoginRedirectUrl:o,clickTrackingContext:r,onClose:a,open:l,configuredText:c,registrationParams:h,contentComponent:u}=t,d=((e,t)=>{var s={};for(var n in e)Lt.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&It)for(var n of It(e))t.indexOf(n)<0&&Rt.call(e,n)&&(s[n]=e[n]);return s})(t,["postLoginRedirectUrl","forcePostLoginRedirectUrl","clickTrackingContext","onClose","open","configuredText","registrationParams","contentComponent"]),p=u||i.$m,f=(0,n.useRef)(null),[m,g]=(0,n.useState)(!1),[v,w]=(0,n.useState)(null),[b,y]=(0,n.useState)("buttons"),[_,C]=(0,n.useState)(""),[S,x]=(0,n.useState)(""),k=(0,n.useMemo)((()=>({buttonsPage:Nt(Nt({},Mt),null==c?void 0:c.buttonsPage),emailEntryPage:Nt(Nt({},Bt),null==c?void 0:c.emailEntryPage),emailRegistrationPage:Nt(Nt({},Ft),null==c?void 0:c.emailRegistrationPage),emailLoginPage:Nt(Nt({},zt),null==c?void 0:c.emailLoginPage)})),[c]);(0,n.useEffect)((()=>{var e;null==(e=f.current)||e.addEventListener("close",(()=>{(0,E.M)(Nt({source:"login_modal_close"},r))}))}),[r,f]);const P=(0,n.useCallback)((()=>{g(!0),w(null)}),[]),T=(0,n.useCallback)((()=>{var e;null==(e=f.current)||e.close(),a&&a()}),[a]),O=(0,n.useCallback)((e=>{o&&s?window.location.href=s:e?window.location.href=e:s?window.location.href=s:window.location.reload()}),[o,s]),A=(0,n.useCallback)((({errorMessage:e,errorCodes:t}={})=>{if(g(!1),e)w(e);else{let e=["Sorry, something went wrong! We're looking into it now.","Please choose a different login method or try again in a few minutes."].join("\n");t&&(e+=`\n\nError code(s): ${t.join(", ")}`),w(e)}}),[]),j=(0,n.useCallback)((()=>{w(null),(0,E.M)(Nt({source:"login_modal_email_button"},r)),y("email-entry")}),[r]);return n.createElement(i.aF,Nt({ref:f,open:null!=l&&l,onClose:T},d),n.createElement(p,{className:$t},n.createElement(De,{onAttempt:P,onSuccess:O,onError:A,errorMessage:null!=v?v:void 0,loading:m,onEmailButtonClick:j,show:"buttons"===b&&!m,setLoading:g,clickTrackingContext:r,text:k.buttonsPage,registrationParams:h,setPage:y}),n.createElement("form",null,n.createElement(Qe,{setUserEmail:C,setUserFirstName:x,setPage:y,show:"email-entry"===b&&!m,clickTrackingContext:r,text:k.emailEntryPage}),n.createElement(ot,{userEmail:_,onSuccess:O,setPage:y,show:"email-registration"===b&&!m,setLoading:g,clickTrackingContext:r,text:k.emailRegistrationPage,registrationParams:h}),n.createElement(wt,{userFirstName:S,userEmail:_,onSuccess:O,setPage:y,setLoading:g,show:"email-login"===b&&!m,clickTrackingContext:r,text:k.emailLoginPage,registrationParams:h})),n.createElement(Et,{userEmail:_,show:"password-reset"===b&&!m,setPage:y,modalRef:f,clickTrackingContext:r}),n.createElement(Tt,{show:"facebook-disabled"===b&&!m,setPage:y,clickTrackingContext:r}),n.createElement(At,{show:m})))}},92687:function(e,t,s){"use strict";s.d(t,{s:function(){return m}});var n=s(76771),i=s(79235),o=s(31690),r=s(72449),a=s(33761),l=Object.defineProperty,c=Object.defineProperties,h=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,d=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,f=(e,t,s)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;const m=()=>{var e;const t="checkout"===window.$controller_name,s=t?"https://613740b08cff4fa2a45a8fb45906c50c@sentry.io/280993":"https://530c6d33a0de4ebfb124b47975ef405c@sentry.io/27953",l=`${window.$controller_name}#${window.$action_name} ${a.currentUser?"(Logged in)":"(Logged out)"}`;if((0,n.Ts)({dsn:s,debug:!1,release:window.$app_rev,environment:window.$rails_env,sampleRate:t?1:.01,integrations:[(0,i.dp)({beforeStartSpan:e=>{return t=((e,t)=>{for(var s in t||(t={}))d.call(t,s)&&f(e,s,t[s]);if(u)for(var s of u(t))p.call(t,s)&&f(e,s,t[s]);return e})({},e),c(t,h({name:l}));var t}})],tracesSampleRate:.01,ignoreErrors:["/s/fs.js","top.GLOBALS","originalCreateNotification","canvas.contentDocument","MyApp_RemoveAllHighlights","http://tt.epicplay.com","Can't find variable: ZiteReader","jigsaw is not defined","ComboSearch is not defined","http://loading.retry.widdit.com/","atomicFindClose","fb_xd_fragment","bmi_SafeAddOnload","EBCallBackMessageReceived","conduitPage",/ in (?:this|makeError|func|apply|api.setZoom|jQuery)/,"__show__deepen is not defined","Blocked a frame with origin","docs-homescreen-gb-container","Access is denied",/Failed to execute 'removeChild' on 'Node': parameter \d+ is not of type 'Node'/,"fixedTimeID is not defined","Cannot read property 'closingEls' of undefined","Out of memory","Cookies are not enabled","Can't execute code from a freed script"],denyUrls:[/seamless\.js/,/4gen\.js/,/graph\.facebook\.com/i,/connect\.facebook\.net\/en_US\/all\.js/i,/eatdifferent\.com\.woopra-ns\.com/i,/static\.woopra\.com\/js\/woopra\.js/i,/extensions\//i,/^chrome:\/\//i,/127\.0\.0\.1:4001\/isrunning/i,/webappstoolbarba\.texthelp\.com\//i,/metrics\.itunes\.apple\.com\.edgesuite\.net\//i,/kaspersky-labs\.com/i,/adguard\.org/i],allowUrls:[/academia\.edu/,/academia-assets\.com/,/scholarific\.com/,/scholarific-assets\.com/,/devdemia\.com/,/webpack-internal:\/\//],beforeSend(e,t){return console.error(t.originalException||t.syntheticException),function(e){var t,s;if(e.fingerprint=["{{ default }}",a.currentUser?"logged_in":"logged_out"],null!=window.$route_uri_pattern){const n=window.$route_uri_pattern.replace(/\(.:format\)$/,"").replace(/(\(|\))/g,"");null==(s=null==(t=e.exception)?void 0:t.values)||s.forEach((e=>{var t,s;null==(s=null==(t=e.stacktrace)?void 0:t.frames)||s.forEach((e=>{e.filename&&e.filename.includes(window.location.pathname)&&(e.filename=e.filename.replace(window.location.pathname,n))}))}))}}(e),e}}),(0,o.o5)().setTransactionName(l),(0,r.Wt)({controller:window.$controller_name,action:window.$action_name,locale:null==(e=window.I18n)?void 0:e.locale,language:navigator.language}),window.addSentryTags=e=>{(0,r.Wt)(e)},window.sentryTags&&(0,r.Wt)(window.sentryTags),a.currentUser){const{id:e,email:t}=a.currentUser;(0,r.gV)({id:e,email:t})}}},93989:function(e,t,s){var n=s(21676);e.exports=function(e){var t,s="",i=e||{};return function(e){switch(s+='
    ',e.type){case"User":s=s+'";break;case"ResearchInterest":s+='
    ';break;case"University":s+='
    ';break;case"Query":s+='
    '}s+='
    ',"Query"===e.type?s=s+'
    Papers matching "'+n.escape(null==(t=e.display_name)?"":t)+'"
    ':s+=n.escape(null==(t=e.display_name)?"":t),s+="
    ",e.description&&(s=s+'
    '+n.escape(null==(t=e.description)?"":t)+"
    "),s+="
    "}.call(this,"result"in i?i.result:"undefined"!=typeof result?result:void 0),s}}}]); //# sourceMappingURL=4935-c3a403dea9f5c8d3e728.js.map