@kodaris/krubble-app-components 1.0.67 → 1.0.68

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.
@@ -1,41 +1,41 @@
1
- import{KRContextMenu as t,KRDialog as e}from"@kodaris/krubble-components";import{KRHttp as i}from"@kodaris/krubble-http";
1
+ import{KRContextMenu as e,KRDialog as t}from"@kodaris/krubble-components";import{KRHttp as s}from"@kodaris/krubble-http";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
5
5
  * SPDX-License-Identifier: BSD-3-Clause
6
- */const s=globalThis,a=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let o=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(a&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=n.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&n.set(e,t))}return t}toString(){return this.cssText}};const l=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===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.")})(i)+t[s+1]),t[0]);return new o(i,t,r)},d=a?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,r))(e)})(t):t
6
+ */const i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),a=new WeakMap;let o=class{constructor(e,t,s){if(this._$cssResult$=!0,s!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const s=void 0!==t&&1===t.length;s&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&a.set(t,e))}return e}toString(){return this.cssText}};const l=(e,...t)=>{const s=1===e.length?e[0]:t.reduce(((t,s,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+e[i+1]),e[0]);return new o(s,e,r)},c=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,r))(t)})(e):e
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */,{is:c,defineProperty:h,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:v}=Object,f=globalThis,b=f.trustedTypes,m=b?b.emptyScript:"",_=f.reactiveElementPolyfillSupport,x=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){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}},w=(t,e)=>!c(t,e),k={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let $=class 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,e=k){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:a}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const r=s?.call(this);a?.call(this,e),this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??k}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=v(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...u(t),...g(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,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,e=this.constructor.elementProperties;for(const i of e.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((t,e)=>{if(a)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const i of e){const e=document.createElement("style"),a=s.litNonce;void 0!==a&&e.setAttribute("nonce",a),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const a=(void 0!==i.converter?.toAttribute?i.converter:y).toAttribute(e,i.type);this._$Em=t,null==a?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),a="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=s;const r=a.fromAttribute(e,t.type);this[s]=r??this._$Ej?.get(s)??r,this._$Em=null}}requestUpdate(t,e,i,s=!1,a){if(void 0!==t){const r=this.constructor;if(!1===s&&(a=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??w)(a,e)||i.useDefault&&i.reflect&&a===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:a},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==a||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;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,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[x("elementProperties")]=new Map,$[x("finalized")]=new Map,_?.({ReactiveElement:$}),(f.reactiveElementVersions??=[]).push("2.1.2");
11
+ */,{is:h,defineProperty:d,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:g,getPrototypeOf:f}=Object,m=globalThis,v=m.trustedTypes,b=v?v.emptyScript:"",x=m.reactiveElementPolyfillSupport,k=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},_=(e,t)=>!h(e,t),w={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let $=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=w){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(e,s,t);void 0!==i&&d(this.prototype,e,i)}}static getPropertyDescriptor(e,t,s){const{get:i,set:n}=p(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const r=i?.call(this);n?.call(this,t),this.requestUpdate(e,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??w}static _$Ei(){if(this.hasOwnProperty(k("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(k("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(k("properties"))){const e=this.properties,t=[...u(e),...g(e)];for(const s of t)this.createProperty(s,e[s])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,s]of t)this.elementProperties.set(e,s)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const s=this._$Eu(e,t);void 0!==s&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const e of s)t.unshift(c(e))}else void 0!==e&&t.push(c(e));return t}static _$Eu(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const s of t.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const s of t){const t=document.createElement("style"),n=i.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=s.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ET(e,t){const s=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,s);if(void 0!==i&&!0===s.reflect){const n=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(t,s.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){const s=this.constructor,i=s._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=s.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=i;const r=n.fromAttribute(t,e.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(e,t,s,i=!1,n){if(void 0!==e){const r=this.constructor;if(!1===i&&(n=this[e]),s??=r.getPropertyOptions(e),!((s.hasChanged??_)(n,t)||s.useDefault&&s.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,s))))return;this.C(e,t,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:s,reflect:i,wrapped:n},r){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,r??t??this[e]),!0!==n||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||s||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,s]of e){const{wrapped:e}=s,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,s,i)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[k("elementProperties")]=new Map,$[k("finalized")]=new Map,x?.({ReactiveElement:$}),(m.reactiveElementVersions??=[]).push("2.1.2");
12
12
  /**
13
13
  * @license
14
14
  * Copyright 2017 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
16
  */
17
- const E=globalThis,I=E.trustedTypes,S=I?I.createPolicy("lit-html",{createHTML:t=>t}):void 0,A="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+C,z=`<${N}>`,D=document,M=()=>D.createComment(""),T=t=>null===t||"object"!=typeof t&&"function"!=typeof t,P=Array.isArray,R="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,L=/>/g,H=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,q=/"/g,X=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),F=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Y=new WeakMap,V=D.createTreeWalker(D,129);function K(t,e){if(!P(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const Q=(t,e)=>{const i=t.length-1,s=[];let a,r=2===e?"<svg>":3===e?"<math>":"",n=U;for(let e=0;e<i;e++){const i=t[e];let o,l,d=-1,c=0;for(;c<i.length&&(n.lastIndex=c,l=n.exec(i),null!==l);)c=n.lastIndex,n===U?"!--"===l[1]?n=O:void 0!==l[1]?n=L:void 0!==l[2]?(X.test(l[2])&&(a=RegExp("</"+l[2],"g")),n=H):void 0!==l[3]&&(n=H):n===H?">"===l[0]?(n=a??U,d=-1):void 0===l[1]?d=-2:(d=n.lastIndex-l[2].length,o=l[1],n=void 0===l[3]?H:'"'===l[3]?q:j):n===q||n===j?n=H:n===O||n===L?n=U:(n=H,a=void 0);const h=n===H&&t[e+1].startsWith("/>")?" ":"";r+=n===U?i+z:d>=0?(s.push(o),i.slice(0,d)+A+i.slice(d)+C+h):i+C+(-2===d?e:h)}return[K(t,r+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class G{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let a=0,r=0;const n=t.length-1,o=this.parts,[l,d]=Q(t,e);if(this.el=G.createElement(l,i),V.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=V.nextNode())&&o.length<n;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(A)){const e=d[r++],i=s.getAttribute(t).split(C),n=/([.?@])?(.*)/.exec(e);o.push({type:1,index:a,name:n[2],strings:i,ctor:"."===n[1]?it:"?"===n[1]?st:"@"===n[1]?at:et}),s.removeAttribute(t)}else t.startsWith(C)&&(o.push({type:6,index:a}),s.removeAttribute(t));if(X.test(s.tagName)){const t=s.textContent.split(C),e=t.length-1;if(e>0){s.textContent=I?I.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],M()),V.nextNode(),o.push({type:2,index:++a});s.append(t[e],M())}}}else if(8===s.nodeType)if(s.data===N)o.push({type:2,index:a});else{let t=-1;for(;-1!==(t=s.data.indexOf(C,t+1));)o.push({type:7,index:a}),t+=C.length-1}a++}}static createElement(t,e){const i=D.createElement("template");return i.innerHTML=t,i}}function J(t,e,i=t,s){if(e===F)return e;let a=void 0!==s?i._$Co?.[s]:i._$Cl;const r=T(e)?void 0:e._$litDirective$;return a?.constructor!==r&&(a?._$AO?.(!1),void 0===r?a=void 0:(a=new r(t),a._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=a:i._$Cl=a),void 0!==a&&(e=J(t,a._$AS(t,e.values),a,s)),e}class Z{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??D).importNode(e,!0);V.currentNode=s;let a=V.nextNode(),r=0,n=0,o=i[0];for(;void 0!==o;){if(r===o.index){let e;2===o.type?e=new tt(a,a.nextSibling,this,t):1===o.type?e=new o.ctor(a,o.name,o.strings,this,t):6===o.type&&(e=new rt(a,this,t)),this._$AV.push(e),o=i[++n]}r!==o?.index&&(a=V.nextNode(),r++)}return V.currentNode=D,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class tt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),T(t)?t===W||null==t||""===t?(this._$AH!==W&&this._$AR(),this._$AH=W):t!==this._$AH&&t!==F&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>P(t)||"function"==typeof t?.[Symbol.iterator])(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!==W&&T(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=G.createElement(K(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new Z(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=Y.get(t.strings);return void 0===e&&Y.set(t.strings,e=new G(t)),e}k(t){P(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const a of t)s===e.length?e.push(i=new tt(this.O(M()),this.O(M()),this,this.options)):i=e[s],i._$AI(a),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,a){this.type=1,this._$AH=W,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=a,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=W}_$AI(t,e=this,i,s){const a=this.strings;let r=!1;if(void 0===a)t=J(this,t,e,0),r=!T(t)||t!==this._$AH&&t!==F,r&&(this._$AH=t);else{const s=t;let n,o;for(t=a[0],n=0;n<a.length-1;n++)o=J(this,s[i+n],e,n),o===F&&(o=this._$AH[n]),r||=!T(o)||o!==this._$AH[n],o===W?t=W:t!==W&&(t+=(o??"")+a[n+1]),this._$AH[n]=o}r&&!s&&this.j(t)}j(t){t===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class it extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===W?void 0:t}}class st extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==W)}}class at extends et{constructor(t,e,i,s,a){super(t,e,i,s,a),this.type=5}_$AI(t,e=this){if((t=J(this,t,e,0)??W)===F)return;const i=this._$AH,s=t===W&&i!==W||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,a=t!==W&&(i===W||s);s&&this.element.removeEventListener(this.name,this,i),a&&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 rt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const nt=E.litHtmlPolyfillSupport;nt?.(G,tt),(E.litHtmlVersions??=[]).push("3.3.2");const ot=globalThis;
17
+ const E=globalThis,I=E.trustedTypes,S=I?I.createPolicy("lit-html",{createHTML:e=>e}):void 0,z="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+A,T=`<${C}>`,R=document,N=()=>R.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,P="[ \t\n\f\r]",O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,U=/-->/g,L=/>/g,H=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,q=/"/g,B=/^(?:script|style|textarea|title)$/i,X=(e=>(t,...s)=>({_$litType$:e,strings:t,values:s}))(1),F=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),Q=new WeakMap,Y=R.createTreeWalker(R,129);function Z(e,t){if(!M(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(t):t}const V=(e,t)=>{const s=e.length-1,i=[];let n,r=2===t?"<svg>":3===t?"<math>":"",a=O;for(let t=0;t<s;t++){const s=e[t];let o,l,c=-1,h=0;for(;h<s.length&&(a.lastIndex=h,l=a.exec(s),null!==l);)h=a.lastIndex,a===O?"!--"===l[1]?a=U:void 0!==l[1]?a=L:void 0!==l[2]?(B.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=H):void 0!==l[3]&&(a=H):a===H?">"===l[0]?(a=n??O,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?H:'"'===l[3]?q:j):a===q||a===j?a=H:a===U||a===L?a=O:(a=H,n=void 0);const d=a===H&&e[t+1].startsWith("/>")?" ":"";r+=a===O?s+T:c>=0?(i.push(o),s.slice(0,c)+z+s.slice(c)+A+d):s+A+(-2===c?t:d)}return[Z(e,r+(e[s]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class K{constructor({strings:e,_$litType$:t},s){let i;this.parts=[];let n=0,r=0;const a=e.length-1,o=this.parts,[l,c]=V(e,t);if(this.el=K.createElement(l,s),Y.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Y.nextNode())&&o.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(z)){const t=c[r++],s=i.getAttribute(e).split(A),a=/([.?@])?(.*)/.exec(t);o.push({type:1,index:n,name:a[2],strings:s,ctor:"."===a[1]?se:"?"===a[1]?ie:"@"===a[1]?ne:te}),i.removeAttribute(e)}else e.startsWith(A)&&(o.push({type:6,index:n}),i.removeAttribute(e));if(B.test(i.tagName)){const e=i.textContent.split(A),t=e.length-1;if(t>0){i.textContent=I?I.emptyScript:"";for(let s=0;s<t;s++)i.append(e[s],N()),Y.nextNode(),o.push({type:2,index:++n});i.append(e[t],N())}}}else if(8===i.nodeType)if(i.data===C)o.push({type:2,index:n});else{let e=-1;for(;-1!==(e=i.data.indexOf(A,e+1));)o.push({type:7,index:n}),e+=A.length-1}n++}}static createElement(e,t){const s=R.createElement("template");return s.innerHTML=e,s}}function J(e,t,s=e,i){if(t===F)return t;let n=void 0!==i?s._$Co?.[i]:s._$Cl;const r=D(t)?void 0:t._$litDirective$;return n?.constructor!==r&&(n?._$AO?.(!1),void 0===r?n=void 0:(n=new r(e),n._$AT(e,s,i)),void 0!==i?(s._$Co??=[])[i]=n:s._$Cl=n),void 0!==n&&(t=J(e,n._$AS(e,t.values),n,i)),t}class G{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:s}=this._$AD,i=(e?.creationScope??R).importNode(t,!0);Y.currentNode=i;let n=Y.nextNode(),r=0,a=0,o=s[0];for(;void 0!==o;){if(r===o.index){let t;2===o.type?t=new ee(n,n.nextSibling,this,e):1===o.type?t=new o.ctor(n,o.name,o.strings,this,e):6===o.type&&(t=new re(n,this,e)),this._$AV.push(t),o=s[++a]}r!==o?.index&&(n=Y.nextNode(),r++)}return Y.currentNode=R,i}p(e){let t=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,s,i){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=J(this,e,t),D(e)?e===W||null==e||""===e?(this._$AH!==W&&this._$AR(),this._$AH=W):e!==this._$AH&&e!==F&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==W&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(R.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:s}=e,i="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=K.createElement(Z(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new G(i,this),s=e.u(this.options);e.p(t),this.T(s),this._$AH=e}}_$AC(e){let t=Q.get(e.strings);return void 0===t&&Q.set(e.strings,t=new K(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,i=0;for(const n of e)i===t.length?t.push(s=new ee(this.O(N()),this.O(N()),this,this.options)):s=t[i],s._$AI(n),i++;i<t.length&&(this._$AR(s&&s._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,s,i,n){this.type=1,this._$AH=W,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=W}_$AI(e,t=this,s,i){const n=this.strings;let r=!1;if(void 0===n)e=J(this,e,t,0),r=!D(e)||e!==this._$AH&&e!==F,r&&(this._$AH=e);else{const i=e;let a,o;for(e=n[0],a=0;a<n.length-1;a++)o=J(this,i[s+a],t,a),o===F&&(o=this._$AH[a]),r||=!D(o)||o!==this._$AH[a],o===W?e=W:e!==W&&(e+=(o??"")+n[a+1]),this._$AH[a]=o}r&&!i&&this.j(e)}j(e){e===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class se extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===W?void 0:e}}class ie extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==W)}}class ne extends te{constructor(e,t,s,i,n){super(e,t,s,i,n),this.type=5}_$AI(e,t=this){if((e=J(this,e,t,0)??W)===F)return;const s=this._$AH,i=e===W&&s!==W||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,n=e!==W&&(s===W||i);i&&this.element.removeEventListener(this.name,this,s),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class re{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){J(this,e)}}const ae=E.litHtmlPolyfillSupport;ae?.(K,ee),(E.litHtmlVersions??=[]).push("3.3.2");const oe=globalThis;
18
18
  /**
19
19
  * @license
20
20
  * Copyright 2017 Google LLC
21
21
  * SPDX-License-Identifier: BSD-3-Clause
22
- */let lt=class extends ${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 e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=i?.renderBefore??e;let a=s._$litPart$;if(void 0===a){const t=i?.renderBefore??null;s._$litPart$=a=new tt(e.insertBefore(M(),t),t,void 0,i??{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}};lt._$litElement$=!0,lt.finalized=!0,ot.litElementHydrateSupport?.({LitElement:lt});const dt=ot.litElementPolyfillSupport;dt?.({LitElement:lt}),(ot.litElementVersions??=[]).push("4.2.2");
22
+ */let le=class extends ${constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,s)=>{const i=s?.renderBefore??t;let n=i._$litPart$;if(void 0===n){const e=s?.renderBefore??null;i._$litPart$=n=new ee(t.insertBefore(N(),e),e,void 0,s??{})}return n._$AI(e),n})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}};le._$litElement$=!0,le.finalized=!0,oe.litElementHydrateSupport?.({LitElement:le});const ce=oe.litElementPolyfillSupport;ce?.({LitElement:le}),(oe.litElementVersions??=[]).push("4.2.2");
23
23
  /**
24
24
  * @license
25
25
  * Copyright 2017 Google LLC
26
26
  * SPDX-License-Identifier: BSD-3-Clause
27
27
  */
28
- const ct=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)}
28
+ const he=e=>(t,s)=>{void 0!==s?s.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
29
29
  /**
30
30
  * @license
31
31
  * Copyright 2017 Google LLC
32
32
  * SPDX-License-Identifier: BSD-3-Clause
33
- */,ht={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:w},pt=(t=ht,e,i)=>{const{kind:s,metadata:a}=i;let r=globalThis.litPropertyMetadata.get(a);if(void 0===r&&globalThis.litPropertyMetadata.set(a,r=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),r.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const a=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,a,t,!0,i)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const a=this[s];e.call(this,i),this.requestUpdate(s,a,t,!0,i)}}throw Error("Unsupported decorator location: "+s)};function ut(t){return(e,i)=>"object"==typeof i?pt(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)
33
+ */,de={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:_},pe=(e=de,t,s)=>{const{kind:i,metadata:n}=s;let r=globalThis.litPropertyMetadata.get(n);if(void 0===r&&globalThis.litPropertyMetadata.set(n,r=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),r.set(s.name,e),"accessor"===i){const{name:i}=s;return{set(s){const n=t.get.call(this);t.set.call(this,s),this.requestUpdate(i,n,e,!0,s)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=s;return function(s){const n=this[i];t.call(this,s),this.requestUpdate(i,n,e,!0,s)}}throw Error("Unsupported decorator location: "+i)};function ue(e){return(t,s)=>"object"==typeof s?pe(e,t,s):((e,t,s)=>{const i=t.hasOwnProperty(s);return t.constructor.createProperty(s,e),i?Object.getOwnPropertyDescriptor(t,s):void 0})(e,t,s)
34
34
  /**
35
35
  * @license
36
36
  * Copyright 2017 Google LLC
37
37
  * SPDX-License-Identifier: BSD-3-Clause
38
- */}function gt(t){return ut({...t,state:!0,attribute:!1})}
38
+ */}function ge(e){return ue({...e,state:!0,attribute:!1})}
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
@@ -46,22 +46,22 @@ const ct=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)
46
46
  * Copyright 2017 Google LLC
47
47
  * SPDX-License-Identifier: BSD-3-Clause
48
48
  */
49
- function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}
49
+ function fe(e,t){return(t,s,i)=>((e,t,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,s),s))(t,s,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}
50
50
  /**
51
51
  * @license
52
52
  * Copyright 2017 Google LLC
53
53
  * SPDX-License-Identifier: BSD-3-Clause
54
- */const ft=1,bt=2,mt=t=>(...e)=>({_$litDirective$:t,values:e});class _t{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)}}
54
+ */const me=1,ve=2,be=e=>(...t)=>({_$litDirective$:e,values:t});class xe{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,s){this._$Ct=e,this._$AM=t,this._$Ci=s}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}
55
55
  /**
56
56
  * @license
57
57
  * Copyright 2017 Google LLC
58
58
  * SPDX-License-Identifier: BSD-3-Clause
59
- */let xt=class extends _t{constructor(t){if(super(t),this.it=W,t.type!==bt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===W||null==t)return this._t=void 0,this.it=t;if(t===F)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};xt.directiveName="unsafeHTML",xt.resultType=1;const yt=mt(xt),wt=mt(class extends _t{constructor(t){if(super(t),t.type!==ft||"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((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.st)t in e||(i.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return F}});
59
+ */let ke=class extends xe{constructor(e){if(super(e),this.it=W,e.type!==ve)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===W||null==e)return this._t=void 0,this.it=e;if(e===F)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};ke.directiveName="unsafeHTML",ke.resultType=1;const ye=be(ke),_e=be(class extends xe{constructor(e){if(super(e),e.type!==me||"class"!==e.name||e.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){if(void 0===this.st){this.st=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(t)}const s=e.element.classList;for(const e of this.st)e in t||(s.remove(e),this.st.delete(e));for(const e in t){const i=!!t[e];i===this.st.has(e)||this.nt?.has(e)||(i?(s.add(e),this.st.add(e)):(s.remove(e),this.st.delete(e)))}return F}});
60
60
  /**
61
61
  * @license
62
62
  * Copyright 2018 Google LLC
63
63
  * SPDX-License-Identifier: BSD-3-Clause
64
- */var kt=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let $t=class extends lt{constructor(){super(...arguments),this.label="",this.icon="",this.url="",this.active=!0}connectedCallback(){super.connectedCallback(),this.data&&(this.label=this.data.label||"",this.icon=this.data.icon||"",this.url=this.data.url||"",this.active=!1!==this.data.active)}handleLabelInput(t){const e=t.target;this.label=e.value}handleIconInput(t){const e=t.target;this.icon=e.value}handleUrlInput(t){const e=t.target;this.url=e.value}handleActiveChange(t){this.active=t.target.checked}handleCancel(){this.dialogRef.close(void 0)}handleSave(){this.dialogRef.close({label:this.label,icon:this.icon||void 0,url:this.url||void 0,active:this.active})}handleKeyDown(t){"Enter"===t.key&&this.handleSave()}render(){return B`
64
+ */var we=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};let $e=class extends le{constructor(){super(...arguments),this.label="",this.icon="",this.url="",this.active=!0}connectedCallback(){super.connectedCallback(),this.data&&(this.label=this.data.label||"",this.icon=this.data.icon||"",this.url=this.data.url||"",this.active=!1!==this.data.active)}handleLabelInput(e){const t=e.target;this.label=t.value}handleIconInput(e){const t=e.target;this.icon=t.value}handleUrlInput(e){const t=e.target;this.url=t.value}handleActiveChange(e){this.active=e.target.checked}handleCancel(){this.dialogRef.close(void 0)}handleSave(){this.dialogRef.close({label:this.label,icon:this.icon||void 0,url:this.url||void 0,active:this.active})}handleKeyDown(e){"Enter"===e.key&&this.handleSave()}render(){return X`
65
65
  <h2>Edit Navigation Item</h2>
66
66
 
67
67
  <div class="form-group">
@@ -113,7 +113,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
113
113
  <button class="btn-cancel" @click=${this.handleCancel}>Cancel</button>
114
114
  <button class="btn-save" @click=${this.handleSave}>Save</button>
115
115
  </div>
116
- `}};$t.styles=l`
116
+ `}};$e.styles=l`
117
117
  :host {
118
118
  display: block;
119
119
  width: 360px;
@@ -198,9 +198,9 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
198
198
  .btn-save:hover {
199
199
  background: #d4f472;
200
200
  }
201
- `,kt([gt()],$t.prototype,"label",void 0),kt([gt()],$t.prototype,"icon",void 0),kt([gt()],$t.prototype,"url",void 0),kt([gt()],$t.prototype,"active",void 0),$t=kt([ct("kr-nav-item-edit")],$t);var Et=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let It=class extends lt{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.navEnabled=!0,this.userType="employee",this.breadcrumbs=[],this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.installFetchInterceptor()}firstUpdated(){this.loadPref()}updated(t){super.updated(t),t.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((t=>"group"===t.type)).forEach((t=>this.navItemsExpanded.add(t.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const t=this;this.originalFetch=window.fetch.bind(window);const e=this.originalFetch;window.fetch=function(...i){return t.pendingRequests++,e(...i).finally((()=>{t.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const i=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(e,s,a=!0,r,n){return t.pendingRequests++,this.addEventListener("loadend",(()=>{t.pendingRequests--}),{once:!0}),i.call(this,e,s,a,r,n)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(t){if(!t.url)return"#";if(t.external)return t.url;const e=t.url.startsWith("/")?t.url.slice(1):t.url,i=document.querySelector("base")?.getAttribute("href")||"/";return(i.endsWith("/")?i:i+"/")+e}getComputedNav(){const t=[];return this.nav.forEach(((e,i)=>{const s=this.pref.nav[e.id];t.push({...e,...s,order:s?.order??e.order??i,parentId:s?.parentId??null}),"group"===e.type&&e.children&&e.children.forEach(((i,s)=>{const a=this.pref.nav[i.id];t.push({...i,...a,order:a?.order??i.order??s,parentId:void 0!==a?.parentId?a.parentId:e.id})}))})),Object.entries(this.pref.nav).forEach((([e,i])=>{e.startsWith("custom")&&i.type&&i.label&&t.push({id:e,type:i.type,label:i.label,icon:i.icon,url:i.url,active:i.active,order:i.order??t.length,parentId:i.parentId??null})})),t}getNavItemChildren(t){let e=this.getComputedNav().filter((e=>e.parentId===t)).sort(((t,e)=>t.order-e.order));if(this.isEditing||(e=e.filter((t=>!1!==t.active))),this.navQuery){const i=this.navQuery.toLowerCase(),s=this.getComputedNav();if(null!==t){const a=s.find((e=>e.id===t));if(a?.label.toLowerCase().includes(i))return e}e=e.filter((t=>"group"===t.type?t.label.toLowerCase().includes(i)||s.some((e=>e.parentId===t.id&&!1!==e.active&&e.label.toLowerCase().includes(i))):t.label.toLowerCase().includes(i)))}return e}handleNavQueryChange(t){this.navQuery=t.target.value,this.navQuery?this.getComputedNav().forEach((t=>{"group"===t.type&&this.navItemsExpanded.add(t.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const t=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(t){this.isNavScrolled=t.target.scrollTop>0}toggleNavItem(t){const e=this.shadowRoot?.querySelector(`.nav-item[data-id="${t}"]`),i=e?.nextElementSibling;i&&(this.navItemsExpanded.has(t)?(this.navItemsExpanded.delete(t),i.animate([{height:`${i.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{i.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(t),i.classList.add("nav-group--expanded"),i.animate([{height:"0px"},{height:`${i.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate())}handleNavItemClick(t,e){if("group"===e.type)this.toggleNavItem(e.id);else{if(t.ctrlKey||t.metaKey||1===t.button)return;this.activeNavItemId=e.id;const i=new CustomEvent("nav-item-click",{detail:{item:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&t.preventDefault()}}updateActiveNavItem(){const t=window.location.pathname,e=this.getComputedNav().filter((t=>"item"===t.type&&t.url));let i=null,s=0;for(const a of e){const e=this.resolveUrl(a);t.startsWith(e)&&e.length>s&&(i=a,s=e.length)}i?(this.activeNavItemId=i.id,i.parentId&&this.navItemsExpanded.add(i.parentId)):this.activeNavItemId=null}startEditing(){this.isEditing=!0}cancelEditing(){this.isEditing=!1,this.loadPref()}resetPref(){this.pref.nav={}}savePref(){if("customer"===this.userType)return;const t=this.pref.uuid?`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`:"/api/system/preference/json/scaffold?global=true";i.fetch({url:t,method:this.pref.uuid?"PUT":"POST",body:JSON.stringify({nav:this.pref.nav})}).then((t=>t.json())).then((t=>{this.pref=t.data,this.isEditing=!1})).catch((t=>{console.error("Failed to save nav customizations:",t)}))}loadPref(){"customer"!==this.userType&&i.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((t=>t.json())).then((t=>{const e=t?.data?.[0];e&&(this.pref=e)})).catch((()=>{}))}handleNavItemContextMenu(e,i){this.isEditing&&(e.preventDefault(),t.open({x:e.clientX,y:e.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((t=>{if(t)switch(t.id){case"edit":this.openNavItemEdit(i);break;case"add-above":this.addNavItem(i,"above");break;case"add-below":this.addNavItem(i,"below")}})))}openNavItemEdit(t){e.open($t,{data:t}).afterClosed().then((e=>{const i=e;i&&(this.pref.nav[t.id]||(this.pref.nav[t.id]={}),this.pref.nav[t.id]={...this.pref.nav[t.id],...i},this.requestUpdate())}))}addNavItem(t,e){const i=`custom-${Date.now()}`,s=this.getComputedNav().filter((e=>e.parentId===t.parentId)).sort(((t,e)=>t.order-e.order)),a=s.findIndex((e=>e.id===t.id)),r="above"===e?a:a+1;s.forEach(((t,e)=>{e>=r&&(this.pref.nav[t.id]||(this.pref.nav[t.id]={}),this.pref.nav[t.id].order=e+1)}));const n={id:i,type:"item",label:"New Item",order:r,parentId:t.parentId,active:!0};this.pref.nav[i]=n,this.requestUpdate(),this.openNavItemEdit(n)}handleNavItemMouseDown(t,e){this.isEditing&&(t.preventDefault(),this.draggedNavItemId=e.id,this.navItemDragStartY=t.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(t){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(t.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const e=this.getComputedNav().find((t=>t.id===this.draggedNavItemId));e&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=e.label,this.navItemDragPreview.style.left=`${t.clientX+10}px`,this.navItemDragPreview.style.top=t.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${t.clientX+10}px`,this.navItemDragPreview.style.top=t.clientY-20+"px"),this.updateNavItemDropTarget(t))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(t){const e=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!e)return;let i=!1;e.forEach((e=>{const s=e.getBoundingClientRect(),a=e.getAttribute("data-id");if(!a||a===this.draggedNavItemId)return;if(t.clientX<s.left||t.clientX>s.right||t.clientY<s.top||t.clientY>s.bottom)return;const r=this.getComputedNav().find((t=>t.id===a));if(!r)return;const n=t.clientY-s.top;let o;"group"===r.type?n<s.height/3?(o="above",this.clearNavItemDragExpandTimeout()):n>2*s.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(r.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(r.id)):(o=n<s.height/2?"above":"below",this.clearNavItemDragExpandTimeout());const l="center"===o?r.id:r.parentId,d=this.getComputedNav().find((t=>t.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===d?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=r.id,this.navItemDropPosition=o,i=!0})),i||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}expandNavGroupOnDrag(t){this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===t&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(t),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const t=this.getComputedNav(),e=t.find((t=>t.id===this.draggedNavItemId)),i=t.find((t=>t.id===this.navItemDropTargetId));if(!e||!i)return;let s;if("center"===this.navItemDropPosition&&"group"===i.type){if(i.id===this.draggedNavItemId)return;s=i.id}else s=i.parentId;if(s===this.draggedNavItemId)return;const a=t.filter((t=>t.parentId===s&&t.id!==this.draggedNavItemId)).sort(((t,e)=>t.order-e.order)),r=this.pref.nav;let n;if("center"===this.navItemDropPosition)n=a.length>0?Math.max(...a.map((t=>t.order)))+1:0;else{const t=a.findIndex((t=>t.id===i.id));n=-1===t?0:"above"===this.navItemDropPosition?t:t+1,a.forEach(((t,e)=>{r[t.id]||(r[t.id]={}),r[t.id].order=e>=n?e+1:e}))}r[this.draggedNavItemId]||(r[this.draggedNavItemId]={}),r[this.draggedNavItemId].order=n,r[this.draggedNavItemId].parentId=s,this.pref.nav=r,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return W;const t=this.user.name.split(" ").map((t=>t[0])).join("").toUpperCase().slice(0,2);return B`
201
+ `,we([ge()],$e.prototype,"label",void 0),we([ge()],$e.prototype,"icon",void 0),we([ge()],$e.prototype,"url",void 0),we([ge()],$e.prototype,"active",void 0),$e=we([he("kr-nav-item-edit")],$e);var Ee=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};let Ie=class extends le{constructor(){super(),this.defaultNavItemIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="10"/></svg>',this.originalFetch=null,this.originalXhrOpen=null,this.navItemDragPreview=null,this.navItemDragStartY=0,this.isNavItemDragging=!1,this.navItemDragExpandTimeout=null,this.navInitialized=!1,this.logo="",this.label="",this.homeUrl="/",this.scheme="light",this.nav=[],this.navIconsDisplayed=!1,this.navExpanded=!1,this.user=null,this.subbar=!1,this.navEnabled=!0,this.userType="employee",this.breadcrumbs=[],this.navItemsExpanded=new Set,this.navQuery="",this.activeNavItemId=null,this.isNavScrolled=!1,this.isNavOpened="false"!==localStorage.getItem("kr-scaffold-nav-opened"),this.isEditing=!1,this.isUserMenuOpen=!1,this.pref={nav:{}},this.draggedNavItemId=null,this.navItemDropTargetId=null,this.navItemDropPosition="above",this.pendingRequests=0,this.boundHandleMouseMove=this.handleMouseMove.bind(this),this.boundHandleMouseUp=this.handleMouseUp.bind(this)}connectedCallback(){super.connectedCallback(),this.installFetchInterceptor()}firstUpdated(){this.loadPref()}updated(e){super.updated(e),e.has("nav")&&this.nav.length>0&&(this.updateActiveNavItem(),this.navExpanded&&!this.navInitialized&&(this.navInitialized=!0,this.getComputedNav().filter((e=>"group"===e.type)).forEach((e=>this.navItemsExpanded.add(e.id)))))}disconnectedCallback(){super.disconnectedCallback(),this.uninstallFetchInterceptor()}installFetchInterceptor(){if(this.originalFetch)return;const e=this;this.originalFetch=window.fetch.bind(window);const t=this.originalFetch;window.fetch=function(...s){return e.pendingRequests++,t(...s).finally((()=>{e.pendingRequests--}))},this.originalXhrOpen=XMLHttpRequest.prototype.open;const s=this.originalXhrOpen;XMLHttpRequest.prototype.open=function(t,i,n=!0,r,a){return e.pendingRequests++,this.addEventListener("loadend",(()=>{e.pendingRequests--}),{once:!0}),s.call(this,t,i,n,r,a)}}uninstallFetchInterceptor(){this.originalFetch&&(window.fetch=this.originalFetch,this.originalFetch=null),this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen,this.originalXhrOpen=null)}resolveUrl(e){if(!e.url)return"#";if(e.external)return e.url;let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const s=document.querySelector("base")?.getAttribute("href")||"/";return s.endsWith("/")?s+t:s+"/"+t}getComputedNav(){const e=[];return this.nav.forEach(((t,s)=>{const i=this.pref.nav[t.id];e.push({...t,...i,order:i?.order??t.order??s,parentId:i?.parentId??null}),"group"===t.type&&t.children&&t.children.forEach(((s,i)=>{const n=this.pref.nav[s.id];let r=t.id;void 0!==n?.parentId&&(r=n.parentId),e.push({...s,...n,order:n?.order??s.order??i,parentId:r})}))})),Object.entries(this.pref.nav).forEach((([t,s])=>{t.startsWith("custom")&&s.type&&s.label&&e.push({id:t,type:s.type,label:s.label,icon:s.icon,url:s.url,active:s.active,order:s.order??e.length,parentId:s.parentId??null})})),e}getNavItemChildren(e){let t=this.getComputedNav().filter((t=>t.parentId===e)).sort(((e,t)=>e.order-t.order));if(this.isEditing||(t=t.filter((e=>!1!==e.active))),this.navQuery){const s=this.navQuery.toLowerCase(),i=this.getComputedNav();if(null!==e){const n=i.find((t=>t.id===e));if(n?.label.toLowerCase().includes(s))return t}t=t.filter((e=>"group"===e.type?e.label.toLowerCase().includes(s)||i.some((t=>t.parentId===e.id&&!1!==t.active&&t.label.toLowerCase().includes(s))):e.label.toLowerCase().includes(s)))}return t}handleNavQueryChange(e){this.navQuery=e.target.value,this.navQuery?this.getComputedNav().forEach((e=>{"group"===e.type&&this.navItemsExpanded.add(e.id)})):this.navItemsExpanded.clear()}handleNavQueryClear(){this.navQuery="",this.navItemsExpanded.clear()}handleMenuClick(){this.isNavOpened=!this.isNavOpened,localStorage.setItem("kr-scaffold-nav-opened",String(this.isNavOpened))}handleNavHeaderClick(){this.activeNavItemId=null;const e=new CustomEvent("nav-item-click",{detail:{item:{url:this.homeUrl}},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(window.location.href=this.homeUrl)}handleNavScroll(e){this.isNavScrolled=e.target.scrollTop>0}toggleNavItem(e){const t=this.shadowRoot?.querySelector(`.nav-item[data-id="${e}"]`),s=t?.nextElementSibling;s&&(this.navItemsExpanded.has(e)?(this.navItemsExpanded.delete(e),s.animate([{height:`${s.scrollHeight}px`},{height:"0px"}],{duration:300,easing:"ease-in-out"}).onfinish=()=>{s.classList.remove("nav-group--expanded")}):(this.navItemsExpanded.add(e),s.classList.add("nav-group--expanded"),s.animate([{height:"0px"},{height:`${s.scrollHeight}px`}],{duration:300,easing:"ease-in-out"})),this.requestUpdate())}handleNavItemClick(e,t){if("group"===t.type)this.toggleNavItem(t.id);else{if(e.ctrlKey||e.metaKey||1===e.button)return;this.activeNavItemId=t.id;const s=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&e.preventDefault()}}updateActiveNavItem(){const e=window.location.pathname,t=this.getComputedNav().filter((e=>"item"===e.type&&e.url));let s=null,i=0;for(const n of t){const t=this.resolveUrl(n);e.startsWith(t)&&t.length>i&&(s=n,i=t.length)}s?(this.activeNavItemId=s.id,s.parentId&&this.navItemsExpanded.add(s.parentId)):this.activeNavItemId=null}startEditing(){this.isEditing=!0}cancelEditing(){this.isEditing=!1,this.loadPref()}resetPref(){this.pref.nav={}}savePref(){if("customer"===this.userType)return;let e="/api/system/preference/json/scaffold?global=true",t="POST";this.pref.uuid&&(e=`/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`,t="PUT"),s.fetch({url:e,method:t,body:JSON.stringify({nav:this.pref.nav})}).then((e=>e.json())).then((e=>{this.pref=e.data,this.isEditing=!1})).catch((e=>{console.error("Failed to save nav customizations:",e)}))}loadPref(){"customer"!==this.userType&&s.fetch({url:"/api/system/preference/json/scaffold?global=true",method:"GET"}).then((e=>e.json())).then((e=>{const t=e?.data?.[0];t&&(this.pref=t)})).catch((()=>{}))}handleNavItemContextMenu(t,s){this.isEditing&&(t.preventDefault(),e.open({x:t.clientX,y:t.clientY,items:[{id:"edit",label:"Edit Item"},{id:"divider-1",label:"",divider:!0},{id:"add-above",label:"Add Item Above"},{id:"add-below",label:"Add Item Below"}]}).then((e=>{if(e)switch(e.id){case"edit":this.openNavItemEdit(s);break;case"add-above":this.addNavItem(s,"above");break;case"add-below":this.addNavItem(s,"below")}})))}openNavItemEdit(e){t.open($e,{data:e}).afterClosed().then((t=>{const s=t;s&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id]={...this.pref.nav[e.id],...s},this.requestUpdate())}))}addNavItem(e,t){const s=`custom-${Date.now()}`,i=this.getComputedNav().filter((t=>t.parentId===e.parentId)).sort(((e,t)=>e.order-t.order)),n=i.findIndex((t=>t.id===e.id));let r;r="above"===t?n:n+1,i.forEach(((e,t)=>{t>=r&&(this.pref.nav[e.id]||(this.pref.nav[e.id]={}),this.pref.nav[e.id].order=t+1)}));const a={id:s,type:"item",label:"New Item",order:r,parentId:e.parentId,active:!0};this.pref.nav[s]=a,this.requestUpdate(),this.openNavItemEdit(a)}handleNavItemMouseDown(e,t){this.isEditing&&(e.preventDefault(),this.draggedNavItemId=t.id,this.navItemDragStartY=e.clientY,this.isNavItemDragging=!1,document.addEventListener("mousemove",this.boundHandleMouseMove),document.addEventListener("mouseup",this.boundHandleMouseUp))}handleMouseMove(e){if(this.draggedNavItemId){if(!this.isNavItemDragging&&Math.abs(e.clientY-this.navItemDragStartY)>5){this.isNavItemDragging=!0,this.classList.add("kr-scaffold--dragging");const t=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));t&&(this.navItemDragPreview=document.createElement("div"),this.navItemDragPreview.className="nav-item-drag-preview",this.navItemDragPreview.textContent=t.label,this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px",this.shadowRoot?.appendChild(this.navItemDragPreview))}this.isNavItemDragging&&(this.navItemDragPreview&&(this.navItemDragPreview.style.left=`${e.clientX+10}px`,this.navItemDragPreview.style.top=e.clientY-20+"px"),this.updateNavItemDropTarget(e))}}handleMouseUp(){document.removeEventListener("mousemove",this.boundHandleMouseMove),document.removeEventListener("mouseup",this.boundHandleMouseUp),this.isNavItemDragging&&this.navItemDropTargetId&&this.executeNavItemDrop(),this.draggedNavItemId=null,this.navItemDropTargetId=null,this.isNavItemDragging=!1,this.classList.remove("kr-scaffold--dragging"),this.navItemDragPreview&&(this.navItemDragPreview.remove(),this.navItemDragPreview=null),this.clearNavItemDragExpandTimeout(),this.requestUpdate()}updateNavItemDropTarget(e){const t=this.shadowRoot?.querySelectorAll(".nav-item[data-id]");if(!t)return;let s=!1;t.forEach((t=>{const i=t.getBoundingClientRect(),n=t.getAttribute("data-id");if(!n||n===this.draggedNavItemId)return;if(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom)return;const r=this.getComputedNav().find((e=>e.id===n));if(!r)return;const a=e.clientY-i.top;let o,l;"group"===r.type?a<i.height/3?(o="above",this.clearNavItemDragExpandTimeout()):a>2*i.height/3?(o="below",this.clearNavItemDragExpandTimeout()):(o="center",this.navItemsExpanded.has(r.id)||this.navItemDragExpandTimeout||this.expandNavGroupOnDrag(r.id)):(o=a<i.height/2?"above":"below",this.clearNavItemDragExpandTimeout()),l="center"===o?r.id:r.parentId;const c=this.getComputedNav().find((e=>e.id===this.draggedNavItemId));if(l===this.draggedNavItemId||"group"===c?.type&&null!==l)return this.navItemDropTargetId=null,void this.clearNavItemDragExpandTimeout();this.navItemDropTargetId=r.id,this.navItemDropPosition=o,s=!0})),s||(this.navItemDropTargetId=null,this.clearNavItemDragExpandTimeout()),this.requestUpdate()}clearNavItemDragExpandTimeout(){this.navItemDragExpandTimeout&&(clearTimeout(this.navItemDragExpandTimeout),this.navItemDragExpandTimeout=null)}expandNavGroupOnDrag(e){this.navItemDragExpandTimeout=window.setTimeout((()=>{this.navItemDropTargetId===e&&"center"===this.navItemDropPosition&&(this.navItemsExpanded.add(e),this.requestUpdate()),this.navItemDragExpandTimeout=null}),500)}executeNavItemDrop(){if(!this.draggedNavItemId||!this.navItemDropTargetId)return;const e=this.getComputedNav(),t=e.find((e=>e.id===this.draggedNavItemId)),s=e.find((e=>e.id===this.navItemDropTargetId));if(!t||!s)return;let i;if("center"===this.navItemDropPosition&&"group"===s.type){if(s.id===this.draggedNavItemId)return;i=s.id}else i=s.parentId;if(i===this.draggedNavItemId)return;const n=e.filter((e=>e.parentId===i&&e.id!==this.draggedNavItemId)).sort(((e,t)=>e.order-t.order)),r=this.pref.nav;let a;if("center"===this.navItemDropPosition)a=n.length>0?Math.max(...n.map((e=>e.order)))+1:0;else{const e=n.findIndex((e=>e.id===s.id));a=-1===e?0:"above"===this.navItemDropPosition?e:e+1,n.forEach(((e,t)=>{r[e.id]||(r[e.id]={}),r[e.id].order=t>=a?t+1:t}))}r[this.draggedNavItemId]||(r[this.draggedNavItemId]={}),r[this.draggedNavItemId].order=a,r[this.draggedNavItemId].parentId=i,this.pref.nav=r,this.requestUpdate()}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}closeUserMenu(){this.isUserMenuOpen=!1}handleCustomize(){this.closeUserMenu(),this.startEditing()}renderNormalFooter(){if(!this.user)return W;const e=this.user.name.split(" ").map((e=>e[0])).join("").toUpperCase().slice(0,2);return X`
202
202
  <div class="user-menu-container">
203
- ${this.isUserMenuOpen?B`
203
+ ${this.isUserMenuOpen?X`
204
204
  <div class="user-menu">
205
205
  <button class="user-menu__item" @click=${this.handleCustomize}>
206
206
  Customize Navigation
@@ -209,15 +209,15 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
209
209
  `:W}
210
210
  <div class="user" @click=${this.toggleUserMenu}>
211
211
  <div class="user__avatar">
212
- ${this.user.avatar?B`<img src=${this.user.avatar} alt=${this.user.name} />`:t}
212
+ ${this.user.avatar?X`<img src=${this.user.avatar} alt=${this.user.name} />`:e}
213
213
  </div>
214
214
  <div class="user__info">
215
215
  <div class="user__name">${this.user.name}</div>
216
- ${this.user.email?B`<div class="user__email">${this.user.email}</div>`:W}
216
+ ${this.user.email?X`<div class="user__email">${this.user.email}</div>`:W}
217
217
  </div>
218
218
  </div>
219
219
  </div>
220
- `}renderEditFooter(){return B`
220
+ `}renderEditFooter(){return X`
221
221
  <div class="edit-actions">
222
222
  <button class="edit-actions__btn edit-actions__btn--primary" @click=${this.savePref}>
223
223
  Save
@@ -231,18 +231,18 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
231
231
  </button>
232
232
  </div>
233
233
  </div>
234
- `}renderNavItem(t,e=!1){if("section"===t.type)return B`
235
- <div class="nav-section">${t.label}</div>
236
- `;if("group"===t.type){const e=this.getNavItemChildren(t.id);return B`
234
+ `}renderNavItem(e,t=!1){if("section"===e.type)return X`
235
+ <div class="nav-section">${e.label}</div>
236
+ `;if("group"===e.type){const t=this.getNavItemChildren(e.id);return X`
237
237
  <button
238
- class=${wt({"nav-item":!0,"nav-item--expanded":this.navItemsExpanded.has(t.id),"nav-item--hidden":this.isEditing&&!1===t.active,"nav-item--drop-above":this.navItemDropTargetId===t.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===t.id&&"below"===this.navItemDropPosition,"nav-item--drop-center":this.navItemDropTargetId===t.id&&"center"===this.navItemDropPosition})}
239
- data-id="${t.id}"
240
- @mousedown=${e=>this.handleNavItemMouseDown(e,t)}
241
- @click=${e=>this.handleNavItemClick(e,t)}
242
- @contextmenu=${e=>this.handleNavItemContextMenu(e,t)}
238
+ class=${_e({"nav-item":!0,"nav-item--expanded":this.navItemsExpanded.has(e.id),"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition,"nav-item--drop-center":this.navItemDropTargetId===e.id&&"center"===this.navItemDropPosition})}
239
+ data-id="${e.id}"
240
+ @mousedown=${t=>this.handleNavItemMouseDown(t,e)}
241
+ @click=${t=>this.handleNavItemClick(t,e)}
242
+ @contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
243
243
  >
244
- ${this.navIconsDisplayed?B`<span class="nav-item__icon">${yt(t.icon||this.defaultNavItemIcon)}</span>`:W}
245
- <span class="nav-item__label">${t.label}</span>
244
+ ${this.navIconsDisplayed?X`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:W}
245
+ <span class="nav-item__label">${e.label}</span>
246
246
  <svg
247
247
  class="nav-item__chevron"
248
248
  viewBox="0 0 24 24"
@@ -250,27 +250,31 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
250
250
  stroke="currentColor"
251
251
  stroke-width="2"
252
252
  >
253
- <path d="M6 9l6 6 6-6" stroke-linecap="round" stroke-linejoin="round" />
253
+ <path
254
+ d="M6 9l6 6 6-6"
255
+ stroke-linecap="round"
256
+ stroke-linejoin="round"
257
+ />
254
258
  </svg>
255
259
  </button>
256
- <div class=${wt({"nav-group":!0,"nav-group--expanded":this.navItemsExpanded.has(t.id)})}>
257
- ${e.map((t=>this.renderNavItem(t,!0)))}
260
+ <div class=${_e({"nav-group":!0,"nav-group--expanded":this.navItemsExpanded.has(e.id)})}>
261
+ ${t.map((e=>this.renderNavItem(e,!0)))}
258
262
  </div>
259
- `}return B`
263
+ `}return X`
260
264
  <a
261
- class=${wt({"nav-item":!0,"nav-item--active":this.activeNavItemId===t.id,"nav-item--hidden":this.isEditing&&!1===t.active,"nav-item--drop-above":this.navItemDropTargetId===t.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===t.id&&"below"===this.navItemDropPosition})}
262
- data-id="${t.id}"
263
- href=${this.resolveUrl(t)}
264
- target=${t.external?"_blank":W}
265
- @mousedown=${e=>this.handleNavItemMouseDown(e,t)}
266
- @click=${e=>this.handleNavItemClick(e,t)}
267
- @contextmenu=${e=>this.handleNavItemContextMenu(e,t)}
265
+ class=${_e({"nav-item":!0,"nav-item--active":this.activeNavItemId===e.id,"nav-item--hidden":this.isEditing&&!1===e.active,"nav-item--drop-above":this.navItemDropTargetId===e.id&&"above"===this.navItemDropPosition,"nav-item--drop-below":this.navItemDropTargetId===e.id&&"below"===this.navItemDropPosition})}
266
+ data-id="${e.id}"
267
+ href=${this.resolveUrl(e)}
268
+ target=${e.external?"_blank":W}
269
+ @mousedown=${t=>this.handleNavItemMouseDown(t,e)}
270
+ @click=${t=>this.handleNavItemClick(t,e)}
271
+ @contextmenu=${t=>this.handleNavItemContextMenu(t,e)}
268
272
  >
269
- ${this.navIconsDisplayed&&!e?B`<span class="nav-item__icon">${yt(t.icon||this.defaultNavItemIcon)}</span>`:W}
270
- <span class="nav-item__label">${t.label}</span>
273
+ ${this.navIconsDisplayed&&!t?X`<span class="nav-item__icon">${ye(e.icon||this.defaultNavItemIcon)}</span>`:W}
274
+ <span class="nav-item__label">${e.label}</span>
271
275
  </a>
272
- `}render(){const t=this.getNavItemChildren(null),e=this.getComputedNav().filter((t=>null===t.parentId)).length;return B`
273
- <div class=${wt({progress:!0,"progress--loading":this.pendingRequests>0})}>
276
+ `}render(){const e=this.getNavItemChildren(null),t=this.getComputedNav().filter((e=>null===e.parentId)).length;return X`
277
+ <div class=${_e({progress:!0,"progress--loading":this.pendingRequests>0})}>
274
278
  <div class="progress__track"></div>
275
279
  <div class="progress__bar progress__bar--primary">
276
280
  <span class="progress__bar-inner"></span>
@@ -280,24 +284,36 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
280
284
  </div>
281
285
  </div>
282
286
 
283
- ${this.subbar?B`
284
- <kr-subbar menu .breadcrumbs=${this.breadcrumbs} @menu-click=${this.handleMenuClick}>
287
+ ${this.subbar?X`
288
+ <kr-subbar
289
+ menu
290
+ .breadcrumbs=${this.breadcrumbs}
291
+ @menu-click=${this.handleMenuClick}
292
+ >
285
293
  <slot name="subbar"></slot>
286
294
  </kr-subbar>
287
295
  `:W}
288
296
 
289
297
  <div class="wrapper">
290
- ${this.navEnabled?B`
291
- <nav class=${wt({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
298
+ ${this.navEnabled?X`
299
+ <nav class=${_e({nav:!0,"nav--scrolled":this.isNavScrolled,"nav--opened":!this.subbar||this.isNavOpened})}>
292
300
  <div class="nav-header" @click=${this.handleNavHeaderClick}>
293
- ${this.label?B`<span class="nav-title">${this.label}</span>`:this.logo?B`<img class="nav-logo" src=${this.logo} alt="Logo" />`:W}
301
+ ${this.label?X`<span class="nav-title">${this.label}</span>`:this.logo?X`<img
302
+ class="nav-logo"
303
+ src=${this.logo}
304
+ alt="Logo"
305
+ />`:W}
294
306
  </div>
295
307
  <div class="nav-content" @scroll=${this.handleNavScroll}>
296
- ${e>20?B`
308
+ ${t>20?X`
297
309
  <div class="nav-search">
298
310
  <div class="nav-search__wrapper">
299
311
  <span class="nav-search__icon">
300
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
312
+ <svg
313
+ xmlns="http://www.w3.org/2000/svg"
314
+ viewBox="0 0 24 24"
315
+ fill="currentColor"
316
+ >
301
317
  <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>
302
318
  </svg>
303
319
  </span>
@@ -308,9 +324,13 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
308
324
  .value=${this.navQuery}
309
325
  @input=${this.handleNavQueryChange}
310
326
  />
311
- ${this.navQuery?B`
327
+ ${this.navQuery?X`
312
328
  <button class="nav-search__clear" @click=${this.handleNavQueryClear}>
313
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
329
+ <svg
330
+ xmlns="http://www.w3.org/2000/svg"
331
+ viewBox="0 0 24 24"
332
+ fill="currentColor"
333
+ >
314
334
  <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
315
335
  </svg>
316
336
  </button>
@@ -319,7 +339,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
319
339
  </div>
320
340
  `:W}
321
341
  <div class="nav-items">
322
- ${t.map((t=>this.renderNavItem(t)))}
342
+ ${e.map((e=>this.renderNavItem(e)))}
323
343
  </div>
324
344
  </div>
325
345
  <!-- <div class="nav-footer">
@@ -333,7 +353,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
333
353
  </main>
334
354
  </div>
335
355
 
336
- `}};It.styles=l`
356
+ `}};Ie.styles=l`
337
357
  :host {
338
358
  display: flex;
339
359
  flex-direction: column;
@@ -499,7 +519,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
499
519
  .nav-content {
500
520
  flex: 1;
501
521
  overflow-y: auto;
502
- padding: 0 9px 0.75rem 8px;
522
+ padding: 0 9px 12px 8px;
503
523
  }
504
524
 
505
525
  .nav-footer {
@@ -619,7 +639,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
619
639
 
620
640
  .breadcrumbs {
621
641
  height: 32px;
622
- padding: 0 1rem;
642
+ padding: 0 16px;
623
643
  display: flex;
624
644
  align-items: center;
625
645
  gap: 6px;
@@ -713,7 +733,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
713
733
  white-space: nowrap;
714
734
  overflow: hidden;
715
735
  text-overflow: ellipsis;
716
- letter-spacing: 0.01em;
736
+ letter-spacing: 0.14px;
717
737
  }
718
738
 
719
739
  .nav-item__chevron {
@@ -768,7 +788,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
768
788
  font-size: 11px;
769
789
  font-weight: 600;
770
790
  text-transform: uppercase;
771
- letter-spacing: 0.05em;
791
+ letter-spacing: 0.55px;
772
792
  color: var(--kr-scaffold-nav-text);
773
793
  opacity: 0.6;
774
794
  }
@@ -891,7 +911,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
891
911
 
892
912
  .breadcrumbs {
893
913
  height: 32px;
894
- padding: 0 1rem;
914
+ padding: 0 16px;
895
915
  display: flex;
896
916
  align-items: center;
897
917
  gap: 6px;
@@ -1058,25 +1078,25 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1058
1078
  transform: scaleX(0.08);
1059
1079
  }
1060
1080
  }
1061
- `,Et([gt()],It.prototype,"navItemsExpanded",void 0),Et([gt()],It.prototype,"navQuery",void 0),Et([gt()],It.prototype,"activeNavItemId",void 0),Et([gt()],It.prototype,"isNavScrolled",void 0),Et([gt()],It.prototype,"isNavOpened",void 0),Et([gt()],It.prototype,"isEditing",void 0),Et([gt()],It.prototype,"isUserMenuOpen",void 0),Et([gt()],It.prototype,"pref",void 0),Et([gt()],It.prototype,"draggedNavItemId",void 0),Et([gt()],It.prototype,"navItemDropTargetId",void 0),Et([gt()],It.prototype,"navItemDropPosition",void 0),Et([gt()],It.prototype,"pendingRequests",void 0),Et([ut({type:String})],It.prototype,"logo",void 0),Et([ut({type:String})],It.prototype,"label",void 0),Et([ut({type:String,attribute:"home-url"})],It.prototype,"homeUrl",void 0),Et([ut({type:String,reflect:!0})],It.prototype,"scheme",void 0),Et([ut({type:Array})],It.prototype,"nav",void 0),Et([ut({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],It.prototype,"navIconsDisplayed",void 0),Et([ut({type:Boolean,attribute:"nav-expanded"})],It.prototype,"navExpanded",void 0),Et([ut({type:Object})],It.prototype,"user",void 0),Et([ut({type:Boolean})],It.prototype,"subbar",void 0),Et([ut({type:Boolean,attribute:"nav-enabled"})],It.prototype,"navEnabled",void 0),Et([ut({type:String,attribute:"user-type"})],It.prototype,"userType",void 0),Et([ut({type:Array})],It.prototype,"breadcrumbs",void 0),It=Et([ct("kr-scaffold")],It);var St=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let At=class extends lt{constructor(){super(...arguments),this.label="",this.subLabel="",this.navItems=[],this.activeId="",this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(t,e){const i=new CustomEvent("nav-item-click",{detail:{item:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&t.preventDefault(),this.activeId=e.id}syncActiveFromUrl(){const t=window.location.pathname,e=this.navItems.find((e=>!!e.url&&(e.url.startsWith("/")?t===e.url:t.endsWith("/"+e.url))));e&&(this.activeId=e.id)}render(){return B`
1081
+ `,Ee([ue({type:String})],Ie.prototype,"logo",void 0),Ee([ue({type:String})],Ie.prototype,"label",void 0),Ee([ue({type:String,attribute:"home-url"})],Ie.prototype,"homeUrl",void 0),Ee([ue({type:String,reflect:!0})],Ie.prototype,"scheme",void 0),Ee([ue({type:Array})],Ie.prototype,"nav",void 0),Ee([ue({type:Boolean,attribute:"nav-icons-displayed",reflect:!0})],Ie.prototype,"navIconsDisplayed",void 0),Ee([ue({type:Boolean,attribute:"nav-expanded"})],Ie.prototype,"navExpanded",void 0),Ee([ue({type:Object})],Ie.prototype,"user",void 0),Ee([ue({type:Boolean})],Ie.prototype,"subbar",void 0),Ee([ue({type:Boolean,attribute:"nav-enabled"})],Ie.prototype,"navEnabled",void 0),Ee([ue({type:String,attribute:"user-type"})],Ie.prototype,"userType",void 0),Ee([ue({type:Array})],Ie.prototype,"breadcrumbs",void 0),Ee([ge()],Ie.prototype,"navItemsExpanded",void 0),Ee([ge()],Ie.prototype,"navQuery",void 0),Ee([ge()],Ie.prototype,"activeNavItemId",void 0),Ee([ge()],Ie.prototype,"isNavScrolled",void 0),Ee([ge()],Ie.prototype,"isNavOpened",void 0),Ee([ge()],Ie.prototype,"isEditing",void 0),Ee([ge()],Ie.prototype,"isUserMenuOpen",void 0),Ee([ge()],Ie.prototype,"pref",void 0),Ee([ge()],Ie.prototype,"draggedNavItemId",void 0),Ee([ge()],Ie.prototype,"navItemDropTargetId",void 0),Ee([ge()],Ie.prototype,"navItemDropPosition",void 0),Ee([ge()],Ie.prototype,"pendingRequests",void 0),Ie=Ee([he("kr-scaffold")],Ie);var Se=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};let ze=class extends le{constructor(){super(...arguments),this.label="",this.subLabel="",this.items=[],this.activeId="",this.handlePopstate=()=>{this.syncActiveFromUrl()}}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>this.syncActiveFromUrl())),window.addEventListener("popstate",this.handlePopstate)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopstate)}handleNavItemClick(e,t){const s=new CustomEvent("nav-item-click",{detail:{item:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&e.preventDefault(),this.activeId=t.id}syncActiveFromUrl(){const e=window.location.pathname,t=this.items.find((t=>!!t.url&&(t.url.startsWith("/")?e===t.url:e.endsWith("/"+t.url))));t&&(this.activeId=t.id)}render(){return X`
1062
1082
  <nav class="nav">
1063
- ${this.label?B`
1083
+ ${this.label?X`
1064
1084
  <div class="nav-header">
1065
1085
  <div class="nav-header__text">
1066
- ${this.subLabel?B`<div class="nav-header__subtitle">${this.subLabel}</div>`:W}
1086
+ ${this.subLabel?X`<div class="nav-header__subtitle">${this.subLabel}</div>`:W}
1067
1087
  <div class="nav-header__title">${this.label}</div>
1068
1088
  </div>
1069
1089
  </div>
1070
1090
  `:W}
1071
1091
  <div class="nav-content">
1072
1092
  <div class="nav-items">
1073
- ${this.navItems.map((t=>B`
1093
+ ${this.items.map((e=>X`
1074
1094
  <a
1075
- class="nav-item ${t.id===this.activeId?"nav-item--active":""}"
1076
- href=${t.url||"#"}
1077
- @click=${e=>this.handleNavItemClick(e,t)}
1095
+ class=${_e({"nav-item":!0,"nav-item--active":e.id===this.activeId})}
1096
+ href=${e.url||"#"}
1097
+ @click=${t=>this.handleNavItemClick(t,e)}
1078
1098
  >
1079
- ${t.label}
1099
+ ${e.label}
1080
1100
  </a>
1081
1101
  `))}
1082
1102
  </div>
@@ -1087,7 +1107,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1087
1107
  <slot></slot>
1088
1108
  </div>
1089
1109
  </main>
1090
- `}};At.styles=l`
1110
+ `}};ze.styles=l`
1091
1111
  :host {
1092
1112
  display: flex;
1093
1113
  height: 100%;
@@ -1132,7 +1152,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1132
1152
  .nav-content {
1133
1153
  flex: 1;
1134
1154
  overflow-y: auto;
1135
- padding: 0 0 0.75rem;
1155
+ padding: 0 0 12px;
1136
1156
  }
1137
1157
 
1138
1158
  .nav-items {
@@ -1146,7 +1166,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1146
1166
  padding: 0 12px;
1147
1167
  height: 32px;
1148
1168
  line-height: 32px;
1149
- letter-spacing: 0.01em;
1169
+ letter-spacing: 0.13px;
1150
1170
  color: rgb(32, 33, 36);
1151
1171
  text-decoration: none;
1152
1172
  font-size: 13px;
@@ -1178,7 +1198,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1178
1198
  flex: 1;
1179
1199
  overflow-y: auto;
1180
1200
  }
1181
- `,St([ut({type:String})],At.prototype,"label",void 0),St([ut({type:String})],At.prototype,"subLabel",void 0),St([ut({type:Array})],At.prototype,"navItems",void 0),St([ut({type:String})],At.prototype,"activeId",void 0),At=St([ct("kr-screen-nav")],At);var Ct=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let Nt=class extends lt{constructor(){super(...arguments),this.title=""}render(){return B`
1201
+ `,Se([ue({type:String})],ze.prototype,"label",void 0),Se([ue({type:String})],ze.prototype,"subLabel",void 0),Se([ue({type:Array})],ze.prototype,"items",void 0),Se([ue({type:String})],ze.prototype,"activeId",void 0),ze=Se([he("kr-screen-nav")],ze);var Ae=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};let Ce=class extends le{constructor(){super(...arguments),this.title=""}render(){return X`
1182
1202
  <div class="header">
1183
1203
  <h2 class="header__title">${this.title}</h2>
1184
1204
  <div class="header__actions">
@@ -1190,7 +1210,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1190
1210
  <slot></slot>
1191
1211
  </div>
1192
1212
  </div>
1193
- `}};Nt.styles=l`
1213
+ `}};Ce.styles=l`
1194
1214
  :host {
1195
1215
  display: flex;
1196
1216
  flex-direction: column;
@@ -1203,7 +1223,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1203
1223
  display: flex;
1204
1224
  align-items: center;
1205
1225
  justify-content: space-between;
1206
- padding: 0 1.5rem;
1226
+ padding: 0 24px;
1207
1227
  background: #ffffff;
1208
1228
  border-bottom: 1px solid #e5e7eb;
1209
1229
  flex-shrink: 0;
@@ -1225,7 +1245,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1225
1245
  .content {
1226
1246
  flex: 1;
1227
1247
  overflow-y: auto;
1228
- padding: 1.5rem;
1248
+ padding: 24px;
1229
1249
  display: flex;
1230
1250
  justify-content: center;
1231
1251
  }
@@ -1234,31 +1254,52 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1234
1254
  width: 100%;
1235
1255
  max-width: 700px;
1236
1256
  }
1237
- `,Ct([ut({type:String})],Nt.prototype,"title",void 0),Nt=Ct([ct("kr-screen-detail")],Nt);var zt=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let Dt=class extends lt{constructor(){super(...arguments),this.breadcrumbs=[],this.menu=!1}_handleMenuClick(){this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0}))}resolveUrl(t){if(!t.url)return"#";const e=t.url.startsWith("/")?t.url.slice(1):t.url,i=document.querySelector("base")?.getAttribute("href")||"/";return(i.endsWith("/")?i:i+"/")+e}_handleBreadcrumbClick(t,e,i){if(i||!e.url)return void t.preventDefault();if(t.ctrlKey||t.metaKey||1===t.button)return;const s=new CustomEvent("breadcrumb-click",{detail:{breadcrumb:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(s),s.defaultPrevented&&t.preventDefault()}render(){return B`
1238
- ${this.menu?B`
1257
+ `,Ae([ue({type:String})],Ce.prototype,"title",void 0),Ce=Ae([he("kr-screen-detail")],Ce);var Te=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};let Re=class extends le{constructor(){super(...arguments),this.breadcrumbs=[],this.menu=!1}_handleMenuClick(){this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0}))}resolveUrl(e){if(!e.url)return"#";let t=e.url;e.url.startsWith("/")&&(t=e.url.slice(1));const s=document.querySelector("base")?.getAttribute("href")||"/";return s.endsWith("/")?s+t:s+"/"+t}_handleBreadcrumbClick(e,t,s){if(s||!t.url)return void e.preventDefault();if(e.ctrlKey||e.metaKey||1===e.button)return;const i=new CustomEvent("breadcrumb-click",{detail:{breadcrumb:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(i),i.defaultPrevented&&e.preventDefault()}render(){return X`
1258
+ ${this.menu?X`
1239
1259
  <div class="menu" @click=${this._handleMenuClick}>
1240
- <svg class="menu__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1241
- <line x1="3" y1="6" x2="21" y2="6"></line>
1242
- <line x1="3" y1="12" x2="21" y2="12"></line>
1243
- <line x1="3" y1="18" x2="21" y2="18"></line>
1260
+ <svg
1261
+ class="menu__icon"
1262
+ viewBox="0 0 24 24"
1263
+ fill="none"
1264
+ stroke="currentColor"
1265
+ stroke-width="2"
1266
+ >
1267
+ <line
1268
+ x1="3"
1269
+ y1="6"
1270
+ x2="21"
1271
+ y2="6"
1272
+ ></line>
1273
+ <line
1274
+ x1="3"
1275
+ y1="12"
1276
+ x2="21"
1277
+ y2="12"
1278
+ ></line>
1279
+ <line
1280
+ x1="3"
1281
+ y1="18"
1282
+ x2="21"
1283
+ y2="18"
1284
+ ></line>
1244
1285
  </svg>
1245
1286
  </div>
1246
1287
  `:W}
1247
1288
  <div class="breadcrumbs">
1248
- ${this.breadcrumbs.map(((t,e)=>{const i=e===this.breadcrumbs.length-1;return B`
1249
- ${e>0?B`<span class="breadcrumb-separator">/</span>`:""}
1289
+ ${this.breadcrumbs.map(((e,t)=>{const s=t===this.breadcrumbs.length-1;return X`
1290
+ ${t>0?X`<span class="breadcrumb-separator">/</span>`:""}
1250
1291
  <a
1251
- class=${wt({breadcrumb:!0,"breadcrumb--current":i})}
1252
- href=${this.resolveUrl(t)}
1253
- @click=${e=>this._handleBreadcrumbClick(e,t,i)}
1254
- >${t.label}</a>
1292
+ class=${_e({breadcrumb:!0,"breadcrumb--current":s})}
1293
+ href=${this.resolveUrl(e)}
1294
+ @click=${t=>this._handleBreadcrumbClick(t,e,s)}
1295
+ >${e.label}</a>
1255
1296
  `}))}
1256
1297
  </div>
1257
1298
  <div class="content">
1258
1299
  <slot></slot>
1259
1300
  </div>
1260
1301
 
1261
- `}};Dt.styles=l`
1302
+ `}};Re.styles=l`
1262
1303
  :host {
1263
1304
  display: flex;
1264
1305
  flex-direction: row;
@@ -1324,130 +1365,226 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1324
1365
  width: 18px;
1325
1366
  height: 18px;
1326
1367
  }
1327
- `,zt([ut({type:Array})],Dt.prototype,"breadcrumbs",void 0),zt([ut({type:Boolean})],Dt.prototype,"menu",void 0),Dt=zt([ct("kr-subbar")],Dt);var Mt=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class Tt{static configure(t){Tt.base=t.base,Tt.routes=t.routes,window.addEventListener("click",(t=>{const e=t.composedPath().find((t=>t instanceof HTMLAnchorElement));e&&e.origin===window.location.origin&&e.pathname.startsWith(Tt.base)&&(t.preventDefault(),Tt.navigate(e.pathname))}))}static navigate(t){let e=t;t.startsWith("/")||(e=Tt.base+"/"+t),window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const t=Tt.matchAll(),e={};for(const i of t)for(const t in i.params)e[t]=decodeURIComponent(i.params[t]);return e}static outlet(t){const e=Tt.matchAll();if(t>=e.length)return null;const i=e[t].route.component,s=Tt.elementCache.get(t+":"+i);if(s)return s;for(const e of Tt.elementCache.keys())e.startsWith(t+":")&&Tt.elementCache.delete(e);const a=document.createElement(i);return Tt.elementCache.set(t+":"+i,a),a}static matchAll(){const t=window.location.pathname;let e=t;t.startsWith(Tt.base)&&(e=t.slice(Tt.base.length));const i=e.split("/").filter((t=>t));return Tt.matchRoutes(Tt.routes,i)}static matchRoutes(t,e){for(const i of t){const t=i.path.split("/").filter((t=>t));if(0===t.length&&0===e.length)return[{route:i,params:{}}];if(0===t.length)continue;if(e.length<t.length)continue;const s={};let a=!0;for(let i=0;i<t.length;i++)if(t[i].startsWith(":"))s[t[i].slice(1)]=e[i];else if(t[i]!==e[i]){a=!1;break}if(!a)continue;const r=e.slice(t.length);if(r.length>0&&!i.children)continue;const n=[{route:i,params:s}];if(i.children&&r.length>0){const t=Tt.matchRoutes(i.children,r);if(t.length>0)return n.push(...t),n}if(i.children&&0===r.length&&i.default){window.history.replaceState({},"",window.location.pathname+"/"+i.default);const t=Tt.matchRoutes(i.children,[i.default]);if(t.length>0)return n.push(...t),n}return n}return[]}}Tt.base="",Tt.routes=[],Tt.elementCache=new Map;let Pt=class extends lt{constructor(){super(...arguments),this.level=-1,this.handlePopState=()=>{this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.level=this.detectLevel(),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState)}detectLevel(){let t=0,e=this;for(;e;)e instanceof ShadowRoot?e=e.host:(e instanceof HTMLElement&&"KR-ROUTER-OUTLET"===e.tagName&&e!==this&&t++,e=e instanceof HTMLElement?e.parentNode:null);return t}render(){const t=Tt.outlet(this.level);return t?B`${t}`:B``}};Pt.styles=l`
1368
+ `,Te([ue({type:Array})],Re.prototype,"breadcrumbs",void 0),Te([ue({type:Boolean})],Re.prototype,"menu",void 0),Re=Te([he("kr-subbar")],Re);var Ne=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};class De{static configure(e){De.base=e.base,De.routes=e.routes,window.addEventListener("click",(e=>{const t=e.composedPath().find((e=>e instanceof HTMLAnchorElement));t&&t.origin===window.location.origin&&t.pathname.startsWith(De.base)&&(e.preventDefault(),De.navigate(t.pathname))}))}static navigate(e){let t=e;e.startsWith("/")||(t=De.base+"/"+e),window.history.pushState({},"",t),window.dispatchEvent(new PopStateEvent("popstate"))}static getParams(){const e=De.matchAll(),t={};for(const s of e)for(const e in s.params)t[e]=decodeURIComponent(s.params[e]);return t}static outlet(e){const t=De.matchAll();if(e>=t.length)return null;const s=t[e].route.component,i=De.elementCache.get(e+":"+s);if(i)return i;for(const t of De.elementCache.keys())t.startsWith(e+":")&&De.elementCache.delete(t);const n=document.createElement(s);return De.elementCache.set(e+":"+s,n),n}static matchAll(){const e=window.location.pathname;let t=e;e.startsWith(De.base)&&(t=e.slice(De.base.length));const s=t.split("/").filter((e=>e));return De.matchRoutes(De.routes,s)}static matchRoutes(e,t){for(const s of e){const e=s.path.split("/").filter((e=>e));if(0===e.length&&0===t.length)return[{route:s,params:{}}];if(0===e.length)continue;if(t.length<e.length)continue;const i={};let n=!0;for(let s=0;s<e.length;s++)if(e[s].startsWith(":"))i[e[s].slice(1)]=t[s];else if(e[s]!==t[s]){n=!1;break}if(!n)continue;const r=t.slice(e.length);if(r.length>0&&!s.children)continue;const a=[{route:s,params:i}];if(s.children&&r.length>0){const e=De.matchRoutes(s.children,r);if(e.length>0)return a.push(...e),a}if(s.children&&0===r.length&&s.default){window.history.replaceState({},"",window.location.pathname+"/"+s.default);const e=De.matchRoutes(s.children,[s.default]);if(e.length>0)return a.push(...e),a}return a}return[]}}De.base="",De.routes=[],De.elementCache=new Map;let Me=class extends le{constructor(){super(...arguments),this.level=-1,this.handlePopState=()=>{this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.level=this.detectLevel(),window.addEventListener("popstate",this.handlePopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this.handlePopState)}detectLevel(){let e=0,t=this;for(;t;)t instanceof ShadowRoot?t=t.host:(t instanceof HTMLElement&&"KR-ROUTER-OUTLET"===t.tagName&&t!==this&&e++,t=t instanceof HTMLElement?t.parentNode:null);return e}render(){const e=De.outlet(this.level);return e?X`${e}`:X``}};function Pe(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}Me.styles=l`
1328
1369
  :host {
1329
1370
  display: block;
1330
1371
  height: 100%;
1331
1372
  }
1332
- `,Pt=Mt([ct("kr-router-outlet")],Pt);var Rt=function(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};let Ut=class extends lt{constructor(){super(...arguments),this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._userHasScrolledUp=!1,this._isDragging=!1,this._isResizing=!1,this._resizeDir="",this._dragStartX=0,this._dragStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._resizeStartW=0,this._resizeStartH=0,this.send=null,this.clear=null,this.messages=[],this.title="AI Assistant",this.subtitle="",this.placeholder="Type a message...",this.opened=!1,this._inputValue="",this._isStreaming=!1,this._statusText="",this._error="",this._handleMouseMove=t=>{if(this._isDragging){let e=this._dragStartLeft+(t.clientX-this._dragStartX),i=this._dragStartTop+(t.clientY-this._dragStartY);const s=this._panelEl.offsetWidth,a=this._panelEl.offsetHeight;e=Math.max(48-s,Math.min(e,window.innerWidth-48)),i=Math.max(48-a,Math.min(i,window.innerHeight-48)),this._panelEl.style.left=e+"px",this._panelEl.style.top=i+"px"}else if(this._isResizing){const e=t.clientX-this._dragStartX,i=t.clientY-this._dragStartY,s=340,a=380,r=.9*window.innerWidth,n=window.innerHeight-72;let o=this._resizeStartW,l=this._resizeStartH,d=this._dragStartLeft,c=this._dragStartTop;if(this._resizeDir.includes("e")&&(o=Math.max(s,Math.min(this._resizeStartW+e,r))),this._resizeDir.includes("w")){const t=this._resizeStartW-e;t>=s&&t<=r&&(o=t,d=this._dragStartLeft+e)}if(this._resizeDir.includes("s")&&(l=Math.max(a,Math.min(this._resizeStartH+i,n))),this._resizeDir.includes("n")){const t=this._resizeStartH-i;t>=a&&t<=n&&(l=t,c=this._dragStartTop+i)}d=Math.max(0,d),c=Math.max(0,c),this._panelEl.style.width=o+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=d+"px",this._panelEl.style.top=c+"px"}},this._handleMouseUp=()=>{this._isDragging&&(this._isDragging=!1,this._panelEl.classList.remove("chatbot__panel--dragging")),this._isResizing&&(this._isResizing=!1,this._panelEl.classList.remove("chatbot__panel--resizing")),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp)}}disconnectedCallback(){super.disconnectedCallback(),this._reader&&(this._reader.cancel(),this._reader=null),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp)}updated(t){(t.has("messages")||t.has("_statusText"))&&!this._userHasScrolledUp&&this._messagesEl&&requestAnimationFrame((()=>{this._messagesEl&&(this._messagesEl.scrollTop=this._messagesEl.scrollHeight)})),t.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200)}stop(){this._handleStop()}_handleHeaderMouseDown(t){if(t.target.closest("button"))return;if(!this._panelEl)return;this._isDragging=!0,this._panelEl.classList.add("chatbot__panel--dragging");const e=this._panelEl.getBoundingClientRect();this._panelEl.style.left=e.left+"px",this._panelEl.style.top=e.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=t.clientX,this._dragStartY=t.clientY,this._dragStartLeft=e.left,this._dragStartTop=e.top,t.preventDefault(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleResizeMouseDown(t){if(!this._panelEl)return;this._isResizing=!0,this._resizeDir=t.currentTarget.dataset.dir||"",this._panelEl.classList.add("chatbot__panel--resizing");const e=this._panelEl.getBoundingClientRect();this._panelEl.style.left=e.left+"px",this._panelEl.style.top=e.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=t.clientX,this._dragStartY=t.clientY,this._dragStartLeft=e.left,this._dragStartTop=e.top,this._resizeStartW=e.width,this._resizeStartH=e.height,t.preventDefault(),t.stopPropagation(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleToggle(){this.opened=!this.opened,this.opened&&this._panelEl&&(this._panelEl.style.left="",this._panelEl.style.top="",this._panelEl.style.right="",this._panelEl.style.bottom="",this._panelEl.style.width="",this._panelEl.style.height="",this._panelEl.style.position="")}_handleInputChange(t){this._inputValue=t.target.value;const e=t.target;e.style.height="auto",e.style.height=Math.min(e.scrollHeight,120)+"px"}_handleKeyDown(t){"Enter"!==t.key||t.shiftKey||(t.preventDefault(),this._handleSubmit())}_handleSubmit(){if(!this._inputValue.trim()||!this.send||this._isStreaming)return;const t=this._inputValue.trim(),e=new CustomEvent("message-submit",{detail:{message:t},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||(this.messages=[...this.messages,{role:"user",content:t}],this._inputValue="",this._error="",this._userHasScrolledUp=!1,this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{role:"assistant",content:""}],this._isStreaming=!0,this._statusText="",this.send({message:t,messages:this.messages.slice(0,-1)}).then((t=>{t.ok?t.body?(this._reader=t.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this._readStreamChunk()):this._handleStreamError("No response body"):this._handleStreamError("Request failed: "+t.status)})).catch((t=>{"AbortError"!==t.name&&this._handleStreamError(t.message)})))}_handleStop(){this._reader&&(this._reader.cancel(),this._reader=null),this._isStreaming=!1,this._statusText=""}_handleClear(){this.clear&&this.clear().then((()=>{this._reader&&(this._reader.cancel(),this._reader=null),this.messages=[],this._isStreaming=!1,this._statusText="",this._error="",this._inputValue="",this._userHasScrolledUp=!1}))}_handleMessagesScroll(t){const e=t.target,i=e.scrollHeight-e.scrollTop-e.clientHeight;this._userHasScrolledUp=i>50}_handleErrorDismiss(){this._error=""}_readStreamChunk(){this._reader&&this._reader.read().then((t=>{if(t.done)return this._isStreaming=!1,this._statusText="",void(this._reader=null);this._buffer=this._buffer+this._decoder.decode(t.value,{stream:!0});const e=this._buffer.split("\n\n");this._buffer=e.pop()||"";for(let t=0;t<e.length;t++){if(!e[t].trim())continue;const i=e[t].split("\n");for(let t=0;t<i.length;t++){if(!i[t].startsWith("data:"))continue;const e=i[t].slice(5).trim();if(!e)continue;let s;try{s=JSON.parse(e)}catch{continue}if(this.dispatchEvent(new CustomEvent("stream-event",{detail:s,bubbles:!0,composed:!0})),"STATUS"===s.type)s.message&&(this._statusText=String(s.message));else if("REASONING_PART"===s.type){if(s.message){const t=this.messages.length-1;t>=0&&"assistant"===this.messages[t].role&&(this.messages[t].reasoning||(this.messages[t].reasoning=""),this.messages[t].reasoning+=String(s.message),this.requestUpdate())}}else if("RESPONSE_PART"===s.type){if(s.message){this._statusText="";const t=this.messages.length-1;t>=0&&"assistant"===this.messages[t].role&&(this.messages[t].content+=String(s.message),this.requestUpdate())}}else if("ACTION"===s.type){const t=s,e=new CustomEvent("action",{detail:{action:t},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(e),!e.defaultPrevented)if("RELOAD"===t.action)location.reload();else if("NAVIGATE"===t.action)t.data&&t.data.url&&(window.location.href=t.data.url);else if("OPEN_TAB"===t.action)t.data&&t.data.url&&window.open(t.data.url,"_blank");else if("UPDATE_HTML"===t.action){if(t.data&&t.data.selector&&t.data.html){const e=document.querySelector(t.data.selector);e&&(e.innerHTML=t.data.html)}}else if("SCROLL_TO"===t.action&&t.data&&t.data.selector){const e=document.querySelector(t.data.selector);e&&e.scrollIntoView({behavior:"smooth"})}}else"ERROR"===s.type&&this._handleStreamError(String(s.message||"Unknown error"));s.finished&&(this._isStreaming=!1,this._statusText="",this._reader=null)}}this._readStreamChunk()})).catch((t=>{"AbortError"!==t.name&&this._handleStreamError(t.message)}))}_handleStreamError(t){if(this._isStreaming=!1,this._statusText="",this._error=t,this._reader&&(this._reader.cancel(),this._reader=null),this.messages.length>0){const t=this.messages[this.messages.length-1];"assistant"!==t.role||t.content||(this.messages=this.messages.slice(0,-1))}}_formatAssistantContent(t){let e=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e=e.replace(/```(\w*)\n?([\s\S]*?)```/g,"<pre><code>$2</code></pre>"),e=e.replace(/`([^`]+)`/g,"<code>$1</code>"),e=e.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>");const i=e.split(/(<pre><code>[\s\S]*?<\/code><\/pre>)/g);for(let t=0;t<i.length;t++)t%2==0&&(i[t]=i[t].replace(/\n\n/g,"</p><p>"),i[t]=i[t].replace(/\n/g,"<br>"));return e=i.join(""),e.includes("</p><p>")&&(e="<p>"+e+"</p>"),e}render(){return B`
1373
+ `,Me=Ne([he("kr-router-outlet")],Me);let Oe={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Ue(e){Oe=e}const Le=/[&<>"']/,He=new RegExp(Le.source,"g"),je=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,qe=new RegExp(je.source,"g"),Be={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xe=e=>Be[e];function Fe(e,t){if(t){if(Le.test(e))return e.replace(He,Xe)}else if(je.test(e))return e.replace(qe,Xe);return e}const We=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Qe(e){return e.replace(We,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Ye=/(^|[^\[])\^/g;function Ze(e,t){let s="string"==typeof e?e:e.source;t=t||"";const i={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(Ye,"$1"),s=s.replace(e,n),i},getRegex:()=>new RegExp(s,t)};return i}function Ve(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Ke={exec:()=>null};function Je(e,t){const s=e.replace(/\|/g,((e,t,s)=>{let i=!1,n=t;for(;--n>=0&&"\\"===s[n];)i=!i;return i?"|":" |"})).split(/ \|/);let i=0;if(s[0].trim()||s.shift(),s.length>0&&!s[s.length-1].trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;i<s.length;i++)s[i]=s[i].trim().replace(/\\\|/g,"|");return s}function Ge(e,t,s){const i=e.length;if(0===i)return"";let n=0;for(;n<i;){if(e.charAt(i-n-1)!==t)break;n++}return e.slice(0,i-n)}function et(e,t,s,i){const n=t.href,r=t.title?Fe(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){i.state.inLink=!0;const e={type:"link",raw:s,href:n,title:r,text:a,tokens:i.inlineTokens(a)};return i.state.inLink=!1,e}return{type:"image",raw:s,href:n,title:r,text:Fe(a)}}class tt{options;rules;lexer;constructor(e){this.options=e||Oe}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Ge(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],s=function(e,t){const s=e.match(/^(\s+)(?:```)/);if(null===s)return t;const i=s[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[s]=t;return s.length>=i.length?e.slice(i.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Ge(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=Ge(e.replace(/^ *>[ \t]?/gm,""),"\n");const s=this.lexer.state.top;this.lexer.state.top=!0;const i=this.lexer.blockTokens(e);return this.lexer.state.top=s,{type:"blockquote",raw:t[0],tokens:i,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let s=t[1].trim();const i=s.length>1,n={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");const r=new RegExp(`^( {0,3}${s})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a="",o="",l=!1;for(;e;){let s=!1;if(!(t=r.exec(e)))break;if(this.rules.block.hr.test(e))break;a=t[0],e=e.substring(a.length);let i=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,o=i.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,o=i.slice(h),h+=t[1].length);let d=!1;if(!i&&/^ *$/.test(c)&&(a+=c+"\n",e=e.substring(c.length+1),s=!0),!s){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),s=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),n=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const l=e.split("\n",1)[0];if(c=l,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),n.test(c))break;if(r.test(c))break;if(t.test(c))break;if(s.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())o+="\n"+c.slice(h);else{if(d)break;if(i.search(/[^ ]/)>=4)break;if(n.test(i))break;if(r.test(i))break;if(s.test(i))break;o+="\n"+c}d||c.trim()||(d=!0),a+=l+"\n",e=e.substring(l.length+1),i=c.slice(h)}}n.loose||(l?n.loose=!0:/\n *\n *$/.test(a)&&(l=!0));let p,u=null;this.options.gfm&&(u=/^\[[ xX]\] /.exec(o),u&&(p="[ ] "!==u[0],o=o.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:a,task:!!u,checked:p,loose:!1,text:o,tokens:[]}),n.raw+=a}n.items[n.items.length-1].raw=a.trimEnd(),n.items[n.items.length-1].text=o.trimEnd(),n.raw=n.raw.trimEnd();for(let e=0;e<n.items.length;e++)if(this.lexer.state.top=!1,n.items[e].tokens=this.lexer.blockTokens(n.items[e].text,[]),!n.loose){const t=n.items[e].tokens.filter((e=>"space"===e.type)),s=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));n.loose=s}if(n.loose)for(let e=0;e<n.items.length;e++)n.items[e].loose=!0;return n}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),s=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:s,title:i}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const s=Je(t[1]),i=t[2].replace(/^\||\| *$/g,"").split("|"),n=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(s.length===i.length){for(const e of i)/^ *-+: *$/.test(e)?r.align.push("right"):/^ *:-+: *$/.test(e)?r.align.push("center"):/^ *:-+ *$/.test(e)?r.align.push("left"):r.align.push(null);for(const e of s)r.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of n)r.rows.push(Je(e,r.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Fe(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Ge(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let s=0;for(let i=0;i<e.length;i++)if("\\"===e[i])i++;else if(e[i]===t[0])s++;else if(e[i]===t[1]&&(s--,s<0))return i;return-1}(t[2],"()");if(e>-1){const s=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,s).trim(),t[3]=""}}let s=t[2],i="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);e&&(s=e[1],i=e[3])}else i=t[3]?t[3].slice(1,-1):"";return s=s.trim(),/^</.test(s)&&(s=this.options.pedantic&&!/>$/.test(e)?s.slice(1):s.slice(1,-1)),et(t,{href:s?s.replace(this.rules.inline.anyPunctuation,"$1"):s,title:i?i.replace(this.rules.inline.anyPunctuation,"$1"):i},t[0],this.lexer)}}reflink(e,t){let s;if((s=this.rules.inline.reflink.exec(e))||(s=this.rules.inline.nolink.exec(e))){const e=t[(s[2]||s[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=s[0].charAt(0);return{type:"text",raw:e,text:e}}return et(s,e,s[0],this.lexer)}}emStrong(e,t,s=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!i)return;if(i[3]&&s.match(/[\p{L}\p{N}]/u))return;if(!(i[1]||i[2]||"")||!s||this.rules.inline.punctuation.exec(s)){const s=[...i[0]].length-1;let n,r,a=s,o=0;const l="*"===i[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+s);null!=(i=l.exec(t));){if(n=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!n)continue;if(r=[...n].length,i[3]||i[4]){a+=r;continue}if((i[5]||i[6])&&s%3&&!((s+r)%3)){o+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+o);const t=[...i[0]][0].length,l=e.slice(0,s+i.index+t+r);if(Math.min(s,r)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const s=/[^ ]/.test(e),i=/^ /.test(e)&&/ $/.test(e);return s&&i&&(e=e.substring(1,e.length-1)),e=Fe(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,s;return"@"===t[2]?(e=Fe(t[1]),s="mailto:"+e):(e=Fe(t[1]),s=e),{type:"link",raw:t[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,s;if("@"===t[2])e=Fe(t[0]),s="mailto:"+e;else{let i;do{i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(i!==t[0]);e=Fe(t[0]),s="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:Fe(t[0]),{type:"text",raw:t[0],text:e}}}}const st=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,it=/(?:[*+-]|\d{1,9}[.)])/,nt=Ze(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,it).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),rt=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,at=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ot=Ze(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",at).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lt=Ze(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,it).getRegex(),ct="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ht=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,dt=Ze("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",ht).replace("tag",ct).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pt=Ze(rt).replace("hr",st).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ct).getRegex(),ut={blockquote:Ze(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",pt).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:ot,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:st,html:dt,lheading:nt,list:lt,newline:/^(?: *(?:\n|$))+/,paragraph:pt,table:Ke,text:/^[^\n]+/},gt=Ze("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",st).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ct).getRegex(),ft={...ut,table:gt,paragraph:Ze(rt).replace("hr",st).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gt).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ct).getRegex()},mt={...ut,html:Ze("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",ht).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ke,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ze(rt).replace("hr",st).replace("heading"," *#{1,6} *[^\n]").replace("lheading",nt).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vt=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,bt=/^( {2,}|\\)\n(?!\s*$)/,xt="\\p{P}\\p{S}",kt=Ze(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,xt).getRegex(),yt=Ze(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,xt).getRegex(),_t=Ze("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,xt).getRegex(),wt=Ze("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,xt).getRegex(),$t=Ze(/\\([punct])/,"gu").replace(/punct/g,xt).getRegex(),Et=Ze(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),It=Ze(ht).replace("(?:--\x3e|$)","--\x3e").getRegex(),St=Ze("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",It).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,At=Ze(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",zt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ct=Ze(/^!?\[(label)\]\[(ref)\]/).replace("label",zt).replace("ref",at).getRegex(),Tt=Ze(/^!?\[(ref)\](?:\[\])?/).replace("ref",at).getRegex(),Rt={_backpedal:Ke,anyPunctuation:$t,autolink:Et,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:bt,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Ke,emStrongLDelim:yt,emStrongRDelimAst:_t,emStrongRDelimUnd:wt,escape:vt,link:At,nolink:Tt,punctuation:kt,reflink:Ct,reflinkSearch:Ze("reflink|nolink(?!\\()","g").replace("reflink",Ct).replace("nolink",Tt).getRegex(),tag:St,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Ke},Nt={...Rt,link:Ze(/^!?\[(label)\]\((.*?)\)/).replace("label",zt).getRegex(),reflink:Ze(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zt).getRegex()},Dt={...Rt,escape:Ze(vt).replace("])","~|])").getRegex(),url:Ze(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Mt={...Dt,br:Ze(bt).replace("{2,}","*").getRegex(),text:Ze(Dt.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Pt={normal:ut,gfm:ft,pedantic:mt},Ot={normal:Rt,gfm:Dt,breaks:Mt,pedantic:Nt};class Ut{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Oe,this.options.tokenizer=this.options.tokenizer||new tt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Pt.normal,inline:Ot.normal};this.options.pedantic?(t.block=Pt.pedantic,t.inline=Ot.pedantic):this.options.gfm&&(t.block=Pt.gfm,this.options.breaks?t.inline=Ot.breaks:t.inline=Ot.gfm),this.tokenizer.rules=t}static get rules(){return{block:Pt,inline:Ot}}static lex(e,t){return new Ut(t).lex(e)}static lexInline(e,t){return new Ut(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let s,i,n,r;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,s)=>t+" ".repeat(s.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((i=>!!(s=i.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0)))))if(s=this.tokenizer.space(e))e=e.substring(s.raw.length),1===s.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(s);else if(s=this.tokenizer.code(e))e=e.substring(s.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(s):(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(s=this.tokenizer.fences(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.heading(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.hr(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.blockquote(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.list(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.html(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.def(e))e=e.substring(s.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title}):(i.raw+="\n"+s.raw,i.text+="\n"+s.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(s=this.tokenizer.table(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.lheading(e))e=e.substring(s.raw.length),t.push(s);else{if(n=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const s=e.slice(1);let i;this.options.extensions.startBlock.forEach((e=>{i=e.call({lexer:this},s),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(this.state.top&&(s=this.tokenizer.paragraph(n)))i=t[t.length-1],r&&"paragraph"===i.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s),r=n.length!==e.length,e=e.substring(s.raw.length);else if(s=this.tokenizer.text(e))e=e.substring(s.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+s.raw,i.text+="\n"+s.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(s);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let s,i,n,r,a,o,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(r=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(r=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(r=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,r.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(o=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((i=>!!(s=i.call({lexer:this},e,t))&&(e=e.substring(s.raw.length),t.push(s),!0)))))if(s=this.tokenizer.escape(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.tag(e))e=e.substring(s.raw.length),i=t[t.length-1],i&&"text"===s.type&&"text"===i.type?(i.raw+=s.raw,i.text+=s.text):t.push(s);else if(s=this.tokenizer.link(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(s.raw.length),i=t[t.length-1],i&&"text"===s.type&&"text"===i.type?(i.raw+=s.raw,i.text+=s.text):t.push(s);else if(s=this.tokenizer.emStrong(e,l,o))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.codespan(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.br(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.del(e))e=e.substring(s.raw.length),t.push(s);else if(s=this.tokenizer.autolink(e))e=e.substring(s.raw.length),t.push(s);else if(this.state.inLink||!(s=this.tokenizer.url(e))){if(n=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const s=e.slice(1);let i;this.options.extensions.startInline.forEach((e=>{i=e.call({lexer:this},s),"number"==typeof i&&i>=0&&(t=Math.min(t,i))})),t<1/0&&t>=0&&(n=e.substring(0,t+1))}if(s=this.tokenizer.inlineText(n))e=e.substring(s.raw.length),"_"!==s.raw.slice(-1)&&(o=s.raw.slice(-1)),a=!0,i=t[t.length-1],i&&"text"===i.type?(i.raw+=s.raw,i.text+=s.text):t.push(s);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(s.raw.length),t.push(s);return t}}class Lt{options;constructor(e){this.options=e||Oe}code(e,t,s){const i=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",i?'<pre><code class="language-'+Fe(i)+'">'+(s?e:Fe(e,!0))+"</code></pre>\n":"<pre><code>"+(s?e:Fe(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,s){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,s){const i=t?"ol":"ul";return"<"+i+(t&&1!==s?' start="'+s+'"':"")+">\n"+e+"</"+i+">\n"}listitem(e,t,s){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const s=t.header?"th":"td";return(t.align?`<${s} align="${t.align}">`:`<${s}>`)+e+`</${s}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,s){const i=Ve(e);if(null===i)return s;let n='<a href="'+(e=i)+'"';return t&&(n+=' title="'+t+'"'),n+=">"+s+"</a>",n}image(e,t,s){const i=Ve(e);if(null===i)return s;let n=`<img src="${e=i}" alt="${s}"`;return t&&(n+=` title="${t}"`),n+=">",n}text(e){return e}}class Ht{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,s){return""+s}image(e,t,s){return""+s}br(){return""}}class jt{options;renderer;textRenderer;constructor(e){this.options=e||Oe,this.options.renderer=this.options.renderer||new Lt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ht}static parse(e,t){return new jt(t).parse(e)}static parseInline(e,t){return new jt(t).parseInline(e)}parse(e,t=!0){let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=n,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){s+=t||"";continue}}switch(n.type){case"space":continue;case"hr":s+=this.renderer.hr();continue;case"heading":{const e=n;s+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Qe(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=n;s+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=n;let t="",i="";for(let t=0;t<e.header.length;t++)i+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(i);let r="";for(let t=0;t<e.rows.length;t++){const s=e.rows[t];i="";for(let t=0;t<s.length;t++)i+=this.renderer.tablecell(this.parseInline(s[t].tokens),{header:!1,align:e.align[t]});r+=this.renderer.tablerow(i)}s+=this.renderer.table(t,r);continue}case"blockquote":{const e=n,t=this.parse(e.tokens);s+=this.renderer.blockquote(t);continue}case"list":{const e=n,t=e.ordered,i=e.start,r=e.loose;let a="";for(let t=0;t<e.items.length;t++){const s=e.items[t],i=s.checked,n=s.task;let o="";if(s.task){const e=this.renderer.checkbox(!!i);r?s.tokens.length>0&&"paragraph"===s.tokens[0].type?(s.tokens[0].text=e+" "+s.tokens[0].text,s.tokens[0].tokens&&s.tokens[0].tokens.length>0&&"text"===s.tokens[0].tokens[0].type&&(s.tokens[0].tokens[0].text=e+" "+s.tokens[0].tokens[0].text)):s.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(s.tokens,r),a+=this.renderer.listitem(o,n,!!i)}s+=this.renderer.list(a,t,i);continue}case"html":{const e=n;s+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=n;s+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let r=n,a=r.tokens?this.parseInline(r.tokens):r.text;for(;i+1<e.length&&"text"===e[i+1].type;)r=e[++i],a+="\n"+(r.tokens?this.parseInline(r.tokens):r.text);s+=t?this.renderer.paragraph(a):a;continue}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return s}parseInline(e,t){t=t||this.renderer;let s="";for(let i=0;i<e.length;i++){const n=e[i];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){const e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){s+=e||"";continue}}switch(n.type){case"escape":{const e=n;s+=t.text(e.text);break}case"html":{const e=n;s+=t.html(e.text);break}case"link":{const e=n;s+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=n;s+=t.image(e.href,e.title,e.text);break}case"strong":{const e=n;s+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=n;s+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=n;s+=t.codespan(e.text);break}case"br":s+=t.br();break;case"del":{const e=n;s+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=n;s+=t.text(e.text);break}default:{const e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return s}}class qt{options;constructor(e){this.options=e||Oe}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Bt=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(Ut.lex,jt.parse);parseInline=this.#e(Ut.lexInline,jt.parseInline);Parser=jt;Renderer=Lt;TextRenderer=Ht;Lexer=Ut;Tokenizer=tt;Hooks=qt;constructor(...e){this.use(...e)}walkTokens(e,t){let s=[];for(const i of e)switch(s=s.concat(t.call(this,i)),i.type){case"table":{const e=i;for(const i of e.header)s=s.concat(this.walkTokens(i.tokens,t));for(const i of e.rows)for(const e of i)s=s.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=i;s=s.concat(this.walkTokens(e.items,t));break}default:{const e=i;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((i=>{const n=e[i].flat(1/0);s=s.concat(this.walkTokens(n,t))})):e.tokens&&(s=s.concat(this.walkTokens(e.tokens,t)))}}return s}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const s={...e};if(s.async=this.defaults.async||s.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const s=t.renderers[e.name];t.renderers[e.name]=s?function(...t){let i=e.renderer.apply(this,t);return!1===i&&(i=s.apply(this,t)),i}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const s=t[e.level];s?s.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),s.extensions=t),e.renderer){const t=this.defaults.renderer||new Lt(this.defaults);for(const s in e.renderer){if(!(s in t))throw new Error(`renderer '${s}' does not exist`);if("options"===s)continue;const i=s,n=e.renderer[i],r=t[i];t[i]=(...e)=>{let s=n.apply(t,e);return!1===s&&(s=r.apply(t,e)),s||""}}s.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new tt(this.defaults);for(const s in e.tokenizer){if(!(s in t))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const i=s,n=e.tokenizer[i],r=t[i];t[i]=(...e)=>{let s=n.apply(t,e);return!1===s&&(s=r.apply(t,e)),s}}s.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new qt;for(const s in e.hooks){if(!(s in t))throw new Error(`hook '${s}' does not exist`);if("options"===s)continue;const i=s,n=e.hooks[i],r=t[i];qt.passThroughHooks.has(s)?t[i]=e=>{if(this.defaults.async)return Promise.resolve(n.call(t,e)).then((e=>r.call(t,e)));const s=n.call(t,e);return r.call(t,s)}:t[i]=(...e)=>{let s=n.apply(t,e);return!1===s&&(s=r.apply(t,e)),s}}s.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,i=e.walkTokens;s.walkTokens=function(e){let s=[];return s.push(i.call(this,e)),t&&(s=s.concat(t.call(this,e))),s}}this.defaults={...this.defaults,...s}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ut.lex(e,t??this.defaults)}parser(e,t){return jt.parse(e,t??this.defaults)}#e(e,t){return(s,i)=>{const n={...i},r={...this.defaults,...n};!0===this.defaults.async&&!1===n.async&&(r.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),r.async=!0);const a=this.#t(!!r.silent,!!r.async);if(null==s)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof s)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(r.hooks&&(r.hooks.options=r),r.async)return Promise.resolve(r.hooks?r.hooks.preprocess(s):s).then((t=>e(t,r))).then((e=>r.hooks?r.hooks.processAllTokens(e):e)).then((e=>r.walkTokens?Promise.all(this.walkTokens(e,r.walkTokens)).then((()=>e)):e)).then((e=>t(e,r))).then((e=>r.hooks?r.hooks.postprocess(e):e)).catch(a);try{r.hooks&&(s=r.hooks.preprocess(s));let i=e(s,r);r.hooks&&(i=r.hooks.processAllTokens(i)),r.walkTokens&&this.walkTokens(i,r.walkTokens);let n=t(i,r);return r.hooks&&(n=r.hooks.postprocess(n)),n}catch(e){return a(e)}}}#t(e,t){return s=>{if(s.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+Fe(s.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(s);throw s}}};function Xt(e,t){return Bt.parse(e,t)}Xt.options=Xt.setOptions=function(e){return Bt.setOptions(e),Xt.defaults=Bt.defaults,Ue(Xt.defaults),Xt},Xt.getDefaults=Pe,Xt.defaults=Oe,Xt.use=function(...e){return Bt.use(...e),Xt.defaults=Bt.defaults,Ue(Xt.defaults),Xt},Xt.walkTokens=function(e,t){return Bt.walkTokens(e,t)},Xt.parseInline=Bt.parseInline,Xt.Parser=jt,Xt.parser=jt.parse,Xt.Renderer=Lt,Xt.TextRenderer=Ht,Xt.Lexer=Ut,Xt.lexer=Ut.lex,Xt.Tokenizer=tt,Xt.Hooks=qt,Xt.parse=Xt,Xt.options,Xt.setOptions,Xt.use,Xt.walkTokens,Xt.parseInline,jt.parse,Ut.lex;var Ft=function(e,t,s,i){var n,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,s,a):n(t,s))||a);return r>3&&a&&Object.defineProperty(t,s,a),a};let Wt=class extends le{constructor(){super(...arguments),this._reader=null,this._decoder=new TextDecoder,this._buffer="",this._userHasScrolledUp=!1,this._isDragging=!1,this._isResizing=!1,this._overlay=null,this._resizeDir="",this._dragStartX=0,this._dragStartY=0,this._dragStartLeft=0,this._dragStartTop=0,this._resizeStartW=0,this._resizeStartH=0,this.send=null,this.clear=null,this.load=null,this.messages=[],this.title="Kat",this.subtitle="",this.placeholder="Type a message...",this.opened=!1,this._inputValue="",this._isStreaming=!1,this._statusText="",this._error="",this._handleMouseMove=e=>{if(this._isDragging){let t=this._dragStartLeft+(e.clientX-this._dragStartX),s=this._dragStartTop+(e.clientY-this._dragStartY);const i=this._panelEl.offsetWidth;t=Math.max(48-i,Math.min(t,window.innerWidth-48)),s=Math.max(0,Math.min(s,window.innerHeight-48)),this._panelEl.style.left=t+"px",this._panelEl.style.top=s+"px"}else if(this._isResizing){const t=e.clientX-this._dragStartX,s=e.clientY-this._dragStartY,i=340,n=380,r=.9*window.innerWidth,a=window.innerHeight-72;let o=this._resizeStartW,l=this._resizeStartH,c=this._dragStartLeft,h=this._dragStartTop;this._resizeDir.includes("e")&&(o=Math.max(i,Math.min(this._resizeStartW+t,r))),this._resizeDir.includes("w")&&(o=Math.max(i,Math.min(this._resizeStartW-t,r)),c=this._dragStartLeft+(this._resizeStartW-o)),this._resizeDir.includes("s")&&(l=Math.max(n,Math.min(this._resizeStartH+s,a))),this._resizeDir.includes("n")&&(l=Math.max(n,Math.min(this._resizeStartH-s,a)),h=this._dragStartTop+(this._resizeStartH-l)),c=Math.max(0,c),h=Math.max(0,h),this._panelEl.style.width=o+"px",this._panelEl.style.height=l+"px",this._panelEl.style.left=c+"px",this._panelEl.style.top=h+"px"}},this._handleMouseUp=()=>{this._isDragging&&(this._isDragging=!1,this._panelEl.classList.remove("panel--dragging")),this._isResizing&&(this._isResizing=!1,this._panelEl.classList.remove("panel--resizing")),this._hideOverlay(),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp),this._saveState()}}connectedCallback(){super.connectedCallback(),this.load&&this.load().then((e=>{e&&e.length&&(this.messages=e)})).catch((()=>{})),this._restoreState()}disconnectedCallback(){super.disconnectedCallback(),this._reader&&(this._reader.cancel(),this._reader=null),document.removeEventListener("mousemove",this._handleMouseMove),document.removeEventListener("mouseup",this._handleMouseUp)}updated(e){(e.has("messages")||e.has("_statusText"))&&(this._userHasScrolledUp||this._isStreaming||!this._messagesEl||requestAnimationFrame((()=>{this._messagesEl&&(this._messagesEl.scrollTop=this._messagesEl.scrollHeight)}))),e.has("opened")&&this.opened&&this._inputEl&&setTimeout((()=>{this._inputEl&&this._inputEl.focus()}),200)}stop(){this._handleStop()}_showOverlay(){this._overlay||(this._overlay=document.createElement("div"),this._overlay.style.cssText="position:fixed; inset:0; z-index:9999; display:none;",document.body.appendChild(this._overlay)),this._overlay.style.display="block"}_hideOverlay(){this._overlay&&(this._overlay.style.display="none")}_handleHeaderMouseDown(e){if(e.target.closest("button"))return;if(!this._panelEl)return;this._isDragging=!0,this._panelEl.classList.add("panel--dragging"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,e.preventDefault(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleResizeMouseDown(e){if(!this._panelEl)return;this._isResizing=!0,this._resizeDir=e.currentTarget.dataset.dir||"",this._panelEl.classList.add("panel--resizing"),this._showOverlay();const t=this._panelEl.getBoundingClientRect();this._panelEl.style.left=t.left+"px",this._panelEl.style.top=t.top+"px",this._panelEl.style.right="auto",this._panelEl.style.bottom="auto",this._panelEl.style.position="fixed",this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._dragStartLeft=t.left,this._dragStartTop=t.top,this._resizeStartW=t.width,this._resizeStartH=t.height,e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",this._handleMouseMove),document.addEventListener("mouseup",this._handleMouseUp)}_handleToggle(){this.opened=!this.opened,this.opened&&this._panelEl&&this._applyStoredLayout(),this._saveState()}_saveState(){try{const e={opened:String(this.opened)};if(this._panelEl){const t=this._panelEl.style;t.left&&(e.left=t.left),t.top&&(e.top=t.top),t.width&&(e.width=t.width),t.height&&(e.height=t.height),t.position&&(e.position=t.position)}localStorage.setItem("kr-chatbot-state",JSON.stringify(e))}catch{}}_restoreState(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e)return;"true"===JSON.parse(e).opened&&(this.opened=!0,this.updateComplete.then((()=>this._applyStoredLayout())))}catch{}}_applyStoredLayout(){try{const e=localStorage.getItem("kr-chatbot-state");if(!e||!this._panelEl)return;const t=JSON.parse(e);t.position&&(this._panelEl.style.position=t.position),t.left&&(this._panelEl.style.left=t.left),t.top&&(this._panelEl.style.top=t.top),t.width&&(this._panelEl.style.width=t.width),t.height&&(this._panelEl.style.height=t.height)}catch{}}_handleInputChange(e){this._inputValue=e.target.value;const t=e.target;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"}_handleKeyDown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this._handleSubmit())}_handleSubmit(){if(!this._inputValue.trim()||!this.send||this._isStreaming)return;const e=this._inputValue.trim(),t=new CustomEvent("message-submit",{detail:{message:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t),t.defaultPrevented||(this.messages=[...this.messages,{role:"user",content:e}],this._inputValue="",this._error="",this._userHasScrolledUp=!1,this._inputEl&&(this._inputEl.style.height="auto"),this.messages=[...this.messages,{role:"assistant",content:""}],this._isStreaming=!0,this._statusText="",this.updateComplete.then((()=>{if(!this._messagesEl)return;this._messagesEl.querySelectorAll(".message--assistant").forEach((e=>{e.style.minHeight=""}));const e=this._messagesEl.querySelectorAll(".message"),t=e[this.messages.length-2],s=e[this.messages.length-1];s&&(s.style.minHeight=this._messagesEl.clientHeight+"px"),t&&(this._messagesEl.scrollTop=t.offsetTop-this._messagesEl.offsetTop-24)})),this.send({message:e,messages:this.messages.slice(0,-1)}).then((e=>{e.ok?e.body?(this._reader=e.body.getReader(),this._decoder=new TextDecoder,this._buffer="",this._readStreamChunk()):this._handleStreamError("No response body"):this._handleStreamError("Request failed: "+e.status)})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)})))}_handleStop(){this._reader&&(this._reader.cancel(),this._reader=null),this._isStreaming=!1,this._statusText=""}_handleClear(){this.clear&&this.clear().then((()=>{this._reader&&(this._reader.cancel(),this._reader=null),this.messages=[],this._isStreaming=!1,this._statusText="",this._error="",this._inputValue="",this._userHasScrolledUp=!1}))}_handleMessagesScroll(e){const t=e.target,s=t.scrollHeight-t.scrollTop-t.clientHeight;this._userHasScrolledUp=s>50}_handleErrorDismiss(){this._error=""}_readStreamChunk(){this._reader&&this._reader.read().then((e=>{if(e.done)return this._isStreaming=!1,this._statusText="",void(this._reader=null);this._buffer=this._buffer+this._decoder.decode(e.value,{stream:!0});const t=this._buffer.split("\n\n");this._buffer=t.pop()||"";for(let e=0;e<t.length;e++){if(!t[e].trim())continue;const s=t[e].split("\n");for(let e=0;e<s.length;e++){if(!s[e].startsWith("data:"))continue;const t=s[e].slice(5).trim();if(!t)continue;let i;try{i=JSON.parse(t)}catch{continue}if(this.dispatchEvent(new CustomEvent("stream-event",{detail:i,bubbles:!0,composed:!0})),"STATUS"===i.type)i.message&&(this._statusText=String(i.message));else if("REASONING_PART"===i.type){if(i.message){const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].role&&(this.messages[e].reasoning||(this.messages[e].reasoning=""),this.messages[e].reasoning+=String(i.message),this.requestUpdate())}}else if("RESPONSE_PART"===i.type){if(i.message){this._statusText="";const e=this.messages.length-1;e>=0&&"assistant"===this.messages[e].role&&(this.messages[e].content+=String(i.message),this.requestUpdate())}}else"ERROR"===i.type&&this._handleStreamError(String(i.message||"Unknown error"));i.finished&&(this._isStreaming=!1,this._statusText="",this._reader=null)}}this._readStreamChunk()})).catch((e=>{"AbortError"!==e.name&&this._handleStreamError(e.message)}))}_handleStreamError(e){if(this._isStreaming=!1,this._statusText="",this._error=e,this._reader&&(this._reader.cancel(),this._reader=null),this.messages.length>0){const e=this.messages[this.messages.length-1];"assistant"!==e.role||e.content||(this.messages=this.messages.slice(0,-1))}}render(){return X`
1333
1374
  <button
1334
- class=${wt({chatbot__toggle:!0,"chatbot__toggle--hidden":this.opened})}
1375
+ class=${_e({toggle:!0,"toggle--hidden":this.opened})}
1335
1376
  @click=${this._handleToggle}
1336
1377
  title="Open chat"
1337
1378
  >
1338
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" class="chatbot__toggle-icon">
1379
+ <svg
1380
+ viewBox="0 0 24 24"
1381
+ fill="none"
1382
+ stroke="currentColor"
1383
+ stroke-width="2"
1384
+ stroke-linecap="round"
1385
+ class="toggle-icon"
1386
+ >
1339
1387
  <path d="M12 2C6.48 2 2 6.03 2 11c0 2.61 1.19 4.94 3.05 6.55L4 22l4.8-2.4C9.82 19.85 10.88 20 12 20c5.52 0 10-4.03 10-9S17.52 2 12 2z"/>
1340
1388
  <path d="M8 11h.01M12 11h.01M16 11h.01" stroke-width="2.5"/>
1341
1389
  </svg>
1342
1390
  </button>
1343
1391
 
1344
- <div class=${wt({chatbot__panel:!0,"chatbot__panel--opened":this.opened})}>
1345
- <div class="chatbot__resize chatbot__resize--n" data-dir="n" @mousedown=${this._handleResizeMouseDown}></div>
1346
- <div class="chatbot__resize chatbot__resize--s" data-dir="s" @mousedown=${this._handleResizeMouseDown}></div>
1347
- <div class="chatbot__resize chatbot__resize--w" data-dir="w" @mousedown=${this._handleResizeMouseDown}></div>
1348
- <div class="chatbot__resize chatbot__resize--e" data-dir="e" @mousedown=${this._handleResizeMouseDown}></div>
1349
- <div class="chatbot__resize chatbot__resize--nw" data-dir="nw" @mousedown=${this._handleResizeMouseDown}></div>
1350
- <div class="chatbot__resize chatbot__resize--ne" data-dir="ne" @mousedown=${this._handleResizeMouseDown}></div>
1351
- <div class="chatbot__resize chatbot__resize--sw" data-dir="sw" @mousedown=${this._handleResizeMouseDown}></div>
1352
- <div class="chatbot__resize chatbot__resize--se" data-dir="se" @mousedown=${this._handleResizeMouseDown}></div>
1353
- <div class="chatbot__header" @mousedown=${this._handleHeaderMouseDown}>
1354
- <div class="chatbot__header-left">
1355
- <div class="chatbot__header-drag-hint">
1356
- <span></span>
1357
- <span></span>
1358
- <span></span>
1359
- </div>
1360
- <div class="chatbot__header-info">
1361
- <span class="chatbot__header-title">${this.title}</span>
1362
- ${this.subtitle?B`
1363
- <span class="chatbot__header-subtitle">${this.subtitle}</span>
1392
+ <div class=${_e({panel:!0,"panel--opened":this.opened})}>
1393
+ <div
1394
+ class="resize resize--n"
1395
+ data-dir="n"
1396
+ @mousedown=${this._handleResizeMouseDown}
1397
+ ></div>
1398
+ <div
1399
+ class="resize resize--s"
1400
+ data-dir="s"
1401
+ @mousedown=${this._handleResizeMouseDown}
1402
+ ></div>
1403
+ <div
1404
+ class="resize resize--w"
1405
+ data-dir="w"
1406
+ @mousedown=${this._handleResizeMouseDown}
1407
+ ></div>
1408
+ <div
1409
+ class="resize resize--e"
1410
+ data-dir="e"
1411
+ @mousedown=${this._handleResizeMouseDown}
1412
+ ></div>
1413
+ <div
1414
+ class="resize resize--nw"
1415
+ data-dir="nw"
1416
+ @mousedown=${this._handleResizeMouseDown}
1417
+ ></div>
1418
+ <div
1419
+ class="resize resize--ne"
1420
+ data-dir="ne"
1421
+ @mousedown=${this._handleResizeMouseDown}
1422
+ ></div>
1423
+ <div
1424
+ class="resize resize--sw"
1425
+ data-dir="sw"
1426
+ @mousedown=${this._handleResizeMouseDown}
1427
+ ></div>
1428
+ <div
1429
+ class="resize resize--se"
1430
+ data-dir="se"
1431
+ @mousedown=${this._handleResizeMouseDown}
1432
+ ></div>
1433
+ <div class="header" @mousedown=${this._handleHeaderMouseDown}>
1434
+ <div class="header-left">
1435
+ <div class="header-info">
1436
+ <span class="header-title">${this.title}</span>
1437
+ ${this.subtitle?X`
1438
+ <span class="header-subtitle">${this.subtitle}</span>
1364
1439
  `:W}
1365
1440
  </div>
1366
1441
  </div>
1367
- <div class="chatbot__header-actions">
1368
- ${this.messages.length>0?B`
1369
- <button class="chatbot__header-action" @click=${this._handleClear} title="Clear conversation">
1370
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="chatbot__header-action-icon">
1371
- <path stroke-linecap="round" stroke-linejoin="round" d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" />
1442
+ <div class="header-actions">
1443
+ ${this.messages.length>0?X`
1444
+ <button
1445
+ class="header-action"
1446
+ @click=${this._handleClear}
1447
+ title="Clear conversation"
1448
+ >
1449
+ <svg
1450
+ xmlns="http://www.w3.org/2000/svg"
1451
+ fill="none"
1452
+ viewBox="0 0 24 24"
1453
+ stroke-width="1.5"
1454
+ stroke="currentColor"
1455
+ class="header-action-icon"
1456
+ >
1457
+ <path
1458
+ stroke-linecap="round"
1459
+ stroke-linejoin="round"
1460
+ d="m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"
1461
+ />
1372
1462
  </svg>
1373
1463
  </button>
1374
1464
  `:W}
1375
- <button class="chatbot__header-action" @click=${this._handleToggle} title="Close">
1376
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="chatbot__header-action-icon">
1377
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
1465
+ <button
1466
+ class="header-action"
1467
+ @click=${this._handleToggle}
1468
+ title="Close"
1469
+ >
1470
+ <svg
1471
+ xmlns="http://www.w3.org/2000/svg"
1472
+ fill="none"
1473
+ viewBox="0 0 24 24"
1474
+ stroke-width="2"
1475
+ stroke="currentColor"
1476
+ class="header-action-icon"
1477
+ >
1478
+ <path
1479
+ stroke-linecap="round"
1480
+ stroke-linejoin="round"
1481
+ d="M6 18 18 6M6 6l12 12"
1482
+ />
1378
1483
  </svg>
1379
1484
  </button>
1380
1485
  </div>
1381
1486
  </div>
1382
1487
 
1383
- <div class="chatbot__messages" @scroll=${this._handleMessagesScroll}>
1384
- ${0===this.messages.length?B`
1385
- <div class="chatbot__empty">
1386
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" class="chatbot__empty-icon">
1387
- <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z" />
1388
- </svg>
1389
- <span class="chatbot__empty-text">How can I help?</span>
1488
+ <div class="messages" @scroll=${this._handleMessagesScroll}>
1489
+ ${0===this.messages.length?X`
1490
+ <div class="empty">
1491
+ <span class="empty-text">What can I help you with?</span>
1390
1492
  </div>
1391
1493
  `:W}
1392
- ${this.messages.map((t=>B`
1393
- <div class=${wt({chatbot__message:!0,"chatbot__message--user":"user"===t.role,"chatbot__message--assistant":"assistant"===t.role})}>
1394
- ${t.reasoning?B`
1395
- <details class="chatbot__reasoning">
1494
+ ${this.messages.map((e=>X`
1495
+ <div class=${_e({message:!0,"message--user":"user"===e.role,"message--assistant":"assistant"===e.role})}>
1496
+ ${e.reasoning?X`
1497
+ <details class="reasoning">
1396
1498
  <summary>Thinking</summary>
1397
- <div class="chatbot__reasoning-content">${t.reasoning}</div>
1499
+ <div class="reasoning-content">${e.reasoning}</div>
1398
1500
  </details>
1399
1501
  `:W}
1400
- <div class="chatbot__message-content">
1401
- ${"user"===t.role?t.content:yt(this._formatAssistantContent(t.content))}
1402
- </div>
1502
+ ${e.content?X`
1503
+ <div class="message-content">
1504
+ ${"user"===e.role?e.content:ye(Xt.parse(e.content,{breaks:!0}))}
1505
+ </div>
1506
+ `:W}
1507
+ ${"assistant"===e.role&&this._isStreaming&&e===this.messages[this.messages.length-1]?X`
1508
+ <div class="typing">
1509
+ <span></span>
1510
+ <span></span>
1511
+ <span></span>
1512
+ </div>
1513
+ `:W}
1403
1514
  </div>
1404
1515
  `))}
1405
- ${this._statusText?B`
1406
- <div class="chatbot__message chatbot__message--assistant">
1407
- <div class="chatbot__typing">
1408
- <span></span>
1409
- <span></span>
1410
- <span></span>
1411
- </div>
1412
- </div>
1413
- `:W}
1414
1516
  </div>
1415
1517
 
1416
- ${this._error?B`
1417
- <div class="chatbot__error">
1518
+ ${this._error?X`
1519
+ <div class="error">
1418
1520
  <span>${this._error}</span>
1419
- <button class="chatbot__error-dismiss" @click=${this._handleErrorDismiss}>
1420
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="chatbot__error-dismiss-icon">
1421
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
1521
+ <button class="error-dismiss" @click=${this._handleErrorDismiss}>
1522
+ <svg
1523
+ xmlns="http://www.w3.org/2000/svg"
1524
+ fill="none"
1525
+ viewBox="0 0 24 24"
1526
+ stroke-width="2"
1527
+ stroke="currentColor"
1528
+ class="error-dismiss-icon"
1529
+ >
1530
+ <path
1531
+ stroke-linecap="round"
1532
+ stroke-linejoin="round"
1533
+ d="M6 18 18 6M6 6l12 12"
1534
+ />
1422
1535
  </svg>
1423
1536
  </button>
1424
1537
  </div>
1425
1538
  `:W}
1426
1539
 
1427
- <div class="chatbot__footer">
1428
- <div class="chatbot__input-wrapper">
1429
- <button class="chatbot__input-plus" title="Attach">+</button>
1540
+ <div class="footer">
1541
+ <div class="input-wrapper">
1542
+ <button class="input-plus" title="Attach">+</button>
1430
1543
  <textarea
1431
- class="chatbot__input"
1544
+ class="input"
1432
1545
  .value=${this._inputValue}
1433
1546
  placeholder=${this.placeholder}
1434
1547
  rows="1"
1435
1548
  @input=${this._handleInputChange}
1436
1549
  @keydown=${this._handleKeyDown}
1437
1550
  ></textarea>
1438
- ${this._isStreaming?B`
1439
- <button class="chatbot__stop" @click=${this._handleStop} title="Stop generating">
1440
- <svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24" class="chatbot__stop-icon">
1441
- <rect x="6" y="6" width="12" height="12" rx="2" />
1551
+ ${this._isStreaming?X`
1552
+ <button
1553
+ class="stop"
1554
+ @click=${this._handleStop}
1555
+ title="Stop generating"
1556
+ >
1557
+ <svg
1558
+ xmlns="http://www.w3.org/2000/svg"
1559
+ fill="currentColor"
1560
+ viewBox="0 0 24 24"
1561
+ class="stop-icon"
1562
+ >
1563
+ <rect
1564
+ x="6"
1565
+ y="6"
1566
+ width="12"
1567
+ height="12"
1568
+ rx="2"
1569
+ />
1442
1570
  </svg>
1443
1571
  </button>
1444
- `:B`
1572
+ `:X`
1445
1573
  <button
1446
- class=${wt({chatbot__send:!0,"chatbot__send--disabled":!this._inputValue.trim()})}
1574
+ class=${_e({send:!0,"send--disabled":!this._inputValue.trim()})}
1447
1575
  @click=${this._handleSubmit}
1448
1576
  title="Send message"
1449
1577
  >
1450
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" class="chatbot__send-icon">
1578
+ <svg
1579
+ width="16"
1580
+ height="16"
1581
+ viewBox="0 0 24 24"
1582
+ fill="none"
1583
+ stroke="currentColor"
1584
+ stroke-width="2.5"
1585
+ stroke-linecap="round"
1586
+ class="send-icon"
1587
+ >
1451
1588
  <path d="M12 19V5M5 12l7-7 7 7"/>
1452
1589
  </svg>
1453
1590
  </button>
@@ -1455,7 +1592,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1455
1592
  </div>
1456
1593
  </div>
1457
1594
  </div>
1458
- `}};Ut.styles=l`
1595
+ `}};Wt.styles=l`
1459
1596
  *,
1460
1597
  *::before,
1461
1598
  *::after {
@@ -1475,7 +1612,6 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1475
1612
  --kr-chatbot-text: #1a1a2e;
1476
1613
  --kr-chatbot-text-secondary: #64668b;
1477
1614
  --kr-chatbot-user-bg: #e9e9e980;
1478
- --kr-chatbot-user-text: #1a1a2e;
1479
1615
  --kr-chatbot-error-bg: #fef2f2;
1480
1616
  --kr-chatbot-error-text: #dc2626;
1481
1617
  --kr-chatbot-success: #00b894;
@@ -1492,7 +1628,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1492
1628
  }
1493
1629
 
1494
1630
  /* Toggle button */
1495
- .chatbot__toggle {
1631
+ .toggle {
1496
1632
  width: var(--kr-chatbot-toggle-size);
1497
1633
  height: var(--kr-chatbot-toggle-size);
1498
1634
  border-radius: 18px;
@@ -1507,24 +1643,24 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1507
1643
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
1508
1644
  }
1509
1645
 
1510
- .chatbot__toggle:hover {
1646
+ .toggle:hover {
1511
1647
  transform: scale(1.05);
1512
1648
  box-shadow: 0 6px 32px rgba(22, 48, 82, 0.5);
1513
1649
  }
1514
1650
 
1515
- .chatbot__toggle--hidden {
1651
+ .toggle--hidden {
1516
1652
  transform: scale(0);
1517
1653
  opacity: 0;
1518
1654
  pointer-events: none;
1519
1655
  }
1520
1656
 
1521
- .chatbot__toggle-icon {
1657
+ .toggle-icon {
1522
1658
  width: 26px;
1523
1659
  height: 26px;
1524
1660
  }
1525
1661
 
1526
1662
  /* Panel */
1527
- .chatbot__panel {
1663
+ .panel {
1528
1664
  display: none;
1529
1665
  flex-direction: column;
1530
1666
  background: var(--kr-chatbot-bg);
@@ -1542,7 +1678,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1542
1678
  transform-origin: bottom right;
1543
1679
  }
1544
1680
 
1545
- .chatbot__panel--opened {
1681
+ .panel--opened {
1546
1682
  display: flex;
1547
1683
  }
1548
1684
 
@@ -1558,49 +1694,35 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1558
1694
  }
1559
1695
 
1560
1696
  /* Header */
1561
- .chatbot__header {
1562
- padding: 10px 16px;
1563
- background: var(--kr-chatbot-primary);
1564
- color: white;
1697
+ .header {
1698
+ padding: 0 16px 0 24px;
1699
+ height: 64px;
1700
+ background: #ffffff;
1701
+ color: #000000;
1702
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
1565
1703
  display: flex;
1566
1704
  align-items: center;
1567
1705
  justify-content: space-between;
1568
1706
  flex-shrink: 0;
1569
1707
  }
1570
1708
 
1571
- .chatbot__header-left {
1709
+ .header-left {
1572
1710
  display: flex;
1573
1711
  align-items: center;
1574
1712
  gap: 10px;
1575
1713
  }
1576
1714
 
1577
- .chatbot__header-drag-hint {
1578
- display: flex;
1579
- flex-direction: column;
1580
- gap: 2px;
1581
- opacity: 0.35;
1582
- }
1583
-
1584
- .chatbot__header-drag-hint span {
1585
- display: block;
1586
- width: 14px;
1587
- height: 2px;
1588
- background: white;
1589
- border-radius: 1px;
1590
- }
1591
-
1592
- .chatbot__header-info {
1715
+ .header-info {
1593
1716
  display: flex;
1594
1717
  flex-direction: column;
1595
1718
  }
1596
1719
 
1597
- .chatbot__header-title {
1598
- font-size: 13px;
1720
+ .header-title {
1721
+ font-size: 16px;
1599
1722
  font-weight: 600;
1600
- letter-spacing: -0.2px;
1601
1723
  }
1602
1724
 
1603
- .chatbot__header-subtitle {
1725
+ .header-subtitle {
1604
1726
  color: rgba(255, 255, 255, 0.5);
1605
1727
  font-size: 11px;
1606
1728
  display: flex;
@@ -1608,7 +1730,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1608
1730
  gap: 4px;
1609
1731
  }
1610
1732
 
1611
- .chatbot__header-subtitle::before {
1733
+ .header-subtitle::before {
1612
1734
  content: '';
1613
1735
  width: 5px;
1614
1736
  height: 5px;
@@ -1616,18 +1738,18 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1616
1738
  border-radius: 50%;
1617
1739
  }
1618
1740
 
1619
- .chatbot__header-actions {
1741
+ .header-actions {
1620
1742
  display: flex;
1621
1743
  align-items: center;
1622
1744
  gap: 4px;
1623
1745
  }
1624
1746
 
1625
- .chatbot__header-action {
1626
- width: 28px;
1627
- height: 28px;
1747
+ .header-action {
1748
+ width: 32px;
1749
+ height: 32px;
1628
1750
  background: transparent;
1629
1751
  border: none;
1630
- color: rgba(255, 255, 255, 0.6);
1752
+ color: rgb(0 0 0 / 70%);
1631
1753
  border-radius: 8px;
1632
1754
  cursor: pointer;
1633
1755
  display: flex;
@@ -1636,18 +1758,18 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1636
1758
  transition: all 0.15s;
1637
1759
  }
1638
1760
 
1639
- .chatbot__header-action:hover {
1640
- background: rgba(255, 255, 255, 0.1);
1641
- color: white;
1761
+ .header-action:hover {
1762
+ background: rgba(0, 0, 0, 0.05);
1763
+ color: #000000;
1642
1764
  }
1643
1765
 
1644
- .chatbot__header-action-icon {
1645
- width: 16px;
1646
- height: 16px;
1766
+ .header-action-icon {
1767
+ width: 20px;
1768
+ height: 20px;
1647
1769
  }
1648
1770
 
1649
1771
  /* Messages */
1650
- .chatbot__messages {
1772
+ .messages {
1651
1773
  flex: 1;
1652
1774
  overflow-y: auto;
1653
1775
  padding: 32px;
@@ -1658,20 +1780,20 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1658
1780
  background: white;
1659
1781
  }
1660
1782
 
1661
- .chatbot__messages::-webkit-scrollbar {
1783
+ .messages::-webkit-scrollbar {
1662
1784
  width: 4px;
1663
1785
  }
1664
1786
 
1665
- .chatbot__messages::-webkit-scrollbar-track {
1787
+ .messages::-webkit-scrollbar-track {
1666
1788
  background: transparent;
1667
1789
  }
1668
1790
 
1669
- .chatbot__messages::-webkit-scrollbar-thumb {
1791
+ .messages::-webkit-scrollbar-thumb {
1670
1792
  background: rgba(0, 0, 0, 0.08);
1671
1793
  border-radius: 2px;
1672
1794
  }
1673
1795
 
1674
- .chatbot__empty {
1796
+ .empty {
1675
1797
  flex: 1;
1676
1798
  display: flex;
1677
1799
  flex-direction: column;
@@ -1681,17 +1803,12 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1681
1803
  gap: 8px;
1682
1804
  }
1683
1805
 
1684
- .chatbot__empty-icon {
1685
- width: 40px;
1686
- height: 40px;
1687
- opacity: 0.4;
1688
- }
1689
-
1690
- .chatbot__empty-text {
1691
- font-size: 13px;
1806
+ .empty-text {
1807
+ font-size: 14px;
1808
+ color: rgb(0 0 0 / 80%);
1692
1809
  }
1693
1810
 
1694
- .chatbot__message {
1811
+ .message {
1695
1812
  display: flex;
1696
1813
  flex-direction: column;
1697
1814
  max-width: 100%;
@@ -1709,40 +1826,41 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1709
1826
  }
1710
1827
  }
1711
1828
 
1712
- .chatbot__message--user {
1829
+ .message--user {
1713
1830
  align-self: flex-end;
1714
1831
  align-items: flex-end;
1715
1832
  max-width: 85%;
1716
1833
  }
1717
1834
 
1718
- .chatbot__message--assistant {
1835
+ .message--assistant {
1719
1836
  align-self: flex-start;
1837
+ gap: 24px;
1720
1838
  }
1721
1839
 
1722
- .chatbot__message-content {
1840
+ .message-content {
1723
1841
  line-height: 1.7;
1724
1842
  word-wrap: break-word;
1725
1843
  overflow-wrap: break-word;
1726
1844
  }
1727
1845
 
1728
- .chatbot__message--user .chatbot__message-content {
1846
+ .message--user .message-content {
1729
1847
  display: inline-block;
1730
1848
  background: var(--kr-chatbot-user-bg);
1731
- color: var(--kr-chatbot-user-text);
1849
+ color: #000000;
1732
1850
  padding: 10px 16px;
1733
1851
  border-radius: 20px;
1734
1852
  border-bottom-right-radius: 6px;
1735
1853
  font-size: 14px;
1736
1854
  }
1737
1855
 
1738
- .chatbot__message--assistant .chatbot__message-content {
1856
+ .message--assistant .message-content {
1739
1857
  background: transparent;
1740
- color: var(--kr-chatbot-text);
1858
+ color: #000000;
1741
1859
  padding: 0;
1742
1860
  font-size: 14px;
1743
1861
  }
1744
1862
 
1745
- .chatbot__message--assistant .chatbot__message-content pre {
1863
+ .message--assistant .message-content pre {
1746
1864
  background: #1e1e1e;
1747
1865
  color: #d4d4d4;
1748
1866
  padding: 12px;
@@ -1753,67 +1871,57 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1753
1871
  line-height: 1.4;
1754
1872
  }
1755
1873
 
1756
- .chatbot__message--assistant .chatbot__message-content code {
1874
+ .message--assistant .message-content code {
1757
1875
  font-family: 'SF Mono', 'Fira Code', Monaco, monospace;
1758
1876
  font-size: 13px;
1759
1877
  }
1760
1878
 
1761
- .chatbot__message--assistant .chatbot__message-content :not(pre) > code {
1879
+ .message--assistant .message-content :not(pre) > code {
1762
1880
  background: rgba(0, 0, 0, 0.06);
1763
1881
  padding: 2px 5px;
1764
1882
  border-radius: 3px;
1765
1883
  }
1766
1884
 
1767
- .chatbot__message--assistant .chatbot__message-content strong {
1885
+ .message--assistant .message-content strong {
1768
1886
  font-weight: 600;
1769
1887
  }
1770
1888
 
1771
- .chatbot__message--assistant .chatbot__message-content p {
1889
+ .message--assistant .message-content p {
1772
1890
  margin: 0 0 8px 0;
1773
1891
  }
1774
1892
 
1775
- .chatbot__message--assistant .chatbot__message-content p:last-child {
1893
+ .message--assistant .message-content p:last-child {
1776
1894
  margin-bottom: 0;
1777
1895
  }
1778
1896
 
1779
1897
  /* Reasoning */
1780
- .chatbot__reasoning {
1781
- margin-bottom: 8px;
1898
+ .reasoning {
1782
1899
  border-radius: 6px;
1783
- background: rgba(0, 0, 0, 0.03);
1900
+ background: rgb(244 244 244 / 80%);
1784
1901
  font-size: 12px;
1785
1902
  }
1786
1903
 
1787
- .chatbot__reasoning summary {
1904
+ .reasoning summary {
1788
1905
  cursor: pointer;
1789
- padding: 6px 10px;
1790
- color: var(--kr-chatbot-text-secondary);
1791
- font-style: italic;
1906
+ padding: 6px 10px 6px 10px;
1907
+ color: black;
1792
1908
  user-select: none;
1793
1909
  }
1794
1910
 
1795
- .chatbot__reasoning-content {
1911
+ .reasoning-content {
1796
1912
  padding: 6px 10px 10px;
1797
- color: var(--kr-chatbot-text-secondary);
1798
- line-height: 1.5;
1913
+ color: black;
1799
1914
  white-space: pre-wrap;
1800
1915
  word-wrap: break-word;
1801
1916
  }
1802
1917
 
1803
- /* Status */
1804
- .chatbot__status {
1805
- font-size: 13px;
1806
- color: var(--kr-chatbot-text-secondary);
1807
- font-style: italic;
1808
- }
1809
-
1810
- .chatbot__typing {
1918
+ .typing {
1811
1919
  display: flex;
1812
1920
  gap: 4px;
1813
1921
  padding: 4px 0;
1814
1922
  }
1815
1923
 
1816
- .chatbot__typing span {
1924
+ .typing span {
1817
1925
  width: 6px;
1818
1926
  height: 6px;
1819
1927
  background: var(--kr-chatbot-text-secondary);
@@ -1822,11 +1930,11 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1822
1930
  opacity: 0.4;
1823
1931
  }
1824
1932
 
1825
- .chatbot__typing span:nth-child(2) {
1933
+ .typing span:nth-child(2) {
1826
1934
  animation-delay: 0.2s;
1827
1935
  }
1828
1936
 
1829
- .chatbot__typing span:nth-child(3) {
1937
+ .typing span:nth-child(3) {
1830
1938
  animation-delay: 0.4s;
1831
1939
  }
1832
1940
 
@@ -1842,7 +1950,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1842
1950
  }
1843
1951
 
1844
1952
  /* Error */
1845
- .chatbot__error {
1953
+ .error {
1846
1954
  padding: 8px 16px;
1847
1955
  background: var(--kr-chatbot-error-bg);
1848
1956
  color: var(--kr-chatbot-error-text);
@@ -1854,7 +1962,7 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1854
1962
  flex-shrink: 0;
1855
1963
  }
1856
1964
 
1857
- .chatbot__error-dismiss {
1965
+ .error-dismiss {
1858
1966
  background: none;
1859
1967
  border: none;
1860
1968
  color: var(--kr-chatbot-error-text);
@@ -1865,19 +1973,19 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1865
1973
  flex-shrink: 0;
1866
1974
  }
1867
1975
 
1868
- .chatbot__error-dismiss-icon {
1976
+ .error-dismiss-icon {
1869
1977
  width: 14px;
1870
1978
  height: 14px;
1871
1979
  }
1872
1980
 
1873
1981
  /* Footer / Input */
1874
- .chatbot__footer {
1875
- padding: 12px 16px 16px;
1982
+ .footer {
1983
+ padding: 16px 16px 16px;
1876
1984
  flex-shrink: 0;
1877
1985
  background: white;
1878
1986
  }
1879
1987
 
1880
- .chatbot__input-wrapper {
1988
+ .input-wrapper {
1881
1989
  display: flex;
1882
1990
  align-items: center;
1883
1991
  gap: 4px;
@@ -1888,12 +1996,12 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1888
1996
  transition: border-color 0.2s, box-shadow 0.2s;
1889
1997
  }
1890
1998
 
1891
- .chatbot__input-wrapper:focus-within {
1999
+ .input-wrapper:focus-within {
1892
2000
  border-color: #b0b0b0;
1893
2001
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
1894
2002
  }
1895
2003
 
1896
- .chatbot__input-plus {
2004
+ .input-plus {
1897
2005
  width: 34px;
1898
2006
  height: 34px;
1899
2007
  border: none;
@@ -1910,11 +2018,11 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1910
2018
  transition: background 0.15s;
1911
2019
  }
1912
2020
 
1913
- .chatbot__input-plus:hover {
2021
+ .input-plus:hover {
1914
2022
  background: #f8f9fc;
1915
2023
  }
1916
2024
 
1917
- .chatbot__input {
2025
+ .input {
1918
2026
  flex: 1;
1919
2027
  border: none;
1920
2028
  outline: none;
@@ -1926,14 +2034,14 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1926
2034
  min-height: 26px;
1927
2035
  max-height: 120px;
1928
2036
  background: transparent;
1929
- color: var(--kr-chatbot-text);
2037
+ color: black;
1930
2038
  }
1931
2039
 
1932
- .chatbot__input::placeholder {
2040
+ .input::placeholder {
1933
2041
  color: #b0b0b0;
1934
2042
  }
1935
2043
 
1936
- .chatbot__send {
2044
+ .send {
1937
2045
  width: 34px;
1938
2046
  height: 34px;
1939
2047
  border-radius: 50%;
@@ -1948,25 +2056,25 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1948
2056
  transition: all 0.15s;
1949
2057
  }
1950
2058
 
1951
- .chatbot__send:hover {
2059
+ .send:hover {
1952
2060
  background: var(--kr-chatbot-primary-hover);
1953
2061
  }
1954
2062
 
1955
- .chatbot__send--disabled {
2063
+ .send--disabled {
1956
2064
  opacity: 0.4;
1957
2065
  cursor: default;
1958
2066
  }
1959
2067
 
1960
- .chatbot__send--disabled:hover {
2068
+ .send--disabled:hover {
1961
2069
  background: var(--kr-chatbot-primary);
1962
2070
  }
1963
2071
 
1964
- .chatbot__send-icon {
2072
+ .send-icon {
1965
2073
  width: 16px;
1966
2074
  height: 16px;
1967
2075
  }
1968
2076
 
1969
- .chatbot__stop {
2077
+ .stop {
1970
2078
  width: 34px;
1971
2079
  height: 34px;
1972
2080
  border-radius: 50%;
@@ -1981,61 +2089,50 @@ function vt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
1981
2089
  transition: all 0.15s;
1982
2090
  }
1983
2091
 
1984
- .chatbot__stop:hover {
2092
+ .stop:hover {
1985
2093
  background: #b91c1c;
1986
2094
  }
1987
2095
 
1988
- .chatbot__stop-icon {
2096
+ .stop-icon {
1989
2097
  width: 14px;
1990
2098
  height: 14px;
1991
2099
  }
1992
2100
 
1993
2101
  /* Header drag cursor */
1994
- .chatbot__header {
2102
+ .header {
1995
2103
  cursor: grab;
1996
2104
  user-select: none;
1997
2105
  }
1998
2106
 
1999
- .chatbot__header:active {
2107
+ .header:active {
2000
2108
  cursor: grabbing;
2001
2109
  }
2002
2110
 
2003
2111
  /* Drag / Resize states */
2004
- .chatbot__panel--dragging,
2005
- .chatbot__panel--resizing {
2112
+ .panel--dragging,
2113
+ .panel--resizing {
2006
2114
  transition: none;
2007
2115
  user-select: none;
2008
2116
  }
2009
2117
 
2010
- .chatbot__panel--dragging {
2118
+ .panel--dragging {
2011
2119
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.18), 0 12px 40px rgba(0, 0, 0, 0.1);
2012
2120
  }
2013
2121
 
2014
2122
  /* Resize handles */
2015
- .chatbot__resize {
2123
+ .resize {
2016
2124
  position: absolute;
2017
2125
  z-index: 10;
2018
2126
  }
2019
2127
 
2020
- .chatbot__resize--n { top: -4px; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
2021
- .chatbot__resize--s { bottom: -4px; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
2022
- .chatbot__resize--w { left: -4px; top: 12px; bottom: 12px; width: 8px; cursor: w-resize; }
2023
- .chatbot__resize--e { right: -4px; top: 12px; bottom: 12px; width: 8px; cursor: e-resize; }
2024
- .chatbot__resize--nw { top: -4px; left: -4px; width: 16px; height: 16px; cursor: nw-resize; }
2025
- .chatbot__resize--ne { top: -4px; right: -4px; width: 16px; height: 16px; cursor: ne-resize; }
2026
- .chatbot__resize--sw { bottom: -4px; left: -4px; width: 16px; height: 16px; cursor: sw-resize; }
2027
- .chatbot__resize--se { bottom: -4px; right: -4px; width: 16px; height: 16px; cursor: se-resize; }
2128
+ .resize--n { top: -4px; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
2129
+ .resize--s { bottom: -4px; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
2130
+ .resize--w { left: -4px; top: 12px; bottom: 12px; width: 8px; cursor: w-resize; }
2131
+ .resize--e { right: -4px; top: 12px; bottom: 12px; width: 8px; cursor: e-resize; }
2132
+ .resize--nw { top: -4px; left: -4px; width: 16px; height: 16px; cursor: nw-resize; }
2133
+ .resize--ne { top: -4px; right: -4px; width: 16px; height: 16px; cursor: ne-resize; }
2134
+ .resize--sw { bottom: -4px; left: -4px; width: 16px; height: 16px; cursor: sw-resize; }
2135
+ .resize--se { bottom: -4px; right: -4px; width: 16px; height: 16px; cursor: se-resize; }
2028
2136
 
2029
- .chatbot__resize--se::after {
2030
- content: '';
2031
- position: absolute;
2032
- bottom: 7px;
2033
- right: 7px;
2034
- width: 10px;
2035
- height: 10px;
2036
- border-right: 2px solid rgba(0, 0, 0, 0.12);
2037
- border-bottom: 2px solid rgba(0, 0, 0, 0.12);
2038
- border-radius: 0 0 3px 0;
2039
- }
2040
- `,Rt([ut({attribute:!1})],Ut.prototype,"send",void 0),Rt([ut({attribute:!1})],Ut.prototype,"clear",void 0),Rt([ut({attribute:!1})],Ut.prototype,"messages",void 0),Rt([ut({type:String})],Ut.prototype,"title",void 0),Rt([ut({type:String})],Ut.prototype,"subtitle",void 0),Rt([ut({type:String})],Ut.prototype,"placeholder",void 0),Rt([ut({type:Boolean,reflect:!0})],Ut.prototype,"opened",void 0),Rt([gt()],Ut.prototype,"_inputValue",void 0),Rt([gt()],Ut.prototype,"_isStreaming",void 0),Rt([gt()],Ut.prototype,"_statusText",void 0),Rt([gt()],Ut.prototype,"_error",void 0),Rt([vt(".chatbot__panel")],Ut.prototype,"_panelEl",void 0),Rt([vt(".chatbot__messages")],Ut.prototype,"_messagesEl",void 0),Rt([vt(".chatbot__input")],Ut.prototype,"_inputEl",void 0),Ut=Rt([ct("kr-chatbot")],Ut);export{Ut as KRChatbot,Tt as KRRouter,Pt as KRRouterOutlet,It as KRScaffold,Nt as KRScreenDetail,At as KRScreenNav,Dt as KRSubbar};
2137
+ `,Ft([ue({attribute:!1})],Wt.prototype,"send",void 0),Ft([ue({attribute:!1})],Wt.prototype,"clear",void 0),Ft([ue({attribute:!1})],Wt.prototype,"load",void 0),Ft([ue({attribute:!1})],Wt.prototype,"messages",void 0),Ft([ue({type:String})],Wt.prototype,"title",void 0),Ft([ue({type:String})],Wt.prototype,"subtitle",void 0),Ft([ue({type:String})],Wt.prototype,"placeholder",void 0),Ft([ue({type:Boolean,reflect:!0})],Wt.prototype,"opened",void 0),Ft([ge()],Wt.prototype,"_inputValue",void 0),Ft([ge()],Wt.prototype,"_isStreaming",void 0),Ft([ge()],Wt.prototype,"_statusText",void 0),Ft([ge()],Wt.prototype,"_error",void 0),Ft([fe(".panel")],Wt.prototype,"_panelEl",void 0),Ft([fe(".messages")],Wt.prototype,"_messagesEl",void 0),Ft([fe(".input")],Wt.prototype,"_inputEl",void 0),Wt=Ft([he("kr-chatbot")],Wt);export{Wt as KRChatbot,De as KRRouter,Me as KRRouterOutlet,Ie as KRScaffold,Ce as KRScreenDetail,ze as KRScreenNav,Re as KRSubbar};
2041
2138
  //# sourceMappingURL=krubble-app.bundled.min.js.map