@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.
@@ -9,26 +9,26 @@
9
9
  * Copyright 2019 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
11
  */
12
- 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;
12
+ 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;
13
13
 
14
14
  /**
15
15
  * @license
16
16
  * Copyright 2017 Google LLC
17
17
  * SPDX-License-Identifier: BSD-3-Clause
18
- */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");
18
+ */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");
19
19
 
20
20
  /**
21
21
  * @license
22
22
  * Copyright 2017 Google LLC
23
23
  * SPDX-License-Identifier: BSD-3-Clause
24
24
  */
25
- 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};
25
+ 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};
26
26
 
27
27
  /**
28
28
  * @license
29
29
  * Copyright 2017 Google LLC
30
30
  * SPDX-License-Identifier: BSD-3-Clause
31
- */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");
31
+ */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");
32
32
 
33
33
  /**
34
34
  * @license
@@ -41,13 +41,13 @@
41
41
  * @license
42
42
  * Copyright 2017 Google LLC
43
43
  * SPDX-License-Identifier: BSD-3-Clause
44
- */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)}
44
+ */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)}
45
45
 
46
46
  /**
47
47
  * @license
48
48
  * Copyright 2017 Google LLC
49
49
  * SPDX-License-Identifier: BSD-3-Clause
50
- */function r(r){return n({...r,state:true,attribute:false})}
50
+ */function r(r){return n$1({...r,state:true,attribute:false})}
51
51
 
52
52
  /**
53
53
  * @license
@@ -67,19 +67,19 @@
67
67
  * Copyright 2017 Google LLC
68
68
  * SPDX-License-Identifier: BSD-3-Clause
69
69
  */
70
- 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)}};
70
+ 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)}};
71
71
 
72
72
  /**
73
73
  * @license
74
74
  * Copyright 2017 Google LLC
75
75
  * SPDX-License-Identifier: BSD-3-Clause
76
- */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);
76
+ */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);
77
77
 
78
78
  /**
79
79
  * @license
80
80
  * Copyright 2018 Google LLC
81
81
  * SPDX-License-Identifier: BSD-3-Clause
82
- */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}});
82
+ */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}});
83
83
 
84
84
  var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
85
85
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -87,7 +87,7 @@
87
87
  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;
88
88
  return c > 3 && r && Object.defineProperty(target, key, r), r;
89
89
  };
90
- let KRNavItemEdit = class KRNavItemEdit extends i$2 {
90
+ let KRNavItemEdit = class KRNavItemEdit extends i$3 {
91
91
  constructor() {
92
92
  super(...arguments);
93
93
  this.label = '';
@@ -191,7 +191,7 @@
191
191
  `;
192
192
  }
193
193
  };
194
- KRNavItemEdit.styles = i$5 `
194
+ KRNavItemEdit.styles = i$6 `
195
195
  :host {
196
196
  display: block;
197
197
  width: 360px;
@@ -352,7 +352,7 @@
352
352
  * - Don't hardcode breadcrumbs
353
353
  * - Look at renderNormalFooter and renderEditFooter and see if that is what we want to do
354
354
  */
355
- exports.Scaffold = class KRScaffold extends i$2 {
355
+ exports.Scaffold = class KRScaffold extends i$3 {
356
356
  constructor() {
357
357
  super();
358
358
  /**
@@ -1372,7 +1372,7 @@
1372
1372
  @click=${(e) => this.handleNavItemClick(e, item)}
1373
1373
  @contextmenu=${(e) => this.handleNavItemContextMenu(e, item)}
1374
1374
  >
1375
- ${this.navIconsDisplayed ? b `<span class="nav-item__icon">${o(item.icon || this.defaultNavItemIcon)}</span>` : A}
1375
+ ${this.navIconsDisplayed ? b `<span class="nav-item__icon">${o$1(item.icon || this.defaultNavItemIcon)}</span>` : A}
1376
1376
  <span class="nav-item__label">${item.label}</span>
1377
1377
  <svg
1378
1378
  class="nav-item__chevron"
@@ -1412,7 +1412,7 @@
1412
1412
  @click=${(e) => this.handleNavItemClick(e, item)}
1413
1413
  @contextmenu=${(e) => this.handleNavItemContextMenu(e, item)}
1414
1414
  >
1415
- ${this.navIconsDisplayed && !isChild ? b `<span class="nav-item__icon">${o(item.icon || this.defaultNavItemIcon)}</span>` : A}
1415
+ ${this.navIconsDisplayed && !isChild ? b `<span class="nav-item__icon">${o$1(item.icon || this.defaultNavItemIcon)}</span>` : A}
1416
1416
  <span class="nav-item__label">${item.label}</span>
1417
1417
  </a>
1418
1418
  `;
@@ -1516,7 +1516,7 @@
1516
1516
  `;
1517
1517
  }
1518
1518
  };
1519
- exports.Scaffold.styles = i$5 `
1519
+ exports.Scaffold.styles = i$6 `
1520
1520
  :host {
1521
1521
  display: flex;
1522
1522
  flex-direction: column;
@@ -2243,59 +2243,59 @@
2243
2243
  }
2244
2244
  `;
2245
2245
  __decorate$5([
2246
- n({ type: String })
2246
+ n$1({ type: String })
2247
2247
  ], exports.Scaffold.prototype, "logo", void 0);
2248
2248
  __decorate$5([
2249
- n({ type: String })
2249
+ n$1({ type: String })
2250
2250
  ], exports.Scaffold.prototype, "label", void 0);
2251
2251
  __decorate$5([
2252
- n({
2252
+ n$1({
2253
2253
  type: String,
2254
2254
  attribute: 'home-url'
2255
2255
  })
2256
2256
  ], exports.Scaffold.prototype, "homeUrl", void 0);
2257
2257
  __decorate$5([
2258
- n({
2258
+ n$1({
2259
2259
  type: String,
2260
2260
  reflect: true
2261
2261
  })
2262
2262
  ], exports.Scaffold.prototype, "scheme", void 0);
2263
2263
  __decorate$5([
2264
- n({ type: Array })
2264
+ n$1({ type: Array })
2265
2265
  ], exports.Scaffold.prototype, "nav", void 0);
2266
2266
  __decorate$5([
2267
- n({
2267
+ n$1({
2268
2268
  type: Boolean,
2269
2269
  attribute: 'nav-icons-displayed',
2270
2270
  reflect: true
2271
2271
  })
2272
2272
  ], exports.Scaffold.prototype, "navIconsDisplayed", void 0);
2273
2273
  __decorate$5([
2274
- n({
2274
+ n$1({
2275
2275
  type: Boolean,
2276
2276
  attribute: 'nav-expanded'
2277
2277
  })
2278
2278
  ], exports.Scaffold.prototype, "navExpanded", void 0);
2279
2279
  __decorate$5([
2280
- n({ type: Object })
2280
+ n$1({ type: Object })
2281
2281
  ], exports.Scaffold.prototype, "user", void 0);
2282
2282
  __decorate$5([
2283
- n({ type: Boolean })
2283
+ n$1({ type: Boolean })
2284
2284
  ], exports.Scaffold.prototype, "subbar", void 0);
2285
2285
  __decorate$5([
2286
- n({
2286
+ n$1({
2287
2287
  type: Boolean,
2288
2288
  attribute: 'nav-enabled'
2289
2289
  })
2290
2290
  ], exports.Scaffold.prototype, "navEnabled", void 0);
2291
2291
  __decorate$5([
2292
- n({
2292
+ n$1({
2293
2293
  type: String,
2294
2294
  attribute: 'user-type'
2295
2295
  })
2296
2296
  ], exports.Scaffold.prototype, "userType", void 0);
2297
2297
  __decorate$5([
2298
- n({ type: Array })
2298
+ n$1({ type: Array })
2299
2299
  ], exports.Scaffold.prototype, "breadcrumbs", void 0);
2300
2300
  __decorate$5([
2301
2301
  r()
@@ -2371,7 +2371,7 @@
2371
2371
  * @property {KRScreenNavItem[]} items - Navigation items as JSON array
2372
2372
  * @property {string} activeId - Currently active item ID
2373
2373
  */
2374
- exports.ScreenNav = class KRScreenNav extends i$2 {
2374
+ exports.ScreenNav = class KRScreenNav extends i$3 {
2375
2375
  constructor() {
2376
2376
  super(...arguments);
2377
2377
  /**
@@ -2487,7 +2487,7 @@
2487
2487
  `;
2488
2488
  }
2489
2489
  };
2490
- exports.ScreenNav.styles = i$5 `
2490
+ exports.ScreenNav.styles = i$6 `
2491
2491
  :host {
2492
2492
  display: flex;
2493
2493
  height: 100%;
@@ -2580,16 +2580,16 @@
2580
2580
  }
2581
2581
  `;
2582
2582
  __decorate$4([
2583
- n({ type: String })
2583
+ n$1({ type: String })
2584
2584
  ], exports.ScreenNav.prototype, "label", void 0);
2585
2585
  __decorate$4([
2586
- n({ type: String })
2586
+ n$1({ type: String })
2587
2587
  ], exports.ScreenNav.prototype, "subLabel", void 0);
2588
2588
  __decorate$4([
2589
- n({ type: Array })
2589
+ n$1({ type: Array })
2590
2590
  ], exports.ScreenNav.prototype, "items", void 0);
2591
2591
  __decorate$4([
2592
- n({ type: String })
2592
+ n$1({ type: String })
2593
2593
  ], exports.ScreenNav.prototype, "activeId", void 0);
2594
2594
  exports.ScreenNav = __decorate$4([
2595
2595
  t$2('kr-screen-nav')
@@ -2620,7 +2620,7 @@
2620
2620
  *
2621
2621
  * @property {string} title - Section title (e.g., "Company Details")
2622
2622
  */
2623
- exports.ScreenDetail = class KRScreenDetail extends i$2 {
2623
+ exports.ScreenDetail = class KRScreenDetail extends i$3 {
2624
2624
  constructor() {
2625
2625
  super(...arguments);
2626
2626
  /**
@@ -2644,7 +2644,7 @@
2644
2644
  `;
2645
2645
  }
2646
2646
  };
2647
- exports.ScreenDetail.styles = i$5 `
2647
+ exports.ScreenDetail.styles = i$6 `
2648
2648
  :host {
2649
2649
  display: flex;
2650
2650
  flex-direction: column;
@@ -2690,7 +2690,7 @@
2690
2690
  }
2691
2691
  `;
2692
2692
  __decorate$3([
2693
- n({ type: String })
2693
+ n$1({ type: String })
2694
2694
  ], exports.ScreenDetail.prototype, "title", void 0);
2695
2695
  exports.ScreenDetail = __decorate$3([
2696
2696
  t$2('kr-screen-detail')
@@ -2707,7 +2707,7 @@
2707
2707
  *
2708
2708
  * @slot - Content to display in the subbar (right side)
2709
2709
  */
2710
- exports.Subbar = class KRSubbar extends i$2 {
2710
+ exports.Subbar = class KRSubbar extends i$3 {
2711
2711
  constructor() {
2712
2712
  super(...arguments);
2713
2713
  /**
@@ -2835,7 +2835,7 @@
2835
2835
  `;
2836
2836
  }
2837
2837
  };
2838
- exports.Subbar.styles = i$5 `
2838
+ exports.Subbar.styles = i$6 `
2839
2839
  :host {
2840
2840
  display: flex;
2841
2841
  flex-direction: row;
@@ -2903,10 +2903,10 @@
2903
2903
  }
2904
2904
  `;
2905
2905
  __decorate$2([
2906
- n({ type: Array })
2906
+ n$1({ type: Array })
2907
2907
  ], exports.Subbar.prototype, "breadcrumbs", void 0);
2908
2908
  __decorate$2([
2909
- n({ type: Boolean })
2909
+ n$1({ type: Boolean })
2910
2910
  ], exports.Subbar.prototype, "menu", void 0);
2911
2911
  exports.Subbar = __decorate$2([
2912
2912
  t$2('kr-subbar')
@@ -3048,7 +3048,7 @@
3048
3048
  KRRouter.base = '';
3049
3049
  KRRouter.routes = [];
3050
3050
  KRRouter.elementCache = new Map();
3051
- exports.RouterOutlet = class KRRouterOutlet extends i$2 {
3051
+ exports.RouterOutlet = class KRRouterOutlet extends i$3 {
3052
3052
  constructor() {
3053
3053
  super(...arguments);
3054
3054
  this.level = -1;
@@ -3093,7 +3093,7 @@
3093
3093
  return b `${el}`;
3094
3094
  }
3095
3095
  };
3096
- exports.RouterOutlet.styles = i$5 `
3096
+ exports.RouterOutlet.styles = i$6 `
3097
3097
  :host {
3098
3098
  display: block;
3099
3099
  height: 100%;
@@ -3103,6 +3103,12 @@
3103
3103
  t$2('kr-router-outlet')
3104
3104
  ], exports.RouterOutlet);
3105
3105
 
3106
+ /**
3107
+ * @license
3108
+ * Copyright 2018 Google LLC
3109
+ * SPDX-License-Identifier: BSD-3-Clause
3110
+ */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}});
3111
+
3106
3112
  /**
3107
3113
  * @license
3108
3114
  * Copyright 2020 Google LLC
@@ -3114,7 +3120,7 @@
3114
3120
  * Copyright 2017 Google LLC
3115
3121
  * SPDX-License-Identifier: BSD-3-Clause
3116
3122
  */
3117
- 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}});
3123
+ 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}});
3118
3124
 
3119
3125
  /**
3120
3126
  * marked v12.0.2 - a markdown parser
@@ -5587,7 +5593,7 @@
5587
5593
  * @fires message-submit - When the user sends a message. Cancelable. Detail: `{ message: string }`
5588
5594
  * @fires stream-event - Dispatched for every SSE message received. Detail contains the parsed event data.
5589
5595
  */
5590
- exports.Chatbot = class KRChatbot extends i$2 {
5596
+ exports.Chatbot = class KRChatbot extends i$3 {
5591
5597
  constructor() {
5592
5598
  super(...arguments);
5593
5599
  // --- Private properties ---
@@ -5605,15 +5611,27 @@
5605
5611
  this._dragStartTop = 0;
5606
5612
  this._resizeStartW = 0;
5607
5613
  this._resizeStartH = 0;
5614
+ /** Cursor X at debug-drawer resize start. */
5615
+ this._debugResizeStartX = 0;
5616
+ /** Debug-drawer width at resize start. */
5617
+ this._debugResizeStartW = 0;
5608
5618
  /** Counter for depth-aware dragenter/dragleave tracking. */
5609
5619
  this._dragDepth = 0;
5610
5620
  /** Monotonic id source for pending attachments. */
5611
5621
  this._pendingSeq = 0;
5612
5622
  /**
5613
- * Request-id guard for skill searches — bumped on each search so out-of-order
5614
- * responses are dropped (mirrors the kr-combo-box `_requestId` pattern).
5623
+ * Request-id guards for skill searches — bumped on each search so out-of-order
5624
+ * responses are dropped (mirrors the kr-combo-box `_requestId` pattern). Org and
5625
+ * global searches run concurrently into separate buffers, so each has its own.
5615
5626
  */
5616
5627
  this._skillRequestId = 0;
5628
+ this._globalSkillRequestId = 0;
5629
+ /**
5630
+ * Codes of global skills with an in-flight enable/disable request. The `+`
5631
+ * button reads this to show a pending state and ignore repeat clicks. Mutated
5632
+ * in place; call requestUpdate() after changing it to re-render.
5633
+ */
5634
+ this._globalSkillPending = new Set();
5617
5635
  // --- @property (public API) ---
5618
5636
  /**
5619
5637
  * Callback function for sending messages. Receives the user's message and
@@ -5677,6 +5695,39 @@
5677
5695
  this._inputValue = '';
5678
5696
  this._isStreaming = false;
5679
5697
  this._error = '';
5698
+ /**
5699
+ * User-facing context warning text (`CONVERSATION_TOKEN_WARNING`). Shown as a
5700
+ * dismissible banner in all variants. Carries only friendly guidance, no numbers.
5701
+ */
5702
+ this._contextWarning = '';
5703
+ /**
5704
+ * True once the conversation hit the context-window limit
5705
+ * (`CONVERSATION_LIMIT_REACHED`, or `contextExceeded` on load). Drives a
5706
+ * blocking "start a new conversation" notice. User-facing, all variants.
5707
+ */
5708
+ this._contextLimitReached = false;
5709
+ /** Server-provided limit text (`CONVERSATION_LIMIT_REACHED`), if any. */
5710
+ this._contextLimitMessage = '';
5711
+ /**
5712
+ * INTERNAL-ONLY latest telemetry snapshot (last-value-wins). Populated from
5713
+ * `TOKEN_USAGE` events during streaming and hydrated from the conversation
5714
+ * DTO on load. Only surfaced in the `inline` variant's debug panel.
5715
+ */
5716
+ this._telemetry = null;
5717
+ /**
5718
+ * INTERNAL-ONLY per-iteration telemetry log for the debug panel's verbose
5719
+ * table. Append-only within a turn; reset at the start of each send. Each row
5720
+ * may be augmented with its `CACHE_CHECKPOINT` info.
5721
+ */
5722
+ this._iterationLog = [];
5723
+ /** Latest cache-checkpoint info keyed by iteration, for the verbose table. */
5724
+ this._cacheCheckpoints = {};
5725
+ /** Whether the internal debug panel is expanded (off by default). */
5726
+ this._debugPanelOpen = false;
5727
+ /** Current width of the debug drawer in px (user-resizable, persisted). */
5728
+ this._debugDrawerWidth = 430;
5729
+ /** True while the user is dragging the debug drawer's resize handle. */
5730
+ this._isDebugResizing = false;
5680
5731
  /** Images staged in the composer, before the message is sent. */
5681
5732
  this._pendingInternalFiles = [];
5682
5733
  /** True while a file is being dragged over the panel (shows the drop overlay). */
@@ -5686,10 +5737,24 @@
5686
5737
  /** Current `/` query (text after the slash), sent to `_searchSkills`. */
5687
5738
  this._skillQuery = '';
5688
5739
  /**
5689
- * Latest skill search results. Shared by the `/` menu and the browse dialog —
5690
- * they're mutually exclusive (opening browse closes the menu), so one buffer.
5740
+ * Latest org skill search results (this instance's own skills). Backs the `/`
5741
+ * menu and the browse dialog's "Your Org" tab.
5691
5742
  */
5692
5743
  this._skillResults = [];
5744
+ /**
5745
+ * Latest shared-Kodaris (global) skill results, for the browse dialog's
5746
+ * "Kodaris" tab. Kept separate from `_skillResults` so switching tabs shows
5747
+ * fresh results immediately instead of the other tab's stale list — the browse
5748
+ * search fills both buffers at once.
5749
+ */
5750
+ this._globalSkillResults = [];
5751
+ /**
5752
+ * AI framework UI config flags fetched from `aiFrameworkConfig` on connect.
5753
+ * `debugTelemetryEnabled` (same server-side gate as TOKEN_USAGE emission) turns
5754
+ * on the debug drawer toggle and the `/test-warning` / `/test-limit` composer
5755
+ * options — known up front, before any message.
5756
+ */
5757
+ this._aiFrameworkConfig = {};
5693
5758
  /** Highlighted item in the skill menu for keyboard navigation (-1 = none). */
5694
5759
  this._skillHighlighted = 0;
5695
5760
  /** Index of the message whose copy button just flashed "Copied" (-1 = none). */
@@ -5697,11 +5762,11 @@
5697
5762
  /** Whether the "Browse all skills" dialog is open. */
5698
5763
  this._skillBrowseOpened = false;
5699
5764
  /**
5700
- * Active tab in the browse dialog. `org` lists this org's skills (searched via
5701
- * `_searchSkills`); `kodaris` is the shared global catalog, added later.
5765
+ * Active tab in the browse dialog. `org` shows `_skillResults` (this instance's
5766
+ * skills); `kodaris` shows `_globalSkillResults` (the shared global catalog).
5702
5767
  */
5703
5768
  this._skillBrowseSource = 'org';
5704
- /** Search text in the browse dialog, sent to `_searchSkills`. */
5769
+ /** Search text in the browse dialog, routed to the active tab's search. */
5705
5770
  this._skillBrowseQuery = '';
5706
5771
  this._handleMouseMove = (e) => {
5707
5772
  if (this._isDragging) {
@@ -5760,6 +5825,25 @@
5760
5825
  document.removeEventListener('mouseup', this._handleMouseUp);
5761
5826
  this._saveState();
5762
5827
  };
5828
+ this._handleDebugResizeMouseMove = (e) => {
5829
+ if (!this._isDebugResizing) {
5830
+ return;
5831
+ }
5832
+ // Handle is on the drawer's left edge; dragging left (negative dx) widens it.
5833
+ const dx = e.clientX - this._debugResizeStartX;
5834
+ const minW = 300;
5835
+ // Never let the chat column shrink below 300px — cap the drawer at the
5836
+ // container width minus that reserved chat width.
5837
+ const minChatWidth = 300;
5838
+ const maxW = Math.max(minW, this.offsetWidth - minChatWidth);
5839
+ this._debugDrawerWidth = Math.max(minW, Math.min(this._debugResizeStartW - dx, maxW));
5840
+ };
5841
+ this._handleDebugResizeMouseUp = () => {
5842
+ this._isDebugResizing = false;
5843
+ document.removeEventListener('mousemove', this._handleDebugResizeMouseMove);
5844
+ document.removeEventListener('mouseup', this._handleDebugResizeMouseUp);
5845
+ this._saveState();
5846
+ };
5763
5847
  }
5764
5848
  // --- Lifecycle ---
5765
5849
  connectedCallback() {
@@ -5780,11 +5864,22 @@
5780
5864
  this.messages = messages;
5781
5865
  }
5782
5866
  }).catch(() => { });
5867
+ // Fetch the framework config on load (debugTelemetryEnabled, v2ChatEnabled,
5868
+ // registryServer). debugTelemetryEnabled gates the debug affordances and is
5869
+ // known before any message.
5870
+ krubbleHttp.Http.fetch({
5871
+ url: '/api/system/integration/aws/bedrock/aiFrameworkConfig',
5872
+ })
5873
+ .then((r) => r.json())
5874
+ .then((res) => {
5875
+ this._aiFrameworkConfig = res?.data || {};
5876
+ })
5877
+ .catch(() => { });
5783
5878
  // Inline mode fills its container and is always open — the floating widget's
5784
- // toggle/drag/resize state (including any persisted layout) doesn't apply.
5879
+ // toggle/drag/resize state doesn't apply, but the composer message and debug
5880
+ // drawer state (restored inside _restoreState) do.
5785
5881
  if (this.variant === 'inline') {
5786
5882
  this.opened = true;
5787
- return;
5788
5883
  }
5789
5884
  this._restoreState();
5790
5885
  }
@@ -5974,7 +6069,12 @@
5974
6069
  }
5975
6070
  _saveState() {
5976
6071
  try {
5977
- const state = { opened: String(this.opened) };
6072
+ const state = {
6073
+ opened: String(this.opened),
6074
+ message: this._inputValue,
6075
+ debugPanelOpen: String(this._debugPanelOpen),
6076
+ debugDrawerWidth: String(this._debugDrawerWidth),
6077
+ };
5978
6078
  if (this._panelEl) {
5979
6079
  const s = this._panelEl.style;
5980
6080
  if (s.left) {
@@ -6004,7 +6104,17 @@
6004
6104
  return;
6005
6105
  }
6006
6106
  const state = JSON.parse(raw);
6007
- if (state.opened === 'true') {
6107
+ // Draft text and the debug drawer are persisted for all variants.
6108
+ if (typeof state.message === 'string') {
6109
+ this._inputValue = state.message;
6110
+ }
6111
+ this._debugPanelOpen = state.debugPanelOpen === 'true';
6112
+ const w = Number(state.debugDrawerWidth);
6113
+ if (w >= 300) {
6114
+ this._debugDrawerWidth = w;
6115
+ }
6116
+ // The floating widget's open/layout state doesn't apply to inline mode.
6117
+ if (this.variant !== 'inline' && state.opened === 'true') {
6008
6118
  this.opened = true;
6009
6119
  // Apply layout after first render
6010
6120
  this.updateComplete.then(() => this._applyStoredLayout());
@@ -6039,6 +6149,7 @@
6039
6149
  }
6040
6150
  _handleInputChange(e) {
6041
6151
  this._inputValue = e.target.value;
6152
+ this._saveState();
6042
6153
  // Auto-resize textarea
6043
6154
  const textarea = e.target;
6044
6155
  textarea.style.height = 'auto';
@@ -6128,17 +6239,33 @@
6128
6239
  // specials so user input is treated literally, then wrap with `*...*`.
6129
6240
  let must = { match_all: {} };
6130
6241
  if (trimmed) {
6131
- const pattern = `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`;
6132
- const value = {
6133
- value: pattern,
6134
- case_insensitive: true,
6135
- };
6136
6242
  must = {
6137
6243
  bool: {
6138
6244
  should: [
6139
- { wildcard: { 'name.raw': value } },
6140
- { wildcard: { 'code.raw': value } },
6141
- { wildcard: { 'description.raw': value } },
6245
+ {
6246
+ wildcard: {
6247
+ 'name.raw': {
6248
+ value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
6249
+ case_insensitive: true,
6250
+ }
6251
+ }
6252
+ },
6253
+ {
6254
+ wildcard: {
6255
+ 'code.raw': {
6256
+ value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
6257
+ case_insensitive: true,
6258
+ }
6259
+ }
6260
+ },
6261
+ {
6262
+ wildcard: {
6263
+ 'description.raw': {
6264
+ value: `*${trimmed.replace(/([*?\\])/g, '\\$1')}*`,
6265
+ case_insensitive: true,
6266
+ }
6267
+ }
6268
+ },
6142
6269
  ],
6143
6270
  minimum_should_match: 1,
6144
6271
  },
@@ -6169,6 +6296,66 @@
6169
6296
  console.error('kr-chatbot: skill search failed', error);
6170
6297
  });
6171
6298
  }
6299
+ /**
6300
+ * Search the shared Kodaris global-skill registry into `_globalSkillResults`
6301
+ * (the browse dialog's "Kodaris" tab). Unlike `/aiskills/search`,
6302
+ * `/aiskills/global/search` returns a digested list
6303
+ * (`data: [{ code, name, description, enabled }]`) already in `KRChatbotSkill`
6304
+ * shape, so no `_source` lifting is needed. Only the browse dialog calls this
6305
+ * (the `/` menu is org-only), so it isn't run per slash keystroke.
6306
+ */
6307
+ _searchGlobalSkills(query) {
6308
+ this._globalSkillRequestId++;
6309
+ const requestId = this._globalSkillRequestId;
6310
+ krubbleHttp.Http.fetch({
6311
+ url: '/api/system/opensearch/aiskills/global/search',
6312
+ method: 'POST',
6313
+ body: { query: query.trim() },
6314
+ })
6315
+ .then((r) => r.json())
6316
+ .then((res) => {
6317
+ // Ignore a stale response superseded by a newer search.
6318
+ if (requestId !== this._globalSkillRequestId) {
6319
+ return;
6320
+ }
6321
+ this._globalSkillResults = (res?.data || []);
6322
+ })
6323
+ .catch((error) => {
6324
+ console.error('kr-chatbot: global skill search failed', error);
6325
+ });
6326
+ }
6327
+ /**
6328
+ * Enable or disable a global skill on this instance via
6329
+ * `/aiskills/global/{code}/enabled`, then reflect the server's result on the
6330
+ * matching card. Ignores clicks while a request for the same code is pending.
6331
+ */
6332
+ _handleGlobalSkillEnable(skill, e) {
6333
+ // The card body inserts the skill; the `+` button must not also do that.
6334
+ e.stopPropagation();
6335
+ if (this._globalSkillPending.has(skill.code)) {
6336
+ return;
6337
+ }
6338
+ this._globalSkillPending.add(skill.code);
6339
+ this.requestUpdate();
6340
+ krubbleHttp.Http.fetch({
6341
+ url: `/api/system/opensearch/aiskills/global/${encodeURIComponent(skill.code)}/enabled`,
6342
+ method: 'POST',
6343
+ body: { enabled: !skill.enabled },
6344
+ })
6345
+ .then((r) => r.json())
6346
+ .then((res) => {
6347
+ // Reflect the server's returned flag on the card.
6348
+ skill.enabled = res?.data?.enabled;
6349
+ this.requestUpdate();
6350
+ })
6351
+ .catch((error) => {
6352
+ console.error('kr-chatbot: global skill enable failed', error);
6353
+ })
6354
+ .finally(() => {
6355
+ this._globalSkillPending.delete(skill.code);
6356
+ this.requestUpdate();
6357
+ });
6358
+ }
6172
6359
  /** The `+` button toggles the skill/attachment menu open (showing all skills). */
6173
6360
  _handlePlusClick() {
6174
6361
  if (this._skillMenuOpened) {
@@ -6183,10 +6370,18 @@
6183
6370
  /** Insert `/code ` into the composer and focus it, ready for the message. */
6184
6371
  _handleSkillSelect(skill) {
6185
6372
  this._inputValue = `/${skill.code} `;
6373
+ this._saveState();
6186
6374
  this._skillMenuOpened = false;
6187
6375
  this._skillBrowseOpened = false;
6188
6376
  this._inputEl?.focus();
6189
6377
  }
6378
+ /** Activate a skill card via keyboard (Enter/Space), since it's a div role=button. */
6379
+ _handleSkillCardKeydown(e, skill) {
6380
+ if (e.key === 'Enter' || e.key === ' ') {
6381
+ e.preventDefault();
6382
+ this._handleSkillSelect(skill);
6383
+ }
6384
+ }
6190
6385
  /** Copy a message's text to the clipboard and briefly flash "Copied". */
6191
6386
  _handleCopyMessage(content, index) {
6192
6387
  navigator.clipboard.writeText(content).then(() => {
@@ -6202,16 +6397,22 @@
6202
6397
  this._skillMenuOpened = false;
6203
6398
  this._skillBrowseQuery = '';
6204
6399
  this._skillBrowseOpened = true;
6400
+ // Fill both tabs up front so switching between them is instant, not stale.
6205
6401
  this._searchSkills('');
6402
+ this._searchGlobalSkills('');
6206
6403
  }
6207
6404
  _handleSkillBrowseClose() {
6208
6405
  this._skillBrowseOpened = false;
6209
6406
  }
6210
6407
  _handleSkillBrowseSearch(e) {
6211
6408
  this._skillBrowseQuery = e.target.value;
6409
+ // Filter both catalogs so whichever tab the user switches to is already current.
6212
6410
  this._searchSkills(this._skillBrowseQuery);
6411
+ this._searchGlobalSkills(this._skillBrowseQuery);
6213
6412
  }
6214
6413
  _handleSkillBrowseTabChange(e) {
6414
+ // Both buffers are kept current by open/search, so switching just swaps which
6415
+ // one is shown — no re-search needed.
6215
6416
  this._skillBrowseSource = e.detail.activeTabId;
6216
6417
  }
6217
6418
  // --- Attachments ---
@@ -6355,6 +6556,7 @@
6355
6556
  };
6356
6557
  this.messages = [...this.messages, userMessage];
6357
6558
  this._inputValue = '';
6559
+ this._saveState();
6358
6560
  this._error = '';
6359
6561
  this._userHasScrolledUp = false;
6360
6562
  // Clear the composer and release its preview object URLs.
@@ -6464,6 +6666,14 @@
6464
6666
  this._error = '';
6465
6667
  this._inputValue = '';
6466
6668
  this._userHasScrolledUp = false;
6669
+ // Reset conversation-scoped context + telemetry state for the new convo.
6670
+ this._contextWarning = '';
6671
+ this._contextLimitReached = false;
6672
+ this._contextLimitMessage = '';
6673
+ this._telemetry = null;
6674
+ this._iterationLog = [];
6675
+ this._cacheCheckpoints = {};
6676
+ this._saveState();
6467
6677
  });
6468
6678
  }
6469
6679
  _handleMessagesScroll(e) {
@@ -6479,6 +6689,22 @@
6479
6689
  _handleErrorDismiss() {
6480
6690
  this._error = '';
6481
6691
  }
6692
+ _handleContextWarningDismiss() {
6693
+ this._contextWarning = '';
6694
+ }
6695
+ _handleToggleDebugPanel() {
6696
+ this._debugPanelOpen = !this._debugPanelOpen;
6697
+ this._saveState();
6698
+ }
6699
+ _handleDebugResizeMouseDown(e) {
6700
+ this._isDebugResizing = true;
6701
+ this._debugResizeStartX = e.clientX;
6702
+ this._debugResizeStartW = this._debugDrawerWidth;
6703
+ e.preventDefault();
6704
+ e.stopPropagation();
6705
+ document.addEventListener('mousemove', this._handleDebugResizeMouseMove);
6706
+ document.addEventListener('mouseup', this._handleDebugResizeMouseUp);
6707
+ }
6482
6708
  _readStreamChunk() {
6483
6709
  if (!this._reader) {
6484
6710
  return;
@@ -6542,6 +6768,47 @@
6542
6768
  else if (data.type === 'ERROR') {
6543
6769
  this._handleStreamError(String(data.message || 'Unknown error'));
6544
6770
  }
6771
+ else if (data.type === 'CONVERSATION_TOKEN_WARNING') {
6772
+ // User-facing: friendly "conversation is getting long" guidance.
6773
+ // Text only, never sent to the model — render verbatim as a banner.
6774
+ this._contextWarning = String(data.message || '');
6775
+ }
6776
+ else if (data.type === 'CONVERSATION_LIMIT_REACHED') {
6777
+ // User-facing hard stop. Carries finished:true (handled below).
6778
+ // Clear any soft warning so we don't double-message the user.
6779
+ this._contextLimitReached = true;
6780
+ this._contextLimitMessage = String(data.message || '');
6781
+ this._contextWarning = '';
6782
+ }
6783
+ else if (data.type === 'TOKEN_USAGE') {
6784
+ // INTERNAL-ONLY debug telemetry. Update the panel snapshot and the
6785
+ // per-iteration log; never render as a chat bubble.
6786
+ if (data.data) {
6787
+ const usage = data.data;
6788
+ this._telemetry = usage;
6789
+ // A new turn starts at iteration 1 — clear the prior turn's log
6790
+ // only now (not at send), so it stays visible until fresh data
6791
+ // actually arrives rather than blanking out on submit.
6792
+ if (usage.iteration === 1) {
6793
+ this._iterationLog = [usage];
6794
+ this._cacheCheckpoints = {};
6795
+ }
6796
+ else {
6797
+ this._iterationLog = [...this._iterationLog, usage];
6798
+ }
6799
+ }
6800
+ }
6801
+ else if (data.type === 'CACHE_CHECKPOINT') {
6802
+ // INTERNAL-ONLY debug telemetry. Records when/under which mode the
6803
+ // history checkpoint was placed, keyed by iteration for the table.
6804
+ if (data.data) {
6805
+ const checkpoint = data.data;
6806
+ this._cacheCheckpoints = {
6807
+ ...this._cacheCheckpoints,
6808
+ [checkpoint.iteration]: checkpoint,
6809
+ };
6810
+ }
6811
+ }
6545
6812
  if (data.finished) {
6546
6813
  this._isStreaming = false;
6547
6814
  this._reader = null;
@@ -6642,35 +6909,79 @@
6642
6909
  ${this._renderSkillGrid()}
6643
6910
  </kr-tab>
6644
6911
  <kr-tab id="kodaris" label="Kodaris">
6645
- <div class="skill-browse__empty">
6646
- Shared Kodaris skills are coming soon.
6647
- </div>
6912
+ ${this._renderSkillGrid(true)}
6648
6913
  </kr-tab>
6649
6914
  </kr-tab-group>
6650
6915
  </div>
6651
6916
  </kr-dialog>
6652
6917
  `;
6653
6918
  }
6654
- /** The card grid of this org's skill search results for the browse dialog. */
6655
- _renderSkillGrid() {
6656
- const skills = this._skillResults;
6919
+ /**
6920
+ * The card grid of skill search results for the browse dialog. Clicking a card
6921
+ * inserts `/code ` into the composer. In the shared-Kodaris (`global`) tab each
6922
+ * card also gets a `+` install button that enables the skill on this instance
6923
+ * (turning into a ✓ once installed).
6924
+ */
6925
+ _renderSkillGrid(global = false) {
6926
+ let skills = this._skillResults;
6927
+ if (global) {
6928
+ skills = this._globalSkillResults;
6929
+ }
6657
6930
  if (!skills.length) {
6658
6931
  return A;
6659
6932
  }
6660
6933
  return b `
6661
6934
  <div class="skill-browse__grid">
6662
6935
  ${skills.map((skill) => b `
6663
- <button
6936
+ <div
6664
6937
  class="skill-card"
6938
+ role="button"
6939
+ tabindex="0"
6665
6940
  @click=${() => this._handleSkillSelect(skill)}
6941
+ @keydown=${(e) => this._handleSkillCardKeydown(e, skill)}
6666
6942
  >
6667
6943
  <span class="skill-card__name">${skill.name}</span>
6668
6944
  ${skill.description ? b `
6669
6945
  <span class="skill-card__desc">${skill.description}</span>
6670
6946
  ` : A}
6671
- </button>
6947
+ ${global ? this._renderSkillInstall(skill) : A}
6948
+ </div>
6672
6949
  `)}
6673
6950
  </div>
6951
+ `;
6952
+ }
6953
+ /**
6954
+ * The install affordance on a global skill card: a `+` button that enables the
6955
+ * skill on this instance, showing a ✓ once installed and a disabled state
6956
+ * while the enable/disable request is in flight.
6957
+ */
6958
+ _renderSkillInstall(skill) {
6959
+ return b `
6960
+ <button
6961
+ class=${e({
6962
+ 'skill-card__install': true,
6963
+ 'skill-card__install--installed': !!skill.enabled,
6964
+ })}
6965
+ ?disabled=${this._globalSkillPending.has(skill.code)}
6966
+ title=${!!skill.enabled ? 'Installed — click to remove' : 'Install this skill'}
6967
+ aria-label=${!!skill.enabled ? 'Remove skill' : 'Install skill'}
6968
+ @click=${(e) => this._handleGlobalSkillEnable(skill, e)}
6969
+ >
6970
+ <svg
6971
+ xmlns="http://www.w3.org/2000/svg"
6972
+ fill="none"
6973
+ viewBox="0 0 24 24"
6974
+ stroke-width="2"
6975
+ stroke="currentColor"
6976
+ class="skill-card__install-icon"
6977
+ >
6978
+ <path
6979
+ stroke-linecap="round"
6980
+ stroke-linejoin="round"
6981
+ d=${!!skill.enabled ? 'm4.5 12.75 6 6 9-13.5' : 'M12 4.5v15m7.5-7.5h-15'}
6982
+ />
6983
+ </svg>
6984
+ </button>
6674
6985
  `;
6675
6986
  }
6676
6987
  /**
@@ -6685,7 +6996,162 @@
6685
6996
  }
6686
6997
  return content;
6687
6998
  }
6999
+ /** Compact integer formatting for the debug panel (e.g. 88928 → "88,928"). */
7000
+ _fmtTokens(n) {
7001
+ if (n == null || isNaN(n)) {
7002
+ return '—';
7003
+ }
7004
+ return n.toLocaleString('en-US');
7005
+ }
7006
+ /** Approximate USD formatting for the debug panel (e.g. 0.1434 → "~$0.1434"). */
7007
+ _fmtCost(n) {
7008
+ if (n == null || isNaN(n)) {
7009
+ return '—';
7010
+ }
7011
+ return '~$' + n.toFixed(4);
7012
+ }
7013
+ /**
7014
+ * INTERNAL-ONLY debug telemetry panel. Rendered only in the inline variant
7015
+ * (guarded by the caller) and only when the user has toggled it open. Shows
7016
+ * three scopes from the latest TOKEN_USAGE event — context gauge, this turn,
7017
+ * lifetime — plus a verbose per-iteration table. Never customer-facing.
7018
+ */
7019
+ _renderDebugPanel() {
7020
+ return b `
7021
+ <div
7022
+ class=${e({
7023
+ 'debug-drawer': true,
7024
+ 'debug-drawer--open': this._debugPanelOpen,
7025
+ 'debug-drawer--resizing': this._isDebugResizing,
7026
+ })}
7027
+ style=${o({ width: `${this._debugDrawerWidth}px` })}
7028
+ >
7029
+ <div
7030
+ class="debug-drawer__resize"
7031
+ @mousedown=${this._handleDebugResizeMouseDown}
7032
+ ></div>
7033
+ <div class="debug-drawer__header">
7034
+ <span class="debug-drawer__title">Debug</span>
7035
+ <button
7036
+ class="header-action"
7037
+ @click=${this._handleToggleDebugPanel}
7038
+ title="Close debug panel"
7039
+ >
7040
+ <svg
7041
+ xmlns="http://www.w3.org/2000/svg"
7042
+ fill="none"
7043
+ viewBox="0 0 24 24"
7044
+ stroke-width="2"
7045
+ stroke="currentColor"
7046
+ class="header-action-icon"
7047
+ >
7048
+ <path
7049
+ stroke-linecap="round"
7050
+ stroke-linejoin="round"
7051
+ d="M6 18 18 6M6 6l12 12"
7052
+ />
7053
+ </svg>
7054
+ </button>
7055
+ </div>
7056
+ <div class="debug-drawer__body">
7057
+ ${this._telemetry ? b `
7058
+ <div class="debug-section">
7059
+ <div class="debug-section__label">Context</div>
7060
+ <div class="debug-gauge">
7061
+ <div class="debug-gauge__bar">
7062
+ <div
7063
+ class="debug-gauge__fill"
7064
+ style=${o({ width: `${Math.min(100, Math.max(0, this._telemetry.contextUsedPercent || 0))}%` })}
7065
+ ></div>
7066
+ </div>
7067
+ <span class="debug-gauge__text">
7068
+ ${this._fmtTokens(this._telemetry.currentContextTokens)} / ${this._fmtTokens(this._telemetry.contextWindowTokens)}
7069
+ · ${this._telemetry.contextUsedPercent ?? 0}%
7070
+ </span>
7071
+ </div>
7072
+ </div>
7073
+
7074
+ <div class="debug-section">
7075
+ <div class="debug-section__label">This turn</div>
7076
+ <div class="debug-metrics">
7077
+ <span class="debug-metrics__key">Input</span>
7078
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnInputTokens)}</span>
7079
+ <span class="debug-metrics__key">Output</span>
7080
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnOutputTokens)}</span>
7081
+ <span class="debug-metrics__key">Cache read</span>
7082
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.turnCacheReadTokens)}</span>
7083
+ <span class="debug-metrics__key">Hit rate</span>
7084
+ <span class="debug-metrics__val">${this._telemetry.turnHitRate ?? '—'}%</span>
7085
+ <span class="debug-metrics__key">Cost</span>
7086
+ <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.turnCostUsd)}</span>
7087
+ </div>
7088
+ </div>
7089
+
7090
+ <div class="debug-section">
7091
+ <div class="debug-section__label">Lifetime</div>
7092
+ <div class="debug-metrics">
7093
+ <span class="debug-metrics__key">Input</span>
7094
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationInputTokens)}</span>
7095
+ <span class="debug-metrics__key">Output</span>
7096
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationOutputTokens)}</span>
7097
+ <span class="debug-metrics__key">Cache read</span>
7098
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheReadTokens)}</span>
7099
+ <span class="debug-metrics__key">Cache write</span>
7100
+ <span class="debug-metrics__val">${this._fmtTokens(this._telemetry.conversationCacheWriteTokens)}</span>
7101
+ <span class="debug-metrics__key">Cost so far</span>
7102
+ <span class="debug-metrics__val debug-cost">${this._fmtCost(this._telemetry.conversationCostUsd)}</span>
7103
+ </div>
7104
+ </div>
7105
+ ` : b `
7106
+ <div class="debug-empty">No telemetry yet — send a message to populate.</div>
7107
+ `}
7108
+
7109
+ ${this._iterationLog.length ? b `
7110
+ <div class="debug-section">
7111
+ <div class="debug-section__label">Iterations (this turn)</div>
7112
+ <div class="debug-iterations-scroll">
7113
+ <table class="debug-iterations">
7114
+ <thead>
7115
+ <tr>
7116
+ <th>#</th>
7117
+ <th>In</th>
7118
+ <th>Out</th>
7119
+ <th>Cache R</th>
7120
+ <th>Cache W</th>
7121
+ <th>Hit</th>
7122
+ <th>Cost</th>
7123
+ <th>Ckpt</th>
7124
+ </tr>
7125
+ </thead>
7126
+ <tbody>
7127
+ ${this._iterationLog.map((it) => {
7128
+ const ckpt = this._cacheCheckpoints[it.iteration];
7129
+ return b `
7130
+ <tr>
7131
+ <td>${it.iteration}</td>
7132
+ <td>${this._fmtTokens(it.iterationInput)}</td>
7133
+ <td>${this._fmtTokens(it.iterationOutput)}</td>
7134
+ <td>${this._fmtTokens(it.iterationCacheRead)}</td>
7135
+ <td>${this._fmtTokens(it.iterationCacheWrite)}</td>
7136
+ <td>${it.iterationHitRate ?? '—'}%</td>
7137
+ <td class="debug-cost">${this._fmtCost(it.iterationCostUsd)}</td>
7138
+ <td>${ckpt ? ckpt.mode : '—'}</td>
7139
+ </tr>
7140
+ `;
7141
+ })}
7142
+ </tbody>
7143
+ </table>
7144
+ </div>
7145
+ </div>
7146
+ ` : A}
7147
+ </div>
7148
+ </div>
7149
+ `;
7150
+ }
6688
7151
  render() {
7152
+ // Debug affordances (drawer toggle, drawer, /test-* options) require the
7153
+ // inline variant AND the server-side debug flag from aiFrameworkConfig.
7154
+ const isDebugEnabled = this.variant === 'inline' && this._aiFrameworkConfig.debugTelemetryEnabled === true;
6689
7155
  return b `
6690
7156
  ${(this.hideToggle || this.variant === 'inline') ? A : b `
6691
7157
  <button
@@ -6714,7 +7180,9 @@
6714
7180
  class=${e({
6715
7181
  'panel': true,
6716
7182
  'panel--opened': this.opened,
7183
+ 'panel--resizing-debug': this._isDebugResizing,
6717
7184
  })}
7185
+ style=${o(this._debugPanelOpen ? { paddingRight: `${this._debugDrawerWidth}px` } : {})}
6718
7186
  @dragenter=${this._handleDragEnter}
6719
7187
  @dragover=${this._handleDragOver}
6720
7188
  @dragleave=${this._handleDragLeave}
@@ -6787,6 +7255,31 @@
6787
7255
  </div>
6788
7256
  </div>
6789
7257
  <div class="header-actions">
7258
+ ${isDebugEnabled ? b `
7259
+ <button
7260
+ class=${e({
7261
+ 'header-action': true,
7262
+ 'header-action--active': this._debugPanelOpen,
7263
+ })}
7264
+ @click=${this._handleToggleDebugPanel}
7265
+ title="Debug telemetry"
7266
+ >
7267
+ <svg
7268
+ xmlns="http://www.w3.org/2000/svg"
7269
+ fill="none"
7270
+ viewBox="0 0 24 24"
7271
+ stroke-width="1.5"
7272
+ stroke="currentColor"
7273
+ class="header-action-icon"
7274
+ >
7275
+ <path
7276
+ stroke-linecap="round"
7277
+ stroke-linejoin="round"
7278
+ 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"
7279
+ />
7280
+ </svg>
7281
+ </button>
7282
+ ` : A}
6790
7283
  ${this.messages.length > 0 ? b `
6791
7284
  <button
6792
7285
  class="header-action"
@@ -6874,7 +7367,7 @@
6874
7367
  <div class="message-content">
6875
7368
  ${msg.type === 'user'
6876
7369
  ? this._renderUserContent(msg.content)
6877
- : o(marked.parse(msg.content, { breaks: true }))}
7370
+ : o$1(marked.parse(msg.content, { breaks: true }))}
6878
7371
  </div>
6879
7372
  ` : A}
6880
7373
  ${msg.type === 'assistant' && this._isStreaming && msg === this.messages[this.messages.length - 1] ? b `
@@ -6951,6 +7444,37 @@
6951
7444
  </div>
6952
7445
  ` : A}
6953
7446
 
7447
+ ${this._contextLimitReached ? b `
7448
+ <div class="context-limit" role="alert">
7449
+ ${this._contextLimitMessage
7450
+ || 'This conversation has reached its limit. Please start a new one to continue.'}
7451
+ </div>
7452
+ ` : this._contextWarning ? b `
7453
+ <div class="context-warning" role="status">
7454
+ <span>${this._contextWarning}</span>
7455
+ <button
7456
+ class="context-warning-dismiss"
7457
+ title="Dismiss"
7458
+ @click=${this._handleContextWarningDismiss}
7459
+ >
7460
+ <svg
7461
+ xmlns="http://www.w3.org/2000/svg"
7462
+ fill="none"
7463
+ viewBox="0 0 24 24"
7464
+ stroke-width="2"
7465
+ stroke="currentColor"
7466
+ class="context-warning-dismiss-icon"
7467
+ >
7468
+ <path
7469
+ stroke-linecap="round"
7470
+ stroke-linejoin="round"
7471
+ d="M6 18 18 6M6 6l12 12"
7472
+ />
7473
+ </svg>
7474
+ </button>
7475
+ </div>
7476
+ ` : A}
7477
+
6954
7478
  <div class="footer">
6955
7479
  ${this._pendingInternalFiles.length ? b `
6956
7480
  <div class="composer-attachments">
@@ -7050,11 +7574,12 @@
7050
7574
  </div>
7051
7575
  </div>
7052
7576
  ${this._skillBrowseOpened ? this._renderSkillBrowse() : A}
7577
+ ${isDebugEnabled ? this._renderDebugPanel() : A}
7053
7578
  </div>
7054
7579
  `;
7055
7580
  }
7056
7581
  };
7057
- exports.Chatbot.styles = i$5 `
7582
+ exports.Chatbot.styles = i$6 `
7058
7583
  *,
7059
7584
  *::before,
7060
7585
  *::after {
@@ -7231,6 +7756,11 @@
7231
7756
  color: #000000;
7232
7757
  }
7233
7758
 
7759
+ .header-action--active {
7760
+ background: rgba(0, 0, 0, 0.08);
7761
+ color: #000000;
7762
+ }
7763
+
7234
7764
  .header-action-icon {
7235
7765
  width: 20px;
7236
7766
  height: 20px;
@@ -7260,19 +7790,6 @@
7260
7790
  margin-right: auto;
7261
7791
  }
7262
7792
 
7263
- .messages::-webkit-scrollbar {
7264
- width: 4px;
7265
- }
7266
-
7267
- .messages::-webkit-scrollbar-track {
7268
- background: transparent;
7269
- }
7270
-
7271
- .messages::-webkit-scrollbar-thumb {
7272
- background: rgba(0, 0, 0, 0.08);
7273
- border-radius: 2px;
7274
- }
7275
-
7276
7793
  .empty {
7277
7794
  flex: 1;
7278
7795
  display: flex;
@@ -7511,6 +8028,238 @@
7511
8028
  height: 14px;
7512
8029
  }
7513
8030
 
8031
+ /* Context warning banner (user-facing, dismissible, non-blocking) */
8032
+ .context-warning {
8033
+ padding: 8px 16px;
8034
+ background: #fffbeb;
8035
+ color: #92400e;
8036
+ font-size: 13px;
8037
+ display: flex;
8038
+ align-items: center;
8039
+ justify-content: space-between;
8040
+ gap: 8px;
8041
+ flex-shrink: 0;
8042
+ }
8043
+
8044
+ .context-warning-dismiss {
8045
+ background: none;
8046
+ border: none;
8047
+ color: #92400e;
8048
+ cursor: pointer;
8049
+ padding: 2px;
8050
+ display: flex;
8051
+ align-items: center;
8052
+ flex-shrink: 0;
8053
+ }
8054
+
8055
+ .context-warning-dismiss-icon {
8056
+ width: 14px;
8057
+ height: 14px;
8058
+ }
8059
+
8060
+ /* Context-limit notice (user-facing, blocking — steers to a new conversation) */
8061
+ .context-limit {
8062
+ padding: 10px 16px;
8063
+ background: var(--kr-chatbot-error-bg);
8064
+ color: var(--kr-chatbot-error-text);
8065
+ font-size: 13px;
8066
+ line-height: 1.5;
8067
+ flex-shrink: 0;
8068
+ }
8069
+
8070
+ /*
8071
+ * INTERNAL-ONLY debug telemetry drawer. A layout drawer docked to the right
8072
+ * of the inline chat — the chat column shrinks to make room; it does not
8073
+ * overlay. Closed by default (width 0), animates open. Not customer-facing —
8074
+ * token counts, cache internals, and approximate cost estimates for internal
8075
+ * debugging. Styled to match the chatbot's light theme (Inter, design tokens).
8076
+ */
8077
+ /*
8078
+ * The chat column reserves space for the drawer by animating padding-right,
8079
+ * so opening the drawer shrinks the chat (header/messages/composer) rather
8080
+ * than overlaying it. Only applies in inline mode.
8081
+ */
8082
+ :host([variant='inline']) .panel {
8083
+ transition: padding-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
8084
+ }
8085
+
8086
+ /* Track the cursor 1:1 while dragging the drawer's resize handle. */
8087
+ :host([variant='inline']) .panel--resizing-debug {
8088
+ transition: none;
8089
+ }
8090
+
8091
+ .debug-drawer {
8092
+ position: absolute;
8093
+ top: 0;
8094
+ right: 0;
8095
+ bottom: 0;
8096
+ background: var(--kr-chatbot-bg);
8097
+ display: flex;
8098
+ flex-direction: column;
8099
+ transform: translateX(100%);
8100
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
8101
+ color: #000000;
8102
+ z-index: 5;
8103
+ }
8104
+
8105
+ /* While dragging the resize handle, suppress the slide transition so the
8106
+ drawer tracks the cursor 1:1. */
8107
+ .debug-drawer--resizing {
8108
+ transition: none;
8109
+ }
8110
+
8111
+ .debug-drawer--open {
8112
+ transform: translateX(0);
8113
+ box-shadow: -4px 0 20px rgba(10, 26, 46, 0.07);
8114
+ }
8115
+
8116
+ /* Left-edge grab handle for resizing the drawer. */
8117
+ .debug-drawer__resize {
8118
+ position: absolute;
8119
+ top: 0;
8120
+ left: 0;
8121
+ bottom: 0;
8122
+ width: 10px;
8123
+ cursor: ew-resize;
8124
+ z-index: 10;
8125
+ }
8126
+
8127
+ .debug-drawer__header {
8128
+ display: flex;
8129
+ align-items: center;
8130
+ justify-content: space-between;
8131
+ padding: 0 12px 0 20px;
8132
+ height: 64px;
8133
+ flex-shrink: 0;
8134
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
8135
+ }
8136
+
8137
+ .debug-drawer__title {
8138
+ font-size: 14px;
8139
+ font-weight: 600;
8140
+ color: #000000;
8141
+ }
8142
+
8143
+ .debug-drawer__body {
8144
+ flex: 1;
8145
+ overflow-y: auto;
8146
+ overflow-x: hidden;
8147
+ padding: 4px 0;
8148
+ }
8149
+
8150
+ .debug-section {
8151
+ padding: 14px 20px;
8152
+ border-bottom: 1px solid rgba(0, 0, 0, 0.06);
8153
+ }
8154
+
8155
+ .debug-section:last-child {
8156
+ border-bottom: none;
8157
+ }
8158
+
8159
+ .debug-section__label {
8160
+ text-transform: uppercase;
8161
+ letter-spacing: 0.06em;
8162
+ color: #000000;
8163
+ font-size: 11px;
8164
+ font-weight: 600;
8165
+ margin-bottom: 10px;
8166
+ }
8167
+
8168
+ /* Context-fullness gauge */
8169
+ .debug-gauge {
8170
+ display: flex;
8171
+ align-items: center;
8172
+ gap: 10px;
8173
+ }
8174
+
8175
+ .debug-gauge__bar {
8176
+ flex: 1;
8177
+ height: 8px;
8178
+ border-radius: 4px;
8179
+ background: rgb(244 244 244 / 100%);
8180
+ overflow: hidden;
8181
+ }
8182
+
8183
+ .debug-gauge__fill {
8184
+ height: 100%;
8185
+ border-radius: 4px;
8186
+ background: var(--kr-chatbot-primary);
8187
+ transition: width 0.3s ease;
8188
+ }
8189
+
8190
+ .debug-gauge__text {
8191
+ color: #000000;
8192
+ font-size: 12px;
8193
+ white-space: nowrap;
8194
+ font-variant-numeric: tabular-nums;
8195
+ }
8196
+
8197
+ /* Metric rows */
8198
+ .debug-metrics {
8199
+ display: grid;
8200
+ grid-template-columns: auto 1fr;
8201
+ column-gap: 12px;
8202
+ row-gap: 7px;
8203
+ font-size: 13px;
8204
+ }
8205
+
8206
+ .debug-metrics__key {
8207
+ color: #000000;
8208
+ }
8209
+
8210
+ .debug-metrics__val {
8211
+ color: #000000;
8212
+ text-align: right;
8213
+ font-variant-numeric: tabular-nums;
8214
+ }
8215
+
8216
+ .debug-cost {
8217
+ font-weight: 600;
8218
+ }
8219
+
8220
+ /* Per-iteration table (verbose). The wrapper scrolls horizontally on its own
8221
+ so a wide table never forces the whole drawer to scroll sideways. */
8222
+ .debug-iterations-scroll {
8223
+ overflow-x: auto;
8224
+ max-width: 100%;
8225
+ }
8226
+
8227
+ .debug-iterations {
8228
+ width: 100%;
8229
+ border-collapse: collapse;
8230
+ font-size: 12px;
8231
+ font-variant-numeric: tabular-nums;
8232
+ }
8233
+
8234
+ .debug-iterations th,
8235
+ .debug-iterations td {
8236
+ padding: 5px 6px;
8237
+ text-align: right;
8238
+ white-space: nowrap;
8239
+ }
8240
+
8241
+ .debug-iterations th {
8242
+ color: #000000;
8243
+ font-weight: 600;
8244
+ border-bottom: 1px solid rgba(0, 0, 0, 0.10);
8245
+ }
8246
+
8247
+ .debug-iterations tbody tr:not(:last-child) td {
8248
+ border-bottom: 1px solid rgba(0, 0, 0, 0.05);
8249
+ }
8250
+
8251
+ .debug-iterations td:first-child,
8252
+ .debug-iterations th:first-child {
8253
+ text-align: left;
8254
+ }
8255
+
8256
+ .debug-empty {
8257
+ color: #000000;
8258
+ padding: 20px;
8259
+ font-size: 13px;
8260
+ text-align: center;
8261
+ }
8262
+
7514
8263
  /* Footer / Input */
7515
8264
  .footer {
7516
8265
  padding: 16px 16px 16px;
@@ -7850,6 +8599,7 @@
7850
8599
  }
7851
8600
 
7852
8601
  .skill-card {
8602
+ position: relative;
7853
8603
  display: flex;
7854
8604
  flex-direction: column;
7855
8605
  gap: 6px;
@@ -7869,8 +8619,53 @@
7869
8619
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
7870
8620
  }
7871
8621
 
8622
+ /* Install button on global skill cards. Absolutely positioned in the corner
8623
+ so it sits above the card's own click target; leave room via the name's
8624
+ padding-right below. */
8625
+ .skill-card__install {
8626
+ position: absolute;
8627
+ top: 10px;
8628
+ right: 10px;
8629
+ display: inline-flex;
8630
+ align-items: center;
8631
+ justify-content: center;
8632
+ width: 24px;
8633
+ height: 24px;
8634
+ padding: 0;
8635
+ border: 1px solid #d1d5db;
8636
+ border-radius: 6px;
8637
+ background: white;
8638
+ color: #374151;
8639
+ cursor: pointer;
8640
+ transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
8641
+ }
8642
+
8643
+ .skill-card__install:hover:not(:disabled) {
8644
+ border-color: var(--kr-chatbot-primary);
8645
+ color: var(--kr-chatbot-primary);
8646
+ }
8647
+
8648
+ .skill-card__install:disabled {
8649
+ opacity: 0.5;
8650
+ cursor: default;
8651
+ }
8652
+
8653
+ /* Installed state: filled check. */
8654
+ .skill-card__install--installed {
8655
+ background: var(--kr-chatbot-primary);
8656
+ border-color: var(--kr-chatbot-primary);
8657
+ color: white;
8658
+ }
8659
+
8660
+ .skill-card__install-icon {
8661
+ width: 15px;
8662
+ height: 15px;
8663
+ }
8664
+
7872
8665
  .skill-card__name {
7873
8666
  font-weight: 600;
8667
+ /* Leave room for the corner install button on global cards. */
8668
+ padding-right: 28px;
7874
8669
  }
7875
8670
 
7876
8671
  .skill-card__desc {
@@ -7973,38 +8768,38 @@
7973
8768
 
7974
8769
  `;
7975
8770
  __decorate([
7976
- n({ attribute: false })
8771
+ n$1({ attribute: false })
7977
8772
  ], exports.Chatbot.prototype, "send", void 0);
7978
8773
  __decorate([
7979
- n({ attribute: false })
8774
+ n$1({ attribute: false })
7980
8775
  ], exports.Chatbot.prototype, "clear", void 0);
7981
8776
  __decorate([
7982
- n({ attribute: false })
8777
+ n$1({ attribute: false })
7983
8778
  ], exports.Chatbot.prototype, "load", void 0);
7984
8779
  __decorate([
7985
- n({ attribute: false })
8780
+ n$1({ attribute: false })
7986
8781
  ], exports.Chatbot.prototype, "messages", void 0);
7987
8782
  __decorate([
7988
- n({ type: String })
8783
+ n$1({ type: String })
7989
8784
  ], exports.Chatbot.prototype, "label", void 0);
7990
8785
  __decorate([
7991
- n({ type: String })
8786
+ n$1({ type: String })
7992
8787
  ], exports.Chatbot.prototype, "placeholder", void 0);
7993
8788
  __decorate([
7994
- n({
8789
+ n$1({
7995
8790
  type: Boolean,
7996
8791
  reflect: true
7997
8792
  })
7998
8793
  ], exports.Chatbot.prototype, "opened", void 0);
7999
8794
  __decorate([
8000
- n({
8795
+ n$1({
8001
8796
  type: Boolean,
8002
8797
  attribute: 'hide-toggle',
8003
8798
  reflect: true
8004
8799
  })
8005
8800
  ], exports.Chatbot.prototype, "hideToggle", void 0);
8006
8801
  __decorate([
8007
- n({
8802
+ n$1({
8008
8803
  type: String,
8009
8804
  reflect: true
8010
8805
  })
@@ -8018,6 +8813,33 @@
8018
8813
  __decorate([
8019
8814
  r()
8020
8815
  ], exports.Chatbot.prototype, "_error", void 0);
8816
+ __decorate([
8817
+ r()
8818
+ ], exports.Chatbot.prototype, "_contextWarning", void 0);
8819
+ __decorate([
8820
+ r()
8821
+ ], exports.Chatbot.prototype, "_contextLimitReached", void 0);
8822
+ __decorate([
8823
+ r()
8824
+ ], exports.Chatbot.prototype, "_contextLimitMessage", void 0);
8825
+ __decorate([
8826
+ r()
8827
+ ], exports.Chatbot.prototype, "_telemetry", void 0);
8828
+ __decorate([
8829
+ r()
8830
+ ], exports.Chatbot.prototype, "_iterationLog", void 0);
8831
+ __decorate([
8832
+ r()
8833
+ ], exports.Chatbot.prototype, "_cacheCheckpoints", void 0);
8834
+ __decorate([
8835
+ r()
8836
+ ], exports.Chatbot.prototype, "_debugPanelOpen", void 0);
8837
+ __decorate([
8838
+ r()
8839
+ ], exports.Chatbot.prototype, "_debugDrawerWidth", void 0);
8840
+ __decorate([
8841
+ r()
8842
+ ], exports.Chatbot.prototype, "_isDebugResizing", void 0);
8021
8843
  __decorate([
8022
8844
  r()
8023
8845
  ], exports.Chatbot.prototype, "_pendingInternalFiles", void 0);
@@ -8033,6 +8855,12 @@
8033
8855
  __decorate([
8034
8856
  r()
8035
8857
  ], exports.Chatbot.prototype, "_skillResults", void 0);
8858
+ __decorate([
8859
+ r()
8860
+ ], exports.Chatbot.prototype, "_globalSkillResults", void 0);
8861
+ __decorate([
8862
+ r()
8863
+ ], exports.Chatbot.prototype, "_aiFrameworkConfig", void 0);
8036
8864
  __decorate([
8037
8865
  r()
8038
8866
  ], exports.Chatbot.prototype, "_skillHighlighted", void 0);