@kodaris/krubble-app-components 1.0.76 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,26 +6,26 @@ import { KRHttp } from '@kodaris/krubble-http';
6
6
  * Copyright 2019 Google LLC
7
7
  * SPDX-License-Identifier: BSD-3-Clause
8
8
  */
9
- const t$4=globalThis,e$7=t$4.ShadowRoot&&(void 0===t$4.ShadyCSS||t$4.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$3),i$5=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$3(o,t,s$3)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$4.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
9
+ const t$4=globalThis,e$7=t$4.ShadowRoot&&(void 0===t$4.ShadyCSS||t$4.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$6=new WeakMap;let n$4 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$6.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$6.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$4("string"==typeof t?t:t+"",void 0,s$3),i$6=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$4(o,t,s$3)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$4.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
10
10
 
11
11
  /**
12
12
  * @license
13
13
  * Copyright 2017 Google LLC
14
14
  * SPDX-License-Identifier: BSD-3-Clause
15
- */const{is:i$4,defineProperty:e$6,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a$1=globalThis,c$2=a$1.trustedTypes,l$1=c$2?c$2.emptyScript:"",p$2=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$3={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$4(t,s),b$1={attribute:true,type:String,converter:u$3,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$6(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$3).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$3;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$2?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
15
+ */const{is:i$5,defineProperty:e$6,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$5,getPrototypeOf:n$3}=Object,a$1=globalThis,c$2=a$1.trustedTypes,l$1=c$2?c$2.emptyScript:"",p$2=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$3={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$5(t,s),b$1={attribute:true,type:String,converter:u$3,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$6(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$3(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$5(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$3).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$3;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$2?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
16
16
 
17
17
  /**
18
18
  * @license
19
19
  * Copyright 2017 Google LLC
20
20
  * SPDX-License-Identifier: BSD-3-Clause
21
21
  */
22
- const t$3=globalThis,i$3=t=>t,s$2=t$3.trustedTypes,e$5=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$1="$lit$",o$3=`lit$${Math.random().toFixed(9).slice(2)}$`,n$1="?"+o$3,r$2=`<${n$1}>`,l=document,c$1=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$2=Array.isArray,d=t=>u$2(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m$1=/>/g,p$1=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$5?e$5.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v$1;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v$1?"!--"===u[1]?c=_:void 0!==u[1]?c=m$1:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$1):void 0!==u[3]&&(c=p$1):c===p$1?">"===u[0]?(c=n??v$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$1:'"'===u[3]?$:g):c===$||c===g?c=p$1:c===_||c===m$1?c=v$1:(c=p$1,n=void 0);const x=c===p$1&&t[i+1].startsWith("/>")?" ":"";l+=c===v$1?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h$1+s.slice(d)+o$3+x):s+o$3+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$1)){const i=v[a++],s=r.getAttribute(t).split(o$3),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$3)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$3),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$1)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$3,t+1));)d.push({type:7,index:l}),t+=o$3.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M$1(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M$1(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M$1(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$3(t).nextSibling;i$3(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M$1(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M$1(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M$1(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M$1(this,t);}}const j={I:k},B=t$3.litHtmlPolyfillSupport;B?.(S,k),(t$3.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
22
+ const t$3=globalThis,i$4=t=>t,s$2=t$3.trustedTypes,e$5=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$1="$lit$",o$4=`lit$${Math.random().toFixed(9).slice(2)}$`,n$2="?"+o$4,r$2=`<${n$2}>`,l=document,c$1=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$2=Array.isArray,d=t=>u$2(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m$1=/>/g,p$1=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$5?e$5.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v$1;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v$1?"!--"===u[1]?c=_:void 0!==u[1]?c=m$1:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$1):void 0!==u[3]&&(c=p$1):c===p$1?">"===u[0]?(c=n??v$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$1:'"'===u[3]?$:g):c===$||c===g?c=p$1:c===_||c===m$1?c=v$1:(c=p$1,n=void 0);const x=c===p$1&&t[i+1].startsWith("/>")?" ":"";l+=c===v$1?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h$1+s.slice(d)+o$4+x):s+o$4+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$1)){const i=v[a++],s=r.getAttribute(t).split(o$4),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$4)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$4),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$2)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$4,t+1));)d.push({type:7,index:l}),t+=o$4.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M$1(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M$1(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M$1(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$4(t).nextSibling;i$4(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M$1(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M$1(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M$1(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M$1(this,t);}}const j={I:k},B=t$3.litHtmlPolyfillSupport;B?.(S,k),(t$3.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
23
23
 
24
24
  /**
25
25
  * @license
26
26
  * Copyright 2017 Google LLC
27
27
  * SPDX-License-Identifier: BSD-3-Clause
28
- */const s$1=globalThis;let i$2 = class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$2._$litElement$=true,i$2["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$2});const o$2=s$1.litElementPolyfillSupport;o$2?.({LitElement:i$2});(s$1.litElementVersions??=[]).push("4.2.2");
28
+ */const s$1=globalThis;let i$3 = class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$3._$litElement$=true,i$3["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$3});const o$3=s$1.litElementPolyfillSupport;o$3?.({LitElement:i$3});(s$1.litElementVersions??=[]).push("4.2.2");
29
29
 
30
30
  /**
31
31
  * @license
@@ -38,13 +38,13 @@ const t$2=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e
38
38
  * @license
39
39
  * Copyright 2017 Google LLC
40
40
  * SPDX-License-Identifier: BSD-3-Clause
41
- */const o$1={attribute:true,type:String,converter:u$3,reflect:false,hasChanged:f$1},r$1=(t=o$1,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,true,r);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,true,r);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
41
+ */const o$2={attribute:true,type:String,converter:u$3,reflect:false,hasChanged:f$1},r$1=(t=o$2,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,true,r);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,true,r);}}throw Error("Unsupported decorator location: "+n)};function n$1(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
42
42
 
43
43
  /**
44
44
  * @license
45
45
  * Copyright 2017 Google LLC
46
46
  * SPDX-License-Identifier: BSD-3-Clause
47
- */function r(r){return n({...r,state:true,attribute:false})}
47
+ */function r(r){return n$1({...r,state:true,attribute:false})}
48
48
 
49
49
  /**
50
50
  * @license
@@ -64,19 +64,19 @@ const e$4=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"obj
64
64
  * Copyright 2017 Google LLC
65
65
  * SPDX-License-Identifier: BSD-3-Clause
66
66
  */
67
- const t$1={ATTRIBUTE:1,CHILD:2},e$2=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
67
+ const t$1={ATTRIBUTE:1,CHILD:2},e$2=t=>(...e)=>({_$litDirective$:t,values:e});let i$2 = class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
68
68
 
69
69
  /**
70
70
  * @license
71
71
  * Copyright 2017 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */let e$1 = class e extends i$1{constructor(i){if(super(i),this.it=A,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};e$1.directiveName="unsafeHTML",e$1.resultType=1;const o=e$2(e$1);
73
+ */let e$1 = class e extends i$2{constructor(i){if(super(i),this.it=A,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};e$1.directiveName="unsafeHTML",e$1.resultType=1;const o$1=e$2(e$1);
74
74
 
75
75
  /**
76
76
  * @license
77
77
  * Copyright 2018 Google LLC
78
78
  * SPDX-License-Identifier: BSD-3-Clause
79
- */const e=e$2(class extends i$1{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
79
+ */const e=e$2(class extends i$2{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
80
80
 
81
81
  var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
82
82
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -84,7 +84,7 @@ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators,
84
84
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
85
85
  return c > 3 && r && Object.defineProperty(target, key, r), r;
86
86
  };
87
- let KRNavItemEdit = class KRNavItemEdit extends i$2 {
87
+ let KRNavItemEdit = class KRNavItemEdit extends i$3 {
88
88
  constructor() {
89
89
  super(...arguments);
90
90
  this.label = '';
@@ -188,7 +188,7 @@ let KRNavItemEdit = class KRNavItemEdit extends i$2 {
188
188
  `;
189
189
  }
190
190
  };
191
- KRNavItemEdit.styles = i$5 `
191
+ KRNavItemEdit.styles = i$6 `
192
192
  :host {
193
193
  display: block;
194
194
  width: 360px;
@@ -349,7 +349,7 @@ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators,
349
349
  * - Don't hardcode breadcrumbs
350
350
  * - Look at renderNormalFooter and renderEditFooter and see if that is what we want to do
351
351
  */
352
- let KRScaffold = class KRScaffold extends i$2 {
352
+ let KRScaffold = class KRScaffold extends i$3 {
353
353
  constructor() {
354
354
  super();
355
355
  /**
@@ -1369,7 +1369,7 @@ let KRScaffold = class KRScaffold extends i$2 {
1369
1369
  @click=${(e) => this.handleNavItemClick(e, item)}
1370
1370
  @contextmenu=${(e) => this.handleNavItemContextMenu(e, item)}
1371
1371
  >
1372
- ${this.navIconsDisplayed ? b `<span class="nav-item__icon">${o(item.icon || this.defaultNavItemIcon)}</span>` : A}
1372
+ ${this.navIconsDisplayed ? b `<span class="nav-item__icon">${o$1(item.icon || this.defaultNavItemIcon)}</span>` : A}
1373
1373
  <span class="nav-item__label">${item.label}</span>
1374
1374
  <svg
1375
1375
  class="nav-item__chevron"
@@ -1409,7 +1409,7 @@ let KRScaffold = class KRScaffold extends i$2 {
1409
1409
  @click=${(e) => this.handleNavItemClick(e, item)}
1410
1410
  @contextmenu=${(e) => this.handleNavItemContextMenu(e, item)}
1411
1411
  >
1412
- ${this.navIconsDisplayed && !isChild ? b `<span class="nav-item__icon">${o(item.icon || this.defaultNavItemIcon)}</span>` : A}
1412
+ ${this.navIconsDisplayed && !isChild ? b `<span class="nav-item__icon">${o$1(item.icon || this.defaultNavItemIcon)}</span>` : A}
1413
1413
  <span class="nav-item__label">${item.label}</span>
1414
1414
  </a>
1415
1415
  `;
@@ -1513,7 +1513,7 @@ let KRScaffold = class KRScaffold extends i$2 {
1513
1513
  `;
1514
1514
  }
1515
1515
  };
1516
- KRScaffold.styles = i$5 `
1516
+ KRScaffold.styles = i$6 `
1517
1517
  :host {
1518
1518
  display: flex;
1519
1519
  flex-direction: column;
@@ -2240,59 +2240,59 @@ KRScaffold.styles = i$5 `
2240
2240
  }
2241
2241
  `;
2242
2242
  __decorate$5([
2243
- n({ type: String })
2243
+ n$1({ type: String })
2244
2244
  ], KRScaffold.prototype, "logo", void 0);
2245
2245
  __decorate$5([
2246
- n({ type: String })
2246
+ n$1({ type: String })
2247
2247
  ], KRScaffold.prototype, "label", void 0);
2248
2248
  __decorate$5([
2249
- n({
2249
+ n$1({
2250
2250
  type: String,
2251
2251
  attribute: 'home-url'
2252
2252
  })
2253
2253
  ], KRScaffold.prototype, "homeUrl", void 0);
2254
2254
  __decorate$5([
2255
- n({
2255
+ n$1({
2256
2256
  type: String,
2257
2257
  reflect: true
2258
2258
  })
2259
2259
  ], KRScaffold.prototype, "scheme", void 0);
2260
2260
  __decorate$5([
2261
- n({ type: Array })
2261
+ n$1({ type: Array })
2262
2262
  ], KRScaffold.prototype, "nav", void 0);
2263
2263
  __decorate$5([
2264
- n({
2264
+ n$1({
2265
2265
  type: Boolean,
2266
2266
  attribute: 'nav-icons-displayed',
2267
2267
  reflect: true
2268
2268
  })
2269
2269
  ], KRScaffold.prototype, "navIconsDisplayed", void 0);
2270
2270
  __decorate$5([
2271
- n({
2271
+ n$1({
2272
2272
  type: Boolean,
2273
2273
  attribute: 'nav-expanded'
2274
2274
  })
2275
2275
  ], KRScaffold.prototype, "navExpanded", void 0);
2276
2276
  __decorate$5([
2277
- n({ type: Object })
2277
+ n$1({ type: Object })
2278
2278
  ], KRScaffold.prototype, "user", void 0);
2279
2279
  __decorate$5([
2280
- n({ type: Boolean })
2280
+ n$1({ type: Boolean })
2281
2281
  ], KRScaffold.prototype, "subbar", void 0);
2282
2282
  __decorate$5([
2283
- n({
2283
+ n$1({
2284
2284
  type: Boolean,
2285
2285
  attribute: 'nav-enabled'
2286
2286
  })
2287
2287
  ], KRScaffold.prototype, "navEnabled", void 0);
2288
2288
  __decorate$5([
2289
- n({
2289
+ n$1({
2290
2290
  type: String,
2291
2291
  attribute: 'user-type'
2292
2292
  })
2293
2293
  ], KRScaffold.prototype, "userType", void 0);
2294
2294
  __decorate$5([
2295
- n({ type: Array })
2295
+ n$1({ type: Array })
2296
2296
  ], KRScaffold.prototype, "breadcrumbs", void 0);
2297
2297
  __decorate$5([
2298
2298
  r()
@@ -2368,7 +2368,7 @@ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators,
2368
2368
  * @property {KRScreenNavItem[]} items - Navigation items as JSON array
2369
2369
  * @property {string} activeId - Currently active item ID
2370
2370
  */
2371
- let KRScreenNav = class KRScreenNav extends i$2 {
2371
+ let KRScreenNav = class KRScreenNav extends i$3 {
2372
2372
  constructor() {
2373
2373
  super(...arguments);
2374
2374
  /**
@@ -2484,7 +2484,7 @@ let KRScreenNav = class KRScreenNav extends i$2 {
2484
2484
  `;
2485
2485
  }
2486
2486
  };
2487
- KRScreenNav.styles = i$5 `
2487
+ KRScreenNav.styles = i$6 `
2488
2488
  :host {
2489
2489
  display: flex;
2490
2490
  height: 100%;
@@ -2577,16 +2577,16 @@ KRScreenNav.styles = i$5 `
2577
2577
  }
2578
2578
  `;
2579
2579
  __decorate$4([
2580
- n({ type: String })
2580
+ n$1({ type: String })
2581
2581
  ], KRScreenNav.prototype, "label", void 0);
2582
2582
  __decorate$4([
2583
- n({ type: String })
2583
+ n$1({ type: String })
2584
2584
  ], KRScreenNav.prototype, "subLabel", void 0);
2585
2585
  __decorate$4([
2586
- n({ type: Array })
2586
+ n$1({ type: Array })
2587
2587
  ], KRScreenNav.prototype, "items", void 0);
2588
2588
  __decorate$4([
2589
- n({ type: String })
2589
+ n$1({ type: String })
2590
2590
  ], KRScreenNav.prototype, "activeId", void 0);
2591
2591
  KRScreenNav = __decorate$4([
2592
2592
  t$2('kr-screen-nav')
@@ -2617,7 +2617,7 @@ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators,
2617
2617
  *
2618
2618
  * @property {string} title - Section title (e.g., "Company Details")
2619
2619
  */
2620
- let KRScreenDetail = class KRScreenDetail extends i$2 {
2620
+ let KRScreenDetail = class KRScreenDetail extends i$3 {
2621
2621
  constructor() {
2622
2622
  super(...arguments);
2623
2623
  /**
@@ -2641,7 +2641,7 @@ let KRScreenDetail = class KRScreenDetail extends i$2 {
2641
2641
  `;
2642
2642
  }
2643
2643
  };
2644
- KRScreenDetail.styles = i$5 `
2644
+ KRScreenDetail.styles = i$6 `
2645
2645
  :host {
2646
2646
  display: flex;
2647
2647
  flex-direction: column;
@@ -2687,7 +2687,7 @@ KRScreenDetail.styles = i$5 `
2687
2687
  }
2688
2688
  `;
2689
2689
  __decorate$3([
2690
- n({ type: String })
2690
+ n$1({ type: String })
2691
2691
  ], KRScreenDetail.prototype, "title", void 0);
2692
2692
  KRScreenDetail = __decorate$3([
2693
2693
  t$2('kr-screen-detail')
@@ -2704,7 +2704,7 @@ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators,
2704
2704
  *
2705
2705
  * @slot - Content to display in the subbar (right side)
2706
2706
  */
2707
- let KRSubbar = class KRSubbar extends i$2 {
2707
+ let KRSubbar = class KRSubbar extends i$3 {
2708
2708
  constructor() {
2709
2709
  super(...arguments);
2710
2710
  /**
@@ -2832,7 +2832,7 @@ let KRSubbar = class KRSubbar extends i$2 {
2832
2832
  `;
2833
2833
  }
2834
2834
  };
2835
- KRSubbar.styles = i$5 `
2835
+ KRSubbar.styles = i$6 `
2836
2836
  :host {
2837
2837
  display: flex;
2838
2838
  flex-direction: row;
@@ -2900,10 +2900,10 @@ KRSubbar.styles = i$5 `
2900
2900
  }
2901
2901
  `;
2902
2902
  __decorate$2([
2903
- n({ type: Array })
2903
+ n$1({ type: Array })
2904
2904
  ], KRSubbar.prototype, "breadcrumbs", void 0);
2905
2905
  __decorate$2([
2906
- n({ type: Boolean })
2906
+ n$1({ type: Boolean })
2907
2907
  ], KRSubbar.prototype, "menu", void 0);
2908
2908
  KRSubbar = __decorate$2([
2909
2909
  t$2('kr-subbar')
@@ -3045,7 +3045,7 @@ class KRRouter {
3045
3045
  KRRouter.base = '';
3046
3046
  KRRouter.routes = [];
3047
3047
  KRRouter.elementCache = new Map();
3048
- let KRRouterOutlet = class KRRouterOutlet extends i$2 {
3048
+ let KRRouterOutlet = class KRRouterOutlet extends i$3 {
3049
3049
  constructor() {
3050
3050
  super(...arguments);
3051
3051
  this.level = -1;
@@ -3090,7 +3090,7 @@ let KRRouterOutlet = class KRRouterOutlet extends i$2 {
3090
3090
  return b `${el}`;
3091
3091
  }
3092
3092
  };
3093
- KRRouterOutlet.styles = i$5 `
3093
+ KRRouterOutlet.styles = i$6 `
3094
3094
  :host {
3095
3095
  display: block;
3096
3096
  height: 100%;
@@ -3100,6 +3100,12 @@ KRRouterOutlet = __decorate$1([
3100
3100
  t$2('kr-router-outlet')
3101
3101
  ], KRRouterOutlet);
3102
3102
 
3103
+ /**
3104
+ * @license
3105
+ * Copyright 2018 Google LLC
3106
+ * SPDX-License-Identifier: BSD-3-Clause
3107
+ */const n="important",i$1=" !"+n,o=e$2(class extends i$2{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"style"!==t.name||t.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(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i$1);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return E}});
3108
+
3103
3109
  /**
3104
3110
  * @license
3105
3111
  * Copyright 2020 Google LLC
@@ -3111,7 +3117,7 @@ KRRouterOutlet = __decorate$1([
3111
3117
  * Copyright 2017 Google LLC
3112
3118
  * SPDX-License-Identifier: BSD-3-Clause
3113
3119
  */
3114
- const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=e$2(class extends i$1{constructor(e){if(super(e),e.type!==t$1.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){const d=M(s),{values:p$1,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p$1;const h$1=this.ut??=[],v$1=[];let m,y,x=0,j=d.length-1,k=0,w=p$1.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h$1[x]===a[k])v$1[k]=u$1(d[x],p$1[k]),x++,k++;else if(h$1[j]===a[w])v$1[w]=u$1(d[j],p$1[w]),j--,w--;else if(h$1[x]===a[w])v$1[w]=u$1(d[x],p$1[w]),v(s,v$1[w+1],d[x]),x++,w--;else if(h$1[j]===a[k])v$1[k]=u$1(d[j],p$1[k]),v(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h$1,x,j)),m.has(h$1[x]))if(m.has(h$1[j])){const e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){const e=v(s,d[x]);u$1(e,p$1[k]),v$1[k]=e;}else v$1[k]=u$1(t,p$1[k]),v(s,d[x],t),d[e]=null;k++;}else h(d[j]),j--;else h(d[x]),x++;for(;k<=w;){const e=v(s,v$1[w+1]);u$1(e,p$1[k]),v$1[k++]=e;}for(;x<=j;){const e=d[x++];null!==e&&h(e);}return this.ut=a,p(s,v$1),E}});
3120
+ const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=e$2(class extends i$2{constructor(e){if(super(e),e.type!==t$1.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){const d=M(s),{values:p$1,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p$1;const h$1=this.ut??=[],v$1=[];let m,y,x=0,j=d.length-1,k=0,w=p$1.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h$1[x]===a[k])v$1[k]=u$1(d[x],p$1[k]),x++,k++;else if(h$1[j]===a[w])v$1[w]=u$1(d[j],p$1[w]),j--,w--;else if(h$1[x]===a[w])v$1[w]=u$1(d[x],p$1[w]),v(s,v$1[w+1],d[x]),x++,w--;else if(h$1[j]===a[k])v$1[k]=u$1(d[j],p$1[k]),v(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h$1,x,j)),m.has(h$1[x]))if(m.has(h$1[j])){const e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){const e=v(s,d[x]);u$1(e,p$1[k]),v$1[k]=e;}else v$1[k]=u$1(t,p$1[k]),v(s,d[x],t),d[e]=null;k++;}else h(d[j]),j--;else h(d[x]),x++;for(;k<=w;){const e=v(s,v$1[w+1]);u$1(e,p$1[k]),v$1[k++]=e;}for(;x<=j;){const e=d[x++];null!==e&&h(e);}return this.ut=a,p(s,v$1),E}});
3115
3121
 
3116
3122
  /**
3117
3123
  * marked v12.0.2 - a markdown parser
@@ -5584,7 +5590,7 @@ const ACCEPTED_IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/web
5584
5590
  * @fires message-submit - When the user sends a message. Cancelable. Detail: `{ message: string }`
5585
5591
  * @fires stream-event - Dispatched for every SSE message received. Detail contains the parsed event data.
5586
5592
  */
5587
- let KRChatbot = class KRChatbot extends i$2 {
5593
+ let KRChatbot = class KRChatbot extends i$3 {
5588
5594
  constructor() {
5589
5595
  super(...arguments);
5590
5596
  // --- Private properties ---
@@ -5602,15 +5608,27 @@ let KRChatbot = class KRChatbot extends i$2 {
5602
5608
  this._dragStartTop = 0;
5603
5609
  this._resizeStartW = 0;
5604
5610
  this._resizeStartH = 0;
5611
+ /** Cursor X at debug-drawer resize start. */
5612
+ this._debugResizeStartX = 0;
5613
+ /** Debug-drawer width at resize start. */
5614
+ this._debugResizeStartW = 0;
5605
5615
  /** Counter for depth-aware dragenter/dragleave tracking. */
5606
5616
  this._dragDepth = 0;
5607
5617
  /** Monotonic id source for pending attachments. */
5608
5618
  this._pendingSeq = 0;
5609
5619
  /**
5610
- * Request-id guard for skill searches — bumped on each search so out-of-order
5611
- * responses are dropped (mirrors the kr-combo-box `_requestId` pattern).
5620
+ * Request-id guards for skill searches — bumped on each search so out-of-order
5621
+ * responses are dropped (mirrors the kr-combo-box `_requestId` pattern). Org and
5622
+ * global searches run concurrently into separate buffers, so each has its own.
5612
5623
  */
5613
5624
  this._skillRequestId = 0;
5625
+ this._globalSkillRequestId = 0;
5626
+ /**
5627
+ * Codes of global skills with an in-flight enable/disable request. The `+`
5628
+ * button reads this to show a pending state and ignore repeat clicks. Mutated
5629
+ * in place; call requestUpdate() after changing it to re-render.
5630
+ */
5631
+ this._globalSkillPending = new Set();
5614
5632
  // --- @property (public API) ---
5615
5633
  /**
5616
5634
  * Callback function for sending messages. Receives the user's message and
@@ -5674,6 +5692,39 @@ let KRChatbot = class KRChatbot extends i$2 {
5674
5692
  this._inputValue = '';
5675
5693
  this._isStreaming = false;
5676
5694
  this._error = '';
5695
+ /**
5696
+ * User-facing context warning text (`CONVERSATION_TOKEN_WARNING`). Shown as a
5697
+ * dismissible banner in all variants. Carries only friendly guidance, no numbers.
5698
+ */
5699
+ this._contextWarning = '';
5700
+ /**
5701
+ * True once the conversation hit the context-window limit
5702
+ * (`CONVERSATION_LIMIT_REACHED`, or `contextExceeded` on load). Drives a
5703
+ * blocking "start a new conversation" notice. User-facing, all variants.
5704
+ */
5705
+ this._contextLimitReached = false;
5706
+ /** Server-provided limit text (`CONVERSATION_LIMIT_REACHED`), if any. */
5707
+ this._contextLimitMessage = '';
5708
+ /**
5709
+ * INTERNAL-ONLY latest telemetry snapshot (last-value-wins). Populated from
5710
+ * `TOKEN_USAGE` events during streaming and hydrated from the conversation
5711
+ * DTO on load. Only surfaced in the `inline` variant's debug panel.
5712
+ */
5713
+ this._telemetry = null;
5714
+ /**
5715
+ * INTERNAL-ONLY per-iteration telemetry log for the debug panel's verbose
5716
+ * table. Append-only within a turn; reset at the start of each send. Each row
5717
+ * may be augmented with its `CACHE_CHECKPOINT` info.
5718
+ */
5719
+ this._iterationLog = [];
5720
+ /** Latest cache-checkpoint info keyed by iteration, for the verbose table. */
5721
+ this._cacheCheckpoints = {};
5722
+ /** Whether the internal debug panel is expanded (off by default). */
5723
+ this._debugPanelOpen = false;
5724
+ /** Current width of the debug drawer in px (user-resizable, persisted). */
5725
+ this._debugDrawerWidth = 430;
5726
+ /** True while the user is dragging the debug drawer's resize handle. */
5727
+ this._isDebugResizing = false;
5677
5728
  /** Images staged in the composer, before the message is sent. */
5678
5729
  this._pendingInternalFiles = [];
5679
5730
  /** True while a file is being dragged over the panel (shows the drop overlay). */
@@ -5683,10 +5734,24 @@ let KRChatbot = class KRChatbot extends i$2 {
5683
5734
  /** Current `/` query (text after the slash), sent to `_searchSkills`. */
5684
5735
  this._skillQuery = '';
5685
5736
  /**
5686
- * Latest skill search results. Shared by the `/` menu and the browse dialog —
5687
- * they're mutually exclusive (opening browse closes the menu), so one buffer.
5737
+ * Latest org skill search results (this instance's own skills). Backs the `/`
5738
+ * menu and the browse dialog's "Your Org" tab.
5688
5739
  */
5689
5740
  this._skillResults = [];
5741
+ /**
5742
+ * Latest shared-Kodaris (global) skill results, for the browse dialog's
5743
+ * "Kodaris" tab. Kept separate from `_skillResults` so switching tabs shows
5744
+ * fresh results immediately instead of the other tab's stale list — the browse
5745
+ * search fills both buffers at once.
5746
+ */
5747
+ this._globalSkillResults = [];
5748
+ /**
5749
+ * AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
5750
+ * `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
5751
+ * on the debug drawer toggle and the `/test-warning` / `/test-limit` composer
5752
+ * options — known up front, before any message.
5753
+ */
5754
+ this._aiFrameworkConfig = {};
5690
5755
  /** Highlighted item in the skill menu for keyboard navigation (-1 = none). */
5691
5756
  this._skillHighlighted = 0;
5692
5757
  /** Index of the message whose copy button just flashed "Copied" (-1 = none). */
@@ -5694,11 +5759,11 @@ let KRChatbot = class KRChatbot extends i$2 {
5694
5759
  /** Whether the "Browse all skills" dialog is open. */
5695
5760
  this._skillBrowseOpened = false;
5696
5761
  /**
5697
- * Active tab in the browse dialog. `org` lists this org's skills (searched via
5698
- * `_searchSkills`); `kodaris` is the shared global catalog, added later.
5762
+ * Active tab in the browse dialog. `org` shows `_skillResults` (this instance's
5763
+ * skills); `kodaris` shows `_globalSkillResults` (the shared global catalog).
5699
5764
  */
5700
5765
  this._skillBrowseSource = 'org';
5701
- /** Search text in the browse dialog, sent to `_searchSkills`. */
5766
+ /** Search text in the browse dialog, routed to the active tab's search. */
5702
5767
  this._skillBrowseQuery = '';
5703
5768
  this._handleMouseMove = (e) => {
5704
5769
  if (this._isDragging) {
@@ -5757,6 +5822,25 @@ let KRChatbot = class KRChatbot extends i$2 {
5757
5822
  document.removeEventListener('mouseup', this._handleMouseUp);
5758
5823
  this._saveState();
5759
5824
  };
5825
+ this._handleDebugResizeMouseMove = (e) => {
5826
+ if (!this._isDebugResizing) {
5827
+ return;
5828
+ }
5829
+ // Handle is on the drawer's left edge; dragging left (negative dx) widens it.
5830
+ const dx = e.clientX - this._debugResizeStartX;
5831
+ const minW = 300;
5832
+ // Never let the chat column shrink below 300px — cap the drawer at the
5833
+ // container width minus that reserved chat width.
5834
+ const minChatWidth = 300;
5835
+ const maxW = Math.max(minW, this.offsetWidth - minChatWidth);
5836
+ this._debugDrawerWidth = Math.max(minW, Math.min(this._debugResizeStartW - dx, maxW));
5837
+ };
5838
+ this._handleDebugResizeMouseUp = () => {
5839
+ this._isDebugResizing = false;
5840
+ document.removeEventListener('mousemove', this._handleDebugResizeMouseMove);
5841
+ document.removeEventListener('mouseup', this._handleDebugResizeMouseUp);
5842
+ this._saveState();
5843
+ };
5760
5844
  }
5761
5845
  // --- Lifecycle ---
5762
5846
  connectedCallback() {
@@ -5777,11 +5861,22 @@ let KRChatbot = class KRChatbot extends i$2 {
5777
5861
  this.messages = messages;
5778
5862
  }
5779
5863
  }).catch(() => { });
5864
+ // Fetch the framework config on load (debugTelemetryEnabled, v2ChatEnabled,
5865
+ // registryServer). debugTelemetryEnabled gates the debug affordances and is
5866
+ // known before any message.
5867
+ KRHttp.fetch({
5868
+ url: '/api/system/integration/aws/bedrock/aiFrameworkConfig',
5869
+ })
5870
+ .then((r) => r.json())
5871
+ .then((res) => {
5872
+ this._aiFrameworkConfig = res?.data || {};
5873
+ })
5874
+ .catch(() => { });
5780
5875
  // Inline mode fills its container and is always open — the floating widget's
5781
- // toggle/drag/resize state (including any persisted layout) doesn't apply.
5876
+ // toggle/drag/resize state doesn't apply, but the composer message and debug
5877
+ // drawer state (restored inside _restoreState) do.
5782
5878
  if (this.variant === 'inline') {
5783
5879
  this.opened = true;
5784
- return;
5785
5880
  }
5786
5881
  this._restoreState();
5787
5882
  }
@@ -5971,7 +6066,12 @@ let KRChatbot = class KRChatbot extends i$2 {
5971
6066
  }
5972
6067
  _saveState() {
5973
6068
  try {
5974
- const state = { opened: String(this.opened) };
6069
+ const state = {
6070
+ opened: String(this.opened),
6071
+ message: this._inputValue,
6072
+ debugPanelOpen: String(this._debugPanelOpen),
6073
+ debugDrawerWidth: String(this._debugDrawerWidth),
6074
+ };
5975
6075
  if (this._panelEl) {
5976
6076
  const s = this._panelEl.style;
5977
6077
  if (s.left) {
@@ -6001,7 +6101,17 @@ let KRChatbot = class KRChatbot extends i$2 {
6001
6101
  return;
6002
6102
  }
6003
6103
  const state = JSON.parse(raw);
6004
- if (state.opened === 'true') {
6104
+ // Draft text and the debug drawer are persisted for all variants.
6105
+ if (typeof state.message === 'string') {
6106
+ this._inputValue = state.message;
6107
+ }
6108
+ this._debugPanelOpen = state.debugPanelOpen === 'true';
6109
+ const w = Number(state.debugDrawerWidth);
6110
+ if (w >= 300) {
6111
+ this._debugDrawerWidth = w;
6112
+ }
6113
+ // The floating widget's open/layout state doesn't apply to inline mode.
6114
+ if (this.variant !== 'inline' && state.opened === 'true') {
6005
6115
  this.opened = true;
6006
6116
  // Apply layout after first render
6007
6117
  this.updateComplete.then(() => this._applyStoredLayout());
@@ -6036,6 +6146,7 @@ let KRChatbot = class KRChatbot extends i$2 {
6036
6146
  }
6037
6147
  _handleInputChange(e) {
6038
6148
  this._inputValue = e.target.value;
6149
+ this._saveState();
6039
6150
  // Auto-resize textarea
6040
6151
  const textarea = e.target;
6041
6152
  textarea.style.height = 'auto';
@@ -6125,17 +6236,33 @@ let KRChatbot = class KRChatbot extends i$2 {
6125
6236
  // specials so user input is treated literally, then wrap with `*...*`.
6126
6237
  let must = { match_all: {} };
6127
6238
  if (trimmed) {
6128
- const pattern = `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`;
6129
- const value = {
6130
- value: pattern,
6131
- case_insensitive: true,
6132
- };
6133
6239
  must = {
6134
6240
  bool: {
6135
6241
  should: [
6136
- { wildcard: { 'name.raw': value } },
6137
- { wildcard: { 'code.raw': value } },
6138
- { wildcard: { 'description.raw': value } },
6242
+ {
6243
+ wildcard: {
6244
+ 'name.raw': {
6245
+ value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
6246
+ case_insensitive: true,
6247
+ }
6248
+ }
6249
+ },
6250
+ {
6251
+ wildcard: {
6252
+ 'code.raw': {
6253
+ value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
6254
+ case_insensitive: true,
6255
+ }
6256
+ }
6257
+ },
6258
+ {
6259
+ wildcard: {
6260
+ 'description.raw': {
6261
+ value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
6262
+ case_insensitive: true,
6263
+ }
6264
+ }
6265
+ },
6139
6266
  ],
6140
6267
  minimum_should_match: 1,
6141
6268
  },
@@ -6166,6 +6293,66 @@ let KRChatbot = class KRChatbot extends i$2 {
6166
6293
  console.error('kr-chatbot: skill search failed', error);
6167
6294
  });
6168
6295
  }
6296
+ /**
6297
+ * Search the shared Kodaris global-skill registry into `_globalSkillResults`
6298
+ * (the browse dialog's "Kodaris" tab). Unlike `/aiskills/search`,
6299
+ * `/aiskills/global/search` returns a digested list
6300
+ * (`data: [{ code, name, description, enabled }]`) already in `KRChatbotSkill`
6301
+ * shape, so no `_source` lifting is needed. Only the browse dialog calls this
6302
+ * (the `/` menu is org-only), so it isn't run per slash keystroke.
6303
+ */
6304
+ _searchGlobalSkills(query) {
6305
+ this._globalSkillRequestId++;
6306
+ const requestId = this._globalSkillRequestId;
6307
+ KRHttp.fetch({
6308
+ url: '/api/system/opensearch/aiskills/global/search',
6309
+ method: 'POST',
6310
+ body: { query: query.trim() },
6311
+ })
6312
+ .then((r) => r.json())
6313
+ .then((res) => {
6314
+ // Ignore a stale response superseded by a newer search.
6315
+ if (requestId !== this._globalSkillRequestId) {
6316
+ return;
6317
+ }
6318
+ this._globalSkillResults = (res?.data || []);
6319
+ })
6320
+ .catch((error) => {
6321
+ console.error('kr-chatbot: global skill search failed', error);
6322
+ });
6323
+ }
6324
+ /**
6325
+ * Enable or disable a global skill on this instance via
6326
+ * `/aiskills/global/{code}/enabled`, then reflect the server's result on the
6327
+ * matching card. Ignores clicks while a request for the same code is pending.
6328
+ */
6329
+ _handleGlobalSkillEnable(skill, e) {
6330
+ // The card body inserts the skill; the `+` button must not also do that.
6331
+ e.stopPropagation();
6332
+ if (this._globalSkillPending.has(skill.code)) {
6333
+ return;
6334
+ }
6335
+ this._globalSkillPending.add(skill.code);
6336
+ this.requestUpdate();
6337
+ KRHttp.fetch({
6338
+ url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
6339
+ method: 'POST',
6340
+ body: { enabled: !skill.enabled },
6341
+ })
6342
+ .then((r) => r.json())
6343
+ .then((res) => {
6344
+ // Reflect the server's returned flag on the card.
6345
+ skill.enabled = res?.data?.enabled;
6346
+ this.requestUpdate();
6347
+ })
6348
+ .catch((error) => {
6349
+ console.error('kr-chatbot: global skill enable failed', error);
6350
+ })
6351
+ .finally(() => {
6352
+ this._globalSkillPending.delete(skill.code);
6353
+ this.requestUpdate();
6354
+ });
6355
+ }
6169
6356
  /** The `+` button toggles the skill/attachment menu open (showing all skills). */
6170
6357
  _handlePlusClick() {
6171
6358
  if (this._skillMenuOpened) {
@@ -6180,10 +6367,18 @@ let KRChatbot = class KRChatbot extends i$2 {
6180
6367
  /** Insert `/code ` into the composer and focus it, ready for the message. */
6181
6368
  _handleSkillSelect(skill) {
6182
6369
  this._inputValue = `/${skill.code} `;
6370
+ this._saveState();
6183
6371
  this._skillMenuOpened = false;
6184
6372
  this._skillBrowseOpened = false;
6185
6373
  this._inputEl?.focus();
6186
6374
  }
6375
+ /** Activate a skill card via keyboard (Enter/Space), since it's a div role=button. */
6376
+ _handleSkillCardKeydown(e, skill) {
6377
+ if (e.key === 'Enter' || e.key === ' ') {
6378
+ e.preventDefault();
6379
+ this._handleSkillSelect(skill);
6380
+ }
6381
+ }
6187
6382
  /** Copy a message's text to the clipboard and briefly flash "Copied". */
6188
6383
  _handleCopyMessage(content, index) {
6189
6384
  navigator.clipboard.writeText(content).then(() => {
@@ -6199,16 +6394,22 @@ let KRChatbot = class KRChatbot extends i$2 {
6199
6394
  this._skillMenuOpened = false;
6200
6395
  this._skillBrowseQuery = '';
6201
6396
  this._skillBrowseOpened = true;
6397
+ // Fill both tabs up front so switching between them is instant, not stale.
6202
6398
  this._searchSkills('');
6399
+ this._searchGlobalSkills('');
6203
6400
  }
6204
6401
  _handleSkillBrowseClose() {
6205
6402
  this._skillBrowseOpened = false;
6206
6403
  }
6207
6404
  _handleSkillBrowseSearch(e) {
6208
6405
  this._skillBrowseQuery = e.target.value;
6406
+ // Filter both catalogs so whichever tab the user switches to is already current.
6209
6407
  this._searchSkills(this._skillBrowseQuery);
6408
+ this._searchGlobalSkills(this._skillBrowseQuery);
6210
6409
  }
6211
6410
  _handleSkillBrowseTabChange(e) {
6411
+ // Both buffers are kept current by open/search, so switching just swaps which
6412
+ // one is shown — no re-search needed.
6212
6413
  this._skillBrowseSource = e.detail.activeTabId;
6213
6414
  }
6214
6415
  // --- Attachments ---
@@ -6352,6 +6553,7 @@ let KRChatbot = class KRChatbot extends i$2 {
6352
6553
  };
6353
6554
  this.messages = [...this.messages, userMessage];
6354
6555
  this._inputValue = '';
6556
+ this._saveState();
6355
6557
  this._error = '';
6356
6558
  this._userHasScrolledUp = false;
6357
6559
  // Clear the composer and release its preview object URLs.
@@ -6461,6 +6663,14 @@ let KRChatbot = class KRChatbot extends i$2 {
6461
6663
  this._error = '';
6462
6664
  this._inputValue = '';
6463
6665
  this._userHasScrolledUp = false;
6666
+ // Reset conversation-scoped context + telemetry state for the new convo.
6667
+ this._contextWarning = '';
6668
+ this._contextLimitReached = false;
6669
+ this._contextLimitMessage = '';
6670
+ this._telemetry = null;
6671
+ this._iterationLog = [];
6672
+ this._cacheCheckpoints = {};
6673
+ this._saveState();
6464
6674
  });
6465
6675
  }
6466
6676
  _handleMessagesScroll(e) {
@@ -6476,6 +6686,22 @@ let KRChatbot = class KRChatbot extends i$2 {
6476
6686
  _handleErrorDismiss() {
6477
6687
  this._error = '';
6478
6688
  }
6689
+ _handleContextWarningDismiss() {
6690
+ this._contextWarning = '';
6691
+ }
6692
+ _handleToggleDebugPanel() {
6693
+ this._debugPanelOpen = !this._debugPanelOpen;
6694
+ this._saveState();
6695
+ }
6696
+ _handleDebugResizeMouseDown(e) {
6697
+ this._isDebugResizing = true;
6698
+ this._debugResizeStartX = e.clientX;
6699
+ this._debugResizeStartW = this._debugDrawerWidth;
6700
+ e.preventDefault();
6701
+ e.stopPropagation();
6702
+ document.addEventListener('mousemove', this._handleDebugResizeMouseMove);
6703
+ document.addEventListener('mouseup', this._handleDebugResizeMouseUp);
6704
+ }
6479
6705
  _readStreamChunk() {
6480
6706
  if (!this._reader) {
6481
6707
  return;
@@ -6539,6 +6765,47 @@ let KRChatbot = class KRChatbot extends i$2 {
6539
6765
  else if (data.type === 'ERROR') {
6540
6766
  this._handleStreamError(String(data.message || 'Unknown error'));
6541
6767
  }
6768
+ else if (data.type === 'CONVERSATION_TOKEN_WARNING') {
6769
+ // User-facing: friendly "conversation is getting long" guidance.
6770
+ // Text only, never sent to the model — render verbatim as a banner.
6771
+ this._contextWarning = String(data.message || '');
6772
+ }
6773
+ else if (data.type === 'CONVERSATION_LIMIT_REACHED') {
6774
+ // User-facing hard stop. Carries finished:true (handled below).
6775
+ // Clear any soft warning so we don't double-message the user.
6776
+ this._contextLimitReached = true;
6777
+ this._contextLimitMessage = String(data.message || '');
6778
+ this._contextWarning = '';
6779
+ }
6780
+ else if (data.type === 'TOKEN_USAGE') {
6781
+ // INTERNAL-ONLY debug telemetry. Update the panel snapshot and the
6782
+ // per-iteration log; never render as a chat bubble.
6783
+ if (data.data) {
6784
+ const usage = data.data;
6785
+ this._telemetry = usage;
6786
+ // A new turn starts at iteration 1 — clear the prior turn's log
6787
+ // only now (not at send), so it stays visible until fresh data
6788
+ // actually arrives rather than blanking out on submit.
6789
+ if (usage.iteration === 1) {
6790
+ this._iterationLog = [usage];
6791
+ this._cacheCheckpoints = {};
6792
+ }
6793
+ else {
6794
+ this._iterationLog = [...this._iterationLog, usage];
6795
+ }
6796
+ }
6797
+ }
6798
+ else if (data.type === 'CACHE_CHECKPOINT') {
6799
+ // INTERNAL-ONLY debug telemetry. Records when/under which mode the
6800
+ // history checkpoint was placed, keyed by iteration for the table.
6801
+ if (data.data) {
6802
+ const checkpoint = data.data;
6803
+ this._cacheCheckpoints = {
6804
+ ...this._cacheCheckpoints,
6805
+ [checkpoint.iteration]: checkpoint,
6806
+ };
6807
+ }
6808
+ }
6542
6809
  if (data.finished) {
6543
6810
  this._isStreaming = false;
6544
6811
  this._reader = null;
@@ -6639,37 +6906,81 @@ let KRChatbot = class KRChatbot extends i$2 {
6639
6906
  ${this._renderSkillGrid()}
6640
6907
  </kr-tab>
6641
6908
  <kr-tab id="kodaris" label="Kodaris">
6642
- <div class="skill-browse__empty">
6643
- Shared Kodaris skills are coming soon.
6644
- </div>
6909
+ ${this._renderSkillGrid(true)}
6645
6910
  </kr-tab>
6646
6911
  </kr-tab-group>
6647
6912
  </div>
6648
6913
  </kr-dialog>
6649
6914
  `;
6650
6915
  }
6651
- /** The card grid of this org's skill search results for the browse dialog. */
6652
- _renderSkillGrid() {
6653
- const skills = this._skillResults;
6916
+ /**
6917
+ * The card grid of skill search results for the browse dialog. Clicking a card
6918
+ * inserts `/code ` into the composer. In the shared-Kodaris (`global`) tab each
6919
+ * card also gets a `+` install button that enables the skill on this instance
6920
+ * (turning into a ✓ once installed).
6921
+ */
6922
+ _renderSkillGrid(global = false) {
6923
+ let skills = this._skillResults;
6924
+ if (global) {
6925
+ skills = this._globalSkillResults;
6926
+ }
6654
6927
  if (!skills.length) {
6655
6928
  return A;
6656
6929
  }
6657
6930
  return b `
6658
6931
  <div class="skill-browse__grid">
6659
6932
  ${skills.map((skill) => b `
6660
- <button
6933
+ <div
6661
6934
  class="skill-card"
6935
+ role="button"
6936
+ tabindex="0"
6662
6937
  @click=${() => this._handleSkillSelect(skill)}
6938
+ @keydown=${(e) => this._handleSkillCardKeydown(e, skill)}
6663
6939
  >
6664
6940
  <span class="skill-card__name">${skill.name}</span>
6665
6941
  ${skill.description ? b `
6666
6942
  <span class="skill-card__desc">${skill.description}</span>
6667
6943
  ` : A}
6668
- </button>
6944
+ ${global ? this._renderSkillInstall(skill) : A}
6945
+ </div>
6669
6946
  `)}
6670
6947
  </div>
6671
6948
  `;
6672
6949
  }
6950
+ /**
6951
+ * The install affordance on a global skill card: a `+` button that enables the
6952
+ * skill on this instance, showing a ✓ once installed and a disabled state
6953
+ * while the enable/disable request is in flight.
6954
+ */
6955
+ _renderSkillInstall(skill) {
6956
+ return b `
6957
+ <button
6958
+ class=${e({
6959
+ 'skill-card__install': true,
6960
+ 'skill-card__install--installed': !!skill.enabled,
6961
+ })}
6962
+ ?disabled=${this._globalSkillPending.has(skill.code)}
6963
+ title=${!!skill.enabled ? 'Installed — click to remove' : 'Install this skill'}
6964
+ aria-label=${!!skill.enabled ? 'Remove skill' : 'Install skill'}
6965
+ @click=${(e) => this._handleGlobalSkillEnable(skill, e)}
6966
+ >
6967
+ <svg
6968
+ xmlns="http://www.w3.org/2000/svg"
6969
+ fill="none"
6970
+ viewBox="0 0 24 24"
6971
+ stroke-width="2"
6972
+ stroke="currentColor"
6973
+ class="skill-card__install-icon"
6974
+ >
6975
+ <path
6976
+ stroke-linecap="round"
6977
+ stroke-linejoin="round"
6978
+ d=${!!skill.enabled ? 'm4.5 12.75 6 6 9-13.5' : 'M12 4.5v15m7.5-7.5h-15'}
6979
+ />
6980
+ </svg>
6981
+ </button>
6982
+ `;
6983
+ }
6673
6984
  /**
6674
6985
  * Render a user message, highlighting a leading `/skill-code` token (like the
6675
6986
  * way Claude highlights slash commands). The composer only inserts valid skill
@@ -6682,7 +6993,162 @@ let KRChatbot = class KRChatbot extends i$2 {
6682
6993
  }
6683
6994
  return content;
6684
6995
  }
6996
+ /** Compact integer formatting for the debug panel (e.g. 88928 → "88,928"). */
6997
+ _fmtTokens(n) {
6998
+ if (n == null || isNaN(n)) {
6999
+ return '—';
7000
+ }
7001
+ return n.toLocaleString('en-US');
7002
+ }
7003
+ /** Approximate USD formatting for the debug panel (e.g. 0.1434 → "~$0.1434"). */
7004
+ _fmtCost(n) {
7005
+ if (n == null || isNaN(n)) {
7006
+ return '—';
7007
+ }
7008
+ return '~$' + n.toFixed(4);
7009
+ }
7010
+ /**
7011
+ * INTERNAL-ONLY debug telemetry panel. Rendered only in the inline variant
7012
+ * (guarded by the caller) and only when the user has toggled it open. Shows
7013
+ * three scopes from the latest TOKEN_USAGE event — context gauge, this turn,
7014
+ * lifetime — plus a verbose per-iteration table. Never customer-facing.
7015
+ */
7016
+ _renderDebugPanel() {
7017
+ return b `
7018
+ <div
7019
+ class=${e({
7020
+ 'debug-drawer': true,
7021
+ 'debug-drawer--open': this._debugPanelOpen,
7022
+ 'debug-drawer--resizing': this._isDebugResizing,
7023
+ })}
7024
+ style=${o({ width: `${this._debugDrawerWidth}px` })}
7025
+ >
7026
+ <div
7027
+ class="debug-drawer__resize"
7028
+ @mousedown=${this._handleDebugResizeMouseDown}
7029
+ ></div>
7030
+ <div class="debug-drawer__header">
7031
+ <span class="debug-drawer__title">Debug</span>
7032
+ <button
7033
+ class="header-action"
7034
+ @click=${this._handleToggleDebugPanel}
7035
+ title="Close debug panel"
7036
+ >
7037
+ <svg
7038
+ xmlns="http://www.w3.org/2000/svg"
7039
+ fill="none"
7040
+ viewBox="0 0 24 24"
7041
+ stroke-width="2"
7042
+ stroke="currentColor"
7043
+ class="header-action-icon"
7044
+ >
7045
+ <path
7046
+ stroke-linecap="round"
7047
+ stroke-linejoin="round"
7048
+ d="M6 18 18 6M6 6l12 12"
7049
+ />
7050
+ </svg>
7051
+ </button>
7052
+ </div>
7053
+ <div class="debug-drawer__body">
7054
+ ${this._telemetry ? b `
7055
+ <div class="debug-section">
7056
+ <div class="debug-section__label">Context</div>
7057
+ <div class="debug-gauge">
7058
+ <div class="debug-gauge__bar">
7059
+ <div
7060
+ class="debug-gauge__fill"
7061
+ style=${o({ width: `${Math.min(100, Math.max(0, this._telemetry.contextUsedPercent || 0))}%` })}
7062
+ ></div>
7063
+ </div>
7064
+ <span class="debug-gauge__text">
7065
+ ${this._fmtTokens(this._telemetry.currentContextTokens)} / ${this._fmtTokens(this._telemetry.contextWindowTokens)}
7066
+ · ${this._telemetry.contextUsedPercent ?? 0}%
7067
+ </span>
7068
+ </div>
7069
+ </div>
7070
+
7071
+ <div class="debug-section">
7072
+ <div class="debug-section__label">This turn</div>
7073
+ <div class="debug-metrics">
7074
+ <span class="debug-metrics__key">Input</span>
7075
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnInputTokens)}</span>
7076
+ <span class="debug-metrics__key">Output</span>
7077
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnOutputTokens)}</span>
7078
+ <span class="debug-metrics__key">Cache read</span>
7079
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
7080
+ <span class="debug-metrics__key">Hit rate</span>
7081
+ <span class="debug-metrics__val">${this._telemetry.turnHitRate ?? '—'}%</span>
7082
+ <span class="debug-metrics__key">Cost</span>
7083
+ <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
7084
+ </div>
7085
+ </div>
7086
+
7087
+ <div class="debug-section">
7088
+ <div class="debug-section__label">Lifetime</div>
7089
+ <div class="debug-metrics">
7090
+ <span class="debug-metrics__key">Input</span>
7091
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationInputTokens)}</span>
7092
+ <span class="debug-metrics__key">Output</span>
7093
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationOutputTokens)}</span>
7094
+ <span class="debug-metrics__key">Cache read</span>
7095
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
7096
+ <span class="debug-metrics__key">Cache write</span>
7097
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
7098
+ <span class="debug-metrics__key">Cost so far</span>
7099
+ <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
7100
+ </div>
7101
+ </div>
7102
+ ` : b `
7103
+ <div class="debug-empty">No telemetry yet — send a message to populate.</div>
7104
+ `}
7105
+
7106
+ ${this._iterationLog.length ? b `
7107
+ <div class="debug-section">
7108
+ <div class="debug-section__label">Iterations (this turn)</div>
7109
+ <div class="debug-iterations-scroll">
7110
+ <table class="debug-iterations">
7111
+ <thead>
7112
+ <tr>
7113
+ <th>#</th>
7114
+ <th>In</th>
7115
+ <th>Out</th>
7116
+ <th>Cache R</th>
7117
+ <th>Cache W</th>
7118
+ <th>Hit</th>
7119
+ <th>Cost</th>
7120
+ <th>Ckpt</th>
7121
+ </tr>
7122
+ </thead>
7123
+ <tbody>
7124
+ ${this._iterationLog.map((it) => {
7125
+ const ckpt = this._cacheCheckpoints[it.iteration];
7126
+ return b `
7127
+ <tr>
7128
+ <td>${it.iteration}</td>
7129
+ <td>${this._fmtTokens(it.iterationInput)}</td>
7130
+ <td>${this._fmtTokens(it.iterationOutput)}</td>
7131
+ <td>${this._fmtTokens(it.iterationCacheRead)}</td>
7132
+ <td>${this._fmtTokens(it.iterationCacheWrite)}</td>
7133
+ <td>${it.iterationHitRate ?? '—'}%</td>
7134
+ <td class="debug-cost">${this._fmtCost(it.iterationCostUsd)}</td>
7135
+ <td>${ckpt ? ckpt.mode : '—'}</td>
7136
+ </tr>
7137
+ `;
7138
+ })}
7139
+ </tbody>
7140
+ </table>
7141
+ </div>
7142
+ </div>
7143
+ ` : A}
7144
+ </div>
7145
+ </div>
7146
+ `;
7147
+ }
6685
7148
  render() {
7149
+ // Debug affordances (drawer toggle, drawer, /test-* options) require the
7150
+ // inline variant AND the server-side debug flag from aiFrameworkConfig.
7151
+ const isDebugEnabled = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6686
7152
  return b `
6687
7153
  ${(this.hideToggle || this.variant === 'inline') ? A : b `
6688
7154
  <button
@@ -6711,7 +7177,9 @@ let KRChatbot = class KRChatbot extends i$2 {
6711
7177
  class=${e({
6712
7178
  'panel': true,
6713
7179
  'panel--opened': this.opened,
7180
+ 'panel--resizing-debug': this._isDebugResizing,
6714
7181
  })}
7182
+ style=${o(this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
6715
7183
  @dragenter=${this._handleDragEnter}
6716
7184
  @dragover=${this._handleDragOver}
6717
7185
  @dragleave=${this._handleDragLeave}
@@ -6784,6 +7252,31 @@ let KRChatbot = class KRChatbot extends i$2 {
6784
7252
  </div>
6785
7253
  </div>
6786
7254
  <div class="header-actions">
7255
+ ${isDebugEnabled ? b `
7256
+ <button
7257
+ class=${e({
7258
+ 'header-action': true,
7259
+ 'header-action--active': this._debugPanelOpen,
7260
+ })}
7261
+ @click=${this._handleToggleDebugPanel}
7262
+ title="Debug telemetry"
7263
+ >
7264
+ <svg
7265
+ xmlns="http://www.w3.org/2000/svg"
7266
+ fill="none"
7267
+ viewBox="0 0 24 24"
7268
+ stroke-width="1.5"
7269
+ stroke="currentColor"
7270
+ class="header-action-icon"
7271
+ >
7272
+ <path
7273
+ stroke-linecap="round"
7274
+ stroke-linejoin="round"
7275
+ d="M3.75 3v11.25A2.25 2.25 0 0 0 6 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0 1 18 16.5h-2.25m-7.5 0h7.5m-7.5 0-1 3m8.5-3 1 3m0 0 .5 1.5m-.5-1.5h-9.5m0 0-.5 1.5M9 11.25v1.5M12 9v3.75m3-6v6"
7276
+ />
7277
+ </svg>
7278
+ </button>
7279
+ ` : A}
6787
7280
  ${this.messages.length > 0 ? b `
6788
7281
  <button
6789
7282
  class="header-action"
@@ -6871,7 +7364,7 @@ let KRChatbot = class KRChatbot extends i$2 {
6871
7364
  <div class="message-content">
6872
7365
  ${msg.type === 'user'
6873
7366
  ? this._renderUserContent(msg.content)
6874
- : o(marked.parse(msg.content, { breaks: true }))}
7367
+ : o$1(marked.parse(msg.content, { breaks: true }))}
6875
7368
  </div>
6876
7369
  ` : A}
6877
7370
  ${msg.type === 'assistant' && this._isStreaming && msg === this.messages[this.messages.length - 1] ? b `
@@ -6948,6 +7441,37 @@ let KRChatbot = class KRChatbot extends i$2 {
6948
7441
  </div>
6949
7442
  ` : A}
6950
7443
 
7444
+ ${this._contextLimitReached ? b `
7445
+ <div class="context-limit" role="alert">
7446
+ ${this._contextLimitMessage
7447
+ || 'This conversation has reached its limit. Please start a new one to continue.'}
7448
+ </div>
7449
+ ` : this._contextWarning ? b `
7450
+ <div class="context-warning" role="status">
7451
+ <span>${this._contextWarning}</span>
7452
+ <button
7453
+ class="context-warning-dismiss"
7454
+ title="Dismiss"
7455
+ @click=${this._handleContextWarningDismiss}
7456
+ >
7457
+ <svg
7458
+ xmlns="http://www.w3.org/2000/svg"
7459
+ fill="none"
7460
+ viewBox="0 0 24 24"
7461
+ stroke-width="2"
7462
+ stroke="currentColor"
7463
+ class="context-warning-dismiss-icon"
7464
+ >
7465
+ <path
7466
+ stroke-linecap="round"
7467
+ stroke-linejoin="round"
7468
+ d="M6 18 18 6M6 6l12 12"
7469
+ />
7470
+ </svg>
7471
+ </button>
7472
+ </div>
7473
+ ` : A}
7474
+
6951
7475
  <div class="footer">
6952
7476
  ${this._pendingInternalFiles.length ? b `
6953
7477
  <div class="composer-attachments">
@@ -7047,11 +7571,12 @@ let KRChatbot = class KRChatbot extends i$2 {
7047
7571
  </div>
7048
7572
  </div>
7049
7573
  ${this._skillBrowseOpened ? this._renderSkillBrowse() : A}
7574
+ ${isDebugEnabled ? this._renderDebugPanel() : A}
7050
7575
  </div>
7051
7576
  `;
7052
7577
  }
7053
7578
  };
7054
- KRChatbot.styles = i$5 `
7579
+ KRChatbot.styles = i$6 `
7055
7580
  *,
7056
7581
  *::before,
7057
7582
  *::after {
@@ -7228,6 +7753,11 @@ KRChatbot.styles = i$5 `
7228
7753
  color: #000000;
7229
7754
  }
7230
7755
 
7756
+ .header-action--active {
7757
+ background: rgba(0, 0, 0, 0.08);
7758
+ color: #000000;
7759
+ }
7760
+
7231
7761
  .header-action-icon {
7232
7762
  width: 20px;
7233
7763
  height: 20px;
@@ -7257,19 +7787,6 @@ KRChatbot.styles = i$5 `
7257
7787
  margin-right: auto;
7258
7788
  }
7259
7789
 
7260
- .messages::-webkit-scrollbar {
7261
- width: 4px;
7262
- }
7263
-
7264
- .messages::-webkit-scrollbar-track {
7265
- background: transparent;
7266
- }
7267
-
7268
- .messages::-webkit-scrollbar-thumb {
7269
- background: rgba(0, 0, 0, 0.08);
7270
- border-radius: 2px;
7271
- }
7272
-
7273
7790
  .empty {
7274
7791
  flex: 1;
7275
7792
  display: flex;
@@ -7508,6 +8025,238 @@ KRChatbot.styles = i$5 `
7508
8025
  height: 14px;
7509
8026
  }
7510
8027
 
8028
+ /* Context warning banner (user-facing, dismissible, non-blocking) */
8029
+ .context-warning {
8030
+ padding: 8px 16px;
8031
+ background: #fffbeb;
8032
+ color: #92400e;
8033
+ font-size: 13px;
8034
+ display: flex;
8035
+ align-items: center;
8036
+ justify-content: space-between;
8037
+ gap: 8px;
8038
+ flex-shrink: 0;
8039
+ }
8040
+
8041
+ .context-warning-dismiss {
8042
+ background: none;
8043
+ border: none;
8044
+ color: #92400e;
8045
+ cursor: pointer;
8046
+ padding: 2px;
8047
+ display: flex;
8048
+ align-items: center;
8049
+ flex-shrink: 0;
8050
+ }
8051
+
8052
+ .context-warning-dismiss-icon {
8053
+ width: 14px;
8054
+ height: 14px;
8055
+ }
8056
+
8057
+ /* Context-limit notice (user-facing, blocking — steers to a new conversation) */
8058
+ .context-limit {
8059
+ padding: 10px 16px;
8060
+ background: var(--kr-chatbot-error-bg);
8061
+ color: var(--kr-chatbot-error-text);
8062
+ font-size: 13px;
8063
+ line-height: 1.5;
8064
+ flex-shrink: 0;
8065
+ }
8066
+
8067
+ /*
8068
+ * INTERNAL-ONLY debug telemetry drawer. A layout drawer docked to the right
8069
+ * of the inline chat — the chat column shrinks to make room; it does not
8070
+ * overlay. Closed by default (width 0), animates open. Not customer-facing —
8071
+ * token counts, cache internals, and approximate cost estimates for internal
8072
+ * debugging. Styled to match the chatbot's light theme (Inter, design tokens).
8073
+ */
8074
+ /*
8075
+ * The chat column reserves space for the drawer by animating padding-right,
8076
+ * so opening the drawer shrinks the chat (header/messages/composer) rather
8077
+ * than overlaying it. Only applies in inline mode.
8078
+ */
8079
+ :host([variant='inline']) .panel {
8080
+ transition: padding-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
8081
+ }
8082
+
8083
+ /* Track the cursor 1:1 while dragging the drawer's resize handle. */
8084
+ :host([variant='inline']) .panel--resizing-debug {
8085
+ transition: none;
8086
+ }
8087
+
8088
+ .debug-drawer {
8089
+ position: absolute;
8090
+ top: 0;
8091
+ right: 0;
8092
+ bottom: 0;
8093
+ background: var(--kr-chatbot-bg);
8094
+ display: flex;
8095
+ flex-direction: column;
8096
+ transform: translateX(100%);
8097
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
8098
+ color: #000000;
8099
+ z-index: 5;
8100
+ }
8101
+
8102
+ /* While dragging the resize handle, suppress the slide transition so the
8103
+ drawer tracks the cursor 1:1. */
8104
+ .debug-drawer--resizing {
8105
+ transition: none;
8106
+ }
8107
+
8108
+ .debug-drawer--open {
8109
+ transform: translateX(0);
8110
+ box-shadow: -4px 0 20px rgba(10, 26, 46, 0.07);
8111
+ }
8112
+
8113
+ /* Left-edge grab handle for resizing the drawer. */
8114
+ .debug-drawer__resize {
8115
+ position: absolute;
8116
+ top: 0;
8117
+ left: 0;
8118
+ bottom: 0;
8119
+ width: 10px;
8120
+ cursor: ew-resize;
8121
+ z-index: 10;
8122
+ }
8123
+
8124
+ .debug-drawer__header {
8125
+ display: flex;
8126
+ align-items: center;
8127
+ justify-content: space-between;
8128
+ padding: 0 12px 0 20px;
8129
+ height: 64px;
8130
+ flex-shrink: 0;
8131
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
8132
+ }
8133
+
8134
+ .debug-drawer__title {
8135
+ font-size: 14px;
8136
+ font-weight: 600;
8137
+ color: #000000;
8138
+ }
8139
+
8140
+ .debug-drawer__body {
8141
+ flex: 1;
8142
+ overflow-y: auto;
8143
+ overflow-x: hidden;
8144
+ padding: 4px 0;
8145
+ }
8146
+
8147
+ .debug-section {
8148
+ padding: 14px 20px;
8149
+ border-bottom: 1px solid rgba(0, 0, 0, 0.06);
8150
+ }
8151
+
8152
+ .debug-section:last-child {
8153
+ border-bottom: none;
8154
+ }
8155
+
8156
+ .debug-section__label {
8157
+ text-transform: uppercase;
8158
+ letter-spacing: 0.06em;
8159
+ color: #000000;
8160
+ font-size: 11px;
8161
+ font-weight: 600;
8162
+ margin-bottom: 10px;
8163
+ }
8164
+
8165
+ /* Context-fullness gauge */
8166
+ .debug-gauge {
8167
+ display: flex;
8168
+ align-items: center;
8169
+ gap: 10px;
8170
+ }
8171
+
8172
+ .debug-gauge__bar {
8173
+ flex: 1;
8174
+ height: 8px;
8175
+ border-radius: 4px;
8176
+ background: rgb(244 244 244 / 100%);
8177
+ overflow: hidden;
8178
+ }
8179
+
8180
+ .debug-gauge__fill {
8181
+ height: 100%;
8182
+ border-radius: 4px;
8183
+ background: var(--kr-chatbot-primary);
8184
+ transition: width 0.3s ease;
8185
+ }
8186
+
8187
+ .debug-gauge__text {
8188
+ color: #000000;
8189
+ font-size: 12px;
8190
+ white-space: nowrap;
8191
+ font-variant-numeric: tabular-nums;
8192
+ }
8193
+
8194
+ /* Metric rows */
8195
+ .debug-metrics {
8196
+ display: grid;
8197
+ grid-template-columns: auto 1fr;
8198
+ column-gap: 12px;
8199
+ row-gap: 7px;
8200
+ font-size: 13px;
8201
+ }
8202
+
8203
+ .debug-metrics__key {
8204
+ color: #000000;
8205
+ }
8206
+
8207
+ .debug-metrics__val {
8208
+ color: #000000;
8209
+ text-align: right;
8210
+ font-variant-numeric: tabular-nums;
8211
+ }
8212
+
8213
+ .debug-cost {
8214
+ font-weight: 600;
8215
+ }
8216
+
8217
+ /* Per-iteration table (verbose). The wrapper scrolls horizontally on its own
8218
+ so a wide table never forces the whole drawer to scroll sideways. */
8219
+ .debug-iterations-scroll {
8220
+ overflow-x: auto;
8221
+ max-width: 100%;
8222
+ }
8223
+
8224
+ .debug-iterations {
8225
+ width: 100%;
8226
+ border-collapse: collapse;
8227
+ font-size: 12px;
8228
+ font-variant-numeric: tabular-nums;
8229
+ }
8230
+
8231
+ .debug-iterations th,
8232
+ .debug-iterations td {
8233
+ padding: 5px 6px;
8234
+ text-align: right;
8235
+ white-space: nowrap;
8236
+ }
8237
+
8238
+ .debug-iterations th {
8239
+ color: #000000;
8240
+ font-weight: 600;
8241
+ border-bottom: 1px solid rgba(0, 0, 0, 0.10);
8242
+ }
8243
+
8244
+ .debug-iterations tbody tr:not(:last-child) td {
8245
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
8246
+ }
8247
+
8248
+ .debug-iterations td:first-child,
8249
+ .debug-iterations th:first-child {
8250
+ text-align: left;
8251
+ }
8252
+
8253
+ .debug-empty {
8254
+ color: #000000;
8255
+ padding: 20px;
8256
+ font-size: 13px;
8257
+ text-align: center;
8258
+ }
8259
+
7511
8260
  /* Footer / Input */
7512
8261
  .footer {
7513
8262
  padding: 16px 16px 16px;
@@ -7847,6 +8596,7 @@ KRChatbot.styles = i$5 `
7847
8596
  }
7848
8597
 
7849
8598
  .skill-card {
8599
+ position: relative;
7850
8600
  display: flex;
7851
8601
  flex-direction: column;
7852
8602
  gap: 6px;
@@ -7866,8 +8616,53 @@ KRChatbot.styles = i$5 `
7866
8616
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
7867
8617
  }
7868
8618
 
8619
+ /* Install button on global skill cards. Absolutely positioned in the corner
8620
+ so it sits above the card's own click target; leave room via the name's
8621
+ padding-right below. */
8622
+ .skill-card__install {
8623
+ position: absolute;
8624
+ top: 10px;
8625
+ right: 10px;
8626
+ display: inline-flex;
8627
+ align-items: center;
8628
+ justify-content: center;
8629
+ width: 24px;
8630
+ height: 24px;
8631
+ padding: 0;
8632
+ border: 1px solid #d1d5db;
8633
+ border-radius: 6px;
8634
+ background: white;
8635
+ color: #374151;
8636
+ cursor: pointer;
8637
+ transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
8638
+ }
8639
+
8640
+ .skill-card__install:hover:not(:disabled) {
8641
+ border-color: var(--kr-chatbot-primary);
8642
+ color: var(--kr-chatbot-primary);
8643
+ }
8644
+
8645
+ .skill-card__install:disabled {
8646
+ opacity: 0.5;
8647
+ cursor: default;
8648
+ }
8649
+
8650
+ /* Installed state: filled check. */
8651
+ .skill-card__install--installed {
8652
+ background: var(--kr-chatbot-primary);
8653
+ border-color: var(--kr-chatbot-primary);
8654
+ color: white;
8655
+ }
8656
+
8657
+ .skill-card__install-icon {
8658
+ width: 15px;
8659
+ height: 15px;
8660
+ }
8661
+
7869
8662
  .skill-card__name {
7870
8663
  font-weight: 600;
8664
+ /* Leave room for the corner install button on global cards. */
8665
+ padding-right: 28px;
7871
8666
  }
7872
8667
 
7873
8668
  .skill-card__desc {
@@ -7970,38 +8765,38 @@ KRChatbot.styles = i$5 `
7970
8765
 
7971
8766
  `;
7972
8767
  __decorate([
7973
- n({ attribute: false })
8768
+ n$1({ attribute: false })
7974
8769
  ], KRChatbot.prototype, "send", void 0);
7975
8770
  __decorate([
7976
- n({ attribute: false })
8771
+ n$1({ attribute: false })
7977
8772
  ], KRChatbot.prototype, "clear", void 0);
7978
8773
  __decorate([
7979
- n({ attribute: false })
8774
+ n$1({ attribute: false })
7980
8775
  ], KRChatbot.prototype, "load", void 0);
7981
8776
  __decorate([
7982
- n({ attribute: false })
8777
+ n$1({ attribute: false })
7983
8778
  ], KRChatbot.prototype, "messages", void 0);
7984
8779
  __decorate([
7985
- n({ type: String })
8780
+ n$1({ type: String })
7986
8781
  ], KRChatbot.prototype, "label", void 0);
7987
8782
  __decorate([
7988
- n({ type: String })
8783
+ n$1({ type: String })
7989
8784
  ], KRChatbot.prototype, "placeholder", void 0);
7990
8785
  __decorate([
7991
- n({
8786
+ n$1({
7992
8787
  type: Boolean,
7993
8788
  reflect: true
7994
8789
  })
7995
8790
  ], KRChatbot.prototype, "opened", void 0);
7996
8791
  __decorate([
7997
- n({
8792
+ n$1({
7998
8793
  type: Boolean,
7999
8794
  attribute: 'hide-toggle',
8000
8795
  reflect: true
8001
8796
  })
8002
8797
  ], KRChatbot.prototype, "hideToggle", void 0);
8003
8798
  __decorate([
8004
- n({
8799
+ n$1({
8005
8800
  type: String,
8006
8801
  reflect: true
8007
8802
  })
@@ -8015,6 +8810,33 @@ __decorate([
8015
8810
  __decorate([
8016
8811
  r()
8017
8812
  ], KRChatbot.prototype, "_error", void 0);
8813
+ __decorate([
8814
+ r()
8815
+ ], KRChatbot.prototype, "_contextWarning", void 0);
8816
+ __decorate([
8817
+ r()
8818
+ ], KRChatbot.prototype, "_contextLimitReached", void 0);
8819
+ __decorate([
8820
+ r()
8821
+ ], KRChatbot.prototype, "_contextLimitMessage", void 0);
8822
+ __decorate([
8823
+ r()
8824
+ ], KRChatbot.prototype, "_telemetry", void 0);
8825
+ __decorate([
8826
+ r()
8827
+ ], KRChatbot.prototype, "_iterationLog", void 0);
8828
+ __decorate([
8829
+ r()
8830
+ ], KRChatbot.prototype, "_cacheCheckpoints", void 0);
8831
+ __decorate([
8832
+ r()
8833
+ ], KRChatbot.prototype, "_debugPanelOpen", void 0);
8834
+ __decorate([
8835
+ r()
8836
+ ], KRChatbot.prototype, "_debugDrawerWidth", void 0);
8837
+ __decorate([
8838
+ r()
8839
+ ], KRChatbot.prototype, "_isDebugResizing", void 0);
8018
8840
  __decorate([
8019
8841
  r()
8020
8842
  ], KRChatbot.prototype, "_pendingInternalFiles", void 0);
@@ -8030,6 +8852,12 @@ __decorate([
8030
8852
  __decorate([
8031
8853
  r()
8032
8854
  ], KRChatbot.prototype, "_skillResults", void 0);
8855
+ __decorate([
8856
+ r()
8857
+ ], KRChatbot.prototype, "_globalSkillResults", void 0);
8858
+ __decorate([
8859
+ r()
8860
+ ], KRChatbot.prototype, "_aiFrameworkConfig", void 0);
8033
8861
  __decorate([
8034
8862
  r()
8035
8863
  ], KRChatbot.prototype, "_skillHighlighted", void 0);