ai12z 3.7.1 → 3.7.2

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.
@@ -104,9 +104,7 @@ export class InputForm {
104
104
  const endPos = textarea.selectionEnd;
105
105
  const currentValue = textarea.value;
106
106
  // Replace selected text or insert at cursor position
107
- const newValue = currentValue.substring(0, startPos) +
108
- pastedText +
109
- currentValue.substring(endPos);
107
+ const newValue = currentValue.substring(0, startPos) + pastedText + currentValue.substring(endPos);
110
108
  // Update the textarea value
111
109
  textarea.value = newValue;
112
110
  // Set cursor position after pasted text
@@ -158,7 +156,7 @@ export class InputForm {
158
156
  this.searchInputElem.value = "";
159
157
  this.searchInput = "";
160
158
  const parent = this.el.querySelector(`#previewContainer-${this.instanceId}`);
161
- const textarea = this.el.querySelector(`#searchInput-${this.instanceId}`);
159
+ const textarea = this.el.querySelector(`#searchInput`);
162
160
  // textarea["style"].height = "20px"
163
161
  textarea["style"].overflow = "hidden";
164
162
  if (parent) {
@@ -230,24 +228,26 @@ export class InputForm {
230
228
  // this.icon_width = url.searchParams.get("w") || "28"
231
229
  // this.icon_height = url.searchParams.get("h") || "28"
232
230
  // }
233
- return (h("div", { key: 'b1155ed7be07bc37ed7d82e5ff0794755ee87df7' }, h("div", { key: '699dcb02be29a8d198c6214a6b6357366866451d', class: `absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10
234
- ${this.isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-90 pointer-events-none"}`, ref: el => (this.menuElem = el) }, h("ul", { key: '5b1046ba8e2f9577219a70d2c1e1d5780720a9e4', class: "space-y-2" }, this.isImageUpload && (h("li", { key: '7fe5378ef380fed221f2d12e9aad0168e75e685d', class: "px-4 py-2 hover:bg-gray-100 cursor-pointer flex" }, h("image-uploader", { key: '2bbeb4f870cda60e5d33110010de398956185349', maxImages: 10, images: this.imagesBase64List, targetElement: this.searchInputElem, onImagesChange: this.handleImageChange, onError: this.handleImageError, ref: el => (this.imageUploaderRef = el) }))), h("li", { key: '5cdfe32e0a4400a26a41e91fd6292addfb70fa73', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", onClick: e => {
231
+ return (h("div", { key: 'b710879654820db9210ccfb4aa92e0a25708d16d' }, h("div", { key: '5408dbbfe45b661d58d5bf1037ab524c1156c4ec', class: `absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10
232
+ ${this.isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-90 pointer-events-none"}`, ref: el => (this.menuElem = el) }, h("ul", { key: '103ee1e4974be113c7666d89fc855b5bb768a85a', class: "space-y-2" }, this.isImageUpload && (h("li", { key: '745574831938ae6f62813979cd67f622eac7abed', class: "px-4 py-2 hover:bg-gray-100 cursor-pointer flex" }, h("image-uploader", { key: '3e2c64281909b59980b76a05a70de05422fcbc88', maxImages: 10, images: this.imagesBase64List, targetElement: this.searchInputElem, onImagesChange: this.handleImageChange, onError: this.handleImageError, ref: el => (this.imageUploaderRef = el) }))), h("li", { key: '1785965c16e263e38df187f1cb56843ce61db27a', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", onClick: e => {
235
233
  this.captureScreen();
236
234
  this.toggleBox(e);
237
- } }, h("div", { key: 'e2c70c710cc49a633772136dda494bedbceb65ba', class: "mr-1 mt-px" }, h("svg", { key: 'f2c18b6e31224d169538f3217390f385427d7cef', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" }, h("path", { key: '5e8c0e43d70670b0d0cbf9b67e5ef3bc8b5c2c46', d: "M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" }), h("path", { key: '192a6e2333f615a81e86279b398fc9f02f1fd682', "fill-rule": "evenodd", d: "M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z", "clip-rule": "evenodd" }))), h("div", { key: '9006b1196c73d557ea7fbd2e8bcea41471bde5c6' }, "Capture")), h("li", { key: 'aa039a37b2bf21ef8ba3d8503ece555718e13451', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", "aria-label": "Start Over", "aria-disabled": this.chatLength === 0, style: { opacity: this.chatLength === 0 ? "0.5" : "1", cursor: this.chatLength === 0 ? "not-allowed" : "pointer" }, onClick: e => {
235
+ } }, h("div", { key: 'b7905767addc89069e6c1daf77c3dca2e71dfc80', class: "mr-1 mt-px" }, h("svg", { key: 'f11079ae7e023a86e47619946c95841b3f058821', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" }, h("path", { key: '22a53f62a4103da03dcc11fcecc85eb6ca60291c', d: "M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" }), h("path", { key: '652fcc2b453519aff9fb590bad21758de9a906cc', "fill-rule": "evenodd", d: "M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z", "clip-rule": "evenodd" }))), h("div", { key: '4488809bd3daf7ee12d280082a600372d7e4c3f9' }, "Capture")), h("li", { key: 'ab6fc198b0eb81c6b636e522ca1baeb0a462ed3d', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", "aria-label": "Start Over", "aria-disabled": this.chatLength === 0, style: { opacity: this.chatLength === 0 ? "0.5" : "1", cursor: this.chatLength === 0 ? "not-allowed" : "pointer" }, onClick: e => {
238
236
  if (this.chatLength === 0)
239
237
  return;
240
238
  // const escapeEvent = new KeyboardEvent("keydown", { key: "Escape" })
241
239
  // document.dispatchEvent(escapeEvent)
242
240
  this.handleFollowUp(e);
243
241
  this.toggleBox(e);
244
- } }, h("div", { key: '93451694e540b98fe74065d64ee95a665e80a184', class: "mr-1 mt-px" }, h("svg", { key: 'a0def4179e1a83d5191b21520d4751b2417d7505', width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { key: 'af2982fc8683e3a09c06dc86c002ad40cb3666b4', d: "M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" }))), h("div", { key: 'ab8e444179e22d967a4eb0ae18d74634a84de1f0' }, "Start Over")))), h("form", { key: '3a4c4af317bd498e47e37e516a0edabf4917548e', class: "w-full flex flex-col gap-1.5 sticky", onSubmit: this.handleFormSubmit }, h("div", { key: '0f35e9c78b7c53b94b13bef5f35c11a470499587', class: `flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === "inline" ? "inline-searchbar-bgcolor" : "searchbar-bgcolor"}`, dir: "LTR", ref: el => (this.searchFormElem = el) }, h("div", { key: 'f26b4fa9f8af9259925ca10bf35c82cafab8a4fa', class: "flex items-center" }, h("div", { key: 'e7743757529af70ef83aaa5aa3668d7e7d84803b', class: "ml-1 self-center flex space-x-1" }, !this.hideAllButtons && (h("div", { key: '7a8326a613ad37227cc513c2e8a2fe56d11448a5', class: "relative inline-block", style: { width: "5%" } }, h("button", { key: '3e0b94d342159169713ec491e4e6efc6b593bd4b', class: "plus-icon", "aria-label": "Options", title: "Add images or capture screen", tabindex: "0", onClick: e => {
242
+ } }, h("div", { key: '61a542eaa45f949112ed87f6ed4058adfad60dc6', class: "mr-1 mt-px" }, h("svg", { key: '3cf1f6ece6bd36b8305a7f90d8ff57c022fd70f1', width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { key: '15c8bf2a524ce56257c8e4bc7027acf6be91b351', d: "M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" }))), h("div", { key: '3e4c57aa7a21a3c3bd85331476c228580108e7cd' }, "Start Over")))), h("form", { key: 'be70c5e66fbecf1e6ff1e90e58a6eabe0e6a3426', class: "w-full flex flex-col gap-1.5 sticky", onSubmit: this.handleFormSubmit }, h("div", { key: '1efa7de82d5b3e16515b83a80e55f915fd3a71d2', class: `flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === "inline" ? "inline-searchbar-bgcolor" : "searchbar-bgcolor"}`, dir: "LTR", ref: el => (this.searchFormElem = el) }, h("div", { key: '08a343d3ce8fc31178bda7a73fabf398f08af140', class: "flex items-center" }, h("div", { key: 'c66ae93e9bc039d5e62e320ed971630ac12d1f96', class: "ml-1 self-center flex space-x-1" }, !this.hideAllButtons && (h("div", { key: 'bbf4e37acf4806835973a57574461ea1e173b015', class: "relative inline-block", style: { width: "5%" } }, h("button", { key: '0e827515ad96fb518b6da91b7512ac24d7fd2c69', class: "plus-icon", "aria-label": "Options", title: "Add images or capture screen", tabindex: "0", onClick: e => {
245
243
  e.stopPropagation();
246
244
  this.toggleBox(e);
247
- } }, h("svg", { key: '83b375c4b365403e23b43118926a665dbf5e3696', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", width: "20", height: "20" }, h("path", { key: 'c8d8f896723940c3122c2933d76ae2880d798299', d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" })))))), !this.hideAllButtons && (h("div", { key: 'd2c57f7f8218e3cc9dc08ca58a2a97e4073b24dd', class: "scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto" }, h("div", { key: 'bdf6d3aae6e8745b30e202d080063e37301715bc', class: "relative w-full min-w-full h-full min-h-fit flex items-center input-prose" }, h("div", { key: 'bfb4f9fa6ea9686e241390e4155b8a72c988d886', id: `previewContainer-${this.instanceId}`, draggable: true }), h("label", { key: '940eaee0a0b6442acb6f5f4bf45785225f8110df', htmlFor: `searchInput-${this.instanceId}`, class: "sr-only" }, "Your message"), h("textarea", { key: 'ec1726fece852a18b0c587e3014826119ed0a432', readOnly: this.submitted, "aria-describedby": this.emptyMessageError ? `message-error-${this.instanceId} search-hint-${this.instanceId}` : `search-hint-${this.instanceId}`, "aria-invalid": this.emptyMessageError, id: `searchInput-${this.instanceId}`, ref: el => {
245
+ } }, h("svg", { key: 'e69dc435f4ddddbf819a12397e6d2ea887511688', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", width: "20", height: "20" }, h("path", { key: '3360f8d395d1fd97dcbfa4b91a8a9058de979a25', d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" })))))), !this.hideAllButtons && (h("div", { key: 'b9899911414806239ec816e3e685fdb3032d6d55', class: "scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto" }, h("div", { key: '9a133e7e3864cf3b8ae9d0dd9e67bdfeebce20ca', class: "relative w-full min-w-full h-full min-h-fit flex items-center input-prose" }, h("div", { key: 'c565c410c5bae7422d15f4fd100382a09337fbc5', id: `previewContainer-${this.instanceId}`, draggable: true }), h("label", { key: '86f1910908282edf08ee380a7496673587de09c0', htmlFor: `searchInput`, class: "sr-only" }, "Your message"), h("textarea", { key: '3ae4d8685868f5c370da21d7172bffc1a0df29fc', readOnly: this.submitted, "aria-describedby": this.emptyMessageError ? `message-error-${this.instanceId} search-hint-${this.instanceId}` : `search-hint-${this.instanceId}`, "aria-invalid": this.emptyMessageError, id: `searchInput`, ref: el => {
248
246
  this.searchInputElem = el;
249
247
  el === null || el === void 0 ? void 0 : el.focus();
250
- }, placeholder: this.placeholder, autoComplete: "off", class: "w-full p-1 custom-input", value: this.searchInput, rows: 1, onInput: debounce(e => this.handleInputChange(e), 500), onKeyUp: this.adjustHeight, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFormElem.classList.add("input-focus-color"), onBlur: () => this.searchFormElem.classList.remove("input-focus-color"), onPaste: e => { this.handlePaste(e); } }), h("div", { key: 'f0f013b50358ca723f000638ffa3e871ffc29676', role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage), h("span", { key: 'd46a067358a4e29dc2394e77379477183517aab4', class: "sr-only" }, "Press Enter to send, Shift+Enter for new line")))), h("div", { key: '4be8b4caab57017d0303a559b1ea39591afff8d6', class: "p-1 self-end flex space-x-1 flex-row", style: { width: this.hideAllButtons ? "100%" : "auto" } }, h("div", { key: '563937271b8a14ee06c9d66e86ab64622e097737', "aria-label": "Record voice", class: "flex self-center", style: { width: this.hideAllButtons ? "100%" : "auto" } }, this.isEnableMic && (h("audio-recorder", { key: 'e1111daea1138728f842bf44fad27f77f7d61189', "component-type": "search", onStartRecord: _ev => {
248
+ }, placeholder: this.placeholder, autoComplete: "off", class: "w-full p-1 custom-input", value: this.searchInput, rows: 1, onInput: debounce(e => this.handleInputChange(e), 500), onKeyUp: this.adjustHeight, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFormElem.classList.add("input-focus-color"), onBlur: () => this.searchFormElem.classList.remove("input-focus-color"), onPaste: e => {
249
+ this.handlePaste(e);
250
+ } }), h("div", { key: '49137e2305050c43e33b1fc6700f3730a1cf2065', role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage), h("span", { key: '0d6a47354a45ad61751dccce4590e1ba9a86f56d', class: "sr-only" }, "Press Enter to send, Shift+Enter for new line")))), h("div", { key: '179faa1a351580def49054d6d2caa45724ef9b8f', class: "p-1 self-end flex space-x-1 flex-row", style: { width: this.hideAllButtons ? "100%" : "auto" } }, h("div", { key: '7605ed2f215e037f303cd7e30d51b6c51923ee52', "aria-label": "Record voice", class: "flex self-center", style: { width: this.hideAllButtons ? "100%" : "auto" } }, this.isEnableMic && (h("audio-recorder", { key: 'e2572b44c68406cfb14cc2e8439a7671db70d2a4', "component-type": "search", onStartRecord: _ev => {
251
251
  // console.log("test", ev)
252
252
  this.hideAllButtons = true;
253
253
  }, onStopRecord: _ev => {
@@ -265,14 +265,14 @@ export class InputForm {
265
265
  });
266
266
  }
267
267
  }, 1000);
268
- }, style: { width: "100%" } }))), " ", !this.hideAllButtons && (h("div", { key: '6b7317a4fcd1bb32ee01bbf13d23059b940c2f6d', class: "flex items-center" }, h("div", { key: '954e1ee9fe1dcab05c88e7c393a3c1c01f22d408', "aria-label": "Send message", class: "flex" }, h("button", { key: 'c2411103d0ce2b549f8f3c7d6bba3326b2433470', id: `send-message-button-${this.instanceId}`, class: "btn-bg-color text-white transition rounded-full p-1.5 self-center",
268
+ }, style: { width: "100%" } }))), " ", !this.hideAllButtons && (h("div", { key: '521ca3e7338c0f2de60d80cdc88c625a8324937f', class: "flex items-center" }, h("div", { key: '641b5a7a59d73e730222cfb19607528403ba46e2', "aria-label": "Send message", class: "flex" }, h("button", { key: 'cbd9fe575d330dfc3f354bb822aeeb6f0d50c548', id: `send-message-button`, class: "btn-bg-color text-white transition rounded-full p-1.5 self-center",
269
269
  // type="submit"
270
- disabled: this.submitted, onClick: this.handleAskAI, tabindex: "0", "aria-label": "Send Message", title: "Send Message" }, h("svg", { key: 'abb05f96ead0e5a0b7fd434796be4747ef60adc9', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", class: "size-6" }, h("path", { key: 'd0da6f95cc784c3d7942e17b1f0cbe10720f5ed9', "fill-rule": "evenodd", d: "M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z", "clip-rule": "evenodd" })))))))), this.imagesBase64List.length > 0 && (h("div", { key: '75443f523a389807d2dc8c6593b389e4b9af6a0d', class: "flex flex-wrap gap-2 mx-1 mt-2.5 mb-1" }, this.imagesBase64List.map((img, idx) => (h("div", { class: "image-Container sc-ai12z-input-form", key: idx }, h("img", { src: img, style: { width: "70px", height: "50px", borderRadius: ".75rem" } }), h("span", { class: "delete-image sc-ai12z-input-form cursor-pointer ml-1", onClick: () => {
270
+ disabled: this.submitted, onClick: this.handleAskAI, tabindex: "0", "aria-label": "Send Message", title: "Send Message" }, h("svg", { key: '61a236c095bee03e42f2ef4f8f54cb4cb203e7ee', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", class: "size-6" }, h("path", { key: 'b3c128071d733511d186b5514b44e567bc273f79', "fill-rule": "evenodd", d: "M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z", "clip-rule": "evenodd" })))))))), this.imagesBase64List.length > 0 && (h("div", { key: '53a1f7b0e27f49b7770eacfdcb3e0f395a2d2207', class: "flex flex-wrap gap-2 mx-1 mt-2.5 mb-1" }, this.imagesBase64List.map((img, idx) => (h("div", { class: "image-Container sc-ai12z-input-form", key: idx }, h("img", { src: img, style: { width: "70px", height: "50px", borderRadius: ".75rem" } }), h("span", { class: "delete-image sc-ai12z-input-form cursor-pointer ml-1", onClick: () => {
271
271
  this.imagesBase64List = this.imagesBase64List.filter((_, i) => i !== idx);
272
272
  if (this.imageUploaderRef && typeof this.imageUploaderRef.removeImageAtIndex === "function") {
273
273
  this.imageUploaderRef.removeImageAtIndex(idx);
274
274
  }
275
- } }, "\u00D7"))))))), this.showErrorMessage && h("div", { key: '007f59936797ea8874e528014d2333b43b596d49', class: "flex" }, " ", h("p", { key: '2e27c3504c2159718de56fac5145daa0faa6d352', class: "error-msg", innerHTML: this.errorMessage })), this.emptyMessageError && (h("div", { key: '2e03556796263aeb789dc155e26272d145552f29', class: "flex" }, h("p", { key: '271eb26b045b203e67179e895f7be336f0fc6ddc', id: `message-error-${this.instanceId}`, class: "error-msg", role: "alert" }, "Message cannot be empty. Please enter a message to send."))), this.chatLength === 0 && (h("div", { key: '9ef1322c2bd10b52c9ee1d733da086a0d513c4f4', class: "enter-tip", role: "tooltip" }, "Tip: Press Enter to send, Shift+Enter for new line")))));
275
+ } }, "\u00D7"))))))), this.showErrorMessage && (h("div", { key: '68835fe3309ee7c3856fe6eca76e5fc98c0efc41', class: "flex" }, " ", h("p", { key: '98f397793822e1cdaefedd76acc41b3df2c65bfd', class: "error-msg", innerHTML: this.errorMessage }))), this.emptyMessageError && (h("div", { key: '57bf882093f456cbb39b3c3846897f5ba8138f9b', class: "flex" }, h("p", { key: '7d2c00863e48982725c76c4d6899f35c1fb8e007', id: `message-error-${this.instanceId}`, class: "error-msg", role: "alert" }, "Message cannot be empty. Please enter a message to send."))), this.chatLength === 0 && (h("div", { key: '730feded06081d0148a0937e158fc5ee35b080e0', class: "enter-tip", role: "tooltip" }, "Tip: Press Enter to send, Shift+Enter for new line")))));
276
276
  }
277
277
  static get is() { return "ai12z-input-form"; }
278
278
  static get originalStyleUrls() {
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../src/components/input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC/F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAa1D,MAAM,OAAO,SAAS;;QAOpB,+BAA+B;QAC/B,6BAA6B;QAC7B,8BAA8B;QACtB,eAAU,GAAW,SAAS,YAAY,EAAE,EAAE,CAAA;QA+BtD,iBAAY,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAA;YAC1C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,GAAG,IAAI,CAAA;QAC9E,CAAC,CAAA;QAED,sBAAiB,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAA;YAC7C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,OAAM;YACR,CAAC;YACD,+DAA+D;YAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAA;YACxC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,I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C,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,CAAA;gCACzE,IAAI,IAAI,CAAC,gBAAgB,IAAI,OAAO,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,KAAK,UAAU,EAAE,CAAC;oCAC5F,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;gCAC/C,CAAC;4BACH,CAAC,aAGI,CACH,CACP,CAAC,CACE,CACP,CACG;gBACL,IAAI,CAAC,gBAAgB,IAAI,4DAAK,KAAK,EAAC,MAAM;;oBAAE,0DAAG,KAAK,EAAC,WAAW,EAAC,SAAS,EAAE,IAAI,CAAC,YAAY,GAAM,CAAM;gBACzG,IAAI,CAAC,iBAAiB,IAAI,CACzB,4DAAK,KAAK,EAAC,MAAM;oBACf,0DAAG,EAAE,EAAE,iBAAiB,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,+DAErE,CACA,CACP;gBACA,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CACxB,4DAAK,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,SAAS,yDAE/B,CACP,CACI,CAED,CACP,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Event, EventEmitter, Element, Listen } from \"@stencil/core\"\nimport { debounce, generateUUID } from \"../../utils/utils\"\n\n// Add this after your imports\ninterface HTMLImageUploaderElement extends HTMLElement {\n removeImageAtIndex?: (idx: number) => void\n}\n\n@Component({\n tag: \"ai12z-input-form\",\n styleUrls: [\"./input.css\"],\n shadow: false,\n // scoped: true\n})\nexport class InputForm {\n private searchFormElem: HTMLDivElement\n private searchInputElem: HTMLTextAreaElement\n // private searchTextareaElem: HTMLTextAreaElement\n private followUpElem: HTMLInputElement\n // private uploadElem: HTMLInputElement\n private menuElem: HTMLElement\n // private customWidth = \"100%\"\n // private icon_width: string\n // private icon_height: string\n private instanceId: string = `input-${generateUUID()}`\n @State() imagesBase64List: string[] = []\n\n @Element() el!: HTMLElement\n\n @Prop() isChat: boolean\n @Prop() placeholder: string\n @Prop() buttonText: string\n @Prop() followUpLabel: string\n @Prop() iconSrc: string\n @Prop() isImageUpload: boolean\n @Prop() isEnableMic: boolean\n @Prop() componentType: string = \"search\"\n @Prop() chatLength: number = 0\n\n @Event() action: EventEmitter\n @Event() capturedImgUpload: EventEmitter<File[]>\n\n @State() searchInput: string = \"\"\n @State() submitted: boolean = false\n @State() showErrorMessage: boolean = false\n @State() hideAllButtons: boolean = false\n @State() isOpen: boolean = false\n @State() capturedFile: File | null = null\n @State() errorMessage: string = \"You can upload a maximum of 10 images once at a time.\"\n @State() emptyMessageError: boolean = false\n @State() announceMessage: string = \"\"\n private tempValue: string\n // Add a ref to the image-uploader\n private imageUploaderRef: HTMLImageUploaderElement\n\n adjustHeight = () => {\n this.searchInputElem.style.height = \"auto\"\n this.searchInputElem.style.height = this.searchInputElem.scrollHeight + \"px\"\n }\n\n handleInputChange = (e: Event) => {\n this.searchInput = this.searchInputElem.value\n if (this.isChat) {\n return\n }\n // console.log(\"handleInputChange\", this.searchInputElem.value)\n const value = this.searchInputElem.value\n if (value.length > 3 && !this.isChat) {\n this.action.emit({ event: e, value: value, type: \"search\", imgFiles: this.imagesBase64List })\n }\n }\n\n handleClickOutside = (event: MouseEvent) => {\n const target = event.target as HTMLElement\n if (this.isOpen && this.menuElem && !this.menuElem.contains(target)) {\n this.isOpen = false\n }\n }\n\n disconnectedCallback() {\n // console.log(\"disconnectedCallback input.tsx\")\n // Clean up event listeners to avoid memory leaks\n document.removeEventListener(\"click\", this.handleClickOutside)\n // Remove any other cleanup logic if necessary\n // Image upload logic moved to ImageUploader component\n }\n\n componentDidLoad() {\n // console.log(\"componentWillLoad input.tsx\")\n if (!this.isImageUpload) return\n // const preivewContainer = this.el.querySelector(\".custom-input\")\n\n document.addEventListener(\"click\", this.handleClickOutside)\n }\n\n handleFormSubmit = (e: Event) => {\n e.preventDefault()\n if (this.searchInput.length > 3) {\n this.action.emit({ event: e, value: this.searchInputElem.value, type: \"search\" })\n }\n }\n\n @Listen(\"stateChanged\", { target: \"document\" })\n stateChangedHandler(_state) {\n this.submitted = false\n if (this.isChat) {\n this.searchInputElem.value = \"\"\n this.searchInput = \"\"\n const parent = this.el.querySelector(`#previewContainer-${this.instanceId}`)\n const textarea = this.el.querySelector(`#searchInput-${this.instanceId}`)\n // textarea[\"style\"].height = \"20px\"\n textarea[\"style\"].overflow = \"hidden\"\n if (parent) {\n parent.innerHTML = \"\"\n }\n this.imagesBase64List = []\n }\n }\n\n @Listen(\"clearInput\", { target: \"document\" })\n clearInputHandler(_state) {\n this.submitted = false\n this.searchInput = \"\"\n\n const parent = this.el.querySelector(`#previewContainer-${this.instanceId}`)\n if (parent) {\n parent.innerHTML = \"\"\n }\n this.imagesBase64List = []\n this.searchInputElem.style.height = \"auto\"\n }\n\n handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Enter\" && event.shiftKey) {\n console.log(\"Shift + Enter detected\")\n // Prevent default behavior if needed\n }\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault()\n console.log(\"Enter key pressed\", this.searchInputElem.value, this.imagesBase64List)\n if (this.searchInputElem.value.trim() !== \"\" || this.imagesBase64List.length > 0) {\n this.handleAskAI(event)\n } else if (this.imagesBase64List.length === 0 && this.searchInputElem.value.trim() === \"\") {\n // Show error when Enter is pressed with empty message\n this.emptyMessageError = true\n this.searchInputElem.focus()\n setTimeout(() => {\n this.emptyMessageError = false\n }, 3000)\n }\n }\n }\n\n private announce(message: string) {\n this.announceMessage = message\n setTimeout(() => {\n this.announceMessage = \"\"\n }, 1000)\n }\n\n handleFollowUp = (e: Event) => {\n this.action.emit({ event: e, value: this.searchInputElem.value, imgFiles: this.imagesBase64List, type: \"follow-up\", followUp: false /*this.followUpElem.checked*/ })\n }\n\n handleAskAI = (e: Event) => {\n e.preventDefault()\n if (this.searchInputElem.value.trim() === \"\" && this.imagesBase64List.length === 0) {\n this.emptyMessageError = true\n this.searchInputElem.focus()\n // Clear error after 3 seconds\n setTimeout(() => {\n this.emptyMessageError = false\n }, 3000)\n return\n }\n this.submitted = true\n this.showErrorMessage = false\n this.emptyMessageError = false\n this.announce(\"Message sent successfully\")\n this.tempValue = this.searchInputElem.value\n this.searchInputElem.value = \"\"\n const tempImages = this.imagesBase64List\n this.imagesBase64List = []\n // console.log(\"Handling Ask AI with value:\", this.searchInputElem.value , this.tempValue)\n this.action.emit({ event: e, value: this.tempValue, imgFiles: tempImages, followUp: this.followUpElem?.checked ?? false, type: \"ask-ai\" })\n }\n\n handleImageChange = event => {\n this.imagesBase64List = event.detail\n this.showErrorMessage = false\n }\n\n handleImageError = event => {\n this.errorMessage = event.detail\n this.showErrorMessage = true\n }\n\n toggleBox = e => {\n e.stopPropagation()\n this.isOpen = !this.isOpen\n }\n\n async captureScreen() {\n try {\n const stream = await navigator.mediaDevices.getDisplayMedia({\n video: true, // Capture the screen\n })\n\n const video = document.createElement(\"video\")\n video.srcObject = stream\n video.autoplay = true\n document.body.appendChild(video) // Add temporarily to allow rendering\n // // Ensure the page stays in focus\n // document.body.focus()\n\n await new Promise(resolve => (video.onloadedmetadata = resolve))\n\n // Ensure the video is playing before capturing\n await new Promise(resolve => setTimeout(resolve, 500))\n const canvas = document.createElement(\"canvas\")\n canvas.width = video.videoWidth\n canvas.height = video.videoHeight\n const ctx = canvas.getContext(\"2d\")\n\n if (ctx) {\n ctx.drawImage(video, 0, 0, canvas.width, canvas.height)\n // Convert canvas to Blob\n canvas.toBlob(blob => {\n if (blob) {\n const file = new File([blob], `screenshot-${Date.now()}.png`, { type: \"image/png\" })\n this.capturedFile = file \n this.capturedImgUpload.emit([file])\n // TODO: Integrate with ImageUploader to handle the captured file\n // Example: emit an event or update state to pass file to ImageUploader\n }\n }, \"image/png\")\n }\n\n // Stop video stream after capture\n stream.getTracks().forEach(track => track.stop())\n // Remove the video element from the DOM\n document.body.removeChild(video)\n } catch (err) {\n console.error(\"Error capturing screen:\", err)\n }\n }\n\n // Replace your existing handlePaste method with this enhanced version\nhandlePaste = (event: ClipboardEvent): void => {\n event.preventDefault() // Prevent default paste behavior\n \n // console.log(\"Text pasted into textarea\")\n \n const pastedText = event.clipboardData?.getData(\"text\") || \"\"\n \n if (this.searchInputElem && pastedText) {\n const textarea = this.searchInputElem\n const startPos = textarea.selectionStart\n const endPos = textarea.selectionEnd\n const currentValue = textarea.value\n\n // Replace selected text or insert at cursor position\n const newValue = currentValue.substring(0, startPos) + \n pastedText + \n currentValue.substring(endPos)\n\n // Update the textarea value\n textarea.value = newValue\n \n // Set cursor position after pasted text\n const newCursorPos = startPos + pastedText.length\n textarea.setSelectionRange(newCursorPos, newCursorPos)\n \n // Adjust height after paste\n setTimeout(() => {\n this.adjustHeight()\n }, 0)\n }\n}\n\n\n render() {\n //To get the query params of the iconSrc\n // if (this.iconSrc) {\n // const url = new URL(this.iconSrc)\n // this.icon_width = url.searchParams.get(\"w\") || \"28\"\n // this.icon_height = url.searchParams.get(\"h\") || \"28\"\n // }\n\n return (\n <div>\n {/* Option Box */}\n <div\n class={`absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n ${this.isOpen ? \"opacity-100 scale-100 pointer-events-auto\" : \"opacity-0 scale-90 pointer-events-none\"}`}\n ref={el => (this.menuElem = el as HTMLElement)}\n >\n <ul class=\"space-y-2\">\n {/* ImageUploader replaces image upload logic */}\n {this.isImageUpload && (\n <li class=\"px-4 py-2 hover:bg-gray-100 cursor-pointer flex\">\n <image-uploader\n maxImages={10}\n images={this.imagesBase64List}\n targetElement={this.searchInputElem}\n onImagesChange={this.handleImageChange}\n onError={this.handleImageError}\n ref={el => (this.imageUploaderRef = el as any)}\n />\n {/* <div class=\"mr-1\">Upload Images</div> */}\n </li>\n )}\n <li\n class=\"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex\"\n onClick={e => {\n this.captureScreen()\n this.toggleBox(e)\n }}\n >\n <div class=\"mr-1 mt-px\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"20\" height=\"20\">\n <path d=\"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z\"></path>\n <path\n fill-rule=\"evenodd\"\n d=\"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z\"\n clip-rule=\"evenodd\"\n ></path>\n </svg>\n </div>\n <div>Capture</div>\n </li>\n <li\n class=\"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex\"\n aria-label=\"Start Over\"\n aria-disabled={this.chatLength === 0}\n style={{ opacity: this.chatLength === 0 ? \"0.5\" : \"1\", cursor: this.chatLength === 0 ? \"not-allowed\" : \"pointer\" }}\n onClick={e => {\n if (this.chatLength === 0) return\n // const escapeEvent = new KeyboardEvent(\"keydown\", { key: \"Escape\" })\n // document.dispatchEvent(escapeEvent)\n this.handleFollowUp(e)\n this.toggleBox(e)\n }}\n >\n <div class=\"mr-1 mt-px\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2\"/>\n </svg>\n </div>\n <div>Start Over</div>\n </li>\n </ul>\n </div>\n <form class=\"w-full flex flex-col gap-1.5 sticky\" onSubmit={this.handleFormSubmit}>\n \n <div\n class={`flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === \"inline\" ? \"inline-searchbar-bgcolor\" : \"searchbar-bgcolor\"}`}\n dir=\"LTR\"\n ref={el => (this.searchFormElem = el)}\n >\n <div class=\"flex items-center\">\n <div class=\"ml-1 self-center flex space-x-1\">\n {!this.hideAllButtons && (\n <div class=\"relative inline-block\" style={{ width: \"5%\" }}>\n <button\n class=\"plus-icon\"\n aria-label=\"Options\"\n title=\"Add images or capture screen\"\n tabindex=\"0\"\n onClick={e => {\n e.stopPropagation()\n this.toggleBox(e)\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" width=\"20\" height=\"20\">\n <path d=\"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z\"></path>\n </svg>\n </button>\n \n </div>\n )}\n </div>\n {!this.hideAllButtons && (\n <div class=\"scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto\">\n <div class=\"relative w-full min-w-full h-full min-h-fit flex items-center input-prose\">\n <div id={`previewContainer-${this.instanceId}`} draggable></div>\n <label htmlFor={`searchInput-${this.instanceId}`} class=\"sr-only\">\n Your message\n </label>\n <textarea\n readOnly={this.submitted}\n aria-describedby={this.emptyMessageError ? `message-error-${this.instanceId} search-hint-${this.instanceId}` : `search-hint-${this.instanceId}`}\n aria-invalid={this.emptyMessageError}\n id={`searchInput-${this.instanceId}`}\n ref={el => {\n this.searchInputElem = el as HTMLTextAreaElement\n el?.focus()\n }}\n placeholder={this.placeholder}\n autoComplete=\"off\"\n class=\"w-full p-1 custom-input\"\n value={this.searchInput}\n rows={1}\n onInput={debounce(e => this.handleInputChange(e), 500)}\n onKeyUp={this.adjustHeight}\n onKeyDown={this.handleKeyDown}\n onFocus={() => this.searchFormElem.classList.add(\"input-focus-color\")}\n onBlur={() => this.searchFormElem.classList.remove(\"input-focus-color\")}\n onPaste={e => {this.handlePaste(e)}}\n ></textarea>\n <div role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">\n {this.announceMessage}\n </div>\n <span class=\"sr-only\">Press Enter to send, Shift+Enter for new line</span>\n </div>\n </div>\n )}\n <div class=\"p-1 self-end flex space-x-1 flex-row\" style={{ width: this.hideAllButtons ? \"100%\" : \"auto\" }}>\n <div aria-label=\"Record voice\" class=\"flex self-center\" style={{ width: this.hideAllButtons ? \"100%\" : \"auto\" }}>\n {this.isEnableMic && (\n <audio-recorder\n component-type=\"search\"\n onStartRecord={_ev => {\n // console.log(\"test\", ev)\n this.hideAllButtons = true\n }}\n onStopRecord={_ev => {\n this.hideAllButtons = false\n }}\n onSendTranscript={ev => {\n // console.log(\"ev\", ev)\n\n setTimeout(() => {\n // console.log(\"input\", this.searchInputElem)\n if (this.searchInputElem) {\n this.searchInputElem.value = ev.detail\n this.searchInputElem.focus()\n // Wait for DOM to update\n requestAnimationFrame(() => {\n this.adjustHeight()\n })\n }\n }, 1000)\n }}\n style={{ width: \"100%\" }}\n ></audio-recorder>\n )}\n </div>{\" \"}\n {!this.hideAllButtons && (\n <div class=\"flex items-center\">\n <div aria-label=\"Send message\" class=\"flex\">\n <button\n id={`send-message-button-${this.instanceId}`}\n class=\"btn-bg-color text-white transition rounded-full p-1.5 self-center\"\n // type=\"submit\"\n disabled={this.submitted}\n onClick={this.handleAskAI}\n tabindex=\"0\"\n aria-label=\"Send Message\"\n title=\"Send Message\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" class=\"size-6\">\n <path\n fill-rule=\"evenodd\"\n d=\"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z\"\n clip-rule=\"evenodd\"\n ></path>\n </svg>\n </button>\n </div>\n </div>\n )}\n </div>\n </div>\n {/* Render uploaded images below the input area if any */}\n {this.imagesBase64List.length > 0 && (\n <div class=\"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1\">\n {this.imagesBase64List.map((img, idx) => (\n <div class=\"image-Container sc-ai12z-input-form\" key={idx}>\n <img src={img} style={{ width: \"70px\", height: \"50px\", borderRadius: \".75rem\" }} />\n <span\n class=\"delete-image sc-ai12z-input-form cursor-pointer ml-1\"\n onClick={() => {\n this.imagesBase64List = this.imagesBase64List.filter((_, i) => i !== idx)\n if (this.imageUploaderRef && typeof this.imageUploaderRef.removeImageAtIndex === \"function\") {\n this.imageUploaderRef.removeImageAtIndex(idx)\n }\n }}\n >\n ×\n </span>\n </div>\n ))}\n </div>\n )}\n </div>\n {this.showErrorMessage && <div class=\"flex\"> <p class=\"error-msg\" innerHTML={this.errorMessage}></p></div> }\n {this.emptyMessageError && (\n <div class=\"flex\">\n <p id={`message-error-${this.instanceId}`} class=\"error-msg\" role=\"alert\">\n Message cannot be empty. Please enter a message to send.\n </p>\n </div>\n )}\n {this.chatLength === 0 && (\n <div class=\"enter-tip\" role=\"tooltip\">\n Tip: Press Enter to send, Shift+Enter for new line\n </div>\n )}\n </form>\n \n </div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AC,kBAAkB,CAAC,GAAG,CAAC,CAAA;gCAC/C,CAAC;4BACH,CAAC,aAGI,CACH,CACP,CAAC,CACE,CACP,CACG;gBACL,IAAI,CAAC,gBAAgB,IAAI,CACxB,4DAAK,KAAK,EAAC,MAAM;oBACd,GAAG;oBACJ,0DAAG,KAAK,EAAC,WAAW,EAAC,SAAS,EAAE,IAAI,CAAC,YAAY,GAAM,CACnD,CACP;gBACA,IAAI,CAAC,iBAAiB,IAAI,CACzB,4DAAK,KAAK,EAAC,MAAM;oBACf,0DAAG,EAAE,EAAE,iBAAiB,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,+DAErE,CACA,CACP;gBACA,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,CACxB,4DAAK,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,SAAS,yDAE/B,CACP,CACI,CACH,CACP,CAAA;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, State, Event, EventEmitter, Element, Listen } from \"@stencil/core\"\nimport { debounce, generateUUID } from \"../../utils/utils\"\n\n// Add this after your imports\ninterface HTMLImageUploaderElement extends HTMLElement {\n removeImageAtIndex?: (idx: number) => void\n}\n\n@Component({\n tag: \"ai12z-input-form\",\n styleUrls: [\"./input.css\"],\n shadow: false,\n // scoped: true\n})\nexport class InputForm {\n private searchFormElem: HTMLDivElement\n private searchInputElem: HTMLTextAreaElement\n // private searchTextareaElem: HTMLTextAreaElement\n private followUpElem: HTMLInputElement\n // private uploadElem: HTMLInputElement\n private menuElem: HTMLElement\n // private customWidth = \"100%\"\n // private icon_width: string\n // private icon_height: string\n private instanceId: string = `input-${generateUUID()}`\n @State() imagesBase64List: string[] = []\n\n @Element() el!: HTMLElement\n\n @Prop() isChat: boolean\n @Prop() placeholder: string\n @Prop() buttonText: string\n @Prop() followUpLabel: string\n @Prop() iconSrc: string\n @Prop() isImageUpload: boolean\n @Prop() isEnableMic: boolean\n @Prop() componentType: string = \"search\"\n @Prop() chatLength: number = 0\n\n @Event() action: EventEmitter\n @Event() capturedImgUpload: EventEmitter<File[]>\n\n @State() searchInput: string = \"\"\n @State() submitted: boolean = false\n @State() showErrorMessage: boolean = false\n @State() hideAllButtons: boolean = false\n @State() isOpen: boolean = false\n @State() capturedFile: File | null = null\n @State() errorMessage: string = \"You can upload a maximum of 10 images once at a time.\"\n @State() emptyMessageError: boolean = false\n @State() announceMessage: string = \"\"\n private tempValue: string\n // Add a ref to the image-uploader\n private imageUploaderRef: HTMLImageUploaderElement\n\n adjustHeight = () => {\n this.searchInputElem.style.height = \"auto\"\n this.searchInputElem.style.height = this.searchInputElem.scrollHeight + \"px\"\n }\n\n handleInputChange = (e: Event) => {\n this.searchInput = this.searchInputElem.value\n if (this.isChat) {\n return\n }\n // console.log(\"handleInputChange\", this.searchInputElem.value)\n const value = this.searchInputElem.value\n if (value.length > 3 && !this.isChat) {\n this.action.emit({ event: e, value: value, type: \"search\", imgFiles: this.imagesBase64List })\n }\n }\n\n handleClickOutside = (event: MouseEvent) => {\n const target = event.target as HTMLElement\n if (this.isOpen && this.menuElem && !this.menuElem.contains(target)) {\n this.isOpen = false\n }\n }\n\n disconnectedCallback() {\n // console.log(\"disconnectedCallback input.tsx\")\n // Clean up event listeners to avoid memory leaks\n document.removeEventListener(\"click\", this.handleClickOutside)\n // Remove any other cleanup logic if necessary\n // Image upload logic moved to ImageUploader component\n }\n\n componentDidLoad() {\n // console.log(\"componentWillLoad input.tsx\")\n if (!this.isImageUpload) return\n // const preivewContainer = this.el.querySelector(\".custom-input\")\n\n document.addEventListener(\"click\", this.handleClickOutside)\n }\n\n handleFormSubmit = (e: Event) => {\n e.preventDefault()\n if (this.searchInput.length > 3) {\n this.action.emit({ event: e, value: this.searchInputElem.value, type: \"search\" })\n }\n }\n\n @Listen(\"stateChanged\", { target: \"document\" })\n stateChangedHandler(_state) {\n this.submitted = false\n if (this.isChat) {\n this.searchInputElem.value = \"\"\n this.searchInput = \"\"\n const parent = this.el.querySelector(`#previewContainer-${this.instanceId}`)\n const textarea = this.el.querySelector(`#searchInput`)\n // textarea[\"style\"].height = \"20px\"\n textarea[\"style\"].overflow = \"hidden\"\n if (parent) {\n parent.innerHTML = \"\"\n }\n this.imagesBase64List = []\n }\n }\n\n @Listen(\"clearInput\", { target: \"document\" })\n clearInputHandler(_state) {\n this.submitted = false\n this.searchInput = \"\"\n\n const parent = this.el.querySelector(`#previewContainer-${this.instanceId}`)\n if (parent) {\n parent.innerHTML = \"\"\n }\n this.imagesBase64List = []\n this.searchInputElem.style.height = \"auto\"\n }\n\n handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Enter\" && event.shiftKey) {\n console.log(\"Shift + Enter detected\")\n // Prevent default behavior if needed\n }\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault()\n console.log(\"Enter key pressed\", this.searchInputElem.value, this.imagesBase64List)\n if (this.searchInputElem.value.trim() !== \"\" || this.imagesBase64List.length > 0) {\n this.handleAskAI(event)\n } else if (this.imagesBase64List.length === 0 && this.searchInputElem.value.trim() === \"\") {\n // Show error when Enter is pressed with empty message\n this.emptyMessageError = true\n this.searchInputElem.focus()\n setTimeout(() => {\n this.emptyMessageError = false\n }, 3000)\n }\n }\n }\n\n private announce(message: string) {\n this.announceMessage = message\n setTimeout(() => {\n this.announceMessage = \"\"\n }, 1000)\n }\n\n handleFollowUp = (e: Event) => {\n this.action.emit({ event: e, value: this.searchInputElem.value, imgFiles: this.imagesBase64List, type: \"follow-up\", followUp: false /*this.followUpElem.checked*/ })\n }\n\n handleAskAI = (e: Event) => {\n e.preventDefault()\n if (this.searchInputElem.value.trim() === \"\" && this.imagesBase64List.length === 0) {\n this.emptyMessageError = true\n this.searchInputElem.focus()\n // Clear error after 3 seconds\n setTimeout(() => {\n this.emptyMessageError = false\n }, 3000)\n return\n }\n this.submitted = true\n this.showErrorMessage = false\n this.emptyMessageError = false\n this.announce(\"Message sent successfully\")\n this.tempValue = this.searchInputElem.value\n this.searchInputElem.value = \"\"\n const tempImages = this.imagesBase64List\n this.imagesBase64List = []\n // console.log(\"Handling Ask AI with value:\", this.searchInputElem.value , this.tempValue)\n this.action.emit({ event: e, value: this.tempValue, imgFiles: tempImages, followUp: this.followUpElem?.checked ?? false, type: \"ask-ai\" })\n }\n\n handleImageChange = event => {\n this.imagesBase64List = event.detail\n this.showErrorMessage = false\n }\n\n handleImageError = event => {\n this.errorMessage = event.detail\n this.showErrorMessage = true\n }\n\n toggleBox = e => {\n e.stopPropagation()\n this.isOpen = !this.isOpen\n }\n\n async captureScreen() {\n try {\n const stream = await navigator.mediaDevices.getDisplayMedia({\n video: true, // Capture the screen\n })\n\n const video = document.createElement(\"video\")\n video.srcObject = stream\n video.autoplay = true\n document.body.appendChild(video) // Add temporarily to allow rendering\n // // Ensure the page stays in focus\n // document.body.focus()\n\n await new Promise(resolve => (video.onloadedmetadata = resolve))\n\n // Ensure the video is playing before capturing\n await new Promise(resolve => setTimeout(resolve, 500))\n const canvas = document.createElement(\"canvas\")\n canvas.width = video.videoWidth\n canvas.height = video.videoHeight\n const ctx = canvas.getContext(\"2d\")\n\n if (ctx) {\n ctx.drawImage(video, 0, 0, canvas.width, canvas.height)\n // Convert canvas to Blob\n canvas.toBlob(blob => {\n if (blob) {\n const file = new File([blob], `screenshot-${Date.now()}.png`, { type: \"image/png\" })\n this.capturedFile = file\n this.capturedImgUpload.emit([file])\n // TODO: Integrate with ImageUploader to handle the captured file\n // Example: emit an event or update state to pass file to ImageUploader\n }\n }, \"image/png\")\n }\n\n // Stop video stream after capture\n stream.getTracks().forEach(track => track.stop())\n // Remove the video element from the DOM\n document.body.removeChild(video)\n } catch (err) {\n console.error(\"Error capturing screen:\", err)\n }\n }\n\n // Replace your existing handlePaste method with this enhanced version\n handlePaste = (event: ClipboardEvent): void => {\n event.preventDefault() // Prevent default paste behavior\n\n // console.log(\"Text pasted into textarea\")\n\n const pastedText = event.clipboardData?.getData(\"text\") || \"\"\n\n if (this.searchInputElem && pastedText) {\n const textarea = this.searchInputElem\n const startPos = textarea.selectionStart\n const endPos = textarea.selectionEnd\n const currentValue = textarea.value\n\n // Replace selected text or insert at cursor position\n const newValue = currentValue.substring(0, startPos) + pastedText + currentValue.substring(endPos)\n\n // Update the textarea value\n textarea.value = newValue\n\n // Set cursor position after pasted text\n const newCursorPos = startPos + pastedText.length\n textarea.setSelectionRange(newCursorPos, newCursorPos)\n\n // Adjust height after paste\n setTimeout(() => {\n this.adjustHeight()\n }, 0)\n }\n }\n\n render() {\n //To get the query params of the iconSrc\n // if (this.iconSrc) {\n // const url = new URL(this.iconSrc)\n // this.icon_width = url.searchParams.get(\"w\") || \"28\"\n // this.icon_height = url.searchParams.get(\"h\") || \"28\"\n // }\n\n return (\n <div>\n {/* Option Box */}\n <div\n class={`absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10\n ${this.isOpen ? \"opacity-100 scale-100 pointer-events-auto\" : \"opacity-0 scale-90 pointer-events-none\"}`}\n ref={el => (this.menuElem = el as HTMLElement)}\n >\n <ul class=\"space-y-2\">\n {/* ImageUploader replaces image upload logic */}\n {this.isImageUpload && (\n <li class=\"px-4 py-2 hover:bg-gray-100 cursor-pointer flex\">\n <image-uploader\n maxImages={10}\n images={this.imagesBase64List}\n targetElement={this.searchInputElem}\n onImagesChange={this.handleImageChange}\n onError={this.handleImageError}\n ref={el => (this.imageUploaderRef = el as any)}\n />\n {/* <div class=\"mr-1\">Upload Images</div> */}\n </li>\n )}\n <li\n class=\"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex\"\n onClick={e => {\n this.captureScreen()\n this.toggleBox(e)\n }}\n >\n <div class=\"mr-1 mt-px\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"20\" height=\"20\">\n <path d=\"M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z\"></path>\n <path\n fill-rule=\"evenodd\"\n d=\"M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z\"\n clip-rule=\"evenodd\"\n ></path>\n </svg>\n </div>\n <div>Capture</div>\n </li>\n <li\n class=\"px-4 pb-2 hover:bg-gray-100 cursor-pointer flex\"\n aria-label=\"Start Over\"\n aria-disabled={this.chatLength === 0}\n style={{ opacity: this.chatLength === 0 ? \"0.5\" : \"1\", cursor: this.chatLength === 0 ? \"not-allowed\" : \"pointer\" }}\n onClick={e => {\n if (this.chatLength === 0) return\n // const escapeEvent = new KeyboardEvent(\"keydown\", { key: \"Escape\" })\n // document.dispatchEvent(escapeEvent)\n this.handleFollowUp(e)\n this.toggleBox(e)\n }}\n >\n <div class=\"mr-1 mt-px\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path d=\"M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2\" />\n </svg>\n </div>\n <div>Start Over</div>\n </li>\n </ul>\n </div>\n <form class=\"w-full flex flex-col gap-1.5 sticky\" onSubmit={this.handleFormSubmit}>\n <div\n class={`flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === \"inline\" ? \"inline-searchbar-bgcolor\" : \"searchbar-bgcolor\"}`}\n dir=\"LTR\"\n ref={el => (this.searchFormElem = el)}\n >\n <div class=\"flex items-center\">\n <div class=\"ml-1 self-center flex space-x-1\">\n {!this.hideAllButtons && (\n <div class=\"relative inline-block\" style={{ width: \"5%\" }}>\n <button\n class=\"plus-icon\"\n aria-label=\"Options\"\n title=\"Add images or capture screen\"\n tabindex=\"0\"\n onClick={e => {\n e.stopPropagation()\n this.toggleBox(e)\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" width=\"20\" height=\"20\">\n <path d=\"M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z\"></path>\n </svg>\n </button>\n </div>\n )}\n </div>\n {!this.hideAllButtons && (\n <div class=\"scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto\">\n <div class=\"relative w-full min-w-full h-full min-h-fit flex items-center input-prose\">\n <div id={`previewContainer-${this.instanceId}`} draggable></div>\n <label htmlFor={`searchInput`} class=\"sr-only\">\n Your message\n </label>\n <textarea\n readOnly={this.submitted}\n aria-describedby={this.emptyMessageError ? `message-error-${this.instanceId} search-hint-${this.instanceId}` : `search-hint-${this.instanceId}`}\n aria-invalid={this.emptyMessageError}\n id={`searchInput`}\n ref={el => {\n this.searchInputElem = el as HTMLTextAreaElement\n el?.focus()\n }}\n placeholder={this.placeholder}\n autoComplete=\"off\"\n class=\"w-full p-1 custom-input\"\n value={this.searchInput}\n rows={1}\n onInput={debounce(e => this.handleInputChange(e), 500)}\n onKeyUp={this.adjustHeight}\n onKeyDown={this.handleKeyDown}\n onFocus={() => this.searchFormElem.classList.add(\"input-focus-color\")}\n onBlur={() => this.searchFormElem.classList.remove(\"input-focus-color\")}\n onPaste={e => {\n this.handlePaste(e)\n }}\n ></textarea>\n <div role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" class=\"sr-only\">\n {this.announceMessage}\n </div>\n <span class=\"sr-only\">Press Enter to send, Shift+Enter for new line</span>\n </div>\n </div>\n )}\n <div class=\"p-1 self-end flex space-x-1 flex-row\" style={{ width: this.hideAllButtons ? \"100%\" : \"auto\" }}>\n <div aria-label=\"Record voice\" class=\"flex self-center\" style={{ width: this.hideAllButtons ? \"100%\" : \"auto\" }}>\n {this.isEnableMic && (\n <audio-recorder\n component-type=\"search\"\n onStartRecord={_ev => {\n // console.log(\"test\", ev)\n this.hideAllButtons = true\n }}\n onStopRecord={_ev => {\n this.hideAllButtons = false\n }}\n onSendTranscript={ev => {\n // console.log(\"ev\", ev)\n\n setTimeout(() => {\n // console.log(\"input\", this.searchInputElem)\n if (this.searchInputElem) {\n this.searchInputElem.value = ev.detail\n this.searchInputElem.focus()\n // Wait for DOM to update\n requestAnimationFrame(() => {\n this.adjustHeight()\n })\n }\n }, 1000)\n }}\n style={{ width: \"100%\" }}\n ></audio-recorder>\n )}\n </div>{\" \"}\n {!this.hideAllButtons && (\n <div class=\"flex items-center\">\n <div aria-label=\"Send message\" class=\"flex\">\n <button\n id={`send-message-button`}\n class=\"btn-bg-color text-white transition rounded-full p-1.5 self-center\"\n // type=\"submit\"\n disabled={this.submitted}\n onClick={this.handleAskAI}\n tabindex=\"0\"\n aria-label=\"Send Message\"\n title=\"Send Message\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\" fill=\"currentColor\" class=\"size-6\">\n <path\n fill-rule=\"evenodd\"\n d=\"M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z\"\n clip-rule=\"evenodd\"\n ></path>\n </svg>\n </button>\n </div>\n </div>\n )}\n </div>\n </div>\n {/* Render uploaded images below the input area if any */}\n {this.imagesBase64List.length > 0 && (\n <div class=\"flex flex-wrap gap-2 mx-1 mt-2.5 mb-1\">\n {this.imagesBase64List.map((img, idx) => (\n <div class=\"image-Container sc-ai12z-input-form\" key={idx}>\n <img src={img} style={{ width: \"70px\", height: \"50px\", borderRadius: \".75rem\" }} />\n <span\n class=\"delete-image sc-ai12z-input-form cursor-pointer ml-1\"\n onClick={() => {\n this.imagesBase64List = this.imagesBase64List.filter((_, i) => i !== idx)\n if (this.imageUploaderRef && typeof this.imageUploaderRef.removeImageAtIndex === \"function\") {\n this.imageUploaderRef.removeImageAtIndex(idx)\n }\n }}\n >\n ×\n </span>\n </div>\n ))}\n </div>\n )}\n </div>\n {this.showErrorMessage && (\n <div class=\"flex\">\n {\" \"}\n <p class=\"error-msg\" innerHTML={this.errorMessage}></p>\n </div>\n )}\n {this.emptyMessageError && (\n <div class=\"flex\">\n <p id={`message-error-${this.instanceId}`} class=\"error-msg\" role=\"alert\">\n Message cannot be empty. Please enter a message to send.\n </p>\n </div>\n )}\n {this.chatLength === 0 && (\n <div class=\"enter-tip\" role=\"tooltip\">\n Tip: Press Enter to send, Shift+Enter for new line\n </div>\n )}\n </form>\n </div>\n )\n }\n}\n"]}
@@ -1387,9 +1387,7 @@ const InputForm = class {
1387
1387
  const endPos = textarea.selectionEnd;
1388
1388
  const currentValue = textarea.value;
1389
1389
  // Replace selected text or insert at cursor position
1390
- const newValue = currentValue.substring(0, startPos) +
1391
- pastedText +
1392
- currentValue.substring(endPos);
1390
+ const newValue = currentValue.substring(0, startPos) + pastedText + currentValue.substring(endPos);
1393
1391
  // Update the textarea value
1394
1392
  textarea.value = newValue;
1395
1393
  // Set cursor position after pasted text
@@ -1441,7 +1439,7 @@ const InputForm = class {
1441
1439
  this.searchInputElem.value = "";
1442
1440
  this.searchInput = "";
1443
1441
  const parent = this.el.querySelector(`#previewContainer-${this.instanceId}`);
1444
- const textarea = this.el.querySelector(`#searchInput-${this.instanceId}`);
1442
+ const textarea = this.el.querySelector(`#searchInput`);
1445
1443
  // textarea["style"].height = "20px"
1446
1444
  textarea["style"].overflow = "hidden";
1447
1445
  if (parent) {
@@ -1513,24 +1511,26 @@ const InputForm = class {
1513
1511
  // this.icon_width = url.searchParams.get("w") || "28"
1514
1512
  // this.icon_height = url.searchParams.get("h") || "28"
1515
1513
  // }
1516
- return (h("div", { key: 'b1155ed7be07bc37ed7d82e5ff0794755ee87df7' }, h("div", { key: '699dcb02be29a8d198c6214a6b6357366866451d', class: `absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10
1517
- ${this.isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-90 pointer-events-none"}`, ref: el => (this.menuElem = el) }, h("ul", { key: '5b1046ba8e2f9577219a70d2c1e1d5780720a9e4', class: "space-y-2" }, this.isImageUpload && (h("li", { key: '7fe5378ef380fed221f2d12e9aad0168e75e685d', class: "px-4 py-2 hover:bg-gray-100 cursor-pointer flex" }, h("image-uploader", { key: '2bbeb4f870cda60e5d33110010de398956185349', maxImages: 10, images: this.imagesBase64List, targetElement: this.searchInputElem, onImagesChange: this.handleImageChange, onError: this.handleImageError, ref: el => (this.imageUploaderRef = el) }))), h("li", { key: '5cdfe32e0a4400a26a41e91fd6292addfb70fa73', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", onClick: e => {
1514
+ return (h("div", { key: 'b710879654820db9210ccfb4aa92e0a25708d16d' }, h("div", { key: '5408dbbfe45b661d58d5bf1037ab524c1156c4ec', class: `absolute left-0 w-48 bg-white rounded-lg shadow-lg transition-all duration-300 ease-in-out z-10
1515
+ ${this.isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-90 pointer-events-none"}`, ref: el => (this.menuElem = el) }, h("ul", { key: '103ee1e4974be113c7666d89fc855b5bb768a85a', class: "space-y-2" }, this.isImageUpload && (h("li", { key: '745574831938ae6f62813979cd67f622eac7abed', class: "px-4 py-2 hover:bg-gray-100 cursor-pointer flex" }, h("image-uploader", { key: '3e2c64281909b59980b76a05a70de05422fcbc88', maxImages: 10, images: this.imagesBase64List, targetElement: this.searchInputElem, onImagesChange: this.handleImageChange, onError: this.handleImageError, ref: el => (this.imageUploaderRef = el) }))), h("li", { key: '1785965c16e263e38df187f1cb56843ce61db27a', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", onClick: e => {
1518
1516
  this.captureScreen();
1519
1517
  this.toggleBox(e);
1520
- } }, h("div", { key: 'e2c70c710cc49a633772136dda494bedbceb65ba', class: "mr-1 mt-px" }, h("svg", { key: 'f2c18b6e31224d169538f3217390f385427d7cef', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" }, h("path", { key: '5e8c0e43d70670b0d0cbf9b67e5ef3bc8b5c2c46', d: "M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" }), h("path", { key: '192a6e2333f615a81e86279b398fc9f02f1fd682', "fill-rule": "evenodd", d: "M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z", "clip-rule": "evenodd" }))), h("div", { key: '9006b1196c73d557ea7fbd2e8bcea41471bde5c6' }, "Capture")), h("li", { key: 'aa039a37b2bf21ef8ba3d8503ece555718e13451', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", "aria-label": "Start Over", "aria-disabled": this.chatLength === 0, style: { opacity: this.chatLength === 0 ? "0.5" : "1", cursor: this.chatLength === 0 ? "not-allowed" : "pointer" }, onClick: e => {
1518
+ } }, h("div", { key: 'b7905767addc89069e6c1daf77c3dca2e71dfc80', class: "mr-1 mt-px" }, h("svg", { key: 'f11079ae7e023a86e47619946c95841b3f058821', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20" }, h("path", { key: '22a53f62a4103da03dcc11fcecc85eb6ca60291c', d: "M12 9a3.75 3.75 0 1 0 0 7.5A3.75 3.75 0 0 0 12 9Z" }), h("path", { key: '652fcc2b453519aff9fb590bad21758de9a906cc', "fill-rule": "evenodd", d: "M9.344 3.071a49.52 49.52 0 0 1 5.312 0c.967.052 1.83.585 2.332 1.39l.821 1.317c.24.383.645.643 1.11.71.386.054.77.113 1.152.177 1.432.239 2.429 1.493 2.429 2.909V18a3 3 0 0 1-3 3h-15a3 3 0 0 1-3-3V9.574c0-1.416.997-2.67 2.429-2.909.382-.064.766-.123 1.151-.178a1.56 1.56 0 0 0 1.11-.71l.822-1.315a2.942 2.942 0 0 1 2.332-1.39ZM6.75 12.75a5.25 5.25 0 1 1 10.5 0 5.25 5.25 0 0 1-10.5 0Zm12-1.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z", "clip-rule": "evenodd" }))), h("div", { key: '4488809bd3daf7ee12d280082a600372d7e4c3f9' }, "Capture")), h("li", { key: 'ab6fc198b0eb81c6b636e522ca1baeb0a462ed3d', class: "px-4 pb-2 hover:bg-gray-100 cursor-pointer flex", "aria-label": "Start Over", "aria-disabled": this.chatLength === 0, style: { opacity: this.chatLength === 0 ? "0.5" : "1", cursor: this.chatLength === 0 ? "not-allowed" : "pointer" }, onClick: e => {
1521
1519
  if (this.chatLength === 0)
1522
1520
  return;
1523
1521
  // const escapeEvent = new KeyboardEvent("keydown", { key: "Escape" })
1524
1522
  // document.dispatchEvent(escapeEvent)
1525
1523
  this.handleFollowUp(e);
1526
1524
  this.toggleBox(e);
1527
- } }, h("div", { key: '93451694e540b98fe74065d64ee95a665e80a184', class: "mr-1 mt-px" }, h("svg", { key: 'a0def4179e1a83d5191b21520d4751b2417d7505', width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { key: 'af2982fc8683e3a09c06dc86c002ad40cb3666b4', d: "M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" }))), h("div", { key: 'ab8e444179e22d967a4eb0ae18d74634a84de1f0' }, "Start Over")))), h("form", { key: '3a4c4af317bd498e47e37e516a0edabf4917548e', class: "w-full flex flex-col gap-1.5 sticky", onSubmit: this.handleFormSubmit }, h("div", { key: '0f35e9c78b7c53b94b13bef5f35c11a470499587', class: `flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === "inline" ? "inline-searchbar-bgcolor" : "searchbar-bgcolor"}`, dir: "LTR", ref: el => (this.searchFormElem = el) }, h("div", { key: 'f26b4fa9f8af9259925ca10bf35c82cafab8a4fa', class: "flex items-center" }, h("div", { key: 'e7743757529af70ef83aaa5aa3668d7e7d84803b', class: "ml-1 self-center flex space-x-1" }, !this.hideAllButtons && (h("div", { key: '7a8326a613ad37227cc513c2e8a2fe56d11448a5', class: "relative inline-block", style: { width: "5%" } }, h("button", { key: '3e0b94d342159169713ec491e4e6efc6b593bd4b', class: "plus-icon", "aria-label": "Options", title: "Add images or capture screen", tabindex: "0", onClick: e => {
1525
+ } }, h("div", { key: '61a542eaa45f949112ed87f6ed4058adfad60dc6', class: "mr-1 mt-px" }, h("svg", { key: '3cf1f6ece6bd36b8305a7f90d8ff57c022fd70f1', width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { key: '15c8bf2a524ce56257c8e4bc7027acf6be91b351', d: "M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2" }))), h("div", { key: '3e4c57aa7a21a3c3bd85331476c228580108e7cd' }, "Start Over")))), h("form", { key: 'be70c5e66fbecf1e6ff1e90e58a6eabe0e6a3426', class: "w-full flex flex-col gap-1.5 sticky", onSubmit: this.handleFormSubmit }, h("div", { key: '1efa7de82d5b3e16515b83a80e55f915fd3a71d2', class: `flex-1 flex flex-col relative w-full rounded-3xl px-1 ${this.componentType === "inline" ? "inline-searchbar-bgcolor" : "searchbar-bgcolor"}`, dir: "LTR", ref: el => (this.searchFormElem = el) }, h("div", { key: '08a343d3ce8fc31178bda7a73fabf398f08af140', class: "flex items-center" }, h("div", { key: 'c66ae93e9bc039d5e62e320ed971630ac12d1f96', class: "ml-1 self-center flex space-x-1" }, !this.hideAllButtons && (h("div", { key: 'bbf4e37acf4806835973a57574461ea1e173b015', class: "relative inline-block", style: { width: "5%" } }, h("button", { key: '0e827515ad96fb518b6da91b7512ac24d7fd2c69', class: "plus-icon", "aria-label": "Options", title: "Add images or capture screen", tabindex: "0", onClick: e => {
1528
1526
  e.stopPropagation();
1529
1527
  this.toggleBox(e);
1530
- } }, h("svg", { key: '83b375c4b365403e23b43118926a665dbf5e3696', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", width: "20", height: "20" }, h("path", { key: 'c8d8f896723940c3122c2933d76ae2880d798299', d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" })))))), !this.hideAllButtons && (h("div", { key: 'd2c57f7f8218e3cc9dc08ca58a2a97e4073b24dd', class: "scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto" }, h("div", { key: 'bdf6d3aae6e8745b30e202d080063e37301715bc', class: "relative w-full min-w-full h-full min-h-fit flex items-center input-prose" }, h("div", { key: 'bfb4f9fa6ea9686e241390e4155b8a72c988d886', id: `previewContainer-${this.instanceId}`, draggable: true }), h("label", { key: '940eaee0a0b6442acb6f5f4bf45785225f8110df', htmlFor: `searchInput-${this.instanceId}`, class: "sr-only" }, "Your message"), h("textarea", { key: 'ec1726fece852a18b0c587e3014826119ed0a432', readOnly: this.submitted, "aria-describedby": this.emptyMessageError ? `message-error-${this.instanceId} search-hint-${this.instanceId}` : `search-hint-${this.instanceId}`, "aria-invalid": this.emptyMessageError, id: `searchInput-${this.instanceId}`, ref: el => {
1528
+ } }, h("svg", { key: 'e69dc435f4ddddbf819a12397e6d2ea887511688', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", width: "20", height: "20" }, h("path", { key: '3360f8d395d1fd97dcbfa4b91a8a9058de979a25', d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" })))))), !this.hideAllButtons && (h("div", { key: 'b9899911414806239ec816e3e685fdb3032d6d55', class: "scrollbar-hidden text-left bg-transparent dark:text-gray-100 outline-none w-full rounded-xl resize-none h-fit max-h-80 overflow-auto" }, h("div", { key: '9a133e7e3864cf3b8ae9d0dd9e67bdfeebce20ca', class: "relative w-full min-w-full h-full min-h-fit flex items-center input-prose" }, h("div", { key: 'c565c410c5bae7422d15f4fd100382a09337fbc5', id: `previewContainer-${this.instanceId}`, draggable: true }), h("label", { key: '86f1910908282edf08ee380a7496673587de09c0', htmlFor: `searchInput`, class: "sr-only" }, "Your message"), h("textarea", { key: '3ae4d8685868f5c370da21d7172bffc1a0df29fc', readOnly: this.submitted, "aria-describedby": this.emptyMessageError ? `message-error-${this.instanceId} search-hint-${this.instanceId}` : `search-hint-${this.instanceId}`, "aria-invalid": this.emptyMessageError, id: `searchInput`, ref: el => {
1531
1529
  this.searchInputElem = el;
1532
1530
  el === null || el === void 0 ? void 0 : el.focus();
1533
- }, placeholder: this.placeholder, autoComplete: "off", class: "w-full p-1 custom-input", value: this.searchInput, rows: 1, onInput: debounce(e => this.handleInputChange(e), 500), onKeyUp: this.adjustHeight, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFormElem.classList.add("input-focus-color"), onBlur: () => this.searchFormElem.classList.remove("input-focus-color"), onPaste: e => { this.handlePaste(e); } }), h("div", { key: 'f0f013b50358ca723f000638ffa3e871ffc29676', role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage), h("span", { key: 'd46a067358a4e29dc2394e77379477183517aab4', class: "sr-only" }, "Press Enter to send, Shift+Enter for new line")))), h("div", { key: '4be8b4caab57017d0303a559b1ea39591afff8d6', class: "p-1 self-end flex space-x-1 flex-row", style: { width: this.hideAllButtons ? "100%" : "auto" } }, h("div", { key: '563937271b8a14ee06c9d66e86ab64622e097737', "aria-label": "Record voice", class: "flex self-center", style: { width: this.hideAllButtons ? "100%" : "auto" } }, this.isEnableMic && (h("audio-recorder", { key: 'e1111daea1138728f842bf44fad27f77f7d61189', "component-type": "search", onStartRecord: _ev => {
1531
+ }, placeholder: this.placeholder, autoComplete: "off", class: "w-full p-1 custom-input", value: this.searchInput, rows: 1, onInput: debounce(e => this.handleInputChange(e), 500), onKeyUp: this.adjustHeight, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFormElem.classList.add("input-focus-color"), onBlur: () => this.searchFormElem.classList.remove("input-focus-color"), onPaste: e => {
1532
+ this.handlePaste(e);
1533
+ } }), h("div", { key: '49137e2305050c43e33b1fc6700f3730a1cf2065', role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage), h("span", { key: '0d6a47354a45ad61751dccce4590e1ba9a86f56d', class: "sr-only" }, "Press Enter to send, Shift+Enter for new line")))), h("div", { key: '179faa1a351580def49054d6d2caa45724ef9b8f', class: "p-1 self-end flex space-x-1 flex-row", style: { width: this.hideAllButtons ? "100%" : "auto" } }, h("div", { key: '7605ed2f215e037f303cd7e30d51b6c51923ee52', "aria-label": "Record voice", class: "flex self-center", style: { width: this.hideAllButtons ? "100%" : "auto" } }, this.isEnableMic && (h("audio-recorder", { key: 'e2572b44c68406cfb14cc2e8439a7671db70d2a4', "component-type": "search", onStartRecord: _ev => {
1534
1534
  // console.log("test", ev)
1535
1535
  this.hideAllButtons = true;
1536
1536
  }, onStopRecord: _ev => {
@@ -1548,14 +1548,14 @@ const InputForm = class {
1548
1548
  });
1549
1549
  }
1550
1550
  }, 1000);
1551
- }, style: { width: "100%" } }))), " ", !this.hideAllButtons && (h("div", { key: '6b7317a4fcd1bb32ee01bbf13d23059b940c2f6d', class: "flex items-center" }, h("div", { key: '954e1ee9fe1dcab05c88e7c393a3c1c01f22d408', "aria-label": "Send message", class: "flex" }, h("button", { key: 'c2411103d0ce2b549f8f3c7d6bba3326b2433470', id: `send-message-button-${this.instanceId}`, class: "btn-bg-color text-white transition rounded-full p-1.5 self-center",
1551
+ }, style: { width: "100%" } }))), " ", !this.hideAllButtons && (h("div", { key: '521ca3e7338c0f2de60d80cdc88c625a8324937f', class: "flex items-center" }, h("div", { key: '641b5a7a59d73e730222cfb19607528403ba46e2', "aria-label": "Send message", class: "flex" }, h("button", { key: 'cbd9fe575d330dfc3f354bb822aeeb6f0d50c548', id: `send-message-button`, class: "btn-bg-color text-white transition rounded-full p-1.5 self-center",
1552
1552
  // type="submit"
1553
- disabled: this.submitted, onClick: this.handleAskAI, tabindex: "0", "aria-label": "Send Message", title: "Send Message" }, h("svg", { key: 'abb05f96ead0e5a0b7fd434796be4747ef60adc9', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", class: "size-6" }, h("path", { key: 'd0da6f95cc784c3d7942e17b1f0cbe10720f5ed9', "fill-rule": "evenodd", d: "M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z", "clip-rule": "evenodd" })))))))), this.imagesBase64List.length > 0 && (h("div", { key: '75443f523a389807d2dc8c6593b389e4b9af6a0d', class: "flex flex-wrap gap-2 mx-1 mt-2.5 mb-1" }, this.imagesBase64List.map((img, idx) => (h("div", { class: "image-Container sc-ai12z-input-form", key: idx }, h("img", { src: img, style: { width: "70px", height: "50px", borderRadius: ".75rem" } }), h("span", { class: "delete-image sc-ai12z-input-form cursor-pointer ml-1", onClick: () => {
1553
+ disabled: this.submitted, onClick: this.handleAskAI, tabindex: "0", "aria-label": "Send Message", title: "Send Message" }, h("svg", { key: '61a236c095bee03e42f2ef4f8f54cb4cb203e7ee', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", class: "size-6" }, h("path", { key: 'b3c128071d733511d186b5514b44e567bc273f79', "fill-rule": "evenodd", d: "M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z", "clip-rule": "evenodd" })))))))), this.imagesBase64List.length > 0 && (h("div", { key: '53a1f7b0e27f49b7770eacfdcb3e0f395a2d2207', class: "flex flex-wrap gap-2 mx-1 mt-2.5 mb-1" }, this.imagesBase64List.map((img, idx) => (h("div", { class: "image-Container sc-ai12z-input-form", key: idx }, h("img", { src: img, style: { width: "70px", height: "50px", borderRadius: ".75rem" } }), h("span", { class: "delete-image sc-ai12z-input-form cursor-pointer ml-1", onClick: () => {
1554
1554
  this.imagesBase64List = this.imagesBase64List.filter((_, i) => i !== idx);
1555
1555
  if (this.imageUploaderRef && typeof this.imageUploaderRef.removeImageAtIndex === "function") {
1556
1556
  this.imageUploaderRef.removeImageAtIndex(idx);
1557
1557
  }
1558
- } }, "\u00D7"))))))), this.showErrorMessage && h("div", { key: '007f59936797ea8874e528014d2333b43b596d49', class: "flex" }, " ", h("p", { key: '2e27c3504c2159718de56fac5145daa0faa6d352', class: "error-msg", innerHTML: this.errorMessage })), this.emptyMessageError && (h("div", { key: '2e03556796263aeb789dc155e26272d145552f29', class: "flex" }, h("p", { key: '271eb26b045b203e67179e895f7be336f0fc6ddc', id: `message-error-${this.instanceId}`, class: "error-msg", role: "alert" }, "Message cannot be empty. Please enter a message to send."))), this.chatLength === 0 && (h("div", { key: '9ef1322c2bd10b52c9ee1d733da086a0d513c4f4', class: "enter-tip", role: "tooltip" }, "Tip: Press Enter to send, Shift+Enter for new line")))));
1558
+ } }, "\u00D7"))))))), this.showErrorMessage && (h("div", { key: '68835fe3309ee7c3856fe6eca76e5fc98c0efc41', class: "flex" }, " ", h("p", { key: '98f397793822e1cdaefedd76acc41b3df2c65bfd', class: "error-msg", innerHTML: this.errorMessage }))), this.emptyMessageError && (h("div", { key: '57bf882093f456cbb39b3c3846897f5ba8138f9b', class: "flex" }, h("p", { key: '7d2c00863e48982725c76c4d6899f35c1fb8e007', id: `message-error-${this.instanceId}`, class: "error-msg", role: "alert" }, "Message cannot be empty. Please enter a message to send."))), this.chatLength === 0 && (h("div", { key: '730feded06081d0148a0937e158fc5ee35b080e0', class: "enter-tip", role: "tooltip" }, "Tip: Press Enter to send, Shift+Enter for new line")))));
1559
1559
  }
1560
1560
  get el() { return getElement(this); }
1561
1561
  };