"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[26465],{26465:(e,t,o)=>{o.r(t),o.d(t,{CoreContentLinksChooseSiteModalComponent:()=>M});var n=o(10467),i=o(52749),s=o(79555),l=o(10883),r=o(75629),a=o(15324),c=o(30454),C=o(86654),d=o(25572),p=o(54438),m=o(60177),k=o(2910),h=o(64422),u=o(16658),_=o(86198),f=o(58197),R=o(88246),S=o(43570),L=o(73955);function CoreContentLinksChooseSiteModalComponent_p_18_Template(e,t){if(1&e&&(p.j41(0,"p"),p.EFF(1),p.k0s()),2&e){const e=p.XpG();p.R7$(),p.JRh(e.url)}}function CoreContentLinksChooseSiteModalComponent_ion_item_19_p_7_Template(e,t){if(1&e&&(p.j41(0,"p"),p.EFF(1),p.k0s()),2&e){const e=p.XpG().$implicit;p.R7$(),p.JRh(e.siteUrl)}}function CoreContentLinksChooseSiteModalComponent_ion_item_19_Template(e,t){if(1&e){const e=p.RV6();p.j41(0,"ion-item",8),p.bIt("click",(function CoreContentLinksChooseSiteModalComponent_ion_item_19_Template_ion_item_click_0_listener(){const t=p.eBV(e).$implicit,o=p.XpG();return p.Njj(o.siteClicked(t.id))})),p.nrm(1,"core-user-avatar",9),p.j41(2,"ion-label")(3,"p",5),p.EFF(4),p.k0s(),p.j41(5,"p"),p.nrm(6,"core-format-text",10),p.k0s(),p.DNE(7,CoreContentLinksChooseSiteModalComponent_ion_item_19_p_7_Template,2,1,"p",6),p.k0s()()}if(2&e){const e=t.$implicit,o=p.XpG();p.Y8G("detail",!1),p.R7$(),p.Y8G("site",e)("linkProfile",!1),p.R7$(3),p.JRh(e.fullname),p.R7$(2),p.Y8G("text",e.siteName)("siteId",e.id),p.R7$(),p.Y8G("ngIf",o.displaySiteUrl)}}let M=(()=>{var e;class CoreContentLinksChooseSiteModalComponent{constructor(){this.sites=[],this.loaded=!1,this.displaySiteUrl=!1,this.isRootURL=!1}ngOnInit(){var e=this;return(0,n.A)((function*(){if(!e.url)return e.closeModal();let t=[];try{const o=yield i.CoreSites.isStoredRootURL(e.url);if(o.site)e.isRootURL=!0,t=o.siteIds;else{if(!o.siteIds.length)throw new r.CoreError(s.HT.instant("core.contentlinks.errornosites"));if(e.action=yield l.CoreContentLinksHelper.getFirstValidActionFor(e.url),!e.action)throw new r.CoreError(s.HT.instant("core.contentlinks.errornoactions"));t=e.action.sites}e.sites=yield i.CoreSites.getSites(t),e.displaySiteUrl=c.a.makeUnauthenticatedSite(e.sites[0].siteUrl).shouldDisplayInformativeLinks()}catch(t){d.CoreAlerts.showError(t,{default:s.HT.instant("core.contentlinks.errornosites")}),e.closeModal()}e.loaded=!0}))()}siteClicked(e){var t=this;return(0,n.A)((function*(){yield s.W3.dismiss(),t.isRootURL?a.CoreNavigator.navigateToSiteHome({siteId:e}):t.action&&t.action.action(e)}))()}closeModal(){s.W3.dismiss()}}return(e=CoreContentLinksChooseSiteModalComponent).ɵfac=function CoreContentLinksChooseSiteModalComponent_Factory(t){return new(t||e)},e.ɵcmp=p.VBU({type:e,selectors:[["core-content-links-choose-site-modal"]],inputs:{url:"url"},standalone:!0,features:[p.aNF],decls:20,vars:12,consts:[["slot","end"],["fill","clear",3,"click","ariaLabel"],["slot","icon-only","name","fas-xmark","aria-hidden","true"],[3,"hideUntil"],[1,"ion-text-wrap"],[1,"item-heading"],[4,"ngIf"],["button","",3,"detail","click",4,"ngFor","ngForOf"],["button","",3,"click","detail"],["slot","start",3,"site","linkProfile"],["clean","true",3,"text","siteId"]],template:function CoreContentLinksChooseSiteModalComponent_Template(e,t){1&e&&(p.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title")(3,"h1"),p.EFF(4),p.nI1(5,"translate"),p.k0s()(),p.j41(6,"ion-buttons",0)(7,"ion-button",1),p.nI1(8,"translate"),p.bIt("click",(function CoreContentLinksChooseSiteModalComponent_Template_ion_button_click_7_listener(){return t.closeModal()})),p.nrm(9,"ion-icon",2),p.k0s()()()(),p.j41(10,"ion-content")(11,"core-loading",3)(12,"ion-list")(13,"ion-item",4)(14,"ion-label")(15,"h2",5),p.EFF(16),p.nI1(17,"translate"),p.k0s(),p.DNE(18,CoreContentLinksChooseSiteModalComponent_p_18_Template,2,1,"p",6),p.k0s()(),p.DNE(19,CoreContentLinksChooseSiteModalComponent_ion_item_19_Template,8,7,"ion-item",7),p.k0s()()()),2&e&&(p.R7$(4),p.JRh(p.bMT(5,6,"core.contentlinks.chooseaccount")),p.R7$(3),p.Y8G("ariaLabel",p.bMT(8,8,"core.close")),p.R7$(4),p.Y8G("hideUntil",t.loaded),p.R7$(5),p.JRh(p.bMT(17,10,"core.contentlinks.chooseaccounttoopenlink")),p.R7$(2),p.Y8G("ngIf",t.displaySiteUrl),p.R7$(),p.Y8G("ngForOf",t.sites))},dependencies:[C.n,m.Sq,m.bT,k.Jm,k.QW,k.W9,k.eU,k.iq,k.uz,k.he,k.nf,k.BC,k.ai,h.R,u.T,_.t,f.B,R.i,S.T,L.D9],encapsulation:2}),CoreContentLinksChooseSiteModalComponent})()}}]);