text: LPVault={},function(e,t,n){var i=Strings.translateString("Folder (a-z)"),o=Strings.translateString("Folder (z-a)"),r=Strings.translateString("Name (a-z)"),s=Strings.translateString("Name (z-a)"),a=Strings.translateString("Most Recent"),l=Strings.translateString("Sender (a-z)"),c=Strings.translateString("Sender (z-a)"),u=Strings.translateString("Recipient (a-z)"),d=Strings.translateString("Recipient (z-a)"),p=[i,o,r,s,a],g=[r,s],m=[r,s,u,d,a],f=[r,s,l,c,a],h=[r,s],P=[r,s],y=function(e){this.options=e};y.prototype.getAddElement=function(){return void 0===this.addElement&&(this.addElement=LPTools.createElement("div","addMenuItem"),this.build(this.addElement,this.options.icon?this.options.icon:"images/vault_4.0/Add.png")),this.addElement},y.prototype.build=function(e,t){e.appendChild(LPTools.createElement("span",null,Strings.Vault[this.options.text]));var n=LPTools.createElement("div"),i=LPTools.createElement("div"),o=LPTools.createElement("img",{src:t});e.appendChild(n),n.appendChild(i),i.appendChild(o),$(e).bind("click",this.options.func)},y.prototype.getMenuElement=function(){return void 0===this.menuElement&&(this.menuElement=LPTools.createElement("li","addMenuItem"),this.build(this.menuElement,this.options.additionalIcon)),this.menuElement};var v={Site:new y({text:"ADD_SITE",icon:"images/vault_4.0/Sites_Active.png",func:function(){t.openSiteDialog({saveOptions:{source:"vault"}})}}),Note:new y({text:"ADD_NOTE",icon:"images/vault_4.0/Notes_Active.png",additionalIcon:"images/vault_4.0/Add_Secure_Note.png",func:function(){t.openNoteDialog({saveOptions:{source:"vault"}})}}),FormFill:new y({text:"ADD_FORM_FILL",icon:"images/vault_4.0/Form_Fills_Active.png",func:function(){t.openFormFillDialog({saveOptions:{source:"vault"}})}}),SharedFolder:new y({text:"ADD_SHARED_FOLDER",func:function(){t.openCreateSharedFolderDialog()}}),Identity:new y({text:"ADD_IDENTITY",func:function(){t.openIdentityDialog()}}),EmergencyAccess:new y({text:"GIVE_EMER_ACCESS",func:function(){dialogs.addEmergencyAccess.open()}}),CreditMonitoring:new y({text:"ADD_CREDIT_MON",func:function(){t.openCreateCreditMonitoringDialog()}}),Folder:new y({text:"ADD_FOLDER",additionalIcon:"images/vault_4.0/Add_Folder.png",func:function(){t.openFolderDialog()}}),ShareItems:new y({text:"SHARE_ITEMS",additionalIcon:"images/vault_4.0/Add_Share.png",func:function(){t.openShareDialog()}})},S=Strings.translateString("search my vault"),E=null,L=$("#advacedOptionsOverlay"),b=$("#inProgressOverlay"),T=$("#tools"),I=$("#options"),C=$("#mainScroll"),_=$("#addMenu"),D=$("#addMenuItems"),A=$("#addMenuButton"),M=$("#addMenuButtonCustom"),w=$("#gridButton"),F=$("#listButton"),O=$("#collapseAllToggle"),k=$("#sizeToggle"),x=$("#orderOption"),R=$("#sortOrderMenu"),B=$("#sortOrderOption"),N=$("#userMenuItems"),G=$("#leftMenuMinimizeButton"),U=$("#moreActions"),z=e.getElementById("contextMenu").parentElement,V=$(e.body),H=$("#advancedMenuItem"),Y=e.getElementById("sortOrderMenu").children[0],q=$("#vaultSearch"),j=$("#userMenuContainer"),W=$("#pageTitle"),K=null,X=null,Q=!0,Z=null,J=null,ee=null,te=function(e,t){ee.getContainer()===t&&(ee.removeBodyState(),ee.addBodyState())},ne=function(e){e=e||{},this.state=e.bodyState,this.menuElement=e.menuElement||null,this.emptyState=this.state+"Empty",this.container=null,this.sortOptions=e.sortOptions||null,this.persistent=LPTools.getOption(e,"persistent",!0),this.searchPlaceholder=LPTools.getOption(e,"searchPlaceholder",S),this.title=e.title||"",this.addMenu=e.addMenu,this.additionalOptionButtons=e.additionalOptionButtons,this.scrollParent=e.scrollParent,this.notificationCount=e.notificationCount,function(t){Topics.get(Topics.CLEAR_DATA).subscribe(function(){t.clear()}),e.menuElement&&e.menuElement.unbind("click.menu").bind("click.menu",function(){t.parent?t.parent.show(t):t.show()})}(this)};!function(){ne.prototype.getElement=function(){return this.menuElement.get(0)},ne.prototype.applyContainerFunction=function(e){var t=this.getContainer();if(null!==t)switch(typeof e){case"string":var n=[];if(arguments.length>1)for(var i=1,o=arguments.length;i<o;++i)n.push(arguments[i]);return t[e].apply(t,n);case"function":return e(t)}},ne.prototype.updateNotificationCount=function(e){var t=0,n=this.menuElement.find(".tabNotification");return void 0!==e?(t=parseInt(n.text()),Be(n,t-e),this.parent&&this.parent.updateNotificationCount(e)):this.notificationCount&&(t=this.notificationCount(),Be(n,t)),t},ne.prototype.getSortOptions=function(){return this.sortOptions},ne.prototype.getContainer=function(){return this.container},ne.prototype.setContainer=function(e,n){this.container=e,e&&(e._buildOptions.stateChangeCallback=te,LPTools.getOption(n,"checkForStateChange",!0)&&ee===this&&te(e.isEmpty(),e),ee===this&&""!==q.val()&&t.search(q.val()))},ne.prototype.openAll=function(){this.applyContainerFunction("openAll")},ne.prototype.collapseAll=function(){this.applyContainerFunction("collapseAll")},ne.prototype.createSelectionContextMenu=function(){return this.applyContainerFunction("createSelectionContextMenu")},ne.prototype.isEmpty=function(){return this.applyContainerFunction("isEmpty")},ne.prototype.search=function(e){var t=this.applyContainerFunction("applySearch",e);e&&null===t&&!this.isEmpty()?V.addClass("searchEmpty"):V.removeClass("searchEmpty")},ne.prototype.clearSelected=function(){this.applyContainerFunction("clearSelected")},ne.prototype.getSelectedItems=function(){return this.applyContainerFunction("getSelectedItems")},ne.prototype.getSortOrder=function(){if(void 0===this.sortOrder){var e=this.sortOptions?this.sortOptions[0]:null;this.sortOrder=LPProxy.getPreference(this.state+"SortOrder",e)}return this.sortOrder},ne.prototype.setSortOrder=function(e){this.sortOrder=e,LPProxy.setPreferences(this.state+"SortOrder",e)},ne.prototype.addBodyState=function(){V.addClass(this.getState());var e=this.getContainer();null!==e&&e.isEmpty()&&0===oneMinuteSignup.getReminderCount()?V.addClass("empty"):V.removeClass("empty"),setTimeout(function(){Topics.get(Topics.EMPTY_VAULT_STATE_CHANGE).publish()},400)},ne.prototype.removeBodyState=function(){V.removeClass(this.emptyState),V.removeClass(this.state)},ne.prototype.hide=function(){if(null!==this.menuElement&&this.menuElement.removeClass("selected"),this.parent&&null!==this.parent.menuElement&&this.parent.menuElement.removeClass("selected"),this.removeBodyState(),this.additionalOptionButtons)for(var e=0,t=this.additionalOptionButtons.length;e<t;++e)this.additionalOptionButtons[e].detach();this.persistent?this.applyContainerFunction("hide"):this.clear()},ne.prototype.getAddMenuItems=function(){var e=[];if(this.addMenu&&this.addMenu.length>0)for(var t=0,n=this.addMenu.length;t<n;++t){var i=this.addMenu[t];(i!==v.ShareItems||LPFeatures.allowIndividualSharing())&&((i!==v.Note||LPFeatures.allowNotes())&&e.push(i))}return e},ne.prototype.show=function(){if(ee!==this){null!==ee&&(Ee(),ee.hide()),q.attr("placeholder",this.searchPlaceholder),null!==this.menuElement&&this.menuElement.addClass("selected"),this.parent&&null!==this.parent.menuElement&&this.parent.menuElement.addClass("selected"),W.text(this.title),this.addBodyState(),this.scrollParent.scrollTop(0);var e=this.getSortOptions();null!==ee&&ee.getSortOptions()===e||be(e),ee=this;var n=this.getSortOrder();n&&t.sort(n),this.additionalOptionButtons&&I.append(this.additionalOptionButtons),D.children().detach(),M.children().detach();var i=this.getAddMenuItems();if(i.length>0){var o=i[0];M.append(o.getAddElement());for(var r=i.length-1;r>0;--r)D.append(i[r].getMenuElement());A.show()}else A.hide();"siteEmpty"===this.emptyState&&bg.sendLpImprove("no_folder::user_vault_opened"),LPProxy.getPreference("leftMenuMaximize")?t.maximizeLeftMenu():t.minimizeLeftMenu()}},ne.prototype.getState=function(){return this.isEmpty()?this.emptyState:this.state},ne.prototype.clear=function(){this.container&&(this.container.destruct(),this.container=null)}}();var ie=function(t){t.bodyState=t.bodyState||t.contentID,ne.call(this,t),this.contentElement=e.getElementById(t.contentID),this.containerType=t.containerType,this.dataSource=t.dataFunction,this.buildOptions=t.buildOptions,this.filter=t.filter,function(e){Topics.get(Topics.IDENTITY_ENABLE).subscribe(function(t){e.refresh(t)}),e.initializeCallback=function(t,n){var i=new e.containerType(t,e.buildOptions);i.initialize(e.contentElement,e.scrollParent),e.filter&&i.applyFilter(e.filter,{checkForStateChange:!1}),e.setContainer(i,{checkForStateChange:LPTools.getOption(n,"checkForStateChange",!1)}),Topics.get(Topics.DIALOG_LOADED).publish()}}(this)};ie.prototype=Object.create(ne.prototype),ie.prototype.constructor=ie,function(){ie.prototype.makeDataRequest=function(e,t){t.error=function(){Topics.get(Topics.DIALOG_LOADED).publish()},LPRequest.makeDataRequest(e,t)},ie.prototype.initialize=function(e,t){null===this.container&&null!==this.containerType&&null!==this.dataSource&&(e=function(e,t){return t?function(n,i){e.initializeCallback(n,i),t()}:e.initializeCallback}(this,e),Topics.get(Topics.DIALOG_LOADING).publish(),this.dataSource.call(this,e,t))},ie.prototype.show=function(e){null===this.container?function(t){t.initialize(function(){e&&e(),ne.prototype.show.apply(t)})}(this):(ne.prototype.show.apply(this),e&&e())},ie.prototype.refresh=function(e){null!==this.container&&(this.container.destruct(),this.container=null,this.initialize(null,{identity:e,checkForStateChange:!0}))}}();var oe=function(e){ne.call(this,e),this.setContainer(e.container||null),this.filter=e.filter};oe.prototype=Object.create(ne.prototype),oe.prototype.constructor=oe,oe.prototype.show=function(){this.container.applyFilter(this.filter,{checkForStateChange:!1}),ne.prototype.show.apply(this,arguments)};var re=function(e){var t=null;if(e.views&&e.views.length>0){for(var n=0,i=e.views.length;n<i;++n)e.views[n].parent=this;this.show=function(n,i){n?(n.show(i),t=n):(null===t&&(t=e.defaultView()),t.show(i))},this.clear=function(){t=null},this.menuElement=e.menuElement;var o=e.menuElement.find(".notificationBubble");this.updateNotificationCount=function(e){Be(o,parseInt(o.text())-e)};var r=function(){for(var t=0,n=0,i=e.views.length;n<i;++n)t+=e.views[n].updateNotificationCount();Be(o,t)};Topics.get(Topics.LOGIN).subscribe(r),Topics.get(Topics.REFRESH_DATA).subscribe(r),function(e){Topics.get(Topics.CLEAR_DATA).subscribe(function(){e.clear()})}(this)}},se=new ie({containerType:IdentityContainer,dataFunction:function(e){for(var t=[],n=0,i=E._identities.length;n<i;++n)t.push(E._identities[n].newDisplayObject());e(t)},sortOptions:P,contentID:"identityContent",bodyState:"identity",scrollParent:C,searchPlaceholder:Strings.translateString("search my identities"),buildOptions:{multiSelect:!1},title:Strings.translateString("Identities"),addMenu:[v.Identity]}),ae=new ie({containerType:CreditMonitoringContainer,dataFunction:function(){var e=function(e,t,n){for(var i=!0,o=[],r=0,s=t.length;r<s;++r){var a=t[r];"1"!==a.premium&&(i=!1),o.push(new CreditMonitoringProfile(a))}var l=$("#creditMonitoring .viewExplanation");i?(l.hide(),ae.title=Strings.translateString("Premium Credit Monitoring")):(l.show(),ae.title=Strings.translateString("Credit Monitoring")),e(o,n)};return function(t,n){this.makeDataRequest(LPProxy.getCreditMonitoringData,{success:function(i){e(t,i,n)}})}}(),persistent:!1,contentID:"creditMonitoring",scrollParent:C,title:Strings.translateString("Credit Monitoring"),addMenu:[v.CreditMonitoring]}),le=new ie({containerType:GridListContainer,dataFunction:function(e,t){this.makeDataRequest(LPProxy.getDeletedItems,{success:e})},filter:{showEmptyGroups:!1},sortOptions:p,contentID:"deletedItems",scrollParent:C,persistent:!1,searchPlaceholder:Strings.translateString("search my deleted items"),buildOptions:{allowDrag:!1,stickyFolders:!0,stickyFolderParent:e.getElementById("main")},title:Strings.translateString("Deleted Items"),additionalOptionButtons:[function(){var e=LPTools.createElement("div",{class:"optionButton optionButtons",id:"purgeAllButton"},Strings.Vault.PURGE_ALL);return LPPlatform.addEventListener(e,"click",function(){var e=le.getContainer();if(e){var t=e.getItemModelChildren();t.length>0&&t[0].purge({itemsForAction:t})}}),$(e)}()]});le.refresh=function(){};var ce=new ie({containerType:EmergencyAccessRecipientContainer,dataFunction:function(e,t){this.makeDataRequest(LPProxy.getEmergencyAccessRecipientInfo,{success:e})},filter:{showEmptyGroups:!1},sortOptions:p,menuElement:$("#emergencyTrustedMenuItem"),contentID:"emergencyTrustedContainer",bodyState:"emergencyTrusted",scrollParent:C,persistent:!1,searchPlaceholder:Strings.translateString("search people I trust"),buildOptions:{allowDrag:!1},title:Strings.translateString("People I Trust"),addMenu:[v.EmergencyAccess]}),ue=new ie({containerType:EmergencyAccessSharerContainer,dataFunction:function(e,t){this.makeDataRequest(LPProxy.getEmergencyAccessSharerInfo,{success:e})},filter:{showEmptyGroups:!1},notificationCount:function(){var e=0,t=bg.get("g_emer_sharers");if(t)for(var n=0,i=t.length;n<i;++n)"0"===t[n].accepted&&++e;return e},sortOptions:p,menuElement:$("#emergencyTrustingMenuItem"),contentID:"emergencyTrusting",bodyState:"emergencyTrusting",scrollParent:C,persistent:!1,searchPlaceholder:Strings.translateString("search people who trust me"),buildOptions:{allowDrag:!1},title:Strings.translateString("People Who Trust Me")}),de=new re({menuElement:$("#emergencyAccessMenuItem"),defaultView:function(){return ue.notificationCount()>0?ue:ce},views:[ce,ue]}),pe=new ie({containerType:IndividualShareContainer,sortOptions:f,menuElement:$("#receivedSharesMenuItem"),contentID:"receivedSharesContent",bodyState:"receivedShares",scrollParent:C,persistent:!1,notificationCount:function(){return bg.get("g_pendings").length},searchPlaceholder:Strings.translateString("search my received shares"),buildOptions:{multiSelect:!1},filter:{showEmptyGroups:!1,multiSelect:!1},title:Strings.translateString("Shared with Me"),addMenu:[v.ShareItems],dataFunction:function(){var e=function(e){for(var t=LPProxy.getAllModelItems(),n=[],i=0,o=t.length;i<o;++i){var r=t[i],s=e[r.getID()];s&&"1"===s.state&&r instanceof AccountBase&&n.push(new AcceptedReceivedSharedItem(r,s))}return n},t=function(e){for(var t=LPProxy.getPendingRecievedShares(),n=!1,i=0,o=t.length;i<o;++i){var r=t[i],s=e[r._model.getID()];s?r._model._shareData=s:n=!0}return n&&LPProxy.refreshSites(),t},n=function(n,i,o){var r=e(n),s=t(n);i(r.concat(s))};return function(e,t){this.makeDataRequest(LPProxy.getReceivedShareData,{params:{},success:function(t){n(t,e)}})}}()}),ge=new ie({containerType:IndividualShareContainer,sortOptions:m,menuElement:$("#sentSharesMenuItem"),contentID:"sentSharesContent",bodyState:"sentShares",scrollParent:C,persistent:!1,searchPlaceholder:Strings.translateString("search my sent shares"),buildOptions:{multiSelect:!1},filter:{showEmptyGroups:!1,multiSelect:!1},title:Strings.translateString("Shared with Others"),addMenu:[v.ShareItems],dataFunction:function(){var e=function(e,t,n){for(var i=LPProxy.getAllModelItems(),o=[],r=0,s=i.length;r<s;++r){var a=i[r];o=o.concat(LPTools.buildSentShareItems(a,e[a.getID()]))}t(o,n)};return function(t,n){this.makeDataRequest(LPProxy.getSentShareData,{params:{},success:function(i){e(i,t,n)}})}}()}),me=new ie({containerType:SharedFolderContainer,dataFunction:function(){var e=function(e,t,n){for(var i=LPProxy.getAllSharedGroupModelsByID(),o=[],r=0,s=e.length;r<s;++r){var a=e[r];if(a.sharedata){var l=i[a.shareid];o.push(new SharedFolderItem(l,a))}}t(o)};return function(t,n){this.makeDataRequest(LPProxy.getSharedFolderData,{params:{},success:function(n){e(n,t)}})}}(),notificationCount:function(){return bg.get("g_pending_shares").length},sortOptions:h,menuElement:$("#sharedFoldersMenuItem"),contentID:"sharedFoldersContent",bodyState:"sharedFolders",scrollParent:C,searchPlaceholder:Strings.translateString("search my shared folders"),buildOptions:{multiSelect:!1},title:Strings.translateString("Shared Folders"),addMenu:[v.SharedFolder],additionalOptionButtons:[function(){var e=$(LPTools.buildCheckbox(null,{text:Strings.translateString("View Deleted Shared Folders")}));return e.attr("id","showDeletedSharedFoldersButton"),e.addClass("optionButtons"),e.bind("click",function(){Qe()}),e}()]});me.initialize=function(e,t){e=function(e,t){return t?function(){Xe({checkForStateChange:!1}),t()}:function(){Xe({checkForStateChange:!1})}}(0,e),ie.prototype.initialize.call(this,e,t)};var fe=new re({menuElement:$(".sharingMenuItem"),defaultView:function(){return pe.notificationCount()>0?pe:LPProxy.getAccountClass()===Constants.USER_FREE?ge:LPFeatures.allowSharedFolders()?me:pe},views:[me,ge,pe]}),he=(new ne({menuElement:$("#newSettingsMenuItem"),bodyState:"newSettings",title:Strings.translateString("Settings"),addMenu:null,scrollParent:$(document.body)}),function(){LPTools.hideContextMenu(J),J=null}),Pe=function(e){e.preventDefault(),e.stopPropagation()},ye=function(){q.val("")},ve=function(){he(),qe(),Ie(),_e()},Se=function(){ee&&ee.clearSelected()},Ee=function(){ye(),Se()},Le=function(e){return function(n){he(),t.sort(e),Pe(n)}},be=function(t){if(null!==t){LPTools.removeDOMChildren(Y);for(var n=0,i=t.length;n<i;++n){var o=e.createElement("li"),r=t[n];o.textContent=r,LPPlatform.addEventListener(o,"click",Le(r)),Y.appendChild(o)}x.show()}else x.hide()},Te=function(e){if(e>0){var t=e+" selected";$("#selectedItemCounter").text(t)}},Ie=function(){H.removeClass("selected"),T.hide("fast"),L.hide()},Ce=function(){_.addClass("open")},_e=function(){_.removeClass("open")},De=function(t,n){var i=LPProxy.getAllItems({identity:t}),o=new GridListContainer(i,{separateItems:!0,separateFavorites:!0,stickyFolders:!0,ignoreFilterOnSearch:!0,keyboardNavigation:!0,stickyFolderParent:e.getElementById("main"),folderStateChange:ke});Oe(o),ze(o,it.all.getSortOrder()),o.initialize(e.getElementById("vaultContent"),C),o.applyFilter(n),ot(o);for(var r in it)it[r].setContainer(o);return o};t.initialize=function(n){var i=$("#showReminders");bg.get("g_one_minute_signup_enabled")?oneMinuteSignup.fetchReminders():i.addClass("hidden"),bg.isOffline()?(i.attr("data-toggle","tooltip"),i.attr("title","You have to be online."),i.addClass("disabled")):(i.removeAttr("data-toggle"),i.removeAttr("title"),i.removeClass("disabled")),oneMinuteSignup.setOpenTourFn(t.openTour);try{if(e.body.removeAttribute("class"),Topics.get(Topics.REFRESH_DATA).publish(),$(".leftMenuItem").removeClass("selected"),LPProxy.getPreference("gridView")||t.displayAsList(),LPProxy.getPreference("compactView")&&t.displayCompact(),this.firstTimeLogin(),G.attr("title","Maximize Menu"),LPFeatures.allowGift()){var o=$("#specialOfferMenu");o.show(),o.bind("click",function(){bg.openURL(LPProxy.getBaseURL()+"gift.php")})}Fe(),LPPlatform.showIntroTutorial(),Ae(),we(),LPFeatures.allowTryFamilies()&&$("#lp-try-families").show()}catch(e){LPPlatform.logException(e)}finally{var r=$("#vaultLoadingOverlay");LPTools.getOption(n,"fadeIn",!1)?(r.addClass("fadeIn"),setTimeout(function(){r.addClass("loaded")},500)):r.addClass("loaded"),V.addClass("loaded")}};var Ae=function(){var e=!1,t=function(){$("#inProgressMigration").hide(),Topics.get(Topics.REFRESH_DATA).publish(),setTimeout(LPPlatform.openTour,1)},n=function(){e?t():e=!0};if(bg.MigrationBackground&&bg.MigrationBackground.subscribeToStateOnce){var i=function(e){e?($("#inProgressMigration").show(),setTimeout(n,3e3)):n(),bg.MigrationBackground.subscribeToStateOnce(i)};if(bg.MigrationBackground.subscribeToStateOnce(i),!LPPlatform.lpIsExtension()){var o=$("#inProgressMigration").find(".progress-bar");Migrator.executeMigrations(function(e,t){o.css("width",Math.floor(e/t*100)+"%")})}}},Me=function(){LPProxy.getPreference("leftMenuMaximize")&&t.toggleLeftMenu()},we=function(){if(bg.get("g_one_minute_signup_menu_enabled")&&LPPlatform.lpIsExtension()){var e=bg.get("g_onemin_advert_app_threshold"),t=LPProxy.getAllModelItems().length;e&&t>e?$("#vaultFooter").addClass("disabled"):$("#vaultFooter").removeClass("disabled")}else $("#vaultFooter").addClass("disabled");$("#linkToOnemin","#vaultFooter").click(function(e){return bg.sendLpImprove("oneminute::notificationfromvaultomsstart"),oneMinuteSignup.show(oneMinuteSignup.modes.normal),!1})},Fe=function(){var e=function(e){t.openReceivedShareCenter(function(){var n=LPProxy.getPendingRecievedShare(e);n&&t.openAcceptShareDialog(n)})},n=function(e){t.openReceivedShareCenter(function(){var t=LPProxy.getPendingRecievedShare(e);t&&t.reject()})},i=function(e){LPProxy.getSiteModel(e)?t.openSiteDialog({vaultItem:e}):LPProxy.getNoteModel(e)&&t.openNoteDialog({vaultItem:e})},o=function(e){switch(e){case"emergencyAccess":ce.show();break;case"emergencyAccessOthers":ue.show();break;default:it.all.show()}},r=function(){t.openManageIdentities(),t.openIdentityDialog()},s=function(e){var n=[];e=e.split(",");for(var i=0,o=e.length;i<o;++i){var r=e[i],s=LPProxy.getSiteModel(r);s||(s=LPProxy.getNoteModel(r)),s&&n.push(s)}n.length>0&&t.openShareDialog(n)};return function(){var a=LPTools.getURLParams();LPPlatform.setIntroTutorialDisable(!1);for(var l in a){var c=a[l];switch("cmd"===l&&(l=c),l){case"opengoogleauth":case"opensettings":Topics.get(Topics.EDIT_SETTINGS).publish();break;case"openhistory":LPProxy.openHistory();break;case"openbookmarklets":LPProxy.openBookmarklets();break;case"linkpersonal":t.openLinkAccountDialog();break;case"unlinkpersonal":t.unlinkAccount();break;case"sharedfolder":case"sf":t.openSharingCenter();break;case"sfadd":t.openSharingCenter(),t.openCreateSharedFolderDialog();break;case"addidentity":r();break;case"showdeleted":t.openDeletedItems();break;case"viewcreditmon":t.openCreditMonitoring();break;case"share":s(c);break;case"edit":i(c);break;case"acceptshare":e(c);break;case"rejectshare":n(c);break;case"omsstart":LPPlatform.setIntroTutorialDisable(!0),oneMinuteSignup.showWithProvider()}}null===ee&&o(a.view)}}(),Oe=function(e){var t=LPPlatform.getOpenGroups();if(null!==t){for(var n=!0,i=e.getAllSubGroupsIncludingFavorites(!0),o=0,r=i.length;o<r;++o){var s=i[o];t[s._model.getName()]?(s.expand(),n=!1):s.collapse()}n&&Topics.get(Topics.ALL_COLLAPSED).publish()}},ke=function(e){if(e){for(var t=e.getAllSubGroupsIncludingFavorites(!0),n=[],i=0,o=t.length;i<o;++i){var r=t[i];r.isExpanded()&&n.push(r._model.getName())}LPPlatform.setOpenGroups(n)}},xe=function(t){var n=e.getElementById("sharedFoldersMenuItem").parentElement;t===Constants.USER_FREE&&($("#emptySharedFoldersIcon .tourText").append(LPTools.createElement("a",{class:"nbtn rbtn dynamicWidth",href:LPProxy.getBaseURL()+"go-premium",target:"_blank"},Strings.translateString("Upgrade to Premium"))),n.parentElement.appendChild(n)),$(n.parentElement).children().last().addClass("last")},Re=function(e){var t=$(".securityScore");t.text(null!==e?Math.round(e)+"%":""),e?t.parents(".menuIcon").addClass("score"):t.parents(".menuIcon").removeClass("score")};t.toggleInProgressOverlay=function(){b.toggle()};var Be=function(e,t){t>0?(e.text(t),e.show()):e.hide()},Ne=function(){var e=!1;return function(){if(!e)for(var t=LPProxy.getEmergencyAccessRecipientModels(),n=0,i=t.length;n<i;++n){var o=t[n];if(o.allowedAccess()||o.hasRequestedAccess()){dialogs.denyEmergencyAccess.open({sharee:o}),e=!0;break}}}}();t.openVault=function(){it.all.show()},t.openNotes=function(){it.notes.show()},t.openFormFills=function(){it.formFill.show()},t.toggleAdvancedMenu=function(e){H.toggleClass("selected"),T.toggle("fast"),L.toggle(),Pe(e)},t.clear=function(){E&&(E.destruct(),E=null),e.body.setAttribute("class","loggedout"+(LPPlatform.canBackgroundOpenPopover()?" canopenpopover":" cannotopenpopover")),$("#vaultLoadingOverlay").removeClass("loaded fadeIn"),Ee(),ee=null,K=null,X=null,Z=null,J=null},t.maximizeLeftMenu=function(){V.addClass("maximized"),G.addClass("opened"),G.attr("title","Minimize Menu"),LPProxy.setPreferences("leftMenuMaximize",!0),setTimeout(Topics.get(Topics.VAULT_LEFT_MENU_TOGGLE).publish,400)},t.minimizeLeftMenu=function(){V.removeClass("maximized"),G.removeClass("opened"),G.attr("title","Maximize Menu"),LPProxy.setPreferences("leftMenuMaximize",!1),setTimeout(Topics.get(Topics.VAULT_LEFT_MENU_TOGGLE).publish,400)},t.toggleLeftMenu=function(){V.hasClass("maximized")?t.minimizeLeftMenu():t.maximizeLeftMenu()},t.addSource=function(e){return e?e.saveOptions&&e.saveOptions.source||(e.saveOptions={source:"vault"}):e={saveOptions:{source:"vault"}},e},t.openSiteDialog=function(e){dialogs.site.open(t.addSource(e))},t.openTour=function(e){"41"===(bg.get("LPContentScriptFeatures")?bg.get("LPContentScriptFeatures").tutorial_enabled:"40")?LPPlatform.openTour(e):e?Ze.show(e):LPProxy.getPreference("seenVault4.0")?(Me(),q.focus()):Ze.show(e)},t.openNoteDialog=function(e){dialogs.note.open(t.addSource(e)),e&&e.vaultItem&&bg.loglogin(e.vaultItem._data.aid)},t.openFormFillDialog=function(e){dialogs.formFill.open(t.addSource(e))},t.openFolderDialog=function(e,t){dialogs.folder.open({vaultItem:e,defaultData:{groupParent:t?t.getName():""},groups:Z.getAllSubGroups()})},t.openTryFamiliesDialog=function(e,t){e=e||!1;var n=t?{origin:t}:{};bg.sendLpImprove("try_families_lightbox_shown",n),dialogs.tryFamilies.open({forceAccepted:e})},t.openUpgradeFamiliesDialog=function(e){e=e||!1;(!function(){var e=localStorage.getItem("lp_families_dialog_snoozed");return localStorage.getItem("lp_families_dialog_never")||e&&parseInt(e)>Date.now()}()&&LPFeatures.allowFamilies()&&LPProxy.isLegacyPremium()&&LPProxy.isPremiumUser()||e)&&(bg.sendLpImprove("families_legacy_premium_lightbox_shown"),dialogs.upgradeFamilies.open({forceAccepted:e}))},t.openFamiliesInvitationDialog=function(e){LPProxy.getFamiliesInvitations({params:{},success:function(t){t.length>0?(t.sort(function(e,t){return new Date(t.date)-new Date(e.date)}),dialogs.familiesInvitation.open({invitations:t,callback:e})):e(!1)},error:function(){e(!1)}})};var $e=function(){var e=LPProxy.getAccountClass();return e===Constants.USER_FREE||e===Constants.USER_PREMIUM},Ge=function(){var e=localStorage.getItem("lp_families_dialog_snooze_timestamp"),t=localStorage.getItem("lp_families_dialog_snooze_count"),n=e&&parseInt(e)>Date.now(),i=t&&"1"===t;return n&&i},Ue=function(){var e=localStorage.getItem("lp_try_families_dialog_declined"),t=localStorage.getItem("lp_families_dialog_snooze_count"),n=t&&parseInt(t)>1;return e||n};t.openCreateSharedFolderDialog=function(e,n){!LPProxy.isLegacyPremium()&&$e()&&LPFeatures.allowTryFamilies()?t.openTryFamiliesDialog(!1,"create_shared_folder_link"):LPProxy.isFamilyUser()&&bg.get("LPContentScriptFeatures").family_shared_folders_enabled?dialogs.familiesSharedFolder.open({group:e,children:n}):LPProxy.getAccountClass()===Constants.USER_FREE?(bg.sendLpImprove("upgrade_to_premium_lightbox_shown"),dialogs.upgradePremium.open({upgradeText:[LPTools.createElement("h1","upgradeDialogHeader",Strings.translateString("Need to share passwords with family or friends?")),LPTools.createElement("p","dialogText",Strings.translateString("Go Premium now to create a Shared Folder, invite family or friends, and fill the folder with passwords and notes. Give up to 5 people access to the Shared Folder. Changes are synced automatically, and you can assign read-only access. Go Premium now to create a Shared Folder!"))]})):dialogs.createSharedFolder.open({group:e,children:n})},t.openSettingsDialog=function(){null===K&&(AccountSettingsService.call(function(e){K=e,t.openSettingsDialog()},function(){Notifications.displayErrorMessage("Could not retrieve account settings!")}),Topics.get(Topics.DIALOG_LOADING).publish()),dialogs.settings.open(K)},t.openLinkAccountDialog=function(){LPProxy.callAcctsIFrameCommand("linkpersonal")},t.unlinkAccount=function(){var e=LPProxy.getLinkedAccount();e&&e.unlink()},t.toggleCollapseAll=function(){var e=!1;return Topics.get(Topics.ALL_COLLAPSED).subscribe(function(){e=!0,O.addClass("selected"),O.attr("title",Strings.Vault.EXPAND_ALL)}),Topics.get(Topics.ALL_EXPANDED).subscribe(function(){e=!1,O.removeClass("selected"),O.attr("title",Strings.Vault.COLLAPSE_ALL)}),function(){e?(Topics.get(Topics.EXPAND_ALL).publish(),Topics.get(Topics.ALL_EXPANDED).publish()):(Topics.get(Topics.COLLAPSE_ALL).publish(),Topics.get(Topics.ALL_COLLAPSED).publish())}}(),t.toggleSize=function(){var e=!1;return t.displayLarge=function(){Topics.get(Topics.DISPLAY_LARGE).publish(),e=!1,k.removeClass("selected"),k.attr("title",Strings.Vault.COMPACT_VIEW),LPProxy.setPreferences("compactView",!1)},t.displayCompact=function(){Topics.get(Topics.DISPLAY_COMPACT).publish(),e=!0,k.addClass("selected"),k.attr("title",Strings.Vault.LARGE_VIEW),LPProxy.setPreferences("compactView",!0)},function(){e?(t.displayLarge(),bg.lpevent(Q?"v_grd_lrg":"v_lst_lrg")):(t.displayCompact(),bg.lpevent(Q?"v_grd_cmp":"v_lst_cmp"))}}(),t.displayAsGrid=function(){Topics.get(Topics.DISPLAY_GRID).publish(),w.addClass("selected"),F.removeClass("selected"),LPProxy.setPreferences("gridView",!0),Q=!0},t.displayAsList=function(){Topics.get(Topics.DISPLAY_LIST).publish(),F.addClass("selected"),w.removeClass("selected"),LPProxy.setPreferences("gridView",!1),Q=!1},t.search=function(e){ee&&ee.search(e)};var ze=function(e,t){switch(t){case r:e.sortByName(!0);break;case s:e.sortByName(!1);break;case i:e.sortByFolder(!0);break;case o:e.sortByFolder(!1);break;case a:e.sortItemsByMostRecent();break;case l:case u:e.sortByEmail(!0);break;case c:case d:e.sortByEmail(!1)}};t.sort=function(e){B.text(e),ze(ee.getContainer(),e),ee.setSortOrder(e)};var Ve=function(e){R.toggle("fast"),J=R,LPTools.addKeyBoardNavigation(Y.children),Pe(e)},He=function(e){if(null===J||J.get(0).parentElement!==z){var t=ee.createSelectionContextMenu();z.appendChild(t),t.removeAttribute("style"),J=$(t),J.show("fast")}else he();Pe(e)};t.showMoreOptionsMenu=function(){U.show("fast")},t.hideMoreOptionsMenu=function(){U.hide("fast")};var Ye=function(e){j.toggleClass("selected"),N.toggle("fast"),Pe(e)},qe=function(){N.hide("fast"),j.removeClass("selected")};t.openEmergencyAccess=function(){de.show()},t.openEmergencyAccessTrusted=function(){de.show(ce)},t.openEmergencyAccessTrusting=function(){de.show(ue)},t.openSharingCenter=function(e){fe.show()},t.openReceivedShareCenter=function(e){fe.show(pe,e)},t.openSentShareCenter=function(e){fe.show(ge,e)},t.openSharedFolderCenter=function(e){fe.show(me,e)};var je=!1,We=function(e){me.getContainer().applyFilter({showEmptyGroups:!1,multiSelect:!1,func:function(e){return!e._model.isDeleted()}},e),je=!1},Ke=function(e){me.getContainer().applyFilter({showEmptyGroups:!1,multiSelect:!1,func:function(e){return!0}},e),je=!0},Xe=function(e){je?Ke(e):We(e)},Qe=function(){je?We():Ke()};t.openAcceptShareDialog=function(e){dialogs.acceptShare.open({vaultItem:e,groups:Z.getAllSubGroups()})},t.openShareDialog=function(e){LPTools.openShareDialog(e)},t.openSharedFolderDialog=function(e,t){LPProxy.isFamilyUser()&&e._shareInfo.cid!==Constants.UNAFFILIATED_COMPANY_ID&&bg.get("LPContentScriptFeatures").family_shared_folders_enabled?dialogs.familiesSharedFolder.open({folder:e,members:t}):dialogs.sharedFolder.open(e,t)},t.openSharedFolderAccessDialog=function(e){dialogs.sharedfolderAccess.open(e)},t.openManageIdentities=function(){se.show()},t.openIdentityDialog=function(e){dialogs.identity.open(e)},t.enableIdentity=function(e){null!==X&&X!==e&&(X.disable(),LPProxy.enableIdentity(e)),X=e;var t=Z?Z._filter:null;null!==Z&&(ke(Z),Z.destruct()),Z=De(X,t)},t.openCreditMonitoring=function(e){ae.show()},t.openCreateCreditMonitoringDialog=function(){dialogs.createCreditMonitoring.open()},t.openDeletedItems=function(e){le.show()};var Ze=function(){var t=0,n=null,i=null,o=e.getElementById("tourItems"),r=$("#tourLeft"),s=$("#tourRight");r.hide(),r.bind("click",function(){Ze.reverse()}),s.bind("click",function(){Ze.advance()});i=e.getElementById("tourSteps").children;for(var a=0,l=i.length;a<l;++a)LPPlatform.addEventListener(i[a],"click",function(e){return function(){Ze.goTo(e)}}(a));i[0].setAttribute("class","tourStep selected");var c=function(e){if(e!==t&&e>=0&&e<i.length){i[t].setAttribute("class","tourStep");var a="tour"+(e+1);o.setAttribute("class",a),V.addClass(a),n&&V.removeClass(n),n=a,t=e,i[t].setAttribute("class","tourStep selected"),0===e?r.hide():r.show(),e===i.length-1?s.hide():s.show()}},u=function(){c(t+1)},d=function(){c(t-1)};return{advance:u,reverse:d,goTo:function(e){c(e)},hide:function(){V.removeClass("tourState"),V.removeClass(n),n=null,Topics.get(Topics.RIGHT_ARROW).unsubscribe(u),Topics.get(Topics.LEFT_ARROW).unsubscribe(d),bg.sendLpImprove&&bg.sendLpImprove("vaulttour::exit",{version:"40",page:t+1})},show:function(e){c(0),V.addClass("tourState"),Topics.get(Topics.RIGHT_ARROW).subscribe(u),Topics.get(Topics.LEFT_ARROW).subscribe(d),bg.sendLpImprove&&(bg.sendLpImprove("vaulttour",{version:"40"}),bg.sendLpImprove("vaulttour::start",{version:"40",source:e?"help":"welcome"}))}}}();t.showAdPane=function(){var t=bg.get("g_prompts").improve?1:0,i=e.getElementById("ad"),o=e.createElement("iframe");o.setAttribute("src",n.getPartnerURL(LPProxy.getBaseURL()+"ads.php?nobr=1&noga=1&rand="+Math.floor(1e3*Math.random())+"&v="+LPProxy.getVersion())+"&g_lpImprove="+t),i.appendChild(o),V.addClass("freeUser"),setInterval(function(){o.setAttribute("src",n.getPartnerURL(LPProxy.getBaseURL()+"ads.php?v=4.0&nobr=1&noga=1&rand="+Math.floor(1e3*Math.random())+"&v="+LPProxy.getVersion())+"&g_lpImprove="+t)},3e5)},t.firstTimeLogin=function(){if(bg.get("g_first_time_login")){var e=LPTools.createElement("iframe",{class:"displaynone",src:LPProxy.getBaseURL()+"lppixel.php"});$("#main").after(e)}},V.bind("click",function(){ve()}),$("#vault").bind("click",function(){Se(),ve()}),$("#loginButton").bind("click",function(){bg.open_login()}),LPPlatform.addEventListener(window,"unload",function(){Topics.get(Topics.CLEAR_DATA).publish()}),q.LP_addSearchHandlers("inputLight",function(e){t.search(e)}),q.bind("keydown",function(e){if(40===(e.keyCode||e.which)){var t=ee.getContainer();if(t){var n=t.getAllChildrenOrdered();n.length>0&&(n[0].focus(),e.preventDefault(),e.stopPropagation())}}}),$("#orderOption").bind("click",Ve),$("#actions").bind("click",He),$(".sharingMenuItem").bind("click",function(){bg.sendLpImprove("sharing_center_vault_click"),!LPProxy.isLegacyPremium()&&$e()&&LPFeatures.allowTryFamilies()&&!Ue()&&!Ge()&&t.openTryFamiliesDialog(!1,"sharing_menu_item"),t.openSharingCenter()}),H.bind("click",t.toggleAdvancedMenu),L.bind("click",Ie),G.bind("click",t.toggleLeftMenu),LPPlatform.addEventListener(e.getElementById("settingsMenuItem"),"click",function(){Topics.get(Topics.EDIT_SETTINGS).publish({source:"sidebar"})}),$("#linkAccountMenuItem").bind("click",function(){t.openLinkAccountDialog()}),T.on("click",".toolsMenuItem.subMenuOption",function(){return!1}),T.on("click",".toolsMenuItem",Ie),_.bind("mouseenter",Ce),_.bind("mouseleave",_e),_.bind("touchstart",function(e){_.unbind("mousenter"),_.unbind("mouseleave"),_.hasClass("open")||(Ce(),e.preventDefault())}),LPPlatform.addEventListener(e.getElementById("collapseAllToggle"),"click",function(){t.toggleCollapseAll()}),LPPlatform.addEventListener(e.getElementById("showReminders"),"click",function(){oneMinuteSignup.show(oneMinuteSignup.modes.reminder)}),LPPlatform.addEventListener(e.getElementById("sizeToggle"),"click",function(){t.toggleSize()}),LPPlatform.addEventListener(e.getElementById("gridButton"),"click",function(){t.displayAsGrid()}),LPPlatform.addEventListener(e.getElementById("listButton"),"click",function(){t.displayAsList()}),LPPlatform.addEventListener(e.getElementById("userMenuContainer"),"click",Ye);var Je=function(){Ze.hide(),LPProxy.getPreference("seenVault4.0")||LPProxy.setPreferences("seenVault4.0",!0),Me()};LPPlatform.addEventListener(e.getElementById("skipTour"),"click",Je),LPPlatform.addEventListener(e.getElementById("tourOpenMyVault"),"click",Je),LPPlatform.addEventListener(e.getElementById("manageIdentitiesMenuItem"),"click",function(){t.openManageIdentities()}),LPPlatform.addEventListener(e.getElementById("creditMonitoringMenuItem"),"click",function(){t.openCreditMonitoring()}),LPPlatform.addEventListener(e.getElementById("openTourMenuItem"),"click",function(){t.openTour(!0)}),$(".toolsMenuItem.subMenuOption").bind("click",function(e){$(e.target.parentElement.nextElementSibling).toggle("fast"),$(e.target).toggleClass("selected"),Pe(e)}),LPPlatform.addEventListener(e.getElementById("toolsImport"),"click",function(){LPProxy.import()}),LPPlatform.addEventListener(e.getElementById("toolsExport"),"click",function(){LPProxy.export()}),LPPlatform.addEventListener(e.getElementById("toolsOpenFavorites"),"click",function(){LPProxy.openAllFavorites("vault")}),LPPlatform.addEventListener(e.getElementById("bookmarkletsMenuItem"),"click",function(){LPProxy.openBookmarklets()}),LPPlatform.addEventListener(e.getElementById("historyMenuItem"),"click",function(){LPProxy.openHistory()}),LPPlatform.addEventListener(e.getElementById("deletedMenuItem"),"click",function(){t.openDeletedItems()}),LPPlatform.addEventListener(e.getElementById("generateSharingKeys"),"click",function(){bg.lpevent("v_gsk"),dialogs.sharingKey.open()}),$("#generateSharingKeys").hide(),LPPlatform.addEventListener(e.getElementById("featureManager"),"click",function(){bg.openURL(window.location.origin+"/lastpass/index.html#/feature-manager")}),LPPlatform.addEventListener(e.getElementById("generatePasswordMenuItem"),"click",function(){bg.lpevent("v_gpw"),(bg.get("LPContentScriptFeatures").better_generate_password_enabled?dialogs.betterGeneratePassword:dialogs.generatePassword).open({fillGenerated:!1,saveOptions:{source:"vault"}})}),$("#removedLinkedAccountMenuItem").bind("click",function(){t.unlinkAccount()}),$("#tryEnterprise").bind("click",function(){dialogs.enterpriseTrial.open()}),$("#emergencyAccessMenuItem").bind("click",function(){bg.sendLpImprove("emergency_access_vault_click"),t.openEmergencyAccess()}),$(".securityMenuItem").bind("click",function(){bg.lpevent("v_sec"),bg.openseccheck()}),$("#adminConsoleMenuItem").bind("click",function(){bg.lpevent("v_oec"),bg.openentconsole()}),$("#more-options-refer-a-friend").bind("click",function(){bg.sendLpImprove("refer_a_friend_more_options_click")}),$("#more-options-go-premium").bind("click",function(){bg.sendLpImprove("go_premium_more_options_vault_click")}),$("#familyAdminConsoleMenuItem").bind("click",function(){bg.lpevent("v_ofc"),bg.openFamilyConsole(),bg.sendLpImprove("families_manage_families_click")}),$("#lp-try-families").bind("click",function(){$e()&&LPFeatures.allowTryFamilies()&&t.openTryFamiliesDialog(!1,"try_families_submenu_item")}),Topics.get(Topics.ITEMS_DESELECTED).subscribe(function(){t.hideMoreOptionsMenu()}),Topics.get(Topics.ITEMS_SELECTED).subscribe(function(){t.showMoreOptionsMenu()}),Topics.get(Topics.SELECT_COUNT_CHANGE).subscribe(function(e){Te(e)}),Topics.get(Topics.CONTEXT_MENU).subscribe(function(t,n){n.parentElement!==e.body&&e.body.appendChild(n),J=LPTools.displayContextMenu(t,n)}),Topics.get(Topics.CONTEXT_CLOSE).subscribe(function(){he()}),Topics.get(Topics.ITEM_SHARE).subscribe(function(e){LPFeatures.allowOmarDrawer()&&1===e.length?window.location.hash="/drawers/(drawer:edit-item/"+e[0]._data.aid+"/sharing)":t.openShareDialog(e)}),Topics.get(Topics.IDENTITY_ENABLE).subscribe(function(e){t.enableIdentity(e),ot(Z)}),Topics.get(Topics.CLEAR_DATA).subscribe(function(){t.clear(),Dialog.prototype.closeAllDialogs(!0),LPProxy.closeIFrame()}),Topics.get(Topics.LOGIN).subscribe(function(e){st(),t.initialize(e),Dialog.prototype.closeAllDialogs()}),Topics.get(Topics.REQUEST_SUCCESS).subscribe(function(e){LPTools.getOption(e,"incrementAccountsVersion",!1)&&Se()}),function(){var e=function(e,t,n){Ee(),Z.addChild(e.newDisplayObject(),t,n),ot(Z)};Topics.get(Topics.SITE_ADDED).subscribe(e),Topics.get(Topics.NOTE_ADDED).subscribe(e),Topics.get(Topics.FORM_FILL_ADDED).subscribe(e),Topics.get(Topics.APPLICATION_ADDED).subscribe(e)}(),Topics.get(Topics.ITEM_REMOVED).subscribe(function(){ot(Z)}),Topics.get(Topics.EDIT_SHARED_FOLDER_ACCESS).subscribe(function(e){t.openSharedFolderAccessDialog(e)}),Topics.get(Topics.EDIT_SITE).subscribe(function(e){LPFeatures.allowOmarDrawer()?window.location.hash="/drawers/(drawer:edit-item/"+e.vaultItem._data.aid+")":t.openSiteDialog(e)}),Topics.get(Topics.EDIT_NOTE).subscribe(function(e){LPFeatures.allowOmarDrawer()?window.location.hash="/drawers/(drawer:edit-item/"+e.vaultItem._data.aid+")":t.openNoteDialog(e)}),Topics.get(Topics.EDIT_FORM_FILL).subscribe(function(e){t.openFormFillDialog(e)}),Topics.get(Topics.EDIT_APPLICATION).subscribe(function(e){dialogs.application.open(e)}),Topics.get(Topics.EDIT_SETTINGS).subscribe(function(e){bg.sendLpImprove("viewvaultsettings",{source:e&&e.source?e.source:""}),LPProxy.callAcctsIFrameCommand("settings")}),Topics.get(Topics.EDIT_IDENTITY).subscribe(function(e){t.openIdentityDialog(e)}),Topics.get(Topics.ACCEPT_SHARE).subscribe(function(e){t.openAcceptShareDialog(e)}),Topics.get(Topics.RENAME_FOLDER).subscribe(function(e){t.openFolderDialog(e)}),Topics.get(Topics.CREATE_SUB_FOLDER).subscribe(function(e){t.openFolderDialog(null,e)}),Topics.get(Topics.GROUP_ADDED).subscribe(function(e,t){if(Ee(),Z.addChild(e.newDisplayObject(),t),e instanceof SharedGroup){var n=me.getContainer();if(null!==n){var i=new SharedFolderItem(e);n.addChild(i)}}}),Topics.get(Topics.ESCAPE).subscribe(function(e){var t=Dialog.prototype.getCurrentDialog();t&&t.close(),Se(),ve()}),Topics.get(Topics.EDIT_SHARED_FOLDER).subscribe(function(e,n){t.openSharedFolderDialog(e,n)}),Topics.get(Topics.IDENTITY_ADDED).subscribe(function(e){se.getContainer().addChild(e.newDisplayObject())}),Topics.get(Topics.REFRESH_DATA).subscribe(function(){LPProxy.initializeModel(),Ne(),E=LPProxy.getUser(),E.initialize(N,$("#userMenuText")),LPTools.parseUserSpecificMenu(e.getElementById("tools"),E._accountClass),LPTools.parseUserSpecificMenu(e.getElementById("leftMenu"),E._accountClass),xe(LPProxy.getAccountClass()),VaultState.setIdentities(E._identities),LPProxy.enableCurrentIdentity(E._identities),E.isFree()?t.showAdPane():V.removeClass("freeUser"),LPProxy.getSecurityChallengeScore(Re),Dialog.prototype.closeInProcessDialogs(),VaultItemDialog.prototype.refreshOpenDialogs(),Topics.get(Topics.REFRESH_PREFERENCES).publish(),he()}),Topics.get(Topics.UPDATE_NOTIFICATION_COUNT).subscribe(function(e){ee&&ee.updateNotificationCount("number"==typeof e?e:1)}),Topics.get(Topics.ACCOUNT_LINKED).subscribe(function(e){$("#linkAccountMenuItem").LP_hide(),$("#removedLinkedAccountMenuItem").LP_show()}),Topics.get(Topics.ACCOUNT_UNLINKED).subscribe(function(e){$("#linkAccountMenuItem").LP_show(),$("#removedLinkedAccountMenuItem").LP_hide()}),Topics.get(Topics.CREATE_SHARED_FOLDER).subscribe(function(e,n){t.openCreateSharedFolderDialog(e,n)}),Topics.get(Topics.REPROMPT).subscribe(function(e){dialogs.reprompt.open({successCallback:e})}),Topics.get(Topics.CONFIRM).subscribe(function(e){dialogs.confirmation.open(e)}),Topics.get(Topics.EMERGENCY_RECIPIENT_ADDED).subscribe(function(e){ce.getContainer().addChild(e.newDisplayObject())}),Topics.get(Topics.EDIT_EMERGENCY_RECIPIENT).subscribe(function(e){dialogs.addEmergencyAccess.open({vaultItem:e})}),Topics.get(Topics.REAPPLY_SEARCH).subscribe(function(e,t){var n=q.val();n&&e.applySearch(n,t)}),Topics.get(Topics.ENROLLED_CREDIT_MONITORING).subscribe(function(){ae.refresh()}),Topics.get(Topics.ITEM_SHARED).subscribe(function(e){ge.refresh()}),Topics.get(Topics.REFRESH_PREFERENCES).subscribe(function(){switch(LPFeatures.updateFeatures({import:!0,noexport:!1,share:!0,share_onlyfolders:!1,show_notes:!0,bookmarklets:!0,hideidentities:!1,showcredmon:!0,link_personal:!0,show_formfills:!0}),LPProxy.hasReceivedShares()?V.removeClass("noReceivedShares"):V.addClass("noReceivedShares"),ee){case ge:LPFeatures.allowIndividualSharing()||(fe.clear(),it.all.show(),dialogs.alert.open({title:Strings.translateString("Policy Update"),text:Strings.translateString("Your enterprise has prohibited individual sharing.")}));break;case me:LPFeatures.allowSharedFolders()||(it.all.show(),dialogs.alert.open({title:Strings.translateString("Policy Update"),text:Strings.translateString("Your enterprise has prohibited sharing.")}))}}),Topics.get(Topics.INITIALIZED).subscribe(function(){if(Strings.translate(e.body),$("input,textarea").prop("spellcheck",!1),LPFeatures.allowNewSettings()){var t=document.getElementById("new-settings-iframe");t.src=LPProxy.getBaseURL()+"newvault/lp-vault/settings.html",t.addEventListener("load",function(){t.contentWindow.postMessage({localkey:parent.g_local_key},LPProxy.getBaseURL())})}}),Topics.get(Topics.INTRO_TOURS_LOADED).subscribe(function(e){var n=LPProxy.seenVaultPostFamilies(),i=LPProxy.predatesFamilies();LPFeatures.allowTryFamilies()&&i&&!n&&!Ue()&&!Ge()&&$e()&&t.openTryFamiliesDialog(!1,"first_vault_entry")}),LPPlatform.addEventListener(e,"DOMContentLoaded",function(){Notifications.initialize()});var et=function(e,t,n){var i=LPTools.createElement("div",$.extend(n,{class:"leftMenuItem",id:n.id}));return i.appendChild(t),i.appendChild(LPTools.createElement("span",{class:"menuText"},e)),$(i)},tt=function(e,t){return e instanceof GroupDisplay||e._model.getRecordType()===t.recordType},nt=function(e,t){if(e.types){var n=t.filter(function(t){return e.types.indexOf(t.id)>-1});return function(e){for(var t=0;t<n.length;++t)if(tt(e,n[t]))return!0;return!1}}return function(e){return!(e instanceof FormFillDisplay)}},it={},ot=function(e){if(LPFeatures.allowOmarIA()){var t=document.getElementById("leftMenuItemsContainer");LPTools.removeDOMChildren(t);var n=LPProxy.getRecordConfig(),i=!1,o=!1,r=function(e){i&&(t.appendChild(LPTools.createElement("div","leftMenuItemsDivider")),i=!1),t.appendChild(it[e].getElement())},s=function(t,a){if(Array.isArray(t))i=a>0,t.forEach(s);else{var l=LPProxy.getConfigViewObject(t);if(l.default)r(t);else{var c=nt(l,n.types),u=e._filter;e.applyFilter({func:c},{checkForStateChange:!1}),e.getItemChildren().length>0?r(t):it[l.id]===ee&&(o=!0),e.applyFilter(u,{checkForStateChange:!1})}}};i=!0,n.viewConfig.forEach(s),o&&it.all.show()}},rt=function(e){var t,n=LPProxy.getRecordConfig();return t=e.types&&e.types.length>0?n.icons[e.types[0]]:n.icons.all,LPTools.createElement("i",{class:["menuIcon",t]})},st=function(){if(LPFeatures.allowOmarIA()){var e=LPProxy.getRecordConfig();e.views.forEach(function(t){it[t.id]=new oe({filter:{showEmptyGroups:!1,func:nt(t,e.types)},sortOptions:p,menuElement:et(t.name,rt(t),{id:t.id}),bodyState:"vaultContent "+t.id,scrollParent:C,title:Strings.translateString(t.name),addMenu:[new y({text:"ADD_ITEM",func:function(){dialogs.addItem.open()}}),v.Folder]})})}else it.all=new oe({filter:{showEmptyGroups:!0,func:function(e){return e instanceof AccountBaseDisplay||e instanceof ApplicationDisplay||e instanceof GroupDisplay}},sortOptions:p,menuElement:$("#vaultMenuItem"),bodyState:"vaultContent site",scrollParent:C,title:Strings.translateString("Sites"),addMenu:[v.Site,v.Note,v.ShareItems,v.Folder]}),it.notes=new oe({filter:{showEmptyGroups:!1,func:function(e){return e instanceof NoteDisplay||e instanceof GroupDisplay}},sortOptions:p,menuElement:$("#notesMenuItem"),bodyState:"vaultContent note",scrollParent:C,title:Strings.translateString("Secure Notes"),addMenu:[v.Note,v.ShareItems,v.Folder]}),it.formFills=new oe({filter:{showEmptyGroups:!1,multiSelect:!1,hasFolderView:!1,func:function(e){return e instanceof FormFillDisplay}},sortOptions:g,menuElement:$("#formFillMenuItem"),bodyState:"vaultContent formFill",scrollParent:C,title:Strings.translateString("Form Fills"),addMenu:[v.FormFill]});LPFeatures.isDogfood()||$("#featureManager").LP_hide()}}(document,LPVault,BuildVariables);