@quidgest/chatbot 0.5.0 → 0.5.1
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/index.js +3 -3
- package/dist/index.mjs +60 -60
- package/package.json +3 -3
- package/src/components/ChatBot/ChatBot.vue +0 -2
- package/src/composables/useSSE.ts +5 -2
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* focus-trap 7.6.4
|
|
6
6
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
7
7
|
*/function ke(e,n){(n==null||n>e.length)&&(n=e.length);for(var o=0,a=Array(n);o<n;o++)a[o]=e[o];return a}function cn(e){if(Array.isArray(e))return ke(e)}function dn(e,n,o){return(n=gn(n))in e?Object.defineProperty(e,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[n]=o,e}function un(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ue(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),o.push.apply(o,a)}return o}function qe(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?Ue(Object(o),!0).forEach(function(a){dn(e,a,o[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Ue(Object(o)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(o,a))})}return e}function fn(e){return cn(e)||un(e)||bn(e)||pn()}function mn(e,n){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var a=o.call(e,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function gn(e){var n=mn(e,"string");return typeof n=="symbol"?n:n+""}function bn(e,n){if(e){if(typeof e=="string")return ke(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?ke(e,n):void 0}}var je={activateTrap:function(e,n){if(e.length>0){var o=e[e.length-1];o!==n&&o._setPausedState(!0)}var a=e.indexOf(n);a===-1||e.splice(a,1),e.push(n)},deactivateTrap:function(e,n){var o=e.indexOf(n);o!==-1&&e.splice(o,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}},hn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},yn=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},oe=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},wn=function(e){return oe(e)&&!e.shiftKey},vn=function(e){return oe(e)&&e.shiftKey},Ge=function(e){return setTimeout(e,0)},ae=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return typeof e=="function"?e.apply(void 0,o):e},ue=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},kn=[],Bn=function(e,n){var o=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||kn,r=qe({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:wn,isKeyBackward:vn},n),l={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},i,s=function(d,p,w){return d&&d[p]!==void 0?d[p]:r[w||p]},u=function(d,p){var w=typeof(p==null?void 0:p.composedPath)=="function"?p.composedPath():void 0;return l.containerGroups.findIndex(function(A){var B=A.container,D=A.tabbableNodes;return B.contains(d)||(w==null?void 0:w.includes(B))||D.find(function(C){return C===d})})},f=function(d){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=p.hasFallback,A=w===void 0?!1:w,B=p.params,D=B===void 0?[]:B,C=r[d];if(typeof C=="function"&&(C=C.apply(void 0,fn(D))),C===!0&&(C=void 0),!C){if(C===void 0||C===!1)return C;throw new Error("`".concat(d,"` was specified but was not a node, or did not return a node"))}var b=C;if(typeof C=="string"){try{b=o.querySelector(C)}catch(h){throw new Error("`".concat(d,'` appears to be an invalid selector; error="').concat(h.message,'"'))}if(!b&&!A)throw new Error("`".concat(d,"` as selector refers to no known node"))}return b},g=function(){var d=f("initialFocus",{hasFallback:!0});if(d===!1)return!1;if(d===void 0||d&&!ve(d,r.tabbableOptions))if(u(o.activeElement)>=0)d=o.activeElement;else{var p=l.tabbableGroups[0],w=p&&p.firstTabbableNode;d=w||f("fallbackFocus")}else d===null&&(d=f("fallbackFocus"));if(!d)throw new Error("Your focus-trap needs to have at least one focusable element");return d},c=function(){if(l.containerGroups=l.containers.map(function(d){var p=rn(d,r.tabbableOptions),w=ln(d,r.tabbableOptions),A=p.length>0?p[0]:void 0,B=p.length>0?p[p.length-1]:void 0,D=w.find(function(h){return Y(h)}),C=w.slice().reverse().find(function(h){return Y(h)}),b=!!p.find(function(h){return z(h)>0});return{container:d,tabbableNodes:p,focusableNodes:w,posTabIndexesFound:b,firstTabbableNode:A,lastTabbableNode:B,firstDomTabbableNode:D,lastDomTabbableNode:C,nextTabbableNode:function(h){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=p.indexOf(h);return T<0?E?w.slice(w.indexOf(h)+1).find(function(L){return Y(L)}):w.slice(0,w.indexOf(h)).reverse().find(function(L){return Y(L)}):p[T+(E?1:-1)]}}}),l.tabbableGroups=l.containerGroups.filter(function(d){return d.tabbableNodes.length>0}),l.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(l.containerGroups.find(function(d){return d.posTabIndexesFound})&&l.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function(d){var p=d.activeElement;if(p)return p.shadowRoot&&p.shadowRoot.activeElement!==null?m(p.shadowRoot):p},y=function(d){if(d!==!1&&d!==m(document)){if(!d||!d.focus){y(g());return}d.focus({preventScroll:!!r.preventScroll}),l.mostRecentlyFocusedNode=d,hn(d)&&d.select()}},x=function(d){var p=f("setReturnFocus",{params:[d]});return p||(p===!1?!1:d)},$=function(d){var p=d.target,w=d.event,A=d.isBackward,B=A===void 0?!1:A;p=p||ue(w),c();var D=null;if(l.tabbableGroups.length>0){var C=u(p,w),b=C>=0?l.containerGroups[C]:void 0;if(C<0)B?D=l.tabbableGroups[l.tabbableGroups.length-1].lastTabbableNode:D=l.tabbableGroups[0].firstTabbableNode;else if(B){var h=l.tabbableGroups.findIndex(function(ee){var le=ee.firstTabbableNode;return p===le});if(h<0&&(b.container===p||ve(p,r.tabbableOptions)&&!Y(p,r.tabbableOptions)&&!b.nextTabbableNode(p,!1))&&(h=C),h>=0){var E=h===0?l.tabbableGroups.length-1:h-1,T=l.tabbableGroups[E];D=z(p)>=0?T.lastTabbableNode:T.lastDomTabbableNode}else oe(w)||(D=b.nextTabbableNode(p,!1))}else{var L=l.tabbableGroups.findIndex(function(ee){var le=ee.lastTabbableNode;return p===le});if(L<0&&(b.container===p||ve(p,r.tabbableOptions)&&!Y(p,r.tabbableOptions)&&!b.nextTabbableNode(p))&&(L=C),L>=0){var Z=L===l.tabbableGroups.length-1?0:L+1,K=l.tabbableGroups[Z];D=z(p)>=0?K.firstTabbableNode:K.firstDomTabbableNode}else oe(w)||(D=b.nextTabbableNode(p))}}else D=f("fallbackFocus");return D},S=function(d){var p=ue(d);if(!(u(p,d)>=0)){if(ae(r.clickOutsideDeactivates,d)){i.deactivate({returnFocus:r.returnFocusOnDeactivate});return}ae(r.allowOutsideClick,d)||d.preventDefault()}},U=function(d){var p=ue(d),w=u(p,d)>=0;if(w||p instanceof Document)w&&(l.mostRecentlyFocusedNode=p);else{d.stopImmediatePropagation();var A,B=!0;if(l.mostRecentlyFocusedNode)if(z(l.mostRecentlyFocusedNode)>0){var D=u(l.mostRecentlyFocusedNode),C=l.containerGroups[D].tabbableNodes;if(C.length>0){var b=C.findIndex(function(h){return h===l.mostRecentlyFocusedNode});b>=0&&(r.isKeyForward(l.recentNavEvent)?b+1<C.length&&(A=C[b+1],B=!1):b-1>=0&&(A=C[b-1],B=!1))}}else l.containerGroups.some(function(h){return h.tabbableNodes.some(function(E){return z(E)>0})})||(B=!1);else B=!1;B&&(A=$({target:l.mostRecentlyFocusedNode,isBackward:r.isKeyBackward(l.recentNavEvent)})),y(A||l.mostRecentlyFocusedNode||g())}l.recentNavEvent=void 0},M=function(d){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;l.recentNavEvent=d;var w=$({event:d,isBackward:p});w&&(oe(d)&&d.preventDefault(),y(w))},F=function(d){(r.isKeyForward(d)||r.isKeyBackward(d))&&M(d,r.isKeyBackward(d))},_=function(d){yn(d)&&ae(r.escapeDeactivates,d)!==!1&&(d.preventDefault(),i.deactivate())},I=function(d){var p=ue(d);u(p,d)>=0||ae(r.clickOutsideDeactivates,d)||ae(r.allowOutsideClick,d)||(d.preventDefault(),d.stopImmediatePropagation())},k=function(){if(l.active)return je.activateTrap(a,i),l.delayInitialFocusTimer=r.delayInitialFocus?Ge(function(){y(g())}):y(g()),o.addEventListener("focusin",U,!0),o.addEventListener("mousedown",S,{capture:!0,passive:!1}),o.addEventListener("touchstart",S,{capture:!0,passive:!1}),o.addEventListener("click",I,{capture:!0,passive:!1}),o.addEventListener("keydown",F,{capture:!0,passive:!1}),o.addEventListener("keydown",_),i},N=function(){if(l.active)return o.removeEventListener("focusin",U,!0),o.removeEventListener("mousedown",S,!0),o.removeEventListener("touchstart",S,!0),o.removeEventListener("click",I,!0),o.removeEventListener("keydown",F,!0),o.removeEventListener("keydown",_),i},V=function(d){var p=d.some(function(w){var A=Array.from(w.removedNodes);return A.some(function(B){return B===l.mostRecentlyFocusedNode})});p&&y(g())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(V):void 0,O=function(){R&&(R.disconnect(),l.active&&!l.paused&&l.containers.map(function(d){R.observe(d,{subtree:!0,childList:!0})}))};return i={get active(){return l.active},get paused(){return l.paused},activate:function(d){if(l.active)return this;var p=s(d,"onActivate"),w=s(d,"onPostActivate"),A=s(d,"checkCanFocusTrap");A||c(),l.active=!0,l.paused=!1,l.nodeFocusedBeforeActivation=o.activeElement,p==null||p();var B=function(){A&&c(),k(),O(),w==null||w()};return A?(A(l.containers.concat()).then(B,B),this):(B(),this)},deactivate:function(d){if(!l.active)return this;var p=qe({onDeactivate:r.onDeactivate,onPostDeactivate:r.onPostDeactivate,checkCanReturnFocus:r.checkCanReturnFocus},d);clearTimeout(l.delayInitialFocusTimer),l.delayInitialFocusTimer=void 0,N(),l.active=!1,l.paused=!1,O(),je.deactivateTrap(a,i);var w=s(p,"onDeactivate"),A=s(p,"onPostDeactivate"),B=s(p,"checkCanReturnFocus"),D=s(p,"returnFocus","returnFocusOnDeactivate");w==null||w();var C=function(){Ge(function(){D&&y(x(l.nodeFocusedBeforeActivation)),A==null||A()})};return D&&B?(B(x(l.nodeFocusedBeforeActivation)).then(C,C),this):(C(),this)},pause:function(d){return l.active?(l.manuallyPaused=!0,this._setPausedState(!0,d)):this},unpause:function(d){return l.active?(l.manuallyPaused=!1,a[a.length-1]!==this?this:this._setPausedState(!1,d)):this},updateContainerElements:function(d){var p=[].concat(d).filter(Boolean);return l.containers=p.map(function(w){return typeof w=="string"?o.querySelector(w):w}),l.active&&c(),O(),this}},Object.defineProperties(i,{_isManuallyPaused:{value:function(){return l.manuallyPaused}},_setPausedState:{value:function(d,p){if(l.paused===d)return this;if(l.paused=d,d){var w=s(p,"onPause"),A=s(p,"onPostPause");w==null||w(),N(),O(),A==null||A()}else{var B=s(p,"onUnpause"),D=s(p,"onPostUnpause");B==null||B(),c(),k(),O(),D==null||D()}return this}}}),i.updateContainerElements(e),i};const En=t.defineComponent({name:"UseFocusTrap",props:["as","options"],setup(e,{slots:n}){let o;const a=t.ref(),r=()=>o&&o.activate(),l=()=>o&&o.deactivate();return t.watch(()=>Gt(a),i=>{i&&(o=Bn(i,e.options||{}),r())},{flush:"post"}),t.onScopeDispose(()=>l()),()=>{if(n.default)return t.h(e.as||"div",{ref:a},n.default())}}}),Cn=q(t.defineComponent({__name:"QFocusTrap",props:t.mergeModels({options:{},as:{}},{disabled:{type:Boolean},disabledModifiers:{}}),emits:["update:disabled"],setup(e){const n=e,o=t.useModel(e,"disabled");return(a,r)=>o.value?t.renderSlot(a.$slots,"default",{key:0}):(t.openBlock(),t.createBlock(t.unref(En),t.normalizeProps(t.mergeProps({key:1},n)),{default:t.withCtx(()=>[t.renderSlot(a.$slots,"default")]),_:3},16))}})),Q="data-scroll-locked",Be="right-scroll-bar-position",Ee="width-before-scroll-bar",_n="with-scroll-bars-hidden",An="--removed-body-scroll-bar-size",Nn={left:0,top:0,right:0,gap:0},Ce=e=>parseInt(e||"",10)||0,Sn=e=>{const n=window.getComputedStyle(document.body),o=n[e==="padding"?"paddingLeft":"marginLeft"],a=n[e==="padding"?"paddingTop":"marginTop"],r=n[e==="padding"?"paddingRight":"marginRight"];return[Ce(o),Ce(a),Ce(r)]},In=(e="margin")=>{if(typeof window>"u")return Nn;const n=Sn(e),o=document.documentElement.clientWidth,a=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,a-o+n[2]-n[0])}};function xn(){return document?document.createElement("style"):null}function Dn(e,n){e.appendChild(document.createTextNode(n))}function $n(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}const Ln=()=>{let e=0,n=null;return{add:o=>{e===0&&(n=xn())&&(Dn(n,o),$n(n)),e++},remove:()=>{var o;e--,!e&&n&&((o=n.parentNode)==null||o.removeChild(n),n=null)}}},Mn=q(t.defineComponent({__name:"QRemoveScrollBar",props:{noRelative:{type:Boolean},noImportant:{type:Boolean},gapMode:{default:"margin"}},setup(e){const n=e,o=Ln(),a=()=>{const l=parseInt(document.body.getAttribute(Q)||"0",10);return isFinite(l)?l:0},r=({left:l,top:i,right:s,gap:u},f,g="margin",c)=>`
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ue(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),o.push.apply(o,a)}return o}function qe(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};n%2?Ue(Object(o),!0).forEach(function(a){dn(e,a,o[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Ue(Object(o)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(o,a))})}return e}function fn(e){return cn(e)||un(e)||bn(e)||pn()}function mn(e,n){if(typeof e!="object"||!e)return e;var o=e[Symbol.toPrimitive];if(o!==void 0){var a=o.call(e,n);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function gn(e){var n=mn(e,"string");return typeof n=="symbol"?n:n+""}function bn(e,n){if(e){if(typeof e=="string")return ke(e,n);var o={}.toString.call(e).slice(8,-1);return o==="Object"&&e.constructor&&(o=e.constructor.name),o==="Map"||o==="Set"?Array.from(e):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?ke(e,n):void 0}}var je={activateTrap:function(e,n){if(e.length>0){var o=e[e.length-1];o!==n&&o._setPausedState(!0)}var a=e.indexOf(n);a===-1||e.splice(a,1),e.push(n)},deactivateTrap:function(e,n){var o=e.indexOf(n);o!==-1&&e.splice(o,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}},hn=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},yn=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},oe=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},wn=function(e){return oe(e)&&!e.shiftKey},vn=function(e){return oe(e)&&e.shiftKey},Ge=function(e){return setTimeout(e,0)},ae=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return typeof e=="function"?e.apply(void 0,o):e},ue=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},kn=[],Bn=function(e,n){var o=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||kn,r=qe({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:wn,isKeyBackward:vn},n),l={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},i,s=function(d,p,w){return d&&d[p]!==void 0?d[p]:r[w||p]},u=function(d,p){var w=typeof(p==null?void 0:p.composedPath)=="function"?p.composedPath():void 0;return l.containerGroups.findIndex(function(A){var B=A.container,D=A.tabbableNodes;return B.contains(d)||(w==null?void 0:w.includes(B))||D.find(function(_){return _===d})})},f=function(d){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},w=p.hasFallback,A=w===void 0?!1:w,B=p.params,D=B===void 0?[]:B,_=r[d];if(typeof _=="function"&&(_=_.apply(void 0,fn(D))),_===!0&&(_=void 0),!_){if(_===void 0||_===!1)return _;throw new Error("`".concat(d,"` was specified but was not a node, or did not return a node"))}var b=_;if(typeof _=="string"){try{b=o.querySelector(_)}catch(h){throw new Error("`".concat(d,'` appears to be an invalid selector; error="').concat(h.message,'"'))}if(!b&&!A)throw new Error("`".concat(d,"` as selector refers to no known node"))}return b},g=function(){var d=f("initialFocus",{hasFallback:!0});if(d===!1)return!1;if(d===void 0||d&&!ve(d,r.tabbableOptions))if(u(o.activeElement)>=0)d=o.activeElement;else{var p=l.tabbableGroups[0],w=p&&p.firstTabbableNode;d=w||f("fallbackFocus")}else d===null&&(d=f("fallbackFocus"));if(!d)throw new Error("Your focus-trap needs to have at least one focusable element");return d},c=function(){if(l.containerGroups=l.containers.map(function(d){var p=rn(d,r.tabbableOptions),w=ln(d,r.tabbableOptions),A=p.length>0?p[0]:void 0,B=p.length>0?p[p.length-1]:void 0,D=w.find(function(h){return Y(h)}),_=w.slice().reverse().find(function(h){return Y(h)}),b=!!p.find(function(h){return z(h)>0});return{container:d,tabbableNodes:p,focusableNodes:w,posTabIndexesFound:b,firstTabbableNode:A,lastTabbableNode:B,firstDomTabbableNode:D,lastDomTabbableNode:_,nextTabbableNode:function(h){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=p.indexOf(h);return T<0?E?w.slice(w.indexOf(h)+1).find(function(L){return Y(L)}):w.slice(0,w.indexOf(h)).reverse().find(function(L){return Y(L)}):p[T+(E?1:-1)]}}}),l.tabbableGroups=l.containerGroups.filter(function(d){return d.tabbableNodes.length>0}),l.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(l.containerGroups.find(function(d){return d.posTabIndexesFound})&&l.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function(d){var p=d.activeElement;if(p)return p.shadowRoot&&p.shadowRoot.activeElement!==null?m(p.shadowRoot):p},y=function(d){if(d!==!1&&d!==m(document)){if(!d||!d.focus){y(g());return}d.focus({preventScroll:!!r.preventScroll}),l.mostRecentlyFocusedNode=d,hn(d)&&d.select()}},x=function(d){var p=f("setReturnFocus",{params:[d]});return p||(p===!1?!1:d)},$=function(d){var p=d.target,w=d.event,A=d.isBackward,B=A===void 0?!1:A;p=p||ue(w),c();var D=null;if(l.tabbableGroups.length>0){var _=u(p,w),b=_>=0?l.containerGroups[_]:void 0;if(_<0)B?D=l.tabbableGroups[l.tabbableGroups.length-1].lastTabbableNode:D=l.tabbableGroups[0].firstTabbableNode;else if(B){var h=l.tabbableGroups.findIndex(function(ee){var le=ee.firstTabbableNode;return p===le});if(h<0&&(b.container===p||ve(p,r.tabbableOptions)&&!Y(p,r.tabbableOptions)&&!b.nextTabbableNode(p,!1))&&(h=_),h>=0){var E=h===0?l.tabbableGroups.length-1:h-1,T=l.tabbableGroups[E];D=z(p)>=0?T.lastTabbableNode:T.lastDomTabbableNode}else oe(w)||(D=b.nextTabbableNode(p,!1))}else{var L=l.tabbableGroups.findIndex(function(ee){var le=ee.lastTabbableNode;return p===le});if(L<0&&(b.container===p||ve(p,r.tabbableOptions)&&!Y(p,r.tabbableOptions)&&!b.nextTabbableNode(p))&&(L=_),L>=0){var Z=L===l.tabbableGroups.length-1?0:L+1,K=l.tabbableGroups[Z];D=z(p)>=0?K.firstTabbableNode:K.firstDomTabbableNode}else oe(w)||(D=b.nextTabbableNode(p))}}else D=f("fallbackFocus");return D},S=function(d){var p=ue(d);if(!(u(p,d)>=0)){if(ae(r.clickOutsideDeactivates,d)){i.deactivate({returnFocus:r.returnFocusOnDeactivate});return}ae(r.allowOutsideClick,d)||d.preventDefault()}},U=function(d){var p=ue(d),w=u(p,d)>=0;if(w||p instanceof Document)w&&(l.mostRecentlyFocusedNode=p);else{d.stopImmediatePropagation();var A,B=!0;if(l.mostRecentlyFocusedNode)if(z(l.mostRecentlyFocusedNode)>0){var D=u(l.mostRecentlyFocusedNode),_=l.containerGroups[D].tabbableNodes;if(_.length>0){var b=_.findIndex(function(h){return h===l.mostRecentlyFocusedNode});b>=0&&(r.isKeyForward(l.recentNavEvent)?b+1<_.length&&(A=_[b+1],B=!1):b-1>=0&&(A=_[b-1],B=!1))}}else l.containerGroups.some(function(h){return h.tabbableNodes.some(function(E){return z(E)>0})})||(B=!1);else B=!1;B&&(A=$({target:l.mostRecentlyFocusedNode,isBackward:r.isKeyBackward(l.recentNavEvent)})),y(A||l.mostRecentlyFocusedNode||g())}l.recentNavEvent=void 0},M=function(d){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;l.recentNavEvent=d;var w=$({event:d,isBackward:p});w&&(oe(d)&&d.preventDefault(),y(w))},F=function(d){(r.isKeyForward(d)||r.isKeyBackward(d))&&M(d,r.isKeyBackward(d))},C=function(d){yn(d)&&ae(r.escapeDeactivates,d)!==!1&&(d.preventDefault(),i.deactivate())},I=function(d){var p=ue(d);u(p,d)>=0||ae(r.clickOutsideDeactivates,d)||ae(r.allowOutsideClick,d)||(d.preventDefault(),d.stopImmediatePropagation())},k=function(){if(l.active)return je.activateTrap(a,i),l.delayInitialFocusTimer=r.delayInitialFocus?Ge(function(){y(g())}):y(g()),o.addEventListener("focusin",U,!0),o.addEventListener("mousedown",S,{capture:!0,passive:!1}),o.addEventListener("touchstart",S,{capture:!0,passive:!1}),o.addEventListener("click",I,{capture:!0,passive:!1}),o.addEventListener("keydown",F,{capture:!0,passive:!1}),o.addEventListener("keydown",C),i},N=function(){if(l.active)return o.removeEventListener("focusin",U,!0),o.removeEventListener("mousedown",S,!0),o.removeEventListener("touchstart",S,!0),o.removeEventListener("click",I,!0),o.removeEventListener("keydown",F,!0),o.removeEventListener("keydown",C),i},V=function(d){var p=d.some(function(w){var A=Array.from(w.removedNodes);return A.some(function(B){return B===l.mostRecentlyFocusedNode})});p&&y(g())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(V):void 0,O=function(){R&&(R.disconnect(),l.active&&!l.paused&&l.containers.map(function(d){R.observe(d,{subtree:!0,childList:!0})}))};return i={get active(){return l.active},get paused(){return l.paused},activate:function(d){if(l.active)return this;var p=s(d,"onActivate"),w=s(d,"onPostActivate"),A=s(d,"checkCanFocusTrap");A||c(),l.active=!0,l.paused=!1,l.nodeFocusedBeforeActivation=o.activeElement,p==null||p();var B=function(){A&&c(),k(),O(),w==null||w()};return A?(A(l.containers.concat()).then(B,B),this):(B(),this)},deactivate:function(d){if(!l.active)return this;var p=qe({onDeactivate:r.onDeactivate,onPostDeactivate:r.onPostDeactivate,checkCanReturnFocus:r.checkCanReturnFocus},d);clearTimeout(l.delayInitialFocusTimer),l.delayInitialFocusTimer=void 0,N(),l.active=!1,l.paused=!1,O(),je.deactivateTrap(a,i);var w=s(p,"onDeactivate"),A=s(p,"onPostDeactivate"),B=s(p,"checkCanReturnFocus"),D=s(p,"returnFocus","returnFocusOnDeactivate");w==null||w();var _=function(){Ge(function(){D&&y(x(l.nodeFocusedBeforeActivation)),A==null||A()})};return D&&B?(B(x(l.nodeFocusedBeforeActivation)).then(_,_),this):(_(),this)},pause:function(d){return l.active?(l.manuallyPaused=!0,this._setPausedState(!0,d)):this},unpause:function(d){return l.active?(l.manuallyPaused=!1,a[a.length-1]!==this?this:this._setPausedState(!1,d)):this},updateContainerElements:function(d){var p=[].concat(d).filter(Boolean);return l.containers=p.map(function(w){return typeof w=="string"?o.querySelector(w):w}),l.active&&c(),O(),this}},Object.defineProperties(i,{_isManuallyPaused:{value:function(){return l.manuallyPaused}},_setPausedState:{value:function(d,p){if(l.paused===d)return this;if(l.paused=d,d){var w=s(p,"onPause"),A=s(p,"onPostPause");w==null||w(),N(),O(),A==null||A()}else{var B=s(p,"onUnpause"),D=s(p,"onPostUnpause");B==null||B(),c(),k(),O(),D==null||D()}return this}}}),i.updateContainerElements(e),i};const En=t.defineComponent({name:"UseFocusTrap",props:["as","options"],setup(e,{slots:n}){let o;const a=t.ref(),r=()=>o&&o.activate(),l=()=>o&&o.deactivate();return t.watch(()=>Gt(a),i=>{i&&(o=Bn(i,e.options||{}),r())},{flush:"post"}),t.onScopeDispose(()=>l()),()=>{if(n.default)return t.h(e.as||"div",{ref:a},n.default())}}}),Cn=q(t.defineComponent({__name:"QFocusTrap",props:t.mergeModels({options:{},as:{}},{disabled:{type:Boolean},disabledModifiers:{}}),emits:["update:disabled"],setup(e){const n=e,o=t.useModel(e,"disabled");return(a,r)=>o.value?t.renderSlot(a.$slots,"default",{key:0}):(t.openBlock(),t.createBlock(t.unref(En),t.normalizeProps(t.mergeProps({key:1},n)),{default:t.withCtx(()=>[t.renderSlot(a.$slots,"default")]),_:3},16))}})),Q="data-scroll-locked",Be="right-scroll-bar-position",Ee="width-before-scroll-bar",_n="with-scroll-bars-hidden",An="--removed-body-scroll-bar-size",Nn={left:0,top:0,right:0,gap:0},Ce=e=>parseInt(e||"",10)||0,Sn=e=>{const n=window.getComputedStyle(document.body),o=n[e==="padding"?"paddingLeft":"marginLeft"],a=n[e==="padding"?"paddingTop":"marginTop"],r=n[e==="padding"?"paddingRight":"marginRight"];return[Ce(o),Ce(a),Ce(r)]},In=(e="margin")=>{if(typeof window>"u")return Nn;const n=Sn(e),o=document.documentElement.clientWidth,a=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,a-o+n[2]-n[0])}};function xn(){return document?document.createElement("style"):null}function Dn(e,n){e.appendChild(document.createTextNode(n))}function $n(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}const Ln=()=>{let e=0,n=null;return{add:o=>{e===0&&(n=xn())&&(Dn(n,o),$n(n)),e++},remove:()=>{var o;e--,!e&&n&&((o=n.parentNode)==null||o.removeChild(n),n=null)}}},Mn=q(t.defineComponent({__name:"QRemoveScrollBar",props:{noRelative:{type:Boolean},noImportant:{type:Boolean},gapMode:{default:"margin"}},setup(e){const n=e,o=Ln(),a=()=>{const l=parseInt(document.body.getAttribute(Q)||"0",10);return isFinite(l)?l:0},r=({left:l,top:i,right:s,gap:u},f,g="margin",c)=>`
|
|
9
9
|
.${_n} {
|
|
10
10
|
overflow: hidden ${c};
|
|
11
11
|
padding-right: ${u}px ${c};
|
|
@@ -42,5 +42,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
42
42
|
body[${Q}] {
|
|
43
43
|
${An}: ${u}px;
|
|
44
44
|
}
|
|
45
|
-
`;return t.onMounted(()=>{document.body.setAttribute(Q,(a()+1).toString());const l=In(n.gapMode);o.add(r(l,!n.noRelative,n.gapMode,n.noImportant?"":"!important"))}),t.onUnmounted(()=>{const l=a()-1;l<=0?document.body.removeAttribute(Q):document.body.setAttribute(Q,l.toString()),o.remove()}),(l,i)=>t.renderSlot(l.$slots,"default")}}));function Rn(e,n,o,a){const r=(a==null?void 0:a.offset)??0,l=(a==null?void 0:a.crossOffset)??0,i=(a==null?void 0:a.placement)??"bottom",s=e.getBoundingClientRect(),u=n.getBoundingClientRect(),f=o==null?void 0:o.getBoundingClientRect(),g=Tn(s,u,i,r),c=Un(s,u,g),m=Vn(c,g,r),y=Pn(m,g,l),x=Fn(y,u,g);let $;if(a!=null&&a.arrow){if(!f)throw new Error("[Quidgest UI] The arrow element must exist to compute its position");$=On(x,s,u,f,g)}return{overlayCoords:x,arrowCoords:$,placement:g}}function Tn(e,n,o,a){const r=ze(e,n,o,a);if(He(r)){const l=X(o),i={top:"bottom",bottom:"top",left:"right",right:"left"}[l],s=ze(e,n,i,a);if(He(s))return o;const u=Gn(o);return u?`${i}-${u}`:i}return o}function Fn(e,n,o){const a=pe(o),r=(i,s,u)=>Math.min(Math.max(i,s),u),l={...e};return a==="x"?l.x=r(e.x,8,window.innerWidth-n.width-8):l.y=r(e.y,8,window.innerHeight-n.height-8),l}function Vn(e,n,o){const a=X(n);return{x:e.x+(a==="left"?-o:a==="right"?o:0),y:e.y+(a==="top"?-o:a==="bottom"?o:0)}}function Pn(e,n,o){const a=X(n);return{x:e.x+(a==="top"||a==="bottom"?o:0),y:e.y+(a==="right"||a==="left"?o:0)}}function On(e,n,o,a,r){if(pe(r)==="y"){const l=n.top+n.height/2,i=e.y+o.height/2,s=i-l,u=o.height/2-s-a.height/2+2;if(u>0&&u<o.height-a.height)return{y:u}}else{const l=n.left+n.width/2,i=e.x+o.width/2,s=i-l,u=o.width/2-s-a.width/2+2;if(u>0&&u<o.width-a.width)return{x:u}}}function Un(e,n,o){const[a,r]=o.split("-"),l=e.x+e.width/2-n.width/2,i=e.y+e.height/2-n.height/2;let s;switch(a){case"top":s={x:l,y:e.y-n.height};break;case"bottom":s={x:l,y:e.y+e.height};break;case"left":s={x:e.x-n.width,y:i};break;case"right":s={x:e.x+e.width,y:i};break;default:throw new Error(`[Quidgest UI] Invalid placement value: ${o}`)}if(!r)return s;const u=pe(o)==="y"?"height":"width",f=pe(o),g=e[u]/2-n[u]/2;switch(r){case"start":s[f]-=g;break;case"end":s[f]+=g;break;default:throw new Error(`[Quidgest UI] Invalid alignment value: ${r}`)}return s}function ze(e,n,o,a){const r=X(o);let l=0;switch(r){case"top":l=e.top-(n.height+a);break;case"bottom":l=window.innerHeight-e.bottom-(n.height+a);break;case"left":l=e.left-(n.width+a);break;case"right":l=window.innerWidth-e.right-(n.width+a);break;default:throw new Error(`[Quidgest UI] Invalid side value: ${r}`)}return l}function qn(e){return e==="x"?"y":"x"}function jn(e){const n=X(e);return["left","right"].includes(n)?"x":"y"}function pe(e){return qn(jn(e))}function X(e){const[n]=e.split("-");return n}function Gn(e){const[,n]=e.split("-");return n}function He(e){return e<0}function zn(e){return typeof e=="string"?document.querySelector(e):e}const Hn=["id"],Zn=["role"],Jn=q(t.defineComponent({inheritAttrs:!1,__name:"QOverlay",props:t.mergeModels({id:{},class:{},anchor:{},appearance:{default:"regular"},arrow:{type:Boolean},attach:{default:"body"},inline:{type:Boolean},backdropBlur:{type:Boolean},backdropClass:{},delay:{default:500},nonModal:{type:Boolean},scrollLock:{type:Boolean},offset:{default:8},crossOffset:{default:0},persistent:{type:Boolean},placement:{default:"right"},spy:{type:Boolean},transition:{default:"fade"},trigger:{default:"click"},width:{default:"auto"},focusTrap:{type:Boolean},centerVertically:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:t.mergeModels(["enter","leave"],["update:modelValue"]),setup(e,{emit:n}){const o=e,a=n,r=t.useModel(e,"modelValue"),{class:l}=$e(),i=t.computed(()=>["q-overlay",`q-overlay--${X(c.placement)}`,l.value,{"q-overlay--independent":s.value,"q-overlay--inverted":o.appearance==="inverted","q-overlay--center":o.centerVertically},o.class]),s=t.computed(()=>o.anchor===void 0),u=t.computed(()=>r.value&&!o.nonModal),f=t.computed(()=>(r.value||c.animating)&&o.scrollLock),g=t.computed(()=>!o.inline&&(r.value||c.animating)),c=t.reactive({animating:!1,top:0,left:0,width:0,placement:o.placement}),m=t.reactive({top:void 0,left:void 0,hidden:!0});t.watch(r,w);const y=t.computed(()=>{if(s.value)return;const v=B(),J=o.width==="anchor",j=J?v==null?void 0:v.getBoundingClientRect().width:void 0;return{top:`${c.top}px`,left:`${c.left}px`,width:j!==void 0?`${j}px`:void 0}}),x=t.computed(()=>{if(o.arrow)return{top:m.top!==void 0?`${m.top}px`:void 0,left:m.left!==void 0?`${m.left}px`:void 0,opacity:m.hidden?0:1}}),$=t.ref(null),S=t.ref(null),U=t.ref(null);function M(){const v=B();if(!v||!S.value)return;const J={placement:o.placement,width:o.width,offset:o.offset,crossOffset:o.crossOffset,arrow:o.arrow},j=Rn(v,S.value,($==null?void 0:$.value)??void 0,J);c.left=j.overlayCoords.x,c.top=j.overlayCoords.y,c.placement=j.placement,m.hidden=j.arrowCoords===void 0,j.arrowCoords&&(m.top=j.arrowCoords.y,m.left=j.arrowCoords.x)}t.watch(()=>o.placement,()=>t.nextTick(M));let F;function _(){k(0)}function I(){k(o.delay)}function k(v){F&&V(),F=window.setTimeout(()=>{r.value=!0},v)}function N(){if(F&&V(),r.value=!1,o.anchor&&o.trigger==="click"){const v=B();t.nextTick(()=>v==null?void 0:v.focus())}}function V(){clearTimeout(F),F=void 0}function R(){t.nextTick(le),a("enter")}function O(){A()}function d(){a("leave")}function p(){A(),Yo()}function w(){c.animating=!0}function A(){c.animating=!1}function B(){return o.anchor?zn(o.anchor):null}function D(v){o.persistent&&v.preventDefault()}function C(v){var J;if(o.persistent){v.preventDefault();return}let j=!1;v.defaultPrevented||v.detail.originalEvent.type==="pointerdown"&&(j=!0);const Qo=v.detail.originalEvent.target;if((J=B())!=null&&J.contains(Qo)){v.preventDefault();return}v.detail.originalEvent.type==="focusin"&&j&&v.preventDefault()}function b(){N()}let h;function E(){const v=B();if(v)switch(h=new MutationObserver(M),h.observe(v,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),o.trigger){case"click":v.addEventListener("click",_);break;case"hover":v.addEventListener("mouseenter",I),v.addEventListener("mouseleave",N),v.addEventListener("focusin",_),v.addEventListener("focusout",N);break}}function T(){const v=B();if(v)switch(h==null||h.disconnect(),o.trigger){case"click":v.removeEventListener("click",_);break;case"hover":v.removeEventListener("mouseenter",I),v.removeEventListener("mouseleave",N),v.removeEventListener("focusin",_),v.removeEventListener("focusout",N);break}}function L(){window.addEventListener("resize",M),o.scrollLock||window.addEventListener("scroll",M)}function Z(){window.removeEventListener("resize",M),o.scrollLock||window.removeEventListener("scroll",M)}let K;function ee(){B()?(M(),K=window.setTimeout(ee,100)):N()}function le(){var v;s.value||(L(),o.spy?ee():M()),(s.value||o.trigger==="click")&&((v=S.value)==null||v.focus())}function Yo(){s.value||Z(),o.spy&&(clearTimeout(K),K=void 0)}return t.onMounted(()=>{t.nextTick(E)}),t.onBeforeUnmount(T),(v,J)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!g.value,to:o.attach},[t.createVNode(t.Transition,{name:"fade",appear:""},{default:t.withCtx(()=>[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass([o.backdropClass,"q-overlay__underlay",{"q-overlay__underlay--blur":o.backdropBlur}])},null,2)):t.createCommentVNode("v-if",!0)]),_:1}),t.createVNode(t.Transition,{name:o.transition,appear:"",onEnter:R,onAfterEnter:O,onLeave:d,onAfterLeave:p},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,id:o.id,ref_key:"overlayContainerRef",ref:U,tabindex:"-1",class:t.normalizeClass(i.value),style:t.normalizeStyle(y.value)},[t.createVNode(t.unref(jt),{onDismiss:b,onInteractOutside:C,onPointerDownOutside:D},{default:t.withCtx(()=>[U.value?(t.openBlock(),t.createBlock(t.unref(Cn),{key:0,disabled:o.nonModal||!r.value,options:{fallbackFocus:U.value}},{default:t.withCtx(()=>[t.createElementVNode("div",t.mergeProps({ref_key:"overlayRef",ref:S,class:"q-overlay__content",tabindex:"-1",role:u.value?"dialog":void 0},v.$attrs),[o.arrow?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"arrowRef",ref:$,role:"presentation",class:"q-overlay__arrow",style:t.normalizeStyle(x.value)},null,4)):t.createCommentVNode("v-if",!0),t.renderSlot(v.$slots,"default")],16,Zn)]),_:3},8,["disabled","options"])):t.createCommentVNode("v-if",!0)]),_:3})],14,Hn)):t.createCommentVNode("v-if",!0)]),_:3},8,["name"])],8,["disabled","to"])),f.value?(t.openBlock(),t.createBlock(t.unref(Mn),{key:0})):t.createCommentVNode("v-if",!0)],64))}})),Wn=[{id:"button",icon:{icon:"check"},props:{variant:"bold",label:"Ok"}}],Yn={icon:"check-circle-outline"},Qn={close:{icon:"close"}},Xn={key:0,class:"q-dialog__header"},Kn={class:"q-dialog__header-title"},eo={key:1,class:"q-dialog__body"},to={key:0,class:"q-dialog__body-icon"},no={class:"q-dialog__body-text"},oo=["innerHTML"],ao={key:1},ro={key:2,class:"q-dialog__footer"},lo={class:"q-dialog__footer-buttons"},io=t.defineComponent({__name:"QDialog",props:t.mergeModels({id:{},class:{},title:{},text:{},icon:{default:()=>Yn},buttons:{default:()=>Wn},attach:{default:"body"},inline:{type:Boolean},backdropBlur:{type:Boolean,default:!0},dismissible:{type:Boolean},html:{type:Boolean,default:!0},icons:{default:()=>Qn},size:{default:"small"},centerVertically:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:t.mergeModels(["enter","leave"],["update:modelValue"]),setup(e,{emit:n}){const o=e,a=n,r=t.useModel(e,"modelValue"),l=t.computed(()=>["q-dialog",o.class]),i=t.computed(()=>`q-overlay--${o.size}`);function s(){r.value=!1}function u(c){var m;(m=c.action)==null||m.call(c),s()}function f(){a("enter")}function g(){a("leave")}return(c,m)=>(t.openBlock(),t.createBlock(t.unref(Jn),{id:o.id,modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=y=>r.value=y),"backdrop-class":"q-dialog__underlay","scroll-lock":"",persistent:"",inline:o.inline,attach:o.attach,"backdrop-blur":o.backdropBlur,"center-vertically":o.centerVertically,class:t.normalizeClass(i.value),onEnter:f,onLeave:g},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(l.value)},[o.title||c.$slots.header?(t.openBlock(),t.createElementBlock("div",Xn,[t.renderSlot(c.$slots,"header",{},()=>[t.createElementVNode("span",Kn,t.toDisplayString(o.title),1)])])):t.createCommentVNode("v-if",!0),o.icon||o.text||c.$slots.body?(t.openBlock(),t.createElementBlock("div",eo,[t.renderSlot(c.$slots,"body",{},()=>[t.renderSlot(c.$slots,"body.icon",{},()=>[o.icon?(t.openBlock(),t.createElementBlock("span",to,[t.createVNode(t.unref(ne),t.normalizeProps(t.guardReactiveProps(o.icon)),null,16)])):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",no,[o.html?(t.openBlock(),t.createElementBlock("div",{key:0,innerHTML:o.text},null,8,oo)):(t.openBlock(),t.createElementBlock("div",ao,t.toDisplayString(o.text),1))]),t.renderSlot(c.$slots,"body.append")])])):t.createCommentVNode("v-if",!0),o.buttons||c.$slots.footer?(t.openBlock(),t.createElementBlock("div",ro,[t.renderSlot(c.$slots,"footer",{},()=>[t.createElementVNode("span",lo,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.buttons,y=>(t.openBlock(),t.createBlock(t.unref(ye),t.mergeProps({ref_for:!0},y.props,{key:y.id,onClick:()=>u(y)}),{default:t.withCtx(()=>[y.icon?(t.openBlock(),t.createBlock(t.unref(ne),t.mergeProps({key:0,ref_for:!0},y.icon),null,16)):t.createCommentVNode("v-if",!0)]),_:2},1040,["onClick"]))),128))])])])):t.createCommentVNode("v-if",!0),o.dismissible?(t.openBlock(),t.createBlock(t.unref(ye),{key:3,class:"q-dialog__close",variant:"text",onClick:s},{default:t.withCtx(()=>[t.createVNode(t.unref(ne),t.normalizeProps(t.guardReactiveProps(o.icons.close)),null,16)]),_:1})):t.createCommentVNode("v-if",!0)],2)]),_:3},8,["id","modelValue","inline","attach","backdrop-blur","center-vertically","class"]))}}),fe=t.reactive({dialogs:[]});function so(){function e(o,a){const r=Mt(a);return fe.dialogs.push({id:r,props:o}),r}function n(o){const a=fe.dialogs.findIndex(r=>r.id===o);a!==-1&&fe.dialogs.splice(a,1)}return{...fe,addDialog:e,removeDialog:n}}const co=t.defineComponent({inheritAttrs:!1,__name:"QDialogProvider",setup(e){const{dialogs:n,removeDialog:o}=so();return(a,r)=>(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(n),l=>(t.openBlock(),t.createBlock(t.unref(Ze),t.mergeProps({key:l.id,ref_for:!0},l.props,{"model-value":"",onLeave:()=>t.unref(o)(l.id)}),null,16,["onLeave"]))),128))}}),Ze=q(io);q(co);function H(){return{copy:"Copy",apply:"Apply",applyAll:"Apply all",chatbotTitle:"ChatBot",sendMessage:"Send message",clearChat:"Clear chat",inputLabel:"What can I help with?",imageUpload:"Upload Image",imageUploadQButton:"Upload Image",goodResponse:"Good response",badResponse:"Bad response",initialMessage:"Howdy! I am GenioBot 👋, Quidgest's personal AI assistant! How can I help you?",initialAgentMessage:"Just a temporary message while we are working on the agent mode",loginError:"Uh oh, I could not authenticate with the Quidgest API endpoint 😓",botIsSick:"*cough cough* GenioBot is not feeling alright 🥴️🤒, looks like something failed!",commentDialogTitle:"Would you like to add a comment?",commentPlaceholder:"Type your comment here (optional)...",copyResponse:"Copy response",submitButton:"Submit",cancelButton:"Cancel",senderImage:"Sender Image",imagePreview:"Image preview",regenerateResponse:"Regenerate response",generatingResponse:"Generating"}}async function Je(e,n){var u,f,g,c,m,y;const o=new AbortController,a=o.signal,l=(await W({...e,headers:{Accept:"text/event-stream"},responseType:"stream",signal:a,adapter:"fetch"})).data;if(!l||!(l instanceof ReadableStream))throw new Error("Invalid stream response");const i=l.getReader(),s=new TextDecoder;for(;;){const{done:x,value:$}=await i.read();if(x){(u=n.onDone)==null||u.call(n);break}const U=s.decode($,{stream:!0}).split(/\n\n+/);for(const M of U){const F=M.trim().split(`
|
|
46
|
-
`);let _="",I="";for(const k of F)k.startsWith("event:")?_=k.replace("event:","").trim():k.startsWith("data:")&&(I=k.replace("data:","").trim());if(!(!_||!I))try{const k=JSON.parse(I);switch(_){case"message":(f=n.onMessage)==null||f.call(n,k.value);break;case"error":(g=n.onError)==null||g.call(n,new Error(k.value));break;case"field_metadata":(c=n.onFieldMetadata)==null||c.call(n,k);break;case"done":(m=n.onDone)==null||m.call(n);break;default:console.warn(`Unknown event type: ${_}`)}}catch(k){(y=n.onError)==null||y.call(n,k),console.error("Error processing event:",k);continue}finally{x&&(i.releaseLock(),o.abort())}}}}function We(e){const n=t.ref(!1),o=t.ref(null);async function a(f){n.value=!0,o.value=null;try{return{data:(await W({...f,baseURL:e})).data,error:null}}catch(g){return o.value=g,console.error("Error in API request:",g),{data:null,error:g}}finally{n.value=!1}}async function r(f,g,c,m){return await a({method:"POST",url:"/prompt/load",data:{username:f,project:g,agentID:c,formId:m}})}async function l(f,g,c,m){return await a({method:"POST",url:"/prompt/clear",data:{username:f,project:g,agentID:c,formId:m}})}async function i(f,g,c){return n.value=!0,await Je({method:"POST",url:`${e}/prompt/submit`,data:f},{onMessage:m=>{g(m)},onError:m=>{o.value=m,c==null||c(m),console.error("Error in sendPrompt:",m)},onDone:()=>n.value=!1})}async function s(f,g,c){return n.value=!0,await Je({method:"POST",url:`${e}/get-job-result`,data:{jobId:f}},{onMessage:m=>g(m),onFieldMetadata:m=>c(m),onError:m=>{o.value=m,console.error("Error in getFieldSuggestionData:",m)},onDone:()=>n.value=!1})}async function u(f,g,c){return await a({method:"POST",url:"/prompt/feedback",data:{messageSessionID:c,feedbackValue:f,feedbackComment:g}})}return{isLoading:n,lastError:o,getChatData:r,clearChatData:l,getFieldSuggestionData:s,sendPrompt:i,handleFeedback:u}}const uo=["innerHTML"],_e=t.defineComponent({__name:"MarkdownRender",props:{source:{},options:{},plugins:{}},setup(e){const n=e,o=t.ref(new et({html:!0,...n.options??{}}));n.plugins&&n.plugins.forEach(r=>o.value.use(r));const a=t.computed(()=>o.value.render(n.source));return(r,l)=>(t.openBlock(),t.createElementBlock("div",{class:"markdown-renderer",innerHTML:a.value},null,8,uo))}});function Ye(e,n){switch(e){case"date":return new Date(n).toLocaleDateString();case"number":return parseFloat(n);case"boolean":return n.toLowerCase()==="true";default:return n.toString()}}const po={class:"q-field-preview"},fo={class:"q-field-preview__toolbar"},mo={class:"q-field-preview__content"},go={class:"q-field-preview__footer"},bo=t.defineComponent({__name:"FieldPreview",props:{name:{},text:{},type:{},disabled:{type:Boolean},applied:{type:Boolean}},emits:["apply"],setup(e,{emit:n}){const o=H(),a=e,r=t.ref(a.applied),l=t.computed(()=>a.disabled||r.value),i=t.computed(()=>a.type==="text"||a.type==="multiline_text"?_e:"div"),s=t.computed(()=>{const g={};return i.value===_e?g.source=a.text:g.innerHTML=a.text,g}),u=n;function f(){if(r.value)return;r.value=!0;const g=Ye(a.type,a.text);u("apply",g)}return(g,c)=>(t.openBlock(),t.createElementBlock("div",po,[t.createElementVNode("div",fo,[t.createElementVNode("span",null,[c[0]||(c[0]=t.createTextVNode(" Suggestions for field: ")),t.createElementVNode("b",null,t.toDisplayString(a.name),1)])]),t.createElementVNode("div",mo,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(i.value),t.normalizeProps(t.guardReactiveProps(s.value)),null,16))]),t.createElementVNode("div",go,[t.createVNode(t.unref(Tt),{borderless:""},{default:t.withCtx(()=>[t.createVNode(t.unref(ye),{label:t.unref(o).apply,disabled:l.value,readonly:l.value,onClick:f},{default:t.withCtx(()=>[t.createVNode(t.unref(ne),{icon:"apply"})]),_:1},8,["label","disabled","readonly"])]),_:1})])]))}}),ho={class:"pulsing-dots"},yo={class:"generating-text"},wo={class:"dots-container"},vo=t.defineComponent({__name:"PulseDots",setup(e){const n=[1,2,3],o=H();return(a,r)=>(t.openBlock(),t.createElementBlock("div",ho,[t.createElementVNode("span",yo,t.toDisplayString(t.unref(o).generatingResponse),1),t.createElementVNode("div",wo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,(l,i)=>t.createElementVNode("span",{key:i,class:"dot",style:t.normalizeStyle({animationDelay:i*.2+"s"})}," • ",4)),64))])]))}}),ko={class:"q-chatbot__message-container"},Bo={class:"q-chatbot__message-wrapper"},Eo={key:0,class:"q-chatbot__image-preview"},Co=["src","alt"],_o={class:"q-chatbot__message"},Ao={key:1,class:"q-chatbot__text"},No=t.defineComponent({__name:"ChatBotMessage",props:{sender:{default:"user"},message:{},date:{default:()=>new Date},loading:{type:Boolean},dateFormat:{},imagePreviewUrl:{},apiEndpoint:{},sessionID:{},userImage:{default:void 0},chatbotImage:{},isWelcomeMessage:{type:Boolean},fields:{default:()=>[]}},emits:["apply-fields"],setup(e,{emit:n}){const o=n,a=H(),r=e,{handleFeedback:l}=We(r.apiEndpoint),i=t.computed(()=>r.sender==="bot"&&!Object.values(a||{}).includes(r.message||"")&&!r.isWelcomeMessage),s=t.computed(()=>r.sender==="bot"?r.chatbotImage:r.userImage);function u(){r.message&&navigator.clipboard.writeText(r.message).then(()=>{console.log("Response copied to clipboard")}).catch(m=>{console.error("Failed to copy response: ",m)})}function f(m,y){o("apply-fields",[{name:y.name,text:m}])}function g(){if(!r.fields||r.fields.length===0)return;const m=r.fields.map(y=>({name:y.name,text:Ye(y.type,y.text)}));o("apply-fields",m)}function c(m,y){m===null||y===null||!r.sessionID||l(m,y,r.sessionID)}return(m,y)=>(t.openBlock(),t.createElementBlock("div",ko,[t.createVNode(t.unref(ne),{type:"img",icon:s.value,alt:t.unref(a).senderImage,class:"q-chatbot__profile"},null,8,["icon","alt"]),t.createElementVNode("div",Bo,[r.imagePreviewUrl&&r.imagePreviewUrl.length>0?(t.openBlock(),t.createElementBlock("div",Eo,[t.createElementVNode("img",{src:r.imagePreviewUrl,alt:t.unref(a).imagePreview},null,8,Co)])):t.createCommentVNode("",!0),t.createElementVNode("div",_o,[m.loading?(t.openBlock(),t.createBlock(vo,{key:0})):r.sender==="bot"&&r.fields.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(r.fields,(x,$)=>(t.openBlock(),t.createBlock(t.unref(bo),{class:"q-chatbot__text",key:$,text:x.text||"",name:x.name,type:x.type,disabled:m.loading,onApply:S=>f(S,x)},null,8,["text","name","type","disabled","onApply"]))),128)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[r.sender==="bot"?(t.openBlock(),t.createBlock(t.unref(_e),{key:0,class:"q-chatbot__text",source:r.message||""},null,8,["source"])):(t.openBlock(),t.createElementBlock("div",Ao,t.toDisplayString(r.message),1))],64))])]),t.createVNode(t.unref(Mo),{showButtons:i.value,loading:r.loading,"date-format":r.dateFormat,onCopyResponse:u,onSubmitFeedback:c,onApplyAll:g},null,8,["showButtons","loading","date-format"])]))}}),P=[];for(let e=0;e<256;++e)P.push((e+256).toString(16).slice(1));function So(e,n=0){return(P[e[n+0]]+P[e[n+1]]+P[e[n+2]]+P[e[n+3]]+"-"+P[e[n+4]]+P[e[n+5]]+"-"+P[e[n+6]]+P[e[n+7]]+"-"+P[e[n+8]]+P[e[n+9]]+"-"+P[e[n+10]]+P[e[n+11]]+P[e[n+12]]+P[e[n+13]]+P[e[n+14]]+P[e[n+15]]).toLowerCase()}let Ae;const Io=new Uint8Array(16);function xo(){if(!Ae){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ae=crypto.getRandomValues.bind(crypto)}return Ae(Io)}const Qe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Xe(e,n,o){var r;if(Qe.randomUUID&&!e)return Qe.randomUUID();e=e||{};const a=e.random??((r=e.rng)==null?void 0:r.call(e))??xo();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,So(a)}const re=t.ref([]),me=t.ref(1);function Ke(){function e(r,l,i,s,u){const f={id:me.value++,message:r,date:new Date,sender:l||"bot",sessionID:s||Xe(),imagePreviewUrl:i||void 0,isWelcomeMessage:u,fields:[]};re.value.push(f)}function n(){return re.value.find(r=>r.id===me.value-1)}function o(){re.value=[],me.value=1}function a(){return re.value}return{messages:re,nextMessageId:me,addChatMessage:e,getLastMessage:n,clearMessages:o,getMessages:a}}const Do={class:"q-chatbot__dialog-title"},$o={key:0,class:"q-chatbot__feedback-buttons"},Lo={class:"q-chatbot__sender"},Mo=t.defineComponent({__name:"ChatBotMessageButtons",props:{loading:{type:Boolean},showButtons:{type:Boolean},dateFormat:{},date:{}},emits:["submit-feedback","copy-response","apply-all"],setup(e,{emit:n}){const o=H(),{getLastMessage:a}=Ke(),r=e,l=t.ref(!1),i=t.ref(""),s=t.ref(null),u=t.ref(!1),f=t.computed(()=>r.loading||u.value),g=r.date||new Date,c=n,m=a(),y=t.computed(()=>m?m.fields&&m.fields.length>1:!1),x=[{id:"confirm-btn",action:_,props:{label:o.submitButton},icon:{icon:"submit"}},{id:"cancel-btn",props:{label:o.cancelButton},icon:{icon:"cancel"}}],$=t.computed(()=>r.dateFormat?U(g,"HH:mm"):g.toLocaleString()),S=t.computed(()=>`${$.value}`);function U(k,N){const V=k.getDate().toString().padStart(2,"0"),R=(k.getMonth()+1).toString().padStart(2,"0"),O=k.getFullYear().toString().padStart(2,"0"),d=k.getHours().toString().padStart(2,"0"),p=k.getMinutes().toString().padStart(2,"0"),w=k.getSeconds().toString().padStart(2,"0");return N.replace("dd",V).replace("MM",R).replace("yyyy",O).replace("HH",d).replace("mm",p).replace("ss",w)}function M(k){l.value=!0,i.value="",s.value=k}function F(){u.value||(u.value=!0,c("apply-all"))}function _(){s.value!==null&&(c("submit-feedback",s.value,i.value),l.value=!1,i.value="",s.value=null)}function I(){c("copy-response")}return(k,N)=>{const V=t.resolveComponent("q-text-field"),R=t.resolveComponent("q-icon"),O=t.resolveComponent("q-button"),d=t.resolveComponent("q-button-group");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(Ze),{modelValue:l.value,"onUpdate:modelValue":N[1]||(N[1]=p=>l.value=p),buttons:x},{body:t.withCtx(()=>[t.createElementVNode("div",Do,t.toDisplayString(t.unref(o).commentDialogTitle),1),t.createVNode(V,{modelValue:i.value,"onUpdate:modelValue":N[0]||(N[0]=p=>i.value=p),maxLength:150,size:"large",placeholder:t.unref(o).commentPlaceholder},null,8,["modelValue","placeholder"])]),_:1},8,["modelValue"]),k.showButtons?(t.openBlock(),t.createElementBlock("div",$o,[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(O,{title:t.unref(o).goodResponse,borderless:"",disabled:r.loading,onClick:N[2]||(N[2]=p=>M(1))},{default:t.withCtx(()=>[t.createVNode(R,{icon:"thumb-up"})]),_:1},8,["title","disabled"]),t.createVNode(O,{title:t.unref(o).badResponse,borderless:"",disabled:r.loading,onClick:N[3]||(N[3]=p=>M(0))},{default:t.withCtx(()=>[t.createVNode(R,{icon:"thumb-down"})]),_:1},8,["title","disabled"]),t.createVNode(O,{title:t.unref(o).copyResponse,borderless:"",disabled:r.loading,onClick:I},{default:t.withCtx(()=>[t.createVNode(R,{icon:"copy-content"})]),_:1},8,["title","disabled"]),y.value?(t.openBlock(),t.createBlock(O,{key:0,title:t.unref(o).applyAll,borderless:"",disabled:f.value,readonly:f.value,onClick:F},{default:t.withCtx(()=>[t.createVNode(R,{icon:"apply-all"})]),_:1},8,["title","disabled","readonly"])):t.createCommentVNode("",!0)]),_:1})])):t.createCommentVNode("",!0),t.createElementVNode("div",Lo,t.toDisplayString(S.value),1)],64)}}}),Ro={class:"q-chatbot__tools"},To={class:"q-chatbot__tools__select"},Fo=t.defineComponent({__name:"ChatToolBar",props:{disabled:{type:Boolean},availableAgents:{default:()=>[]},selectedAgentKey:{}},emits:["clear","change-chat"],setup(e,{emit:n}){const{clearChat:o}=H(),a={key:"",value:"Default Chat",formId:""},r=e,l=n,i=t.computed(()=>r.availableAgents&&r.availableAgents.length>0),s=t.ref(r.selectedAgentKey||a.key);t.watch(()=>r.selectedAgentKey,c=>{s.value=c||a.key});const u=t.computed(()=>{var m;const c=(m=r.availableAgents)==null?void 0:m.map(y=>({key:y.key,value:y.value,formId:y.formId}));return c==null||c.push(a),c||[a]});function f(){l("clear")}function g(c){const m=u.value.find(y=>y.key===c);if(m){if(m.key===a.key){l("change-chat",{key:"",formId:""});return}l("change-chat",m)}}return(c,m)=>{const y=t.resolveComponent("q-select"),x=t.resolveComponent("q-icon"),$=t.resolveComponent("q-button");return t.openBlock(),t.createElementBlock("div",Ro,[t.createElementVNode("div",To,[i.value?(t.openBlock(),t.createBlock(y,{key:0,modelValue:s.value,"onUpdate:modelValue":[m[0]||(m[0]=S=>s.value=S),g],size:"medium",items:u.value},null,8,["modelValue","items"])):t.createCommentVNode("",!0)]),t.createVNode($,{title:t.unref(o),disabled:r.disabled,borderless:"",onClick:f},{default:t.withCtx(()=>[t.createVNode(x,{icon:"bin"})]),_:1},8,["title","disabled"])])}}}),Vo={class:"q-chatbot__input-wrapper"},Po={key:0,class:"q-chatbot__image-preview"},Oo=["src"],Uo={class:"q-chatbot__input"},qo={class:"q-chatbot__send-container"},jo=["accept"],Go=t.defineComponent({__name:"ChatBotInput",props:{disabled:{type:Boolean},loading:{type:Boolean},userPrompt:{},agentId:{}},emits:["sendMessage"],setup(e,{emit:n}){const o=H(),a=e,r=t.ref(null),l=t.ref(""),i=t.computed(()=>".png, .jpeg, .jpg, .svg, .webp"),s=t.ref(!1),u=t.ref(!1),f=t.ref(a.userPrompt??""),g=n,c=t.computed(()=>a.disabled||a.loading||f.value.trim().length===0);function m(_){_.preventDefault(),a.disabled||(u.value=!0)}const y=t.computed(()=>({"q-chatbot__footer-disabled":a.disabled,"drag-over":u.value&&!s.value}));function x(_){_.preventDefault(),u.value=!1}function $(_){var N;if(_.preventDefault(),u.value=!1,a.disabled||s.value)return;const I=(N=_.dataTransfer)==null?void 0:N.files;if(!I)return;const k=I[0];if(k.type.startsWith("image/")){if(!r.value)return;const V=new DataTransfer;V.items.add(k),r.value.files=V.files,l.value=URL.createObjectURL(k),s.value=!0}}function S(){if(!(f.value.trim()===""||a.loading||a.disabled)){if(r.value&&r.value.files&&r.value.files.length>0){const I={file:r.value.files[0],previewUrl:l.value};g("sendMessage",f.value,I),U()}else g("sendMessage",f.value);f.value=""}}function U(){l.value="",r.value&&(r.value.value="",r.value.files=null),s.value=!1}function M(){var _;(_=r.value)==null||_.click()}function F(_){const I=_.target;r.value=I,I.files&&I.files[0]&&(l.value=URL.createObjectURL(I.files[0]),s.value=!0)}return(_,I)=>{const k=t.resolveComponent("q-icon"),N=t.resolveComponent("q-button"),V=t.resolveComponent("q-text-area");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(Pt),{label:t.unref(o).inputLabel},null,8,["label"]),t.createElementVNode("div",{class:t.normalizeClass(["q-chatbot__footer",y.value]),onDragover:t.withModifiers(m,["prevent"]),onDragleave:t.withModifiers(x,["prevent"]),onDrop:t.withModifiers($,["prevent"])},[t.createElementVNode("div",Vo,[l.value?(t.openBlock(),t.createElementBlock("div",Po,[t.createElementVNode("img",{src:l.value,tabindex:"0",alt:"Image preview"},null,8,Oo),t.createVNode(N,{class:"q-chatbot__remove-image",tabindex:"0",flat:"",round:"",onClick:U},{default:t.withCtx(()=>[t.createVNode(k,{icon:"bin"})]),_:1})])):t.createCommentVNode("",!0),t.createElementVNode("div",Uo,[t.createVNode(V,{modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=R=>f.value=R),size:"block",autosize:"",resize:"none",rows:2,disabled:a.disabled,onKeyup:t.withKeys(S,["enter"])},null,8,["modelValue","disabled"])])]),t.createElementVNode("div",qo,[t.createVNode(N,{title:t.unref(o).imageUpload,class:"q-chatbot__upload",disabled:a.disabled||a.loading||s.value,onClick:M},{default:t.withCtx(()=>[t.createVNode(k,{icon:"upload"})]),_:1},8,["title","disabled"]),t.createElementVNode("input",{id:"image-upload",type:"file",ref_key:"imageInput",ref:r,onChange:F,accept:i.value,class:"hidden-input"},null,40,jo),t.createVNode(N,{title:t.unref(o).sendMessage,variant:"bold",class:"q-chatbot__send",disabled:c.value,readonly:c.value,onClick:S},{default:t.withCtx(()=>[t.createVNode(k,{icon:"send"})]),_:1},8,["title","disabled","readonly"])])],34)],64)}}}),zo="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20126.25%20110.36'%3e%3cdefs%3e%3cradialGradient%20id='radial-gradient'%20cx='45.24'%20cy='38.05'%20fx='45.24'%20fy='38.05'%20r='59.09'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%2331319e'/%3e%3cstop%20offset='.19'%20stop-color='%232e2e97'/%3e%3cstop%20offset='.45'%20stop-color='%23292985'/%3e%3cstop%20offset='.75'%20stop-color='%23202067'/%3e%3cstop%20offset='1'%20stop-color='%2317174a'/%3e%3c/radialGradient%3e%3clinearGradient%20id='linear-gradient'%20x1='82.65'%20y1='50.41'%20x2='82.65'%20y2='77.5'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='.02'%20stop-color='%2366ebfe'/%3e%3cstop%20offset='.96'%20stop-color='%2300bfdb'/%3e%3c/linearGradient%3e%3clinearGradient%20id='linear-gradient-2'%20x1='44.6'%20y1='50.01'%20x2='44.6'%20y2='77.1'%20xlink:href='%23linear-gradient'/%3e%3c/defs%3e%3cg%20isolation='isolate'%3e%3cg%20id='Layer_1'%3e%3cpath%20d='M126.2,61.4c-.2-3.69-2.61-17.39-5.92-22.09-2.42-3.44-5.89-4.03-7.96-4.38-.13-.02-.27-.05-.41-.07-.16-.28-.32-.58-.45-.81-.63-1.14-1.03-1.87-1.44-2.44-6.96-9.88-14.91-16.51-24.85-20.69-.25-2.29-.84-5.24-3.37-7.44-2.93-2.55-7.58-2.9-11.68-3.21-.93-.07-1.82-.14-2.4-.22l-.33-.05h-8.61l-.36.05c-.65.1-1.61.17-2.63.24-3.75.27-8.01.57-10.98,2.85-2.94,2.26-3.58,5.55-3.79,7.84-9.71,3.94-17.86,10.71-24.85,20.62-.4.57-.81,1.3-1.43,2.44-.13.23-.29.53-.45.81-.14.02-.28.05-.4.07-2.07.35-5.54.94-7.96,4.39-2.25,3.19-3.84,9.89-4.58,13.59-.6,2.97-1.9,10.3-1.08,14.26.79,3.78,3.66,5.6,5.37,6.68.12.08.26.16.39.25,1.65,10.03,6.98,18.56,15.52,24.77,9.23,6.72,20.2,9.43,27.78,10.52,4.49.65,9.15.97,13.85.97,9.67,0,23.77-1.39,36-8.02,11.58-6.27,18.81-16,21.04-28.24,4.52-2.76,6.36-5.67,5.98-12.71Z'%20fill='%2317174a'/%3e%3cpath%20d='M67.15,4.69c2.98.42,9.31.31,11.62,2.31,1.99,1.73,1.65,4.82,2.06,7.22,10.77,3.89,18.73,10.59,25.39,20.04.64.91,2.13,3.95,2.58,4.33,1.71,1.46,5.54.35,7.67,3.37,2.29,3.25,4.83,15.41,5.06,19.59.31,5.82-.76,6.9-5.58,9.44-3.28,26.16-29.7,34.5-52.68,34.5-4.6,0-9.06-.33-13.17-.93-18.13-2.61-37.11-12.11-39.51-33.08-1.7-1.92-4.96-2.54-5.55-5.39-.95-4.56,2.21-20.32,4.89-24.14,2.13-3.02,5.96-1.91,7.67-3.37.46-.39,1.94-3.42,2.58-4.33,6.54-9.28,14.55-16.22,25.21-19.87.85-.87-.3-5.45,2.43-7.55,2.52-1.94,8.35-1.69,11.42-2.16h7.91'%20fill='%23fff'/%3e%3cpath%20d='M121.86,61.51c-.22-4.2-2.78-16.43-5.07-19.7-1.77-2.51-4.71-2.18-6.64-2.83.1,1.18.16,2.37.16,3.57,0,26.85-25.96,48.61-57.98,48.61-15.83,0-30.17-5.32-40.63-13.94,4.91,17.1,22.06,25.14,38.51,27.52,4.12.59,8.6.93,13.21.93,23.06,0,49.57-8.38,52.85-34.68,4.83-2.56,5.91-3.63,5.6-9.49Z'%20fill='%23d0d7e2'%20mix-blend-mode='multiply'%20opacity='.4'/%3e%3cpath%20d='M62.91,97.68c5.82,0,11.67-.53,16.72-1.56,13.1-2.67,22.09-8.06,26.72-16.03,4.43-7.63,4.75-17.33.96-28.84-4.28-13-13.22-22.77-24.7-27.89-.13,4.51-3.84,8.16-8.38,8.16h-20.89c-4.61,0-8.39-3.78-8.39-8.39v-.14c-5.36,2.25-10.29,5.49-14.5,9.61-8.23,8.06-13.16,19.02-13.9,30.84-.59,9.44,2.67,17.53,9.43,23.42,6.27,5.46,15.68,9.02,27.2,10.3,3.13.35,6.43.52,9.73.52'%20fill='url(%23radial-gradient)'/%3e%3crect%20x='74.34'%20y='50.41'%20width='16.62'%20height='27.09'%20rx='4.06'%20ry='4.06'%20fill='url(%23linear-gradient)'/%3e%3crect%20x='36.29'%20y='50.01'%20width='16.62'%20height='27.09'%20rx='4.06'%20ry='4.06'%20fill='url(%23linear-gradient-2)'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Ho="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF2GlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRj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OAi4GTQrDji8CpSorQz4Y5NTRCd+Bes5UKQ2+bVfdDwHP1qH7mev5X0CklziW8WhfTgO8G9VDVHXAHo0w0i44wa0PkzMh+ApirpHi3Rn3/AnAUuuDySUA2xK/fYBaV99XS/k5Ev/w+6IPetTo6+TraP74MnZHnFWClkuK/Zfbv8+j6UYcaR8xh6JOAB9eovwIYH0VoU2QP5F3P7wxMRj9BiarSSzuwCvjA/L3VtdrFvPYE9ie6qqYb0Omgfh3VKcvIIy5czz8YfQbnFJpLbegDeZGmjqxbSI3r+ScCtwL9GhzsS+jQ1tn1aLxuNRvMBR8OTCD4MZk4SJprO6JecOs6govcn88GfggcEXOwz5uZaboN2Qysi3p0Pf8Y40A4lfgUY96IduzcoaR4xqaOWRvW6nr+3sZJcg4wxNJuLjSOl2lKirU2djAWccvGkX+6cTYcE+G2pti26xnjZJkZhwcisQtMN6kCW4Ch5jUYyNSoufeMU2IBOtxmnpJiQ5zs1RAnD0xS837orHIHAb2MAyODDgzcs8j9fKNxgKwzIFehE8G9gT6fu1RJsSrutvk/GdqIAV0smzEAAAAASUVORK5CYII=",Zo={class:"q-chatbot"},Jo={class:"q-chatbot__content"},Wo={class:"q-chatbot__footer-container"};return t.defineComponent({name:"ChatBot",__name:"ChatBot",props:{apiEndpoint:{default:"http://localhost:3000"},controllerEndpoint:{},username:{},projectPath:{},userImage:{default:Ho},chatbotImage:{default:zo},dateFormat:{},agentData:{default:()=>({id:"",formId:"",jobId:""})},availableAgents:{default:()=>[]}},emits:["apply-fields"],setup(e,{emit:n}){const o=n,a=e,r=t.ref(!0),l=t.ref(null),i=t.ref(!0),s=t.ref(a.agentData.id),u=t.ref(a.agentData.formId),f=H(),{isLoading:g,clearChatData:c,getChatData:m,getFieldSuggestionData:y,sendPrompt:x}=We(a.apiEndpoint),{messages:$,addChatMessage:S,clearMessages:U,getLastMessage:M}=Ke(),F=t.computed(()=>r.value||g.value);t.onBeforeMount(()=>{var b;(b=l.value)==null||b.removeEventListener("scroll",O)}),t.onMounted(()=>{I()});function _(b){r.value=b}async function I(){try{await k()}catch(b){S(f.loginError),console.error("Error logging in: "+b)}}async function k(){_(!0);const{data:b,error:h}=await m(a.username,a.projectPath,s.value,u.value);if(h||!b||!b.success){_(!0),S(f.botIsSick),console.log("Error loading chat data: "+h);return}_(!1),N(),b.history.forEach(async E=>{const T=E.imageUrl?a.controllerEndpoint+E.imageUrl:void 0;S(E.content,E.type==="ai"?"bot":"user",T,E.sessionID)})}function N(){const b=f.initialMessage;S(b,"bot",null,void 0,!0)}function V(){U(),_(!1),i.value=!0}function R(){t.nextTick(()=>{l.value&&(l.value.scrollTop=l.value.scrollHeight)})}function O(){if(l.value){const{scrollTop:h,clientHeight:E,scrollHeight:T}=l.value;i.value=h+E>=T-20}}async function d(b,h){l.value&&l.value.scrollTo({top:l.value.scrollHeight,behavior:"smooth"}),S(b,"user",h==null?void 0:h.previewUrl),t.nextTick(()=>{i.value&&R()}),w(b,h==null?void 0:h.file)}async function p(b){l.value&&l.value.scrollTo({top:l.value.scrollHeight,behavior:"smooth"}),S("","bot"),t.nextTick(()=>{i.value&&R()});const h=M();h&&await y(b,E=>{h.message+=E,h.fields||(h.fields=[]);const T=h.fields[h.fields.length-1];T.text=h.message,i.value&&R()},E=>{var L;h.message="";const T=E;(L=h.fields)==null||L.push({type:T.type,name:T.name,text:T.text})})}async function w(b,h){S("","bot");const E=M();if(!E)return;const T=(E==null?void 0:E.sessionID)||Xe(),L=new FormData;h&&L.append("image",h),L.append("message",b),L.append("project",a.projectPath),L.append("user",a.username),L.append("sessionID",T),L.append("agentID",s.value),L.append("formId",u.value),await x(L,Z=>{E&&(E.message+=Z),i.value&&R()},Z=>{_(!0),S(f.botIsSick),console.error("Error sending message: "+Z)})}async function A(){const{data:b,error:h}=await c(a.username,a.projectPath,s.value,u.value);if(h||!b||!b.success){_(!0),S(f.loginError),console.log("Error clearing chat: "+h);return}V(),N()}function B(b){const h=["q-chatbot__messages-wrapper"];return b==="user"&&h.push("q-chatbot__messages-wrapper_right"),h}function D(b){s.value=b.key,u.value=b.formId,V(),k()}function C(b){!b||b.length===0||o("apply-fields",b)}return t.watch(()=>a.availableAgents,(b,h)=>{b.length===0&&h.length>0&&(s.value="",u.value="",V(),I())}),t.watch(()=>a.agentData,async(b,h)=>{var E;F.value||(((E=a.agentData)==null?void 0:E.id)!==(h==null?void 0:h.id)&&(s.value=(b==null?void 0:b.id)||"",u.value=(b==null?void 0:b.formId)||"",V(),await I()),(b==null?void 0:b.id)!==""&&b&&b.jobId!==h.jobId&&await p(b.jobId))}),t.watch(()=>[a.agentData.id,a.agentData.formId],([b,h])=>{s.value=b,u.value=h},{immediate:!0}),(b,h)=>(t.openBlock(),t.createElementBlock("div",Zo,[t.createElementVNode("div",Jo,[t.createVNode(t.unref(Fo),{disabled:F.value,"available-agents":a.availableAgents,"selected-agent-key":s.value,onClear:A,onChangeChat:D},null,8,["disabled","available-agents","selected-agent-key"]),t.createElementVNode("div",{ref_key:"messagesContainer",ref:l,class:"q-chatbot__messages-container",onScroll:O},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($),E=>(t.openBlock(),t.createElementBlock("div",{key:E.id,class:t.normalizeClass(B(E.sender))},[t.createVNode(t.unref(No),t.mergeProps({ref_for:!0},E,{"date-format":a.dateFormat,"user-image":a.userImage,"chatbot-image":a.chatbotImage,loading:t.unref(g)&&!E.message,imagePreviewUrl:E.imagePreviewUrl,apiEndpoint:a.apiEndpoint,sessionID:E.sessionID,fields:E.fields,onApplyFields:C}),null,16,["date-format","user-image","chatbot-image","loading","imagePreviewUrl","apiEndpoint","sessionID","fields"])],2))),128))],544)]),t.createElementVNode("div",Wo,[t.createVNode(t.unref(Go),{disabled:F.value,loading:t.unref(g),onSendMessage:d},null,8,["disabled","loading"])])]))}})});
|
|
45
|
+
`;return t.onMounted(()=>{document.body.setAttribute(Q,(a()+1).toString());const l=In(n.gapMode);o.add(r(l,!n.noRelative,n.gapMode,n.noImportant?"":"!important"))}),t.onUnmounted(()=>{const l=a()-1;l<=0?document.body.removeAttribute(Q):document.body.setAttribute(Q,l.toString()),o.remove()}),(l,i)=>t.renderSlot(l.$slots,"default")}}));function Rn(e,n,o,a){const r=(a==null?void 0:a.offset)??0,l=(a==null?void 0:a.crossOffset)??0,i=(a==null?void 0:a.placement)??"bottom",s=e.getBoundingClientRect(),u=n.getBoundingClientRect(),f=o==null?void 0:o.getBoundingClientRect(),g=Tn(s,u,i,r),c=Un(s,u,g),m=Vn(c,g,r),y=Pn(m,g,l),x=Fn(y,u,g);let $;if(a!=null&&a.arrow){if(!f)throw new Error("[Quidgest UI] The arrow element must exist to compute its position");$=On(x,s,u,f,g)}return{overlayCoords:x,arrowCoords:$,placement:g}}function Tn(e,n,o,a){const r=ze(e,n,o,a);if(He(r)){const l=X(o),i={top:"bottom",bottom:"top",left:"right",right:"left"}[l],s=ze(e,n,i,a);if(He(s))return o;const u=Gn(o);return u?`${i}-${u}`:i}return o}function Fn(e,n,o){const a=pe(o),r=(i,s,u)=>Math.min(Math.max(i,s),u),l={...e};return a==="x"?l.x=r(e.x,8,window.innerWidth-n.width-8):l.y=r(e.y,8,window.innerHeight-n.height-8),l}function Vn(e,n,o){const a=X(n);return{x:e.x+(a==="left"?-o:a==="right"?o:0),y:e.y+(a==="top"?-o:a==="bottom"?o:0)}}function Pn(e,n,o){const a=X(n);return{x:e.x+(a==="top"||a==="bottom"?o:0),y:e.y+(a==="right"||a==="left"?o:0)}}function On(e,n,o,a,r){if(pe(r)==="y"){const l=n.top+n.height/2,i=e.y+o.height/2,s=i-l,u=o.height/2-s-a.height/2+2;if(u>0&&u<o.height-a.height)return{y:u}}else{const l=n.left+n.width/2,i=e.x+o.width/2,s=i-l,u=o.width/2-s-a.width/2+2;if(u>0&&u<o.width-a.width)return{x:u}}}function Un(e,n,o){const[a,r]=o.split("-"),l=e.x+e.width/2-n.width/2,i=e.y+e.height/2-n.height/2;let s;switch(a){case"top":s={x:l,y:e.y-n.height};break;case"bottom":s={x:l,y:e.y+e.height};break;case"left":s={x:e.x-n.width,y:i};break;case"right":s={x:e.x+e.width,y:i};break;default:throw new Error(`[Quidgest UI] Invalid placement value: ${o}`)}if(!r)return s;const u=pe(o)==="y"?"height":"width",f=pe(o),g=e[u]/2-n[u]/2;switch(r){case"start":s[f]-=g;break;case"end":s[f]+=g;break;default:throw new Error(`[Quidgest UI] Invalid alignment value: ${r}`)}return s}function ze(e,n,o,a){const r=X(o);let l=0;switch(r){case"top":l=e.top-(n.height+a);break;case"bottom":l=window.innerHeight-e.bottom-(n.height+a);break;case"left":l=e.left-(n.width+a);break;case"right":l=window.innerWidth-e.right-(n.width+a);break;default:throw new Error(`[Quidgest UI] Invalid side value: ${r}`)}return l}function qn(e){return e==="x"?"y":"x"}function jn(e){const n=X(e);return["left","right"].includes(n)?"x":"y"}function pe(e){return qn(jn(e))}function X(e){const[n]=e.split("-");return n}function Gn(e){const[,n]=e.split("-");return n}function He(e){return e<0}function zn(e){return typeof e=="string"?document.querySelector(e):e}const Hn=["id"],Zn=["role"],Jn=q(t.defineComponent({inheritAttrs:!1,__name:"QOverlay",props:t.mergeModels({id:{},class:{},anchor:{},appearance:{default:"regular"},arrow:{type:Boolean},attach:{default:"body"},inline:{type:Boolean},backdropBlur:{type:Boolean},backdropClass:{},delay:{default:500},nonModal:{type:Boolean},scrollLock:{type:Boolean},offset:{default:8},crossOffset:{default:0},persistent:{type:Boolean},placement:{default:"right"},spy:{type:Boolean},transition:{default:"fade"},trigger:{default:"click"},width:{default:"auto"},focusTrap:{type:Boolean},centerVertically:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:t.mergeModels(["enter","leave"],["update:modelValue"]),setup(e,{emit:n}){const o=e,a=n,r=t.useModel(e,"modelValue"),{class:l}=$e(),i=t.computed(()=>["q-overlay",`q-overlay--${X(c.placement)}`,l.value,{"q-overlay--independent":s.value,"q-overlay--inverted":o.appearance==="inverted","q-overlay--center":o.centerVertically},o.class]),s=t.computed(()=>o.anchor===void 0),u=t.computed(()=>r.value&&!o.nonModal),f=t.computed(()=>(r.value||c.animating)&&o.scrollLock),g=t.computed(()=>!o.inline&&(r.value||c.animating)),c=t.reactive({animating:!1,top:0,left:0,width:0,placement:o.placement}),m=t.reactive({top:void 0,left:void 0,hidden:!0});t.watch(r,w);const y=t.computed(()=>{if(s.value)return;const v=B(),J=o.width==="anchor",j=J?v==null?void 0:v.getBoundingClientRect().width:void 0;return{top:`${c.top}px`,left:`${c.left}px`,width:j!==void 0?`${j}px`:void 0}}),x=t.computed(()=>{if(o.arrow)return{top:m.top!==void 0?`${m.top}px`:void 0,left:m.left!==void 0?`${m.left}px`:void 0,opacity:m.hidden?0:1}}),$=t.ref(null),S=t.ref(null),U=t.ref(null);function M(){const v=B();if(!v||!S.value)return;const J={placement:o.placement,width:o.width,offset:o.offset,crossOffset:o.crossOffset,arrow:o.arrow},j=Rn(v,S.value,($==null?void 0:$.value)??void 0,J);c.left=j.overlayCoords.x,c.top=j.overlayCoords.y,c.placement=j.placement,m.hidden=j.arrowCoords===void 0,j.arrowCoords&&(m.top=j.arrowCoords.y,m.left=j.arrowCoords.x)}t.watch(()=>o.placement,()=>t.nextTick(M));let F;function C(){k(0)}function I(){k(o.delay)}function k(v){F&&V(),F=window.setTimeout(()=>{r.value=!0},v)}function N(){if(F&&V(),r.value=!1,o.anchor&&o.trigger==="click"){const v=B();t.nextTick(()=>v==null?void 0:v.focus())}}function V(){clearTimeout(F),F=void 0}function R(){t.nextTick(le),a("enter")}function O(){A()}function d(){a("leave")}function p(){A(),Yo()}function w(){c.animating=!0}function A(){c.animating=!1}function B(){return o.anchor?zn(o.anchor):null}function D(v){o.persistent&&v.preventDefault()}function _(v){var J;if(o.persistent){v.preventDefault();return}let j=!1;v.defaultPrevented||v.detail.originalEvent.type==="pointerdown"&&(j=!0);const Qo=v.detail.originalEvent.target;if((J=B())!=null&&J.contains(Qo)){v.preventDefault();return}v.detail.originalEvent.type==="focusin"&&j&&v.preventDefault()}function b(){N()}let h;function E(){const v=B();if(v)switch(h=new MutationObserver(M),h.observe(v,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),o.trigger){case"click":v.addEventListener("click",C);break;case"hover":v.addEventListener("mouseenter",I),v.addEventListener("mouseleave",N),v.addEventListener("focusin",C),v.addEventListener("focusout",N);break}}function T(){const v=B();if(v)switch(h==null||h.disconnect(),o.trigger){case"click":v.removeEventListener("click",C);break;case"hover":v.removeEventListener("mouseenter",I),v.removeEventListener("mouseleave",N),v.removeEventListener("focusin",C),v.removeEventListener("focusout",N);break}}function L(){window.addEventListener("resize",M),o.scrollLock||window.addEventListener("scroll",M)}function Z(){window.removeEventListener("resize",M),o.scrollLock||window.removeEventListener("scroll",M)}let K;function ee(){B()?(M(),K=window.setTimeout(ee,100)):N()}function le(){var v;s.value||(L(),o.spy?ee():M()),(s.value||o.trigger==="click")&&((v=S.value)==null||v.focus())}function Yo(){s.value||Z(),o.spy&&(clearTimeout(K),K=void 0)}return t.onMounted(()=>{t.nextTick(E)}),t.onBeforeUnmount(T),(v,J)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[(t.openBlock(),t.createBlock(t.Teleport,{disabled:!g.value,to:o.attach},[t.createVNode(t.Transition,{name:"fade",appear:""},{default:t.withCtx(()=>[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass([o.backdropClass,"q-overlay__underlay",{"q-overlay__underlay--blur":o.backdropBlur}])},null,2)):t.createCommentVNode("v-if",!0)]),_:1}),t.createVNode(t.Transition,{name:o.transition,appear:"",onEnter:R,onAfterEnter:O,onLeave:d,onAfterLeave:p},{default:t.withCtx(()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,id:o.id,ref_key:"overlayContainerRef",ref:U,tabindex:"-1",class:t.normalizeClass(i.value),style:t.normalizeStyle(y.value)},[t.createVNode(t.unref(jt),{onDismiss:b,onInteractOutside:_,onPointerDownOutside:D},{default:t.withCtx(()=>[U.value?(t.openBlock(),t.createBlock(t.unref(Cn),{key:0,disabled:o.nonModal||!r.value,options:{fallbackFocus:U.value}},{default:t.withCtx(()=>[t.createElementVNode("div",t.mergeProps({ref_key:"overlayRef",ref:S,class:"q-overlay__content",tabindex:"-1",role:u.value?"dialog":void 0},v.$attrs),[o.arrow?(t.openBlock(),t.createElementBlock("div",{key:0,ref_key:"arrowRef",ref:$,role:"presentation",class:"q-overlay__arrow",style:t.normalizeStyle(x.value)},null,4)):t.createCommentVNode("v-if",!0),t.renderSlot(v.$slots,"default")],16,Zn)]),_:3},8,["disabled","options"])):t.createCommentVNode("v-if",!0)]),_:3})],14,Hn)):t.createCommentVNode("v-if",!0)]),_:3},8,["name"])],8,["disabled","to"])),f.value?(t.openBlock(),t.createBlock(t.unref(Mn),{key:0})):t.createCommentVNode("v-if",!0)],64))}})),Wn=[{id:"button",icon:{icon:"check"},props:{variant:"bold",label:"Ok"}}],Yn={icon:"check-circle-outline"},Qn={close:{icon:"close"}},Xn={key:0,class:"q-dialog__header"},Kn={class:"q-dialog__header-title"},eo={key:1,class:"q-dialog__body"},to={key:0,class:"q-dialog__body-icon"},no={class:"q-dialog__body-text"},oo=["innerHTML"],ao={key:1},ro={key:2,class:"q-dialog__footer"},lo={class:"q-dialog__footer-buttons"},io=t.defineComponent({__name:"QDialog",props:t.mergeModels({id:{},class:{},title:{},text:{},icon:{default:()=>Yn},buttons:{default:()=>Wn},attach:{default:"body"},inline:{type:Boolean},backdropBlur:{type:Boolean,default:!0},dismissible:{type:Boolean},html:{type:Boolean,default:!0},icons:{default:()=>Qn},size:{default:"small"},centerVertically:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:t.mergeModels(["enter","leave"],["update:modelValue"]),setup(e,{emit:n}){const o=e,a=n,r=t.useModel(e,"modelValue"),l=t.computed(()=>["q-dialog",o.class]),i=t.computed(()=>`q-overlay--${o.size}`);function s(){r.value=!1}function u(c){var m;(m=c.action)==null||m.call(c),s()}function f(){a("enter")}function g(){a("leave")}return(c,m)=>(t.openBlock(),t.createBlock(t.unref(Jn),{id:o.id,modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=y=>r.value=y),"backdrop-class":"q-dialog__underlay","scroll-lock":"",persistent:"",inline:o.inline,attach:o.attach,"backdrop-blur":o.backdropBlur,"center-vertically":o.centerVertically,class:t.normalizeClass(i.value),onEnter:f,onLeave:g},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(l.value)},[o.title||c.$slots.header?(t.openBlock(),t.createElementBlock("div",Xn,[t.renderSlot(c.$slots,"header",{},()=>[t.createElementVNode("span",Kn,t.toDisplayString(o.title),1)])])):t.createCommentVNode("v-if",!0),o.icon||o.text||c.$slots.body?(t.openBlock(),t.createElementBlock("div",eo,[t.renderSlot(c.$slots,"body",{},()=>[t.renderSlot(c.$slots,"body.icon",{},()=>[o.icon?(t.openBlock(),t.createElementBlock("span",to,[t.createVNode(t.unref(ne),t.normalizeProps(t.guardReactiveProps(o.icon)),null,16)])):t.createCommentVNode("v-if",!0)]),t.createElementVNode("div",no,[o.html?(t.openBlock(),t.createElementBlock("div",{key:0,innerHTML:o.text},null,8,oo)):(t.openBlock(),t.createElementBlock("div",ao,t.toDisplayString(o.text),1))]),t.renderSlot(c.$slots,"body.append")])])):t.createCommentVNode("v-if",!0),o.buttons||c.$slots.footer?(t.openBlock(),t.createElementBlock("div",ro,[t.renderSlot(c.$slots,"footer",{},()=>[t.createElementVNode("span",lo,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.buttons,y=>(t.openBlock(),t.createBlock(t.unref(ye),t.mergeProps({ref_for:!0},y.props,{key:y.id,onClick:()=>u(y)}),{default:t.withCtx(()=>[y.icon?(t.openBlock(),t.createBlock(t.unref(ne),t.mergeProps({key:0,ref_for:!0},y.icon),null,16)):t.createCommentVNode("v-if",!0)]),_:2},1040,["onClick"]))),128))])])])):t.createCommentVNode("v-if",!0),o.dismissible?(t.openBlock(),t.createBlock(t.unref(ye),{key:3,class:"q-dialog__close",variant:"text",onClick:s},{default:t.withCtx(()=>[t.createVNode(t.unref(ne),t.normalizeProps(t.guardReactiveProps(o.icons.close)),null,16)]),_:1})):t.createCommentVNode("v-if",!0)],2)]),_:3},8,["id","modelValue","inline","attach","backdrop-blur","center-vertically","class"]))}}),fe=t.reactive({dialogs:[]});function so(){function e(o,a){const r=Mt(a);return fe.dialogs.push({id:r,props:o}),r}function n(o){const a=fe.dialogs.findIndex(r=>r.id===o);a!==-1&&fe.dialogs.splice(a,1)}return{...fe,addDialog:e,removeDialog:n}}const co=t.defineComponent({inheritAttrs:!1,__name:"QDialogProvider",setup(e){const{dialogs:n,removeDialog:o}=so();return(a,r)=>(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(n),l=>(t.openBlock(),t.createBlock(t.unref(Ze),t.mergeProps({key:l.id,ref_for:!0},l.props,{"model-value":"",onLeave:()=>t.unref(o)(l.id)}),null,16,["onLeave"]))),128))}}),Ze=q(io);q(co);function H(){return{copy:"Copy",apply:"Apply",applyAll:"Apply all",chatbotTitle:"ChatBot",sendMessage:"Send message",clearChat:"Clear chat",inputLabel:"What can I help with?",imageUpload:"Upload Image",imageUploadQButton:"Upload Image",goodResponse:"Good response",badResponse:"Bad response",initialMessage:"Howdy! I am GenioBot 👋, Quidgest's personal AI assistant! How can I help you?",initialAgentMessage:"Just a temporary message while we are working on the agent mode",loginError:"Uh oh, I could not authenticate with the Quidgest API endpoint 😓",botIsSick:"*cough cough* GenioBot is not feeling alright 🥴️🤒, looks like something failed!",commentDialogTitle:"Would you like to add a comment?",commentPlaceholder:"Type your comment here (optional)...",copyResponse:"Copy response",submitButton:"Submit",cancelButton:"Cancel",senderImage:"Sender Image",imagePreview:"Image preview",regenerateResponse:"Regenerate response",generatingResponse:"Generating"}}async function Je(e,n){var u,f,g,c,m,y;const o=new AbortController,a=o.signal,l=(await W({...e,headers:{Accept:"text/event-stream"},responseType:"stream",signal:a,adapter:"fetch"})).data;if(!l||!(l instanceof ReadableStream))throw new Error("Invalid stream response");const i=l.getReader(),s=new TextDecoder;for(;;){const{done:x,value:$}=await i.read();if(x){(u=n.onDone)==null||u.call(n);break}const U=s.decode($,{stream:!0}).split(/\n\n+/);for(const M of U){const F=M.trim().split(`
|
|
46
|
+
`);let C="",I="";for(const k of F)k.startsWith("event:")?C=k.replace("event:","").trim():k.startsWith("data:")&&(I=k.replace("data:","").trim());if(C||(C="message"),!!I)try{const k=JSON.parse(I);switch(C){case"message":(f=n.onMessage)==null||f.call(n,k.value);break;case"error":(g=n.onError)==null||g.call(n,new Error(k.value));break;case"field_metadata":(c=n.onFieldMetadata)==null||c.call(n,k);break;case"done":(m=n.onDone)==null||m.call(n);break;default:console.warn(`Unknown event type: ${C}`)}}catch(k){(y=n.onError)==null||y.call(n,k),console.error("Error processing event:",k);continue}finally{x&&(i.releaseLock(),o.abort())}}}}function We(e){const n=t.ref(!1),o=t.ref(null);async function a(f){n.value=!0,o.value=null;try{return{data:(await W({...f,baseURL:e})).data,error:null}}catch(g){return o.value=g,console.error("Error in API request:",g),{data:null,error:g}}finally{n.value=!1}}async function r(f,g,c,m){return await a({method:"POST",url:"/prompt/load",data:{username:f,project:g,agentID:c,formId:m}})}async function l(f,g,c,m){return await a({method:"POST",url:"/prompt/clear",data:{username:f,project:g,agentID:c,formId:m}})}async function i(f,g,c){return n.value=!0,await Je({method:"POST",url:`${e}/prompt/submit`,data:f},{onMessage:m=>{g(m)},onError:m=>{o.value=m,c==null||c(m),console.error("Error in sendPrompt:",m)},onDone:()=>n.value=!1})}async function s(f,g,c){return n.value=!0,await Je({method:"POST",url:`${e}/get-job-result`,data:{jobId:f}},{onMessage:m=>g(m),onFieldMetadata:m=>c(m),onError:m=>{o.value=m,console.error("Error in getFieldSuggestionData:",m)},onDone:()=>n.value=!1})}async function u(f,g,c){return await a({method:"POST",url:"/prompt/feedback",data:{messageSessionID:c,feedbackValue:f,feedbackComment:g}})}return{isLoading:n,lastError:o,getChatData:r,clearChatData:l,getFieldSuggestionData:s,sendPrompt:i,handleFeedback:u}}const uo=["innerHTML"],_e=t.defineComponent({__name:"MarkdownRender",props:{source:{},options:{},plugins:{}},setup(e){const n=e,o=t.ref(new et({html:!0,...n.options??{}}));n.plugins&&n.plugins.forEach(r=>o.value.use(r));const a=t.computed(()=>o.value.render(n.source));return(r,l)=>(t.openBlock(),t.createElementBlock("div",{class:"markdown-renderer",innerHTML:a.value},null,8,uo))}});function Ye(e,n){switch(e){case"date":return new Date(n).toLocaleDateString();case"number":return parseFloat(n);case"boolean":return n.toLowerCase()==="true";default:return n.toString()}}const po={class:"q-field-preview"},fo={class:"q-field-preview__toolbar"},mo={class:"q-field-preview__content"},go={class:"q-field-preview__footer"},bo=t.defineComponent({__name:"FieldPreview",props:{name:{},text:{},type:{},disabled:{type:Boolean},applied:{type:Boolean}},emits:["apply"],setup(e,{emit:n}){const o=H(),a=e,r=t.ref(a.applied),l=t.computed(()=>a.disabled||r.value),i=t.computed(()=>a.type==="text"||a.type==="multiline_text"?_e:"div"),s=t.computed(()=>{const g={};return i.value===_e?g.source=a.text:g.innerHTML=a.text,g}),u=n;function f(){if(r.value)return;r.value=!0;const g=Ye(a.type,a.text);u("apply",g)}return(g,c)=>(t.openBlock(),t.createElementBlock("div",po,[t.createElementVNode("div",fo,[t.createElementVNode("span",null,[c[0]||(c[0]=t.createTextVNode(" Suggestions for field: ")),t.createElementVNode("b",null,t.toDisplayString(a.name),1)])]),t.createElementVNode("div",mo,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(i.value),t.normalizeProps(t.guardReactiveProps(s.value)),null,16))]),t.createElementVNode("div",go,[t.createVNode(t.unref(Tt),{borderless:""},{default:t.withCtx(()=>[t.createVNode(t.unref(ye),{label:t.unref(o).apply,disabled:l.value,readonly:l.value,onClick:f},{default:t.withCtx(()=>[t.createVNode(t.unref(ne),{icon:"apply"})]),_:1},8,["label","disabled","readonly"])]),_:1})])]))}}),ho={class:"pulsing-dots"},yo={class:"generating-text"},wo={class:"dots-container"},vo=t.defineComponent({__name:"PulseDots",setup(e){const n=[1,2,3],o=H();return(a,r)=>(t.openBlock(),t.createElementBlock("div",ho,[t.createElementVNode("span",yo,t.toDisplayString(t.unref(o).generatingResponse),1),t.createElementVNode("div",wo,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(n,(l,i)=>t.createElementVNode("span",{key:i,class:"dot",style:t.normalizeStyle({animationDelay:i*.2+"s"})}," • ",4)),64))])]))}}),ko={class:"q-chatbot__message-container"},Bo={class:"q-chatbot__message-wrapper"},Eo={key:0,class:"q-chatbot__image-preview"},Co=["src","alt"],_o={class:"q-chatbot__message"},Ao={key:1,class:"q-chatbot__text"},No=t.defineComponent({__name:"ChatBotMessage",props:{sender:{default:"user"},message:{},date:{default:()=>new Date},loading:{type:Boolean},dateFormat:{},imagePreviewUrl:{},apiEndpoint:{},sessionID:{},userImage:{default:void 0},chatbotImage:{},isWelcomeMessage:{type:Boolean},fields:{default:()=>[]}},emits:["apply-fields"],setup(e,{emit:n}){const o=n,a=H(),r=e,{handleFeedback:l}=We(r.apiEndpoint),i=t.computed(()=>r.sender==="bot"&&!Object.values(a||{}).includes(r.message||"")&&!r.isWelcomeMessage),s=t.computed(()=>r.sender==="bot"?r.chatbotImage:r.userImage);function u(){r.message&&navigator.clipboard.writeText(r.message).then(()=>{console.log("Response copied to clipboard")}).catch(m=>{console.error("Failed to copy response: ",m)})}function f(m,y){o("apply-fields",[{name:y.name,text:m}])}function g(){if(!r.fields||r.fields.length===0)return;const m=r.fields.map(y=>({name:y.name,text:Ye(y.type,y.text)}));o("apply-fields",m)}function c(m,y){m===null||y===null||!r.sessionID||l(m,y,r.sessionID)}return(m,y)=>(t.openBlock(),t.createElementBlock("div",ko,[t.createVNode(t.unref(ne),{type:"img",icon:s.value,alt:t.unref(a).senderImage,class:"q-chatbot__profile"},null,8,["icon","alt"]),t.createElementVNode("div",Bo,[r.imagePreviewUrl&&r.imagePreviewUrl.length>0?(t.openBlock(),t.createElementBlock("div",Eo,[t.createElementVNode("img",{src:r.imagePreviewUrl,alt:t.unref(a).imagePreview},null,8,Co)])):t.createCommentVNode("",!0),t.createElementVNode("div",_o,[m.loading?(t.openBlock(),t.createBlock(vo,{key:0})):r.sender==="bot"&&r.fields.length>0?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(r.fields,(x,$)=>(t.openBlock(),t.createBlock(t.unref(bo),{class:"q-chatbot__text",key:$,text:x.text||"",name:x.name,type:x.type,disabled:m.loading,onApply:S=>f(S,x)},null,8,["text","name","type","disabled","onApply"]))),128)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[r.sender==="bot"?(t.openBlock(),t.createBlock(t.unref(_e),{key:0,class:"q-chatbot__text",source:r.message||""},null,8,["source"])):(t.openBlock(),t.createElementBlock("div",Ao,t.toDisplayString(r.message),1))],64))])]),t.createVNode(t.unref(Mo),{showButtons:i.value,loading:r.loading,"date-format":r.dateFormat,onCopyResponse:u,onSubmitFeedback:c,onApplyAll:g},null,8,["showButtons","loading","date-format"])]))}}),P=[];for(let e=0;e<256;++e)P.push((e+256).toString(16).slice(1));function So(e,n=0){return(P[e[n+0]]+P[e[n+1]]+P[e[n+2]]+P[e[n+3]]+"-"+P[e[n+4]]+P[e[n+5]]+"-"+P[e[n+6]]+P[e[n+7]]+"-"+P[e[n+8]]+P[e[n+9]]+"-"+P[e[n+10]]+P[e[n+11]]+P[e[n+12]]+P[e[n+13]]+P[e[n+14]]+P[e[n+15]]).toLowerCase()}let Ae;const Io=new Uint8Array(16);function xo(){if(!Ae){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ae=crypto.getRandomValues.bind(crypto)}return Ae(Io)}const Qe={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Xe(e,n,o){var r;if(Qe.randomUUID&&!e)return Qe.randomUUID();e=e||{};const a=e.random??((r=e.rng)==null?void 0:r.call(e))??xo();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,So(a)}const re=t.ref([]),me=t.ref(1);function Ke(){function e(r,l,i,s,u){const f={id:me.value++,message:r,date:new Date,sender:l||"bot",sessionID:s||Xe(),imagePreviewUrl:i||void 0,isWelcomeMessage:u,fields:[]};re.value.push(f)}function n(){return re.value.find(r=>r.id===me.value-1)}function o(){re.value=[],me.value=1}function a(){return re.value}return{messages:re,nextMessageId:me,addChatMessage:e,getLastMessage:n,clearMessages:o,getMessages:a}}const Do={class:"q-chatbot__dialog-title"},$o={key:0,class:"q-chatbot__feedback-buttons"},Lo={class:"q-chatbot__sender"},Mo=t.defineComponent({__name:"ChatBotMessageButtons",props:{loading:{type:Boolean},showButtons:{type:Boolean},dateFormat:{},date:{}},emits:["submit-feedback","copy-response","apply-all"],setup(e,{emit:n}){const o=H(),{getLastMessage:a}=Ke(),r=e,l=t.ref(!1),i=t.ref(""),s=t.ref(null),u=t.ref(!1),f=t.computed(()=>r.loading||u.value),g=r.date||new Date,c=n,m=a(),y=t.computed(()=>m?m.fields&&m.fields.length>1:!1),x=[{id:"confirm-btn",action:C,props:{label:o.submitButton},icon:{icon:"submit"}},{id:"cancel-btn",props:{label:o.cancelButton},icon:{icon:"cancel"}}],$=t.computed(()=>r.dateFormat?U(g,"HH:mm"):g.toLocaleString()),S=t.computed(()=>`${$.value}`);function U(k,N){const V=k.getDate().toString().padStart(2,"0"),R=(k.getMonth()+1).toString().padStart(2,"0"),O=k.getFullYear().toString().padStart(2,"0"),d=k.getHours().toString().padStart(2,"0"),p=k.getMinutes().toString().padStart(2,"0"),w=k.getSeconds().toString().padStart(2,"0");return N.replace("dd",V).replace("MM",R).replace("yyyy",O).replace("HH",d).replace("mm",p).replace("ss",w)}function M(k){l.value=!0,i.value="",s.value=k}function F(){u.value||(u.value=!0,c("apply-all"))}function C(){s.value!==null&&(c("submit-feedback",s.value,i.value),l.value=!1,i.value="",s.value=null)}function I(){c("copy-response")}return(k,N)=>{const V=t.resolveComponent("q-text-field"),R=t.resolveComponent("q-icon"),O=t.resolveComponent("q-button"),d=t.resolveComponent("q-button-group");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(Ze),{modelValue:l.value,"onUpdate:modelValue":N[1]||(N[1]=p=>l.value=p),buttons:x},{body:t.withCtx(()=>[t.createElementVNode("div",Do,t.toDisplayString(t.unref(o).commentDialogTitle),1),t.createVNode(V,{modelValue:i.value,"onUpdate:modelValue":N[0]||(N[0]=p=>i.value=p),maxLength:150,size:"large",placeholder:t.unref(o).commentPlaceholder},null,8,["modelValue","placeholder"])]),_:1},8,["modelValue"]),k.showButtons?(t.openBlock(),t.createElementBlock("div",$o,[t.createVNode(d,null,{default:t.withCtx(()=>[t.createVNode(O,{title:t.unref(o).goodResponse,borderless:"",disabled:r.loading,onClick:N[2]||(N[2]=p=>M(1))},{default:t.withCtx(()=>[t.createVNode(R,{icon:"thumb-up"})]),_:1},8,["title","disabled"]),t.createVNode(O,{title:t.unref(o).badResponse,borderless:"",disabled:r.loading,onClick:N[3]||(N[3]=p=>M(0))},{default:t.withCtx(()=>[t.createVNode(R,{icon:"thumb-down"})]),_:1},8,["title","disabled"]),t.createVNode(O,{title:t.unref(o).copyResponse,borderless:"",disabled:r.loading,onClick:I},{default:t.withCtx(()=>[t.createVNode(R,{icon:"copy-content"})]),_:1},8,["title","disabled"]),y.value?(t.openBlock(),t.createBlock(O,{key:0,title:t.unref(o).applyAll,borderless:"",disabled:f.value,readonly:f.value,onClick:F},{default:t.withCtx(()=>[t.createVNode(R,{icon:"apply-all"})]),_:1},8,["title","disabled","readonly"])):t.createCommentVNode("",!0)]),_:1})])):t.createCommentVNode("",!0),t.createElementVNode("div",Lo,t.toDisplayString(S.value),1)],64)}}}),Ro={class:"q-chatbot__tools"},To={class:"q-chatbot__tools__select"},Fo=t.defineComponent({__name:"ChatToolBar",props:{disabled:{type:Boolean},availableAgents:{default:()=>[]},selectedAgentKey:{}},emits:["clear","change-chat"],setup(e,{emit:n}){const{clearChat:o}=H(),a={key:"",value:"Default Chat",formId:""},r=e,l=n,i=t.computed(()=>r.availableAgents&&r.availableAgents.length>0),s=t.ref(r.selectedAgentKey||a.key);t.watch(()=>r.selectedAgentKey,c=>{s.value=c||a.key});const u=t.computed(()=>{var m;const c=(m=r.availableAgents)==null?void 0:m.map(y=>({key:y.key,value:y.value,formId:y.formId}));return c==null||c.push(a),c||[a]});function f(){l("clear")}function g(c){const m=u.value.find(y=>y.key===c);if(m){if(m.key===a.key){l("change-chat",{key:"",formId:""});return}l("change-chat",m)}}return(c,m)=>{const y=t.resolveComponent("q-select"),x=t.resolveComponent("q-icon"),$=t.resolveComponent("q-button");return t.openBlock(),t.createElementBlock("div",Ro,[t.createElementVNode("div",To,[i.value?(t.openBlock(),t.createBlock(y,{key:0,modelValue:s.value,"onUpdate:modelValue":[m[0]||(m[0]=S=>s.value=S),g],size:"medium",items:u.value},null,8,["modelValue","items"])):t.createCommentVNode("",!0)]),t.createVNode($,{title:t.unref(o),disabled:r.disabled,borderless:"",onClick:f},{default:t.withCtx(()=>[t.createVNode(x,{icon:"bin"})]),_:1},8,["title","disabled"])])}}}),Vo={class:"q-chatbot__input-wrapper"},Po={key:0,class:"q-chatbot__image-preview"},Oo=["src"],Uo={class:"q-chatbot__input"},qo={class:"q-chatbot__send-container"},jo=["accept"],Go=t.defineComponent({__name:"ChatBotInput",props:{disabled:{type:Boolean},loading:{type:Boolean},userPrompt:{},agentId:{}},emits:["sendMessage"],setup(e,{emit:n}){const o=H(),a=e,r=t.ref(null),l=t.ref(""),i=t.computed(()=>".png, .jpeg, .jpg, .svg, .webp"),s=t.ref(!1),u=t.ref(!1),f=t.ref(a.userPrompt??""),g=n,c=t.computed(()=>a.disabled||a.loading||f.value.trim().length===0);function m(C){C.preventDefault(),a.disabled||(u.value=!0)}const y=t.computed(()=>({"q-chatbot__footer-disabled":a.disabled,"drag-over":u.value&&!s.value}));function x(C){C.preventDefault(),u.value=!1}function $(C){var N;if(C.preventDefault(),u.value=!1,a.disabled||s.value)return;const I=(N=C.dataTransfer)==null?void 0:N.files;if(!I)return;const k=I[0];if(k.type.startsWith("image/")){if(!r.value)return;const V=new DataTransfer;V.items.add(k),r.value.files=V.files,l.value=URL.createObjectURL(k),s.value=!0}}function S(){if(!(f.value.trim()===""||a.loading||a.disabled)){if(r.value&&r.value.files&&r.value.files.length>0){const I={file:r.value.files[0],previewUrl:l.value};g("sendMessage",f.value,I),U()}else g("sendMessage",f.value);f.value=""}}function U(){l.value="",r.value&&(r.value.value="",r.value.files=null),s.value=!1}function M(){var C;(C=r.value)==null||C.click()}function F(C){const I=C.target;r.value=I,I.files&&I.files[0]&&(l.value=URL.createObjectURL(I.files[0]),s.value=!0)}return(C,I)=>{const k=t.resolveComponent("q-icon"),N=t.resolveComponent("q-button"),V=t.resolveComponent("q-text-area");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(Pt),{label:t.unref(o).inputLabel},null,8,["label"]),t.createElementVNode("div",{class:t.normalizeClass(["q-chatbot__footer",y.value]),onDragover:t.withModifiers(m,["prevent"]),onDragleave:t.withModifiers(x,["prevent"]),onDrop:t.withModifiers($,["prevent"])},[t.createElementVNode("div",Vo,[l.value?(t.openBlock(),t.createElementBlock("div",Po,[t.createElementVNode("img",{src:l.value,tabindex:"0",alt:"Image preview"},null,8,Oo),t.createVNode(N,{class:"q-chatbot__remove-image",tabindex:"0",flat:"",round:"",onClick:U},{default:t.withCtx(()=>[t.createVNode(k,{icon:"bin"})]),_:1})])):t.createCommentVNode("",!0),t.createElementVNode("div",Uo,[t.createVNode(V,{modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=R=>f.value=R),size:"block",autosize:"",resize:"none",rows:2,disabled:a.disabled,onKeyup:t.withKeys(S,["enter"])},null,8,["modelValue","disabled"])])]),t.createElementVNode("div",qo,[t.createVNode(N,{title:t.unref(o).imageUpload,class:"q-chatbot__upload",disabled:a.disabled||a.loading||s.value,onClick:M},{default:t.withCtx(()=>[t.createVNode(k,{icon:"upload"})]),_:1},8,["title","disabled"]),t.createElementVNode("input",{id:"image-upload",type:"file",ref_key:"imageInput",ref:r,onChange:F,accept:i.value,class:"hidden-input"},null,40,jo),t.createVNode(N,{title:t.unref(o).sendMessage,variant:"bold",class:"q-chatbot__send",disabled:c.value,readonly:c.value,onClick:S},{default:t.withCtx(()=>[t.createVNode(k,{icon:"send"})]),_:1},8,["title","disabled","readonly"])])],34)],64)}}}),zo="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20126.25%20110.36'%3e%3cdefs%3e%3cradialGradient%20id='radial-gradient'%20cx='45.24'%20cy='38.05'%20fx='45.24'%20fy='38.05'%20r='59.09'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%2331319e'/%3e%3cstop%20offset='.19'%20stop-color='%232e2e97'/%3e%3cstop%20offset='.45'%20stop-color='%23292985'/%3e%3cstop%20offset='.75'%20stop-color='%23202067'/%3e%3cstop%20offset='1'%20stop-color='%2317174a'/%3e%3c/radialGradient%3e%3clinearGradient%20id='linear-gradient'%20x1='82.65'%20y1='50.41'%20x2='82.65'%20y2='77.5'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='.02'%20stop-color='%2366ebfe'/%3e%3cstop%20offset='.96'%20stop-color='%2300bfdb'/%3e%3c/linearGradient%3e%3clinearGradient%20id='linear-gradient-2'%20x1='44.6'%20y1='50.01'%20x2='44.6'%20y2='77.1'%20xlink:href='%23linear-gradient'/%3e%3c/defs%3e%3cg%20isolation='isolate'%3e%3cg%20id='Layer_1'%3e%3cpath%20d='M126.2,61.4c-.2-3.69-2.61-17.39-5.92-22.09-2.42-3.44-5.89-4.03-7.96-4.38-.13-.02-.27-.05-.41-.07-.16-.28-.32-.58-.45-.81-.63-1.14-1.03-1.87-1.44-2.44-6.96-9.88-14.91-16.51-24.85-20.69-.25-2.29-.84-5.24-3.37-7.44-2.93-2.55-7.58-2.9-11.68-3.21-.93-.07-1.82-.14-2.4-.22l-.33-.05h-8.61l-.36.05c-.65.1-1.61.17-2.63.24-3.75.27-8.01.57-10.98,2.85-2.94,2.26-3.58,5.55-3.79,7.84-9.71,3.94-17.86,10.71-24.85,20.62-.4.57-.81,1.3-1.43,2.44-.13.23-.29.53-.45.81-.14.02-.28.05-.4.07-2.07.35-5.54.94-7.96,4.39-2.25,3.19-3.84,9.89-4.58,13.59-.6,2.97-1.9,10.3-1.08,14.26.79,3.78,3.66,5.6,5.37,6.68.12.08.26.16.39.25,1.65,10.03,6.98,18.56,15.52,24.77,9.23,6.72,20.2,9.43,27.78,10.52,4.49.65,9.15.97,13.85.97,9.67,0,23.77-1.39,36-8.02,11.58-6.27,18.81-16,21.04-28.24,4.52-2.76,6.36-5.67,5.98-12.71Z'%20fill='%2317174a'/%3e%3cpath%20d='M67.15,4.69c2.98.42,9.31.31,11.62,2.31,1.99,1.73,1.65,4.82,2.06,7.22,10.77,3.89,18.73,10.59,25.39,20.04.64.91,2.13,3.95,2.58,4.33,1.71,1.46,5.54.35,7.67,3.37,2.29,3.25,4.83,15.41,5.06,19.59.31,5.82-.76,6.9-5.58,9.44-3.28,26.16-29.7,34.5-52.68,34.5-4.6,0-9.06-.33-13.17-.93-18.13-2.61-37.11-12.11-39.51-33.08-1.7-1.92-4.96-2.54-5.55-5.39-.95-4.56,2.21-20.32,4.89-24.14,2.13-3.02,5.96-1.91,7.67-3.37.46-.39,1.94-3.42,2.58-4.33,6.54-9.28,14.55-16.22,25.21-19.87.85-.87-.3-5.45,2.43-7.55,2.52-1.94,8.35-1.69,11.42-2.16h7.91'%20fill='%23fff'/%3e%3cpath%20d='M121.86,61.51c-.22-4.2-2.78-16.43-5.07-19.7-1.77-2.51-4.71-2.18-6.64-2.83.1,1.18.16,2.37.16,3.57,0,26.85-25.96,48.61-57.98,48.61-15.83,0-30.17-5.32-40.63-13.94,4.91,17.1,22.06,25.14,38.51,27.52,4.12.59,8.6.93,13.21.93,23.06,0,49.57-8.38,52.85-34.68,4.83-2.56,5.91-3.63,5.6-9.49Z'%20fill='%23d0d7e2'%20mix-blend-mode='multiply'%20opacity='.4'/%3e%3cpath%20d='M62.91,97.68c5.82,0,11.67-.53,16.72-1.56,13.1-2.67,22.09-8.06,26.72-16.03,4.43-7.63,4.75-17.33.96-28.84-4.28-13-13.22-22.77-24.7-27.89-.13,4.51-3.84,8.16-8.38,8.16h-20.89c-4.61,0-8.39-3.78-8.39-8.39v-.14c-5.36,2.25-10.29,5.49-14.5,9.61-8.23,8.06-13.16,19.02-13.9,30.84-.59,9.44,2.67,17.53,9.43,23.42,6.27,5.46,15.68,9.02,27.2,10.3,3.13.35,6.43.52,9.73.52'%20fill='url(%23radial-gradient)'/%3e%3crect%20x='74.34'%20y='50.41'%20width='16.62'%20height='27.09'%20rx='4.06'%20ry='4.06'%20fill='url(%23linear-gradient)'/%3e%3crect%20x='36.29'%20y='50.01'%20width='16.62'%20height='27.09'%20rx='4.06'%20ry='4.06'%20fill='url(%23linear-gradient-2)'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Ho="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF2GlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnL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3P7wxMRj9BiarSSzuwCvjA/L3VtdrFvPYE9ie6qqYb0Omgfh3VKcvIIy5czz8YfQbnFJpLbegDeZGmjqxbSI3r+ScCtwL9GhzsS+jQ1tn1aLxuNRvMBR8OTCD4MZk4SJprO6JecOs6govcn88GfggcEXOwz5uZaboN2Qysi3p0Pf8Y40A4lfgUY96IduzcoaR4xqaOWRvW6nr+3sZJcg4wxNJuLjSOl2lKirU2djAWccvGkX+6cTYcE+G2pti26xnjZJkZhwcisQtMN6kCW4Ch5jUYyNSoufeMU2IBOtxmnpJiQ5zs1RAnD0xS837orHIHAb2MAyODDgzcs8j9fKNxgKwzIFehE8G9gT6fu1RJsSrutvk/GdqIAV0smzEAAAAASUVORK5CYII=",Zo={class:"q-chatbot"},Jo={class:"q-chatbot__content"},Wo={class:"q-chatbot__footer-container"};return t.defineComponent({name:"ChatBot",__name:"ChatBot",props:{apiEndpoint:{default:"http://localhost:3000"},controllerEndpoint:{},username:{},projectPath:{},userImage:{default:Ho},chatbotImage:{default:zo},dateFormat:{},agentData:{default:()=>({id:"",formId:"",jobId:""})},availableAgents:{default:()=>[]}},emits:["apply-fields"],setup(e,{emit:n}){const o=n,a=e,r=t.ref(!0),l=t.ref(null),i=t.ref(!0),s=t.ref(a.agentData.id),u=t.ref(a.agentData.formId),f=H(),{isLoading:g,clearChatData:c,getChatData:m,getFieldSuggestionData:y,sendPrompt:x}=We(a.apiEndpoint),{messages:$,addChatMessage:S,clearMessages:U,getLastMessage:M}=Ke(),F=t.computed(()=>r.value||g.value);t.onBeforeMount(()=>{var b;(b=l.value)==null||b.removeEventListener("scroll",O)}),t.onMounted(()=>{I()});function C(b){r.value=b}async function I(){try{await k()}catch(b){S(f.loginError),console.error("Error logging in: "+b)}}async function k(){C(!0);const{data:b,error:h}=await m(a.username,a.projectPath,s.value,u.value);if(h||!b||!b.success){C(!0),S(f.botIsSick),console.log("Error loading chat data: "+h);return}C(!1),N(),b.history.forEach(async E=>{const T=E.imageUrl?a.controllerEndpoint+E.imageUrl:void 0;S(E.content,E.type==="ai"?"bot":"user",T,E.sessionID)})}function N(){const b=f.initialMessage;S(b,"bot",null,void 0,!0)}function V(){U(),C(!1),i.value=!0}function R(){t.nextTick(()=>{l.value&&(l.value.scrollTop=l.value.scrollHeight)})}function O(){if(l.value){const{scrollTop:h,clientHeight:E,scrollHeight:T}=l.value;i.value=h+E>=T-20}}async function d(b,h){l.value&&l.value.scrollTo({top:l.value.scrollHeight,behavior:"smooth"}),S(b,"user",h==null?void 0:h.previewUrl),t.nextTick(()=>{i.value&&R()}),w(b,h==null?void 0:h.file)}async function p(b){l.value&&l.value.scrollTo({top:l.value.scrollHeight,behavior:"smooth"}),S("","bot"),t.nextTick(()=>{i.value&&R()});const h=M();h&&await y(b,E=>{h.message+=E,h.fields||(h.fields=[]);const T=h.fields[h.fields.length-1];T.text=h.message,i.value&&R()},E=>{var L;h.message="";const T=E;(L=h.fields)==null||L.push({type:T.type,name:T.name,text:T.text})})}async function w(b,h){S("","bot");const E=M();if(!E)return;const T=(E==null?void 0:E.sessionID)||Xe(),L=new FormData;h&&L.append("image",h),L.append("message",b),L.append("project",a.projectPath),L.append("user",a.username),L.append("sessionID",T),await x(L,Z=>{E&&(E.message+=Z),i.value&&R()},Z=>{C(!0),S(f.botIsSick),console.error("Error sending message: "+Z)})}async function A(){const{data:b,error:h}=await c(a.username,a.projectPath,s.value,u.value);if(h||!b||!b.success){C(!0),S(f.loginError),console.log("Error clearing chat: "+h);return}V(),N()}function B(b){const h=["q-chatbot__messages-wrapper"];return b==="user"&&h.push("q-chatbot__messages-wrapper_right"),h}function D(b){s.value=b.key,u.value=b.formId,V(),k()}function _(b){!b||b.length===0||o("apply-fields",b)}return t.watch(()=>a.availableAgents,(b,h)=>{b.length===0&&h.length>0&&(s.value="",u.value="",V(),I())}),t.watch(()=>a.agentData,async(b,h)=>{var E;F.value||(((E=a.agentData)==null?void 0:E.id)!==(h==null?void 0:h.id)&&(s.value=(b==null?void 0:b.id)||"",u.value=(b==null?void 0:b.formId)||"",V(),await I()),(b==null?void 0:b.id)!==""&&b&&b.jobId!==h.jobId&&await p(b.jobId))}),t.watch(()=>[a.agentData.id,a.agentData.formId],([b,h])=>{s.value=b,u.value=h},{immediate:!0}),(b,h)=>(t.openBlock(),t.createElementBlock("div",Zo,[t.createElementVNode("div",Jo,[t.createVNode(t.unref(Fo),{disabled:F.value,"available-agents":a.availableAgents,"selected-agent-key":s.value,onClear:A,onChangeChat:D},null,8,["disabled","available-agents","selected-agent-key"]),t.createElementVNode("div",{ref_key:"messagesContainer",ref:l,class:"q-chatbot__messages-container",onScroll:O},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref($),E=>(t.openBlock(),t.createElementBlock("div",{key:E.id,class:t.normalizeClass(B(E.sender))},[t.createVNode(t.unref(No),t.mergeProps({ref_for:!0},E,{"date-format":a.dateFormat,"user-image":a.userImage,"chatbot-image":a.chatbotImage,loading:t.unref(g)&&!E.message,imagePreviewUrl:E.imagePreviewUrl,apiEndpoint:a.apiEndpoint,sessionID:E.sessionID,fields:E.fields,onApplyFields:_}),null,16,["date-format","user-image","chatbot-image","loading","imagePreviewUrl","apiEndpoint","sessionID","fields"])],2))),128))],544)]),t.createElementVNode("div",Wo,[t.createVNode(t.unref(Go),{disabled:F.value,loading:t.unref(g),onSendMessage:d},null,8,["disabled","loading"])])]))}})});
|
package/dist/index.mjs
CHANGED
|
@@ -1013,21 +1013,21 @@ var ut = {
|
|
|
1013
1013
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
1014
1014
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
1015
1015
|
// look inside web components even if open)
|
|
1016
|
-
(y == null ? void 0 : y.includes(I)) || T.find(function(
|
|
1017
|
-
return
|
|
1016
|
+
(y == null ? void 0 : y.includes(I)) || T.find(function(x) {
|
|
1017
|
+
return x === u;
|
|
1018
1018
|
});
|
|
1019
1019
|
});
|
|
1020
1020
|
}, f = function(u) {
|
|
1021
|
-
var d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = d.hasFallback, C = y === void 0 ? !1 : y, I = d.params, T = I === void 0 ? [] : I,
|
|
1022
|
-
if (typeof
|
|
1023
|
-
if (
|
|
1024
|
-
return
|
|
1021
|
+
var d = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, y = d.hasFallback, C = y === void 0 ? !1 : y, I = d.params, T = I === void 0 ? [] : I, x = a[u];
|
|
1022
|
+
if (typeof x == "function" && (x = x.apply(void 0, uo(T))), x === !0 && (x = void 0), !x) {
|
|
1023
|
+
if (x === void 0 || x === !1)
|
|
1024
|
+
return x;
|
|
1025
1025
|
throw new Error("`".concat(u, "` was specified but was not a node, or did not return a node"));
|
|
1026
1026
|
}
|
|
1027
|
-
var g =
|
|
1028
|
-
if (typeof
|
|
1027
|
+
var g = x;
|
|
1028
|
+
if (typeof x == "string") {
|
|
1029
1029
|
try {
|
|
1030
|
-
g = n.querySelector(
|
|
1030
|
+
g = n.querySelector(x);
|
|
1031
1031
|
} catch (m) {
|
|
1032
1032
|
throw new Error("`".concat(u, '` appears to be an invalid selector; error="').concat(m.message, '"'));
|
|
1033
1033
|
}
|
|
@@ -1056,7 +1056,7 @@ var ut = {
|
|
|
1056
1056
|
if (r.containerGroups = r.containers.map(function(u) {
|
|
1057
1057
|
var d = no(u, a.tabbableOptions), y = oo(u, a.tabbableOptions), C = d.length > 0 ? d[0] : void 0, I = d.length > 0 ? d[d.length - 1] : void 0, T = y.find(function(m) {
|
|
1058
1058
|
return ge(m);
|
|
1059
|
-
}),
|
|
1059
|
+
}), x = y.slice().reverse().find(function(m) {
|
|
1060
1060
|
return ge(m);
|
|
1061
1061
|
}), g = !!d.find(function(m) {
|
|
1062
1062
|
return se(m) > 0;
|
|
@@ -1081,7 +1081,7 @@ var ut = {
|
|
|
1081
1081
|
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
1082
1082
|
firstDomTabbableNode: T,
|
|
1083
1083
|
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
1084
|
-
lastDomTabbableNode:
|
|
1084
|
+
lastDomTabbableNode: x,
|
|
1085
1085
|
/**
|
|
1086
1086
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
1087
1087
|
* in this container, if any.
|
|
@@ -1131,15 +1131,15 @@ var ut = {
|
|
|
1131
1131
|
d = d || Se(y), l();
|
|
1132
1132
|
var T = null;
|
|
1133
1133
|
if (r.tabbableGroups.length > 0) {
|
|
1134
|
-
var
|
|
1135
|
-
if (
|
|
1134
|
+
var x = c(d, y), g = x >= 0 ? r.containerGroups[x] : void 0;
|
|
1135
|
+
if (x < 0)
|
|
1136
1136
|
I ? T = r.tabbableGroups[r.tabbableGroups.length - 1].lastTabbableNode : T = r.tabbableGroups[0].firstTabbableNode;
|
|
1137
1137
|
else if (I) {
|
|
1138
1138
|
var m = r.tabbableGroups.findIndex(function(ve) {
|
|
1139
1139
|
var ye = ve.firstTabbableNode;
|
|
1140
1140
|
return d === ye;
|
|
1141
1141
|
});
|
|
1142
|
-
if (m < 0 && (g.container === d || Pe(d, a.tabbableOptions) && !ge(d, a.tabbableOptions) && !g.nextTabbableNode(d, !1)) && (m =
|
|
1142
|
+
if (m < 0 && (g.container === d || Pe(d, a.tabbableOptions) && !ge(d, a.tabbableOptions) && !g.nextTabbableNode(d, !1)) && (m = x), m >= 0) {
|
|
1143
1143
|
var D = m === 0 ? r.tabbableGroups.length - 1 : m - 1, z = r.tabbableGroups[D];
|
|
1144
1144
|
T = se(d) >= 0 ? z.lastTabbableNode : z.lastDomTabbableNode;
|
|
1145
1145
|
} else Ie(y) || (T = g.nextTabbableNode(d, !1));
|
|
@@ -1148,7 +1148,7 @@ var ut = {
|
|
|
1148
1148
|
var ye = ve.lastTabbableNode;
|
|
1149
1149
|
return d === ye;
|
|
1150
1150
|
});
|
|
1151
|
-
if (P < 0 && (g.container === d || Pe(d, a.tabbableOptions) && !ge(d, a.tabbableOptions) && !g.nextTabbableNode(d)) && (P =
|
|
1151
|
+
if (P < 0 && (g.container === d || Pe(d, a.tabbableOptions) && !ge(d, a.tabbableOptions) && !g.nextTabbableNode(d)) && (P = x), P >= 0) {
|
|
1152
1152
|
var re = P === r.tabbableGroups.length - 1 ? 0 : P + 1, pe = r.tabbableGroups[re];
|
|
1153
1153
|
T = se(d) >= 0 ? pe.firstTabbableNode : pe.firstDomTabbableNode;
|
|
1154
1154
|
} else Ie(y) || (T = g.nextTabbableNode(d));
|
|
@@ -1182,12 +1182,12 @@ var ut = {
|
|
|
1182
1182
|
var C, I = !0;
|
|
1183
1183
|
if (r.mostRecentlyFocusedNode)
|
|
1184
1184
|
if (se(r.mostRecentlyFocusedNode) > 0) {
|
|
1185
|
-
var T = c(r.mostRecentlyFocusedNode),
|
|
1186
|
-
if (
|
|
1187
|
-
var g =
|
|
1185
|
+
var T = c(r.mostRecentlyFocusedNode), x = r.containerGroups[T].tabbableNodes;
|
|
1186
|
+
if (x.length > 0) {
|
|
1187
|
+
var g = x.findIndex(function(m) {
|
|
1188
1188
|
return m === r.mostRecentlyFocusedNode;
|
|
1189
1189
|
});
|
|
1190
|
-
g >= 0 && (a.isKeyForward(r.recentNavEvent) ? g + 1 <
|
|
1190
|
+
g >= 0 && (a.isKeyForward(r.recentNavEvent) ? g + 1 < x.length && (C = x[g + 1], I = !1) : g - 1 >= 0 && (C = x[g - 1], I = !1));
|
|
1191
1191
|
}
|
|
1192
1192
|
} else
|
|
1193
1193
|
r.containerGroups.some(function(m) {
|
|
@@ -1215,7 +1215,7 @@ var ut = {
|
|
|
1215
1215
|
y && (Ie(u) && u.preventDefault(), b(y));
|
|
1216
1216
|
}, H = function(u) {
|
|
1217
1217
|
(a.isKeyForward(u) || a.isKeyBackward(u)) && q(u, a.isKeyBackward(u));
|
|
1218
|
-
},
|
|
1218
|
+
}, S = function(u) {
|
|
1219
1219
|
go(u) && _e(a.escapeDeactivates, u) !== !1 && (u.preventDefault(), i.deactivate());
|
|
1220
1220
|
}, R = function(u) {
|
|
1221
1221
|
var d = Se(u);
|
|
@@ -1236,10 +1236,10 @@ var ut = {
|
|
|
1236
1236
|
}), n.addEventListener("keydown", H, {
|
|
1237
1237
|
capture: !0,
|
|
1238
1238
|
passive: !1
|
|
1239
|
-
}), n.addEventListener("keydown",
|
|
1239
|
+
}), n.addEventListener("keydown", S), i;
|
|
1240
1240
|
}, B = function() {
|
|
1241
1241
|
if (r.active)
|
|
1242
|
-
return n.removeEventListener("focusin", W, !0), n.removeEventListener("mousedown", N, !0), n.removeEventListener("touchstart", N, !0), n.removeEventListener("click", R, !0), n.removeEventListener("keydown", H, !0), n.removeEventListener("keydown",
|
|
1242
|
+
return n.removeEventListener("focusin", W, !0), n.removeEventListener("mousedown", N, !0), n.removeEventListener("touchstart", N, !0), n.removeEventListener("click", R, !0), n.removeEventListener("keydown", H, !0), n.removeEventListener("keydown", S), i;
|
|
1243
1243
|
}, Z = function(u) {
|
|
1244
1244
|
var d = u.some(function(y) {
|
|
1245
1245
|
var C = Array.from(y.removedNodes);
|
|
@@ -1284,12 +1284,12 @@ var ut = {
|
|
|
1284
1284
|
clearTimeout(r.delayInitialFocusTimer), r.delayInitialFocusTimer = void 0, B(), r.active = !1, r.paused = !1, V(), ut.deactivateTrap(o, i);
|
|
1285
1285
|
var y = s(d, "onDeactivate"), C = s(d, "onPostDeactivate"), I = s(d, "checkCanReturnFocus"), T = s(d, "returnFocus", "returnFocusOnDeactivate");
|
|
1286
1286
|
y == null || y();
|
|
1287
|
-
var
|
|
1287
|
+
var x = function() {
|
|
1288
1288
|
ct(function() {
|
|
1289
1289
|
T && b(M(r.nodeFocusedBeforeActivation)), C == null || C();
|
|
1290
1290
|
});
|
|
1291
1291
|
};
|
|
1292
|
-
return T && I ? (I(M(r.nodeFocusedBeforeActivation)).then(
|
|
1292
|
+
return T && I ? (I(M(r.nodeFocusedBeforeActivation)).then(x, x), this) : (x(), this);
|
|
1293
1293
|
},
|
|
1294
1294
|
pause: function(u) {
|
|
1295
1295
|
return r.active ? (r.manuallyPaused = !0, this._setPausedState(!0, u)) : this;
|
|
@@ -1708,7 +1708,7 @@ const Ho = ["id"], Zo = ["role"], Vo = /* @__PURE__ */ U({
|
|
|
1708
1708
|
() => le(q)
|
|
1709
1709
|
);
|
|
1710
1710
|
let H;
|
|
1711
|
-
function
|
|
1711
|
+
function S() {
|
|
1712
1712
|
k(0);
|
|
1713
1713
|
}
|
|
1714
1714
|
function R() {
|
|
@@ -1752,7 +1752,7 @@ const Ho = ["id"], Zo = ["role"], Vo = /* @__PURE__ */ U({
|
|
|
1752
1752
|
function T(_) {
|
|
1753
1753
|
n.persistent && _.preventDefault();
|
|
1754
1754
|
}
|
|
1755
|
-
function
|
|
1755
|
+
function x(_) {
|
|
1756
1756
|
var ie;
|
|
1757
1757
|
if (n.persistent) {
|
|
1758
1758
|
_.preventDefault();
|
|
@@ -1781,10 +1781,10 @@ const Ho = ["id"], Zo = ["role"], Vo = /* @__PURE__ */ U({
|
|
|
1781
1781
|
subtree: !0
|
|
1782
1782
|
}), n.trigger) {
|
|
1783
1783
|
case "click":
|
|
1784
|
-
_.addEventListener("click",
|
|
1784
|
+
_.addEventListener("click", S);
|
|
1785
1785
|
break;
|
|
1786
1786
|
case "hover":
|
|
1787
|
-
_.addEventListener("mouseenter", R), _.addEventListener("mouseleave", B), _.addEventListener("focusin",
|
|
1787
|
+
_.addEventListener("mouseenter", R), _.addEventListener("mouseleave", B), _.addEventListener("focusin", S), _.addEventListener("focusout", B);
|
|
1788
1788
|
break;
|
|
1789
1789
|
}
|
|
1790
1790
|
}
|
|
@@ -1793,10 +1793,10 @@ const Ho = ["id"], Zo = ["role"], Vo = /* @__PURE__ */ U({
|
|
|
1793
1793
|
if (_)
|
|
1794
1794
|
switch (m == null || m.disconnect(), n.trigger) {
|
|
1795
1795
|
case "click":
|
|
1796
|
-
_.removeEventListener("click",
|
|
1796
|
+
_.removeEventListener("click", S);
|
|
1797
1797
|
break;
|
|
1798
1798
|
case "hover":
|
|
1799
|
-
_.removeEventListener("mouseenter", R), _.removeEventListener("mouseleave", B), _.removeEventListener("focusin",
|
|
1799
|
+
_.removeEventListener("mouseenter", R), _.removeEventListener("mouseleave", B), _.removeEventListener("focusin", S), _.removeEventListener("focusout", B);
|
|
1800
1800
|
break;
|
|
1801
1801
|
}
|
|
1802
1802
|
}
|
|
@@ -1870,7 +1870,7 @@ const Ho = ["id"], Zo = ["role"], Vo = /* @__PURE__ */ U({
|
|
|
1870
1870
|
}, [
|
|
1871
1871
|
$(w(Pn), {
|
|
1872
1872
|
onDismiss: g,
|
|
1873
|
-
onInteractOutside:
|
|
1873
|
+
onInteractOutside: x,
|
|
1874
1874
|
onPointerDownOutside: T
|
|
1875
1875
|
}, {
|
|
1876
1876
|
default: j(() => [
|
|
@@ -2197,13 +2197,13 @@ async function pt(e, t) {
|
|
|
2197
2197
|
for (const q of W) {
|
|
2198
2198
|
const H = q.trim().split(`
|
|
2199
2199
|
`);
|
|
2200
|
-
let
|
|
2200
|
+
let S = "", R = "";
|
|
2201
2201
|
for (const k of H)
|
|
2202
|
-
k.startsWith("event:") ?
|
|
2203
|
-
if (
|
|
2202
|
+
k.startsWith("event:") ? S = k.replace("event:", "").trim() : k.startsWith("data:") && (R = k.replace("data:", "").trim());
|
|
2203
|
+
if (S || (S = "message"), !!R)
|
|
2204
2204
|
try {
|
|
2205
2205
|
const k = JSON.parse(R);
|
|
2206
|
-
switch (
|
|
2206
|
+
switch (S) {
|
|
2207
2207
|
case "message":
|
|
2208
2208
|
(f = t.onMessage) == null || f.call(t, k.value);
|
|
2209
2209
|
break;
|
|
@@ -2217,7 +2217,7 @@ async function pt(e, t) {
|
|
|
2217
2217
|
(p = t.onDone) == null || p.call(t);
|
|
2218
2218
|
break;
|
|
2219
2219
|
default:
|
|
2220
|
-
console.warn(`Unknown event type: ${
|
|
2220
|
+
console.warn(`Unknown event type: ${S}`);
|
|
2221
2221
|
}
|
|
2222
2222
|
} catch (k) {
|
|
2223
2223
|
(b = t.onError) == null || b.call(t, k), console.error("Error processing event:", k);
|
|
@@ -2593,7 +2593,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2593
2593
|
const n = fe(), { getLastMessage: o } = Rt(), a = e, r = F(!1), i = F(""), s = F(null), c = F(!1), f = A(() => a.loading || c.value), v = a.date || /* @__PURE__ */ new Date(), l = t, p = o(), b = A(() => p ? p.fields && p.fields.length > 1 : !1), M = [
|
|
2594
2594
|
{
|
|
2595
2595
|
id: "confirm-btn",
|
|
2596
|
-
action:
|
|
2596
|
+
action: S,
|
|
2597
2597
|
props: {
|
|
2598
2598
|
label: n.submitButton
|
|
2599
2599
|
},
|
|
@@ -2621,7 +2621,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2621
2621
|
function H() {
|
|
2622
2622
|
c.value || (c.value = !0, l("apply-all"));
|
|
2623
2623
|
}
|
|
2624
|
-
function
|
|
2624
|
+
function S() {
|
|
2625
2625
|
s.value !== null && (l("submit-feedback", s.value, i.value), r.value = !1, i.value = "", s.value = null);
|
|
2626
2626
|
}
|
|
2627
2627
|
function R() {
|
|
@@ -2789,20 +2789,20 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2789
2789
|
emits: ["sendMessage"],
|
|
2790
2790
|
setup(e, { emit: t }) {
|
|
2791
2791
|
const n = fe(), o = e, a = F(null), r = F(""), i = A(() => ".png, .jpeg, .jpg, .svg, .webp"), s = F(!1), c = F(!1), f = F(o.userPrompt ?? ""), v = t, l = A(() => o.disabled || o.loading || f.value.trim().length === 0);
|
|
2792
|
-
function p(
|
|
2793
|
-
|
|
2792
|
+
function p(S) {
|
|
2793
|
+
S.preventDefault(), o.disabled || (c.value = !0);
|
|
2794
2794
|
}
|
|
2795
2795
|
const b = A(() => ({
|
|
2796
2796
|
"q-chatbot__footer-disabled": o.disabled,
|
|
2797
2797
|
"drag-over": c.value && !s.value
|
|
2798
2798
|
}));
|
|
2799
|
-
function M(
|
|
2800
|
-
|
|
2799
|
+
function M(S) {
|
|
2800
|
+
S.preventDefault(), c.value = !1;
|
|
2801
2801
|
}
|
|
2802
|
-
function O(
|
|
2802
|
+
function O(S) {
|
|
2803
2803
|
var B;
|
|
2804
|
-
if (
|
|
2805
|
-
const R = (B =
|
|
2804
|
+
if (S.preventDefault(), c.value = !1, o.disabled || s.value) return;
|
|
2805
|
+
const R = (B = S.dataTransfer) == null ? void 0 : B.files;
|
|
2806
2806
|
if (!R) return;
|
|
2807
2807
|
const k = R[0];
|
|
2808
2808
|
if (k.type.startsWith("image/")) {
|
|
@@ -2827,14 +2827,14 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2827
2827
|
r.value = "", a.value && (a.value.value = "", a.value.files = null), s.value = !1;
|
|
2828
2828
|
}
|
|
2829
2829
|
function q() {
|
|
2830
|
-
var
|
|
2831
|
-
(
|
|
2830
|
+
var S;
|
|
2831
|
+
(S = a.value) == null || S.click();
|
|
2832
2832
|
}
|
|
2833
|
-
function H(
|
|
2834
|
-
const R =
|
|
2833
|
+
function H(S) {
|
|
2834
|
+
const R = S.target;
|
|
2835
2835
|
a.value = R, R.files && R.files[0] && (r.value = URL.createObjectURL(R.files[0]), s.value = !0);
|
|
2836
2836
|
}
|
|
2837
|
-
return (
|
|
2837
|
+
return (S, R) => {
|
|
2838
2838
|
const k = ne("q-icon"), B = ne("q-button"), Z = ne("q-text-area");
|
|
2839
2839
|
return h(), E(ae, null, [
|
|
2840
2840
|
$(w(Mn), {
|
|
@@ -2951,7 +2951,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2951
2951
|
}), Oe(() => {
|
|
2952
2952
|
R();
|
|
2953
2953
|
});
|
|
2954
|
-
function
|
|
2954
|
+
function S(g) {
|
|
2955
2955
|
a.value = g;
|
|
2956
2956
|
}
|
|
2957
2957
|
async function R() {
|
|
@@ -2962,7 +2962,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2962
2962
|
}
|
|
2963
2963
|
}
|
|
2964
2964
|
async function k() {
|
|
2965
|
-
|
|
2965
|
+
S(!0);
|
|
2966
2966
|
const { data: g, error: m } = await p(
|
|
2967
2967
|
o.username,
|
|
2968
2968
|
o.projectPath,
|
|
@@ -2970,10 +2970,10 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2970
2970
|
c.value
|
|
2971
2971
|
);
|
|
2972
2972
|
if (m || !g || !g.success) {
|
|
2973
|
-
|
|
2973
|
+
S(!0), N(f.botIsSick), console.log("Error loading chat data: " + m);
|
|
2974
2974
|
return;
|
|
2975
2975
|
}
|
|
2976
|
-
|
|
2976
|
+
S(!1), B(), g.history.forEach(async (D) => {
|
|
2977
2977
|
const z = D.imageUrl ? o.controllerEndpoint + D.imageUrl : void 0;
|
|
2978
2978
|
N(
|
|
2979
2979
|
D.content,
|
|
@@ -2988,7 +2988,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
2988
2988
|
N(g, "bot", null, void 0, !0);
|
|
2989
2989
|
}
|
|
2990
2990
|
function Z() {
|
|
2991
|
-
W(),
|
|
2991
|
+
W(), S(!1), i.value = !0;
|
|
2992
2992
|
}
|
|
2993
2993
|
function G() {
|
|
2994
2994
|
le(() => {
|
|
@@ -3041,13 +3041,13 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
3041
3041
|
const D = q();
|
|
3042
3042
|
if (!D) return;
|
|
3043
3043
|
const z = (D == null ? void 0 : D.sessionID) || Nt(), P = new FormData();
|
|
3044
|
-
m && P.append("image", m), P.append("message", g), P.append("project", o.projectPath), P.append("user", o.username), P.append("sessionID", z),
|
|
3044
|
+
m && P.append("image", m), P.append("message", g), P.append("project", o.projectPath), P.append("user", o.username), P.append("sessionID", z), await M(
|
|
3045
3045
|
P,
|
|
3046
3046
|
(re) => {
|
|
3047
3047
|
D && (D.message += re), i.value && G();
|
|
3048
3048
|
},
|
|
3049
3049
|
(re) => {
|
|
3050
|
-
|
|
3050
|
+
S(!0), N(f.botIsSick), console.error("Error sending message: " + re);
|
|
3051
3051
|
}
|
|
3052
3052
|
);
|
|
3053
3053
|
}
|
|
@@ -3059,7 +3059,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
3059
3059
|
c.value
|
|
3060
3060
|
);
|
|
3061
3061
|
if (m || !g || !g.success) {
|
|
3062
|
-
|
|
3062
|
+
S(!0), N(f.loginError), console.log("Error clearing chat: " + m);
|
|
3063
3063
|
return;
|
|
3064
3064
|
}
|
|
3065
3065
|
Z(), B();
|
|
@@ -3071,7 +3071,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
3071
3071
|
function T(g) {
|
|
3072
3072
|
s.value = g.key, c.value = g.formId, Z(), k();
|
|
3073
3073
|
}
|
|
3074
|
-
function
|
|
3074
|
+
function x(g) {
|
|
3075
3075
|
!g || g.length === 0 || n("apply-fields", g);
|
|
3076
3076
|
}
|
|
3077
3077
|
return ue(
|
|
@@ -3119,7 +3119,7 @@ const Ba = { class: "q-chatbot__dialog-title" }, La = {
|
|
|
3119
3119
|
apiEndpoint: o.apiEndpoint,
|
|
3120
3120
|
sessionID: D.sessionID,
|
|
3121
3121
|
fields: D.fields,
|
|
3122
|
-
onApplyFields:
|
|
3122
|
+
onApplyFields: x
|
|
3123
3123
|
}), null, 16, ["date-format", "user-image", "chatbot-image", "loading", "imagePreviewUrl", "apiEndpoint", "sessionID", "fields"])
|
|
3124
3124
|
], 2))), 128))
|
|
3125
3125
|
], 544)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quidgest/chatbot",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"vue-tsc": "^1.8.27"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@quidgest/ui": "0.16.
|
|
55
|
-
"vue": "
|
|
54
|
+
"@quidgest/ui": "0.16.12",
|
|
55
|
+
"vue": "3.5.17"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -275,8 +275,6 @@
|
|
|
275
275
|
formData.append('project', props.projectPath)
|
|
276
276
|
formData.append('user', props.username)
|
|
277
277
|
formData.append('sessionID', currentSessionID)
|
|
278
|
-
formData.append('agentID', currentAgentId.value)
|
|
279
|
-
formData.append('formId', currentFormId.value)
|
|
280
278
|
|
|
281
279
|
await sendPrompt(
|
|
282
280
|
formData,
|
|
@@ -53,11 +53,14 @@ export async function useSSE(config: AxiosRequestConfig, handlers: SSEvents) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
// Backward compatibility for missing event names
|
|
58
|
+
if(!name) name = 'message';
|
|
59
|
+
|
|
60
|
+
if (!data) continue
|
|
57
61
|
|
|
58
62
|
try {
|
|
59
63
|
const parsedData = JSON.parse(data)
|
|
60
|
-
|
|
61
64
|
switch (name) {
|
|
62
65
|
case 'message':
|
|
63
66
|
handlers.onMessage?.(parsedData.value)
|