@luzmo/analytics-components-kit 1.0.1-alpha.142 → 1.0.1-alpha.144
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/angular/esm/types/ai-chat.types.d.ts +1 -0
- package/angular/types/ai-chat.types.ts +1 -0
- package/components/ai-chat/ai-chat.d.ts +8 -1
- package/components/ai-chat/index.cjs +1 -1
- package/components/ai-chat/index.js +7 -7
- package/components/{ai-chat-DlUYd_Cf.js → ai-chat-CEX2VQeq.js} +115 -82
- package/components/ai-chat-PZrWiUxE.cjs +90 -0
- package/components/ai-interaction-textarea/index.cjs +1 -1
- package/components/ai-interaction-textarea/index.js +5 -5
- package/components/{ai-interaction-textarea-BGnQbDpJ.cjs → ai-interaction-textarea-CcgFeoIg.cjs} +4 -4
- package/components/data-fields-select/index.cjs +1 -1
- package/components/data-fields-select/index.js +3 -3
- package/components/{data-fields-select-DOFNOn2D.cjs → data-fields-select-Byfdph5v.cjs} +3 -3
- package/components/{data-fields-select-0-QPdj3X.js → data-fields-select-dbn1KG3y.js} +2 -2
- package/components/dataset-icon/index.cjs +1 -1
- package/components/dataset-icon/index.js +1 -1
- package/components/{dataset-icon-BbNgugDA.cjs → dataset-icon-C0cID-ra.cjs} +11 -11
- package/components/{dataset-icon-x6Q8nhYc.js → dataset-icon-DhF21dXC.js} +6 -6
- package/components/dataset-selector-list/index.cjs +1 -1
- package/components/dataset-selector-list/index.js +3 -3
- package/components/{dataset-selector-list-DO_ExOrO.js → dataset-selector-list-BDSXGUDh.js} +1 -1
- package/components/{dataset-selector-list-BdeJlo0u.cjs → dataset-selector-list-CH3lwAjJ.cjs} +1 -1
- package/components/dataset-selector-row/index.cjs +1 -1
- package/components/dataset-selector-row/index.js +4 -4
- package/components/{dataset-selector-row-VsvdrVDf.js → dataset-selector-row-DPyGMP__.js} +2 -2
- package/components/{dataset-selector-row-CAlRVIk_.cjs → dataset-selector-row-DdTnaQ6w.cjs} +9 -9
- package/components/{de-DEzbbWVL.js → de-DOhCpte6.js} +5 -2
- package/components/de-DR0saUbU.cjs +20 -0
- package/components/display-settings/index.cjs +1 -1
- package/components/display-settings/index.js +3 -3
- package/components/{display-settings-BwRkE6i-.js → display-settings-C_ubOOoF.js} +14 -14
- package/components/{display-settings-rCBWD_I_.cjs → display-settings-Sh4LWJgN.cjs} +16 -16
- package/components/display-settings-binning/index.cjs +1 -1
- package/components/display-settings-binning/index.js +3 -3
- package/components/{display-settings-binning-C4V_P8mI.cjs → display-settings-binning-C9VF0K9q.cjs} +7 -7
- package/components/{display-settings-binning-BXlXiFNV.js → display-settings-binning-DP9oFC6h.js} +2 -2
- package/components/display-settings-datetime/index.cjs +1 -1
- package/components/display-settings-datetime/index.js +3 -3
- package/components/{display-settings-datetime-Db-0j9VZ.cjs → display-settings-datetime-C3LDVEcH.cjs} +38 -38
- package/components/{display-settings-datetime-LqM04khP.js → display-settings-datetime-DxBUXAuH.js} +2 -2
- package/components/display-settings-grand-totals/index.cjs +1 -1
- package/components/display-settings-grand-totals/index.js +3 -3
- package/components/{display-settings-grand-totals-BDDMVFrg.js → display-settings-grand-totals-BiGxXuw2.js} +2 -2
- package/components/{display-settings-grand-totals-0ihnPMfZ.cjs → display-settings-grand-totals-C3QlInwU.cjs} +5 -5
- package/components/display-settings-numeric/index.cjs +1 -1
- package/components/display-settings-numeric/index.js +3 -3
- package/components/{display-settings-numeric-Cpp9mQCA.js → display-settings-numeric-BvLDL-qP.js} +3 -3
- package/components/{display-settings-numeric-CfBT04A7.cjs → display-settings-numeric-CyoTJKZv.cjs} +28 -28
- package/components/display-settings-period-over-period/index.cjs +1 -1
- package/components/display-settings-period-over-period/index.js +3 -3
- package/components/{display-settings-period-over-period-CWOpgJmd.cjs → display-settings-period-over-period-Cdmaf_Rw.cjs} +1 -1
- package/components/{display-settings-period-over-period-pxCijPAW.js → display-settings-period-over-period-CvvgRCVH.js} +1 -1
- package/components/draggable-data-field/index.cjs +1 -1
- package/components/draggable-data-field/index.js +4 -4
- package/components/{draggable-data-field-C6ojUWMf.js → draggable-data-field-C_zHA_mn.js} +1 -1
- package/components/{draggable-data-field-BsvgQjQY.cjs → draggable-data-field-CbF7N-o7.cjs} +1 -1
- package/components/draggable-data-field-level/index.cjs +1 -1
- package/components/draggable-data-field-level/index.js +3 -3
- package/components/{draggable-data-field-level-CJ-vup34.cjs → draggable-data-field-level-CI1No5x8.cjs} +10 -10
- package/components/draggable-data-fields-panel/index.cjs +1 -1
- package/components/draggable-data-fields-panel/index.js +5 -5
- package/components/{draggable-data-fields-panel-DJPz42xa.js → draggable-data-fields-panel-D7oa6gGZ.js} +1 -1
- package/components/{draggable-data-fields-panel-oNEzkow0.cjs → draggable-data-fields-panel-DOdI9NaC.cjs} +1 -1
- package/components/droppable-slot/index.cjs +1 -1
- package/components/droppable-slot/index.js +6 -6
- package/components/{droppable-slot-C8rhDVI-.cjs → droppable-slot-DtFdADiO.cjs} +10 -10
- package/components/{droppable-slot-DEpOqyps.js → droppable-slot-oB61SQKO.js} +4 -4
- package/components/edit-filters/index.cjs +1 -1
- package/components/edit-filters/index.js +10 -10
- package/components/{edit-filters-D2oZa0E_.js → edit-filters-B29YfSBe.js} +12 -21
- package/components/{edit-filters-pq1q7Eff.cjs → edit-filters-geWHEBCw.cjs} +23 -33
- package/components/edit-item/index.cjs +1 -1
- package/components/edit-item/index.js +2 -2
- package/components/edit-option/index.cjs +1 -1
- package/components/edit-option/index.js +2 -2
- package/components/edit-option-action-button-group/index.cjs +1 -1
- package/components/edit-option-action-button-group/index.js +3 -3
- package/components/{edit-option-action-button-group-DlJwTW3A.cjs → edit-option-action-button-group-W34osCsN.cjs} +5 -5
- package/components/edit-option-color-palette-picker/index.cjs +1 -1
- package/components/edit-option-color-palette-picker/index.js +2 -2
- package/components/edit-option-color-picker/index.cjs +1 -1
- package/components/edit-option-color-picker/index.js +2 -2
- package/components/edit-option-color-range/index.cjs +1 -1
- package/components/edit-option-color-range/index.js +3 -3
- package/components/{edit-option-color-range-BtahxHzd.js → edit-option-color-range-CmpvQTSG.js} +3 -3
- package/components/{edit-option-color-range-DhBp5wlk.cjs → edit-option-color-range-DVYMhG2R.cjs} +15 -15
- package/components/edit-option-multi-language-field/index.cjs +1 -1
- package/components/edit-option-multi-language-field/index.js +2 -2
- package/components/edit-option-number-field/index.cjs +1 -1
- package/components/edit-option-number-field/index.js +2 -2
- package/components/edit-option-picker/index.cjs +1 -1
- package/components/edit-option-picker/index.js +2 -2
- package/components/edit-option-position-picker/index.cjs +1 -1
- package/components/edit-option-position-picker/index.js +2 -2
- package/components/edit-option-positions-number-field/index.cjs +1 -1
- package/components/edit-option-positions-number-field/index.js +3 -3
- package/components/{edit-option-positions-number-field-DhnxicFl.cjs → edit-option-positions-number-field-CmK8_2ZQ.cjs} +8 -8
- package/components/edit-option-radio-button-group/index.cjs +1 -1
- package/components/edit-option-radio-button-group/index.js +2 -2
- package/components/edit-option-slider/index.cjs +1 -1
- package/components/edit-option-slider/index.js +2 -2
- package/components/edit-option-switch/index.cjs +1 -1
- package/components/edit-option-switch/index.js +2 -2
- package/components/edit-option-text-field/index.cjs +1 -1
- package/components/edit-option-text-field/index.js +2 -2
- package/components/es-CNpZK6tJ.cjs +20 -0
- package/components/{es-DIIjhY-_.js → es-cTUhzLmn.js} +5 -2
- package/components/filter-expression-picker/index.cjs +1 -1
- package/components/filter-expression-picker/index.js +3 -3
- package/components/{filter-expression-picker-BKJXpOiw.js → filter-expression-picker-D83ya_dt.js} +1 -1
- package/components/{filter-expression-picker-Jcv2KTB6.cjs → filter-expression-picker-wOcgU2No.cjs} +1 -1
- package/components/filter-item/index.cjs +1 -1
- package/components/filter-item/index.js +9 -9
- package/components/{filter-item-RaC0VdlI.js → filter-item-BdnrbMUW.js} +2 -2
- package/components/{filter-item-Bqhpikdf.cjs → filter-item-ByKzQ-fl.cjs} +1 -1
- package/components/filter-value-picker/index.cjs +1 -1
- package/components/filter-value-picker/index.js +6 -6
- package/components/{filter-value-picker-C92yj41B.js → filter-value-picker-B2BjJuIa.js} +1 -1
- package/components/{filter-value-picker-49_ZrLE2.cjs → filter-value-picker-Co9Vka2J.cjs} +1 -1
- package/components/filter-value-picker-datetime/index.cjs +1 -1
- package/components/filter-value-picker-datetime/index.js +3 -3
- package/components/{filter-value-picker-datetime-CwrpeAdQ.js → filter-value-picker-datetime-BOheBbvB.js} +1 -1
- package/components/{filter-value-picker-datetime-f3T5FuxN.cjs → filter-value-picker-datetime-BzMfKPkZ.cjs} +1 -1
- package/components/filter-value-picker-hierarchy/index.cjs +1 -1
- package/components/filter-value-picker-hierarchy/index.js +3 -3
- package/components/{filter-value-picker-hierarchy-BjWbzo8J.js → filter-value-picker-hierarchy-Cwq8GLp4.js} +1 -1
- package/components/{filter-value-picker-hierarchy-D6FbH0gw.cjs → filter-value-picker-hierarchy-Dgdj-xqx.cjs} +1 -1
- package/components/filter-value-picker-numeric/index.cjs +1 -1
- package/components/filter-value-picker-numeric/index.js +3 -3
- package/components/{filter-value-picker-numeric-F1XJRVFa.js → filter-value-picker-numeric-CHFRRe1f.js} +1 -1
- package/components/{filter-value-picker-numeric-BCfpod5c.cjs → filter-value-picker-numeric-CZrRBHuR.cjs} +1 -1
- package/components/fr-DKJHfJgy.cjs +20 -0
- package/components/{fr-D9ILwOuz.js → fr-x3aFvlKk.js} +5 -2
- package/components/grid/index.cjs +1 -1
- package/components/grid/index.js +3 -3
- package/components/{grid-BNbbl-9p.cjs → grid-BxeX-SG-.cjs} +31 -31
- package/components/{grid-Ca-fxUK1.js → grid-CfCH13sk.js} +20 -20
- package/components/index.cjs +1 -1
- package/components/index.js +35 -35
- package/components/item-data-drop-panel/index.cjs +1 -1
- package/components/item-data-drop-panel/index.js +7 -7
- package/components/{item-data-drop-panel-BMubV7pj.js → item-data-drop-panel-BNf_N7GH.js} +1 -1
- package/components/{item-data-drop-panel-Bt8rKT6s.cjs → item-data-drop-panel-Dcj5Gz29.cjs} +1 -1
- package/components/item-data-picker-panel/index.cjs +1 -1
- package/components/item-data-picker-panel/index.js +8 -8
- package/components/{item-data-picker-panel-DZOIUxuS.cjs → item-data-picker-panel-GD6CRais.cjs} +1 -1
- package/components/{item-data-picker-panel-DBK2fVsG.js → item-data-picker-panel-OK_nMbm4.js} +1 -1
- package/components/{localized-mixin-DTvVLuXW.cjs → localized-mixin-BmZhC9XV.cjs} +1 -1
- package/components/{localized-mixin-cLT0UbaF.js → localized-mixin-CgQFYGOU.js} +1 -1
- package/components/{nl-DhD5Rlf7.js → nl-Cv7QXh6s.js} +5 -2
- package/components/nl-DtxDWOXH.cjs +20 -0
- package/components/{set-locale-Uv6F4uSq.js → set-locale-CRNDDu2d.js} +4 -4
- package/components/{set-locale-CKjJZRH6.cjs → set-locale-DjOkyNGu.cjs} +1 -1
- package/components/slot-contents-picker/index.cjs +1 -1
- package/components/slot-contents-picker/index.js +7 -7
- package/components/{slot-contents-picker-Bw_G1BwZ.js → slot-contents-picker-BNWBIypw.js} +4 -4
- package/components/{slot-contents-picker-BO5lSTDz.cjs → slot-contents-picker-BjqOUNKU.cjs} +21 -21
- package/components/slot-menu/index.cjs +1 -1
- package/components/slot-menu/index.js +5 -5
- package/components/{slot-menu-DxYruISb.js → slot-menu-B3L8YEnv.js} +2 -2
- package/components/{slot-menu-DyC8HQ5E.cjs → slot-menu-DIQ6h6Dz.cjs} +9 -9
- package/components/slot-menu-list/index.cjs +1 -1
- package/components/slot-menu-list/index.js +3 -3
- package/components/{slot-menu-list-Dmb6s6UK.cjs → slot-menu-list-CFCvrPVt.cjs} +3 -3
- package/components/utils/base.cjs +1 -1
- package/components/utils/base.js +2 -2
- package/components/utils.cjs +1 -1
- package/components/utils.js +1 -1
- package/components/viz-item-menu/index.cjs +1 -1
- package/components/viz-item-menu/index.js +3 -3
- package/components/{viz-item-menu-D18d77aP.cjs → viz-item-menu-BNgd025g.cjs} +6 -6
- package/components/{viz-item-menu-CjA1X_Vg.js → viz-item-menu-_DLQJFWj.js} +2 -2
- package/custom-elements.json +19 -0
- package/package.json +1 -1
- package/types/ai-chat.types.d.ts +1 -0
- package/components/ai-chat-rok8ar11.cjs +0 -62
- package/components/de-nxCdeqFz.cjs +0 -20
- package/components/es-BEBp9Wdb.cjs +0 -20
- package/components/fr-BSmOmsww.cjs +0 -20
- package/components/nl-BiQ2EuE6.cjs +0 -20
- package/components/{ai-interaction-textarea-EdWcPK0w.js → ai-interaction-textarea-B5UE7CIq.js} +1 -1
- package/components/{draggable-data-field-level-BTUXWyDq.js → draggable-data-field-level-BQBMnApS.js} +1 -1
- package/components/{edit-option-action-button-group-CnsDFlK_.js → edit-option-action-button-group-DNrXatQR.js} +1 -1
- package/components/{edit-option-positions-number-field-BX1zqHcV.js → edit-option-positions-number-field-DZtxuvEY.js} +1 -1
- package/components/{slot-menu-list-DbZnXcMZ.js → slot-menu-list-BLJxoLeI.js} +1 -1
|
@@ -90,6 +90,11 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
90
90
|
* @default '0.1.0'
|
|
91
91
|
*/
|
|
92
92
|
apiVersion: string;
|
|
93
|
+
/**
|
|
94
|
+
* Loading message
|
|
95
|
+
* @default null
|
|
96
|
+
*/
|
|
97
|
+
loadingMessage: string | null;
|
|
93
98
|
private _isGeneratingInternal;
|
|
94
99
|
private _textareaValue;
|
|
95
100
|
private _generateMessageId;
|
|
@@ -101,12 +106,12 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
101
106
|
private _handleErrorResponse;
|
|
102
107
|
private _processAIResponse;
|
|
103
108
|
private _handleAPIError;
|
|
104
|
-
private _finalizeAIResponse;
|
|
105
109
|
private _handleDatasetSelected;
|
|
106
110
|
private _handleDatasetRemoved;
|
|
107
111
|
private _emitDatasetsChanged;
|
|
108
112
|
private _handlePromptSubmitted;
|
|
109
113
|
private _scrollToBottom;
|
|
114
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
110
115
|
/**
|
|
111
116
|
* Sanitizes HTML content to prevent XSS attacks while preserving safe formatting
|
|
112
117
|
* @param htmlContent - The HTML string to sanitize
|
|
@@ -114,5 +119,7 @@ export declare class LuzmoAiChat extends LuzmoElement {
|
|
|
114
119
|
*/
|
|
115
120
|
private _sanitizeMessage;
|
|
116
121
|
private _renderMessages;
|
|
122
|
+
private _renderLoadingMessage;
|
|
123
|
+
private _renderPlaceholderMessage;
|
|
117
124
|
protected render(): TemplateResult;
|
|
118
125
|
}
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
18
|
* SOFTWARE.
|
|
19
19
|
* */
|
|
20
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../base-C_azywlB.cjs`),require(`../focus-visible-3ACCHno4.cjs`),require(`../set-locale-
|
|
20
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../base-C_azywlB.cjs`),require(`../focus-visible-3ACCHno4.cjs`),require(`../set-locale-DjOkyNGu.cjs`),require(`../localized-mixin-BmZhC9XV.cjs`);const e=require(`../ai-chat-PZrWiUxE.cjs`);require(`../dataset-icon-C0cID-ra.cjs`),require(`../data-broker-BUIUM5hr.cjs`),require(`../dataset-selector-list-CH3lwAjJ.cjs`),require(`../dataset-selector-row-DdTnaQ6w.cjs`),require(`../ai-interaction-textarea-CcgFeoIg.cjs`),exports.LuzmoAiChat=e.t,exports.buildAiMessageRequest=e.n;
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
})();
|
|
26
26
|
import "../base-rg2x95aL.js";
|
|
27
27
|
import "../focus-visible-D1pJhWEh.js";
|
|
28
|
-
import "../set-locale-
|
|
29
|
-
import "../localized-mixin-
|
|
30
|
-
import { n as buildAiMessageRequest, t as LuzmoAiChat } from "../ai-chat-
|
|
31
|
-
import "../dataset-icon-
|
|
28
|
+
import "../set-locale-CRNDDu2d.js";
|
|
29
|
+
import "../localized-mixin-CgQFYGOU.js";
|
|
30
|
+
import { n as buildAiMessageRequest, t as LuzmoAiChat } from "../ai-chat-CEX2VQeq.js";
|
|
31
|
+
import "../dataset-icon-DhF21dXC.js";
|
|
32
32
|
import "../data-broker-cLR-t5LM.js";
|
|
33
|
-
import "../dataset-selector-list-
|
|
34
|
-
import "../dataset-selector-row-
|
|
35
|
-
import "../ai-interaction-textarea-
|
|
33
|
+
import "../dataset-selector-list-BDSXGUDh.js";
|
|
34
|
+
import "../dataset-selector-row-DPyGMP__.js";
|
|
35
|
+
import "../ai-interaction-textarea-B5UE7CIq.js";
|
|
36
36
|
export { LuzmoAiChat, buildAiMessageRequest };
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* */
|
|
20
20
|
import { i as LuzmoElement } from "./base-rg2x95aL.js";
|
|
21
21
|
import { t as __decorate } from "./decorate-Da6S_xrw.js";
|
|
22
|
+
import { msg } from "@lit/localize/lit-localize";
|
|
23
|
+
import { luzmoIcon, luzmoSpin } from "@luzmo/icons";
|
|
22
24
|
import "@luzmo/lucero/chat-message";
|
|
23
25
|
import { html, unsafeCSS } from "lit";
|
|
24
26
|
import { property, state } from "lit/decorators.js";
|
|
@@ -215,7 +217,7 @@ var html$1 = freeze(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.a
|
|
|
215
217
|
function createDOMPurify() {
|
|
216
218
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(), t = (e) => createDOMPurify(e);
|
|
217
219
|
if (t.version = "3.3.1", t.removed = [], !e || !e.document || e.document.nodeType !== NODE_TYPE.document || !e.Element) return t.isSupported = !1, t;
|
|
218
|
-
let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node:
|
|
220
|
+
let { document: n } = e, r = n, i = r.currentScript, { DocumentFragment: a, HTMLTemplateElement: o, Node: s, Element: c, NodeFilter: l, NamedNodeMap: d = e.NamedNodeMap || e.MozNamedAttrMap, HTMLFormElement: Re, DOMParser: ze, trustedTypes: f } = e, p = c.prototype, Be = lookupGetter(p, "cloneNode"), Ve = lookupGetter(p, "remove"), He = lookupGetter(p, "nextSibling"), Ue = lookupGetter(p, "childNodes"), m = lookupGetter(p, "parentNode");
|
|
219
221
|
if (typeof o == "function") {
|
|
220
222
|
let e = n.createElement("template");
|
|
221
223
|
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
@@ -265,7 +267,7 @@ function createDOMPurify() {
|
|
|
265
267
|
enumerable: !0,
|
|
266
268
|
value: null
|
|
267
269
|
}
|
|
268
|
-
})), nt = !0, O = !0, rt = !1, it = !0, k = !1, A = !0, j = !1, M = !1, N = !1, P = !1, F = !1, I = !1, at = !0, ot = !1, L = !0, R = !1, z = {}, B = null,
|
|
270
|
+
})), nt = !0, O = !0, rt = !1, it = !0, k = !1, A = !0, j = !1, M = !1, N = !1, P = !1, F = !1, I = !1, at = !0, ot = !1, L = !0, R = !1, z = {}, B = null, V = addToSet({}, [
|
|
269
271
|
"annotation-xml",
|
|
270
272
|
"audio",
|
|
271
273
|
"colgroup",
|
|
@@ -291,14 +293,14 @@ function createDOMPurify() {
|
|
|
291
293
|
"title",
|
|
292
294
|
"video",
|
|
293
295
|
"xmp"
|
|
294
|
-
]),
|
|
296
|
+
]), st = null, ct = addToSet({}, [
|
|
295
297
|
"audio",
|
|
296
298
|
"video",
|
|
297
299
|
"img",
|
|
298
300
|
"source",
|
|
299
301
|
"image",
|
|
300
302
|
"track"
|
|
301
|
-
]),
|
|
303
|
+
]), lt = null, ut = addToSet({}, [
|
|
302
304
|
"alt",
|
|
303
305
|
"class",
|
|
304
306
|
"for",
|
|
@@ -313,28 +315,28 @@ function createDOMPurify() {
|
|
|
313
315
|
"value",
|
|
314
316
|
"style",
|
|
315
317
|
"xmlns"
|
|
316
|
-
]),
|
|
317
|
-
V,
|
|
318
|
+
]), H = "http://www.w3.org/1998/Math/MathML", U = "http://www.w3.org/2000/svg", W = "http://www.w3.org/1999/xhtml", G = W, dt = !1, ft = null, pt = addToSet({}, [
|
|
318
319
|
H,
|
|
319
|
-
U
|
|
320
|
-
|
|
320
|
+
U,
|
|
321
|
+
W
|
|
322
|
+
], stringToString), K = addToSet({}, [
|
|
321
323
|
"mi",
|
|
322
324
|
"mo",
|
|
323
325
|
"mn",
|
|
324
326
|
"ms",
|
|
325
327
|
"mtext"
|
|
326
|
-
]),
|
|
328
|
+
]), q = addToSet({}, ["annotation-xml"]), mt = addToSet({}, [
|
|
327
329
|
"title",
|
|
328
330
|
"style",
|
|
329
331
|
"font",
|
|
330
332
|
"a",
|
|
331
333
|
"script"
|
|
332
|
-
]),
|
|
334
|
+
]), J = null, ht = ["application/xhtml+xml", "text/html"], Y = null, X = null, gt = n.createElement("form"), _t = function(e) {
|
|
333
335
|
return e instanceof RegExp || e instanceof Function;
|
|
334
|
-
},
|
|
336
|
+
}, vt = function() {
|
|
335
337
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
336
|
-
if (!(
|
|
337
|
-
if ((!e || typeof e != "object") && (e = {}), e = clone(e),
|
|
338
|
+
if (!(X && X === e)) {
|
|
339
|
+
if ((!e || typeof e != "object") && (e = {}), e = clone(e), J = ht.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, Y = J === "application/xhtml+xml" ? stringToString : stringToLowerCase, S = objectHasOwnProperty(e, "ALLOWED_TAGS") ? addToSet({}, e.ALLOWED_TAGS, Y) : et, C = objectHasOwnProperty(e, "ALLOWED_ATTR") ? addToSet({}, e.ALLOWED_ATTR, Y) : tt, ft = objectHasOwnProperty(e, "ALLOWED_NAMESPACES") ? addToSet({}, e.ALLOWED_NAMESPACES, stringToString) : pt, lt = objectHasOwnProperty(e, "ADD_URI_SAFE_ATTR") ? addToSet(clone(ut), e.ADD_URI_SAFE_ATTR, Y) : ut, st = objectHasOwnProperty(e, "ADD_DATA_URI_TAGS") ? addToSet(clone(ct), e.ADD_DATA_URI_TAGS, Y) : ct, B = objectHasOwnProperty(e, "FORBID_CONTENTS") ? addToSet({}, e.FORBID_CONTENTS, Y) : V, T = objectHasOwnProperty(e, "FORBID_TAGS") ? addToSet({}, e.FORBID_TAGS, Y) : clone({}), E = objectHasOwnProperty(e, "FORBID_ATTR") ? addToSet({}, e.FORBID_ATTR, Y) : clone({}), z = objectHasOwnProperty(e, "USE_PROFILES") ? e.USE_PROFILES : !1, nt = e.ALLOW_ARIA_ATTR !== !1, O = e.ALLOW_DATA_ATTR !== !1, rt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, it = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, k = e.SAFE_FOR_TEMPLATES || !1, A = e.SAFE_FOR_XML !== !1, j = e.WHOLE_DOCUMENT || !1, P = e.RETURN_DOM || !1, F = e.RETURN_DOM_FRAGMENT || !1, I = e.RETURN_TRUSTED_TYPE || !1, N = e.FORCE_BODY || !1, at = e.SANITIZE_DOM !== !1, ot = e.SANITIZE_NAMED_PROPS || !1, L = e.KEEP_CONTENT !== !1, R = e.IN_PLACE || !1, $e = e.ALLOWED_URI_REGEXP || IS_ALLOWED_URI, G = e.NAMESPACE || W, K = e.MATHML_TEXT_INTEGRATION_POINTS || K, q = e.HTML_INTEGRATION_POINTS || q, w = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (w.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && _t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (w.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (w.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), k && (O = !1), F && (P = !0), z && (S = addToSet({}, text), C = [], z.html === !0 && (addToSet(S, html$1), addToSet(C, html$2)), z.svg === !0 && (addToSet(S, svg$1), addToSet(C, svg), addToSet(C, xml)), z.svgFilters === !0 && (addToSet(S, svgFilters), addToSet(C, svg), addToSet(C, xml)), z.mathMl === !0 && (addToSet(S, mathMl$1), addToSet(C, mathMl), addToSet(C, xml))), e.ADD_TAGS && (typeof e.ADD_TAGS == "function" ? D.tagCheck = e.ADD_TAGS : (S === et && (S = clone(S)), addToSet(S, e.ADD_TAGS, Y))), e.ADD_ATTR && (typeof e.ADD_ATTR == "function" ? D.attributeCheck = e.ADD_ATTR : (C === tt && (C = clone(C)), addToSet(C, e.ADD_ATTR, Y))), e.ADD_URI_SAFE_ATTR && addToSet(lt, e.ADD_URI_SAFE_ATTR, Y), e.FORBID_CONTENTS && (B === V && (B = clone(B)), addToSet(B, e.FORBID_CONTENTS, Y)), e.ADD_FORBID_CONTENTS && (B === V && (B = clone(B)), addToSet(B, e.ADD_FORBID_CONTENTS, Y)), L && (S["#text"] = !0), j && addToSet(S, [
|
|
338
340
|
"html",
|
|
339
341
|
"head",
|
|
340
342
|
"body"
|
|
@@ -343,28 +345,28 @@ function createDOMPurify() {
|
|
|
343
345
|
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
344
346
|
h = e.TRUSTED_TYPES_POLICY, g = h.createHTML("");
|
|
345
347
|
} else h === void 0 && (h = _createTrustedTypesPolicy(f, i)), h !== null && typeof g == "string" && (g = h.createHTML(""));
|
|
346
|
-
freeze && freeze(e),
|
|
348
|
+
freeze && freeze(e), X = e;
|
|
347
349
|
}
|
|
348
|
-
},
|
|
350
|
+
}, yt = addToSet({}, [
|
|
349
351
|
...svg$1,
|
|
350
352
|
...svgFilters,
|
|
351
353
|
...svgDisallowed
|
|
352
|
-
]),
|
|
354
|
+
]), bt = addToSet({}, [...mathMl$1, ...mathMlDisallowed]), xt = function(e) {
|
|
353
355
|
let t = m(e);
|
|
354
356
|
(!t || !t.tagName) && (t = {
|
|
355
|
-
namespaceURI:
|
|
357
|
+
namespaceURI: G,
|
|
356
358
|
tagName: "template"
|
|
357
359
|
});
|
|
358
360
|
let n = stringToLowerCase(e.tagName), r = stringToLowerCase(t.tagName);
|
|
359
|
-
return
|
|
360
|
-
},
|
|
361
|
+
return ft[e.namespaceURI] ? e.namespaceURI === U ? t.namespaceURI === W ? n === "svg" : t.namespaceURI === H ? n === "svg" && (r === "annotation-xml" || K[r]) : !!yt[n] : e.namespaceURI === H ? t.namespaceURI === W ? n === "math" : t.namespaceURI === U ? n === "math" && q[r] : !!bt[n] : e.namespaceURI === W ? t.namespaceURI === U && !q[r] || t.namespaceURI === H && !K[r] ? !1 : !bt[n] && (mt[n] || !yt[n]) : !!(J === "application/xhtml+xml" && ft[e.namespaceURI]) : !1;
|
|
362
|
+
}, Z = function(e) {
|
|
361
363
|
arrayPush(t.removed, { element: e });
|
|
362
364
|
try {
|
|
363
365
|
m(e).removeChild(e);
|
|
364
366
|
} catch {
|
|
365
367
|
Ve(e);
|
|
366
368
|
}
|
|
367
|
-
},
|
|
369
|
+
}, Q = function(e, n) {
|
|
368
370
|
try {
|
|
369
371
|
arrayPush(t.removed, {
|
|
370
372
|
attribute: n.getAttributeNode(e),
|
|
@@ -377,51 +379,51 @@ function createDOMPurify() {
|
|
|
377
379
|
});
|
|
378
380
|
}
|
|
379
381
|
if (n.removeAttribute(e), e === "is") if (P || F) try {
|
|
380
|
-
|
|
382
|
+
Z(n);
|
|
381
383
|
} catch {}
|
|
382
384
|
else try {
|
|
383
385
|
n.setAttribute(e, "");
|
|
384
386
|
} catch {}
|
|
385
|
-
},
|
|
387
|
+
}, St = function(e) {
|
|
386
388
|
let t = null, r = null;
|
|
387
389
|
if (N) e = "<remove></remove>" + e;
|
|
388
390
|
else {
|
|
389
391
|
let t = stringMatch(e, /^[\r\n\t ]+/);
|
|
390
392
|
r = t && t[0];
|
|
391
393
|
}
|
|
392
|
-
|
|
394
|
+
J === "application/xhtml+xml" && G === W && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
393
395
|
let i = h ? h.createHTML(e) : e;
|
|
394
|
-
if (
|
|
395
|
-
t = new ze().parseFromString(i,
|
|
396
|
+
if (G === W) try {
|
|
397
|
+
t = new ze().parseFromString(i, J);
|
|
396
398
|
} catch {}
|
|
397
399
|
if (!t || !t.documentElement) {
|
|
398
|
-
t = _.createDocument(
|
|
400
|
+
t = _.createDocument(G, "template", null);
|
|
399
401
|
try {
|
|
400
|
-
t.documentElement.innerHTML =
|
|
402
|
+
t.documentElement.innerHTML = dt ? g : i;
|
|
401
403
|
} catch {}
|
|
402
404
|
}
|
|
403
405
|
let a = t.body || t.documentElement;
|
|
404
|
-
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null),
|
|
406
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), G === W ? Ke.call(t, j ? "html" : "body")[0] : j ? t.documentElement : a;
|
|
407
|
+
}, Ct = function(e) {
|
|
408
|
+
return We.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
|
|
405
409
|
}, wt = function(e) {
|
|
406
|
-
return We.call(e.ownerDocument || e, e, u.SHOW_ELEMENT | u.SHOW_COMMENT | u.SHOW_TEXT | u.SHOW_PROCESSING_INSTRUCTION | u.SHOW_CDATA_SECTION, null);
|
|
407
|
-
}, Q = function(e) {
|
|
408
410
|
return e instanceof Re && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof d) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
|
|
409
411
|
}, Tt = function(e) {
|
|
410
|
-
return typeof
|
|
412
|
+
return typeof s == "function" && e instanceof s;
|
|
411
413
|
};
|
|
412
414
|
function $(e, n, r) {
|
|
413
415
|
arrayForEach(e, (e) => {
|
|
414
|
-
e.call(t, n, r,
|
|
416
|
+
e.call(t, n, r, X);
|
|
415
417
|
});
|
|
416
418
|
}
|
|
417
419
|
let Et = function(e) {
|
|
418
420
|
let n = null;
|
|
419
|
-
if ($(v.beforeSanitizeElements, e, null),
|
|
420
|
-
let r =
|
|
421
|
+
if ($(v.beforeSanitizeElements, e, null), wt(e)) return Z(e), !0;
|
|
422
|
+
let r = Y(e.nodeName);
|
|
421
423
|
if ($(v.uponSanitizeElement, e, {
|
|
422
424
|
tagName: r,
|
|
423
425
|
allowedTags: S
|
|
424
|
-
}), A && e.hasChildNodes() && !Tt(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || e.nodeType === NODE_TYPE.progressingInstruction || A && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return
|
|
426
|
+
}), A && e.hasChildNodes() && !Tt(e.firstElementChild) && regExpTest(/<[/\w!]/g, e.innerHTML) && regExpTest(/<[/\w!]/g, e.textContent) || e.nodeType === NODE_TYPE.progressingInstruction || A && e.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, e.data)) return Z(e), !0;
|
|
425
427
|
if (!(D.tagCheck instanceof Function && D.tagCheck(r)) && (!S[r] || T[r])) {
|
|
426
428
|
if (!T[r] && Ot(r) && (w.tagNameCheck instanceof RegExp && regExpTest(w.tagNameCheck, r) || w.tagNameCheck instanceof Function && w.tagNameCheck(r))) return !1;
|
|
427
429
|
if (L && !B[r]) {
|
|
@@ -434,9 +436,9 @@ function createDOMPurify() {
|
|
|
434
436
|
}
|
|
435
437
|
}
|
|
436
438
|
}
|
|
437
|
-
return
|
|
439
|
+
return Z(e), !0;
|
|
438
440
|
}
|
|
439
|
-
return e instanceof
|
|
441
|
+
return e instanceof c && !xt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, e.innerHTML) ? (Z(e), !0) : (k && e.nodeType === NODE_TYPE.text && (n = e.textContent, arrayForEach([
|
|
440
442
|
y,
|
|
441
443
|
b,
|
|
442
444
|
x
|
|
@@ -444,11 +446,11 @@ function createDOMPurify() {
|
|
|
444
446
|
n = stringReplace(n, e, " ");
|
|
445
447
|
}), e.textContent !== n && (arrayPush(t.removed, { element: e.cloneNode() }), e.textContent = n)), $(v.afterSanitizeElements, e, null), !1);
|
|
446
448
|
}, Dt = function(e, t, r) {
|
|
447
|
-
if (at && (t === "id" || t === "name") && (r in n || r in
|
|
449
|
+
if (at && (t === "id" || t === "name") && (r in n || r in gt)) return !1;
|
|
448
450
|
if (!(O && !E[t] && regExpTest(Je, t)) && !(nt && regExpTest(Ye, t)) && !(D.attributeCheck instanceof Function && D.attributeCheck(t, e))) {
|
|
449
451
|
if (!C[t] || E[t]) {
|
|
450
452
|
if (!(Ot(e) && (w.tagNameCheck instanceof RegExp && regExpTest(w.tagNameCheck, e) || w.tagNameCheck instanceof Function && w.tagNameCheck(e)) && (w.attributeNameCheck instanceof RegExp && regExpTest(w.attributeNameCheck, t) || w.attributeNameCheck instanceof Function && w.attributeNameCheck(t, e)) || t === "is" && w.allowCustomizedBuiltInElements && (w.tagNameCheck instanceof RegExp && regExpTest(w.tagNameCheck, r) || w.tagNameCheck instanceof Function && w.tagNameCheck(r)))) return !1;
|
|
451
|
-
} else if (!
|
|
453
|
+
} else if (!lt[t] && !regExpTest($e, stringReplace(r, Ze, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && stringIndexOf(r, "data:") === 0 && st[e]) && !(rt && !regExpTest(Xe, stringReplace(r, Ze, ""))) && r) return !1;
|
|
452
454
|
}
|
|
453
455
|
return !0;
|
|
454
456
|
}, Ot = function(e) {
|
|
@@ -456,7 +458,7 @@ function createDOMPurify() {
|
|
|
456
458
|
}, kt = function(e) {
|
|
457
459
|
$(v.beforeSanitizeAttributes, e, null);
|
|
458
460
|
let { attributes: n } = e;
|
|
459
|
-
if (!n ||
|
|
461
|
+
if (!n || wt(e)) return;
|
|
460
462
|
let r = {
|
|
461
463
|
attrName: "",
|
|
462
464
|
attrValue: "",
|
|
@@ -465,22 +467,22 @@ function createDOMPurify() {
|
|
|
465
467
|
forceKeepAttr: void 0
|
|
466
468
|
}, i = n.length;
|
|
467
469
|
for (; i--;) {
|
|
468
|
-
let { name: a, namespaceURI: o, value: s } = n[i], c =
|
|
469
|
-
if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(v.uponSanitizeAttribute, e, r), u = r.attrValue, ot && (c === "id" || c === "name") && (
|
|
470
|
-
|
|
470
|
+
let { name: a, namespaceURI: o, value: s } = n[i], c = Y(a), l = s, u = a === "value" ? l : stringTrim(l);
|
|
471
|
+
if (r.attrName = c, r.attrValue = u, r.keepAttr = !0, r.forceKeepAttr = void 0, $(v.uponSanitizeAttribute, e, r), u = r.attrValue, ot && (c === "id" || c === "name") && (Q(a, e), u = "user-content-" + u), A && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, u)) {
|
|
472
|
+
Q(a, e);
|
|
471
473
|
continue;
|
|
472
474
|
}
|
|
473
475
|
if (c === "attributename" && stringMatch(u, "href")) {
|
|
474
|
-
|
|
476
|
+
Q(a, e);
|
|
475
477
|
continue;
|
|
476
478
|
}
|
|
477
479
|
if (r.forceKeepAttr) continue;
|
|
478
480
|
if (!r.keepAttr) {
|
|
479
|
-
|
|
481
|
+
Q(a, e);
|
|
480
482
|
continue;
|
|
481
483
|
}
|
|
482
484
|
if (!it && regExpTest(/\/>/i, u)) {
|
|
483
|
-
|
|
485
|
+
Q(a, e);
|
|
484
486
|
continue;
|
|
485
487
|
}
|
|
486
488
|
k && arrayForEach([
|
|
@@ -490,9 +492,9 @@ function createDOMPurify() {
|
|
|
490
492
|
], (e) => {
|
|
491
493
|
u = stringReplace(u, e, " ");
|
|
492
494
|
});
|
|
493
|
-
let d =
|
|
495
|
+
let d = Y(e.nodeName);
|
|
494
496
|
if (!Dt(d, c, u)) {
|
|
495
|
-
|
|
497
|
+
Q(a, e);
|
|
496
498
|
continue;
|
|
497
499
|
}
|
|
498
500
|
if (h && typeof f == "object" && typeof f.getAttributeType == "function" && !o) switch (f.getAttributeType(d, c)) {
|
|
@@ -504,36 +506,36 @@ function createDOMPurify() {
|
|
|
504
506
|
break;
|
|
505
507
|
}
|
|
506
508
|
if (u !== l) try {
|
|
507
|
-
o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u),
|
|
509
|
+
o ? e.setAttributeNS(o, a, u) : e.setAttribute(a, u), wt(e) ? Z(e) : arrayPop(t.removed);
|
|
508
510
|
} catch {
|
|
509
|
-
|
|
511
|
+
Q(a, e);
|
|
510
512
|
}
|
|
511
513
|
}
|
|
512
514
|
$(v.afterSanitizeAttributes, e, null);
|
|
513
515
|
}, At = function e(t) {
|
|
514
|
-
let n = null, r =
|
|
516
|
+
let n = null, r = Ct(t);
|
|
515
517
|
for ($(v.beforeSanitizeShadowDOM, t, null); n = r.nextNode();) $(v.uponSanitizeShadowNode, n, null), Et(n), kt(n), n.content instanceof a && e(n.content);
|
|
516
518
|
$(v.afterSanitizeShadowDOM, t, null);
|
|
517
519
|
};
|
|
518
520
|
return t.sanitize = function(e) {
|
|
519
|
-
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null,
|
|
520
|
-
if (
|
|
521
|
+
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null, c = null, l = null;
|
|
522
|
+
if (dt = !e, dt && (e = "<!-->"), typeof e != "string" && !Tt(e)) if (typeof e.toString == "function") {
|
|
521
523
|
if (e = e.toString(), typeof e != "string") throw typeErrorCreate("dirty is not a string, aborting");
|
|
522
524
|
} else throw typeErrorCreate("toString is not a function");
|
|
523
525
|
if (!t.isSupported) return e;
|
|
524
|
-
if (M ||
|
|
526
|
+
if (M || vt(n), t.removed = [], typeof e == "string" && (R = !1), R) {
|
|
525
527
|
if (e.nodeName) {
|
|
526
|
-
let t =
|
|
528
|
+
let t = Y(e.nodeName);
|
|
527
529
|
if (!S[t] || T[t]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
528
530
|
}
|
|
529
|
-
} else if (e instanceof
|
|
531
|
+
} else if (e instanceof s) i = St("<!---->"), o = i.ownerDocument.importNode(e, !0), o.nodeType === NODE_TYPE.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? i = o : i.appendChild(o);
|
|
530
532
|
else {
|
|
531
533
|
if (!P && !k && !j && e.indexOf("<") === -1) return h && I ? h.createHTML(e) : e;
|
|
532
|
-
if (i =
|
|
534
|
+
if (i = St(e), !i) return P ? null : I ? g : "";
|
|
533
535
|
}
|
|
534
|
-
i && N &&
|
|
535
|
-
let u =
|
|
536
|
-
for (;
|
|
536
|
+
i && N && Z(i.firstChild);
|
|
537
|
+
let u = Ct(R ? e : i);
|
|
538
|
+
for (; c = u.nextNode();) Et(c), kt(c), c.content instanceof a && At(c.content);
|
|
537
539
|
if (R) return e;
|
|
538
540
|
if (P) {
|
|
539
541
|
if (F) for (l = Ge.call(i.ownerDocument); i.firstChild;) l.appendChild(i.firstChild);
|
|
@@ -549,11 +551,11 @@ function createDOMPurify() {
|
|
|
549
551
|
d = stringReplace(d, e, " ");
|
|
550
552
|
}), h && I ? h.createHTML(d) : d;
|
|
551
553
|
}, t.setConfig = function() {
|
|
552
|
-
|
|
554
|
+
vt(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), M = !0;
|
|
553
555
|
}, t.clearConfig = function() {
|
|
554
|
-
|
|
556
|
+
X = null, M = !1;
|
|
555
557
|
}, t.isValidAttribute = function(e, t, n) {
|
|
556
|
-
return
|
|
558
|
+
return X || vt({}), Dt(Y(e), Y(t), n);
|
|
557
559
|
}, t.addHook = function(e, t) {
|
|
558
560
|
typeof t == "function" && arrayPush(v[e], t);
|
|
559
561
|
}, t.removeHook = function(e, t) {
|
|
@@ -568,7 +570,7 @@ function createDOMPurify() {
|
|
|
568
570
|
v = _createHooksMap();
|
|
569
571
|
}, t;
|
|
570
572
|
}
|
|
571
|
-
var purify = createDOMPurify(), ai_chat_module_default = ":host{box-sizing:border-box;flex-direction:column;width:100%;height:100%;display:flex}:host .chat-container{background:var(--luzmo-ai-chat-background,var(--ai-chat-background));border-radius:var(--luzmo-ai-chat-border-radius,var(--ai-chat-border-radius));width:100%;height:100%;min-height:0;padding:var(--luzmo-ai-chat-padding,var(--ai-chat-padding));gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));border:var(--luzmo-ai-chat-border,var(--ai-chat-border));box-shadow:var(--luzmo-ai-chat-box-shadow,var(--ai-chat-box-shadow));box-sizing:border-box;flex-direction:column;flex:1;display:flex;overflow:hidden}:host .chat-messages-container{gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));flex-direction:column;flex:1;min-height:0;display:flex;overflow:auto}:host luzmo-chat-message{--luzmo-primary:rgba(var(--luzmo-primary-rgb),.08);--chat-message-primary-text-color:var(--luzmo-font-color);--chat-message-primary-border-color:transparent}:host luzmo-ai-interaction-textarea{flex-grow:0;flex-shrink:0}:host{--ai-chat-background:var(--luzmo-background-color);--ai-chat-border-radius:0;--ai-chat-padding:0;--ai-chat-gap:1rem;--ai-chat-max-height:none;--ai-chat-messages-flex:1;--ai-chat-border:none;--ai-chat-box-shadow:none}";
|
|
573
|
+
var purify = createDOMPurify(), ai_chat_module_default = ":host{box-sizing:border-box;flex-direction:column;width:100%;height:100%;display:flex}:host .chat-container{background:var(--luzmo-ai-chat-background,var(--ai-chat-background));border-radius:var(--luzmo-ai-chat-border-radius,var(--ai-chat-border-radius));width:100%;height:100%;min-height:0;padding:var(--luzmo-ai-chat-padding,var(--ai-chat-padding));gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));border:var(--luzmo-ai-chat-border,var(--ai-chat-border));box-shadow:var(--luzmo-ai-chat-box-shadow,var(--ai-chat-box-shadow));box-sizing:border-box;flex-direction:column;flex:1;display:flex;overflow:hidden}:host .chat-messages-container{gap:var(--luzmo-ai-chat-gap,var(--ai-chat-gap));flex-direction:column;flex:1;min-height:0;display:flex;overflow:auto}:host luzmo-chat-message{--luzmo-primary:rgba(var(--luzmo-primary-rgb),.08);--chat-message-primary-text-color:var(--luzmo-font-color);--chat-message-primary-border-color:transparent}:host luzmo-chat-message.error{color:var(--luzmo-ai-chat-error-message-color,var(--ai-chat-error-message-color))}:host luzmo-ai-interaction-textarea{flex-grow:0;flex-shrink:0}:host .loading-message{color:var(--luzmo-font-color);align-items:center;gap:.5rem;display:flex}:host .loading-message svg{color:var(--luzmo-ai-chat-loading-message-color,var(--ai-chat-loading-message-color));font-size:var(--luzmo-ai-chat-loading-message-icon-font-size,var(--ai-chat-loading-message-icon-font-size,1rem));justify-content:center;align-items:center;display:flex}:host .loading-message svg.spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}:host{--ai-chat-background:var(--luzmo-background-color);--ai-chat-border-radius:0;--ai-chat-padding:0;--ai-chat-gap:1rem;--ai-chat-max-height:none;--ai-chat-messages-flex:1;--ai-chat-border:none;--ai-chat-box-shadow:none;--ai-chat-loading-message-color:var(--luzmo-primary);--ai-chat-error-message-color:var(--luzmo-danger,#dc3545)}";
|
|
572
574
|
function buildAiMessageRequest(e) {
|
|
573
575
|
let { prompt: t, datasetIds: n, authKey: r, authToken: i, conversationId: a, chart: o, modelPreference: s, apiVersion: c = "0.1.0" } = e;
|
|
574
576
|
return {
|
|
@@ -598,7 +600,7 @@ function buildAiMessageRequest(e) {
|
|
|
598
600
|
}
|
|
599
601
|
var LuzmoAiChat = class extends LuzmoElement {
|
|
600
602
|
constructor(...e) {
|
|
601
|
-
super(...e), this.messages = [], this.selectedDatasets = [], this.placeholder = "Describe your change", this.disabled = !1, this.showAssistantContextMenu = !1, this.authKey = "", this.authToken = "", this.apiUrl = "https://api.luzmo.com", this.appServer = "https://app.luzmo.com", this.flagOpendata = !1, this.hideDatasetButton = !1, this.modelPreference = "performance", this.requestMode = "internal", this.isGenerating = !1, this.conversationId = null, this.chart = null, this.apiVersion = "0.1.0", this._isGeneratingInternal = !1, this._textareaValue = "";
|
|
603
|
+
super(...e), this.messages = [], this.selectedDatasets = [], this.placeholder = "Describe your change", this.disabled = !1, this.showAssistantContextMenu = !1, this.authKey = "", this.authToken = "", this.apiUrl = "https://api.luzmo.com", this.appServer = "https://app.luzmo.com", this.flagOpendata = !1, this.hideDatasetButton = !1, this.modelPreference = "performance", this.requestMode = "internal", this.isGenerating = !1, this.conversationId = null, this.chart = null, this.apiVersion = "0.1.0", this.loadingMessage = null, this._isGeneratingInternal = !1, this._textareaValue = "";
|
|
602
604
|
}
|
|
603
605
|
static {
|
|
604
606
|
this.styles = unsafeCSS(ai_chat_module_default);
|
|
@@ -634,7 +636,7 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
634
636
|
}
|
|
635
637
|
return await n.json();
|
|
636
638
|
}
|
|
637
|
-
|
|
639
|
+
_addUserMessage(e, t) {
|
|
638
640
|
let n = {
|
|
639
641
|
id: this._generateMessageId(),
|
|
640
642
|
type: "user",
|
|
@@ -647,7 +649,7 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
647
649
|
},
|
|
648
650
|
bubbles: !0,
|
|
649
651
|
composed: !0
|
|
650
|
-
}))
|
|
652
|
+
}));
|
|
651
653
|
}
|
|
652
654
|
_prepareForAIResponse() {
|
|
653
655
|
this._isGeneratingInternal = !0;
|
|
@@ -692,14 +694,8 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
692
694
|
_processAIResponse(e, t) {
|
|
693
695
|
e.generatedChart === void 0 ? (e.functionResponse?.error !== void 0 || typeof e.functionResponse == "string" || e.clarificationQuestion === "string") && this._handleErrorResponse(e, t) : this._handleChartResponse(e, t);
|
|
694
696
|
}
|
|
695
|
-
_handleAPIError(e) {
|
|
696
|
-
|
|
697
|
-
let t = {
|
|
698
|
-
id: this._generateMessageId(),
|
|
699
|
-
type: "ai",
|
|
700
|
-
message: `${e instanceof Error ? e.message : "Unknown error"}`
|
|
701
|
-
};
|
|
702
|
-
this.messages = [...this.messages, t], this.dispatchEvent(new CustomEvent("luzmo-response-received", {
|
|
697
|
+
_handleAPIError(e, t) {
|
|
698
|
+
t.message = msg("Something went wrong. Please try again.", { desc: "Generic error message shown in ai chat when the API request fails" }), t.isError = !0, this.messages = [...this.messages.slice(0, -1), { ...t }], this.dispatchEvent(new CustomEvent("luzmo-response-received", {
|
|
703
699
|
detail: {
|
|
704
700
|
message: t,
|
|
705
701
|
error: e
|
|
@@ -708,9 +704,6 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
708
704
|
composed: !0
|
|
709
705
|
}));
|
|
710
706
|
}
|
|
711
|
-
async _finalizeAIResponse() {
|
|
712
|
-
this._isGeneratingInternal = !1, await this.updateComplete, this._scrollToBottom();
|
|
713
|
-
}
|
|
714
707
|
_handleDatasetSelected(e) {
|
|
715
708
|
let t = e.detail;
|
|
716
709
|
this.selectedDatasets.some((e) => e.id === t.id) || (this.selectedDatasets = [...this.selectedDatasets, t], this._emitDatasetsChanged());
|
|
@@ -728,7 +721,7 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
728
721
|
}
|
|
729
722
|
async _handlePromptSubmitted(e) {
|
|
730
723
|
let { prompt: t, selectedDatasets: n } = e.detail, r = n.map((e) => e.id), i = this._buildRequestBody(t, r);
|
|
731
|
-
if (
|
|
724
|
+
if (this._addUserMessage(t, n), this.requestMode === "external") {
|
|
732
725
|
let e = {
|
|
733
726
|
prompt: t,
|
|
734
727
|
selectedDatasets: n,
|
|
@@ -748,9 +741,9 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
748
741
|
let e = await this._sendMessage(i);
|
|
749
742
|
this._processAIResponse(e, a);
|
|
750
743
|
} catch (e) {
|
|
751
|
-
this._handleAPIError(e);
|
|
744
|
+
this._handleAPIError(e, a);
|
|
752
745
|
} finally {
|
|
753
|
-
|
|
746
|
+
this._isGeneratingInternal = !1;
|
|
754
747
|
}
|
|
755
748
|
}
|
|
756
749
|
_scrollToBottom() {
|
|
@@ -761,6 +754,9 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
761
754
|
});
|
|
762
755
|
});
|
|
763
756
|
}
|
|
757
|
+
updated(e) {
|
|
758
|
+
super.updated?.(e), e.has("messages") && this.updateComplete.then(() => this._scrollToBottom());
|
|
759
|
+
}
|
|
764
760
|
_sanitizeMessage(e) {
|
|
765
761
|
return purify.sanitize(e, {
|
|
766
762
|
ALLOWED_TAGS: [
|
|
@@ -818,6 +814,7 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
818
814
|
</luzmo-chat-message>
|
|
819
815
|
` : html`
|
|
820
816
|
<luzmo-chat-message
|
|
817
|
+
class=${e.isError ? "error" : ""}
|
|
821
818
|
avatar-placement="bottom"
|
|
822
819
|
position="left"
|
|
823
820
|
quiet
|
|
@@ -827,12 +824,45 @@ var LuzmoAiChat = class extends LuzmoElement {
|
|
|
827
824
|
</luzmo-chat-message>
|
|
828
825
|
`);
|
|
829
826
|
}
|
|
827
|
+
_renderLoadingMessage() {
|
|
828
|
+
return this.isGenerating || this._isGeneratingInternal ? html`
|
|
829
|
+
<luzmo-chat-message
|
|
830
|
+
avatar-placement="bottom"
|
|
831
|
+
position="left"
|
|
832
|
+
quiet
|
|
833
|
+
size="s"
|
|
834
|
+
>
|
|
835
|
+
<div class="loading-message">
|
|
836
|
+
<span class="icon-lg">${luzmoIcon(luzmoSpin, { className: "spin" })}</span>
|
|
837
|
+
<span class="loading-message-text">${this.loadingMessage || (this.chart?.type === "placeholder" ? msg("Creating item...", { desc: "Label for ai chat creating item message" }) : msg("Updating item...", { desc: "Label for ai chat updating item message" }))}</span>
|
|
838
|
+
</div>
|
|
839
|
+
</luzmo-chat-message>
|
|
840
|
+
` : html`
|
|
841
|
+
|
|
842
|
+
`;
|
|
843
|
+
}
|
|
844
|
+
_renderPlaceholderMessage() {
|
|
845
|
+
return this.messages.length > 0 ? html`
|
|
846
|
+
|
|
847
|
+
` : html`
|
|
848
|
+
<luzmo-chat-message
|
|
849
|
+
avatar-placement="bottom"
|
|
850
|
+
position="left"
|
|
851
|
+
quiet
|
|
852
|
+
size="s"
|
|
853
|
+
>
|
|
854
|
+
${msg("Describe how you want to edit this item…", { desc: "Label for ai chat placeholder message" })}
|
|
855
|
+
</luzmo-chat-message>
|
|
856
|
+
`;
|
|
857
|
+
}
|
|
830
858
|
render() {
|
|
831
859
|
let e = this.requestMode === "external" ? this.isGenerating : this._isGeneratingInternal;
|
|
832
860
|
return html`
|
|
833
861
|
<div class="chat-container">
|
|
834
862
|
<div class="chat-messages-container">
|
|
863
|
+
${this._renderPlaceholderMessage()}
|
|
835
864
|
${this._renderMessages()}
|
|
865
|
+
${this._renderLoadingMessage()}
|
|
836
866
|
</div>
|
|
837
867
|
|
|
838
868
|
<luzmo-ai-interaction-textarea
|
|
@@ -900,5 +930,8 @@ __decorate([property({ type: Array })], LuzmoAiChat.prototype, "messages", void
|
|
|
900
930
|
})], LuzmoAiChat.prototype, "chart", void 0), __decorate([property({
|
|
901
931
|
type: String,
|
|
902
932
|
attribute: "api-version"
|
|
903
|
-
})], LuzmoAiChat.prototype, "apiVersion", void 0), __decorate([
|
|
933
|
+
})], LuzmoAiChat.prototype, "apiVersion", void 0), __decorate([property({
|
|
934
|
+
type: String,
|
|
935
|
+
attribute: "loading-message"
|
|
936
|
+
})], LuzmoAiChat.prototype, "loadingMessage", void 0), __decorate([state()], LuzmoAiChat.prototype, "_isGeneratingInternal", void 0), __decorate([state()], LuzmoAiChat.prototype, "_textareaValue", void 0), customElements.get("luzmo-ai-chat") || customElements.define("luzmo-ai-chat", LuzmoAiChat);
|
|
904
937
|
export { buildAiMessageRequest as n, LuzmoAiChat as t };
|