1import{a as e}from"./standalone-app-Bj-IdwrG.js";import{E as t,_ as n,x as r}from"./institution-DyFDvNu6.js";import"./user-BMje1Le7.js";import{t as i}from"./page-B8YwBOEr.js";import{Sr as a,o}from"./main-5Sl8yySz.js";import"./jha-card-DC-UH8vN.js";import"./jha-card-header-D2XWRnD9.js";import"./jha-link-button-k4YCp-l3.js";import"./jha-form-switch-CLwMa4i1.js";import"./jha-list-UCQUTbOQ.js";import"./jha-flex-wrapper-DmIt29Hs.js";import{t as s}from"./observable-models-lit-Conecq5s.js";import{t as c}from"./async-dialog-Bj6--dJf.js";import{t as l}from"./user-management-utils-CswTx9SY.js";var u=s(n);window.BannowebSubUserExternalApplicationsList=class extends u{static get is(){return`bannoweb-sub-user-external-applications-list`}static get properties(){return{applications:{type:Array},updating:{type:Boolean},disabled:{type:Boolean}}}constructor(){super(),this.applications=[],this.updating=!1,this.disabled=!0}toggleItem(e,t){this.dispatchEvent(new CustomEvent(`toggle-item`,{bubbles:!0,composed:!0,detail:{appId:e.clientId,enabled:t.detail}}))}static get styles(){return t`:host{--jha-form-switch-label-padding:0px}jha-list-item{justify-content:space-between;align-items:center;display:flex}.content{max-width:70%}.title{color:var(--jha-text-dark);flex-grow:1;font-size:14px;font-weight:500;line-height:20px}.sub-title{color:var(--body-text-secondary-color);white-space:nowrap;text-overflow:ellipsis;font-size:12px;overflow:hidden}`}render(){return r`<jha-list> ${this.applications.map(e=>r`<jha-list-item> <div class="content" title="${e.description||e.linkTypeTitle}"> <div class="title"> ${e.linkTypeTitle} <div class="sub-title">${e.description}</div> </div> </div> <jha-form-switch .label="${e.linkTypeTitle}" .checked="${e.enabled}" @switch="${t=>this.toggleItem(e,t)}" .disabled="${this.disabled||this.updating}"></jha-form-switch> </jha-list-item>`)} </jha-list>`}},customElements.define(window.BannowebSubUserExternalApplicationsList.is,window.BannowebSubUserExternalApplicationsList),window.BannowebSubUserExternalApplicationsList;var d=o.userManagementController,f={UPDATING:`updating`,LOADING:`loading`,ERROR:`error`,IDLE:`idle`},p=l(s(n));window.BannowebSubUserExternalApplicationsCard=class extends p{static get is(){return`bannoweb-sub-user-external-applications-card`}static get properties(){return{user:{type:Object},subUser:{type:Object},applications:{type:Array},maxDisplayed:{type:Number,attribute:`max-displayed`},state:{type:String},showHeader:{type:Boolean,attribute:`show-header`}}}constructor(){super(),e(()=>import(`./icon-circle-info-CI9QftZe.js`).then(e=>e.t),[]),this.user={},this.subUser={},this.applications=[],this.maxDisplayed=1/0,this.state=f.IDLE,this.showHeader=!1}set users({user:e,subUser:t}){this.user=e,this.subUser=t,e&&t&&this.loadApps()}async loadApps(){this.state=f.LOADING;try{let e=(await d.loadExternalApps(this.user.profile.organization.organizationId,this.subUser.id)).clients;this.applications=[...e].sort((e,t)=>e.enabled&&!t.enabled?-1:!e.enabled&&t.enabled?1:e.linkTypeTitle.localeCompare(t.linkTypeTitle))}catch{this.state=f.ERROR;return}this.state=f.IDLE}showFooter(){return this.applications.length>this.maxDisplayed}onToggleItem(e){this.toggleItem(e.detail)}async toggleItem(e){let t=[...this.applications],n=this.applications.find(t=>t.clientId===e.appId);if(this.state=f.UPDATING,!e.enabled)try{await c.showDialog({title:`${this.subUser.name} may still have access`,description:`${n.linkTypeTitle} will no longer be visible for ${this.subUser.name}. ${this.subUser.name} may still be able to access the ${n.linkTypeTitle} website directly and perform actions allowed by their application.`,confirmButtonText:`OK`,cancelButtonText:``})}catch{this.applications=[],await this.updateComplete,this.applications=t,this.state=f.IDLE;return}this.applications=this.applications.map(t=>t.clientId===e.appId?{...t,enabled:e.enabled}:t);try{await d.toggleExternalApp(this.subUser.id,this.user.profile.organization.organizationId,e.appId,e.enabled)}catch{let r=e.enabled?`enable`:`disable`,i=`${n.linkTypeTitle} failed to ${r}`;this.dispatchEvent(new a(i)),this.applications=[],await this.updateComplete,this.applications=t}this.state=f.IDLE}static get styles(){return t`article{margin:0;padding:0}p{padding:0px var(--jha-list-item-horizontal-spacing)}jha-tooltip{--jha-tooltip-width:269px;--jha-tooltip-white-space:normal;--jha-tooltip-text-align:left}
1.no-content{fill:var(--body-text-secondary-color);padding:0px var(--jha-list-item-horizontal-spacing)}.error{fill:var(--color-warning)}.empty-list{fill:var(--body-text-secondary-color)}.sub-heading{color:var(--body-text-secondary-color)}.pseudo-header{color:var(--body-text-secondary-color);padding:16px var(--jha-list-item-horizontal-spacing);justify-content:space-between;align-items:center;font-size:14px;font-weight:400;line-height:20px;display:flex}`}renderTooltip(){return r`<jha-tooltip ?top-left="${i.isMobile()}" ?top="${!i.isMobile()}" slot="header-right" text="${`This setting allows users to view links to additional services. What users can do within those services is defined by the service.`}"> <jh-icon-circle-info></jh-icon-circle-info> </jha-tooltip>`}render(){if(!this.user||!this.subUser)return``;let e=`Manage ${this.subUser.name}âs ability to view the additional services enabled by ${this.user.profile.organization.summary.organizationName}.`;return r`<jha-card .hasData="${!!this.applications.length}" .loading="${this.state===f.LOADING}"> ${this.showHeader?r`<jha-card-header slot="header"> <h1>${`Additional services`}</h1> ${this.renderTooltip()} </jha-card-header>`:r`<div class="pseudo-header" slot="header"> <div>${e}</div> ${this.renderTooltip()} </div>`} <article> ${this.showHeader?r`<p class="sub-heading">${e}</p>`:``} <bannoweb-sub-user-external-applications-list .applications="${this.applications.slice(0,this.maxDisplayed)}" .updating="${this.state===f.UPDATING}" .disabled="${!this.isAdminUser(this.user.profile.organization.adminLevel)}" @toggle-item="${this.onToggleItem}"></bannoweb-sub-user-external-applications-list> </article> ${this.showFooter()?r`<footer> <jha-link-button type="button" sync outline href="external-applications"> ${`See more`} </jha-link-button> </footer>`:``} <div slot="no-content" class="no-content"> ${this.state===f.ERROR?r`<div> <jh-icon-circle-info class="error"></jh-icon-circle-info> <div>${`Failed to load additional services.`}</div> <jha-button link sync @click="${this.loadApps}"> ${`Try again`} </jha-button> </div>`:r`<jh-icon-circle-info class="empty-list"></jh-icon-circle-info> <div>${`No external applications are available for ${this.subUser.name}.`}</div>`} </div> </jha-card>`}},customElements.define(window.BannowebSubUserExternalApplicationsCard.is,window.BannowebSubUserExternalApplicationsCard),window.BannowebSubUserExternalApplicationsCard;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.