@kodaris/krubble-app-components 1.0.69 → 1.0.70
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.
- package/dist/chatbot.d.ts +57 -2
- package/dist/chatbot.d.ts.map +1 -1
- package/dist/chatbot.js +400 -26
- package/dist/chatbot.js.map +1 -1
- package/dist/krubble-app.bundled.js +441 -56
- package/dist/krubble-app.bundled.js.map +1 -1
- package/dist/krubble-app.bundled.min.js +276 -74
- package/dist/krubble-app.bundled.min.js.map +1 -1
- package/dist/krubble-app.umd.js +440 -55
- package/dist/krubble-app.umd.js.map +1 -1
- package/dist/krubble-app.umd.min.js +276 -74
- package/dist/krubble-app.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/krubble-app.umd.js
CHANGED
|
@@ -9,39 +9,39 @@
|
|
|
9
9
|
* Copyright 2019 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const t$
|
|
12
|
+
const t$4=globalThis,e$7=t$4.ShadowRoot&&(void 0===t$4.ShadyCSS||t$4.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$5=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$7&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$3),i$5=(t,...e)=>{const o=1===t.length?t[0]:e.reduce((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1],t[0]);return new n$3(o,t,s$3)},S$1=(s,o)=>{if(e$7)s.adoptedStyleSheets=o.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of o){const o=document.createElement("style"),n=t$4.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$7?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
16
16
|
* Copyright 2017 Google LLC
|
|
17
17
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
-
*/const{is:i$
|
|
18
|
+
*/const{is:i$4,defineProperty:e$6,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$3,getOwnPropertySymbols:o$4,getPrototypeOf:n$2}=Object,a$1=globalThis,c$2=a$1.trustedTypes,l$1=c$2?c$2.emptyScript:"",p$2=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$3={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$4(t,s),b$1={attribute:true,type:String,converter:u$3,reflect:false,useDefault:false,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b$1){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$6(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...r$3(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$3).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$3;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i,e=false,h){if(void 0!==t){const r=this.constructor;if(false===e&&(h=this[t]),i??=r.getPropertyOptions(t),!((i.hasChanged??f$1)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$1("elementProperties")]=new Map,y$1[d$1("finalized")]=new Map,p$2?.({ReactiveElement:y$1}),(a$1.reactiveElementVersions??=[]).push("2.1.2");
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
22
22
|
* Copyright 2017 Google LLC
|
|
23
23
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
24
|
*/
|
|
25
|
-
const t$
|
|
25
|
+
const t$3=globalThis,i$3=t=>t,s$2=t$3.trustedTypes,e$5=s$2?s$2.createPolicy("lit-html",{createHTML:t=>t}):void 0,h$1="$lit$",o$3=`lit$${Math.random().toFixed(9).slice(2)}$`,n$1="?"+o$3,r$2=`<${n$1}>`,l=document,c$1=()=>l.createComment(""),a=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$2=Array.isArray,d=t=>u$2(t)||"function"==typeof t?.[Symbol.iterator],f="[ \t\n\f\r]",v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m$1=/>/g,p$1=RegExp(`>|${f}(?:([^\\s"'>=/]+)(${f}*=${f}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),g=/'/g,$=/"/g,y=/^(?:script|style|textarea|title)$/i,x=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),b=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l.createTreeWalker(l,129);function V(t,i){if(!u$2(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==e$5?e$5.createHTML(i):i}const N=(t,i)=>{const s=t.length-1,e=[];let n,l=2===i?"<svg>":3===i?"<math>":"",c=v$1;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,f=0;for(;f<s.length&&(c.lastIndex=f,u=c.exec(s),null!==u);)f=c.lastIndex,c===v$1?"!--"===u[1]?c=_:void 0!==u[1]?c=m$1:void 0!==u[2]?(y.test(u[2])&&(n=RegExp("</"+u[2],"g")),c=p$1):void 0!==u[3]&&(c=p$1):c===p$1?">"===u[0]?(c=n??v$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?p$1:'"'===u[3]?$:g):c===$||c===g?c=p$1:c===_||c===m$1?c=v$1:(c=p$1,n=void 0);const x=c===p$1&&t[i+1].startsWith("/>")?" ":"";l+=c===v$1?s+r$2:d>=0?(e.push(a),s.slice(0,d)+h$1+s.slice(d)+o$3+x):s+o$3+(-2===d?i:x);}return [V(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),e]};class S{constructor({strings:t,_$litType$:i},e){let r;this.parts=[];let l=0,a=0;const u=t.length-1,d=this.parts,[f,v]=N(t,i);if(this.el=S.createElement(f,e),P.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=P.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(h$1)){const i=v[a++],s=r.getAttribute(t).split(o$3),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:l,name:e[2],strings:s,ctor:"."===e[1]?I:"?"===e[1]?L:"@"===e[1]?z:H}),r.removeAttribute(t);}else t.startsWith(o$3)&&(d.push({type:6,index:l}),r.removeAttribute(t));if(y.test(r.tagName)){const t=r.textContent.split(o$3),i=t.length-1;if(i>0){r.textContent=s$2?s$2.emptyScript:"";for(let s=0;s<i;s++)r.append(t[s],c$1()),P.nextNode(),d.push({type:2,index:++l});r.append(t[i],c$1());}}}else if(8===r.nodeType)if(r.data===n$1)d.push({type:2,index:l});else {let t=-1;for(;-1!==(t=r.data.indexOf(o$3,t+1));)d.push({type:7,index:l}),t+=o$3.length-1;}l++;}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function M$1(t,i,s=t,e){if(i===E)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=a(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(false),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=M$1(t,h._$AS(t,i.values),h,e)),i}class R{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??l).importNode(i,true);P.currentNode=e;let h=P.nextNode(),o=0,n=0,r=s[0];for(;void 0!==r;){if(o===r.index){let i;2===r.type?i=new k(h,h.nextSibling,this,t):1===r.type?i=new r.ctor(h,r.name,r.strings,this,t):6===r.type&&(i=new Z(h,this,t)),this._$AV.push(i),r=s[++n];}o!==r?.index&&(h=P.nextNode(),o++);}return P.currentNode=l,e}p(t){let i=0;for(const s of this._$AV) void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class k{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??true;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=M$1(this,t,i),a(t)?t===A||null==t||""===t?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==E&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):d(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==A&&a(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new R(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=C.get(t.strings);return void 0===i&&C.set(t.strings,i=new S(t)),i}k(t){u$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new k(this.O(c$1()),this.O(c$1()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(false,true,s);t!==this._$AB;){const s=i$3(t).nextSibling;i$3(t).remove(),t=s;}}setConnected(t){ void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class H{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=A;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=M$1(this,t,i,0),o=!a(t)||t!==this._$AH&&t!==E,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=M$1(this,e[s+n],i,n),r===E&&(r=this._$AH[n]),o||=!a(r)||r!==this._$AH[n],r===A?t=A:t!==A&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class I extends H{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===A?void 0:t;}}class L extends H{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A);}}class z extends H{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=M$1(this,t,i,0)??A)===E)return;const s=this._$AH,e=t===A&&s!==A||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==A&&(s===A||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class Z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){M$1(this,t);}}const j={I:k},B=t$3.litHtmlPolyfillSupport;B?.(S,k),(t$3.litHtmlVersions??=[]).push("3.3.2");const D=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new k(i.insertBefore(c$1(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2017 Google LLC
|
|
30
30
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
31
|
-
*/const s=globalThis;let i$
|
|
31
|
+
*/const s$1=globalThis;let i$2 = class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=D(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i$2._$litElement$=true,i$2["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i$2});const o$2=s$1.litElementPolyfillSupport;o$2?.({LitElement:i$2});(s$1.litElementVersions??=[]).push("4.2.2");
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @license
|
|
35
35
|
* Copyright 2017 Google LLC
|
|
36
36
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
37
37
|
*/
|
|
38
|
-
const t$
|
|
38
|
+
const t$2=t=>(e,o)=>{ void 0!==o?o.addInitializer(()=>{customElements.define(t,e);}):customElements.define(t,e);};
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright 2017 Google LLC
|
|
43
43
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
44
|
-
*/const o$1={attribute:true,type:String,converter:u$
|
|
44
|
+
*/const o$1={attribute:true,type:String,converter:u$3,reflect:false,hasChanged:f$1},r$1=(t=o$1,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t,true,r);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t,true,r);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r$1(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* @license
|
|
@@ -67,19 +67,19 @@
|
|
|
67
67
|
* Copyright 2017 Google LLC
|
|
68
68
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
69
69
|
*/
|
|
70
|
-
const t={ATTRIBUTE:1,CHILD:2},e$2=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
70
|
+
const t$1={ATTRIBUTE:1,CHILD:2},e$2=t=>(...e)=>({_$litDirective$:t,values:e});let i$1 = class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
74
74
|
* Copyright 2017 Google LLC
|
|
75
75
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
76
|
-
*/let e$1 = class e extends i{constructor(i){if(super(i),this.it=A,i.type!==t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};e$1.directiveName="unsafeHTML",e$1.resultType=1;const o=e$2(e$1);
|
|
76
|
+
*/let e$1 = class e extends i$1{constructor(i){if(super(i),this.it=A,i.type!==t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===A||null==r)return this._t=void 0,this.it=r;if(r===E)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;const s=[r];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}};e$1.directiveName="unsafeHTML",e$1.resultType=1;const o=e$2(e$1);
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* @license
|
|
80
80
|
* Copyright 2018 Google LLC
|
|
81
81
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
82
|
-
*/const e=e$2(class extends i{constructor(t
|
|
82
|
+
*/const e=e$2(class extends i$1{constructor(t){if(super(t),t.type!==t$1.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter(s=>t[s]).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return E}});
|
|
83
83
|
|
|
84
84
|
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
85
85
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
88
88
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
89
89
|
};
|
|
90
|
-
let KRNavItemEdit = class KRNavItemEdit extends i$
|
|
90
|
+
let KRNavItemEdit = class KRNavItemEdit extends i$2 {
|
|
91
91
|
constructor() {
|
|
92
92
|
super(...arguments);
|
|
93
93
|
this.label = '';
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
`;
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
KRNavItemEdit.styles = i$
|
|
194
|
+
KRNavItemEdit.styles = i$5 `
|
|
195
195
|
:host {
|
|
196
196
|
display: block;
|
|
197
197
|
width: 360px;
|
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
r()
|
|
291
291
|
], KRNavItemEdit.prototype, "active", void 0);
|
|
292
292
|
KRNavItemEdit = __decorate$6([
|
|
293
|
-
t$
|
|
293
|
+
t$2('kr-nav-item-edit')
|
|
294
294
|
], KRNavItemEdit);
|
|
295
295
|
|
|
296
296
|
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -352,7 +352,7 @@
|
|
|
352
352
|
* - Don't hardcode breadcrumbs
|
|
353
353
|
* - Look at renderNormalFooter and renderEditFooter and see if that is what we want to do
|
|
354
354
|
*/
|
|
355
|
-
exports.Scaffold = class KRScaffold extends i$
|
|
355
|
+
exports.Scaffold = class KRScaffold extends i$2 {
|
|
356
356
|
constructor() {
|
|
357
357
|
super();
|
|
358
358
|
/**
|
|
@@ -1516,7 +1516,7 @@
|
|
|
1516
1516
|
`;
|
|
1517
1517
|
}
|
|
1518
1518
|
};
|
|
1519
|
-
exports.Scaffold.styles = i$
|
|
1519
|
+
exports.Scaffold.styles = i$5 `
|
|
1520
1520
|
:host {
|
|
1521
1521
|
display: flex;
|
|
1522
1522
|
flex-direction: column;
|
|
@@ -2334,7 +2334,7 @@
|
|
|
2334
2334
|
r()
|
|
2335
2335
|
], exports.Scaffold.prototype, "pendingRequests", void 0);
|
|
2336
2336
|
exports.Scaffold = __decorate$5([
|
|
2337
|
-
t$
|
|
2337
|
+
t$2('kr-scaffold')
|
|
2338
2338
|
], exports.Scaffold);
|
|
2339
2339
|
|
|
2340
2340
|
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -2371,7 +2371,7 @@
|
|
|
2371
2371
|
* @property {KRScreenNavItem[]} items - Navigation items as JSON array
|
|
2372
2372
|
* @property {string} activeId - Currently active item ID
|
|
2373
2373
|
*/
|
|
2374
|
-
exports.ScreenNav = class KRScreenNav extends i$
|
|
2374
|
+
exports.ScreenNav = class KRScreenNav extends i$2 {
|
|
2375
2375
|
constructor() {
|
|
2376
2376
|
super(...arguments);
|
|
2377
2377
|
/**
|
|
@@ -2487,7 +2487,7 @@
|
|
|
2487
2487
|
`;
|
|
2488
2488
|
}
|
|
2489
2489
|
};
|
|
2490
|
-
exports.ScreenNav.styles = i$
|
|
2490
|
+
exports.ScreenNav.styles = i$5 `
|
|
2491
2491
|
:host {
|
|
2492
2492
|
display: flex;
|
|
2493
2493
|
height: 100%;
|
|
@@ -2592,7 +2592,7 @@
|
|
|
2592
2592
|
n({ type: String })
|
|
2593
2593
|
], exports.ScreenNav.prototype, "activeId", void 0);
|
|
2594
2594
|
exports.ScreenNav = __decorate$4([
|
|
2595
|
-
t$
|
|
2595
|
+
t$2('kr-screen-nav')
|
|
2596
2596
|
], exports.ScreenNav);
|
|
2597
2597
|
|
|
2598
2598
|
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -2620,7 +2620,7 @@
|
|
|
2620
2620
|
*
|
|
2621
2621
|
* @property {string} title - Section title (e.g., "Company Details")
|
|
2622
2622
|
*/
|
|
2623
|
-
exports.ScreenDetail = class KRScreenDetail extends i$
|
|
2623
|
+
exports.ScreenDetail = class KRScreenDetail extends i$2 {
|
|
2624
2624
|
constructor() {
|
|
2625
2625
|
super(...arguments);
|
|
2626
2626
|
/**
|
|
@@ -2644,7 +2644,7 @@
|
|
|
2644
2644
|
`;
|
|
2645
2645
|
}
|
|
2646
2646
|
};
|
|
2647
|
-
exports.ScreenDetail.styles = i$
|
|
2647
|
+
exports.ScreenDetail.styles = i$5 `
|
|
2648
2648
|
:host {
|
|
2649
2649
|
display: flex;
|
|
2650
2650
|
flex-direction: column;
|
|
@@ -2693,7 +2693,7 @@
|
|
|
2693
2693
|
n({ type: String })
|
|
2694
2694
|
], exports.ScreenDetail.prototype, "title", void 0);
|
|
2695
2695
|
exports.ScreenDetail = __decorate$3([
|
|
2696
|
-
t$
|
|
2696
|
+
t$2('kr-screen-detail')
|
|
2697
2697
|
], exports.ScreenDetail);
|
|
2698
2698
|
|
|
2699
2699
|
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -2707,7 +2707,7 @@
|
|
|
2707
2707
|
*
|
|
2708
2708
|
* @slot - Content to display in the subbar (right side)
|
|
2709
2709
|
*/
|
|
2710
|
-
exports.Subbar = class KRSubbar extends i$
|
|
2710
|
+
exports.Subbar = class KRSubbar extends i$2 {
|
|
2711
2711
|
constructor() {
|
|
2712
2712
|
super(...arguments);
|
|
2713
2713
|
/**
|
|
@@ -2835,7 +2835,7 @@
|
|
|
2835
2835
|
`;
|
|
2836
2836
|
}
|
|
2837
2837
|
};
|
|
2838
|
-
exports.Subbar.styles = i$
|
|
2838
|
+
exports.Subbar.styles = i$5 `
|
|
2839
2839
|
:host {
|
|
2840
2840
|
display: flex;
|
|
2841
2841
|
flex-direction: row;
|
|
@@ -2909,7 +2909,7 @@
|
|
|
2909
2909
|
n({ type: Boolean })
|
|
2910
2910
|
], exports.Subbar.prototype, "menu", void 0);
|
|
2911
2911
|
exports.Subbar = __decorate$2([
|
|
2912
|
-
t$
|
|
2912
|
+
t$2('kr-subbar')
|
|
2913
2913
|
], exports.Subbar);
|
|
2914
2914
|
|
|
2915
2915
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -3048,7 +3048,7 @@
|
|
|
3048
3048
|
KRRouter.base = '';
|
|
3049
3049
|
KRRouter.routes = [];
|
|
3050
3050
|
KRRouter.elementCache = new Map();
|
|
3051
|
-
exports.RouterOutlet = class KRRouterOutlet extends i$
|
|
3051
|
+
exports.RouterOutlet = class KRRouterOutlet extends i$2 {
|
|
3052
3052
|
constructor() {
|
|
3053
3053
|
super(...arguments);
|
|
3054
3054
|
this.level = -1;
|
|
@@ -3093,16 +3093,29 @@
|
|
|
3093
3093
|
return b `${el}`;
|
|
3094
3094
|
}
|
|
3095
3095
|
};
|
|
3096
|
-
exports.RouterOutlet.styles = i$
|
|
3096
|
+
exports.RouterOutlet.styles = i$5 `
|
|
3097
3097
|
:host {
|
|
3098
3098
|
display: block;
|
|
3099
3099
|
height: 100%;
|
|
3100
3100
|
}
|
|
3101
3101
|
`;
|
|
3102
3102
|
exports.RouterOutlet = __decorate$1([
|
|
3103
|
-
t$
|
|
3103
|
+
t$2('kr-router-outlet')
|
|
3104
3104
|
], exports.RouterOutlet);
|
|
3105
3105
|
|
|
3106
|
+
/**
|
|
3107
|
+
* @license
|
|
3108
|
+
* Copyright 2020 Google LLC
|
|
3109
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3110
|
+
*/const {I:t}=j,i=o=>o,s=()=>document.createComment(""),v=(o,n,e)=>{const l=o._$AA.parentNode,d=void 0===n?o._$AB:n._$AA;if(void 0===e){const i=l.insertBefore(s(),d),n=l.insertBefore(s(),d);e=new t(i,n,o,o.options);}else {const t=e._$AB.nextSibling,n=e._$AM,c=n!==o;if(c){let t;e._$AQ?.(o),e._$AM=o,void 0!==e._$AP&&(t=o._$AU)!==n._$AU&&e._$AP(t);}if(t!==d||c){let o=e._$AA;for(;o!==t;){const t=i(o).nextSibling;i(l).insertBefore(o,d),o=t;}}}return e},u$1=(o,t,i=o)=>(o._$AI(t,i),o),m={},p=(o,t=m)=>o._$AH=t,M=o=>o._$AH,h=o=>{o._$AR(),o._$AA.remove();};
|
|
3111
|
+
|
|
3112
|
+
/**
|
|
3113
|
+
* @license
|
|
3114
|
+
* Copyright 2017 Google LLC
|
|
3115
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
3116
|
+
*/
|
|
3117
|
+
const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=e$2(class extends i$1{constructor(e){if(super(e),e.type!==t$1.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return {values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){const d=M(s),{values:p$1,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p$1;const h$1=this.ut??=[],v$1=[];let m,y,x=0,j=d.length-1,k=0,w=p$1.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h$1[x]===a[k])v$1[k]=u$1(d[x],p$1[k]),x++,k++;else if(h$1[j]===a[w])v$1[w]=u$1(d[j],p$1[w]),j--,w--;else if(h$1[x]===a[w])v$1[w]=u$1(d[x],p$1[w]),v(s,v$1[w+1],d[x]),x++,w--;else if(h$1[j]===a[k])v$1[k]=u$1(d[j],p$1[k]),v(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h$1,x,j)),m.has(h$1[x]))if(m.has(h$1[j])){const e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){const e=v(s,d[x]);u$1(e,p$1[k]),v$1[k]=e;}else v$1[k]=u$1(t,p$1[k]),v(s,d[x],t),d[e]=null;k++;}else h(d[j]),j--;else h(d[x]),x++;for(;k<=w;){const e=v(s,v$1[w+1]);u$1(e,p$1[k]),v$1[k++]=e;}for(;x<=j;){const e=d[x++];null!==e&&h(e);}return this.ut=a,p(s,v$1),E}});
|
|
3118
|
+
|
|
3106
3119
|
/**
|
|
3107
3120
|
* marked v12.0.2 - a markdown parser
|
|
3108
3121
|
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
@@ -5535,6 +5548,8 @@
|
|
|
5535
5548
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5536
5549
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5537
5550
|
};
|
|
5551
|
+
/** Image MIME types the chatbot accepts (matches what Bedrock can ingest). */
|
|
5552
|
+
const ACCEPTED_IMAGE_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
|
|
5538
5553
|
/**
|
|
5539
5554
|
* AI chatbot component with SSE streaming.
|
|
5540
5555
|
*
|
|
@@ -5572,7 +5587,7 @@
|
|
|
5572
5587
|
* @fires message-submit - When the user sends a message. Cancelable. Detail: `{ message: string }`
|
|
5573
5588
|
* @fires stream-event - Dispatched for every SSE message received. Detail contains the parsed event data.
|
|
5574
5589
|
*/
|
|
5575
|
-
exports.Chatbot = class KRChatbot extends i$
|
|
5590
|
+
exports.Chatbot = class KRChatbot extends i$2 {
|
|
5576
5591
|
constructor() {
|
|
5577
5592
|
super(...arguments);
|
|
5578
5593
|
// --- Private properties ---
|
|
@@ -5590,6 +5605,10 @@
|
|
|
5590
5605
|
this._dragStartTop = 0;
|
|
5591
5606
|
this._resizeStartW = 0;
|
|
5592
5607
|
this._resizeStartH = 0;
|
|
5608
|
+
/** Counter for depth-aware dragenter/dragleave tracking. */
|
|
5609
|
+
this._dragDepth = 0;
|
|
5610
|
+
/** Monotonic id source for pending attachments. */
|
|
5611
|
+
this._pendingSeq = 0;
|
|
5593
5612
|
// --- @property (public API) ---
|
|
5594
5613
|
/**
|
|
5595
5614
|
* Callback function for sending messages. Receives the user's message and
|
|
@@ -5627,11 +5646,21 @@
|
|
|
5627
5646
|
* Whether the chat panel is open. Only relevant in floating mode.
|
|
5628
5647
|
*/
|
|
5629
5648
|
this.opened = false;
|
|
5649
|
+
/**
|
|
5650
|
+
* Hide the built-in floating toggle button. Use this when an external
|
|
5651
|
+
* control (e.g. the site-editor bar) owns opening the chat — the panel is
|
|
5652
|
+
* then driven via the `open()` / `close()` / `toggle()` methods.
|
|
5653
|
+
*/
|
|
5654
|
+
this.hideToggle = false;
|
|
5630
5655
|
// --- @state (internal) ---
|
|
5631
5656
|
this._inputValue = '';
|
|
5632
5657
|
this._isStreaming = false;
|
|
5633
5658
|
this._statusText = '';
|
|
5634
5659
|
this._error = '';
|
|
5660
|
+
/** Images staged in the composer, before the message is sent. */
|
|
5661
|
+
this._pendingAttachments = [];
|
|
5662
|
+
/** True while a file is being dragged over the panel (shows the drop overlay). */
|
|
5663
|
+
this._isDraggingFile = false;
|
|
5635
5664
|
this._handleMouseMove = (e) => {
|
|
5636
5665
|
if (this._isDragging) {
|
|
5637
5666
|
let newLeft = this._dragStartLeft + (e.clientX - this._dragStartX);
|
|
@@ -5710,6 +5739,8 @@
|
|
|
5710
5739
|
}
|
|
5711
5740
|
document.removeEventListener('mousemove', this._handleMouseMove);
|
|
5712
5741
|
document.removeEventListener('mouseup', this._handleMouseUp);
|
|
5742
|
+
// Release any object URLs still held by staged attachments.
|
|
5743
|
+
this._pendingAttachments.forEach((p) => URL.revokeObjectURL(p.previewUrl));
|
|
5713
5744
|
}
|
|
5714
5745
|
updated(changed) {
|
|
5715
5746
|
if (changed.has('messages') || changed.has('_statusText')) {
|
|
@@ -5736,6 +5767,22 @@
|
|
|
5736
5767
|
stop() {
|
|
5737
5768
|
this._handleStop();
|
|
5738
5769
|
}
|
|
5770
|
+
/** Open the chat panel. */
|
|
5771
|
+
open() {
|
|
5772
|
+
if (!this.opened) {
|
|
5773
|
+
this._handleToggle();
|
|
5774
|
+
}
|
|
5775
|
+
}
|
|
5776
|
+
/** Close the chat panel. */
|
|
5777
|
+
close() {
|
|
5778
|
+
if (this.opened) {
|
|
5779
|
+
this._handleToggle();
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
/** Toggle the chat panel open/closed. */
|
|
5783
|
+
toggle() {
|
|
5784
|
+
this._handleToggle();
|
|
5785
|
+
}
|
|
5739
5786
|
// --- Private methods ---
|
|
5740
5787
|
/**
|
|
5741
5788
|
* Shows a full-viewport transparent overlay during drag/resize operations.
|
|
@@ -5904,14 +5951,137 @@
|
|
|
5904
5951
|
this._handleSubmit();
|
|
5905
5952
|
}
|
|
5906
5953
|
}
|
|
5954
|
+
// --- Attachments ---
|
|
5955
|
+
_openFilePicker() {
|
|
5956
|
+
this._fileInputEl?.click();
|
|
5957
|
+
}
|
|
5958
|
+
_handleFileInputChange(e) {
|
|
5959
|
+
const input = e.target;
|
|
5960
|
+
if (input.files) {
|
|
5961
|
+
this._addFiles(input.files);
|
|
5962
|
+
}
|
|
5963
|
+
// Reset so picking the same file again re-fires change.
|
|
5964
|
+
input.value = '';
|
|
5965
|
+
}
|
|
5966
|
+
_handlePaste(e) {
|
|
5967
|
+
const items = e.clipboardData?.items;
|
|
5968
|
+
if (!items) {
|
|
5969
|
+
return;
|
|
5970
|
+
}
|
|
5971
|
+
const files = [];
|
|
5972
|
+
for (let i = 0; i < items.length; i++) {
|
|
5973
|
+
if (items[i].kind === 'file') {
|
|
5974
|
+
const file = items[i].getAsFile();
|
|
5975
|
+
if (file) {
|
|
5976
|
+
files.push(file);
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
}
|
|
5980
|
+
if (files.length) {
|
|
5981
|
+
e.preventDefault();
|
|
5982
|
+
this._addFiles(files);
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5985
|
+
_handleDragEnter(e) {
|
|
5986
|
+
if (!this._hasFiles(e)) {
|
|
5987
|
+
return;
|
|
5988
|
+
}
|
|
5989
|
+
e.preventDefault();
|
|
5990
|
+
this._dragDepth++;
|
|
5991
|
+
this._isDraggingFile = true;
|
|
5992
|
+
}
|
|
5993
|
+
_handleDragOver(e) {
|
|
5994
|
+
if (!this._hasFiles(e)) {
|
|
5995
|
+
return;
|
|
5996
|
+
}
|
|
5997
|
+
// Required so the drop event fires.
|
|
5998
|
+
e.preventDefault();
|
|
5999
|
+
}
|
|
6000
|
+
_handleDragLeave(e) {
|
|
6001
|
+
if (!this._hasFiles(e)) {
|
|
6002
|
+
return;
|
|
6003
|
+
}
|
|
6004
|
+
this._dragDepth--;
|
|
6005
|
+
if (this._dragDepth <= 0) {
|
|
6006
|
+
this._dragDepth = 0;
|
|
6007
|
+
this._isDraggingFile = false;
|
|
6008
|
+
}
|
|
6009
|
+
}
|
|
6010
|
+
_handleDrop(e) {
|
|
6011
|
+
if (!this._hasFiles(e)) {
|
|
6012
|
+
return;
|
|
6013
|
+
}
|
|
6014
|
+
e.preventDefault();
|
|
6015
|
+
this._dragDepth = 0;
|
|
6016
|
+
this._isDraggingFile = false;
|
|
6017
|
+
if (e.dataTransfer?.files) {
|
|
6018
|
+
this._addFiles(e.dataTransfer.files);
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
6021
|
+
_hasFiles(e) {
|
|
6022
|
+
return Array.from(e.dataTransfer?.types || []).includes('Files');
|
|
6023
|
+
}
|
|
6024
|
+
/** Stage a set of image files in the composer (held locally until send). */
|
|
6025
|
+
_addFiles(fileList) {
|
|
6026
|
+
const files = Array.from(fileList).filter((f) => ACCEPTED_IMAGE_TYPES.includes(f.type));
|
|
6027
|
+
if (!files.length) {
|
|
6028
|
+
return;
|
|
6029
|
+
}
|
|
6030
|
+
files.forEach((file) => {
|
|
6031
|
+
const pending = {
|
|
6032
|
+
localId: 'att-' + this._pendingSeq++,
|
|
6033
|
+
file,
|
|
6034
|
+
name: file.name,
|
|
6035
|
+
previewUrl: URL.createObjectURL(file),
|
|
6036
|
+
};
|
|
6037
|
+
this._pendingAttachments = [...this._pendingAttachments, pending];
|
|
6038
|
+
});
|
|
6039
|
+
}
|
|
6040
|
+
_removePending(localId) {
|
|
6041
|
+
const target = this._pendingAttachments.find((p) => p.localId === localId);
|
|
6042
|
+
if (target) {
|
|
6043
|
+
URL.revokeObjectURL(target.previewUrl);
|
|
6044
|
+
}
|
|
6045
|
+
this._pendingAttachments = this._pendingAttachments.filter((p) => p.localId !== localId);
|
|
6046
|
+
}
|
|
6047
|
+
_clearPending() {
|
|
6048
|
+
this._pendingAttachments.forEach((p) => URL.revokeObjectURL(p.previewUrl));
|
|
6049
|
+
this._pendingAttachments = [];
|
|
6050
|
+
}
|
|
6051
|
+
/** Open the shared full-screen previewer for an attachment. */
|
|
6052
|
+
_openAttachment(att) {
|
|
6053
|
+
krubbleComponents.FilePreview.open({
|
|
6054
|
+
src: att.url,
|
|
6055
|
+
name: att.name || 'image',
|
|
6056
|
+
});
|
|
6057
|
+
}
|
|
6058
|
+
/** Whether the send button is active: needs text or at least one image. */
|
|
6059
|
+
_canSend() {
|
|
6060
|
+
return Boolean(this._inputValue.trim()) || this._pendingAttachments.length > 0;
|
|
6061
|
+
}
|
|
5907
6062
|
_handleSubmit() {
|
|
5908
|
-
if (!this.
|
|
6063
|
+
if (!this.send || this._isStreaming) {
|
|
5909
6064
|
return;
|
|
5910
6065
|
}
|
|
5911
6066
|
const messageText = this._inputValue.trim();
|
|
6067
|
+
const pending = this._pendingAttachments;
|
|
6068
|
+
// Allow sending an image with no text, but require at least one of them.
|
|
6069
|
+
if (!messageText && !pending.length) {
|
|
6070
|
+
return;
|
|
6071
|
+
}
|
|
6072
|
+
// The raw files sent to the backend, and the display attachments for the
|
|
6073
|
+
// sent message. The message reuses each preview object URL, so ownership of
|
|
6074
|
+
// those URLs transfers to the message (we don't revoke them here).
|
|
6075
|
+
const files = pending.map((p) => p.file);
|
|
6076
|
+
const attachments = pending.map((p) => ({
|
|
6077
|
+
url: p.previewUrl,
|
|
6078
|
+
name: p.name,
|
|
6079
|
+
mimeType: p.file.type,
|
|
6080
|
+
}));
|
|
5912
6081
|
const submitEvent = new CustomEvent('message-submit', {
|
|
5913
6082
|
detail: {
|
|
5914
6083
|
message: messageText,
|
|
6084
|
+
files,
|
|
5915
6085
|
},
|
|
5916
6086
|
bubbles: true,
|
|
5917
6087
|
composed: true,
|
|
@@ -5921,13 +6091,20 @@
|
|
|
5921
6091
|
if (submitEvent.defaultPrevented) {
|
|
5922
6092
|
return;
|
|
5923
6093
|
}
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
6094
|
+
const userMessage = {
|
|
6095
|
+
role: 'user',
|
|
6096
|
+
content: messageText,
|
|
6097
|
+
};
|
|
6098
|
+
if (attachments.length) {
|
|
6099
|
+
userMessage.attachments = attachments;
|
|
6100
|
+
}
|
|
6101
|
+
this.messages = [...this.messages, userMessage];
|
|
5928
6102
|
this._inputValue = '';
|
|
5929
6103
|
this._error = '';
|
|
5930
6104
|
this._userHasScrolledUp = false;
|
|
6105
|
+
// Clear the composer without revoking the object URLs — the sent message now
|
|
6106
|
+
// owns them for display.
|
|
6107
|
+
this._pendingAttachments = [];
|
|
5931
6108
|
// Reset textarea height
|
|
5932
6109
|
if (this._inputEl) {
|
|
5933
6110
|
this._inputEl.style.height = 'auto';
|
|
@@ -5963,6 +6140,7 @@
|
|
|
5963
6140
|
this.send({
|
|
5964
6141
|
message: messageText,
|
|
5965
6142
|
messages: this.messages.slice(0, -1),
|
|
6143
|
+
files,
|
|
5966
6144
|
}).then((response) => {
|
|
5967
6145
|
if (!response.ok) {
|
|
5968
6146
|
this._handleStreamError('Request failed: ' + response.status);
|
|
@@ -6123,31 +6301,57 @@
|
|
|
6123
6301
|
// --- Render ---
|
|
6124
6302
|
render() {
|
|
6125
6303
|
return b `
|
|
6126
|
-
|
|
6127
|
-
|
|
6304
|
+
${this.hideToggle ? A : b `
|
|
6305
|
+
<button
|
|
6306
|
+
class=${e({
|
|
6128
6307
|
'toggle': true,
|
|
6129
6308
|
'toggle--hidden': this.opened,
|
|
6130
6309
|
})}
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
>
|
|
6134
|
-
<svg
|
|
6135
|
-
viewBox="0 0 24 24"
|
|
6136
|
-
fill="none"
|
|
6137
|
-
stroke="currentColor"
|
|
6138
|
-
stroke-width="2"
|
|
6139
|
-
stroke-linecap="round"
|
|
6140
|
-
class="toggle-icon"
|
|
6310
|
+
@click=${this._handleToggle}
|
|
6311
|
+
title="Open chat"
|
|
6141
6312
|
>
|
|
6142
|
-
<
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6313
|
+
<svg
|
|
6314
|
+
viewBox="0 0 24 24"
|
|
6315
|
+
fill="none"
|
|
6316
|
+
stroke="currentColor"
|
|
6317
|
+
stroke-width="2"
|
|
6318
|
+
stroke-linecap="round"
|
|
6319
|
+
class="toggle-icon"
|
|
6320
|
+
>
|
|
6321
|
+
<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"/>
|
|
6322
|
+
<path d="M8 11h.01M12 11h.01M16 11h.01" stroke-width="2.5"/>
|
|
6323
|
+
</svg>
|
|
6324
|
+
</button>
|
|
6325
|
+
`}
|
|
6146
6326
|
|
|
6147
|
-
<div
|
|
6327
|
+
<div
|
|
6328
|
+
class=${e({
|
|
6148
6329
|
'panel': true,
|
|
6149
6330
|
'panel--opened': this.opened,
|
|
6150
|
-
})}
|
|
6331
|
+
})}
|
|
6332
|
+
@dragenter=${this._handleDragEnter}
|
|
6333
|
+
@dragover=${this._handleDragOver}
|
|
6334
|
+
@dragleave=${this._handleDragLeave}
|
|
6335
|
+
@drop=${this._handleDrop}
|
|
6336
|
+
>
|
|
6337
|
+
${this._isDraggingFile ? b `
|
|
6338
|
+
<div class="drop-overlay">
|
|
6339
|
+
<svg
|
|
6340
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6341
|
+
fill="none"
|
|
6342
|
+
viewBox="0 0 24 24"
|
|
6343
|
+
stroke-width="1.5"
|
|
6344
|
+
stroke="currentColor"
|
|
6345
|
+
>
|
|
6346
|
+
<path
|
|
6347
|
+
stroke-linecap="round"
|
|
6348
|
+
stroke-linejoin="round"
|
|
6349
|
+
d="M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"
|
|
6350
|
+
/>
|
|
6351
|
+
</svg>
|
|
6352
|
+
<span>Drop images to attach</span>
|
|
6353
|
+
</div>
|
|
6354
|
+
` : A}
|
|
6151
6355
|
<div
|
|
6152
6356
|
class="resize resize--n"
|
|
6153
6357
|
data-dir="n"
|
|
@@ -6261,6 +6465,20 @@
|
|
|
6261
6465
|
<div class="reasoning-content">${msg.reasoning}</div>
|
|
6262
6466
|
</details>
|
|
6263
6467
|
` : A}
|
|
6468
|
+
${msg.attachments && msg.attachments.length ? b `
|
|
6469
|
+
<div class="attachments">
|
|
6470
|
+
${msg.attachments.map((att) => b `
|
|
6471
|
+
<button
|
|
6472
|
+
class="attachment"
|
|
6473
|
+
type="button"
|
|
6474
|
+
title=${att.name || 'View image'}
|
|
6475
|
+
@click=${() => this._openAttachment(att)}
|
|
6476
|
+
>
|
|
6477
|
+
<img src=${att.url} alt=${att.name || ''} />
|
|
6478
|
+
</button>
|
|
6479
|
+
`)}
|
|
6480
|
+
</div>
|
|
6481
|
+
` : A}
|
|
6264
6482
|
${msg.content ? b `
|
|
6265
6483
|
<div class="message-content">
|
|
6266
6484
|
${msg.role === 'user'
|
|
@@ -6302,8 +6520,48 @@
|
|
|
6302
6520
|
` : A}
|
|
6303
6521
|
|
|
6304
6522
|
<div class="footer">
|
|
6523
|
+
${this._pendingAttachments.length ? b `
|
|
6524
|
+
<div class="composer-attachments">
|
|
6525
|
+
${c(this._pendingAttachments, (p) => p.localId, (p) => b `
|
|
6526
|
+
<div class="chip">
|
|
6527
|
+
<img src=${p.previewUrl} alt=${p.name} />
|
|
6528
|
+
<button
|
|
6529
|
+
class="chip-remove"
|
|
6530
|
+
title="Remove"
|
|
6531
|
+
@click=${() => this._removePending(p.localId)}
|
|
6532
|
+
>
|
|
6533
|
+
<svg
|
|
6534
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6535
|
+
fill="none"
|
|
6536
|
+
viewBox="0 0 24 24"
|
|
6537
|
+
stroke-width="3"
|
|
6538
|
+
stroke="currentColor"
|
|
6539
|
+
>
|
|
6540
|
+
<path
|
|
6541
|
+
stroke-linecap="round"
|
|
6542
|
+
stroke-linejoin="round"
|
|
6543
|
+
d="M6 18 18 6M6 6l12 12"
|
|
6544
|
+
/>
|
|
6545
|
+
</svg>
|
|
6546
|
+
</button>
|
|
6547
|
+
</div>
|
|
6548
|
+
`)}
|
|
6549
|
+
</div>
|
|
6550
|
+
` : A}
|
|
6551
|
+
<input
|
|
6552
|
+
class="file-input"
|
|
6553
|
+
type="file"
|
|
6554
|
+
accept="image/png,image/jpeg,image/gif,image/webp"
|
|
6555
|
+
multiple
|
|
6556
|
+
hidden
|
|
6557
|
+
@change=${this._handleFileInputChange}
|
|
6558
|
+
/>
|
|
6305
6559
|
<div class="input-wrapper">
|
|
6306
|
-
<button
|
|
6560
|
+
<button
|
|
6561
|
+
class="input-plus"
|
|
6562
|
+
title="Attach image"
|
|
6563
|
+
@click=${this._openFilePicker}
|
|
6564
|
+
>+</button>
|
|
6307
6565
|
<textarea
|
|
6308
6566
|
class="input"
|
|
6309
6567
|
.value=${this._inputValue}
|
|
@@ -6311,6 +6569,7 @@
|
|
|
6311
6569
|
rows="1"
|
|
6312
6570
|
@input=${this._handleInputChange}
|
|
6313
6571
|
@keydown=${this._handleKeyDown}
|
|
6572
|
+
@paste=${this._handlePaste}
|
|
6314
6573
|
></textarea>
|
|
6315
6574
|
${this._isStreaming ? b `
|
|
6316
6575
|
<button
|
|
@@ -6337,7 +6596,7 @@
|
|
|
6337
6596
|
<button
|
|
6338
6597
|
class=${e({
|
|
6339
6598
|
'send': true,
|
|
6340
|
-
'send--disabled': !this.
|
|
6599
|
+
'send--disabled': !this._canSend(),
|
|
6341
6600
|
})}
|
|
6342
6601
|
@click=${this._handleSubmit}
|
|
6343
6602
|
title="Send message"
|
|
@@ -6362,7 +6621,7 @@
|
|
|
6362
6621
|
`;
|
|
6363
6622
|
}
|
|
6364
6623
|
};
|
|
6365
|
-
exports.Chatbot.styles = i$
|
|
6624
|
+
exports.Chatbot.styles = i$5 `
|
|
6366
6625
|
*,
|
|
6367
6626
|
*::before,
|
|
6368
6627
|
*::after {
|
|
@@ -6904,6 +7163,116 @@
|
|
|
6904
7163
|
.resize--sw { bottom: -4px; left: -4px; width: 16px; height: 16px; cursor: sw-resize; }
|
|
6905
7164
|
.resize--se { bottom: -4px; right: -4px; width: 16px; height: 16px; cursor: se-resize; }
|
|
6906
7165
|
|
|
7166
|
+
/* Attachment thumbnails inside a sent message bubble */
|
|
7167
|
+
.attachments {
|
|
7168
|
+
display: flex;
|
|
7169
|
+
flex-wrap: wrap;
|
|
7170
|
+
gap: 8px;
|
|
7171
|
+
}
|
|
7172
|
+
|
|
7173
|
+
.message--user .attachments {
|
|
7174
|
+
justify-content: flex-end;
|
|
7175
|
+
}
|
|
7176
|
+
|
|
7177
|
+
.attachment {
|
|
7178
|
+
width: 120px;
|
|
7179
|
+
height: 120px;
|
|
7180
|
+
border-radius: 12px;
|
|
7181
|
+
overflow: hidden;
|
|
7182
|
+
background: #f2f2f4;
|
|
7183
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
7184
|
+
cursor: zoom-in;
|
|
7185
|
+
flex-shrink: 0;
|
|
7186
|
+
padding: 0;
|
|
7187
|
+
}
|
|
7188
|
+
|
|
7189
|
+
.attachment img {
|
|
7190
|
+
width: 100%;
|
|
7191
|
+
height: 100%;
|
|
7192
|
+
object-fit: cover;
|
|
7193
|
+
display: block;
|
|
7194
|
+
}
|
|
7195
|
+
|
|
7196
|
+
/* Composer attachment chips (pre-send) */
|
|
7197
|
+
.composer-attachments {
|
|
7198
|
+
display: flex;
|
|
7199
|
+
flex-wrap: wrap;
|
|
7200
|
+
gap: 8px;
|
|
7201
|
+
padding: 0 6px 10px;
|
|
7202
|
+
}
|
|
7203
|
+
|
|
7204
|
+
.chip {
|
|
7205
|
+
position: relative;
|
|
7206
|
+
width: 56px;
|
|
7207
|
+
height: 56px;
|
|
7208
|
+
border-radius: 10px;
|
|
7209
|
+
overflow: hidden;
|
|
7210
|
+
background: #f2f2f4;
|
|
7211
|
+
border: 1px solid var(--kr-chatbot-border);
|
|
7212
|
+
flex-shrink: 0;
|
|
7213
|
+
}
|
|
7214
|
+
|
|
7215
|
+
.chip img {
|
|
7216
|
+
width: 100%;
|
|
7217
|
+
height: 100%;
|
|
7218
|
+
object-fit: cover;
|
|
7219
|
+
display: block;
|
|
7220
|
+
}
|
|
7221
|
+
|
|
7222
|
+
.chip-remove {
|
|
7223
|
+
position: absolute;
|
|
7224
|
+
top: 2px;
|
|
7225
|
+
right: 2px;
|
|
7226
|
+
width: 18px;
|
|
7227
|
+
height: 18px;
|
|
7228
|
+
border-radius: 50%;
|
|
7229
|
+
border: none;
|
|
7230
|
+
background: rgba(0, 0, 0, 0.6);
|
|
7231
|
+
color: #fff;
|
|
7232
|
+
cursor: pointer;
|
|
7233
|
+
display: flex;
|
|
7234
|
+
align-items: center;
|
|
7235
|
+
justify-content: center;
|
|
7236
|
+
padding: 0;
|
|
7237
|
+
line-height: 1;
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
.chip-remove:hover {
|
|
7241
|
+
background: rgba(0, 0, 0, 0.8);
|
|
7242
|
+
}
|
|
7243
|
+
|
|
7244
|
+
.chip-remove svg {
|
|
7245
|
+
width: 10px;
|
|
7246
|
+
height: 10px;
|
|
7247
|
+
}
|
|
7248
|
+
|
|
7249
|
+
/* Drag-and-drop overlay */
|
|
7250
|
+
.drop-overlay {
|
|
7251
|
+
position: absolute;
|
|
7252
|
+
inset: 0;
|
|
7253
|
+
z-index: 20;
|
|
7254
|
+
display: flex;
|
|
7255
|
+
align-items: center;
|
|
7256
|
+
justify-content: center;
|
|
7257
|
+
flex-direction: column;
|
|
7258
|
+
gap: 10px;
|
|
7259
|
+
/* Frosted, mostly-opaque surface so the chat content behind is masked
|
|
7260
|
+
and doesn't clash with the overlay label. */
|
|
7261
|
+
background: rgba(255, 255, 255, 0.92);
|
|
7262
|
+
backdrop-filter: blur(3px);
|
|
7263
|
+
border: 2px dashed var(--kr-chatbot-primary);
|
|
7264
|
+
border-radius: 16px;
|
|
7265
|
+
color: var(--kr-chatbot-primary);
|
|
7266
|
+
font-weight: 600;
|
|
7267
|
+
font-size: 15px;
|
|
7268
|
+
pointer-events: none;
|
|
7269
|
+
}
|
|
7270
|
+
|
|
7271
|
+
.drop-overlay svg {
|
|
7272
|
+
width: 32px;
|
|
7273
|
+
height: 32px;
|
|
7274
|
+
}
|
|
7275
|
+
|
|
6907
7276
|
`;
|
|
6908
7277
|
__decorate([
|
|
6909
7278
|
n({ attribute: false })
|
|
@@ -6932,6 +7301,13 @@
|
|
|
6932
7301
|
reflect: true
|
|
6933
7302
|
})
|
|
6934
7303
|
], exports.Chatbot.prototype, "opened", void 0);
|
|
7304
|
+
__decorate([
|
|
7305
|
+
n({
|
|
7306
|
+
type: Boolean,
|
|
7307
|
+
attribute: 'hide-toggle',
|
|
7308
|
+
reflect: true
|
|
7309
|
+
})
|
|
7310
|
+
], exports.Chatbot.prototype, "hideToggle", void 0);
|
|
6935
7311
|
__decorate([
|
|
6936
7312
|
r()
|
|
6937
7313
|
], exports.Chatbot.prototype, "_inputValue", void 0);
|
|
@@ -6944,6 +7320,12 @@
|
|
|
6944
7320
|
__decorate([
|
|
6945
7321
|
r()
|
|
6946
7322
|
], exports.Chatbot.prototype, "_error", void 0);
|
|
7323
|
+
__decorate([
|
|
7324
|
+
r()
|
|
7325
|
+
], exports.Chatbot.prototype, "_pendingAttachments", void 0);
|
|
7326
|
+
__decorate([
|
|
7327
|
+
r()
|
|
7328
|
+
], exports.Chatbot.prototype, "_isDraggingFile", void 0);
|
|
6947
7329
|
__decorate([
|
|
6948
7330
|
e$3('.panel')
|
|
6949
7331
|
], exports.Chatbot.prototype, "_panelEl", void 0);
|
|
@@ -6953,8 +7335,11 @@
|
|
|
6953
7335
|
__decorate([
|
|
6954
7336
|
e$3('.input')
|
|
6955
7337
|
], exports.Chatbot.prototype, "_inputEl", void 0);
|
|
7338
|
+
__decorate([
|
|
7339
|
+
e$3('.file-input')
|
|
7340
|
+
], exports.Chatbot.prototype, "_fileInputEl", void 0);
|
|
6956
7341
|
exports.Chatbot = __decorate([
|
|
6957
|
-
t$
|
|
7342
|
+
t$2('kr-chatbot')
|
|
6958
7343
|
], exports.Chatbot);
|
|
6959
7344
|
|
|
6960
7345
|
exports.Router = KRRouter;
|