UNPKG

@zywave/zywave-api-toolkit-bundle

Version:

184 lines (183 loc) 35.6 kB
import{Z as e,T as t,E as i,i as a,n as s,a as r,x as o,o as n}from"./internals/_baebe903.js";import{A as l}from"./internals/_6186bfaf.js"; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const h=(e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */;function d(e,t){return(i,a,s)=>{const r=t=>t.renderRoot?.querySelector(e)??null;if(t){const{get:e,set:t}="object"==typeof a?i:s??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return h(i,a,{get(){let i=e.call(this);return void 0===i&&(i=r(this),(null!==i||this.hasUpdated)&&t.call(this,i)),i}})}return h(i,a,{get(){return r(this)}})}} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const p=1,c=2,u=e=>(...t)=>({_$litDirective$:e,values:t});let f=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,i){this._$Ct=e,this._$AM=t,this._$Ci=i}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}; /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const{I:g}=e,m=()=>document.createComment(""),y=(e,t,i)=>{const a=e._$AA.parentNode,s=void 0===t?e._$AB:t._$AA;if(void 0===i){const t=a.insertBefore(m(),s),r=a.insertBefore(m(),s);i=new g(t,r,e,e.options)}else{const t=i._$AB.nextSibling,r=i._$AM,o=r!==e;if(o){let t;i._$AQ?.(e),i._$AM=e,void 0!==i._$AP&&(t=e._$AU)!==r._$AU&&i._$AP(t)}if(t!==s||o){let e=i._$AA;for(;e!==t;){const t=e.nextSibling;a.insertBefore(e,s),e=t}}}return i},v=(e,t,i=e)=>(e._$AI(t,i),e),w={},b=e=>{e._$AR(),e._$AA.remove()},$=(e,t,i)=>{const a=new Map;for(let s=t;s<=i;s++)a.set(e[s],s);return a},k=u(class extends f{constructor(e){if(super(e),e.type!==c)throw Error("repeat() can only be used in text expressions")}dt(e,t,i){let a;void 0===i?i=t:void 0!==t&&(a=t);const s=[],r=[];let o=0;for(const t of e)s[o]=a?a(t,o):o,r[o]=i(t,o),o++;return{values:r,keys:s}}render(e,t,i){return this.dt(e,t,i).values}update(e,[i,a,s]){const r=(e=>e._$AH)(e),{values:o,keys:n}=this.dt(i,a,s);if(!Array.isArray(r))return this.ut=n,o;const l=this.ut??=[],h=[];let d,p,c=0,u=r.length-1,f=0,g=o.length-1;for(;c<=u&&f<=g;)if(null===r[c])c++;else if(null===r[u])u--;else if(l[c]===n[f])h[f]=v(r[c],o[f]),c++,f++;else if(l[u]===n[g])h[g]=v(r[u],o[g]),u--,g--;else if(l[c]===n[g])h[g]=v(r[c],o[g]),y(e,h[g+1],r[c]),c++,g--;else if(l[u]===n[f])h[f]=v(r[u],o[f]),y(e,r[c],r[u]),u--,f++;else if(void 0===d&&(d=$(n,f,g),p=$(l,c,u)),d.has(l[c]))if(d.has(l[u])){const t=p.get(n[f]),i=void 0!==t?r[t]:null;if(null===i){const t=y(e,r[c]);v(t,o[f]),h[f]=t}else h[f]=v(i,o[f]),y(e,r[c],i),r[t]=null;f++}else b(r[u]),u--;else b(r[c]),c++;for(;f<=g;){const t=y(e,h[g+1]);v(t,o[f]),h[f++]=t}for(;c<=u;){const e=r[c++];null!==e&&b(e)}return this.ut=n,((e,t=w)=>{e._$AH=t})(e,h),t}}),z={userHeader:"Account Information",manageUserLink:"Manage account",logoutUserLink:"Log out",profileHeader:"Profile Information",manageProfileLink:"Edit profile",switchProfileLink:"Switch profile",impersonatingVerb:"acting as",notificationsHeader:"Notifications",notificationsLabel:"Unread notifications",noNotificationsLabel:"No unread notifications",notificationsLink:"View all",copyright:"© 1995 - {0} Zywave, Inc. All rights reserved.",tosLink:"Terms and Conditions",privacyLink:"Privacy Statement",dmcaLink:"DMCA",cookiesLink:"Cookie Usage",contactLinkTitle:"Contact",contactLink:"https://support.zywave.com/s/contactsupport",loginUserText:"Log in",featureFlagsHeader:"Early feature access"},U=u(class extends f{constructor(e){if(super(e),e.type!==p||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[i]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}const a=e.element.classList;for(const e of this.st)e in i||(a.remove(e),this.st.delete(e));for(const e in i){const t=!!i[e];t===this.st.has(e)||this.nt?.has(e)||(t?(a.add(e),this.st.add(e)):(a.remove(e),this.st.delete(e)))}return t}}); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ class C extends f{constructor(e){if(super(e),this.it=i,e.type!==c)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===i||null==e)return this._t=void 0,this.it=e;if(e===t)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const a=[e];return a.raw=a,this._t={_$litType$:this.constructor.resultType,strings:a,values:[]}}}C.directiveName="unsafeHTML",C.resultType=1;const L=u(C),S=a`:host{display:contents}:host :not(:defined){display:none}.theme-logo{width:auto;height:100%}zui-shell{--zui-shell-primary-theme:var(--zywave-shell-primary-color, var(--zui-blue-500))}.legalese{display:block}.notify-parent{position:fixed;top:var(--zui-shell-topbar-global-height);left:0;width:calc(100vw - 1.25rem);visibility:hidden;margin-top:1.25rem}.profile-type-identifier,.profile-types-list{list-style:none;padding:0}:not(:defined){display:none;width:0;height:0;visibility:hidden}.feature-flags-header{padding:.625rem .9375rem;background:var(--zui-gray-50);font-weight:700}slot[name=experimentalassistant]{display:none}@media(min-width:45em){slot[name=experimentalassistant]{display:contents}}::slotted([slot=experimentalassistant]){min-width:0}`;function D(e,t=!1){return new Promise(((i,a)=>{setTimeout((()=>t?a(new Error("Sleep rejected")):i()),e)}))} /** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const P="important",x=" !"+P,N=u(class extends f{constructor(e){if(super(e),e.type!==p||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const a=e[i];return null==a?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`}),"")}update(e,[i]){const{style:a}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(i)),this.render(i);for(const e of this.ft)null==i[e]&&(this.ft.delete(e),e.includes("-")?a.removeProperty(e):a[e]=null);for(const e in i){const t=i[e];if(null!=t){this.ft.add(e);const i="string"==typeof t&&t.endsWith(x);e.includes("-")||i?a.setProperty(e,i?t.slice(0,-11):t,i?P:""):a[e]=t}}return t}}),_=a`@supports(scrollbar-width:thin){.options-list{scrollbar-color:var(--zui-gray-400) var(--zui-gray-50);scrollbar-width:thin}}@supports not (scrollbar-width:thin){.options-list::-webkit-scrollbar{width:7px;height:7px;background-color:var(--zui-gray-50)}.options-list::-webkit-scrollbar-thumb{background-color:var(--zui-gray-400);border-radius:10px}}:host{display:block}.wrapper{position:relative;width:100%}@media(min-width:45em){.wrapper{width:auto}}.input-wrapper{position:relative;background:#fff;border-radius:.25rem}.input-wrapper zui-icon{--zui-icon-size:1.0625rem;position:absolute;top:calc(50% - .53125rem);left:.8125rem;z-index:1;fill:var(--zui-gray-400)}.input-wrapper input{position:relative;display:inline-block;width:100%;min-width:0;min-height:2.625rem;z-index:2;vertical-align:middle;padding:0 .625rem 0 2.5rem;background-color:rgba(0,0,0,0);border:.0625rem solid var(--zui-gray-200);border-radius:.25rem;font:inherit;color:inherit;transition:border .1s ease-in-out,box-shadow .1s ease-in-out,width 250ms ease-in-out;box-sizing:border-box;appearance:textfield}@media(min-width:45em){.input-wrapper input{min-width:69ch}}.input-wrapper input::placeholder{color:var(--zui-gray-300)}.input-wrapper input::-webkit-input-placeholder{color:var(--zui-gray-300)}.input-wrapper input::-moz-placeholder{opacity:1;color:var(--zui-gray-300)}.input-wrapper input:-moz-placeholder{opacity:1;color:var(--zui-gray-300)}.input-wrapper input:-ms-input-placeholder{color:var(--zui-gray-300)}.input-wrapper input::-ms-clear{display:none;width:0;height:0}.input-wrapper input::-ms-reveal{display:none;width:0;height:0}.input-wrapper input:not(output):-moz-ui-invalid{box-shadow:none}.input-wrapper input::-webkit-search-cancel-button,.input-wrapper input::-webkit-search-decoration,.input-wrapper input::-webkit-search-results-button,.input-wrapper input::-webkit-search-results-decoration{display:none}.input-wrapper input:hover{border-color:var(--zui-gray-300)}.input-wrapper input:focus{border-color:var(--zui-blue-400);box-shadow:0 0 0 .0625rem var(--zui-blue-400);outline:0}.input-wrapper input[disabled]{background-color:var(--zui-gray-100);cursor:not-allowed;color:var(--zui-gray)}.input-wrapper input[disabled]:hover{border:.0625rem solid var(--zui-gray-200)}.input-wrapper input[readonly]{background:rgba(0,0,0,0);border:0;outline:0;color:var(--zui-gray);pointer-events:none}.options-list{width:calc(100% - 2.5rem);max-width:69ch;max-height:80vh;z-index:1;overflow-y:auto;padding:1.5625rem 0 .9375rem;background-color:#fff;border:0;border-radius:.25rem;box-shadow:0 .0625rem .1875rem .0625rem rgba(0,0,0,.16);color:var(--zui-gray-700);transition:max-height .2s,padding .2s,box-shadow .2s,transform .3s;scroll-behavior:smooth}@media(min-width:45em){.options-list{width:69ch;max-width:none}}.options-list:popover-open{position:fixed;inset:unset}.options-list .options-group{display:block}.options-list .group-label{display:flex;justify-content:space-between;align-items:center;padding:1.25rem 1.5625rem .75rem;font-size:.75rem;font-weight:700;text-transform:uppercase}.options-list .group-label:first-child{padding-top:0}.options-list .option{display:flex;height:2.6rem;align-items:center;padding:.5rem 1.5625rem;background-color:rgba(0,0,0,0);cursor:pointer;color:var(--zui-gray-600);transition:background-color .1s ease-in-out;text-decoration:none}.options-list .option:hover{background-color:var(--zui-gray-50)}.options-list .option:focus{background-color:var(--zui-gray-50);outline:0}.options-list .option zui-icon{--zui-icon-size:1.25rem;align-self:flex-start;margin-top:.5ch;margin-right:.9375rem}.options-list .description{width:calc(100% - 1.875rem);align-self:stretch}.options-list .first-line{font-weight:700}.options-list .second-line{font-size:.75rem;color:var(--zui-gray-500)}.options-list .first-line,.options-list .second-line{display:block;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.options-list .no-results{padding:.5rem 1.5625rem;font-style:italic;color:var(--zui-gray-800)}.see-more{display:block;padding:0 1.5625rem}.see-more a{display:inline-block;vertical-align:baseline;margin:0;padding:.5rem 0 .625rem;font-size:.75rem;font-weight:600;cursor:pointer;color:var(--zui-blue);text-decoration:none}.see-more a:hover{color:var(--zui-blue-400)}.see-more a:focus{outline:.0625rem solid var(--zui-blue);outline-offset:.25rem;text-decoration:none}.see-more a:active{outline:0;color:var(--zui-blue-600);text-decoration:underline}.no-results+.group-label,.see-more+.group-label{margin-top:.625rem;border-top:1px solid var(--zui-gray-100)}.skeleton{position:relative;display:inline-block;height:1.6em;overflow:hidden;background-color:var(--zui-gray-100);border-radius:.1875rem}.skeleton::after{position:absolute;top:0;right:0;bottom:0;left:0;content:"";background-image:linear-gradient(90deg,rgba(255,255,255,0) 0,rgba(255,255,255,.2) 20%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0));animation:shimmer 2s infinite;transform:translateX(-100%)}@keyframes shimmer{100%{transform:translateX(100%)}}zui-icon.skeleton{width:1.25rem;height:1.25rem;border-radius:50%}.skeleton.group-label{width:10ch;margin:0 1.5625rem .75rem;padding:0}.skeleton.first-line,.skeleton.second-line{height:1.6em}.skeleton.first-line{margin-bottom:.15625rem}.skeleton.second-line{width:70%;margin-top:.15625rem}.skeleton.see-more{width:8ch;margin-left:1.5625rem;padding:0}`;var T=function(e,t,i,a){var s,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};class R extends r{#e;#t;#i;#a;#s;#r;#o;#n;#l;get value(){return this.#t}set value(e){const t=this.#t;this.#t=e,this.requestUpdate("value",t)}static get styles(){return[_]}get#h(){return this._input?.value}constructor(){super(),this.#t="",this.#r=!1,this.#o=!1,this.placeholder="Search...",this.#l=e=>{this.#d(e)}}connectedCallback(){super.connectedCallback(),window.addEventListener("topbarheightchange",this.#l)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("topbarheightchange",this.#l)}async firstUpdated(e){super.firstUpdated(e),this.#a=window.zywave?.zapi?._popover?.requiresPolyfill?window.zywave.zapi._popover.loadPolyfill():Promise.resolve(),await this.#a,this.requestUpdate(),this.#n=this._input.getBoundingClientRect().top}render(){return o`${this.#p()}<div class="wrapper">${this.#c()} ${this.#u()}</div><slot></slot>`}#p(){return window.zywave?.zapi?._popover?.requiresPolyfill?o`<link href="${window.zywave.zapi._popover.cssUri}" rel="stylesheet">`:i}#c(){return o`<div class="input-wrapper"><zui-icon icon="zui-search"></zui-icon><input id="search" aria-label="Search" type="search" .value="${this.value||""}" placeholder="${this.placeholder??""}" @input="${()=>this.#f()}" @keyup="${e=>this.#g(e)}" popovertarget="list" autocomplete="nope"></div>`}#u(){if(!this._input)return i;const e=this._input.getBoundingClientRect(),t={};window.zywave?.zapi?._popover?.requiresPolyfill&&(t.position="fixed",t.inset="unset"),t.top=`${e.height}px`;const a=this._input.getBoundingClientRect().top;this.#n!==a&&(this.#n=a),window.zywave?.zapi?._popover?.requiresPolyfill||(t.top=`${this.#n+e.height}px`,t.left=`${e.left}px`);const s=structuredClone(this.#e??[]),r=e=>o`<a href="${e.href}" class="option" @click="${()=>this.#m(e)}"><zui-icon icon="${e.icon??"zui-rocket"}" class="small"></zui-icon><div class="description"><div class="first-line" title="${e.title}">${e.title}</div><div class="second-line" title="${e.subtitle}">${e.subtitle}</div></div></a>`;return o`<div id="list" class="options-list" style="${N(t)}" popover @toggle="${this.#y}">${this.#o?this.#v():k(s,(e=>o`<div class="group-label">${e.entityName}</div>${e.items.length>0?k(e.items,r):o`<div class="no-results">No results found.</div>`} ${e.items.length>0?o`<div class="see-more"><a href="${e.items[0].searchPageUri}" @click="${()=>this.#w(e)}">See all results</a></div>`:i}`))}<slot></slot></div>`}#b(){return o`${k([1,2,3,4,5],(()=>o`<div class="option"><zui-icon icon="" class="small skeleton"></zui-icon><div class="description"><div class="first-line skeleton"> </div><div class="second-line skeleton"> </div></div></div>`))}`}#v(){return o`<div class="group-label skeleton"> </div>${this.#b()}`}async#$(e,t){const i=performance.now(),a=new URL("shell/v2.0/search",this.apiUrl);e&&a.searchParams.set("query",e),a.searchParams.set("host",window.location.hostname);const s=await this._apiClient.fetch(a,{signal:t});if(s instanceof Response&&200===s.status&&!t.aborted){const t=performance.now();this.#e=await s.json();const a={duration:t-i,query:e};for(const e of this.#e)a[`${e.entityName} - Count`]=e.items?.length??0,a[`${e.entityName} - Timed Out`]=e.timedOut,a[`${e.entityName} - Elapsed Milliseconds`]=e.elapsedMs;this.dispatchEvent(new CustomEvent("search",{detail:a,bubbles:!1})),this.requestUpdate()}}#f(){this.#k(),this.#o=!0,this.requestUpdate(),this.#i&&(window.clearTimeout(this.#i),this.#s?.abort()),this.#s=new AbortController;const e=this.#s.signal,t=async()=>{e.aborted||(await this.#$(this.#h,this.#s.signal),this.#o=!1,this.requestUpdate())};this.#i=window.setTimeout((()=>{t()}),300)}#y(e){this.#r="closed"===e.oldState&&"open"===e.newState,this.#r||this.#z()}#k(){const e=()=>{this._list?.showPopover?.(),this._input?.focus(),this.#r=!0};this.#a?this.#a?.then(e):e()}#m(e){const t={entityName:e.entityName,title:e.title,subtitle:e.subtitle,href:e.href,query:this.#h};this.dispatchEvent(new CustomEvent("clickresult",{detail:t,bubbles:!1}))}#w(e){const t={entityName:e.entityName,searchPageUri:e.items[0].searchPageUri,query:this.#h};this.dispatchEvent(new CustomEvent("clickseemore",{detail:t,bubbles:!1}))}#g(e){"Enter"===e.key&&this.dispatchEvent(new CustomEvent("inputkeypress",{detail:{key:e.key,query:this.#h},bubbles:!1}))}#z(){this.dispatchEvent(new CustomEvent("dismiss",{detail:{query:this.#h},bubbles:!1}))}#d(e){const t=e,i=t.detail?.topbarVisible;this._list.style.transform=i?"none":"translateY(calc(var(--zui-shell-topbar-global-height) * -1))",this.requestUpdate()}}T([s({type:String})],R.prototype,"value",null),T([s({type:String,attribute:"placeholder"})],R.prototype,"placeholder",void 0),T([d("#search")],R.prototype,"_input",void 0),T([d("#list")],R.prototype,"_list",void 0),window.customElements.define("zywave-shell-omnisearch",R);const A=a`:host{display:block}:host(:not(:last-of-type):not(:only-of-type)) .feature{margin-bottom:1.25rem}.feature{display:flex;align-items:center;margin:.625rem .9375rem .6875rem}.feature .header{margin-right:.625rem}.feature zui-toggle{margin-left:auto}`;var I=function(e,t,i,a){var s,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};class E extends r{constructor(){super(...arguments),this.header="",this.description="",this.checked=!1}static get styles(){return[A]}render(){return o`<div class="feature"><div class="header">${this.header}</div><zui-tooltip position="bottom"><zui-icon class="small" icon="zui-details" slot="trigger"></zui-icon><span slot="message">${this.description}</span></zui-tooltip><zui-toggle ?checked="${this.checked}" @change="${()=>this.checked=this._toggle.checked}"></zui-toggle></div>`}}I([s({type:String})],E.prototype,"header",void 0),I([s({type:String})],E.prototype,"description",void 0),I([s({type:Boolean,reflect:!0})],E.prototype,"checked",void 0),I([d("zui-toggle")],E.prototype,"_toggle",void 0),window.customElements.define("zywave-shell-feature",E);var q=function(e,t,i,a){var s,r=arguments.length,o=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o};class F extends r{static get styles(){return[S]}get appName(){return this.#U?this.#C:null}set appName(e){const t=this.#C;this.#C=e,this.requestUpdate("appName",t)}get state(){return this.#L}#S;#D;#P;#x;#N;#_;#T;#R;#A;#I;#E;#q;#F;#O;#j;#H;#M;#B;#Z;#L;#V;#K;#C;#Y;#Q;get#G(){return!!this.#N}get#W(){return this.#E}get#U(){return!(!this.querySelector('* > [slot="nav"]')&&!this.noNav)}constructor(){super(),this.navTags=null,this.activeNavId=null,this.navCollapsed=null,this.copyrightYear=(new Date).getFullYear(),this.culture=window.navigator.language,this.logoutUserUrl=null,this.profileSwitchTypeCodes=null,this.loginUserUrl=null,this.switchProfileHandlerUrl=null,this.switchProfileRedirectUrl=null,this.noNav=!1,this.noSearch=!1,this.logoUri=null,this.analyticsUserProperties=null,this.#q=!1,this.#F=!1,this.#O=!1,this.#j=!1,this.#H=!1,this.#M=!1,this.#B=!1,this.#L="loading",this.#C=null,this.#Y=null,this.#Y=this.attachInternals?.(),this.#V=window.performance.now()}connectedCallback(){super.connectedCallback(),this.#X("loading"),this.#Q=this.#J.bind(this),document.addEventListener("keydown",this.#Q)}disconnectedCallback(){super.disconnectedCallback(),this.#Q&&(document.removeEventListener("keydown",this.#Q),this.#Q=void 0)}async firstUpdated(e){super.firstUpdated(e),await this._apiClientReady,await this.#ee(),this.#te(),this.profileSwitchTypeCodes??=[],this.#_&&!this.profileSwitchTypeCodes.includes(this.#_.typeCode)&&this.profileSwitchTypeCodes.push(this.#_.typeCode),this.#K=window.performance.now(),this.updateComplete.then((()=>{this.#X("interactive","loading")})),this.track("ZywaveShellUtilization",{navOverridden:this.#U.toString(),appName:this.appName,loadTime:this.#K-this.#V})}render(){return o` ${this.#ie()} <zui-shell part="shell" app-name="${this.appName||""}"> <zui-shell-topbar part="topbar" @topbarheightchange="${this.#d}"> ${this.#ae()} ${this.#se()} ${this.#re()} ${this.#oe()} </zui-shell-topbar> ${this.#ne()} <slot slot="nav" name="nav">${this.#le()}</slot> <zui-shell-content part="content"> <div class="notify-parent"></div> <slot></slot> </zui-shell-content> ${this.#he()} </zui-shell> `}async notify(e,t,i,a){if(!this.#Z){const e=await import("./internals/_600342e6.js");this.#Z=new e.NotifierController(this.shadowRoot,".notify-parent")}this.#Z.show(e,t,i,a?.duration)}track(e,t){l.track(e,t)}#ae(){const e=this.#S||[],t=this.logoUri,i=t?o` <zui-logo slot="logo" part="logo" class="${U({"static-logo-uri":!!this.logoUri})}"> <img class="theme-logo" src="${t}" /> </zui-logo>`:o`<zui-logo slot="logo"></zui-logo>`;if(!e.length)return i;const a=e?.map((e=>o` <zui-shell-apps-item id="${e.id}" name="${e.text}" url="${e.href}"></zui-shell-apps-item> `))??[];return o` <zui-shell-apps slot="apps" class="${U({loading:!this.#q})}"> ${a} ${i} </zui-shell-apps> `}#se(){return o` <slot name="search" slot="search"> ${this.#de()} </slot> <slot name="experimentalassistant" slot="search"></slot> `}#de(){return this.#I?.searchProviders?.length?o`<zywave-shell-omnisearch slot="search" @search="${this.#pe}" @clickresult="${this.#ce}" @clickseemore="${this.#ue}" @dismiss="${this.#fe}" @inputkeypress="${this.#ge}" ></zywave-shell-omnisearch> `:i}#le(){if(this.noNav||this.#F&&!this.#U&&!this.#D?.length)return i;const e=this.#D||[],t=this.#P||[],a=e=>{if(this.activeNavId)return e.id?.toLowerCase()===this.activeNavId.toLowerCase();if(e.href)try{return window.location.toString().startsWith(new URL(e.href).href)}catch{return!1}return!1},s=e=>{if(!e)return e;try{const t=new URL(e);return"localhost"===window.location.hostname||window.location.origin===t.origin?t.pathname+t.search:t.href}catch{return e}},r=e=>{const t=e.items&&e.items.length;return o` <zui-icon slot="icon" icon="${n(e.icon??void 0)}"></zui-icon> ${e.href?o`<a id="${e.id}" ?active="${a(e)}" href="${n(s(e.href))}" @click="${this.#me}" rel="noopener" >${e.text}</a >`:o`<span id="${e.id}">${e.text}</span>`} ${t?e.items.map((e=>o`<a id="${e.id}" ?active="${a(e)}" href="${n(s(e.href))}" @click="${this.#me}" >${e.text}</a >`)):i}`},l=e?.map((e=>{const t=e.items&&e.items.length;return o` <zui-shell-nav-item data-nav-id="${e.id}" ?expanded="${t&&e.items.some(a)}" ?subnav="${t}" >${r(e)}</zui-shell-nav-item > `}))??[],h=t?.map((e=>{const t=e.items&&e.items.length;return o` <zui-shell-nav-item data-nav-id="${e.id}" ?expanded="${t&&e.items.some(a)}" ?subnav="${t}" slot="utility" >${r(e)}</zui-shell-nav-item > `}))??[];return o` <zui-shell-nav part="nav" class="${U({loading:!this.#F||!this.#O})}" ?collapsed="${this.navCollapsed}" @navcollapsechange="${e=>this.navCollapsed=e.detail}" > <slot name="context-switcher"></slot> ${l} ${h} </zui-shell-nav> `}#re(){if(!this.#x?.items?.length)return i;const e=this.#x.items.map((e=>o`<a id="${e.id}" href="${e.href}" rel="noopener" target="_blank">${e.text}</a>`));return o` <zui-shell-help slot="help" id="${this.#x?.id}" icon="${n(this.#x?.icon??void 0)}" help-header="${this.#x?.text??""}" >${e} </zui-shell-help> `}#oe(){const e=this.#N,t=this.#_,a=this.#T,s=t?.hasMultipleProfiles??!1;let r=t?.switchProfileUrl;return r??=void 0,o` <zui-shell-user class="${U({loading:!this.#j||!this.#H||!this.#M})}" slot="user" switch-profile-url="${n(r)}" ?has-multiple-profiles="${s}" ?unauthenticated="${null!==this.#G&&!this.#G}" login-user-text="${z?.loginUserText}" login-user-url="${this.loginUserUrl||""}" avatar="${e?.picture||""}" username="${e?.preferred_username||""}" given-name="${e?.given_name||""}" family-name="${e?.family_name||""}" logout-user-url="${this.logoutUserUrl||""}" manage-user-url="${e?.profile||""}" profile-name="${t?.profileName||""}" profile-detail="${t?.profileDetail||""}" manage-profile-url="${t?.manageProfileUrl||""}" ?impersonating="${t?.isImpersonating}" impersonating-profile-name="${t?.impersonatedProfileName||""}" notification-count="${a?.notificationCount||""}" view-notifications-url="${a?.notificationsUrl||""}" user-header="${z?.userHeader}" logout-user-text="${z?.logoutUserLink}" manage-user-text="${z?.manageUserLink}" profile-header="${z?.profileHeader}" manage-profile-text="${z?.manageProfileLink}" switch-profile-text="${z?.switchProfileLink}" impersonating-action="${z?.impersonatingVerb}" notifications-header="${z?.notificationsHeader}" notification-title="${z?.notificationsLabel}" no-notification-title="${z?.noNotificationsLabel}" view-notifications-text="${z?.notificationsLink}" > ${this.#W?.length?this.#ye():i} </zui-shell-user> `}#ye(){const e=e=>{this.#A[e]=!this.#A[e];const t={};t[`Feature flag: ${e}`]=this.#A[e],this.#ve(t),Promise.all([D(1500),this.#we(e,this.#A[e])]).then((()=>{window.location.reload()}))};return o`<div slot="feature-flags"> <div class="feature-flags-header">${z?.featureFlagsHeader}</div> ${k(this.#W??[],(t=>o`<zywave-shell-feature header="${z?.featureFlags?.[t]?.header||""}" description="${z?.featureFlags?.[t]?.description||""}" ?checked="${this.#A[t]}" @click="${()=>e(t)}" ></zywave-shell-feature>`))} </div>`}async#we(e,t){const i=new URL(`shell/v2.0/featureflag/${e}`,this.apiUrl);await this._apiClient.fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t})})}#he(){const e=z?.copyright.replace("{0}",this.copyrightYear.toString()),t="co.uk"===location.hostname.substring(location.hostname.length-5)?"co.uk":"com",i=`http://www.zywave.${t}/terms-conditions/`,a=`http://www.zywave.${t}/privacy-statement/`,s=`http://www.zywave.${t}/dmca-notice/`,r=`http://www.zywave.${t}/cookie-usage/`,l=z?.contactLink;return o` <zui-shell-footer part="footer"> <div class="legalese"> <slot name="legalese"></slot> </div> <div>${e}</div> <a target="_blank" href="${i}" rel="noopener">${z?.tosLink}</a> <a target="_blank" href="${a}" rel="noopener">${z?.privacyLink}</a> <a target="_blank" href="${s}" rel="noopener">${z?.dmcaLink}</a> <a target="_blank" href="${r}" rel="noopener">${z?.cookiesLink}</a> <a target="_blank" href="${n(l)}">${z?.contactLinkTitle}</a> </zui-shell-footer> `}#ie(){const e=this.analyticsUserProperties||null;return o`${this.#j?o`<zywave-analytics .userProperties="${e}" api-base-url="${n(this.apiBaseUrl??void 0)}" bearer-token="${n(this.bearerToken??void 0)}" profile-token="${n(this.profileToken??void 0)}" ></zywave-analytics>`:i}`}#ne(){const e=this.#R?.[0]?.message??null;return o`${this.#B&&null!==e?o`<zui-shell-banner type="warning"><span>${L(e)}</span></zui-shell-banner>`:i}`}async#ee(){if(this._authorized&&(await Promise.allSettled([this.#be(),this.#$e()]),this.#G)){const e=[this.#ke(),this.#ze(),this.#Ue()];await Promise.allSettled(e)}this.dispatchEvent(new CustomEvent("load")),this.requestUpdate()}async#te(){this.#G&&(await Promise.allSettled([this.#Ce(),this.#Le()]),this.#X("complete","interactive"),this.requestUpdate())}#X(e,t){if(t)try{this.#Y?.states?.delete(t)}catch{this.#Y?.states?.delete(`--${t}`)}this.#L=e;try{this.#Y?.states?.add(e)}catch{this.#Y?.states?.add(`--${e}`)}this.dispatchEvent(new CustomEvent(e))}async#ke(){const e=new URL("shell/v2.0/navitem",this.apiUrl);e.searchParams.set("culture",this.culture),(this.navTags||[]).forEach((t=>{e.searchParams.append("tags",t)})),this.#Se(e);const t=await this._apiClient.fetch(e);if(t instanceof Response&&t.ok){const e=await t.json();this.#S=e.filter((e=>"Apps"===e.menuType)),this.#q=!0,this.#D=e.filter((e=>"SideNav"===e.menuType)),this.#F=!0,this.#P=e.filter((e=>"Utility"===e.menuType)),this.#O=!0,this.#x=e.find((e=>"Help"===e.menuType)),this.requestUpdate()}}async#be(){const e=new URL("userinfo",this.apiUrl),t=await this._apiClient.fetch(e);if(t instanceof Response&&t.ok){const e=await t.json();this.#N=e}this.#j=!0,this.requestUpdate()}async#$e(){const e=new URL("shell/v2.0/profileinfo",this.apiUrl);(this.profileSwitchTypeCodes||[]).forEach((t=>{e.searchParams.append("typeCodes",t)})),this.switchProfileHandlerUrl&&e.searchParams.append("switchProfileHandlerUrl",this.switchProfileHandlerUrl),this.switchProfileRedirectUrl&&e.searchParams.append("switchProfileRedirectUrl",this.switchProfileRedirectUrl);const t=await this._apiClient.fetch(e);if(t instanceof Response&&200===t.status){const e=await t.json();this.#_=e,this.#H=!0,this.requestUpdate()}}async#Ce(){const e=new URL("shell/v2.0/notificationinfo",this.apiUrl);this.#Se(e);const t=await this._apiClient.fetch(e);if(t instanceof Response&&200===t.status){const e=await t.json();this.#T=e,this.#M=!0,this.requestUpdate()}}async#Le(){const e=new URL("shell/v2.0/notification/system",this.apiUrl),t=await this._apiClient.fetch(e);if(t instanceof Response&&200===t.status){const e=await t.json();this.#R=e,this.#B=!0,this.requestUpdate()}}async#Ue(){const e=await this._loadFeatureFlags();this.#A=e?.flagValues,this.#E=e?.userManagedFlags,this.requestUpdate()}async#ze(){const e=new URL("shell/v2.0/search/info",this.apiUrl);e.searchParams.set("host",window.location.hostname);const t=await this._apiClient.fetch(e);if(t instanceof Response&&200===t.status){const e=await t.json();this.#I=e}this.requestUpdate()}#me(e){return e.target instanceof HTMLElement&&(this.activeNavId=e.target.id),!this.onNavigate||this.onNavigate(e)}async#d(e){const t=e.detail?.height,i=await this._notifyParent;i.style.top=t||"",this.#Z&&this.#Z.reposition(),this.requestUpdate()}#Se(e){this.#_&&(e.searchParams.set("profileId",this.#_.id),e.searchParams.set("profileTypeCode",this.#_.typeCode))}#pe(e){this.track("ZywaveShell:Search",e.detail)}#ce(e){this.track("ZywaveShell:SearchResultClicked",e.detail)}#ue(e){this.track("ZywaveShell:SeeMoreClicked",e.detail)}#fe(e){this.track("ZywaveShell:SearchDismissed",e.detail)}#ge(e){this.track("ZywaveShell:SearchKeypress",e.detail)}#ve(e){this.track("ZywaveShell:FeatureFlagToggled",e)}#J(e){if(e.ctrlKey&&e.altKey&&"KeyZ"===e.code){const e={url:window.location.href,userAgent:window.navigator.userAgent,referrer:document.referrer};let t={};this.#N&&(t={sub:this.#N.sub,given_name:this.#N.given_name,family_name:this.#N.family_name,preferred_username:this.#N.preferred_username,email:this.#N.email});let i={};this.#_&&(i={profileId:this.#_.id,profileTypeCode:this.#_.typeCode,isImpersonating:this.#_.isImpersonating}),console.table({...e,...t,...i})}}}q([s({type:String,attribute:"app-name"})],F.prototype,"appName",null),q([s({type:Array,attribute:"nav-tags"})],F.prototype,"navTags",void 0),q([s({type:String,attribute:"active-nav-id"})],F.prototype,"activeNavId",void 0),q([s({type:Boolean,attribute:"nav-collapsed"})],F.prototype,"navCollapsed",void 0),q([s({type:Number,attribute:"copyright-year"})],F.prototype,"copyrightYear",void 0),q([s({type:String,attribute:"culture"})],F.prototype,"culture",void 0),q([s({type:String,attribute:"logout-user-url"})],F.prototype,"logoutUserUrl",void 0),q([s({type:Array,attribute:"profile-switch-type-codes"})],F.prototype,"profileSwitchTypeCodes",void 0),q([s({type:String,attribute:"login-user-url"})],F.prototype,"loginUserUrl",void 0),q([s({type:String,attribute:"switch-profile-handler-url"})],F.prototype,"switchProfileHandlerUrl",void 0),q([s({type:String,attribute:"switch-profile-redirect-url"})],F.prototype,"switchProfileRedirectUrl",void 0),q([s({type:Boolean,attribute:"no-nav"})],F.prototype,"noNav",void 0),q([s({type:Boolean,attribute:"no-search"})],F.prototype,"noSearch",void 0),q([s({type:String,attribute:"logo-uri"})],F.prototype,"logoUri",void 0),q([s({type:Object,attribute:"analytics-user-properties"})],F.prototype,"analyticsUserProperties",void 0),q([function(e){return(t,i)=>h(t,i,{async get(){return await this.updateComplete,this.renderRoot?.querySelector(e)??null}})}(".notify-parent")],F.prototype,"_notifyParent",void 0),window.customElements.define("zywave-shell",F);const O=!HTMLElement.prototype.hasOwnProperty("popover"),j=import.meta.url.substring(0,import.meta.url.lastIndexOf("/"));window.zywave=Object.assign({},window.zywave,{ZywaveApiClient:class{#De;get apiUrl(){return this.apiBaseUrl?new URL(this.apiBaseUrl,window.location.origin.toString()):void 0}constructor(e){if(!e||e?.apiProxyElement||e?.proxy){if(e?.apiProxyElement)this.#De=e.apiProxyElement;else{const t=e?.proxy?`zywave-api-proxy[name="${e.proxy}"]`:"zywave-api-proxy";this.#De=document.querySelector(t)}if(!this.#De)throw new Error("To use the configuration-less ZywaveApiClient, the proxy element must be in the document or must be provided.")}else{if(!e.apiBaseUrl?.trim().length)throw new Error("apiBaseUrl is required if not using the API Proxy.");if(!e.bearerToken)throw new Error("bearerToken is required if not using the API Proxy.");this.apiBaseUrl=e.apiBaseUrl,this.bearerToken=e.bearerToken,this.profileToken=e.profileToken}}async fetch(e,t){if(this.#De){const i=await this.#De._apiClient.fetch(e,t);if(i instanceof Response)return i;throw i}let i;if((t=t??{}).headers=new Headers(t.headers),this.bearerToken&&t.headers.set("Authorization",`Bearer ${this.bearerToken}`),this.profileToken&&t.headers.set("Profile",`Token ${this.profileToken}`),t.credentials||(t.credentials="include"),"string"==typeof e||e instanceof URL){const t=new URL(e.toString(),this.apiUrl);i=new Request(t.toString())}else{const t=new URL(e.url,this.apiUrl);i=new Request(t.toString(),e)}return window.fetch(i,t)}}}),window.zywave.zapi={...window.zywave.zapi,_popover:{requiresPolyfill:O,loadPolyfill:()=>import("./internals/_75d73e1b.js"),cssUri:`${j}/_polyfills/popover/popover.css`}};