vue-element-ui-x 1.0.43-beta → 1.1.0
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/lib/components/EditorSender/index.js +1508 -0
- package/lib/index.common.js +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1008 -18
- package/lib/index.umd.js +1 -1
- package/lib/mixins/index.js +20 -17
- package/package.json +3 -3
- package/lib/index.ssr.js +0 -90
package/lib/index.js
CHANGED
|
@@ -5579,6 +5579,912 @@ module.exports = [
|
|
|
5579
5579
|
];
|
|
5580
5580
|
|
|
5581
5581
|
|
|
5582
|
+
/***/ }),
|
|
5583
|
+
|
|
5584
|
+
/***/ 1433:
|
|
5585
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
5586
|
+
|
|
5587
|
+
"use strict";
|
|
5588
|
+
|
|
5589
|
+
// EXPORTS
|
|
5590
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
5591
|
+
"default": () => (/* binding */ EditorSender)
|
|
5592
|
+
});
|
|
5593
|
+
|
|
5594
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/main.vue?vue&type=template&id=8ce301dc&scoped=true
|
|
5595
|
+
var render = function render() {
|
|
5596
|
+
var _vm = this,
|
|
5597
|
+
_c = _vm._self._c;
|
|
5598
|
+
return _c("div", {
|
|
5599
|
+
staticClass: "el-editor-sender-wrap",
|
|
5600
|
+
style: {
|
|
5601
|
+
"--el-editor-sender-header-duration": `${_vm.headerAnimationTimer}ms`
|
|
5602
|
+
}
|
|
5603
|
+
}, [_c("transition", {
|
|
5604
|
+
attrs: {
|
|
5605
|
+
name: "slide"
|
|
5606
|
+
}
|
|
5607
|
+
}, [_vm.$slots.header ? _c("div", {
|
|
5608
|
+
staticClass: "el-editor-sender-header"
|
|
5609
|
+
}, [_c("div", {
|
|
5610
|
+
staticClass: "el-editor-sender-header-container"
|
|
5611
|
+
}, [_vm._t("header")], 2)]) : _vm._e()]), _vm._v(" "), _c("div", {
|
|
5612
|
+
staticClass: "el-editor-sender-content",
|
|
5613
|
+
class: {
|
|
5614
|
+
"content-variant-updown": _vm.variant === "updown"
|
|
5615
|
+
},
|
|
5616
|
+
on: {
|
|
5617
|
+
mousedown: _vm.onContentMouseDown
|
|
5618
|
+
}
|
|
5619
|
+
}, [_vm.$slots.prefix && _vm.variant === "default" ? _c("div", {
|
|
5620
|
+
staticClass: "el-editor-sender-prefix"
|
|
5621
|
+
}, [_vm._t("prefix")], 2) : _vm._e(), _vm._v(" "), _c("div", {
|
|
5622
|
+
staticClass: "el-editor-sender-chat-room",
|
|
5623
|
+
on: {
|
|
5624
|
+
mousedown: function ($event) {
|
|
5625
|
+
$event.stopPropagation();
|
|
5626
|
+
return (() => {}).apply(null, arguments);
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
}, [_c("div", {
|
|
5630
|
+
ref: "container",
|
|
5631
|
+
staticClass: "el-editor-sender-chat",
|
|
5632
|
+
style: {
|
|
5633
|
+
..._vm.customStyle
|
|
5634
|
+
}
|
|
5635
|
+
})]), _vm._v(" "), _vm.variant === "default" ? _c("div", {
|
|
5636
|
+
staticClass: "el-editor-sender-action-list"
|
|
5637
|
+
}, [_vm._t("action-list", function () {
|
|
5638
|
+
return [_c("div", {
|
|
5639
|
+
staticClass: "el-editor-sender-action-list-presets"
|
|
5640
|
+
}, [!_vm.loading ? _c("SendButton", {
|
|
5641
|
+
attrs: {
|
|
5642
|
+
disabled: _vm.chatState.isEmpty || _vm.disabled
|
|
5643
|
+
},
|
|
5644
|
+
on: {
|
|
5645
|
+
submit: _vm.onSubmit
|
|
5646
|
+
}
|
|
5647
|
+
}) : _vm._e(), _vm._v(" "), _vm.loading ? _c("LoadingButton", {
|
|
5648
|
+
on: {
|
|
5649
|
+
cancel: _vm.onCancel
|
|
5650
|
+
}
|
|
5651
|
+
}) : _vm._e(), _vm._v(" "), _vm.clearable ? _c("ClearButton", {
|
|
5652
|
+
attrs: {
|
|
5653
|
+
disabled: _vm.chatState.isEmpty || _vm.disabled
|
|
5654
|
+
},
|
|
5655
|
+
on: {
|
|
5656
|
+
clear: _vm.onClear
|
|
5657
|
+
}
|
|
5658
|
+
}) : _vm._e()], 1)];
|
|
5659
|
+
})], 2) : _vm.variant === "updown" ? _c("div", {
|
|
5660
|
+
staticClass: "el-editor-sender-updown-action-list"
|
|
5661
|
+
}, [_vm.$slots.prefix ? _c("div", {
|
|
5662
|
+
staticClass: "el-editor-sender-prefix"
|
|
5663
|
+
}, [_vm._t("prefix")], 2) : _vm._e(), _vm._v(" "), _c("div", {
|
|
5664
|
+
staticClass: "el-editor-sender-action-list"
|
|
5665
|
+
}, [_vm._t("action-list", function () {
|
|
5666
|
+
return [_c("div", {
|
|
5667
|
+
staticClass: "el-editor-sender-action-list-presets"
|
|
5668
|
+
}, [!_vm.loading ? _c("SendButton", {
|
|
5669
|
+
attrs: {
|
|
5670
|
+
disabled: _vm.chatState.isEmpty || _vm.disabled
|
|
5671
|
+
},
|
|
5672
|
+
on: {
|
|
5673
|
+
submit: _vm.onSubmit
|
|
5674
|
+
}
|
|
5675
|
+
}) : _vm._e(), _vm._v(" "), _vm.loading ? _c("LoadingButton", {
|
|
5676
|
+
on: {
|
|
5677
|
+
cancel: _vm.onCancel
|
|
5678
|
+
}
|
|
5679
|
+
}) : _vm._e(), _vm._v(" "), _vm.clearable ? _c("ClearButton", {
|
|
5680
|
+
attrs: {
|
|
5681
|
+
disabled: _vm.chatState.isEmpty || _vm.disabled
|
|
5682
|
+
},
|
|
5683
|
+
on: {
|
|
5684
|
+
clear: _vm.onClear
|
|
5685
|
+
}
|
|
5686
|
+
}) : _vm._e()], 1)];
|
|
5687
|
+
})], 2)]) : _vm._e()]), _vm._v(" "), _c("transition", {
|
|
5688
|
+
attrs: {
|
|
5689
|
+
name: "slide"
|
|
5690
|
+
}
|
|
5691
|
+
}, [_vm.$slots.footer ? _c("div", {
|
|
5692
|
+
staticClass: "el-editor-sender-footer"
|
|
5693
|
+
}, [_vm._t("footer")], 2) : _vm._e()])], 1);
|
|
5694
|
+
};
|
|
5695
|
+
var staticRenderFns = [];
|
|
5696
|
+
render._withStripped = true;
|
|
5697
|
+
|
|
5698
|
+
;// ./src/components/EditorSender/src/main.vue?vue&type=template&id=8ce301dc&scoped=true
|
|
5699
|
+
|
|
5700
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/ClearButton.vue?vue&type=template&id=3e37542a&scoped=true
|
|
5701
|
+
var ClearButtonvue_type_template_id_3e37542a_scoped_true_render = function render() {
|
|
5702
|
+
var _vm = this,
|
|
5703
|
+
_c = _vm._self._c;
|
|
5704
|
+
return _c("div", {
|
|
5705
|
+
staticClass: "el-x-send-button"
|
|
5706
|
+
}, [_c("el-button", {
|
|
5707
|
+
attrs: {
|
|
5708
|
+
circle: "",
|
|
5709
|
+
disabled: _vm.disabled,
|
|
5710
|
+
size: "small"
|
|
5711
|
+
},
|
|
5712
|
+
on: {
|
|
5713
|
+
click: function ($event) {
|
|
5714
|
+
return _vm.$emit("clear");
|
|
5715
|
+
}
|
|
5716
|
+
}
|
|
5717
|
+
}, [_c("i", {
|
|
5718
|
+
staticClass: "el-icon-brush"
|
|
5719
|
+
})])], 1);
|
|
5720
|
+
};
|
|
5721
|
+
var ClearButtonvue_type_template_id_3e37542a_scoped_true_staticRenderFns = [];
|
|
5722
|
+
ClearButtonvue_type_template_id_3e37542a_scoped_true_render._withStripped = true;
|
|
5723
|
+
|
|
5724
|
+
;// ./src/components/EditorSender/src/components/ClearButton.vue?vue&type=template&id=3e37542a&scoped=true
|
|
5725
|
+
|
|
5726
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/ClearButton.vue?vue&type=script&lang=js
|
|
5727
|
+
/* harmony default export */ const ClearButtonvue_type_script_lang_js = ({
|
|
5728
|
+
name: 'ClearButton',
|
|
5729
|
+
props: {
|
|
5730
|
+
disabled: {
|
|
5731
|
+
type: Boolean,
|
|
5732
|
+
default: false
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5735
|
+
});
|
|
5736
|
+
;// ./src/components/EditorSender/src/components/ClearButton.vue?vue&type=script&lang=js
|
|
5737
|
+
/* harmony default export */ const components_ClearButtonvue_type_script_lang_js = (ClearButtonvue_type_script_lang_js);
|
|
5738
|
+
// EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
|
|
5739
|
+
var injectStylesIntoStyleTag = __webpack_require__(5072);
|
|
5740
|
+
var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
|
|
5741
|
+
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/ClearButton.vue?vue&type=style&index=0&id=3e37542a&prod&scoped=true&lang=scss
|
|
5742
|
+
var ClearButtonvue_type_style_index_0_id_3e37542a_prod_scoped_true_lang_scss = __webpack_require__(6021);
|
|
5743
|
+
;// ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/ClearButton.vue?vue&type=style&index=0&id=3e37542a&prod&scoped=true&lang=scss
|
|
5744
|
+
|
|
5745
|
+
|
|
5746
|
+
|
|
5747
|
+
var options = {};
|
|
5748
|
+
|
|
5749
|
+
options.insert = "head";
|
|
5750
|
+
options.singleton = false;
|
|
5751
|
+
|
|
5752
|
+
var update = injectStylesIntoStyleTag_default()(ClearButtonvue_type_style_index_0_id_3e37542a_prod_scoped_true_lang_scss/* default */.A, options);
|
|
5753
|
+
|
|
5754
|
+
|
|
5755
|
+
|
|
5756
|
+
/* harmony default export */ const components_ClearButtonvue_type_style_index_0_id_3e37542a_prod_scoped_true_lang_scss = (ClearButtonvue_type_style_index_0_id_3e37542a_prod_scoped_true_lang_scss/* default */.A.locals || {});
|
|
5757
|
+
;// ./src/components/EditorSender/src/components/ClearButton.vue?vue&type=style&index=0&id=3e37542a&prod&scoped=true&lang=scss
|
|
5758
|
+
|
|
5759
|
+
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
5760
|
+
var componentNormalizer = __webpack_require__(4486);
|
|
5761
|
+
;// ./src/components/EditorSender/src/components/ClearButton.vue
|
|
5762
|
+
|
|
5763
|
+
|
|
5764
|
+
|
|
5765
|
+
;
|
|
5766
|
+
|
|
5767
|
+
|
|
5768
|
+
/* normalize component */
|
|
5769
|
+
|
|
5770
|
+
var component = (0,componentNormalizer/* default */.A)(
|
|
5771
|
+
components_ClearButtonvue_type_script_lang_js,
|
|
5772
|
+
ClearButtonvue_type_template_id_3e37542a_scoped_true_render,
|
|
5773
|
+
ClearButtonvue_type_template_id_3e37542a_scoped_true_staticRenderFns,
|
|
5774
|
+
false,
|
|
5775
|
+
null,
|
|
5776
|
+
"3e37542a",
|
|
5777
|
+
null
|
|
5778
|
+
|
|
5779
|
+
)
|
|
5780
|
+
|
|
5781
|
+
/* harmony default export */ const ClearButton = (component.exports);
|
|
5782
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=template&id=353808b6&scoped=true
|
|
5783
|
+
var LoadingButtonvue_type_template_id_353808b6_scoped_true_render = function render() {
|
|
5784
|
+
var _vm = this,
|
|
5785
|
+
_c = _vm._self._c;
|
|
5786
|
+
return _c("div", {
|
|
5787
|
+
staticClass: "el-x-send-button"
|
|
5788
|
+
}, [_c("el-button", {
|
|
5789
|
+
attrs: {
|
|
5790
|
+
circle: "",
|
|
5791
|
+
size: "small"
|
|
5792
|
+
},
|
|
5793
|
+
on: {
|
|
5794
|
+
click: function ($event) {
|
|
5795
|
+
return _vm.$emit("cancel");
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
}, [_c("loading", {
|
|
5799
|
+
staticClass: "loading-svg"
|
|
5800
|
+
})], 1)], 1);
|
|
5801
|
+
};
|
|
5802
|
+
var LoadingButtonvue_type_template_id_353808b6_scoped_true_staticRenderFns = [];
|
|
5803
|
+
LoadingButtonvue_type_template_id_353808b6_scoped_true_render._withStripped = true;
|
|
5804
|
+
|
|
5805
|
+
;// ./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=template&id=353808b6&scoped=true
|
|
5806
|
+
|
|
5807
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/Loading.vue?vue&type=template&id=0c9c176e&scoped=true
|
|
5808
|
+
var Loadingvue_type_template_id_0c9c176e_scoped_true_render = function render() {
|
|
5809
|
+
var _vm = this,
|
|
5810
|
+
_c = _vm._self._c;
|
|
5811
|
+
return _c("svg", {
|
|
5812
|
+
attrs: {
|
|
5813
|
+
viewBox: "0 0 1000 1000",
|
|
5814
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5815
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
5816
|
+
}
|
|
5817
|
+
}, [_c("title", [_vm._v("Loading")]), _vm._v(" "), _c("rect", {
|
|
5818
|
+
attrs: {
|
|
5819
|
+
fill: "currentColor",
|
|
5820
|
+
height: "250",
|
|
5821
|
+
rx: "24",
|
|
5822
|
+
ry: "24",
|
|
5823
|
+
width: "250",
|
|
5824
|
+
x: "375",
|
|
5825
|
+
y: "375"
|
|
5826
|
+
}
|
|
5827
|
+
}), _vm._v(" "), _c("circle", {
|
|
5828
|
+
attrs: {
|
|
5829
|
+
cx: "500",
|
|
5830
|
+
cy: "500",
|
|
5831
|
+
fill: "none",
|
|
5832
|
+
r: "450",
|
|
5833
|
+
stroke: "currentColor",
|
|
5834
|
+
"stroke-width": "100",
|
|
5835
|
+
opacity: "0.45"
|
|
5836
|
+
}
|
|
5837
|
+
}), _vm._v(" "), _c("circle", {
|
|
5838
|
+
attrs: {
|
|
5839
|
+
cx: "500",
|
|
5840
|
+
cy: "500",
|
|
5841
|
+
fill: "none",
|
|
5842
|
+
r: "450",
|
|
5843
|
+
stroke: "currentColor",
|
|
5844
|
+
"stroke-width": "100",
|
|
5845
|
+
"stroke-dasharray": "600 9999999"
|
|
5846
|
+
}
|
|
5847
|
+
}, [_c("animateTransform", {
|
|
5848
|
+
attrs: {
|
|
5849
|
+
attributeName: "transform",
|
|
5850
|
+
dur: "1s",
|
|
5851
|
+
from: "0 500 500",
|
|
5852
|
+
repeatCount: "indefinite",
|
|
5853
|
+
to: "360 500 500",
|
|
5854
|
+
type: "rotate"
|
|
5855
|
+
}
|
|
5856
|
+
})], 1)]);
|
|
5857
|
+
};
|
|
5858
|
+
var Loadingvue_type_template_id_0c9c176e_scoped_true_staticRenderFns = [];
|
|
5859
|
+
Loadingvue_type_template_id_0c9c176e_scoped_true_render._withStripped = true;
|
|
5860
|
+
|
|
5861
|
+
;// ./src/components/EditorSender/src/components/Loading.vue?vue&type=template&id=0c9c176e&scoped=true
|
|
5862
|
+
|
|
5863
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/Loading.vue?vue&type=script&lang=js
|
|
5864
|
+
/* harmony default export */ const Loadingvue_type_script_lang_js = ({
|
|
5865
|
+
name: 'Loading'
|
|
5866
|
+
});
|
|
5867
|
+
;// ./src/components/EditorSender/src/components/Loading.vue?vue&type=script&lang=js
|
|
5868
|
+
/* harmony default export */ const components_Loadingvue_type_script_lang_js = (Loadingvue_type_script_lang_js);
|
|
5869
|
+
;// ./src/components/EditorSender/src/components/Loading.vue
|
|
5870
|
+
|
|
5871
|
+
|
|
5872
|
+
|
|
5873
|
+
|
|
5874
|
+
|
|
5875
|
+
/* normalize component */
|
|
5876
|
+
;
|
|
5877
|
+
var Loading_component = (0,componentNormalizer/* default */.A)(
|
|
5878
|
+
components_Loadingvue_type_script_lang_js,
|
|
5879
|
+
Loadingvue_type_template_id_0c9c176e_scoped_true_render,
|
|
5880
|
+
Loadingvue_type_template_id_0c9c176e_scoped_true_staticRenderFns,
|
|
5881
|
+
false,
|
|
5882
|
+
null,
|
|
5883
|
+
"0c9c176e",
|
|
5884
|
+
null
|
|
5885
|
+
|
|
5886
|
+
)
|
|
5887
|
+
|
|
5888
|
+
/* harmony default export */ const Loading = (Loading_component.exports);
|
|
5889
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=script&lang=js
|
|
5890
|
+
|
|
5891
|
+
/* harmony default export */ const LoadingButtonvue_type_script_lang_js = ({
|
|
5892
|
+
name: 'LoadingButton',
|
|
5893
|
+
components: {
|
|
5894
|
+
Loading: Loading
|
|
5895
|
+
}
|
|
5896
|
+
});
|
|
5897
|
+
;// ./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=script&lang=js
|
|
5898
|
+
/* harmony default export */ const components_LoadingButtonvue_type_script_lang_js = (LoadingButtonvue_type_script_lang_js);
|
|
5899
|
+
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=style&index=0&id=353808b6&prod&scoped=true&lang=scss
|
|
5900
|
+
var LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss = __webpack_require__(2351);
|
|
5901
|
+
;// ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=style&index=0&id=353808b6&prod&scoped=true&lang=scss
|
|
5902
|
+
|
|
5903
|
+
|
|
5904
|
+
|
|
5905
|
+
var LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss_options = {};
|
|
5906
|
+
|
|
5907
|
+
LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss_options.insert = "head";
|
|
5908
|
+
LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss_options.singleton = false;
|
|
5909
|
+
|
|
5910
|
+
var LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss_update = injectStylesIntoStyleTag_default()(LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss/* default */.A, LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss_options);
|
|
5911
|
+
|
|
5912
|
+
|
|
5913
|
+
|
|
5914
|
+
/* harmony default export */ const components_LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss = (LoadingButtonvue_type_style_index_0_id_353808b6_prod_scoped_true_lang_scss/* default */.A.locals || {});
|
|
5915
|
+
;// ./src/components/EditorSender/src/components/LoadingButton.vue?vue&type=style&index=0&id=353808b6&prod&scoped=true&lang=scss
|
|
5916
|
+
|
|
5917
|
+
;// ./src/components/EditorSender/src/components/LoadingButton.vue
|
|
5918
|
+
|
|
5919
|
+
|
|
5920
|
+
|
|
5921
|
+
;
|
|
5922
|
+
|
|
5923
|
+
|
|
5924
|
+
/* normalize component */
|
|
5925
|
+
|
|
5926
|
+
var LoadingButton_component = (0,componentNormalizer/* default */.A)(
|
|
5927
|
+
components_LoadingButtonvue_type_script_lang_js,
|
|
5928
|
+
LoadingButtonvue_type_template_id_353808b6_scoped_true_render,
|
|
5929
|
+
LoadingButtonvue_type_template_id_353808b6_scoped_true_staticRenderFns,
|
|
5930
|
+
false,
|
|
5931
|
+
null,
|
|
5932
|
+
"353808b6",
|
|
5933
|
+
null
|
|
5934
|
+
|
|
5935
|
+
)
|
|
5936
|
+
|
|
5937
|
+
/* harmony default export */ const LoadingButton = (LoadingButton_component.exports);
|
|
5938
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/SendButton.vue?vue&type=template&id=2e5f663d&scoped=true
|
|
5939
|
+
var SendButtonvue_type_template_id_2e5f663d_scoped_true_render = function render() {
|
|
5940
|
+
var _vm = this,
|
|
5941
|
+
_c = _vm._self._c;
|
|
5942
|
+
return _c("div", {
|
|
5943
|
+
staticClass: "el-x-send-button"
|
|
5944
|
+
}, [_c("el-button", {
|
|
5945
|
+
attrs: {
|
|
5946
|
+
circle: "",
|
|
5947
|
+
disabled: _vm.disabled,
|
|
5948
|
+
size: "small"
|
|
5949
|
+
},
|
|
5950
|
+
on: {
|
|
5951
|
+
click: function ($event) {
|
|
5952
|
+
return _vm.$emit("submit");
|
|
5953
|
+
}
|
|
5954
|
+
}
|
|
5955
|
+
}, [_c("i", {
|
|
5956
|
+
staticClass: "el-icon-top"
|
|
5957
|
+
})])], 1);
|
|
5958
|
+
};
|
|
5959
|
+
var SendButtonvue_type_template_id_2e5f663d_scoped_true_staticRenderFns = [];
|
|
5960
|
+
SendButtonvue_type_template_id_2e5f663d_scoped_true_render._withStripped = true;
|
|
5961
|
+
|
|
5962
|
+
;// ./src/components/EditorSender/src/components/SendButton.vue?vue&type=template&id=2e5f663d&scoped=true
|
|
5963
|
+
|
|
5964
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/components/SendButton.vue?vue&type=script&lang=js
|
|
5965
|
+
/* harmony default export */ const SendButtonvue_type_script_lang_js = ({
|
|
5966
|
+
name: 'SendButton',
|
|
5967
|
+
props: {
|
|
5968
|
+
disabled: {
|
|
5969
|
+
type: Boolean,
|
|
5970
|
+
default: false
|
|
5971
|
+
}
|
|
5972
|
+
}
|
|
5973
|
+
});
|
|
5974
|
+
;// ./src/components/EditorSender/src/components/SendButton.vue?vue&type=script&lang=js
|
|
5975
|
+
/* harmony default export */ const components_SendButtonvue_type_script_lang_js = (SendButtonvue_type_script_lang_js);
|
|
5976
|
+
;// ./src/components/EditorSender/src/components/SendButton.vue
|
|
5977
|
+
|
|
5978
|
+
|
|
5979
|
+
|
|
5980
|
+
|
|
5981
|
+
|
|
5982
|
+
/* normalize component */
|
|
5983
|
+
;
|
|
5984
|
+
var SendButton_component = (0,componentNormalizer/* default */.A)(
|
|
5985
|
+
components_SendButtonvue_type_script_lang_js,
|
|
5986
|
+
SendButtonvue_type_template_id_2e5f663d_scoped_true_render,
|
|
5987
|
+
SendButtonvue_type_template_id_2e5f663d_scoped_true_staticRenderFns,
|
|
5988
|
+
false,
|
|
5989
|
+
null,
|
|
5990
|
+
"2e5f663d",
|
|
5991
|
+
null
|
|
5992
|
+
|
|
5993
|
+
)
|
|
5994
|
+
|
|
5995
|
+
/* harmony default export */ const SendButton = (SendButton_component.exports);
|
|
5996
|
+
;// ./node_modules/chatarea/lib/ChatArea.mjs
|
|
5997
|
+
var __defProp=Object.defineProperty,__defNormalProp=(t,e,i)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,__publicField=(t,e,i)=>__defNormalProp(t,"symbol"!=typeof e?e+"":e,i);function os(){const t=navigator.userAgent,e=/(?:Windows Phone)/.test(t),i=/(?:SymbianOS)/.test(t)||e,n=/(?:Android)/.test(t),s=/(?:Firefox)/.test(t),a=/(?:iPad|PlayBook)/.test(t)||n&&!/(?:Mobile)/.test(t)||s&&/(?:Tablet)/.test(t),l=/(?:iPhone)/.test(t)&&!a;return{isTablet:a,isPhone:l,isAndroid:n,isPc:!l&&!n&&!i}}function domItVisible(t,e=!1,i="block"){t&&(t.className=t.className.replace(/ chat-view-show| chat-view-hidden/g,""),e?(t.style.display=i,t.className+=" chat-view-show"):(t.className+=" chat-view-hidden",t.style.display="none"))}function hasElmShow(t){return t&&t.classList.contains("chat-view-show")}function updateElmClass(t,e,i){t.classList[i?"add":"remove"](e)}const ELEMENT_EMPTY_KEY="data-set-empty",ELEMENT_RICH_TYPE_KEY="data-set-richType",RICH_WRAP="richWrap",RICH_GRID="richGrid",RICH_MARK="richMark",RICH_INPUT="richInput",RICH_TAG="richTag",ELEMENT_COMPONENT_KEY="data-set-component",sleep=(t=50)=>new Promise(e=>{setTimeout(e,t)}),getBoolean=t=>"false"!==String(t)&&"null"!==String(t)&&"0"!==String(t),debounce=(t,e,i=!1)=>{let n;return function(...s){const a=this,l=i&&!n;clearTimeout(n),n=setTimeout(()=>{n=null,i||t.apply(a,s)},e),l&&t.apply(a,s)}},throttle=(t,e)=>{let i;return function(...n){const s=this;i||(t.apply(s,n),i=!0,setTimeout(function(){i=!1},e))}},upFindElm=(t,e)=>{const i=t.getAttribute("data-set-richType");return i===RICH_GRID?null:i===RICH_MARK||i===RICH_TAG?t:t.parentElement&&e>0?upFindElm(t.parentElement,e-1):null},getObjValue=(t,e,i)=>t&&t[e]?t[e]:i,strictMinifyHtml=t=>t.replace(/\n+/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><").trim(),convertBlocksToSpans=(t,e)=>{const i=document.createElement("div");i.innerHTML=t;i.querySelectorAll("div, p, h1, h2, h3, h4, h5, h6, section, article, header, footer, aside, nav").forEach(t=>{const e=document.createElement("span");for(e.style.display="block",Array.from(t.attributes).forEach(t=>{e.setAttribute(t.name,t.value)});t.firstChild;)e.appendChild(t.firstChild);t.parentNode.replaceChild(e,t)});const n=i.children[0];if(n&&"block"===n.style.display&&(n.style.display="inline-block"),n){for(const t in e)n.dataset[t]="{{"+t+"}}";n.setAttribute("data-set-component","{{data-set-component}}")}return i.innerHTML};function replaceTemplateVariables(t,e){let i=t;for(const[t,n]of Object.entries(e)){const e=`{{${t}}}`;i=i.replace(new RegExp(e,"g"),String(n))}return i}function escapeHtml(t){return t.replace(/[&<>"']/g,t=>{switch(t){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return t}}).replace(/\s/g," ")}function pinyinMatch(t,e,i){const n=e.split(/\s+/),s=t.split("").map((t,i)=>{let s=n[i]||"";return""===e&&""===s&&(s=t),{char:t,pinyin:s.toLowerCase(),initial:s?s[0].toLowerCase():""}}),a=(t=>{const e=[];let i="";for(const n of t)/[a-zA-Z]/.test(n)?i+=n.toLowerCase():(i&&(e.push({type:"pinyin",value:i}),i=""),e.push({type:"char",value:n}));return i&&e.push({type:"pinyin",value:i}),e})(i),l=s.length,o=a.length,r=Array.from({length:l+1},()=>Array(o+1).fill(!1));r[0][0]=!0;for(let t=0;t<=l;t++)for(let e=0;e<=o;e++)if(r[t][e]&&e<o){const i=a[e];for(let n=t;n<l;n++){const t=s[n];if("char"===i.type)t.char===i.value&&(r[n+1][e+1]=!0);else{const a=t.pinyin.toLowerCase(),o=t.initial,c=i.value;if(c===o)r[n+1][e+1]=!0;else if(c===a)r[n+1][e+1]=!0;else if(isSubsequence(c,a))r[n+1][e+1]=!0;else for(let t=2;t<=l-n;t++){const i=s.slice(n,n+t),a=i.map(t=>t.pinyin.toLowerCase()).join(""),l=i.map(t=>t.initial).join("");if(c===a||c===l||isSubsequence(c,a)){r[n+t][e+1]=!0;break}}}}}for(let t=0;t<=l;t++)if(r[t][o])return!0;return!1}function isSubsequence(t,e){let i=0,n=0;for(;i<t.length&&n<e.length;)t[i]===e[n]&&i++,n++;return i===t.length}const checkEmptySvg='<svg class="check-empty-svg" viewBox="0 0 64 41" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 1)" fill="none" fill-rule="evenodd"><ellipse fill="#f5f5f5" cx="32" cy="33" rx="32" ry="7"></ellipse><g fill-rule="nonzero" stroke="#d9d9d9"><path d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path><path d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z" fill="#fafafa"></path></g></g></svg>',searchEmptySvg='<svg class="empty-svg" viewBox="0 0 64 41" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 1)" fill="none" fill-rule="evenodd"><ellipse fill="#f5f5f5" cx="32" cy="33" rx="32" ry="7"></ellipse><g fill-rule="nonzero" stroke="#d9d9d9"><path d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path><path d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z" fill="#fafafa"></path></g></g></svg>',searchSvg='<svg class="icon-search" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M684.8 223.530667a326.272 326.272 0 0 1 24.96 433.621333c2.645333 2.133333 5.290667 4.48 7.850667 7.04L870.4 817.066667c24.789333 24.746667 32.896 56.832 18.133333 71.594666-14.762667 14.805333-46.848 6.656-71.637333-18.090666l-152.789333-152.832a106.282667 106.282667 0 0 1-7.210667-7.936 326.101333 326.101333 0 0 1-433.109333-25.173334c-127.445333-127.445333-127.573333-333.952-0.256-461.269333 127.36-127.36 333.866667-127.232 461.269333 0.213333zM275.328 275.114667a252.885333 252.885333 0 0 0 0.256 357.632 252.885333 252.885333 0 0 0 357.632 0.256 252.885333 252.885333 0 0 0-0.256-357.632 252.885333 252.885333 0 0 0-357.632-0.256z" fill="#9B9B9B"></path></svg>',antdLoading='<div class="ant-spin ant-spin-spinning" aria-live="polite" aria-busy="true"><span class="ant-spin-dot ant-spin-dot-spin"><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i><i class="ant-spin-dot-item"></i></span></div>',matchEmptySvg='<svg class="match-empty-svg" viewBox="0 0 64 41" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 1)" fill="none" fill-rule="evenodd"><ellipse fill="#f5f5f5" cx="32" cy="33" rx="32" ry="7"></ellipse><g fill-rule="nonzero" stroke="#d9d9d9"><path d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path><path d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z" fill="#fafafa"></path></g></g></svg>',checkSvg='<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="none" viewBox="0 0 24 24"><path fill="currentColor" d="M9.218 17.41 19.83 6.796a.99.99 0 1 1 1.389 1.415c-3.545 3.425-4.251 4.105-11.419 11.074a.997.997 0 0 1-1.375.018c-1.924-1.801-3.709-3.568-5.573-5.43a.999.999 0 0 1 1.414-1.413z"></path></svg>',arrowSvg='<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="none" viewBox="0 0 24 24"><path fill="currentColor" d="m20.23 8.653-7.795 9.685a1.2 1.2 0 0 1-1.87 0L2.771 8.652C2.14 7.867 2.698 6.7 3.706 6.7h15.588c1.008 0 1.567 1.167.935 1.952"></path></svg>',closeSvg='<svg focusable="false" data-icon="close-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true" fill-rule="evenodd" viewBox="64 64 896 896"><path d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"></path></svg>';class ChatElement{constructor(t){__publicField(this,"target"),__publicField(this,"richText",document.createElement("div")),__publicField(this,"placeholderElm",document.createElement("div")),__publicField(this,"tipElm",null),__publicField(this,"isExternalCallPopup",!1),__publicField(this,"isPointSearchMode",!1),__publicField(this,"checkboxRows",[]),__publicField(this,"customTags",{}),__publicField(this,"selectTags",{}),__publicField(this,"rects",{}),__publicField(this,"pcElms",{containerDialogElm:null,pointDialogElm:null,pointDialogCheckElm:null,pointDialogMainElm:null,pointDialogUsersElm:[],pointDialogActiveElm:null,pointDialogLoadingElm:null,pointDialogEmptyElm:null,checkDialogElm:null,checkDialogSearchResultElm:null,checkDialogUsersElm:null,checkDialogSearchInputElm:null,checkDialogTagsElm:null,customTagDialogElms:{},customTagDialogTagKey:"",customTagDialogActiveElm:null,selectDialogElms:{},selectDialogKey:"",selectDialogAim:null,tipContainerPopoverElm:null,tipPopoverElm:null}),__publicField(this,"h5Elms",{dialogElm:null,dialogMainElm:null,dialogCheckElm:null,dialogShowElm:null,dialogSearchElm:null,dialogEmptyElm:null,dialogLoadingElm:null}),this.target=t,this.createRichText(),this.createPlaceholder(),t.deviceInfo.isPc?this.createPCDialog():this.createH5Dialog()}createRichText(){const{options:t,deviceInfo:e}=this.target,{elm:i}=t;updateElmClass(i,"chat-area-"+(e.isPc?"pc":"h5"),!0),updateElmClass(this.richText,"chat-rich-text",!0),this.richText.setAttribute("data-set-richType",RICH_WRAP),this.richText.setAttribute("contenteditable","true"),i.appendChild(this.richText)}createPlaceholder(){const{options:t}=this.target,{elm:e}=t;updateElmClass(this.placeholderElm,"chat-placeholder-wrap",!0),domItVisible(this.placeholderElm,!0),e.appendChild(this.placeholderElm),this.rects.plaRect=this.placeholderElm.getBoundingClientRect()}createPCDialog(){const{options:t}=this.target,{needDialog:e,elm:i,asyncMatch:n}=t;if(!e)return;const{pcElms:s}=this;s.containerDialogElm=document.createElement("div"),updateElmClass(this.pcElms.containerDialogElm,"chat-dialog",!0),i.nextElementSibling?i.parentElement.insertBefore(s.containerDialogElm,i.nextElementSibling):i.parentElement.appendChild(s.containerDialogElm),n||this.createPCCheckDialog(),this.createPCPointDialog()}createPCCheckDialog(){const{options:t}=this.target,e=this.target.options.dialogLabels.pcPCheckDialog,{pcElms:i}=this;i.checkDialogElm=document.createElement("div"),updateElmClass(i.checkDialogElm,"checkbox-dialog",!0),domItVisible(i.checkDialogElm),i.checkDialogElm.innerHTML=`\n <div class="checkbox-dialog-container">\n <div class="checkbox-dialog-container-header">\n <span>${e.title}</span>\n <span class="checkbox-dialog-container-header-close">⛌</span>\n </div>\n <div class="checkbox-dialog-container-body">\n <div class="checkbox-dialog-left-box">\n <div class="checkbox-dialog-search">\n <input class="checkbox-dialog-search-input" placeholder="${e.searchPlaceholder}" type="text">\n <div class="checkbox-dialog-search-group"></div>\n </div>\n <div class="checkbox-dialog-tags"></div>\n <div class="checkbox-dialog-option">\n <button class="checkbox-dialog-option-btn btn-submit disabled">${e.confirmLabel}</button>\n <button class="checkbox-dialog-option-btn btn-close">${e.cancelLabel}</button>\n </div>\n </div>\n <div class="checkbox-dialog-right-box">\n <div class="checkbox-dialog-right-box-title">${e.userTagTitle}</div>\n <div class="checkbox-dialog-check-group"></div>\n </div>\n </div>\n </div>\n `,i.containerDialogElm.appendChild(i.checkDialogElm),i.checkDialogUsersElm=i.checkDialogElm.querySelector(".checkbox-dialog-check-group"),i.checkDialogSearchResultElm=i.checkDialogElm.querySelector(".checkbox-dialog-search-group"),i.checkDialogSearchInputElm=i.checkDialogElm.querySelector(".checkbox-dialog-search-input"),i.checkDialogTagsElm=i.checkDialogElm.querySelector(".checkbox-dialog-tags");const n=()=>{domItVisible(i.checkDialogElm),updateElmClass(document.body,"disable-scroll")};i.checkDialogElm.querySelector(".checkbox-dialog-container-header-close").onclick=n,i.checkDialogElm.querySelector(".btn-close").onclick=n;const s=i.checkDialogElm.querySelector(".btn-submit");s.onclick=async()=>{if(s.classList.contains("disabled"))return;const e=this.checkboxRows.map(e=>{const i=Object.create(null);return i[t.userProps.id]=e.id,i[t.userProps.name]=e.name,i});await this.target.batchSetTag(e),n()},domItVisible(i.checkDialogSearchResultElm),i.checkDialogSearchResultElm.onclick=t=>{t.stopPropagation()},i.checkDialogSearchInputElm.onclick=t=>{t.stopPropagation()};const a=debounce(t=>{const e=String(t.target.value||"").replace(/'/g,"").trim();if(!e)return void domItVisible(i.checkDialogSearchResultElm);const n=this.target.searchUserList(e).map(t=>t.id);Array.from(i.checkDialogSearchResultElm.children,(t,e)=>{if(e===i.checkDialogSearchResultElm.children.length-1)domItVisible(t,0===n.length);else{const e=t.getAttribute("data-set-id");domItVisible(t,-1!==n.indexOf(e),"flex")}}),domItVisible(i.checkDialogSearchResultElm,!0)},200);i.checkDialogSearchInputElm.oninput=a,i.checkDialogSearchInputElm.onfocus=a}createPCPointDialog(){const{pcElms:t,target:e}=this;t.pointDialogElm=document.createElement("div"),updateElmClass(t.pointDialogElm,"call-user-dialog",!0),domItVisible(t.pointDialogElm);const i=document.createElement("div");updateElmClass(i,"call-user-dialog-header",!0),i.innerHTML=`<span class="call-user-dialog-header-title">${e.options.dialogLabels.pcPointDialog.title}</span>`,t.pointDialogCheckElm=document.createElement("span"),updateElmClass(t.pointDialogCheckElm,"call-user-dialog-header-check",!0),t.pointDialogCheckElm.innerText=e.options.dialogLabels.pcPointDialog.checkLabel,t.pointDialogCheckElm.onclick=()=>{this.target.showPCCheckDialog(),this.isExternalCallPopup=!1},i.appendChild(t.pointDialogCheckElm),t.pointDialogElm.appendChild(i),t.pointDialogMainElm=document.createElement("div"),updateElmClass(t.pointDialogMainElm,"call-user-dialog-main",!0),t.pointDialogElm.appendChild(t.pointDialogMainElm),e.options.asyncMatch&&(t.pointDialogLoadingElm=document.createElement("div"),updateElmClass(t.pointDialogLoadingElm,"call-user-dialog-loading",!0),t.pointDialogLoadingElm.innerHTML=antdLoading,t.pointDialogElm.appendChild(t.pointDialogLoadingElm),domItVisible(t.pointDialogLoadingElm),t.pointDialogEmptyElm=document.createElement("div"),updateElmClass(t.pointDialogEmptyElm,"call-user-dialog-empty",!0),t.pointDialogEmptyElm.innerHTML=`\n ${matchEmptySvg}\n <span class="empty-label">${e.options.dialogLabels.pcPointDialog.emptyLabel}</span>\n `,t.pointDialogElm.appendChild(t.pointDialogEmptyElm),domItVisible(t.pointDialogEmptyElm)),t.containerDialogElm.appendChild(t.pointDialogElm)}createH5Dialog(){const{options:t,chatEvent:e}=this.target,{needDialog:i,dialogLabels:n}=t;if(!i)return;const{h5Elms:s}=this;s.dialogElm=document.createElement("div"),updateElmClass(s.dialogElm,"call-user-popup",!0),s.dialogElm.innerHTML=`\n <div class="call-user-popup-main">\n <div class="call-user-popup-header">\n <span class="popup-show">${n.h5Dialog.cancelLabel}</span>\n <span class="popup-title">${n.h5Dialog.title}</span>\n <span class="popup-check">${n.h5Dialog.confirmLabel}</span>\n </div>\n <div class="call-user-popup-search">\n ${searchSvg}\n <input class="call-user-popup-search-input"\n placeholder="${n.h5Dialog.searchPlaceholder}"\n type="text">\n </div>\n <div class="call-user-popup-body"></div>\n </div>\n `;const a=async()=>{s.dialogElm.className=s.dialogElm.className.replace(/ chat-view-show/g," chat-view-hidden"),s.dialogSearchElm.value="",await sleep(260),domItVisible(s.dialogElm),updateElmClass(document.body,"disable-scroll"),t.asyncMatch&&this.target.updateUserList([]),this.target.chatInput.restCursorPos(this.target.chatInput.vnode,this.target.chatInput.cursorIndex),this.target.chatInput.viewIntoPoint()};s.dialogElm.onclick=a;const l=s.dialogElm.querySelector(".call-user-popup-main");l.onclick=t=>{t.stopPropagation()},s.dialogShowElm=s.dialogElm.querySelector(".popup-show"),s.dialogShowElm.onclick=a,s.dialogCheckElm=s.dialogElm.querySelector(".popup-check"),s.dialogCheckElm.onclick=async()=>{if(s.dialogCheckElm.classList.contains("disabled"))return;const e=s.dialogElm.querySelectorAll(".user-popup-check-item-check")||[];if(0===e.length)return void await a();if(Array.prototype.some.call(e,t=>"isALL"===t.getAttribute("data-set-id")))return await this.target.onceSetTag({[t.userProps.id]:"isALL",[t.userProps.name]:t.dialogLabels.h5Dialog.callEveryLabel}),void await a();const i=Array.from(e,t=>t.getAttribute("data-set-id")),n=t.userList.filter(e=>-1!==i.indexOf(String(e[t.userProps.id])));await this.target.batchSetTag(n),await a()},s.dialogMainElm=s.dialogElm.querySelector(".call-user-popup-body"),s.dialogEmptyElm=document.createElement("div"),updateElmClass(s.dialogEmptyElm,"call-user-popup-empty",!0),this.h5Elms.dialogEmptyElm.innerHTML=`\n ${searchEmptySvg}\n <span class="empty-label">${t.dialogLabels.h5Dialog.searchEmptyLabel}</span>\n `,domItVisible(s.dialogEmptyElm),l.appendChild(s.dialogEmptyElm),t.asyncMatch&&(s.dialogLoadingElm=document.createElement("div"),updateElmClass(s.dialogLoadingElm,"call-user-popup-loading",!0),s.dialogLoadingElm.innerHTML=antdLoading,domItVisible(s.dialogLoadingElm),l.appendChild(s.dialogLoadingElm)),s.dialogSearchElm=s.dialogElm.querySelector(".call-user-popup-search-input"),s.dialogSearchElm.oninput=debounce(i=>{const n=String(i.target.value||"").replace(/'/g,"").trim();if(t.asyncMatch){e.matchKey++;const t=e.matchKey;this.target.updateUserList([]),domItVisible(s.dialogLoadingElm,!0),domItVisible(s.dialogEmptyElm);const i=e.triggerChatEvent("atMatch",n).find(t=>t&&t instanceof Promise);return void(i&&i.then(i=>{t===e.matchKey&&(domItVisible(s.dialogLoadingElm),!i||i.length<=0?domItVisible(s.dialogEmptyElm,!0,"flex"):this.target.updateUserList(i))}))}const a=[];Array.from(this.h5Elms.dialogMainElm.children,t=>{if(!n)return domItVisible(t,!0,"flex"),void a.push(t);pinyinMatch(t.getAttribute("data-set-name")||"",t.getAttribute("data-set-pinyin")||"",n)?(domItVisible(t,!0,"flex"),a.push(t)):domItVisible(t)}),domItVisible(this.h5Elms.dialogEmptyElm,!a.length,"flex")},200),domItVisible(s.dialogElm),document.body.appendChild(s.dialogElm)}updatePCUser(){const{pcElms:t,target:e}=this;t.pointDialogMainElm.innerHTML="",t.pointDialogActiveElm=void 0;const i=document.createDocumentFragment();if(this.target.options.needCallEvery){const t=document.createElement("div");updateElmClass(t,"call-user-dialog-item",!0),t.setAttribute("data-set-id","isALL"),this.userSelectStyleAndEvent(t,{id:"isALL",name:e.options.dialogLabels.pcPointDialog.callEveryLabel}),t.innerHTML=`\n <span class="call-user-dialog-item-sculpture">\n <span style="transform: scale(0.75)">@</span>\n </span>\n <span class="call-user-dialog-item-name">${e.options.dialogLabels.pcPointDialog.callEveryLabel}(${e.options.reformList.length})</span>\n `,i.appendChild(t)}if(e.options.reformList.forEach(t=>{const e=document.createElement("div");updateElmClass(e,"call-user-dialog-item",!0),e.setAttribute("data-set-id",t.id),this.userSelectStyleAndEvent(e,t),this.getUserHtmlTemplate(e,t),i.appendChild(e)}),t.pointDialogMainElm.appendChild(i),t.pointDialogUsersElm=[],Array.from(t.pointDialogMainElm.children||[],(e,i)=>{t.pointDialogUsersElm.push({index:i,elm:e})}),e.options.asyncMatch)return;t.checkDialogUsersElm.innerHTML=`\n <div class="checkbox-dialog-check-item" data-set-value="ALL">\n <input type="checkbox" value>\n <span class="checkbox-dialog-check-item-inner"></span>\n <div class="checkbox-dialog-check-item-label">${e.options.dialogLabels.pcPCheckDialog.checkAllLabel}</div>\n </div>\n `;const n=document.createDocumentFragment();e.options.reformList.forEach(t=>{const e=document.createElement("div");updateElmClass(e,"checkbox-dialog-check-item",!0),e.setAttribute("data-set-value",t.id),e.innerHTML='\n <input type="checkbox" value>\n <span class="checkbox-dialog-check-item-inner"></span>\n ',this.getUserHtmlTemplate(e,t),n.appendChild(e)}),t.checkDialogUsersElm.appendChild(n),t.checkDialogUsersElm&&t.checkDialogUsersElm.children.length&&Array.from(t.checkDialogUsersElm.children,t=>{t.onclick=()=>{const i=t.getAttribute("data-set-value")||"",n=e.options.reformList.find(t=>t.id===i),s=-1===t.className.indexOf("checkbox-dialog-check-item-check");"ALL"===i?this.checkboxRows=s?e.options.reformList.map(t=>t):[]:s?this.checkboxRows.push(n):this.checkboxRows=this.checkboxRows.filter(t=>t.id!==i),this.updateCheckDialogTags()}}),t.checkDialogSearchResultElm.innerHTML="";const s=document.createDocumentFragment();e.options.reformList.forEach(t=>{const i=document.createElement("div");updateElmClass(i,"checkbox-dialog-check-item",!0),i.setAttribute("data-set-id",t.id);const n=document.createElement("div");updateElmClass(n,"checkbox-dialog-check-item-label",!0),this.getUserHtmlTemplate(n,t),i.appendChild(n),i.onclick=()=>{domItVisible(this.pcElms.checkDialogSearchResultElm);const t=i.getAttribute("data-set-id")||"";if(this.pcElms.checkDialogSearchInputElm.value="",this.pcElms.checkDialogSearchInputElm.focus(),this.checkboxRows.some(e=>e.id===t))return;const n=e.options.reformList.find(e=>e.id===t);n&&this.checkboxRows.push(n),this.updateCheckDialogTags()},s.appendChild(i)});const a=document.createElement("div");updateElmClass(a,"checkbox-dialog-search-empty",!0),a.innerText=e.options.dialogLabels.pcPCheckDialog.searchEmptyLabel,s.appendChild(a),t.checkDialogSearchResultElm.appendChild(s)}updateH5User(){const{h5Elms:t,target:e}=this;t.dialogMainElm.innerHTML="";const i=e.options.reformList&&e.options.reformList.length>0,n=document.createDocumentFragment(),s=document.createElement("span");if(s.innerHTML='\n <input type="checkbox" value>\n <span class="user-popup-check-item-inner"></span>\n ',i){const t=document.createElement("div");e.options.needCallEvery&&(updateElmClass(t,"call-user-popup-item",!0),t.setAttribute("data-set-id","isALL"),t.innerHTML=`\n <span class="call-user-dialog-item-sculpture">\n <span style="transform: scale(0.75)">@</span>\n </span>\n <span class="call-user-dialog-item-name">${e.options.dialogLabels.h5Dialog.callEveryLabel}(${e.options.reformList.length})</span>\n `,t.appendChild(s.cloneNode(!0)),t.onclick=()=>{const e=!t.classList.contains("user-popup-check-item-check");Array.from(this.h5Elms.dialogMainElm.children,t=>{updateElmClass(t,"user-popup-check-item-check",e)}),updateElmClass(this.h5Elms.dialogCheckElm,"disabled",!e)},n.appendChild(t)),e.options.reformList.forEach((e,i)=>{const a=document.createElement("div");updateElmClass(a,"call-user-popup-item",!0),a.setAttribute("data-set-id",e.id),a.setAttribute("data-set-name",e.name),a.setAttribute("data-set-pinyin",e.pinyin||""),this.getUserHtmlTemplate(a,e),a.appendChild(s.cloneNode(!0)),n.appendChild(a),a.onclick=e=>{const i=!a.classList.contains("user-popup-check-item-check");updateElmClass(a,"user-popup-check-item-check",i);const n=Array.prototype.every.call(this.h5Elms.dialogMainElm.children,t=>t.classList.contains("user-popup-check-item-check")||"isALL"===t.getAttribute("data-set-id"));updateElmClass(t,"user-popup-check-item-check",n);const s=Array.prototype.some.call(this.h5Elms.dialogMainElm.children,t=>t.classList.contains("user-popup-check-item-check"));updateElmClass(this.h5Elms.dialogCheckElm,"disabled",!s)}})}t.dialogMainElm.appendChild(n)}updateCheckDialogTags(){const t=this.checkboxRows.map(t=>t.id),e=[],i=[],n=document.createElement("div");n.className="check-empty",n.innerHTML=`\n ${checkEmptySvg}\n <span class="check-empty-label">${this.target.options.dialogLabels.pcPCheckDialog.checkEmptyLabel}</span>\n `,Array.from(this.pcElms.checkDialogTagsElm.children,n=>{const s=n.getAttribute("data-set-value");-1===t.indexOf(s)?i.push(n):e.push(s)}),Array.from(this.pcElms.checkDialogUsersElm.children,(e,i)=>{if(0===i)return void updateElmClass(e,"checkbox-dialog-check-item-check",t.length===this.target.options.reformList.length);const n=e.getAttribute("data-set-value");updateElmClass(e,"checkbox-dialog-check-item-check",-1!==t.indexOf(n))}),i.forEach(t=>{this.pcElms.checkDialogTagsElm.removeChild(t)});updateElmClass(this.pcElms.checkDialogElm.querySelector(".btn-submit"),"disabled",t.length<=0),t.length||this.pcElms.checkDialogTagsElm.appendChild(n);const s=this.checkboxRows.filter(t=>-1===e.indexOf(t.id));if(!s.length)return;const a=document.createDocumentFragment();s.forEach(t=>{const e=document.createElement("div");e.setAttribute("class","checkbox-dialog-tag-item"),e.setAttribute("data-set-value",t.id),e.innerHTML=`\n <span>${t.name}</span>\n `;const i=document.createElement("span");i.setAttribute("class","checkbox-dialog-tag-item-close"),i.innerHTML="⛌",i.onclick=()=>{const t=e.getAttribute("data-set-value");this.checkboxRows=this.checkboxRows.filter(e=>e.id!==t),this.updateCheckDialogTags()},e.appendChild(i),a.appendChild(e)}),this.pcElms.checkDialogTagsElm.appendChild(a)}userSelectStyleAndEvent(t,e){t.addEventListener("click",async i=>{const{options:n}=this.target;if(i.stopPropagation(),this.updatePointActiveUserElm(t),this.isPointSearchMode||n.asyncMatch)await this.target.matchSetTag(e);else{const t=n.userList.find(t=>String(t[n.userProps.id])===e.id);await this.target.onceSetTag(t)}this.exitPointDialog()})}bindCustomTrigger(){Object.values(this.pcElms.customTagDialogElms).forEach(t=>{this.pcElms.containerDialogElm.removeChild(t)}),this.pcElms.customTagDialogElms={},this.customTags={},this.target.options.customTrigger.forEach(t=>{t.tagList&&t.tagList.length>0&&(this.customTags[t.prefix]=t.tagList.map(t=>({id:String(t.id),name:String(t.name),pinyin:String(t.pinyin||"")})),this.createCustomTagDialog(t))})}createCustomTagDialog(t){const e=document.createElement("div");e.setAttribute("class","call-tag-dialog"),domItVisible(e);const i=document.createElement("div");i.setAttribute("class","call-tag-dialog-header"),i.innerHTML=`<span class="call-tag-dialog-header-title">${t.dialogTitle||t.prefix}</span>`,e.appendChild(i);const n=document.createElement("div");n.setAttribute("class","call-tag-dialog-main"),t.tagList.forEach(t=>{const e=document.createElement("div");e.setAttribute("class","call-tag-dialog-item"),e.setAttribute("data-set-id",t.id);const i=document.createElement("span");i.setAttribute("class","call-tag-dialog-item-name"),i.innerHTML=t.name,e.appendChild(i),e.addEventListener("click",async i=>{i.stopPropagation(),this.updateActiveCustomTagElm(e),this.isPointSearchMode?await this.target.matchSetCustomTag(t):await this.target.onceSetCustomTag(t),this.exitCustomTagDialog()}),n.appendChild(e)}),e.appendChild(n),this.pcElms.containerDialogElm.appendChild(e),this.pcElms.customTagDialogElms[t.prefix]=e}getUserHtmlTemplate(t,e){const i=document.createElement("span");if(i.setAttribute("class","call-user-dialog-item-sculpture "+(e.avatar?"is-avatar":"")),e.avatar){const t=new Image;t.alt="",t.src=String(e.avatar),i.appendChild(t)}else i.innerHTML=`<span style="transform: scale(0.75)">${e.name.slice(-2)}</span>`;t.appendChild(i);const n=document.createElement("span");n.setAttribute("class","call-user-dialog-item-name"),n.innerHTML=e.name,t.appendChild(n)}updatePointActiveUserElm(t,e=!1){if(this.pcElms.pointDialogActiveElm&&updateElmClass(this.pcElms.pointDialogActiveElm,"call-user-dialog-item-active"),this.pcElms.pointDialogActiveElm=t,t&&(updateElmClass(t,"call-user-dialog-item-active",!0),e)){const e=Array.prototype.filter.call(this.pcElms.pointDialogMainElm.children,t=>-1===t.className.indexOf("user-no-match")),i=t.clientHeight,n=Array.prototype.indexOf.call(e,t)+1-Math.ceil(Math.floor(this.pcElms.pointDialogMainElm.clientHeight/i)/2);this.pcElms.pointDialogMainElm.scrollTop=n>0?n*i:0}}updateActiveCustomTagElm(t,e=!1){if(this.pcElms.customTagDialogActiveElm&&updateElmClass(this.pcElms.customTagDialogActiveElm,"call-tag-dialog-item-active"),this.pcElms.customTagDialogActiveElm=t,t&&(updateElmClass(t,"call-tag-dialog-item-active",!0),e)){const e=this.pcElms.customTagDialogElms[this.pcElms.customTagDialogTagKey].children[1],i=Array.prototype.filter.call(e.children,t=>-1===t.className.indexOf("tag-no-match")),n=t.clientHeight,s=Array.prototype.indexOf.call(i,t)+1-Math.ceil(Math.floor(e.clientHeight/n)/2);e.scrollTop=s>0?s*n:0}}showPointDialog(t){this.exitSelectDialog(),this.exitCustomTagDialog(),this.exitPointDialog(),this.isPointSearchMode=!!t;let e=null;this.pcElms.pointDialogUsersElm.forEach(i=>{const n=i.elm,s=n.getAttribute("data-set-id"),a=t&&t.every(t=>t.id!==s);e||a||(e=n),updateElmClass(n,"user-no-match",a)}),null!==e&&this.updatePointActiveUserElm(e),domItVisible(this.pcElms.pointDialogCheckElm,!this.target.options.asyncMatch&&!this.isPointSearchMode),domItVisible(this.pcElms.pointDialogElm,!0),this.target.chatEvent.debounceEvents.dialogMoveToRange(this.pcElms.pointDialogElm),this.pcElms.pointDialogMainElm.scrollTop=0}showCustomTagDialog(t,e){this.exitSelectDialog(),this.exitCustomTagDialog(),this.exitPointDialog(),this.isPointSearchMode=!!e,this.pcElms.customTagDialogTagKey=t;const i=this.pcElms.customTagDialogElms[t],n=i.children[1];let s=null;Array.from(n.children,t=>{const i=t.getAttribute("data-set-id"),n=e&&e.every(t=>t.id!==i);s||n||(s=t),updateElmClass(t,"tag-no-match",n)}),null!==s&&this.updateActiveCustomTagElm(s),domItVisible(i,!0),this.target.chatEvent.debounceEvents.dialogMoveToRange(i),i.children[1].scrollTop=0}exitPointDialog(){this.updatePointActiveUserElm(),this.target.options.asyncMatch&&this.target.updateUserList([]),domItVisible(this.pcElms.pointDialogElm)}exitCustomTagDialog(){this.updateActiveCustomTagElm();for(const t in this.pcElms.customTagDialogElms)domItVisible(this.pcElms.customTagDialogElms[t])}ruleShowPointDialog(){const{options:t}=this.target;t.needDialog&&t.reformList.length>0&&(this.isExternalCallPopup=!1,this.showPointDialog())}showPlaceholder(){domItVisible(this.placeholderElm,this.target.isEmpty()),this.offsetTipElm()}bindSelectList(){Object.values(this.pcElms.selectDialogElms).forEach(t=>{this.pcElms.containerDialogElm.removeChild(t)}),this.pcElms.selectDialogElms={},this.selectTags={},this.target.options.selectList.forEach(t=>{t.options&&t.options.length>0&&(this.selectTags[t.key]=t.options.map(t=>({id:String(t.id),name:String(t.name),preview:String(t.preview||"")})),this.createSelectDialog(t))})}createSelectDialog(t){const e=document.createElement("div");e.setAttribute("class","chat-select-dialog"),domItVisible(e);const i=document.createElement("div");i.setAttribute("class","chat-select-dialog-header"),i.innerHTML=`<span class="chat-select-dialog-header-title">${t.dialogTitle||t.key}</span>`,e.appendChild(i);const n=document.createElement("div");n.setAttribute("class","chat-select-dialog-main"),t.options.forEach(t=>{const e=document.createElement("div");if(e.setAttribute("class","chat-select-dialog-item"),e.setAttribute("data-set-id",t.id),t.preview){const i=document.createElement("img");i.setAttribute("class","chat-select-dialog-preview"),i.src=String(t.preview),e.appendChild(i)}const i=document.createElement("span");i.setAttribute("class","chat-select-dialog-name"),i.textContent=t.name;const s=document.createElement("span");s.setAttribute("class","chat-select-dialog-check"),s.innerHTML=checkSvg,domItVisible(s),i.appendChild(s),e.appendChild(i),e.onclick=async()=>{await this.target.setSelectTag(t)},n.appendChild(e)}),e.appendChild(n);const s=document.createElement("div");s.setAttribute("class","chat-select-arrow"),e.appendChild(s),this.pcElms.containerDialogElm.appendChild(e),this.pcElms.selectDialogElms[t.key]=e}exitSelectDialog(){for(const t in this.pcElms.selectDialogElms)domItVisible(this.pcElms.selectDialogElms[t]);this.pcElms.selectDialogKey="",this.pcElms.selectDialogAim&&(updateElmClass(this.pcElms.selectDialogAim,"aim"),this.pcElms.selectDialogAim=null)}createTipElm(t){this.tipElm||(this.tipElm=document.createElement("div")),updateElmClass(this.tipElm,"chat-tip-wrap",!0),this.tipElm.innerHTML=`\n <div class="chat-tip-tag">\n <span class="chat-tip-tag-txt">${t.tagLabel||"--"}</span>\n <span class="chat-tip-tag-close">\n ${this.target.deviceInfo.isPc?closeSvg:""}\n </span>\n </div>\n `,this.target.options.elm.appendChild(this.tipElm);const e=this.tipElm.children[0],i=(e.clientHeight-this.target.chatInput.NODE_HEIGHT)/2;this.tipElm.style.top=`-${i}px`,e.onclick=()=>{this.target.deviceInfo.isPc&&this.target.closeTipTag()},e.onmouseenter=()=>{if(this.pcElms.tipContainerPopoverElm&&this.pcElms.tipPopoverElm){domItVisible(this.pcElms.tipPopoverElm,!0);const t=this.pcElms.tipContainerPopoverElm.getBoundingClientRect();this.rects.tipRect=this.tipElm.getBoundingClientRect();const i=(this.pcElms.tipPopoverElm.clientWidth-(this.tipElm.clientWidth+(this.tipElm.clientWidth-e.clientWidth)))/2;this.pcElms.tipPopoverElm.style.left=-i+"px",this.pcElms.tipPopoverElm.style.bottom=t.y-this.rects.tipRect.y+"px",this.pcElms.tipPopoverElm.style.transform=e.style.transform}},e.onmouseleave=()=>{this.pcElms.tipPopoverElm&&domItVisible(this.pcElms.tipPopoverElm)};const n=this.richText.children[0].children[0];this.rects.tipRect=this.tipElm.getBoundingClientRect();const s=this.rects.tipRect;if(this.placeholderElm.style.paddingLeft=s.width+"px",n.style.paddingLeft=s.width-n.offsetLeft+"px",this.offsetTipElm(),this.target.deviceInfo.isPc){this.pcElms.tipContainerPopoverElm||(this.pcElms.tipContainerPopoverElm=document.createElement("div"),updateElmClass(this.pcElms.tipContainerPopoverElm,"chat-tip-dialog",!0)),this.pcElms.tipPopoverElm||(this.pcElms.tipPopoverElm=document.createElement("div")),updateElmClass(this.pcElms.tipPopoverElm,"chat-tip-popover",!0),this.pcElms.tipPopoverElm.innerHTML=`\n <div class="chat-tip-popover-main">\n <span class="chat-tip-popover-txt">${t.popoverLabel||"--"}</span>\n <span class="chat-tip-popover-code ${t.codeLabel?"":"chat-view-show"}">${t.codeLabel||"--"}</span>\n </div>\n <div class="chat-tip-popover-arrow"></div>\n `,this.pcElms.tipContainerPopoverElm.appendChild(this.pcElms.tipPopoverElm),domItVisible(this.pcElms.tipPopoverElm);const{elm:e}=this.target.options;e.parentElement&&(e.nextElementSibling?e.parentElement.insertBefore(this.pcElms.tipContainerPopoverElm,e.nextElementSibling):e.parentElement.appendChild(this.pcElms.tipContainerPopoverElm))}this.target.chatEvent.triggerChatEvent("tipTagState",!0)}offsetTipElm(){if(this.tipElm){const t=this.richText.children[0].children[0];t.style.paddingLeft=this.rects.tipRect.width-t.offsetLeft+"px",this.target.nextTick(()=>{if(this.tipElm){const t=this.tipElm.children[0],e=this.richText.children[0].children[0];t.style.transform=`translateY(${e.offsetTop-this.target.chatInput.NODE_PADDING_DIFF}px)`}})}}removeTipElm(){this.tipElm&&(this.target.options.elm.removeChild(this.tipElm),this.tipElm=null),this.pcElms.tipContainerPopoverElm&&(this.pcElms.tipContainerPopoverElm.removeChild(this.pcElms.tipPopoverElm),this.target.options.elm.parentElement.removeChild(this.pcElms.tipContainerPopoverElm),this.pcElms.tipContainerPopoverElm=null,this.pcElms.tipPopoverElm=null);const t=this.richText.children[0].children[0];this.placeholderElm.style.removeProperty("padding-left"),t.style.removeProperty("padding-left"),this.target.chatInput.setRangeLastText(),this.target.chatEvent.triggerChatEvent("tipTagState",!1)}}class ChatInput{constructor(t){__publicField(this,"target"),__publicField(this,"richText"),__publicField(this,"vnode"),__publicField(this,"cursorIndex"),__publicField(this,"cursorLeft"),__publicField(this,"needCallSpace",!1),__publicField(this,"VOID_KEY","\ufeff"),__publicField(this,"ZERO_WIDTH_KEY",""),__publicField(this,"INPUT_TAG_WRAP_KEY","\n"),__publicField(this,"NODE_HEIGHT",24),__publicField(this,"NODE_PADDING_DIFF",10),__publicField(this,"IME_RECORD",{MARK:void 0,GRID:void 0,TAG:void 0,NODE:void 0,INDEX:void 0}),this.target=t,this.richText=t.chatElement.richText,this.initEditor()}initEditor(t=!1,e){if(t||this.getNodeEmpty(this.richText)){this.richText.innerHTML="";const i=this.getGridElm();this.richText.appendChild(i);const n=i.children[0].children[0];e&&(n.textContent=e,n.setAttribute("data-set-empty","false"));const s=n.childNodes[0];t||this.target.options.autoFocus?this.restCursorPos(s,s.textContent===this.VOID_KEY?1:s.textContent.length):(this.vnode=s,this.cursorIndex=s.textContent===this.VOID_KEY?1:s.textContent.length),this.target.nextTick(()=>{const t=i.getBoundingClientRect();this.NODE_HEIGHT=t.height,this.NODE_PADDING_DIFF=t.top-this.target.options.elm.getBoundingClientRect().top})}}onceCall(t){return new Promise(e=>{const i=this.createChatTagElm(t,"@","at-user","user-id");this.replaceRegContent(i),e()})}onceSearchCall(t,e){return new Promise(i=>{const n=this.createChatTagElm(t,"@","at-user","user-id");this.replaceRegContent(n,e),i()})}onceCustomCall(t,e,i){return new Promise(n=>{const s=this.createChatTagElm(t,i,"at-tag","tag-id");s.children[0].setAttribute("data-set-prefix",i),this.replaceRegContent(s,e),n()})}upDataNodeOrIndex(){var t,e,i;const{focusNode:n,focusOffset:s,anchorOffset:a}=window.getSelection(),l=(null==n?void 0:n.parentNode)||void 0;if(!l||!l.getAttribute||l.getAttribute("data-set-richType")!==RICH_INPUT)return;(null==(i=null==(e=null==(t=null==n?void 0:n.parentNode)?void 0:t.parentNode)?void 0:e.parentNode)?void 0:i.parentNode)===this.richText&&(this.vnode=n,this.cursorIndex=s,this.cursorLeft=a<s?a:s)}keyUpAsKey(t){if(this.upDataNodeOrIndex(),!this.vnode||this.vnode.nodeType!==Node.TEXT_NODE)return!1;const e=this.vnode.textContent||"",i=new RegExp(`${t}([^${t}\\s]*)$`),n=e.slice(0,this.cursorIndex),s=i.exec(n);return s&&2===s.length&&n[n.length-1]===t}getRangeRect(){let t=0,e=0;const i=window.getSelection();if(i.focusNode.nodeType!==Node.TEXT_NODE)return null;const n=i.getRangeAt(0).getClientRects()[0];return n&&(t=n.x,e=n.y),{x:t,y:e}}createChatTagElm(t,e,i,n){const s=document.createElement("span");return s.className=i,s.setAttribute(`data-${n}`,String(t.id)),s.textContent=`${e}${t.name}${this.needCallSpace?" ":""}`,this.createNewDom(s)}createNewDom(t){const e=document.createElement("span");return e.className="chat-tag",e.setAttribute("contenteditable","false"),e.setAttribute("data-set-richType",RICH_TAG),e.appendChild(t),e}restCursorPos(t,e){null==e?e=t.textContent===this.VOID_KEY?1:0:e>t.textContent.length&&(e=t.textContent.length);const i=new Range;i.setStart(t,e),i.setEnd(t,e);const n=window.getSelection();n&&(this.vnode=t,this.cursorIndex=e,this.cursorLeft=e,n.removeAllRanges(),n.addRange(i))}replaceRegContent(t,e=!0){const i=this.vnode.textContent;let n;n="boolean"==typeof e?i.slice(0,e?this.cursorIndex-1:this.cursorIndex):i.slice(0,e-1),0===n.length?(this.vnode.parentElement.setAttribute("data-set-empty","true"),this.vnode.textContent=this.VOID_KEY):this.vnode.textContent=n;let s=i.slice(this.cursorIndex);const a=this.vnode.parentNode.parentNode,l=a.nextSibling;l?a.parentNode.insertBefore(t,l):a.parentNode.appendChild(t);const o=t.previousSibling.childNodes[0],r=o.childNodes[1];r&&o.removeChild(r);const c=this.getGridElm(!0),h=c.childNodes[0];s&&s!==this.VOID_KEY&&(h.setAttribute("data-set-empty","false"),h.innerHTML=s);const d=h.childNodes[1];t.nextSibling?(d&&h.removeChild(d),a.parentNode.insertBefore(c,t.nextSibling)):a.parentNode.appendChild(c),this.restCursorPos(h.childNodes[0])}batchReplaceRegContent(t=[],e=!0){return new Promise(i=>{let n=`<span data-set-richType="${RICH_MARK}"><span class="chat-grid-input" data-set-richType="${RICH_INPUT}" data-set-empty="true">${this.VOID_KEY}</span></span>`;t.forEach(t=>{n+=`<span class="chat-tag" contenteditable="false" data-set-richType="${RICH_TAG}"><span class="at-user" data-user-id="${t.id}" contentEditable="false">@${t.name}${this.needCallSpace?" ":""}</span></span><span data-set-richType="${RICH_MARK}"><span class="chat-grid-input" data-set-richType="${RICH_INPUT}" data-set-empty="true">${this.VOID_KEY}</span></span>`});const s=document.createElement("div");s.innerHTML=n,this.insetRangeGrid(s,e?1:0),i()})}switchRange(t){var e,i;let{focusNode:n,focusOffset:s}=window.getSelection();n.getAttribute&&n.getAttribute("data-set-richType")===RICH_INPUT&&(n=n.childNodes[0]);let a,l,o=!1;if(n.nodeType===Node.TEXT_NODE){const r=n.textContent.length,c=n.parentNode.parentNode;switch(t){case"ArrowLeft":if(s>0&&n.textContent!==this.VOID_KEY){l=s-1,a=n;break}const t=c.previousSibling;if(t&&t.children[0].classList.contains("at-input")){a=t.children[0].children[0].childNodes[0],l=a.textContent===this.VOID_KEY?1:a.textContent.length,o=!0;break}const h=null==(e=null==c?void 0:c.previousSibling)?void 0:e.previousSibling;if(h)a=h.childNodes[0].childNodes[0],l=a.textContent.length;else{const t=c.parentNode.previousSibling;if(t){a=t.lastChild.childNodes[0].childNodes[0],l=a.textContent.length}}break;case"ArrowRight":if(s<r&&n.textContent!==this.VOID_KEY){l=s+1,a=n;break}const d=c.nextSibling;if(d&&d.children[0].classList.contains("at-input")){a=d.children[0].children[0].childNodes[0],l=a.textContent===this.VOID_KEY?1:0,o=!0;break}const p=null==(i=null==c?void 0:c.nextSibling)?void 0:i.nextSibling;if(p)a=p.childNodes[0].childNodes[0],l=a.textContent===this.VOID_KEY?1:0;else{const t=c.parentNode.nextSibling;t&&(a=t.childNodes[0].childNodes[0].childNodes[0],l=a.textContent===this.VOID_KEY?1:0)}}}(l||0===l)&&(o?this.setInputTagRange(a,l):this.restCursorPos(a,l))}getGridElm(t=!1){const e=document.createElement("span");if(e.setAttribute("data-set-richType",RICH_MARK),e.innerHTML=`<span class="chat-grid-input" data-set-richType="${RICH_INPUT}" data-set-empty="true">${this.VOID_KEY}<br></span>`,t)return e;const i=document.createElement("p");return i.className="chat-grid-wrap",i.setAttribute("data-set-richType",RICH_GRID),i.appendChild(e),i}updateGrid(){const t=window.getSelection(),e=t.focusNode;if(!e)return;const i=e.parentNode;let n,s,a,l;switch(i.getAttribute("data-set-richType")){case RICH_WRAP:if(n=e.childNodes[t.focusOffset],!n||n.getAttribute("data-set-richType")===RICH_TAG){const t=this.getGridElm(!0),i=t.children[0];n?(i.removeChild(i.childNodes[1]),e.insertBefore(t,n)):e.appendChild(t),this.restCursorPos(i.childNodes[0]);break}if(n.tagName&&"BR"===n.tagName.toLocaleUpperCase()){const t=this.getGridElm(!0),i=t.children[0];e.insertBefore(t,n),e.removeChild(n),t.nextElementSibling&&t.children[0].removeChild(t.children[0].childNodes[1]),this.restCursorPos(i.childNodes[0],i.childNodes[0].textContent.length)}break;case RICH_MARK:const o=i.parentNode,r=Array.prototype.indexOf.call(o.childNodes,i);if(-1===r)break;if(0===r){const e=t.focusNode;e.setAttribute("data-set-empty","true"),e.innerHTML=`${this.VOID_KEY}<br>`,n=e.childNodes[0],this.restCursorPos(n,n.textContent.length);break}let c,h=i.previousSibling;h.getAttribute("data-set-richType")===RICH_TAG?(c=h.previousSibling,o.removeChild(h),o.removeChild(i)):(c=i.previousSibling,o.removeChild(i));n=c.childNodes[0].childNodes[0],n.textContent===this.VOID_KEY&&n.parentNode.appendChild(document.createElement("br")),this.restCursorPos(n,n.textContent.length);break;case RICH_INPUT:if(l=i.parentNode,a=l.parentNode,this.getNodeEmpty(i)){i.setAttribute("data-set-empty","true"),a.childNodes[a.childNodes.length-1]===l&&(i.innerHTML=`${this.VOID_KEY}<br>`),n=i.childNodes[0],this.restCursorPos(n,n.textContent.length);break}if("true"===String(i.getAttribute("data-set-empty"))){i.setAttribute("data-set-empty","false"),n=i.childNodes[0],this.target.chatEvent.isIMEModel?(i.childNodes[1]&&i.removeChild(i.childNodes[1]),n.textContent===this.VOID_KEY&&i.setAttribute("data-set-empty","true")):i.textContent=n.textContent.replace(new RegExp(this.VOID_KEY,"g"),"");const t=i.childNodes[0];this.restCursorPos(t,t.textContent.length)}if(s=i.parentNode.nextSibling,s&&s.nodeType===Node.TEXT_NODE){let t=s.textContent,e=this.getGridElm(!0);e.childNodes[0].textContent=t,e.childNodes[0].setAttribute("data-set-empty","false"),s.parentNode.insertBefore(e,s),s.parentNode.removeChild(s),s=e}s&&s.getAttribute("data-set-richType")===RICH_MARK&&this.markMerge(i.parentNode,s)}}getNodeEmpty(t){const e=new RegExp(`^(${this.ZERO_WIDTH_KEY}|<br>|${this.VOID_KEY})+$`);return!t.innerHTML||e.test(t.innerHTML)}setWrap(t=!0){const e=window.getSelection();let{focusNode:i,focusOffset:n}=e;if(i.nodeType!==Node.TEXT_NODE){if(!i.getAttribute||i.getAttribute("data-set-richType")!==RICH_INPUT)return;i=i.childNodes[0]}const s=i.textContent.slice(n),a=i.parentNode.parentNode,l=a.parentNode,o=Array.prototype.indexOf.call(l.childNodes,a),r=Array.prototype.slice.call(l.childNodes,o+1),c=this.getGridElm();let h=c.children[0].children[0].childNodes[0];(s||r.length>0)&&h.parentNode.removeChild(h.parentNode.childNodes[1]),s&&s!==this.VOID_KEY&&(i.textContent=i.textContent.slice(0,n),h.textContent=s,h.parentElement.setAttribute("data-set-empty","false")),r.forEach(t=>{l.removeChild(t),c.appendChild(t)});const d=l.lastChild.childNodes[0],p=c.lastChild.childNodes[0];if(d.childNodes.length<=1){const t=d.childNodes[0];t.textContent&&t.textContent!==this.VOID_KEY||(d.innerHTML=`${this.VOID_KEY}<br>`,d.setAttribute("data-set-empty","true"))}if(p.parentElement.getAttribute("data-set-richType")!==RICH_MARK)c.appendChild(this.getGridElm(!0));else if(p.childNodes.length<=1){const t=p.childNodes[0];t.textContent&&t.textContent!==this.VOID_KEY||(p.innerHTML=`${this.VOID_KEY}<br>`,p.setAttribute("data-set-empty","true"),h=c.children[0].children[0].childNodes[0])}l.nextSibling?this.richText.insertBefore(c,l.nextSibling):this.richText.appendChild(c),t&&this.restCursorPos(h,h.textContent===this.VOID_KEY?1:0)}selectAll(){const t=document.createRange(),e=this.richText.children[0].children[0].childNodes[0].childNodes[0],i=this.richText.lastElementChild.lastElementChild.childNodes[0].childNodes[0];t.setStart(e,0),t.setEnd(i,i.textContent.length);const n=window.getSelection();n.removeAllRanges(),n.addRange(t)}selectRegionMerge(){const t=window.getSelection();if(t.isCollapsed||t.rangeCount<=0)return;const e=t.getRangeAt(0);if(e.startContainer.nodeType===Node.TEXT_NODE&&e.startContainer===e.endContainer){const t=e.startContainer;if(t.length===e.endOffset-e.startOffset){const e=t.parentNode,i=e.parentNode===e.parentNode.parentNode.lastChild;e.setAttribute("data-set-empty","true"),e.innerHTML="\ufeff"+(i?"<br>":""),this.restCursorPos(e.childNodes[0])}else e.deleteContents()}else if(e.commonAncestorContainer&&e.commonAncestorContainer.getAttribute("data-set-richType")===RICH_GRID){const t=e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentNode.parentNode:e.startContainer,i=e.endContainer.nodeType===Node.TEXT_NODE?e.endContainer.parentNode.parentNode:e.endContainer;e.deleteContents(),t.getAttribute("data-set-richType")===i.getAttribute("data-set-richType")&&this.markMerge(t,i)}else if(e.commonAncestorContainer===e.startContainer&&e.startContainer===e.endContainer)this.initEditor(!0);else{const t=t=>{if(t.nodeType===Node.TEXT_NODE)return t.parentNode.parentNode.parentNode;switch(t.getAttribute("data-set-richType")){case RICH_INPUT:return t.parentNode.parentNode;case RICH_MARK:return t.parentNode;case RICH_GRID:return t;default:return null}},i=t(e.startContainer),n=t(e.endContainer);if(!i||!n)return;e.deleteContents(),this.gridMerge(i,n)}return!0}gridElmMerge(){const t=window.getSelection(),{focusNode:e,focusOffset:i,isCollapsed:n}=t;if(!e)return this.restCursorPos(this.vnode,this.cursorIndex),!1;if(i>1)return!1;if(!n)return!1;const s=(t,e)=>(t.parentNode===this.richText||t===t.parentNode.childNodes[0])&&(-1!==Array.prototype.indexOf.call(this.richText.childNodes,t)?t:!(e>=6)&&s(t.parentNode,e+1)),a=s(e,0);if(!a||a===this.richText.childNodes[0]||1===i&&"false"===a.children[0].children[0].getAttribute("data-set-empty"))return!1;const l=a.previousSibling;return this.gridMerge(l,a),!0}delMarkRule(){const t=window.getSelection(),e=t.focusNode;if(!e)return this.restCursorPos(this.vnode,this.cursorIndex),!1;const i=e.textContent,n=e.parentNode,s=n.parentNode,a=s.parentNode;if(!t.isCollapsed||n.getAttribute("data-set-richType")!==RICH_INPUT)return!1;if(i&&1===i.length&&s!==a.childNodes[0]&&(0!==t.focusOffset||i===this.VOID_KEY)){if(i===this.VOID_KEY){const t=s.previousSibling;if(t.children[0].classList.contains("at-input")&&t.children[0].children[0].textContent!==this.VOID_KEY)return this.rangeToInputTag(t.children[0]),!0;const e=t.previousSibling;a.removeChild(t),a.removeChild(s);const i=e.childNodes[0],n=i.childNodes[0];n.textContent===this.VOID_KEY&&e===a.lastChild&&i.appendChild(document.createElement("br")),this.restCursorPos(n,n.textContent.length)}else{n.innerHTML=s===a.lastChild?`${this.VOID_KEY}<br>`:this.VOID_KEY,n.setAttribute("data-set-empty","true");const t=n.childNodes[0];this.restCursorPos(t,1)}return!0}if(0===t.focusOffset){const t=n.parentNode,e=null==t?void 0:t.previousSibling;return!(!e||e.getAttribute("data-set-richType")!==RICH_TAG)&&(e.children[0].classList.contains("at-input")&&e.children[0].children[0].textContent!==this.VOID_KEY?(this.rangeToInputTag(e.children[0]),!0):(this.delTag(e),!0))}}delTag(t){const e=t.previousSibling,i=t.nextSibling;t.parentNode.removeChild(t),this.markMerge(e,i)}gridMerge(t,e,i=!0){t.lastChild.getAttribute("data-set-richType")!==RICH_MARK&&t.appendChild(this.getGridElm(!0)),e.childNodes[0].getAttribute("data-set-richType")!==RICH_MARK&&e.insertBefore(this.getGridElm(!0),e.childNodes[0]);const n=t.lastChild.childNodes[0],s=n.childNodes[0];let a=s.textContent.length;Array.from(e.childNodes,e=>{t.appendChild(e.cloneNode(!0))}),e.childNodes.length>1&&n.childNodes[1]&&n.removeChild(n.childNodes[1]);const l=n.parentNode.nextSibling;if(l){const e=l.children[0].childNodes[0];e&&e.textContent!==this.VOID_KEY&&(n.childNodes[1]&&n.removeChild(n.childNodes[1]),s.textContent=(s.textContent+e.textContent).replace(new RegExp(this.VOID_KEY,"g"),()=>(a--,"")),s.parentElement.setAttribute("data-set-empty","false")),t.removeChild(l)}""===s.textContent&&(s.textContent=this.VOID_KEY,s.parentNode.setAttribute("data-set-empty","true"),a=1),this.richText.removeChild(e),i&&this.restCursorPos(s,a)}markMerge(t,e){const i=t.children[0].childNodes[0];let n=i.textContent.length;if(e){const t=e.children[0].childNodes[0];t&&t.textContent!==this.VOID_KEY&&(i.textContent=(i.textContent+t.textContent).replace(new RegExp(this.VOID_KEY,"g"),()=>(n--,"")),i.parentElement.setAttribute("data-set-empty","false")),e.parentNode.removeChild(e)}""===i.textContent&&(i.textContent=this.VOID_KEY,i.parentNode.setAttribute("data-set-empty","true"),n=1);const s=t.parentNode;i.textContent===this.VOID_KEY&&t===s.lastChild&&(i.parentNode.appendChild(document.createElement("br")),i.parentNode.setAttribute("data-set-empty","true"),n=1),this.restCursorPos(i,n)}setCallSpace(t){this.needCallSpace=t}getWrapNode(t,e=!1){if(t.nodeType===Node.TEXT_NODE)return t.parentNode.parentNode.parentNode;const i=t.getAttribute("data-set-richType");if(e&&i===RICH_TAG)return t.parentNode;switch(i){case RICH_INPUT:return t.parentNode.parentNode;case RICH_MARK:return t.parentNode;case RICH_GRID:return t}}getMarkNode(t,e=!1){if(t.nodeType===Node.TEXT_NODE)return t.parentNode?t.parentNode.parentNode:null;const i=t.getAttribute("data-set-richType");if(e&&i===RICH_TAG)return t;switch(i){case RICH_INPUT:return t.parentNode;case RICH_MARK:return t}}getRichTextNodeIndex(t){const e=this.getMarkNode(t),i=e?e.parentNode:null;return e&&i?{gridIndex:Array.prototype.indexOf.call(this.richText.childNodes,i),markIndex:Array.prototype.indexOf.call(i.childNodes,e)}:{gridIndex:null,markIndex:null}}setWrapNodeByMark(t){const e=document.createElement("p");return e.className="chat-grid-wrap",e.setAttribute("data-set-richType",RICH_GRID),Array.from(t,t=>{e.appendChild(t)}),e}setRangeLastText(){const t=this.richText.childNodes[this.richText.childNodes.length-1],e=t.childNodes[t.childNodes.length-1].children[0].childNodes[0];this.restCursorPos(e,e.textContent===this.VOID_KEY?1:e.textContent.length),this.viewIntoPoint()}viewIntoPoint(){let t,e;const i=window.getSelection(),{focusNode:n,focusOffset:s}=i;if(n&&n.parentElement&&n.parentElement.classList.contains("input-write"))t=n.parentElement.parentElement,e=s;else{if(!this.vnode)return;t=this.getMarkNode(this.vnode),e=this.cursorIndex}if(!t)return;const a=t.getBoundingClientRect(),l=Math.ceil(a.height/this.NODE_HEIGHT),o=Math.floor(t.textContent.length/l)||1,r=(Math.floor(e/o)||1)*this.NODE_HEIGHT,c=a.top+(r-this.NODE_HEIGHT),h=this.richText.parentElement,d=h.getBoundingClientRect(),p=d.top,g=d.top+d.height;if(c<p+this.NODE_PADDING_DIFF){const t=p-c;h.scrollTo(0,h.scrollTop-t)}else if(c>g-this.NODE_HEIGHT){const t=c-g+this.NODE_HEIGHT;h.scrollTo(0,h.scrollTop+t)}}insetRangeGrid(t,e=0){const i=this.vnode.textContent,n=i.slice(0,this.cursorIndex-e);0===n.length?(this.vnode.parentElement.setAttribute("data-set-empty","true"),this.vnode.textContent=this.VOID_KEY):this.vnode.textContent=n;let s=i.slice(this.cursorIndex);const a=[],l=document.createDocumentFragment();Array.from(t.children).forEach((t,e)=>{a.push(t),0!==e&&l.appendChild(t)});const o=a[a.length-1].children[0];s&&s.length>0&&s!==this.VOID_KEY?(o.setAttribute("data-set-empty","false"),o.textContent=o.textContent+s):o.setAttribute("data-set-empty","true");const r=this.getMarkNode(this.vnode),c=r.parentElement,h=r.children[0],d=a[0].textContent;d&&d.length>0&&d!==this.VOID_KEY&&(h.setAttribute("data-set-empty","false"),h.textContent=(h.textContent+d).replace(new RegExp(this.VOID_KEY,"g"),"")),h.childNodes[1]&&h.removeChild(h.childNodes[1]),r.nextElementSibling?(o.childNodes[1]&&o.removeChild(o.childNodes[1]),c.insertBefore(l,r.nextElementSibling)):c.appendChild(l);const p=s&&s!==this.VOID_KEY?s.length:0;if(a.length>1){const t=o.childNodes[0];this.restCursorPos(t,t.textContent===this.VOID_KEY?1:t.textContent.length-p)}else{const t=h.childNodes[0];this.restCursorPos(t,t.textContent===this.VOID_KEY?1:t.textContent.length-p)}}insetRangeGrids(t){const e=document.createDocumentFragment();Array.from(t).forEach(t=>{e.appendChild(t)});const i=this.getWrapNode(this.vnode);this.restCursorPos(this.vnode,this.cursorIndex),this.setWrap(!1);const n=i.nextElementSibling;n&&this.richText.insertBefore(e,n);n&&n.previousElementSibling?(this.gridMerge(i,i.nextElementSibling,!1),this.gridMerge(n.previousElementSibling,n,!0)):this.gridMerge(i,i.nextElementSibling,!0)}getOffsetRange(t,e,i=!1){const n=e.children[0].childNodes[0],s=n.textContent;if(0===t)return{rangeNode:n,rangeIndex:i?s.length:s===this.VOID_KEY?1:0};if(s!==this.VOID_KEY&&s.length>=t)return{rangeNode:n,rangeIndex:i?s.length-t:t};let a,l;if(i?(a=Boolean(e.previousElementSibling&&e.previousElementSibling.previousElementSibling),l=Boolean(e.parentElement.previousElementSibling)):(a=Boolean(e.nextElementSibling&&e.nextElementSibling.nextElementSibling),l=Boolean(e.parentElement.nextElementSibling)),!a&&!l)return{rangeNode:n,rangeIndex:i?s.length===this.VOID_KEY?1:0:s.length===this.VOID_KEY?1:s.length};const o=t-s.length,r=i?a?e.previousElementSibling.previousElementSibling:e.parentElement.previousElementSibling.lastElementChild:a?e.nextElementSibling.nextElementSibling:e.parentElement.nextElementSibling.children[0];return this.getOffsetRange(o,r,i)}rangeToInputTag(t){const e=t.children[0].childNodes[0];this.setInputTagRange(e,e.textContent===this.VOID_KEY?1:e.textContent.length)}watchInputTag(t){if(0===t.childNodes.length||0===t.textContent.length)t.textContent=this.VOID_KEY,this.rangeToInputTag(t.parentElement);else{const e=t.childNodes[0];this.target.nextTick(()=>{if(!this.target.chatEvent.isComposition){const i=window.getSelection().focusOffset,n=t.textContent===this.VOID_KEY||-1===t.textContent.indexOf(this.VOID_KEY)?0:1;let s=!1;1===n&&(e.textContent=e.textContent.replace(this.VOID_KEY,""),s=!0),-1!==t.textContent.indexOf(this.INPUT_TAG_WRAP_KEY[1])&&(t.textContent=t.textContent.replace(new RegExp(this.INPUT_TAG_WRAP_KEY[0],"g"),"").replace(new RegExp(this.INPUT_TAG_WRAP_KEY[1],"g"),this.INPUT_TAG_WRAP_KEY),s=!0),s&&this.setInputTagRange(t.childNodes[0],i-n)}})}domItVisible(t.nextElementSibling,t.textContent===this.VOID_KEY,"inline")}backRuleInputTag(t){if(t.textContent===this.VOID_KEY)return this.delTag(t.parentElement.parentElement),!0;const e=window.getSelection();if(0===e.focusOffset&&e.isCollapsed){const e=t.parentElement.parentElement.previousElementSibling.children[0].childNodes[0];return this.restCursorPos(e,e.textContent===this.VOID_KEY?1:e.textContent.length),!0}if(-1!==e.focusNode.textContent.indexOf(this.INPUT_TAG_WRAP_KEY[1])){const t=this.getDiffInputTagOffset(e.focusNode,e.focusOffset,"left");if(t>0){const i=e.focusNode.textContent.slice(0,e.focusOffset-1-t),n=e.focusNode.textContent.slice(e.focusOffset);return e.focusNode.textContent=i+n,e.focusNode.textContent?this.setInputTagRange(e.focusNode,i.length):(e.focusNode.textContent=this.VOID_KEY,this.watchInputTag(e.focusNode.parentElement),this.setInputTagRange(e.focusNode,1)),!0}}return!1}mergeRuleInputTag(t){this.target.nextTick(()=>{t.childNodes.length>1&&(t.removeChild(t.childNodes[1]),this.watchInputTag(t))})}inputTagSwitchRange(t){const{focusNode:e,focusOffset:i}=window.getSelection(),n=e.textContent.length,s=e.parentElement.parentElement.parentElement;let a,l,o,r=!1;switch(t){case"ArrowLeft":i>0&&e.textContent!==this.VOID_KEY?(o=this.getDiffInputTagOffset(e,i,"left"),l=i-1-o,a=e):(a=s.previousElementSibling.children[0].childNodes[0],l=a.textContent===this.VOID_KEY?1:a.textContent.length,r=!0);break;case"ArrowRight":i<n&&e.textContent!==this.VOID_KEY?(o=this.getDiffInputTagOffset(e,i,"right"),l=i+1+o,a=e):(a=s.nextElementSibling.children[0].childNodes[0],l=a.textContent===this.VOID_KEY?1:0,r=!0)}r?this.restCursorPos(a,l):this.setInputTagRange(a,l)}setInputTagRange(t,e){const i=new Range;i.setStart(t,e),i.setEnd(t,e);const n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(i))}pasteInputTag(t){t=t.replace(new RegExp(this.INPUT_TAG_WRAP_KEY[0],"g"),"").replace(new RegExp(this.INPUT_TAG_WRAP_KEY[1],"g"),this.INPUT_TAG_WRAP_KEY);const e=window.getSelection(),{focusNode:i,focusOffset:n,anchorOffset:s}=e;let a="",l="";e.isCollapsed?(a=i.textContent.slice(0,n)||"",l=i.textContent.slice(n)||""):(a=i.textContent.slice(0,s<n?s:n)||"",l=i.textContent.slice(n>s?n:s)||""),i.textContent=a+t+l,this.setInputTagRange(i,(s<n?s:n)+t.length);const o=i.parentElement;this.watchInputTag(o)}setInputTagWrap(t){const e=window.getSelection(),{focusOffset:i}=e,n=t.textContent,s=n.slice(0,i),a=n.slice(i);t.textContent=s+this.INPUT_TAG_WRAP_KEY+a,this.setInputTagRange(t.childNodes[0],i+this.INPUT_TAG_WRAP_KEY.length),this.watchInputTag(t)}getDiffInputTagOffset(t,e,i){const n="left"===i?t.textContent[e-1]:t.textContent[e];if(-1===this.INPUT_TAG_WRAP_KEY.indexOf(n))return 0;switch(i){case"left":return t.textContent[e-2]===this.INPUT_TAG_WRAP_KEY[1]?2:t.textContent[e-2]===this.INPUT_TAG_WRAP_KEY[0]?3:1;case"right":return t.textContent[e+1]===this.INPUT_TAG_WRAP_KEY[1]?2:t.textContent[e+1]===this.INPUT_TAG_WRAP_KEY[0]?3:1}}}const DEFAULT_OPTIONS={device:"auto",autoFocus:!0,needDialog:!0,needDebounce:!0,asyncMatch:!1,userList:[],reformList:[],placeholder:"",maxLength:-1,copyType:["text"],uploadImage:void 0,needCallEvery:!0,needCallSpace:!1,userProps:{},customTrigger:[],dialogLabels:{pcPointDialog:{},pcPCheckDialog:{},h5Dialog:{}},wrapKeyFun:t=>t.ctrlKey&&["Enter"].includes(t.key),sendKeyFun:t=>!t.ctrlKey&&["Enter"].includes(t.key)},DEFAULT_USER_PROPS={id:"id",name:"name",avatar:"avatar",pinyin:"pinyin"},DEFAULT_PC_POINT_DIALOG={title:"群成员",callEveryLabel:"所有人",checkLabel:"多选",emptyLabel:"暂无数据"},DEFAULT_PC_CHECK_DIALOG={title:"选择要@的人",searchPlaceholder:"搜素人员名称",searchEmptyLabel:"没有匹配到任何结果",userTagTitle:"研讨成员列表",checkAllLabel:"全选",checkEmptyLabel:"请选择需要@的成员",confirmLabel:"确定",cancelLabel:"取消"},DEFAULT_H5_DIALOG={title:"选择提醒的人",callEveryLabel:"所有人",searchPlaceholder:"搜素人员名称",searchEmptyLabel:"没有匹配到任何结果",confirmLabel:"确定",cancelLabel:"收起"},DEFAULT_REDUCE_CONFIG={saveTagData:!1,needUserId:!1,needTagId:!1,needSelectId:!1,wrapClassName:void 0,rowClassName:void 0,imgToText:!1,identifyLink:!1},NotMergeKey=["Backspace","Shift","Tab","CapsLock","Control","Meta","Alt","ContextMenu","Enter","NumpadEnter","Escape","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Home","End","PageUp","PageDown","Insert","Delete","NumLock"],KEY_CODE_MAP={"`":192,"~":192,1:49,"!":49,3:51,"#":51,4:52,$:52,5:53,"%":53,6:54,"^":54,7:55,"&":55,8:56,"*":56,";":186,":":186,"/":191,"?":191,"\\":200,"|":200};class ChatEvent{constructor(t){__publicField(this,"target"),__publicField(this,"outerApply",!1),__publicField(this,"isComposition",!1),__publicField(this,"matchKey",0),__publicField(this,"startOpenIndex",0),__publicField(this,"textLength",0),__publicField(this,"isIMEModel",!1),__publicField(this,"takeIMEModel",!1),__publicField(this,"undoHistory",[]),__publicField(this,"redoHistory",[]),__publicField(this,"doOverHistory",!0),__publicField(this,"notMergeKey",NotMergeKey),__publicField(this,"chatEventModule",{enterSend:[],operate:[],defaultAction:[],atMatch:[],atCheck:[],tagCheck:[],selectCheck:[],tipTagState:[],afterAtCheck:[],afterTagCheck:[],afterSelectCheck:[],showAtDialog:[],showTagDialog:[],showSelectDialog:[],elementClicked:[]}),__publicField(this,"debounceEvents",{recordHistory:()=>{},dialogMoveToRange:t=>{},selectDialogToAim:()=>{},matchPointDialog:()=>{},movePointActiveUserElm:t=>{},moveCustomActiveTagElm:t=>{}}),this.target=t,this.registerEvent(),this.otherEvent()}registerEvent(){const{chatElement:t,options:e,deviceInfo:i,chatInput:n}=this.target;t.richText.addEventListener("keyup",s=>{if(!s.target.classList.contains("input-write"))if(s.stopPropagation(),i.isPc)if(50===+s.keyCode&&n.keyUpAsKey("@"))this.triggerChatEvent("showAtDialog"),e.needDialog&&t.ruleShowPointDialog();else{e.customTrigger.filter(t=>t.keyCode===s.keyCode).map(t=>t.prefix).forEach(i=>{n.keyUpAsKey(i)&&(this.triggerChatEvent("showTagDialog",i),e.needDialog&&t.showCustomTagDialog(i))})}else if((e.reformList.length>0||e.asyncMatch)&&n.keyUpAsKey("@"))this.triggerChatEvent("showAtDialog"),e.needDialog&&this.target.showH5Dialog(),t.isExternalCallPopup=!1;else{const t=e.customTrigger.map(t=>t.prefix),i=t.indexOf(s.key);-1!==i&&n.keyUpAsKey(t[i])&&this.triggerChatEvent("showTagDialog",s.key)}}),t.richText.addEventListener("keydown",s=>{const a=s.target.classList.contains("input-write");if(!i.isPc&&"Unidentified"===s.key&&229===s.keyCode)return a&&n.mergeRuleInputTag(s.target),void(this.isIMEModel=!0);if(!this.isIMEModel)if(hasElmShow(t.pcElms.pointDialogElm))["ArrowUp","ArrowDown","Enter","NumpadEnter"].includes(s.code)?s.preventDefault():["ArrowLeft","ArrowRight"].includes(s.code)&&t.exitPointDialog();else if(t.pcElms.customTagDialogTagKey&&hasElmShow(t.pcElms.customTagDialogElms[t.pcElms.customTagDialogTagKey]))["ArrowUp","ArrowDown","Enter","NumpadEnter"].includes(s.code)?s.preventDefault():["ArrowLeft","ArrowRight"].includes(s.code)&&t.exitCustomTagDialog();else if(this.isComposition||"Backspace"!==s.code&&"Backspace"!==s.key?e.wrapKeyFun(s)||!i.isPc&&"Enter"===s.key?(s.preventDefault(),this.isComposition||(a?n.setInputTagWrap(s.target):n.setWrap(),this.richTextInput())):e.sendKeyFun(s)?(s.preventDefault(),this.isComposition||this.triggerChatEvent("enterSend")):["ArrowLeft","ArrowRight"].includes(s.code)?(s.preventDefault(),this.isComposition||(a?n.inputTagSwitchRange(s.code):n.switchRange(s.code))):(s.ctrlKey||s.metaKey)&&"KeyA"===s.code?(s.preventDefault(),this.isComposition||this.target.isEmpty()||n.selectAll()):(s.ctrlKey||s.metaKey)&&"KeyZ"===s.code?(s.preventDefault(),this.isComposition||this.ruleChatEvent(()=>{this.target.undo()},"defaultAction","UNDO")):(s.ctrlKey||s.metaKey)&&"KeyY"===s.code&&(s.preventDefault(),this.isComposition||this.ruleChatEvent(()=>{this.target.redo()},"defaultAction","REDO")):a&&n.backRuleInputTag(s.target)||n.selectRegionMerge()||n.gridElmMerge()||n.delMarkRule()?(s.preventDefault(),this.richTextInput()):t.tipElm&&this.target.isEmpty()&&t.removeTipElm(),!s.ctrlKey&&!s.altKey&&!s.metaKey){const t=-1===this.notMergeKey.indexOf(s.key);a?(t||"Backspace"===s.code||"Backspace"===s.key)&&n.mergeRuleInputTag(s.target):t&&n.selectRegionMerge()}}),t.richText.addEventListener("beforeinput",e=>{const i=e.target.classList.contains("input-write");if(this.isIMEModel){if("insertParagraph"===e.inputType)return e.preventDefault(),i?n.setInputTagWrap(e.target):n.setWrap(),void this.richTextInput();if("deleteContentBackward"===e.inputType){this.takeIMEModel=!0,e.preventDefault();const s=t.richText.innerHTML,a=window.getSelection(),l=a.focusNode,o=a.focusOffset,r=i?l.parentElement.parentElement.parentElement:l.parentElement.parentElement,c=r.parentElement,h=Array.prototype.indexOf.call(t.richText.children,c),d=Array.prototype.indexOf.call(c.children,r);this.target.nextTick(()=>{t.richText.innerHTML=s;const e=t.richText.children[h].children[d],a=i?e.children[0].children[0].childNodes[0]:e.children[0].childNodes[0];i?(n.setInputTagRange(a,o),n.backRuleInputTag(a.parentElement)||(a.textContent=a.textContent.slice(0,o-1)+a.textContent.slice(o),n.setInputTagRange(a,o-1)),n.watchInputTag(a.parentElement)):(n.restCursorPos(a,o),n.selectRegionMerge()||n.gridElmMerge()||n.delMarkRule()||(a.textContent=a.textContent.slice(0,o-1)+a.textContent.slice(o),n.restCursorPos(a,o-1))),this.target.nextTick(async()=>{await this.richTextInput(),this.takeIMEModel=!1,this.isIMEModel=!1})})}}}),t.richText.addEventListener("input",async s=>{const a=s.target.classList.contains("input-write");if(this.isIMEModel){if(this.takeIMEModel)return;await this.target.nextTick(()=>{a&&n.watchInputTag(s.target),-1!==e.maxLength&&this.ruleMaxLength(),t.showPlaceholder(),this.triggerChatEvent("operate"),this.isIMEModel=!1})}else{if(a)return n.watchInputTag(s.target),void await this.richTextInput();await this.richTextInput(),i.isPc&&!this.isComposition&&this.debounceEvents.matchPointDialog()}}),t.richText.addEventListener("copy",t=>{t.preventDefault(),this.ruleChatEvent(()=>{this.copyRange(t)},"defaultAction","COPY")}),t.richText.addEventListener("cut",t=>{t.preventDefault(),this.ruleChatEvent(()=>{this.copyRange(t),this.removeRange(),t.target.classList.contains("input-write")&&this.target.chatInput.watchInputTag(t.target)},"defaultAction","CUT")}),t.richText.addEventListener("paste",t=>{t.preventDefault();const{options:e,chatInput:i}=this.target;this.ruleChatEvent(()=>{const n=t.clipboardData.getData("text/plain");if("string"==typeof n&&""!==n){if(-1===e.copyType.indexOf("text"))return;if(t.target.classList.contains("input-write"))return i.pasteInputTag(n),void this.richTextInput();let s=document.createElement("div");s.innerHTML=t.clipboardData.getData("application/my-custom-format")||"",i.selectRegionMerge(),s.children[0]&&s.children[0].getAttribute("data-set-richType")===RICH_GRID?this.insertInsideHtml(s.innerHTML):(s.innerHTML=n,this.target.insertText(s.innerText)),s=null}else{if(-1===e.copyType.indexOf("image"))return;const i=(t.clipboardData||t.originalEvent.clipboardData).items||[];Array.from(i,async t=>{if(-1===t.type.indexOf("image"))return;const i=t.getAsFile();if(e.uploadImage){const t=await e.uploadImage(i);this.target.insertHtml(`<img class="chat-img" src="${t}" alt="" />`)}else{const t=new FileReader;t.onload=t=>{this.target.insertHtml(`<img class="chat-img" src="${t.target.result}" alt="" />`)},t.readAsDataURL(i)}})}},"defaultAction","PASTE")}),t.richText.addEventListener("blur",()=>{n.upDataNodeOrIndex()}),t.richText.addEventListener("focus",()=>{n.upDataNodeOrIndex()}),t.richText.addEventListener("click",t=>{n.upDataNodeOrIndex();const i=upFindElm(t.target,5);if(i){const t=i.children[0];if(t.classList.contains("chat-grid-input"))return void this.triggerChatEvent("elementClicked","gridInput",t);if(t.classList.contains("at-input"))return t.children[0].textContent===n.VOID_KEY&&n.rangeToInputTag(t),void this.triggerChatEvent("elementClicked","inputTag",t);if(t.classList.contains("at-select")){const i=t.getAttribute("data-select-key");return this.triggerChatEvent("showSelectDialog",i,t),e.needDialog&&this.target.showPCSelectDialog(i,t),void this.triggerChatEvent("elementClicked","selectTag",t)}if(t.classList.contains("at-user"))return void this.triggerChatEvent("elementClicked","userTag",t);if(t.classList.contains("at-tag"))return void this.triggerChatEvent("elementClicked","customTag",t);if(t.classList.contains("chat-set-html"))return void this.triggerChatEvent("elementClicked","htmlTag",t.children[0])}}),t.richText.addEventListener("dragstart",t=>{t.stopPropagation(),t.preventDefault()}),t.richText.addEventListener("dragover",t=>{t.stopPropagation(),t.preventDefault()}),t.richText.addEventListener("drop",t=>{t.stopPropagation(),t.preventDefault()}),t.richText.addEventListener("compositionstart",()=>{this.isComposition=!0}),t.richText.addEventListener("compositionend",()=>{this.isComposition=!1}),window.addEventListener("click",this.winClick.bind(this)),window.addEventListener("keydown",this.winKeydown.bind(this))}otherEvent(){const{options:t,chatInput:e,chatElement:i}=this.target,{needDebounce:n}=t,s=()=>{const{gridIndex:t,markIndex:n}=e.getRichTextNodeIndex(e.vnode);if(null===t||null==n)return;const s={html:i.richText.innerHTML,gridIndex:t,markIndex:n,cursorIndex:e.cursorIndex};this.undoHistory.push(s),this.undoHistory.length>50&&this.undoHistory.shift()};this.debounceEvents.recordHistory=n?debounce(s,200):s;const a=t=>{let n="0",s="100%";const a=e.getRangeRect();if(!a)return;const l=i.pcElms.containerDialogElm.getBoundingClientRect();let o=a.x-l.x,r=l.y-a.y;const{clientWidth:c,clientHeight:h}=t;a.x>window.innerWidth-c-30&&(o=a.x-c-l.x-16,n="100%"),a.y<h&&(r-=h,s="0"),t.style.transform="translate(0, 0)",t.style.transformOrigin=`${n} ${s}`,t.style.left=o+6+"px",t.style.bottom=`${r}px`,t.style.opacity="1"};this.debounceEvents.dialogMoveToRange=n?debounce(a,120,!0):a;const l=()=>{if(!t.needDialog)return;const n=e.vnode.textContent||"",s=e.cursorIndex,a=n.slice(0,s);let l=-1,o=-1,r="userTag";if(-1!==a.lastIndexOf("@")&&(l=a.lastIndexOf("@")),i.pcElms.customTagDialogTagKey&&-1!==a.lastIndexOf(i.pcElms.customTagDialogTagKey)&&(o=a.lastIndexOf(i.pcElms.customTagDialogTagKey)),o>l&&(r="customTag"),"userTag"===r&&t.asyncMatch){if(l<0)return void i.exitPointDialog();this.matchKey++;const t=this.matchKey;this.startOpenIndex=l+1;const e=a.slice(this.startOpenIndex)||"";if(/\s/gi.test(e))return void i.exitPointDialog();this.target.updateUserList([]),domItVisible(i.pcElms.pointDialogLoadingElm,!0,"flex"),domItVisible(i.pcElms.pointDialogEmptyElm),i.showPointDialog();const n=this.triggerChatEvent("atMatch",e).find(t=>t&&t instanceof Promise);return void(n&&n.then(e=>{t===this.matchKey&&(domItVisible(i.pcElms.pointDialogLoadingElm),!e||e.length<=0?domItVisible(i.pcElms.pointDialogEmptyElm,!0,"flex"):(this.target.updateUserList(e),i.pcElms.pointDialogUsersElm&&i.pcElms.pointDialogUsersElm.length>0&&i.updatePointActiveUserElm(i.pcElms.pointDialogUsersElm[0].elm)))}))}if("userTag"===r&&t.reformList.length<=0)return void i.exitCustomTagDialog();if("customTag"===r&&i.customTags[i.pcElms.customTagDialogTagKey].length<=0)return;const c=()=>{"userTag"===r?i.exitPointDialog():i.exitCustomTagDialog()};if(l<0&&o<0)return i.exitPointDialog(),void i.exitCustomTagDialog();this.startOpenIndex="userTag"===r?l+1:o+1;const h=new RegExp(`^([${e.ZERO_WIDTH_KEY}${e.VOID_KEY}])+$`);if(!a||h.test(a)||s<this.startOpenIndex)return void c();const d=a.slice(this.startOpenIndex)||"";if(/\s/gi.test(d))c();else if(d)if("userTag"===r){const t=this.target.searchUserList(d);t.length>0?i.showPointDialog(t):c()}else{const t=i.customTags[i.pcElms.customTagDialogTagKey].filter(t=>pinyinMatch(t.name,t.pinyin||"",d));t.length>0?i.showCustomTagDialog(i.pcElms.customTagDialogTagKey,t):c()}else"userTag"===r?i.showPointDialog():i.showCustomTagDialog(i.pcElms.customTagDialogTagKey)};this.debounceEvents.matchPointDialog=n?debounce(l,200):l;this.debounceEvents.movePointActiveUserElm=throttle(t=>{if(!i.pcElms.pointDialogActiveElm)return;let e=0;const n=i.pcElms.pointDialogActiveElm.getAttribute("data-set-id");i.pcElms.pointDialogUsersElm.some(t=>{const i=t.elm.getAttribute("data-set-id");return e=t.index,n===i});const s=i.pcElms.pointDialogUsersElm.filter(t=>!t.elm.classList.contains("user-no-match")),a=s.map(t=>t.index);let l;"down"===t?l=e===s[s.length-1].index?s[0]:s[a.indexOf(e)+1]:"up"===t&&(l=e===s[0].index?s[s.length-1]:s[a.indexOf(e)-1]),l&&i.updatePointActiveUserElm(l.elm,!0)},80);this.debounceEvents.moveCustomActiveTagElm=throttle(t=>{if(!i.pcElms.customTagDialogActiveElm)return;const e=i.customTags[i.pcElms.customTagDialogTagKey].map(t=>t.id),n=i.pcElms.customTagDialogActiveElm.getAttribute("data-set-id"),s=e.indexOf(n),a=Array.from(i.pcElms.customTagDialogElms[i.pcElms.customTagDialogTagKey].children[1].children,(t,e)=>({elm:t,index:e})).filter(t=>!t.elm.classList.contains("tag-no-match")),l=a.map(t=>t.index);let o;"down"===t?o=s===a[a.length-1].index?a[0]:a[l.indexOf(s)+1]:"up"===t&&(o=s===a[0].index?a[a.length-1]:a[l.indexOf(s)-1]),o&&i.updateActiveCustomTagElm(o.elm,!0)},80);const o=()=>{const t=i.pcElms.selectDialogAim.getClientRects()[0],e=i.pcElms.selectDialogElms[i.pcElms.selectDialogKey];domItVisible(e,!0);const n=e.querySelector(".chat-select-arrow");let s=e.clientHeight+16;if(s>t.y?(s=-(t.height+16),n.style.top="-16px",n.style.bottom="auto",n.style.transform="rotate(0deg)"):(n.style.transform="rotate(180deg)",n.style.bottom="-16px",n.style.top="auto"),window.innerWidth-t.x<e.clientWidth){const i=e.clientWidth-(window.innerWidth-t.x)-10;e.style.left="auto",e.style.right="10px",n.style.left="auto",n.style.right=i-n.clientWidth/2+t.width/2+"px"}else e.style.left=t.x+"px",e.style.right="auto",n.style.left=t.width/2-n.clientWidth/2+"px",n.style.right="auto";e.style.top=t.y+"px",e.style.transform=`translateY(${-s}px)`;const a=e.querySelector(".chat-select-dialog-main"),l=e.querySelectorAll(".chat-select-dialog-item");let o=0,r=!1,c=0;if(i.pcElms.selectDialogAim.classList.contains("at-select")){const t=i.pcElms.selectDialogAim.getAttribute("data-select-id");updateElmClass(i.pcElms.selectDialogAim,"aim",!0),Array.from(l,e=>{const i=e.lastChild.lastChild,n=t===e.getAttribute("data-set-id");n&&(c=e.clientHeight,r=!0),n||r||(o+=e.clientHeight),domItVisible(i,n,"inline-block")});const e=o-a.clientHeight/2+c/2;a.scrollTop=e>0?e:0}else Array.from(l,t=>{domItVisible(t.lastChild.lastChild,!1,"inline-block")})};this.debounceEvents.selectDialogToAim=n?debounce(o,120):o;const r={html:i.richText.innerHTML,gridIndex:0,markIndex:0,cursorIndex:e.cursorIndex};this.undoHistory=[r]}winClick(){if(!this.target||this.outerApply)return;const{chatElement:t}=this.target;hasElmShow(t.pcElms.pointDialogElm)&&t.exitPointDialog(),t.pcElms.checkDialogSearchResultElm&&domItVisible(t.pcElms.checkDialogSearchResultElm),t.pcElms.customTagDialogTagKey&&hasElmShow(t.pcElms.customTagDialogElms[t.pcElms.customTagDialogTagKey])&&t.exitCustomTagDialog(),t.pcElms.selectDialogKey&&hasElmShow(t.pcElms.selectDialogElms[t.pcElms.selectDialogKey])&&t.exitSelectDialog()}async winKeydown(t){if(!this.target)return;const{chatElement:e,options:i}=this.target;if((t.ctrlKey||t.metaKey)&&"KeyZ"===t.code&&t.preventDefault(),!this.isComposition)if(hasElmShow(e.pcElms.pointDialogElm)){if("ArrowDown"===t.code)return t.preventDefault(),void this.debounceEvents.movePointActiveUserElm("down");if("ArrowUp"===t.code)return t.preventDefault(),void this.debounceEvents.movePointActiveUserElm("up");if(("Enter"===t.code||"NumpadEnter"===t.code)&&e.pcElms.pointDialogActiveElm){t.preventDefault();const n=e.pcElms.pointDialogActiveElm.getAttribute("data-set-id");if(await sleep(100),e.isPointSearchMode||i.asyncMatch)await this.target.matchSetTag(i.reformList.find(t=>t.id===n));else{const t=i.userList.find(t=>String(t[i.userProps.id])===n);await this.target.onceSetTag(t)}e.exitPointDialog()}}else if(e.pcElms.customTagDialogTagKey&&hasElmShow(e.pcElms.customTagDialogElms[e.pcElms.customTagDialogTagKey])){if("ArrowDown"===t.code)return t.preventDefault(),void this.debounceEvents.moveCustomActiveTagElm("down");if("ArrowUp"===t.code)return t.preventDefault(),void this.debounceEvents.moveCustomActiveTagElm("up");if(("Enter"===t.code||"NumpadEnter"===t.code)&&e.pcElms.customTagDialogActiveElm){t.preventDefault();const i=e.pcElms.customTagDialogActiveElm.getAttribute("data-set-id");await sleep(100);const n=e.customTags[e.pcElms.customTagDialogTagKey].find(t=>t.id===i);e.isPointSearchMode?await this.target.matchSetCustomTag(n):await this.target.onceSetCustomTag(n),e.exitCustomTagDialog()}}}async richTextInput(t=!0){const{chatInput:e,deviceInfo:i,chatElement:n,options:s}=this.target;return e.upDataNodeOrIndex(),i.isPc&&e.selectRegionMerge(),await this.target.nextTick(()=>{this.isComposition||e.updateGrid(),this.fixEditor()||(-1!==s.maxLength&&this.ruleMaxLength(),n.showPlaceholder(),this.triggerChatEvent("operate"),t&&this.doOverHistory&&!this.isComposition&&this.debounceEvents.recordHistory(),e.viewIntoPoint())}),!0}ruleMaxLength(){const{options:t,chatElement:e}=this.target;if(this.target.isEmpty()||-1===t.maxLength)return void(this.textLength=0);let i=0,n=0;const s=[];Array.prototype.some.call(e.richText.children,(e,a)=>{const{nodeInfos:l,nodeTextLength:o}=this.getGirdNodeTextInfo(e);if(i+=o,s.push(l),n=a,i>=t.maxLength)return!0});const a=[];Array.from(e.richText.children,(t,e)=>{e>n&&a.push(t)}),a.forEach(t=>e.richText.removeChild(t)),this.deepDelGirdText(s,i)}getGirdNodeTextInfo(t){const{chatInput:e}=this.target,i=[];let n=0;if(1===t.children.length&&t!==t.parentElement.children[0]){const s=t.children[0],a=(s.textContent||"").replace(new RegExp(e.VOID_KEY,"g"),"");n+=a.length||1,i[0]={node:s,textLength:a.length||1,type:RICH_MARK}}else Array.from(t.children,(t,s)=>{if(t.getAttribute("data-set-richType")===RICH_MARK){const a=(t.textContent||"").replace(new RegExp(e.VOID_KEY,"g"),"");n+=a.length,i[s]={node:t,textLength:a.length,type:RICH_MARK}}else{const a=(t.textContent||"").replace(new RegExp(e.VOID_KEY,"g"),"");n+=a.length||1,i[s]={node:t,textLength:a.length||1,type:RICH_TAG}}});return{nodeInfos:i,nodeTextLength:n}}deepDelGirdText(t,e){if(e>this.target.options.maxLength){const i=t[t.length-1];t.pop(),this.deepDelNode(i,t,e)}else this.textLength=e}deepDelNode(t,e,i){const n=t[0].node.parentElement;if(i>this.target.options.maxLength){let s=i-this.target.options.maxLength,a=t[t.length-1];if(a.type===RICH_MARK)if(0===a.textLength||s>=a.textLength)n.removeChild(a.node),t.pop(),s-=a.textLength,a=t[t.length-1],n.removeChild(a.node),t.pop(),s-=a.textLength;else{const t=a.node.childNodes[0];t.textContent=t.textContent.slice(0,a.textLength-s),0===t.textContent&&(t.setAttribute("data-set-empty","true"),t.innerHTML=`${this.target.chatInput.VOID_KEY}<br>`),s=0}else n.removeChild(a.node),t.pop(),s-=a.textLength;s>0?t.length>0?this.deepDelNode(t,e,s+this.target.options.maxLength):(this.target.chatElement.richText.appendChild(n),this.deepDelGirdText(e,s+this.target.options.maxLength)):(this.textLength=this.target.options.maxLength+s,this.target.chatInput.setRangeLastText())}}copyRange(t){const e=window.getSelection();if(e.isCollapsed||e.rangeCount<=0)return t.clipboardData.setData("application/my-custom-format",""),void t.clipboardData.setData("text/plain","");const{chatElement:i,chatInput:n}=this.target,s=e.toString()||"";let a=document.createElement("div");a.innerHTML=s;const l=a.innerText.replace(/\n\n/g,"\n");a=null,t.clipboardData.setData("text/plain",l);const o=e.anchorNode,r=e.focusNode;if(o===r&&o.nodeType===Node.TEXT_NODE)return void t.clipboardData.setData("application/my-custom-format",l);if(o===i.richText&&r===i.richText)return void t.clipboardData.setData("application/my-custom-format",i.richText.innerHTML);const c=n.getWrapNode(o,!0),h=n.getWrapNode(r,!0),d=n.getMarkNode(o,!0),p=n.getMarkNode(r,!0),g=d.getAttribute("data-set-richType")===RICH_MARK,m=p.getAttribute("data-set-richType")===RICH_MARK,u=Array.prototype.indexOf.call(c.childNodes,d),E=Array.prototype.indexOf.call(h.childNodes,p);if(c===h&&c.parentNode===i.richText){const i=u>E,s=Array.prototype.filter.call(c.childNodes,(t,e)=>i?e<u&&e>E:e>u&&e<E).map(t=>t.cloneNode(!0)),a=g?i?o.textContent.slice(0,e.anchorOffset):o.textContent.slice(e.anchorOffset):"",l=m?i?r.textContent.slice(e.focusOffset):r.textContent.slice(0,e.focusOffset):"",h=n.getGridElm(!0),d=n.getGridElm(!0);a&&(h.childNodes[0].innerHTML=a,h.childNodes[0].setAttribute("data-set-empty","false")),l&&(d.childNodes[0].innerHTML=l,d.childNodes[0].setAttribute("data-set-empty","false")),i?(s[0].getAttribute("data-set-richType")!==RICH_MARK&&s.unshift(d),s[s.length-1].getAttribute("data-set-richType")!==RICH_MARK&&s.push(h)):(s[0].getAttribute("data-set-richType")!==RICH_MARK&&s.unshift(h),s[s.length-1].getAttribute("data-set-richType")!==RICH_MARK&&s.push(d));let p=document.createElement("div");const C=n.setWrapNodeByMark(s);return p.appendChild(C),t.clipboardData.setData("application/my-custom-format",p.innerHTML),void(p=null)}if(c.parentNode===i.richText&&h.parentNode===i.richText){const s=Array.prototype.indexOf.call(i.richText.childNodes,c),a=Array.prototype.indexOf.call(i.richText.childNodes,h),l=s>a,d=Array.prototype.filter.call(i.richText.childNodes,(t,e)=>l?e<s&&e>a:e>s&&e<a).map(t=>t.cloneNode(!0)),p=g?l?o.textContent.slice(0,e.anchorOffset):o.textContent.slice(e.anchorOffset):"",C=m?l?r.textContent.slice(e.focusOffset):r.textContent.slice(0,e.focusOffset):"",f=n.getGridElm(!0),x=n.getGridElm(!0);p&&(f.childNodes[0].innerHTML=p,f.childNodes[0].setAttribute("data-set-empty","false")),C&&(x.childNodes[0].innerHTML=C,x.childNodes[0].setAttribute("data-set-empty","false"));const T=Array.prototype.filter.call(c.childNodes,(t,e)=>l?e<u:e>u).map(t=>t.cloneNode(!0)),y=Array.prototype.filter.call(h.childNodes,(t,e)=>l?e>E:e<E).map(t=>t.cloneNode(!0));if(l){T.push(f),y.unshift(x);const t=n.setWrapNodeByMark(T),e=n.setWrapNodeByMark(y);d.push(t),d.unshift(e)}else{T.unshift(f),y.push(x);const t=n.setWrapNodeByMark(T),e=n.setWrapNodeByMark(y);d.unshift(t),d.push(e)}let v=document.createElement("div");return Array.from(d,t=>{v.appendChild(t)}),t.clipboardData.setData("application/my-custom-format",v.innerHTML),void(v=null)}}removeRange(){const{chatInput:t,chatElement:e}=this.target;window.getSelection().getRangeAt(0).deleteContents(),this.target.nextTick(()=>{t.updateGrid(),e.showPlaceholder()})}async setChatHistory(t){const{chatElement:e,chatInput:i}=this.target;this.doOverHistory=!1;const{html:n,gridIndex:s,markIndex:a,cursorIndex:l}=t;e.richText.innerHTML=n;const o=e.richText.childNodes[s].childNodes[a].childNodes[0].childNodes[0];i.restCursorPos(o,l),await this.richTextInput(),this.doOverHistory=!0}async insertInsideHtml(t){const{chatInput:e}=this.target;let i=document.createElement("div");i.innerHTML=t,i.children.length&&(1===i.children.length?e.insetRangeGrid(i.children[0]):e.insetRangeGrids(i.children),i=null,await this.richTextInput())}triggerChatEvent(t,...e){const i=[];return this.chatEventModule[t].forEach(t=>{t&&i.push(t(...e))}),i}ruleChatEvent(t,e,...i){this.triggerChatEvent(e,...i).some(t=>t&&"PREVENT"===t)||(t&&t.bind(this)(),t=null)}fixEditor(){const t=(this.target.chatElement.richText.children[0]||{children:[]}).children[0];if(!t||!t.getAttribute||t.getAttribute("data-set-richType")!==RICH_MARK)return this.target.chatInput.initEditor(!0),this.target.chatElement.showPlaceholder(),this.triggerChatEvent("operate"),!0}}class ChatOperateNode{constructor(t){__publicField(this,"target"),__publicField(this,"rankLen",4),this.target=t}getCurrentNodes(){const t=[];return Array.from(this.target.chatElement.richText.children,(e,i)=>{t.push(this.analyzeGrid(e,i))}),t}getRank(t){let e=t+1+"";const i=this.rankLen-e.length;for(let t=0;t<i;t++)e="0"+e;return e}analyzeGrid(t,e){const i={type:"gridBox",rank:this.getRank(e),children:[]};return Array.from(t.children,(t,e)=>{switch(t.getAttribute("data-set-richType")){case RICH_MARK:i.children.push(this.analyzeMark(t,e,i.rank));break;case RICH_TAG:i.children.push(this.analyzeTag(t,e,i.rank))}}),i}analyzeMark(t,e,i){return{type:"gridInput",rank:i+this.getRank(e),text:t.textContent.replace(new RegExp(this.target.chatInput.VOID_KEY,"g"),"")}}analyzeTag(t,e,i){const n=t.children[0],s={type:"htmlTag",rank:i+this.getRank(e)};return n.classList.contains("at-user")?(s.type="userTag",s.dataset={[this.target.options.userProps.id]:n.getAttribute("data-user-id"),[this.target.options.userProps.name]:n.textContent.slice(1)}):n.classList.contains("at-tag")?(s.type="customTag",s.dataset={id:n.getAttribute("data-tag-id"),name:n.textContent.slice(1),prefix:n.getAttribute("data-set-prefix")}):n.classList.contains("at-select")?(s.type="selectTag",s.dataset={id:n.getAttribute("data-select-id"),name:n.textContent,key:n.getAttribute("data-select-key")}):n.classList.contains("at-input")?(s.type="inputTag",s.dataset={key:n.getAttribute("data-input-key"),placeholder:n.children[1].textContent,value:n.children[0].textContent===this.target.chatInput.VOID_KEY?"":n.children[0].textContent.replace(new RegExp(this.target.chatInput.INPUT_TAG_WRAP_KEY[0],"g"),"")}):(s.type="htmlTag",s.html=t.children[0].innerHTML),s}analyzeGridNodes(t){t.children=t.children||[];const e=t.children;if(0===e.length)return void e.push({type:"gridInput",rank:t.rank+this.getRank(0),text:""});const i=[];e.forEach((t,n)=>{if(n===e.length-1)return;const s=n+1;if("gridInput"===t.type&&"gridInput"===e[s].type){let t=s-i.length;i.push(t)}}),i.forEach(t=>{const i=e[t];e[t-1].text+=i.text,e.splice(t,1)});const n=[];e.forEach((t,i)=>{if(i===e.length-1)return;const s=i+1;if("gridInput"!==t.type&&"gridInput"!==e[s].type){let t=s+n.length;n.push(t)}}),n.forEach(t=>{e.splice(t,0,{type:"gridInput",rank:"",text:""})}),"gridInput"!==e[0].type&&e.unshift({type:"gridInput",rank:"",text:""}),"gridInput"!==e[e.length-1].type&&e.push({type:"gridInput",rank:"",text:""}),e.forEach((e,i)=>{e.rank=t.rank+this.getRank(i)})}analyzeNode(t,e=!1){switch(t.type){case"gridInput":return`<span data-set-richType="${RICH_MARK}"><span class="chat-grid-input" data-set-richType="${RICH_INPUT}" data-set-empty="${String(""===t.text)}">${""===t.text?this.target.chatInput.VOID_KEY:escapeHtml(t.text)}${e&&""===t.text?"<br>":""}</span></span>`;case"userTag":return`<span class="chat-tag" contenteditable="false" data-set-richType="${RICH_TAG}"><span class="at-user" data-user-id="${t.dataset[this.target.options.userProps.id]}">@${t.dataset[this.target.options.userProps.name]}</span></span>`;case"customTag":return`<span class="chat-tag" contenteditable="false" data-set-richType="${RICH_TAG}"><span class="at-tag" data-tag-id="${t.dataset.id}" data-set-prefix="${t.dataset.prefix}">${t.dataset.prefix}${t.dataset.name}</span></span>`;case"selectTag":return`<span class="chat-tag" contenteditable="false" data-set-richType="${RICH_TAG}"><span class="at-select" data-select-id="${t.dataset.id}" data-select-key="${t.dataset.key}">${t.dataset.name}${arrowSvg}</span></span>`;case"htmlTag":return`<span class="chat-tag" contenteditable="false" data-set-richType="${RICH_TAG}"><span class="chat-set-html">${t.html}</span></span>`;case"inputTag":const i=!Boolean(t.dataset.value),n=i?`<span class="input-tip">${t.dataset.placeholder}</span>`:`<span class="input-tip chat-view-show" style="display: none">${t.dataset.placeholder}</span>`;return`<span class="chat-tag" contenteditable="false" data-set-richType="${RICH_TAG}"><span class="at-input" contenteditable="false" data-input-key="${t.dataset.key}"><span class="input-write" contenteditable="true">${i?this.target.chatInput.VOID_KEY:t.dataset.value.replace(new RegExp(this.target.chatInput.INPUT_TAG_WRAP_KEY[1],"g"),this.target.chatInput.INPUT_TAG_WRAP_KEY)}</span>${n}</span></span>`;case"gridBox":let s="";return this.analyzeGridNodes(t),t.children.forEach((e,i)=>{s+=this.analyzeNode(e,i===t.children.length-1)}),`<p class="chat-grid-wrap" data-set-richType="${RICH_GRID}">${s}</p>`;default:return""}}async insertNode(t){if("gridBox"===t.type){const e=this.analyzeNode(t);let i=document.createElement("div");i.innerHTML=e;const n=i.children[0],s=parseFloat(t.rank)-1;if(-1===s||s>this.target.chatElement.richText.children.length-1)this.target.chatElement.richText.appendChild(n);else{const t=this.target.chatElement.richText.children[s];if(!t)return;this.target.chatElement.richText.insertBefore(n,t)}const a=n.lastElementChild.children[0].childNodes[0];this.target.chatInput.restCursorPos(a,a.textContent===this.target.chatInput.VOID_KEY?1:a.textContent.length),i=null,await this.target.chatEvent.richTextInput()}else{const e=(t.text||"").length,i=t.rank.match(new RegExp(`.{1,${this.rankLen}}`,"g")),n=this.getNodeByRank(i[0]);if(!n)return;const s=parseFloat(i[1])-1;-1==s?n.children.push(t):n.children.splice(s,0,t),await this.updateNode(n,()=>{if("gridInput"===t.type){const t=-1===s||s>n.children.length-1,i=!t&&s%2==0,a=t?n.children[n.children.length-1]:n.children[i?s:s-1];this.setCursorNode(a,i?e:-1)}else{const e=n.children.indexOf(t);this.setCursorNode(n.children[e+1],0)}})}}async updateNode(t,e){const i=t.rank.match(new RegExp(`.{1,${this.rankLen}}`,"g")),n=parseFloat(i[0])-1,s=this.target.chatElement.richText.children[n];if("gridBox"===t.type){if(!s)return;this.analyzeGridNodes(t);let i="";if(t.children.forEach((e,n)=>{i+=this.analyzeNode(e,n===t.children.length-1)}),s.innerHTML=i,e)e();else{const t=s.lastElementChild.children[0].childNodes[0];this.target.chatInput.restCursorPos(t,t.textContent===this.target.chatInput.VOID_KEY?1:t.textContent.length)}return void await this.target.chatEvent.richTextInput()}const a=parseFloat(i[1])-1,l=s.children[a],o=this.getNodeByRank(t.rank);if(!o||t.type!==o.type)return;let r,c;if("gridInput"===t.type){const e=l.children[0];e.innerHTML=escapeHtml(t.text);const i=""!==e.textContent;e.setAttribute("data-set-empty",String(!i)),i||(e.innerHTML=l.nextElementSibling?this.target.chatInput.VOID_KEY:`${this.target.chatInput.VOID_KEY}<br>`),r=e.childNodes[0],c=r.textContent.length}else if("userTag"===t.type){const e=l.children[0];e.setAttribute("data-user-id",t.dataset[this.target.options.userProps.id]),e.textContent=`@${t.dataset[this.target.options.userProps.name]}`;r=l.nextElementSibling.children[0].childNodes[0]}else if("customTag"===t.type){const e=l.children[0];e.setAttribute("data-tag-id",t.dataset.id),e.setAttribute("data-set-prefix",t.dataset.prefix),e.textContent=`${t.dataset.prefix}${t.dataset.name}`;r=l.nextElementSibling.children[0].childNodes[0]}else if("selectTag"===t.type){const e=l.children[0];e.setAttribute("data-select-id",t.dataset.id),e.setAttribute("data-select-key",t.dataset.key),e.childNodes[0].textContent=t.dataset.name;r=l.nextElementSibling.children[0].childNodes[0]}else if("htmlTag"===t.type){l.children[0].innerHTML=t.html;r=l.nextElementSibling.children[0].childNodes[0]}e?e():this.target.chatInput.restCursorPos(r,c),await this.target.chatEvent.richTextInput()}getNodeByRank(t){if(!t)return null;const e=t.match(new RegExp(`.{1,${this.rankLen}}`,"g"));if(0===e.length)return null;const i=parseFloat(e[0])-1,n=-1===i?this.target.chatElement.richText.lastElementChild:this.target.chatElement.richText.children[i];if(!n)return null;if(1===e.length)return this.analyzeGrid(n,-1===i?this.target.chatElement.richText.children.length-1:i);-1===i&&(e[0]=this.getRank(this.target.chatElement.richText.children.length-1));const s=parseFloat(e[1])-1,a=-1===s?n.lastElementChild:n.children[s];if(!a)return null;return a.getAttribute("data-set-richType")===RICH_MARK?this.analyzeMark(a,-1===s?n.children.length-1:s,e[0]):this.analyzeTag(a,-1===s?n.children.length-1:s,e[0])}async delNodeByRank(t){const e=this.getNodeByRank(t);if(e)if("gridBox"===e.type){const e=parseFloat(t)-1,i=this.target.chatElement.richText.children[e],n=i.nextElementSibling||i.previousElementSibling;if(n){const t=n.lastElementChild.children[0].childNodes[0];this.target.chatInput.restCursorPos(t,t.textContent===this.target.chatInput.VOID_KEY?1:t.textContent.length)}this.target.chatElement.richText.removeChild(i),0===this.target.chatElement.richText.children.length&&this.target.chatInput.initEditor(!0),await this.target.chatEvent.richTextInput()}else if("gridInput"===e.type)e.text="",await this.updateNode(e);else{const i=e.rank.match(new RegExp(`.{1,${this.rankLen}}`,"g")),n=this.getNodeByRank(i[0]),s=n.children[parseFloat(i[1])-1-1],a=s.text.length;n.children=n.children.filter(e=>e.rank!==t),await this.updateNode(n,()=>{this.setCursorNode(s,a)})}}async coverNodes(t){if(t.length<0)return;let e="";t.forEach(t=>{e+=this.analyzeNode(t)}),this.target.chatElement.richText.innerHTML=e,this.target.chatInput.setRangeLastText(),await this.target.chatEvent.richTextInput()}setCursorNode(t,e=-1){const i=t.rank.match(new RegExp(`.{1,${this.rankLen}}`,"g")),n=parseFloat(i[0])-1,s=-1===n?this.target.chatElement.richText.lastElementChild:this.target.chatElement.richText.children[n];let a=null;if("gridInput"===t.type){const t=parseFloat(i[1])-1;a=-1===t?s.lastElementChild:s.children[t]}else if("gridBox"===t.type)a=-1===e?s.lastElementChild:s.children[0];else if("inputTag"===t.type){const t=parseFloat(i[1])-1,n=s.children[t].children[0].children[0].childNodes[0],a=n.textContent===this.target.chatInput.VOID_KEY?1:-1===e?n.textContent.length:e;this.target.chatInput.setInputTagRange(n,a)}else{const t=parseFloat(i[1])-1,n=s.children[t];a=-1===e?n.nextElementSibling:n.previousElementSibling,e=-1===e?0:-1}if(a){const t=a.children[0].childNodes[0];-1===e&&(e=t.textContent.length),this.target.chatInput.restCursorPos(t,t.textContent===this.target.chatInput.VOID_KEY?1:e)}}getCursorNode(){const t=window.getSelection(),e=t.focusNode;if(e&&e.parentElement&&e.parentElement.classList.contains("input-write")){const i=e.parentElement.parentElement.parentElement;return{node:this.analyzeTag(i,Array.prototype.indexOf.call(i.parentElement.children,i),this.getRank(Array.prototype.indexOf.call(this.target.chatElement.richText.children,i.parentElement))),offset:e.textContent===this.target.chatInput.VOID_KEY?0:t.focusOffset}}const i=this.target.chatInput.vnode.parentElement.parentElement;return{node:this.analyzeMark(i,Array.prototype.indexOf.call(i.parentElement.children,i),this.getRank(Array.prototype.indexOf.call(this.target.chatElement.richText.children,i.parentElement))),offset:this.target.chatInput.vnode.textContent===this.target.chatInput.VOID_KEY?0:this.target.chatInput.cursorIndex}}setSelectNodes(t,e,i=0,n=-1){let s,a;const l=t.rank.match(new RegExp(`.{1,${this.rankLen}}`,"g")),o=e.rank.match(new RegExp(`.{1,${this.rankLen}}`,"g")),r=this.target.chatElement.richText.children[parseFloat(l[0])-1],c=this.target.chatElement.richText.children[parseFloat(o[0])-1];if("gridInput"===t.type)s=r.children[parseFloat(l[1])-1];else if("gridBox"===t.type)s=-1===i?r.lastElementChild:r.children[0];else{const t=parseFloat(l[1])-1,e=r.children[t];s=-1===i?e.nextElementSibling:e.previousElementSibling,i=-1===i?0:-1}if("gridInput"===e.type)a=c.children[parseFloat(o[1])-1];else if("gridBox"===t.type)a=-1===n?c.lastElementChild:c.children[0];else{const t=parseFloat(o[1])-1,e=c.children[t];a=-1===n?e.nextElementSibling:e.previousElementSibling,n=-1===n?0:-1}const h=s.children[0].childNodes[0],d=a.children[0].childNodes[0],p=document.createRange(),g=parseFloat(t.rank)>parseFloat(e.rank);p[g?"setEnd":"setStart"](h,h.textContent===this.target.chatInput.VOID_KEY?1:-1===i?h.textContent.length:i),p[g?"setStart":"setEnd"](d,d.textContent===this.target.chatInput.VOID_KEY?1:-1===n?d.textContent.length:n);const m=window.getSelection();m.removeAllRanges(),m.addRange(p)}getElmByRank(t){const e=t.match(new RegExp(`.{1,${this.rankLen}}`,"g")),i=parseFloat(e[0])-1,n=-1===i?this.target.chatElement.richText.lastElementChild:this.target.chatElement.richText.children[i];if(1===e.length)return n;const s=parseFloat(e[1])-1;return-1===s?n.lastElementChild:n.children[s]}getRankByElm(t){const e=this.target.chatElement.richText.children;let i=null,n=null;return Array.prototype.find.call(e,(e,s)=>t===e?(i=s,!0):Array.prototype.find.call(e.children,(e,a)=>e===t&&(i=s,n=a,!0))),(null!==i?this.getRank(i):"")+(null!==n?this.getRank(n):"")}}class ChatComponent{constructor(t){__publicField(this,"target"),__publicField(this,"components",{}),__publicField(this,"eventTypes",[]),this.target=t}useComponent(t){t.props=t.props||{},t.template=strictMinifyHtml(t.template||""),t.template=convertBlocksToSpans(t.template||"",t.props),this.components[t.name]=t;const e=/bind-([a-zA-Z]+)="([^"]*)"/g,i=[];let n;for(;null!==(n=e.exec(t.template));)i.push({eventType:n[1],handlerName:n[2]});i.forEach(t=>{this.useComponentEvent(t.eventType)})}useComponentEvent(t){if(this.eventTypes.includes(t))return;this.eventTypes.push(t);this.target.chatElement.richText.addEventListener(t,e=>{this.componentEventRecognizer(e,t)})}componentEventRecognizer(t,e){const i=t.target,n=upFindElm(i,20);if(!n||!n.classList.contains("chat-tag")||!n.children[0].classList.contains("chat-set-html"))return;const s=n.children[0].children[0],a=s.getAttribute("data-set-component");if(!a)return;const l=this.components[a];if(!l)return;const o=l.methods,r=this.deppComponentEvent(s,e).reverse();let c=!1,h=0;const d=()=>{if(c)return;const n=r[h];if(i===n||n.contains(i)){const i=n.getAttribute("bind-"+e),a=Object.create(null);for(const t in s.dataset)t in l.props&&(a[t]=s.dataset[t]);const r={componentElm:s,targetElm:n,data:a,eventType:e,eventName:i,stopPropagation:()=>{c=!0}};o[i]&&o[i](r,t)}h<r.length-1&&(h++,d())};d()}deppComponentEvent(t,e){const i=[];return t.getAttribute("bind-"+e)&&i.push(t),t.children&&t.children.length>0&&Array.from(t.children).forEach(t=>{i.push(...this.deppComponentEvent(t,e))}),i}async insertComponent(t,e){const i=this.components[t];if(!i)return;const n=Object.assign({},i.props,e),s=replaceTemplateVariables(i.template,{...n,[ELEMENT_COMPONENT_KEY]:i.name}),a=await this.target.insertHtml(s);return await this.target.chatEvent.richTextInput(),a}async removeComponentElm(t){const e=upFindElm(t,20);e&&(this.target.chatInput.delTag(e),await this.target.chatEvent.richTextInput())}async updateComponentElm(t,e){var i,n;const s=upFindElm(t,20);if(!s)return;const a=null==(n=null==(i=null==s?void 0:s.children[0])?void 0:i.children[0])?void 0:n.getAttribute("data-set-component");if(!a)return;const l=this.components[a];if(!l)return;const o=Object.assign({},l.props,e);s.children[0].innerHTML=replaceTemplateVariables(l.template,{...o,[ELEMENT_COMPONENT_KEY]:l.name}),await this.target.chatEvent.richTextInput()}getComponentElms(t){const e=[],i=this.target.chatElement.richText.querySelectorAll(".chat-tag");return Array.from(i,i=>{this.isComponentElm(i,t)&&e.push(i)}),e}isComponentElm(t,e){return!!(t&&t.children[0]&&t.children[0].children[0])&&t.children[0].children[0].getAttribute("data-set-component")===e}}const arrObSort=function(t,e,i){return t.forEach(t=>{if(i in t){const n=e.indexOf(String(t[i]));-1!==n&&(e[n]=t)}}),e.filter(t=>t[i])};class ChatArea{constructor(t){switch(__publicField(this,"options"),__publicField(this,"deviceInfo",os()),__publicField(this,"chatElement"),__publicField(this,"chatInput"),__publicField(this,"chatEvent"),this.options=Object.assign({},DEFAULT_OPTIONS,t),this.options.device=this.options.device.toLocaleLowerCase(),this.deviceInfo.isTablet&&(this.deviceInfo.isPc=!1),this.options.device){case"pc":this.deviceInfo.isPc=!0;break;case"h5":this.deviceInfo.isPc=!1}this.options.userProps=Object.assign({},DEFAULT_USER_PROPS,t.userProps||{}),this.options.dialogLabels.pcPointDialog=Object.assign({},DEFAULT_PC_POINT_DIALOG,getObjValue(t.dialogLabels,"pcPointDialog",{})),this.options.dialogLabels.pcPCheckDialog=Object.assign({},DEFAULT_PC_CHECK_DIALOG,getObjValue(t.dialogLabels,"pcPCheckDialog",{})),this.options.dialogLabels.h5Dialog=Object.assign({},DEFAULT_H5_DIALOG,getObjValue(t.dialogLabels,"h5Dialog",{})),this.chatElement=new ChatElement(this),this.chatInput=new ChatInput(this),this.chatEvent=new ChatEvent(this),this.updateConfig(t);const e=this;Object.defineProperty(this,"richText",{get:()=>e.chatElement.richText}),Object.defineProperty(this,"textLength",{get:()=>e.chatEvent.textLength}),this.options.autoFocus&&this.nextTick(()=>{this.chatElement.richText.focus()})}updateConfig(t){void 0!==t.copyType&&(this.options.copyType=t.copyType),t.userProps&&(this.options.userProps=Object.assign({},DEFAULT_USER_PROPS,t.userProps)),void 0!==t.uploadImage&&(this.options.uploadImage=t.uploadImage),void 0!==t.placeholder&&(this.chatElement.placeholderElm.textContent=t.placeholder),void 0!==t.maxLength&&(this.options.maxLength=t.maxLength<=0?-1:t.maxLength,this.chatEvent.ruleMaxLength()),this.options.asyncMatch?(this.options.needCallEvery=!1,this.updateUserList([])):(void 0!==t.needCallEvery||t.userList)&&(this.options.needCallEvery=getBoolean(void 0===t.needCallEvery?this.options.needCallEvery:t.needCallEvery),this.updateUserList(t.userList)),void 0!==t.needCallSpace&&this.chatInput.setCallSpace(getBoolean(t.needCallSpace)),void 0!==t.wrapKeyFun&&(this.options.wrapKeyFun=t.wrapKeyFun),void 0!==t.sendKeyFun&&(this.options.sendKeyFun=t.sendKeyFun),t.customTrigger&&(this.options.customTrigger=t.customTrigger.map(t=>(t.keyCode=KEY_CODE_MAP[t.prefix]||null,t)),this.options.needDialog&&this.deviceInfo.isPc&&this.chatElement.bindCustomTrigger()),t.selectList&&(this.options.selectList=t.selectList,this.options.needDialog&&this.deviceInfo.isPc&&this.chatElement.bindSelectList())}updateUserList(t=void 0){const{options:e,chatElement:i}=this;if(t){e.userList=JSON.parse(JSON.stringify(t));const i={[e.userProps.id]:"isALL",[e.userProps.name]:""};e.userList.unshift(i),e.reformList=t.map(t=>({id:String(t[e.userProps.id]),name:String(t[e.userProps.name]||""),avatar:String(t[e.userProps.avatar]||""),pinyin:String(t[e.userProps.pinyin]||"")}))}const n=e.userList[0];n&&"isALL"===n[e.userProps.id]&&(n[e.userProps.name]=this.deviceInfo.isPc?e.dialogLabels.pcPointDialog.callEveryLabel:e.dialogLabels.h5Dialog.callEveryLabel),e.needDialog&&(this.deviceInfo.isPc?i.updatePCUser():i.updateH5User())}searchUserList(t){return this.options.reformList.filter(e=>pinyinMatch(e.name,e.pinyin||"",t))}getReduceNode(t){const e=Object.assign({},DEFAULT_REDUCE_CONFIG,t||{});e.saveTagData&&(e.needUserId=!0,e.needTagId=!0,e.needSelectId=!0);const i=/(https?|http|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g,n=this.chatElement.richText.cloneNode(!0).children||[],s=document.createElement("div");return e.wrapClassName&&(s.className=e.wrapClassName),Array.from(n,(t,n)=>{const a=document.createElement("p");Array.from(t.children,t=>{const n=t.children[0];this.chatInput.getNodeEmpty(n)||(n.removeAttribute("data-set-richType"),n.removeAttribute("contenteditable"),n.removeAttribute("data-set-empty"),e.needUserId||n.removeAttribute("data-user-id"),e.needTagId||(n.removeAttribute("data-set-prefix"),n.removeAttribute("data-tag-id")),e.needSelectId||(n.removeAttribute("data-select-id"),n.removeAttribute("data-select-key")),e.imgToText&&n.firstChild&&"IMG"===n.firstChild.tagName&&(n.classList.add("img-to-text"),n.innerHTML=`[${n.firstChild.getAttribute("data-img-text")||"you need set data-img-text"}]`),e.identifyLink&&n.classList.contains("chat-grid-input")&&(n.innerHTML=n.innerHTML.replace(i,t=>`<a class="chat-grid-link" href="${t}" target="_blank">${t}</a>`)),n.classList.contains("at-select")&&(n.classList.remove("aim"),n.removeChild(n.lastChild)),n.classList.contains("at-input")&&(e.saveTagData?n.setAttribute("data-input-tip",n.children[1].textContent):n.removeAttribute("data-input-key"),n.textContent=n.children[0].textContent!==this.chatInput.VOID_KEY?n.children[0].textContent:n.children[1].textContent,n.textContent=n.textContent.replace(new RegExp(this.chatInput.INPUT_TAG_WRAP_KEY[0],"g"),"")),a.appendChild(n))}),e.rowClassName&&(a.className=e.rowClassName),a.innerHTML||(a.innerHTML="<br>"),s.appendChild(a)}),s}getText(t){let e="";const i=this.getReduceNode(t);return Array.from(i.children,(t,i)=>{e=e+(i>0?"\n":"")+t.textContent}),e}getHtml(t){return this.getReduceNode(t).innerHTML}async reverseAnalysis(t,e){if(!t)return;const i=document.createElement("div");i.innerHTML=t;const n=i.children;Array.from(n,t=>{t.className="chat-grid-wrap",t.setAttribute("data-set-richType",RICH_GRID);const e=t.children,i={},n=[];Array.from(e,(s,a)=>{if(-1!==s.className.indexOf("chat-grid-input")){const t=s.textContent||"";return s.className="",s.setAttribute("data-set-richType",RICH_MARK),void(s.innerHTML=`<span class="chat-grid-input" data-set-richType="${RICH_INPUT}" data-set-empty="false">${escapeHtml(t)}</span>`)}if(s.tagName&&"BR"===s.tagName.toLocaleUpperCase()){const e=this.chatInput.getGridElm(!0);return t.removeChild(s),void t.appendChild(e)}const l=s.cloneNode(!0);l.setAttribute("contenteditable","false");const o=document.createElement("span");if(o.className="chat-tag",o.setAttribute("contenteditable","false"),o.setAttribute("data-set-richType",RICH_TAG),o.appendChild(l),i[a]=o,a!==e.length-1){-1===e[a+1].className.indexOf("chat-grid-input")&&n.push(a)}else n.push(a);0===a&&n.push(-1)});for(const n in i){const s=Number(n),a=i[n].lastChild;if(a.classList.contains("at-select"))a.innerHTML=`${a.textContent}${arrowSvg}`;else if(a.classList.contains("at-input")){const t=""===a.textContent,e=t?`<span class="input-tip">${a.getAttribute("data-input-tip")}</span>`:`<span class="input-tip chat-view-hidden" style="display: none">${a.getAttribute("data-input-tip")}</span>`;a.innerHTML=`<span class="input-write" contenteditable="true">${t?this.chatInput.VOID_KEY:a.textContent.replace(new RegExp(this.chatInput.INPUT_TAG_WRAP_KEY[1],"g"),this.chatInput.INPUT_TAG_WRAP_KEY)}</span>${e}`,a.removeAttribute("data-input-tip")}s===e.length-1?(t.removeChild(e[s]),t.appendChild(i[n])):(t.insertBefore(i[n],e[s+1]),t.removeChild(e[s]))}const s=[],a=t.children;n.forEach(t=>{t===a.length-1?s.push("isEnd"):s.push(a[t+1])}),s.forEach(e=>{const i=this.chatInput.getGridElm(!0);if("isEnd"===e)t.appendChild(i);else{const n=i.children[0];n.childNodes.length>1&&n.removeChild(n.childNodes[1]),t.insertBefore(i,e)}})}),e?(this.chatInput.setRangeLastText(),await this.chatEvent.insertInsideHtml(i.innerHTML)):(this.chatElement.richText.innerHTML=i.innerHTML,this.chatInput.setRangeLastText(),await this.chatEvent.richTextInput())}async insertHtml(t){if(!t)return;const e=document.createElement("span");e.innerHTML=t,e.className="chat-set-html";const i=this.chatInput.createNewDom(e);return this.chatInput.replaceRegContent(i,!1),await this.chatEvent.richTextInput(),i}async insertText(t){if(!t)return;t=escapeHtml(t);const e=new RegExp(`[${this.chatInput.ZERO_WIDTH_KEY}|${this.chatInput.VOID_KEY}]`,"ig"),i=t.replace(e,"");if(!i)return;const n=i.split("\n");let s="";n.forEach(t=>{const e=""!==t;s+=`<p class="chat-grid-wrap" data-set-richType="${RICH_GRID}"><span data-set-richType="${RICH_MARK}"><span class="chat-grid-input" data-set-richType="${RICH_INPUT}" data-set-empty="${e?"false":"true"}">${e?t:this.chatInput.VOID_KEY+"<br>"}</span></span></p>`}),await this.chatEvent.insertInsideHtml(s)}getCallUserList(){const t=this.chatElement.richText.querySelectorAll(".at-user");if(t&&t.length>0){const e=Array.from(t,t=>t.dataset.userId);return arrObSort(this.options.userList,e,this.options.userProps.id)}return[]}getCallUserTagList(){const t=this.chatElement.richText.querySelectorAll(".at-user");if(t&&t.length>0){const e=[];return Array.from(t,t=>{e.some(e=>e[this.options.userProps.id]===t.dataset.userId)||e.push({[this.options.userProps.id]:t.dataset.userId,[this.options.userProps.name]:t.textContent.slice(1)})}),e}return[]}getCustomTagList(){const t=Object.keys(this.chatElement.customTags),e={},i=this.chatElement.richText.querySelectorAll(".at-tag");return t.forEach(t=>{let n=Array.prototype.filter.call(i,e=>e.getAttribute("data-set-prefix")===String(t)).map(t=>t.getAttribute("data-tag-id"));n=n.filter((t,e)=>n.indexOf(t)===e),e[t]=arrObSort(this.chatElement.customTags[t],n,"id")}),e}getSelectTagList(){const t=Object.keys(this.chatElement.selectTags),e={},i=this.chatElement.richText.querySelectorAll(".at-select");return t.forEach(t=>{let n=Array.prototype.filter.call(i,e=>e.getAttribute("data-select-key")===String(t)).map(t=>t.getAttribute("data-select-id"));n=n.filter((t,e)=>n.indexOf(t)===e),e[t]=arrObSort(this.chatElement.selectTags[t],n,"id")}),e}getInputTagList(){const t={},e=this.chatElement.richText.querySelectorAll(".at-input");return Array.from(e,e=>{const i=e.getAttribute("data-input-key"),n=e.children[0].textContent===this.chatInput.VOID_KEY?null:e.children[0].textContent;t[i]||(t[i]=[]),t[i].push(n)}),t}async clear(t){this.chatInput.initEditor(!0,t),this.clearHistory(),await this.chatEvent.richTextInput(!1)}isEmpty(t=!1){if((this.chatElement.richText.querySelectorAll(".chat-tag")||[]).length>0)return!1;const e=new RegExp(`^(${this.chatInput.ZERO_WIDTH_KEY}|<br>|${this.chatInput.VOID_KEY})+$`),i=this.chatElement.richText.querySelectorAll(".chat-grid-input")||[];return t?Array.prototype.every.call(i,t=>!t.innerHTML||!t.textContent||!t.textContent.trim()||e.test(t.innerHTML)):Array.prototype.every.call(i,t=>!t.innerHTML||!t.textContent||e.test(t.innerHTML))}dispose(){if(this.options.elm.removeChild(this.chatElement.richText),this.options.elm.removeChild(this.chatElement.placeholderElm),this.options.needDialog)if(this.deviceInfo.isPc){const t=this.chatElement.pcElms.containerDialogElm.parentElement;t&&t.removeChild(this.chatElement.pcElms.containerDialogElm)}else document.body.removeChild(this.chatElement.h5Elms.dialogElm)}showPCPointDialog(){this.options.needDialog&&(this.insertText("@"),this.options.asyncMatch&&domItVisible(this.chatElement.pcElms.pointDialogEmptyElm,!0,"flex"),this.chatEvent.outerApply=!0,this.chatElement.showPointDialog(),sleep(50).then(()=>{this.chatEvent.outerApply=!1}))}showPCCheckDialog(){this.options.needDialog&&!this.options.asyncMatch&&(this.chatEvent.winClick(),this.chatElement.checkboxRows=[],domItVisible(this.chatElement.pcElms.checkDialogElm,!0),updateElmClass(document.body,"disable-scroll",!0),this.chatElement.pcElms.checkDialogTagsElm.scrollTop=0,this.chatElement.pcElms.checkDialogUsersElm.scrollTop=0,this.chatElement.pcElms.checkDialogSearchInputElm.value="",this.chatElement.updateCheckDialogTags(),this.chatElement.isExternalCallPopup=!0)}showPCCustomTagDialog(t){this.options.needDialog&&!this.options.asyncMatch&&(this.insertText(t),this.chatEvent.outerApply=!0,this.chatElement.showCustomTagDialog(t),sleep(50).then(()=>{this.chatEvent.outerApply=!1}))}showPCSelectDialog(t,e){this.chatElement.exitCustomTagDialog(),this.chatElement.exitPointDialog(),this.chatEvent.outerApply=!0,e&&(this.chatElement.exitSelectDialog(),this.chatElement.pcElms.selectDialogAim=e),this.chatElement.pcElms.selectDialogKey=t,this.chatEvent.debounceEvents.selectDialogToAim(),sleep(50).then(()=>{this.chatEvent.outerApply=!1})}showH5Dialog(){this.chatElement.richText&&this.chatElement.richText.blur(),Array.from(this.chatElement.h5Elms.dialogMainElm.children,t=>{t.style.display="",updateElmClass(t,"user-popup-check-item-check")}),updateElmClass(this.chatElement.h5Elms.dialogCheckElm,"disabled",!0),domItVisible(this.chatElement.h5Elms.dialogElm,!0),updateElmClass(document.body,"disable-scroll",!0),this.options.asyncMatch&&domItVisible(this.chatElement.h5Elms.dialogEmptyElm,!0,"flex"),this.chatElement.h5Elms.dialogMainElm.scrollTop=0,this.chatElement.isExternalCallPopup=!0}disabled(){this.chatElement.richText.setAttribute("contenteditable","false"),updateElmClass(this.chatElement.richText,"chat-rich-text-disabled",!0)}enable(){this.chatElement.richText.setAttribute("contenteditable","true"),updateElmClass(this.chatElement.richText,"chat-rich-text-disabled"),this.chatInput.setRangeLastText()}async setUserTag(t){this.chatEvent.triggerChatEvent("atCheck",[t]);const e=this.chatInput.createChatTagElm({id:t[this.options.userProps.id],name:t[this.options.userProps.name]},"@","at-user","user-id");this.chatInput.replaceRegContent(e,!1),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterAtCheck",[t])}async setCustomTag(t,e){this.chatEvent.triggerChatEvent("tagCheck",t,e),await this.chatInput.onceCustomCall(t,!1,e),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterTagCheck",t,e)}async setSelectTag(t,e){if(e||(e=this.chatElement.pcElms.selectDialogKey),this.chatEvent.triggerChatEvent("selectCheck",t,e),this.chatElement.pcElms.selectDialogAim&&this.chatElement.pcElms.selectDialogAim.classList.contains("at-select")){const e=this.chatElement.pcElms.selectDialogAim.getAttribute("data-select-id"),i=this.chatElement.pcElms.selectDialogAim.parentElement.nextElementSibling.childNodes[0].childNodes[0];if(this.chatInput.restCursorPos(i),e===t.id)return;this.chatElement.pcElms.selectDialogAim.setAttribute("data-select-id",t.id),this.chatElement.pcElms.selectDialogAim.childNodes[0].textContent=t.name}else{const i=document.createElement("span");i.setAttribute("class","at-select"),i.setAttribute("data-select-key",e),i.setAttribute("data-select-id",t.id),i.innerHTML=`${t.name}${arrowSvg}`;const n=this.chatInput.createNewDom(i);this.chatInput.replaceRegContent(n,!1)}await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterSelectCheck",t,e)}async setInputTag(t,e,i=""){const n=document.createElement("span");n.setAttribute("class","at-input"),n.setAttribute("contenteditable","false"),n.setAttribute("data-input-key",t);const s=document.createElement("span");s.setAttribute("class","input-write"),s.setAttribute("contenteditable","true"),s.textContent=i||this.chatInput.VOID_KEY;const a=document.createElement("span");a.setAttribute("class","input-tip"),a.textContent="["+(e||"Please input")+"]",n.appendChild(s),n.appendChild(a);const l=this.chatInput.createNewDom(n);this.chatInput.replaceRegContent(l,!1),i&&this.chatInput.watchInputTag(s),this.chatInput.rangeToInputTag(n),await this.chatEvent.richTextInput()}async matchSetTag(t){this.chatEvent.triggerChatEvent("atCheck",[t]),await this.chatInput.onceSearchCall(t,this.chatEvent.startOpenIndex),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterAtCheck",[t])}async onceSetTag(t){this.chatEvent.triggerChatEvent("atCheck",[t]),await this.chatInput.onceCall({id:t[this.options.userProps.id],name:t[this.options.userProps.name]}),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterAtCheck",[t])}async batchSetTag(t){this.chatEvent.triggerChatEvent("atCheck",t);const e=[];for(let i=0;i<=t.length-1;)e.push({id:t[i][this.options.userProps.id],name:t[i][this.options.userProps.name]}),i++;await this.chatInput.batchReplaceRegContent(e,!this.chatElement.isExternalCallPopup),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterAtCheck",t)}async onceSetCustomTag(t,e){e||(e=this.chatElement.pcElms.customTagDialogTagKey),this.chatEvent.triggerChatEvent("tagCheck",t,e),await this.chatInput.onceCustomCall(t,!0,e),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterTagCheck",t,e)}async matchSetCustomTag(t,e){e||(e=this.chatElement.pcElms.customTagDialogTagKey),this.chatEvent.triggerChatEvent("tagCheck",t,e),await this.chatInput.onceCustomCall(t,this.chatEvent.startOpenIndex,e),await this.chatEvent.richTextInput(),this.chatEvent.triggerChatEvent("afterTagCheck",e)}async undo(){const{chatEvent:t}=this;if(!t.doOverHistory||!t.undoHistory||t.undoHistory.length<=1)return;const e=t.undoHistory[t.undoHistory.length-2],i=t.undoHistory[t.undoHistory.length-1];t.redoHistory.push(i),t.undoHistory.pop(),await t.setChatHistory(e)}async redo(){const{chatEvent:t}=this;if(!t.doOverHistory||!t.redoHistory||t.redoHistory.length<1)return;const e=t.redoHistory[t.redoHistory.length-1];t.redoHistory.pop(),t.undoHistory.push(e),await t.setChatHistory(e)}clearHistory(){const{gridIndex:t,markIndex:e}=this.chatInput.getRichTextNodeIndex(this.chatInput.vnode);this.chatEvent.undoHistory=null===t||null==e?[{html:this.chatElement.richText.innerHTML,gridIndex:0,markIndex:0,cursorIndex:this.chatInput.cursorIndex}]:[{html:this.chatElement.richText.innerHTML,gridIndex:t,markIndex:e,cursorIndex:this.chatInput.cursorIndex}],this.chatEvent.redoHistory=[]}cursorMove(t){if(0===t)return void this.chatInput.restCursorPos(this.chatInput.vnode,this.chatInput.cursorIndex);const e=new RegExp(`[${this.chatInput.ZERO_WIDTH_KEY}|${this.chatInput.VOID_KEY}]`,"ig");if(t>0){const i=this.chatInput.vnode.textContent.replace(e,"").slice(this.chatInput.cursorIndex);if(i.length>=t)return this.chatInput.cursorIndex+=t,void this.chatInput.restCursorPos(this.chatInput.vnode,this.chatInput.cursorIndex);const n=this.chatInput.vnode.parentElement.parentElement,s=n.parentElement;let a=Boolean(n.nextElementSibling&&n.nextElementSibling.nextElementSibling);const l=Boolean(s.nextElementSibling);if(!a&&!l)return this.chatInput.cursorIndex+=i.length,0===this.chatInput.cursorIndex&&(this.chatInput.cursorIndex=1),void this.chatInput.restCursorPos(this.chatInput.vnode,this.chatInput.cursorIndex);const o=t-i.length-1,r=a?n.nextElementSibling.nextElementSibling:s.nextElementSibling.children[0],{rangeNode:c,rangeIndex:h}=this.chatInput.getOffsetRange(o,r);this.chatInput.restCursorPos(c,h)}else if(t<0){let i=Math.abs(t);const n=this.chatInput.vnode.textContent.replace(e,"").slice(0,this.chatInput.cursorIndex);if(n.length>=i)return this.chatInput.cursorIndex-=i,void this.chatInput.restCursorPos(this.chatInput.vnode,this.chatInput.cursorIndex);const s=this.chatInput.vnode.parentElement.parentElement,a=s.parentElement,l=Boolean(s.previousElementSibling&&s.previousElementSibling.previousElementSibling),o=Boolean(a.previousElementSibling);if(!l&&!o)return void this.chatInput.restCursorPos(this.chatInput.vnode);i=i-n.length-1;const r=l?s.previousElementSibling.previousElementSibling:a.previousElementSibling.lastElementChild,{rangeNode:c,rangeIndex:h}=this.chatInput.getOffsetRange(i,r,!0);this.chatInput.restCursorPos(c,h)}}async cursorDel(t){if(0===t)return void this.chatInput.restCursorPos(this.chatInput.vnode,this.chatInput.cursorIndex);const e=this.chatInput.vnode,i=this.chatInput.cursorIndex;this.cursorMove(t);const n=this.chatInput.vnode,s=this.chatInput.cursorIndex,a=document.createRange();t<0?(a.setStart(n,s),a.setEnd(e,i)):(a.setStart(e,i),a.setEnd(n,s));const l=window.getSelection();l.removeAllRanges(),l.addRange(a),(this.chatInput.selectRegionMerge()||this.chatInput.gridElmMerge()||this.chatInput.delMarkRule())&&await this.chatEvent.richTextInput()}async delUserTags(t){const e=t||this.options.userList.map(t=>t[this.options.userProps.id]),i=this.chatElement.richText.querySelectorAll(".at-user"),n=[];Array.from(i,t=>{const i=t.getAttribute("data-user-id");e.some(t=>String(t)===i)&&n.push(t.parentElement)});for(let t=0;t<n.length;){const e=n[t];this.chatInput.delTag(e),t++}this.chatInput.setRangeLastText(),await this.chatEvent.richTextInput()}async delCustomTags(t,e){const i=this.options.customTrigger.find(e=>e.prefix===t);if(!i||0===i.tagList.length)return;const n=e||i.tagList.map(t=>t.id),s=this.chatElement.richText.querySelectorAll(".at-tag"),a=[];Array.from(s,e=>{const i=e.getAttribute("data-set-prefix"),s=e.getAttribute("data-tag-id");i===t&&n.some(t=>String(t)===s)&&a.push(e.parentElement)});for(let t=0;t<a.length;){const e=a[t];this.chatInput.delTag(e),t++}this.chatInput.setRangeLastText(),await this.chatEvent.richTextInput()}async delSelectTags(t,e){const i=this.options.selectList.find(e=>e.key===t);if(!i||0===i.options.length)return;const n=e||i.options.map(t=>t.id),s=this.chatElement.richText.querySelectorAll(".at-select"),a=[];Array.from(s,e=>{const i=e.getAttribute("data-select-key"),s=e.getAttribute("data-select-id");i===t&&n.some(t=>String(t)===s)&&a.push(e.parentElement)});for(let t=0;t<a.length;){const e=a[t];this.chatInput.delTag(e),t++}this.chatInput.setRangeLastText(),await this.chatEvent.richTextInput()}async delInputTags(t){const e=this.chatElement.richText.querySelectorAll(".at-input"),i=[];Array.from(e,e=>{if(t){const n=e.getAttribute("data-input-key");t.some(t=>String(t)===n)&&i.push(e.parentElement)}else i.push(e.parentElement)});for(let t=0;t<i.length;){const e=i[t];this.chatInput.delTag(e),t++}this.chatInput.setRangeLastText(),await this.chatEvent.richTextInput()}openTipTag(t){this.chatElement.createTipElm(t),this.chatInput.setRangeLastText()}closeTipTag(){this.chatElement.tipElm&&this.chatElement.removeTipElm()}addEventListener(t,e){this.chatEvent.chatEventModule[t].push(e)}removeEventListener(t,e){const i=this.chatEvent.chatEventModule[t],n=i.indexOf(e);-1!==n&&i.splice(n,1)}revisePCPointDialogLabel(t){this.options.needDialog&&(this.options.dialogLabels.pcPointDialog=Object.assign({},DEFAULT_PC_POINT_DIALOG,t||{}),this.chatElement.pcElms.pointDialogElm.querySelector(".call-user-dialog-header-title").textContent=this.options.dialogLabels.pcPointDialog.title,this.chatElement.pcElms.pointDialogCheckElm.textContent=this.options.dialogLabels.pcPointDialog.checkLabel,this.chatElement.pcElms.pointDialogEmptyElm&&(this.chatElement.pcElms.pointDialogEmptyElm.children[1].textContent=this.options.dialogLabels.pcPointDialog.emptyLabel),this.options.asyncMatch||this.updateUserList())}revisePCCheckDialogLabel(t){this.options.needDialog&&!this.options.asyncMatch&&(this.options.dialogLabels.pcPCheckDialog=Object.assign({},DEFAULT_PC_CHECK_DIALOG,t||{}),this.chatElement.pcElms.checkDialogElm.querySelector(".checkbox-dialog-container-header").children[0].textContent=this.options.dialogLabels.pcPCheckDialog.title,this.chatElement.pcElms.checkDialogSearchInputElm.setAttribute("placeholder",this.options.dialogLabels.pcPCheckDialog.searchPlaceholder),this.chatElement.pcElms.checkDialogElm.querySelector(".checkbox-dialog-search-empty").textContent=this.options.dialogLabels.pcPCheckDialog.searchEmptyLabel,this.chatElement.pcElms.checkDialogElm.querySelector(".checkbox-dialog-right-box-title").textContent=this.options.dialogLabels.pcPCheckDialog.userTagTitle,this.chatElement.pcElms.checkDialogUsersElm.children[0].children[2].textContent=this.options.dialogLabels.pcPCheckDialog.checkAllLabel,this.chatElement.pcElms.checkDialogElm.querySelector(".btn-submit").textContent=this.options.dialogLabels.pcPCheckDialog.confirmLabel,this.chatElement.pcElms.checkDialogElm.querySelector(".btn-close").textContent=this.options.dialogLabels.pcPCheckDialog.cancelLabel)}reviseH5DialogLabel(t){this.options.needDialog&&(this.options.dialogLabels.h5Dialog=Object.assign({},DEFAULT_H5_DIALOG,t||{}),this.chatElement.h5Elms.dialogElm.querySelector(".popup-title").textContent=this.options.dialogLabels.h5Dialog.title,this.chatElement.h5Elms.dialogSearchElm.setAttribute("placeholder",this.options.dialogLabels.h5Dialog.searchPlaceholder),this.chatElement.h5Elms.dialogEmptyElm.children[1].textContent=this.options.dialogLabels.h5Dialog.searchEmptyLabel,this.chatElement.h5Elms.dialogCheckElm.textContent=this.options.dialogLabels.h5Dialog.confirmLabel,this.chatElement.h5Elms.dialogShowElm.textContent=this.options.dialogLabels.h5Dialog.cancelLabel,this.options.asyncMatch||this.updateUserList())}async nextTick(t){return new Promise(e=>{requestAnimationFrame(()=>{const i=t();i instanceof Promise?i.then(()=>{e()}):e()})})}createOperateNode(){return new ChatOperateNode(this)}createChatComponent(){return new ChatComponent(this)}}__publicField(ChatArea,"version","5.8.5");
|
|
5998
|
+
// EXTERNAL MODULE: ./node_modules/chatarea/lib/ChatArea.css
|
|
5999
|
+
var lib_ChatArea = __webpack_require__(2736);
|
|
6000
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/main.vue?vue&type=script&lang=js
|
|
6001
|
+
|
|
6002
|
+
|
|
6003
|
+
|
|
6004
|
+
|
|
6005
|
+
|
|
6006
|
+
/* harmony default export */ const mainvue_type_script_lang_js = ({
|
|
6007
|
+
name: 'ElXEditorSender',
|
|
6008
|
+
components: {
|
|
6009
|
+
ClearButton: ClearButton,
|
|
6010
|
+
LoadingButton: LoadingButton,
|
|
6011
|
+
SendButton: SendButton
|
|
6012
|
+
},
|
|
6013
|
+
props: {
|
|
6014
|
+
// 输入框提示占位语
|
|
6015
|
+
placeholder: {
|
|
6016
|
+
type: String,
|
|
6017
|
+
default: '请输入内容'
|
|
6018
|
+
},
|
|
6019
|
+
// 使用编辑器设备类型 pc内置了很多丰富的弹出选择功能,如果用户传入了h5,弹出交互需要参考自定义弹出去支持
|
|
6020
|
+
device: {
|
|
6021
|
+
type: String,
|
|
6022
|
+
default: 'pc' // pc|h5
|
|
6023
|
+
},
|
|
6024
|
+
// 是否在聊天框生成后自动聚焦
|
|
6025
|
+
autoFocus: {
|
|
6026
|
+
type: Boolean,
|
|
6027
|
+
default: false
|
|
6028
|
+
},
|
|
6029
|
+
// 输入框的变体类型
|
|
6030
|
+
variant: {
|
|
6031
|
+
type: String,
|
|
6032
|
+
default: 'default' // default|updown
|
|
6033
|
+
},
|
|
6034
|
+
// 配置标签下拉选择的选项
|
|
6035
|
+
selectList: {
|
|
6036
|
+
type: Array,
|
|
6037
|
+
default: () => []
|
|
6038
|
+
},
|
|
6039
|
+
// @研讨群成员列表
|
|
6040
|
+
userList: {
|
|
6041
|
+
type: Array,
|
|
6042
|
+
default: () => []
|
|
6043
|
+
},
|
|
6044
|
+
// 扩展自定义弹窗列表
|
|
6045
|
+
customTrigger: {
|
|
6046
|
+
type: Array,
|
|
6047
|
+
default: () => []
|
|
6048
|
+
},
|
|
6049
|
+
// 限制输入框最大字数 *注 该配置项性能开销较大 非必要情况请别设置(像豆包和文心一言都不对这块做限制,不应因小失大)
|
|
6050
|
+
maxLength: {
|
|
6051
|
+
type: Number,
|
|
6052
|
+
default: undefined
|
|
6053
|
+
},
|
|
6054
|
+
// 控制换行与提交模式
|
|
6055
|
+
submitType: {
|
|
6056
|
+
type: String,
|
|
6057
|
+
default: 'enter' // enter|shiftEnter
|
|
6058
|
+
},
|
|
6059
|
+
// 修改输入样式
|
|
6060
|
+
customStyle: {
|
|
6061
|
+
type: Object,
|
|
6062
|
+
default: () => ({})
|
|
6063
|
+
},
|
|
6064
|
+
// 发送按钮加载状态
|
|
6065
|
+
loading: {
|
|
6066
|
+
type: Boolean,
|
|
6067
|
+
default: false
|
|
6068
|
+
},
|
|
6069
|
+
// 是否禁用输入框
|
|
6070
|
+
disabled: {
|
|
6071
|
+
type: Boolean,
|
|
6072
|
+
default: false
|
|
6073
|
+
},
|
|
6074
|
+
// 是否显示清空按钮
|
|
6075
|
+
clearable: {
|
|
6076
|
+
type: Boolean,
|
|
6077
|
+
default: false
|
|
6078
|
+
},
|
|
6079
|
+
// 展开动画事件/ms
|
|
6080
|
+
headerAnimationTimer: {
|
|
6081
|
+
type: Number,
|
|
6082
|
+
default: 300
|
|
6083
|
+
},
|
|
6084
|
+
// 异步加载群成员方法
|
|
6085
|
+
asyncMatchFun: {
|
|
6086
|
+
type: Function,
|
|
6087
|
+
default: undefined
|
|
6088
|
+
},
|
|
6089
|
+
// 是否需要自定义弹窗 开启后内部弹窗将不会再创建了
|
|
6090
|
+
customDialog: {
|
|
6091
|
+
type: Boolean,
|
|
6092
|
+
default: false
|
|
6093
|
+
}
|
|
6094
|
+
},
|
|
6095
|
+
emits: ['submit', 'change', 'cancel', 'show-at-dialog', 'show-select-dialog', 'show-tag-dialog'],
|
|
6096
|
+
data() {
|
|
6097
|
+
return {
|
|
6098
|
+
chat: null,
|
|
6099
|
+
opNode: null,
|
|
6100
|
+
chatState: {
|
|
6101
|
+
isEmpty: true,
|
|
6102
|
+
textLength: 0,
|
|
6103
|
+
// 该属性值只会在配置了maxLength情况下才拥有赋值
|
|
6104
|
+
lastFocusNode: null,
|
|
6105
|
+
lastOffset: 0,
|
|
6106
|
+
wrapCallSelectDialog: false,
|
|
6107
|
+
// 记录是否是外部调用了选择弹窗进行插值行为操作
|
|
6108
|
+
beforeText: '',
|
|
6109
|
+
afterText: ''
|
|
6110
|
+
}
|
|
6111
|
+
};
|
|
6112
|
+
},
|
|
6113
|
+
watch: {
|
|
6114
|
+
disabled(val) {
|
|
6115
|
+
val ? this.chat?.disabled() : this.chat?.enable();
|
|
6116
|
+
},
|
|
6117
|
+
placeholder(val) {
|
|
6118
|
+
this.chat?.updateConfig({
|
|
6119
|
+
placeholder: val
|
|
6120
|
+
});
|
|
6121
|
+
},
|
|
6122
|
+
maxLength(val) {
|
|
6123
|
+
this.chat?.updateConfig({
|
|
6124
|
+
maxLength: val
|
|
6125
|
+
});
|
|
6126
|
+
},
|
|
6127
|
+
submitType(val) {
|
|
6128
|
+
this.chat?.updateConfig({
|
|
6129
|
+
sendKeyFun: val === 'enter' ? event => !event.shiftKey && event.key === 'Enter' : event => event.shiftKey && event.key === 'Enter',
|
|
6130
|
+
wrapKeyFun: val === 'shiftEnter' ? event => !event.shiftKey && event.key === 'Enter' : event => event.shiftKey && event.key === 'Enter'
|
|
6131
|
+
});
|
|
6132
|
+
},
|
|
6133
|
+
userList: {
|
|
6134
|
+
handler(val) {
|
|
6135
|
+
this.chat?.updateConfig({
|
|
6136
|
+
userList: JSON.parse(JSON.stringify(val))
|
|
6137
|
+
});
|
|
6138
|
+
},
|
|
6139
|
+
deep: true
|
|
6140
|
+
},
|
|
6141
|
+
selectList: {
|
|
6142
|
+
handler(val) {
|
|
6143
|
+
this.chat?.updateConfig({
|
|
6144
|
+
selectList: val
|
|
6145
|
+
});
|
|
6146
|
+
},
|
|
6147
|
+
deep: true
|
|
6148
|
+
},
|
|
6149
|
+
customTrigger: {
|
|
6150
|
+
handler(val) {
|
|
6151
|
+
this.chat?.updateConfig({
|
|
6152
|
+
customTrigger: val
|
|
6153
|
+
});
|
|
6154
|
+
},
|
|
6155
|
+
deep: true
|
|
6156
|
+
}
|
|
6157
|
+
},
|
|
6158
|
+
mounted() {
|
|
6159
|
+
this.createChat();
|
|
6160
|
+
},
|
|
6161
|
+
beforeDestroy() {
|
|
6162
|
+
if (this.chat) {
|
|
6163
|
+
this.chat.dispose();
|
|
6164
|
+
this.chat = null;
|
|
6165
|
+
this.opNode = null;
|
|
6166
|
+
window.removeEventListener('keydown', this.keydownESC);
|
|
6167
|
+
}
|
|
6168
|
+
},
|
|
6169
|
+
methods: {
|
|
6170
|
+
// 创建输入框
|
|
6171
|
+
createChat() {
|
|
6172
|
+
this.chat = new ChatArea({
|
|
6173
|
+
elm: this.$refs.container,
|
|
6174
|
+
...this.$props,
|
|
6175
|
+
userList: JSON.parse(JSON.stringify(this.userList)),
|
|
6176
|
+
needDialog: !this.customDialog && this.device === 'pc',
|
|
6177
|
+
copyType: ['text'],
|
|
6178
|
+
asyncMatch: Boolean(this.asyncMatchFun),
|
|
6179
|
+
needDebounce: true,
|
|
6180
|
+
needCallSpace: false,
|
|
6181
|
+
sendKeyFun: this.submitType === 'enter' ? event => !event.shiftKey && event.key === 'Enter' : event => event.shiftKey && event.key === 'Enter',
|
|
6182
|
+
wrapKeyFun: this.submitType === 'shiftEnter' ? event => !event.shiftKey && event.key === 'Enter' : event => event.shiftKey && event.key === 'Enter'
|
|
6183
|
+
});
|
|
6184
|
+
this.opNode = this.chat.createOperateNode();
|
|
6185
|
+
// 订阅发送事件
|
|
6186
|
+
this.chat.addEventListener('enterSend', this.onSubmit);
|
|
6187
|
+
// 对输入框进行操作事件
|
|
6188
|
+
this.chat.addEventListener('operate', () => {
|
|
6189
|
+
this.chatState.isEmpty = this.chat.isEmpty(true);
|
|
6190
|
+
this.chatState.textLength = this.chat.textLength;
|
|
6191
|
+
this.$emit('change');
|
|
6192
|
+
});
|
|
6193
|
+
// 失去焦点记录最后一次光标Node节点
|
|
6194
|
+
this.chat.richText.addEventListener('blur', () => {
|
|
6195
|
+
const sel = getSelection();
|
|
6196
|
+
this.chatState.lastFocusNode = sel.focusNode;
|
|
6197
|
+
this.chatState.lastOffset = sel.focusOffset;
|
|
6198
|
+
}, true);
|
|
6199
|
+
// 订阅标签选择事件
|
|
6200
|
+
this.chat.addEventListener('selectCheck', () => {
|
|
6201
|
+
if (this.chatState.wrapCallSelectDialog && this.chatState.beforeText) {
|
|
6202
|
+
this.chat.insertText(this.chatState.beforeText);
|
|
6203
|
+
this.chatState.beforeText = '';
|
|
6204
|
+
}
|
|
6205
|
+
});
|
|
6206
|
+
this.chat.addEventListener('afterSelectCheck', () => {
|
|
6207
|
+
if (this.chatState.wrapCallSelectDialog && this.chatState.afterText) {
|
|
6208
|
+
this.chat.insertText(this.chatState.afterText);
|
|
6209
|
+
this.chatState.afterText = '';
|
|
6210
|
+
this.chatState.wrapCallSelectDialog = false;
|
|
6211
|
+
}
|
|
6212
|
+
});
|
|
6213
|
+
// 接管异步匹配
|
|
6214
|
+
if (this.asyncMatchFun) {
|
|
6215
|
+
this.chat.addEventListener('atMatch', this.asyncMatchFun);
|
|
6216
|
+
}
|
|
6217
|
+
// 检测多种弹窗唤起事件
|
|
6218
|
+
this.chat.addEventListener('showAtDialog', () => {
|
|
6219
|
+
this.$emit('show-at-dialog');
|
|
6220
|
+
});
|
|
6221
|
+
this.chat.addEventListener('showSelectDialog', (key, elm) => {
|
|
6222
|
+
this.$emit('show-select-dialog', key, elm);
|
|
6223
|
+
});
|
|
6224
|
+
this.chat.addEventListener('showTagDialog', prefix => {
|
|
6225
|
+
this.$emit('show-tag-dialog', prefix);
|
|
6226
|
+
});
|
|
6227
|
+
// 禁用编辑器
|
|
6228
|
+
if (this.disabled) {
|
|
6229
|
+
this.chat.disabled();
|
|
6230
|
+
}
|
|
6231
|
+
// 绑定ESC按键关闭提示标签
|
|
6232
|
+
window.addEventListener('keydown', this.keydownESC);
|
|
6233
|
+
},
|
|
6234
|
+
// 获取输入框当前内容
|
|
6235
|
+
getCurrentValue() {
|
|
6236
|
+
const text = this.chat.getText();
|
|
6237
|
+
const html = this.chat.getHtml();
|
|
6238
|
+
const inputTags = this.chat.getInputTagList();
|
|
6239
|
+
const userTags = this.userList.length > 0 ? this.chat.getCallUserTagList() : undefined;
|
|
6240
|
+
const selectTags = this.selectList.length > 0 ? this.chat.getSelectTagList() : undefined;
|
|
6241
|
+
const customTags = this.customTrigger.length > 0 ? this.chat.getCustomTagList() : undefined;
|
|
6242
|
+
return {
|
|
6243
|
+
text,
|
|
6244
|
+
html,
|
|
6245
|
+
inputTags,
|
|
6246
|
+
userTags,
|
|
6247
|
+
selectTags,
|
|
6248
|
+
customTags
|
|
6249
|
+
};
|
|
6250
|
+
},
|
|
6251
|
+
// 提交发送方法
|
|
6252
|
+
onSubmit() {
|
|
6253
|
+
// 内容纯空 拦截发送
|
|
6254
|
+
if (this.chatState.isEmpty) {
|
|
6255
|
+
return;
|
|
6256
|
+
}
|
|
6257
|
+
this.$emit('submit', this.getCurrentValue());
|
|
6258
|
+
},
|
|
6259
|
+
// 取消发送方法
|
|
6260
|
+
onCancel() {
|
|
6261
|
+
this.$emit('cancel');
|
|
6262
|
+
},
|
|
6263
|
+
// 清空输入框方法
|
|
6264
|
+
onClear(txt) {
|
|
6265
|
+
this.chat.clear(txt);
|
|
6266
|
+
// 将光标移动到末尾
|
|
6267
|
+
this.focusToEnd();
|
|
6268
|
+
},
|
|
6269
|
+
// 点击内容区域聚焦输入框
|
|
6270
|
+
onContentMouseDown() {
|
|
6271
|
+
requestAnimationFrame(() => {
|
|
6272
|
+
const focusElm = this.chatState.lastFocusNode?.parentElement;
|
|
6273
|
+
const chatInput = this.chat.chatInput;
|
|
6274
|
+
if (focusElm && focusElm.classList.contains('input-write')) {
|
|
6275
|
+
chatInput.setInputTagRange(this.chatState.lastFocusNode, this.chatState.lastOffset);
|
|
6276
|
+
} else {
|
|
6277
|
+
chatInput.restCursorPos(chatInput.vnode, chatInput.cursorIndex);
|
|
6278
|
+
}
|
|
6279
|
+
});
|
|
6280
|
+
},
|
|
6281
|
+
// 聚焦到文本最前方
|
|
6282
|
+
focusToStart() {
|
|
6283
|
+
if (this.chat && this.opNode) {
|
|
6284
|
+
this.opNode.setCursorNode(this.opNode.getNodeByRank(this.opNode.getRank(0) + this.opNode.getRank(0)), 0);
|
|
6285
|
+
}
|
|
6286
|
+
},
|
|
6287
|
+
// 聚焦到文本最后方
|
|
6288
|
+
focusToEnd() {
|
|
6289
|
+
if (this.chat && this.opNode) {
|
|
6290
|
+
this.opNode.setCursorNode(this.opNode.getNodeByRank(this.opNode.getRank(-1) + this.opNode.getRank(-1)));
|
|
6291
|
+
}
|
|
6292
|
+
},
|
|
6293
|
+
// 失去焦点
|
|
6294
|
+
onBlur() {
|
|
6295
|
+
if (this.chat) {
|
|
6296
|
+
const selection = getSelection();
|
|
6297
|
+
selection.removeAllRanges();
|
|
6298
|
+
this.chat.richText.blur();
|
|
6299
|
+
}
|
|
6300
|
+
},
|
|
6301
|
+
// 内容全选
|
|
6302
|
+
selectAll() {
|
|
6303
|
+
if (this.chat && this.opNode) {
|
|
6304
|
+
const firstNode = this.opNode.getNodeByRank(this.opNode.getRank(0) + this.opNode.getRank(0));
|
|
6305
|
+
const lastNode = this.opNode.getNodeByRank(this.opNode.getRank(-1) + this.opNode.getRank(-1));
|
|
6306
|
+
this.opNode.setSelectNodes(firstNode, lastNode);
|
|
6307
|
+
}
|
|
6308
|
+
},
|
|
6309
|
+
// 插入一个选择标签
|
|
6310
|
+
setSelectTag(key, tagId) {
|
|
6311
|
+
this.chatState.wrapCallSelectDialog = false;
|
|
6312
|
+
const tag = this.selectList?.find(option => option.key === key)?.options.find(tag => tag.id === tagId);
|
|
6313
|
+
if (tag) {
|
|
6314
|
+
this.chat.setSelectTag(tag, key);
|
|
6315
|
+
}
|
|
6316
|
+
},
|
|
6317
|
+
// 插入一个输入标签
|
|
6318
|
+
setInputTag(key, placeholder, defaultValue) {
|
|
6319
|
+
this.chat.setInputTag(key, placeholder, defaultValue);
|
|
6320
|
+
},
|
|
6321
|
+
// 插入一个@提及标签
|
|
6322
|
+
setUserTag(userId) {
|
|
6323
|
+
const user = this.userList?.find(user => user.id === userId);
|
|
6324
|
+
if (user) {
|
|
6325
|
+
this.chat.setUserTag(user);
|
|
6326
|
+
}
|
|
6327
|
+
},
|
|
6328
|
+
// 插入一个自定义触发符标签
|
|
6329
|
+
setCustomTag(prefix, id) {
|
|
6330
|
+
const custom = this.customTrigger?.find(option => option.prefix === prefix)?.tagList.find(tag => tag.id === id);
|
|
6331
|
+
if (custom) {
|
|
6332
|
+
this.chat.setCustomTag(custom, prefix);
|
|
6333
|
+
}
|
|
6334
|
+
},
|
|
6335
|
+
// 混合式插入
|
|
6336
|
+
setMixTags(tags) {
|
|
6337
|
+
// 整合ChatNode
|
|
6338
|
+
const chatNodes = tags.map((row, index) => {
|
|
6339
|
+
return {
|
|
6340
|
+
type: 'gridBox',
|
|
6341
|
+
rank: this.opNode.getRank(index),
|
|
6342
|
+
children: row.map(cRow => {
|
|
6343
|
+
return {
|
|
6344
|
+
type: cRow.type,
|
|
6345
|
+
text: cRow.value,
|
|
6346
|
+
html: cRow.value,
|
|
6347
|
+
dataset: {
|
|
6348
|
+
id: cRow.value,
|
|
6349
|
+
name: this.getNameByTypeId(cRow),
|
|
6350
|
+
prefix: cRow.key,
|
|
6351
|
+
key: cRow.key,
|
|
6352
|
+
placeholder: cRow.placeholder,
|
|
6353
|
+
value: cRow.value
|
|
6354
|
+
}
|
|
6355
|
+
};
|
|
6356
|
+
})
|
|
6357
|
+
};
|
|
6358
|
+
});
|
|
6359
|
+
this.opNode.coverNodes(chatNodes);
|
|
6360
|
+
},
|
|
6361
|
+
// 根据id和类型捕获目标name
|
|
6362
|
+
getNameByTypeId(mixTag) {
|
|
6363
|
+
const {
|
|
6364
|
+
type,
|
|
6365
|
+
value,
|
|
6366
|
+
key
|
|
6367
|
+
} = mixTag;
|
|
6368
|
+
switch (type) {
|
|
6369
|
+
case 'userTag':
|
|
6370
|
+
return this.userList?.find(user => user.id === value)?.name || '';
|
|
6371
|
+
case 'selectTag':
|
|
6372
|
+
return this.selectList?.find(row => row.key === key)?.options.find(select => select.id === value)?.name || '';
|
|
6373
|
+
case 'customTag':
|
|
6374
|
+
return this.customTrigger?.find(row => row.prefix === key)?.tagList.find(custom => custom.id === value)?.name || '';
|
|
6375
|
+
default:
|
|
6376
|
+
return '';
|
|
6377
|
+
}
|
|
6378
|
+
},
|
|
6379
|
+
// 在当前光标处插入html片段
|
|
6380
|
+
setHtml(html) {
|
|
6381
|
+
// 注* 插入的html标签必须是 行内 或 行内块元素,如果需要块级元素标签 请自行插入行内元素然后修改其css属性为块级元素
|
|
6382
|
+
this.chat.insertHtml(html);
|
|
6383
|
+
},
|
|
6384
|
+
// 在当前光标处插入text内容
|
|
6385
|
+
setText(txt) {
|
|
6386
|
+
this.chat.insertText(txt);
|
|
6387
|
+
},
|
|
6388
|
+
// 外部调用唤起标签选择弹窗
|
|
6389
|
+
openSelectDialog(option) {
|
|
6390
|
+
this.chatState.beforeText = option.beforeText || '';
|
|
6391
|
+
this.chatState.afterText = option.afterText || '';
|
|
6392
|
+
this.chatState.wrapCallSelectDialog = true;
|
|
6393
|
+
this.chat.showPCSelectDialog(option.key, option.elm);
|
|
6394
|
+
},
|
|
6395
|
+
// 打开前置提示标签
|
|
6396
|
+
openTipTag(options) {
|
|
6397
|
+
this.chat.openTipTag({
|
|
6398
|
+
...options,
|
|
6399
|
+
codeLabel: 'ESC'
|
|
6400
|
+
});
|
|
6401
|
+
},
|
|
6402
|
+
// 关闭前置提示标签
|
|
6403
|
+
closeTipTag() {
|
|
6404
|
+
this.chat.closeTipTag();
|
|
6405
|
+
},
|
|
6406
|
+
// 绑定ESC按键关闭提示标签
|
|
6407
|
+
keydownESC(event) {
|
|
6408
|
+
if (event.key === 'Escape') {
|
|
6409
|
+
this.closeTipTag();
|
|
6410
|
+
}
|
|
6411
|
+
},
|
|
6412
|
+
// 用户自定义弹窗写入@提及标签
|
|
6413
|
+
customSetUser(user) {
|
|
6414
|
+
// 该方法并未写入ts 因为是一个私有api没暴露给用户 其区别 setUserTag 相比会去向前截取掉触发符
|
|
6415
|
+
this.chat.onceSetTag(user);
|
|
6416
|
+
},
|
|
6417
|
+
// 用户自定义弹窗写入自定义触发符号标签
|
|
6418
|
+
customSetTag(prefix, tag) {
|
|
6419
|
+
this.chat.onceSetCustomTag(tag, prefix);
|
|
6420
|
+
},
|
|
6421
|
+
// 用户自定义弹窗更新选择标签
|
|
6422
|
+
updateSelectTag(elm, tag) {
|
|
6423
|
+
const rank = this.opNode.getRankByElm(elm.parentElement);
|
|
6424
|
+
if (!rank) {
|
|
6425
|
+
return;
|
|
6426
|
+
}
|
|
6427
|
+
const chatNode = this.opNode.getNodeByRank(rank);
|
|
6428
|
+
if (!chatNode) {
|
|
6429
|
+
return;
|
|
6430
|
+
}
|
|
6431
|
+
const dataset = chatNode.dataset;
|
|
6432
|
+
dataset.id = tag.id;
|
|
6433
|
+
dataset.name = tag.name;
|
|
6434
|
+
this.opNode.updateNode(chatNode);
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6437
|
+
});
|
|
6438
|
+
;// ./src/components/EditorSender/src/main.vue?vue&type=script&lang=js
|
|
6439
|
+
/* harmony default export */ const src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
|
|
6440
|
+
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/main.vue?vue&type=style&index=0&id=8ce301dc&prod&lang=scss&scoped=true
|
|
6441
|
+
var mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true = __webpack_require__(9125);
|
|
6442
|
+
;// ./node_modules/style-loader/dist/cjs.js!./node_modules/css-loader/dist/cjs.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/EditorSender/src/main.vue?vue&type=style&index=0&id=8ce301dc&prod&lang=scss&scoped=true
|
|
6443
|
+
|
|
6444
|
+
|
|
6445
|
+
|
|
6446
|
+
var mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true_options = {};
|
|
6447
|
+
|
|
6448
|
+
mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true_options.insert = "head";
|
|
6449
|
+
mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true_options.singleton = false;
|
|
6450
|
+
|
|
6451
|
+
var mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true_update = injectStylesIntoStyleTag_default()(mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true/* default */.A, mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true_options);
|
|
6452
|
+
|
|
6453
|
+
|
|
6454
|
+
|
|
6455
|
+
/* harmony default export */ const src_mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true = (mainvue_type_style_index_0_id_8ce301dc_prod_lang_scss_scoped_true/* default */.A.locals || {});
|
|
6456
|
+
;// ./src/components/EditorSender/src/main.vue?vue&type=style&index=0&id=8ce301dc&prod&lang=scss&scoped=true
|
|
6457
|
+
|
|
6458
|
+
;// ./src/components/EditorSender/src/main.vue
|
|
6459
|
+
|
|
6460
|
+
|
|
6461
|
+
|
|
6462
|
+
;
|
|
6463
|
+
|
|
6464
|
+
|
|
6465
|
+
/* normalize component */
|
|
6466
|
+
|
|
6467
|
+
var main_component = (0,componentNormalizer/* default */.A)(
|
|
6468
|
+
src_mainvue_type_script_lang_js,
|
|
6469
|
+
render,
|
|
6470
|
+
staticRenderFns,
|
|
6471
|
+
false,
|
|
6472
|
+
null,
|
|
6473
|
+
"8ce301dc",
|
|
6474
|
+
null
|
|
6475
|
+
|
|
6476
|
+
)
|
|
6477
|
+
|
|
6478
|
+
/* harmony default export */ const main = (main_component.exports);
|
|
6479
|
+
;// ./src/components/EditorSender/index.js
|
|
6480
|
+
|
|
6481
|
+
|
|
6482
|
+
/* istanbul ignore next */
|
|
6483
|
+
main.install = function (Vue) {
|
|
6484
|
+
Vue.component(main.name, main);
|
|
6485
|
+
};
|
|
6486
|
+
/* harmony default export */ const EditorSender = (main);
|
|
6487
|
+
|
|
5582
6488
|
/***/ }),
|
|
5583
6489
|
|
|
5584
6490
|
/***/ 1519:
|
|
@@ -5992,6 +6898,26 @@ module.exports = function text(state, silent) {
|
|
|
5992
6898
|
};*/
|
|
5993
6899
|
|
|
5994
6900
|
|
|
6901
|
+
/***/ }),
|
|
6902
|
+
|
|
6903
|
+
/***/ 2351:
|
|
6904
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
6905
|
+
|
|
6906
|
+
"use strict";
|
|
6907
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6908
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
6909
|
+
/* harmony export */ });
|
|
6910
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6314);
|
|
6911
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
6912
|
+
// Imports
|
|
6913
|
+
|
|
6914
|
+
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
|
|
6915
|
+
// Module
|
|
6916
|
+
___CSS_LOADER_EXPORT___.push([module.id, "[data-v-353808b6]:root{--color-primary: #409eff;--color-success: #67c23a;--color-warning: #e6a23c;--color-danger: #f56c6c;--color-info: #909399}.el-x-send-button[data-v-353808b6]{height:32px}.el-x-send-button .el-button[data-v-353808b6]{padding:0;width:32px;height:32px}.el-x-send-button .loading-svg[data-v-353808b6]{color:#409eff;width:100%}", ""]);
|
|
6917
|
+
// Exports
|
|
6918
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
6919
|
+
|
|
6920
|
+
|
|
5995
6921
|
/***/ }),
|
|
5996
6922
|
|
|
5997
6923
|
/***/ 2373:
|
|
@@ -23729,6 +24655,23 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
|
23729
24655
|
|
|
23730
24656
|
module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/
|
|
23731
24657
|
|
|
24658
|
+
/***/ }),
|
|
24659
|
+
|
|
24660
|
+
/***/ 2736:
|
|
24661
|
+
/***/ ((module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
|
24662
|
+
|
|
24663
|
+
"use strict";
|
|
24664
|
+
/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6314);
|
|
24665
|
+
/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
24666
|
+
// Imports
|
|
24667
|
+
|
|
24668
|
+
var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
|
|
24669
|
+
// Module
|
|
24670
|
+
___CSS_LOADER_EXPORT___.push([module.id, ":root{--chat-primary: #1890ff;--chat-disabled: #e8e8e8;--chat-highlight: #40A9FF;--chat-text: #333;--chat-text-assistant: #666;--chat-text-secondary: #ccc;--chat-text-placeholder: #bfbfbf;--chat-box: #fff;--chat-box-shadow: 1px 3px 10px 2px rgba(6, 21, 50, .2);--chat-box-mark: rgba(0, 0, 0, .5);--chat-input: #F9F9F9;--chat-card: #F2F6FC;--chat-highlight-card: #E6F7FF;--chat-border: #f1f1f2;--chat-popover: #000;--chat-popover-text: #fff}@-webkit-keyframes antSpinMove{to{opacity:1}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antRotate{to{transform:rotate(405deg)}}@keyframes antRotate{to{transform:rotate(405deg)}}.ant-spin{font-size:14px;line-height:1.5;list-style:none;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\";position:absolute;display:none;text-align:center;vertical-align:middle;opacity:0;transition:transform .3s cubic-bezier(.78,.14,.15,.86)}.ant-spin .ant-spin-dot{position:relative;display:inline-block;font-size:20px;width:1em;height:1em}.ant-spin .ant-spin-dot-spin{transform:rotate(45deg);animation-name:antRotate;animation-duration:1.2s;animation-iteration-count:infinite;animation-timing-function:linear}.ant-spin .ant-spin-dot-item{position:absolute;display:block;width:9px;height:9px;background-color:var(--chat-primary);border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation-name:antSpinMove;animation-duration:1s;animation-iteration-count:infinite;animation-timing-function:linear;animation-direction:alternate}.ant-spin .ant-spin-dot-item:nth-child(1){top:0;inset-inline-start:0}.ant-spin .ant-spin-dot-item:nth-child(2){top:0;inset-inline-end:0;animation-delay:.4s}.ant-spin .ant-spin-dot-item:nth-child(3){inset-inline-end:0;bottom:0;animation-delay:.8s}.ant-spin .ant-spin-dot-item:nth-child(4){bottom:0;inset-inline-start:0;animation-delay:1.2s}.ant-spin-spinning{position:static;display:inline-block;opacity:1}.chat-area-pc{position:relative;z-index:10}.chat-area-pc *{margin:0;padding:0;box-sizing:border-box;outline:none;text-indent:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;font-size:16px}@keyframes a-chat-dialog{0%{transform:scale(.6);opacity:.4}to{opacity:1;transform:scale(1)}}@keyframes a-chat-check-pc{0%{transform:scale(.4) translate(-50%,-50%);opacity:.4}to{opacity:1;transform:scale(1) translate(-50%,-50%)}}.chat-area-h5{position:relative;z-index:10}.chat-area-h5 *{margin:0;padding:0;box-sizing:border-box;outline:none;text-indent:0;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;font-size:16px}@keyframes a-popup-mark{0%{background:#0000}to{background:var(--chat-box-mark)}}@keyframes a-popup-mark-leave{0%{background:var(--chat-box-mark)}to{background:#0000}}@keyframes a-popup-main{0%{bottom:-100%}to{bottom:0}}@keyframes a-popup-main-leave{0%{bottom:0}to{bottom:-100%}}.chat-rich-text{width:100%;padding:10px;margin:0;background:transparent;border-radius:4px;outline:none;box-sizing:border-box;overflow-y:auto;font-size:16px;color:var(--chat-text);vertical-align:text-bottom;transition:all .4s ease;word-break:break-all}.chat-rich-text-disabled{cursor:not-allowed}.chat-dialog{position:relative;z-index:20;width:100%;height:0}.chat-tip-dialog{position:relative;z-index:21;width:100%;height:0}.call-user-dialog{position:absolute;z-index:2024;border-radius:4px;padding:4px;box-sizing:border-box;width:180px;overflow:hidden;background:var(--chat-box);box-shadow:var(--chat-box-shadow)}.call-user-dialog *{margin:0;padding:0;box-sizing:border-box}.call-user-dialog.chat-view-show{animation:a-chat-dialog .2s ease}.call-user-dialog .call-user-dialog-header{display:flex;align-items:center;justify-content:space-between;background:var(--chat-box);padding:6px 4px}.call-user-dialog .call-user-dialog-header .call-user-dialog-header-title{color:var(--chat-text);font-weight:700;font-size:14px}.call-user-dialog .call-user-dialog-header .call-user-dialog-header-check{color:var(--chat-primary);font-size:12px;cursor:pointer}.call-user-dialog .call-user-dialog-main{max-height:240px;overflow-y:auto}.call-user-dialog .call-user-dialog-item{display:flex;align-items:center;color:var(--chat-text-secondary);background:transparent;cursor:pointer;padding:4px;transition:all .3s ease;font-weight:700;font-size:14px;border-radius:4px}.call-user-dialog .call-user-dialog-item .call-user-dialog-item-name{transition:all .3s ease;color:var(--chat-text-secondary)}.call-user-dialog .call-user-dialog-item:hover{background:var(--chat-card);opacity:.7}.call-user-dialog .call-user-dialog-item:hover .call-user-dialog-item-name{color:var(--chat-primary)}.call-user-dialog .call-user-dialog-item.call-user-dialog-item-active{background:var(--chat-card);opacity:1}.call-user-dialog .call-user-dialog-item.call-user-dialog-item-active .call-user-dialog-item-name{color:var(--chat-primary)}.call-user-dialog .call-user-dialog-item.user-no-match{display:none}.call-user-dialog .call-user-dialog-loading{display:flex;align-items:center;justify-content:center;height:36px}.call-user-dialog .call-user-dialog-empty{display:flex;align-items:center;flex-direction:column;justify-content:center;padding:10px 0}.call-user-dialog .call-user-dialog-empty .match-empty-svg{width:auto;height:40px;margin-bottom:2px}.call-user-dialog .call-user-dialog-empty .empty-label{font-size:12px;color:var(--chat-text-secondary)}.call-user-popup{position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;background:var(--chat-box-mark)}.call-user-popup div,.call-user-popup p,.call-user-popup span,.call-user-popup label,.call-user-popup a,.call-user-popup ul,.call-user-popup li{margin:0;padding:0;box-sizing:border-box}.call-user-popup .call-user-popup-main{position:absolute;left:0;bottom:0;width:100%;height:86%;display:flex;flex-direction:column;background:var(--chat-box);border-radius:16px 16px 0 0;overflow:hidden;padding:14px}.call-user-popup .call-user-popup-header{display:flex;align-items:center}.call-user-popup .call-user-popup-header .popup-show{font-size:16px;color:var(--chat-text-assistant)}.call-user-popup .call-user-popup-header .popup-check{font-size:18px;color:var(--chat-primary);transition:color .3s ease}.call-user-popup .call-user-popup-header .popup-check.disabled{color:var(--chat-disabled)}.call-user-popup .call-user-popup-header .popup-title{flex:1;font-weight:700;font-size:21px;text-align:center;color:var(--chat-text)}.call-user-popup .call-user-popup-search{display:flex;align-items:center;margin-top:20px;background:var(--chat-input);height:44px;border-radius:4px;padding:0 15px}.call-user-popup .call-user-popup-search .call-user-popup-search-input{width:100%;height:100%;background:transparent;padding-left:8px;outline:none;border:none;font-size:16px;color:var(--chat-text)}.call-user-popup .call-user-popup-search .call-user-popup-search-input::-moz-placeholder{color:var(--chat-text-placeholder);opacity:1}.call-user-popup .call-user-popup-search .call-user-popup-search-input:-ms-input-placeholder{color:var(--chat-text-placeholder)}.call-user-popup .call-user-popup-search .call-user-popup-search-input::-webkit-input-placeholder{color:var(--chat-text-placeholder)}.call-user-popup .call-user-popup-search .call-user-popup-search-input:placeholder-shown{text-overflow:ellipsis}.call-user-popup .call-user-popup-search .icon-search{width:auto;height:30px}.call-user-popup .call-user-popup-body{flex:1;padding-top:25px;overflow-y:auto}.call-user-popup .call-user-popup-body .call-user-popup-item{position:relative;padding:15px 10px;display:flex;align-items:center;border-bottom:1px solid var(--chat-border)}.call-user-popup .call-user-popup-body .call-user-popup-item input{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;width:100%;height:100%;opacity:0;box-sizing:border-box}.call-user-popup .call-user-popup-body .call-user-popup-item .user-popup-check-item-inner{position:relative;top:0;left:0;display:block;width:25px;height:25px;border-radius:50%;background-color:var(--chat-box);border:1px solid var(--chat-border);border-collapse:separate;transition:all .3s;box-sizing:border-box}.call-user-popup .call-user-popup-body .call-user-popup-item .user-popup-check-item-inner:after{position:absolute;top:50%;left:30%;display:table;width:5px;height:9px;border:3px solid var(--chat-box);border-top:0;border-left:0;transform:rotate(45deg) scale(0) translate(-60%,-50%);opacity:0;transition:all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;content:\" \"}.call-user-popup .call-user-popup-body .call-user-popup-item.user-popup-check-item-check .user-popup-check-item-inner{background-color:var(--chat-primary);border-color:var(--chat-primary)}.call-user-popup .call-user-popup-body .call-user-popup-item.user-popup-check-item-check .user-popup-check-item-inner:after{position:absolute;display:table;border:3px solid var(--chat-box);border-top:0;border-left:0;transform:rotate(45deg) scale(1) translate(-60%,-50%);opacity:1;transition:all .2s cubic-bezier(.12,.4,.29,1.46) .1s;content:\" \"}.call-user-popup .call-user-popup-body .call-user-dialog-item-sculpture{width:35px;height:35px;border-radius:4px}.call-user-popup .call-user-popup-body .call-user-dialog-item-sculpture span{font-size:16px}.call-user-popup .call-user-popup-body .call-user-dialog-item-name{padding-left:8px;font-size:16px;line-height:35px;color:var(--chat-text)}.call-user-popup .call-user-popup-empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;justify-content:center}.call-user-popup .call-user-popup-empty .empty-svg{width:auto;height:60px}.call-user-popup .call-user-popup-empty .empty-label{margin-top:10px;font-size:12px;color:var(--chat-text-secondary)}.call-user-popup .call-user-popup-loading{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;justify-content:center;height:36px}.call-user-popup .call-user-popup-loading .ant-spin{transform:scale(1.5)}.call-user-popup.chat-view-show{animation:a-popup-mark .3s ease}.call-user-popup.chat-view-show .call-user-popup-main{animation:a-popup-main .3s ease}.call-user-popup.chat-view-hidden{animation:a-popup-mark-leave .3s ease-in}.call-user-popup.chat-view-hidden .call-user-popup-main{animation:a-popup-main-leave .3s ease-in}.checkbox-dialog{position:fixed;top:0;left:0;margin:0;padding:0;width:100vw;height:100vh;box-sizing:border-box;background:var(--chat-box-mark);z-index:10000}.checkbox-dialog.chat-view-show .checkbox-dialog-container{transform-origin:0 0 0;animation:a-chat-check-pc .3s ease}.checkbox-dialog *{margin:0;padding:0;box-sizing:border-box}.checkbox-dialog .checkbox-dialog-container{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:684px;height:540px;padding:14px 14px 0;border-radius:4px;background:var(--chat-box);box-shadow:var(--chat-box-shadow);overflow:hidden}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-header{display:flex;align-items:center;justify-content:space-between;height:22px;color:var(--chat-text-secondary);font-size:16px}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-header .checkbox-dialog-container-header-close{cursor:pointer;transition:all .3s ease}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-header .checkbox-dialog-container-header-close:hover{color:var(--chat-text-assistant)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body{display:flex;flex-direction:row;width:100%;height:calc(100% - 22px);padding-top:16px}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box{position:relative;width:50%;height:100%;padding-top:20px;padding-bottom:20px;padding-left:20px}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search{position:relative;padding-right:20px;margin-bottom:20px}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input{position:relative;box-sizing:border-box;margin:0;font-variant:tabular-nums;list-style:none;font-feature-settings:\"tnum\";display:inline-block;width:100%;height:32px;padding:4px 11px;color:var(--chat-text);font-size:14px;line-height:1.5;background-color:var(--chat-box);background-image:none;border:1px solid var(--chat-border);border-radius:4px;transition:all .3s}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input::-moz-placeholder{color:var(--chat-text-placeholder);opacity:1}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input:-ms-input-placeholder{color:var(--chat-text-placeholder)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input::-webkit-input-placeholder{color:var(--chat-text-placeholder)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input:placeholder-shown{text-overflow:ellipsis}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input:focus,.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input:hover{border-color:var(--chat-primary);border-right-width:1px!important}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search .checkbox-dialog-search-input:focus{outline:0}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags{width:100%;height:calc(100% - 98px);overflow-y:auto;overflow-x:hidden}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags:after{display:block;content:\"\";clear:both}@keyframes tag-scale{0%{transform:scale(0)}to{transform:scale(1)}}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags .checkbox-dialog-tag-item{float:left;display:flex;align-items:center;justify-content:center;margin-right:8px;margin-bottom:6px;background:var(--chat-card);border-radius:4px;font-size:12px;color:var(--chat-text-assistant);padding:4px 8px;cursor:default;animation:tag-scale .3s ease}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags .checkbox-dialog-tag-item .checkbox-dialog-tag-item-close{cursor:pointer;margin-left:6px;color:var(--chat-text-secondary);transform:scale(.7);transition:color .3s ease}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags .checkbox-dialog-tag-item .checkbox-dialog-tag-item-close:hover{color:var(--chat-primary)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags .check-empty{height:40%;display:flex;flex-direction:column;align-items:center;justify-content:center}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags .check-empty .check-empty-svg{width:auto;height:60px}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-tags .check-empty .check-empty-label{margin-top:10px;font-size:12px;color:var(--chat-text-secondary)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-option{position:absolute;left:20px;bottom:20px;display:flex;align-items:center}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-option .checkbox-dialog-option-btn{position:relative;width:76px;height:36px;text-align:center;color:var(--chat-text-assistant);border:1px solid var(--chat-border);background:transparent;cursor:pointer;outline:none;text-indent:8px;letter-spacing:8px;border-radius:4px;font-size:14px;transition:all .3s ease}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-option .checkbox-dialog-option-btn.btn-submit{border:none;margin-right:16px;background:var(--chat-primary);color:var(--chat-box)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-option .checkbox-dialog-option-btn.btn-submit.disabled{background:var(--chat-primary);opacity:.4;cursor:not-allowed}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-option .checkbox-dialog-option-btn.btn-close:hover{border-color:var(--chat-primary);color:var(--chat-primary)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search-group{color:var(--chat-text-assistant);line-height:1.5;list-style:none;font-feature-settings:\"tnum\";position:absolute;width:calc(100% - 20px);max-height:250px;top:calc(100% + 2px);left:0;z-index:1050;box-sizing:border-box;font-size:14px;font-variant:normal;background-color:var(--chat-box);border-radius:4px;outline:none;box-shadow:var(--chat-box-shadow);overflow-y:auto}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-left-box .checkbox-dialog-search-group .checkbox-dialog-search-empty{padding:34px 0;text-align:center;color:var(--chat-text-secondary)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-right-box{width:50%;height:100%;padding-top:20px;border-left:1px solid var(--chat-border)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-right-box .checkbox-dialog-right-box-title{padding-left:20px;font-size:16px;height:22px;color:var(--chat-text-assistant);font-weight:700}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-right-box .checkbox-dialog-check-group{width:calc(100% + 14px);height:calc(100% - 22px);padding-top:8px;overflow-x:hidden;overflow-y:auto}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item{position:relative;display:flex;align-items:center;padding-left:20px;height:44px;font-size:14px;transition:all .3s ease}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item:hover{background:var(--chat-card);cursor:pointer}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item input{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;width:100%;height:100%;cursor:pointer;opacity:0;box-sizing:border-box;touch-action:manipulation}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item .checkbox-dialog-check-item-inner{position:relative;top:0;left:0;display:block;width:18px;height:18px;margin-right:12px;border-radius:50%;background-color:var(--chat-box);border:1px solid var(--chat-border);border-collapse:separate;transition:all .3s;box-sizing:border-box}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item .checkbox-dialog-check-item-inner:after{position:absolute;top:50%;left:22%;display:table;width:4px;height:8px;border:2px solid var(--chat-border);border-top:0;border-left:0;transform:rotate(45deg) scale(0) translate(-50%,-50%);opacity:0;transition:all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;content:\" \"}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item.checkbox-dialog-check-item-check .checkbox-dialog-check-item-inner{background-color:var(--chat-primary);border-color:var(--chat-primary)}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item.checkbox-dialog-check-item-check .checkbox-dialog-check-item-inner:after{position:absolute;display:table;border:2px solid var(--chat-box);border-top:0;border-left:0;transform:rotate(45deg) scale(1) translate(-50%,-50%);opacity:1;transition:all .2s cubic-bezier(.12,.4,.29,1.46) .1s;content:\" \"}.checkbox-dialog .checkbox-dialog-container .checkbox-dialog-container-body .checkbox-dialog-check-item .checkbox-dialog-check-item-label{display:flex;align-items:center;font-size:14px}.call-tag-dialog{position:absolute;z-index:2024;border-radius:4px;padding:4px;box-sizing:border-box;width:180px;overflow:hidden;background:var(--chat-box);box-shadow:var(--chat-box-shadow)}.call-tag-dialog.chat-view-show{animation:a-chat-dialog .2s ease}.call-tag-dialog .call-tag-dialog-header{display:flex;align-items:center;justify-content:space-between;background:var(--chat-box);padding:6px 4px}.call-tag-dialog .call-tag-dialog-header .call-tag-dialog-header-title{color:var(--chat-text);font-weight:700;font-size:14px}.call-tag-dialog .call-tag-dialog-main{max-height:240px;overflow-y:auto}.call-tag-dialog .call-tag-dialog-item{display:flex;align-items:center;color:var(--chat-text-secondary);background:transparent;cursor:pointer;padding:4px 8px;transition:all .3s ease;font-weight:700;font-size:14px;border-radius:4px}.call-tag-dialog .call-tag-dialog-item .call-tag-dialog-item-name{transition:all .3s ease;color:var(--chat-text-secondary)}.call-tag-dialog .call-tag-dialog-item:hover{background:var(--chat-card);opacity:.7}.call-tag-dialog .call-tag-dialog-item:hover .call-tag-dialog-item-name{color:var(--chat-primary)}.call-tag-dialog .call-tag-dialog-item.call-tag-dialog-item-active{background:var(--chat-card);opacity:1}.call-tag-dialog .call-tag-dialog-item.call-tag-dialog-item-active .call-tag-dialog-item-name{color:var(--chat-primary)}.call-tag-dialog .call-tag-dialog-item.tag-no-match{display:none}.chat-select-dialog{position:fixed;min-width:180px;z-index:2024;border-radius:4px;padding:4px;box-sizing:border-box;width:auto;background:var(--chat-box);box-shadow:var(--chat-box-shadow)}.chat-select-dialog .chat-select-dialog-header{display:flex;align-items:center;justify-content:space-between;background:var(--chat-box);padding:6px}.chat-select-dialog .chat-select-dialog-header .chat-select-dialog-header-title{color:var(--chat-text);font-weight:700;font-size:14px}.chat-select-dialog .chat-select-dialog-main{position:relative;z-index:3;max-height:280px;overflow-y:auto}.chat-select-dialog .chat-select-dialog-main .chat-select-dialog-item{display:flex;align-items:center;color:var(--chat-text-secondary);background:transparent;cursor:pointer;padding:8px;transition:all .3s ease;font-weight:700;font-size:14px;border-radius:6px;min-height:42px}.chat-select-dialog .chat-select-dialog-main .chat-select-dialog-item .chat-select-dialog-preview{width:42px;height:42px;border-radius:6px;flex-shrink:0;margin-right:12px}.chat-select-dialog .chat-select-dialog-main .chat-select-dialog-item .chat-select-dialog-name{flex:1;transition:all .3s ease;color:var(--chat-text-secondary)}.chat-select-dialog .chat-select-dialog-main .chat-select-dialog-item .chat-select-dialog-check{display:inline-block;margin-left:6px;font-size:12px;color:var(--chat-primary)}.chat-select-dialog .chat-select-dialog-main .chat-select-dialog-item:hover{background:var(--chat-card);opacity:.8}.chat-select-dialog .chat-select-dialog-main .chat-select-dialog-item:hover .chat-select-dialog-name{color:var(--chat-primary)}.chat-select-dialog .chat-select-arrow{position:absolute;z-index:2;pointer-events:none;width:16px;height:16px;overflow:hidden}.chat-select-dialog .chat-select-arrow:before{box-sizing:border-box;background:var(--chat-box);position:absolute;bottom:0;inset-inline-start:0;width:16px;height:8px;clip-path:path(\"M 0 8 A 4 4 0 0 0 2.82842712474619 6.82842712474619 L 6.585786437626905 3.0710678118654755 A 2 2 0 0 1 9.414213562373096 3.0710678118654755 L 13.17157287525381 6.82842712474619 A 4 4 0 0 0 16 8 Z\");content:\"\"}.chat-select-dialog .chat-select-arrow:after{box-sizing:border-box;content:\"\";position:absolute;width:9px;height:9px;bottom:0;inset-inline:0;margin:auto;border-radius:0 0 2px;transform:translateY(50%) rotate(-135deg);box-shadow:var(--chat-box-shadow);z-index:0;background:transparent;opacity:.25}.call-user-dialog-item-sculpture{display:flex;align-items:center;justify-content:center;width:24px;height:24px;margin-right:8px;border-radius:4px;overflow:hidden;background:var(--chat-primary);color:var(--chat-box);white-space:nowrap;font-size:12px}.call-user-dialog-item-sculpture *{margin:0;padding:0;box-sizing:border-box}.call-user-dialog-item-sculpture.is-avatar{background:var(--chat-box)}.call-user-dialog-item-sculpture.is-avatar img{width:100%;height:100%}.call-user-dialog-item-sculpture span{font-size:12px;color:var(--chat-box)}.call-user-dialog-item-name{flex:1;white-space:nowrap;line-height:24px;overflow:hidden;text-overflow:ellipsis;padding-right:10px;color:var(--chat-text-assistant);font-size:14px}.chat-select-dialog-main::-webkit-scrollbar,.call-user-dialog-main::-webkit-scrollbar,.call-tag-dialog-main::-webkit-scrollbar,.checkbox-dialog-check-group::-webkit-scrollbar,.checkbox-dialog-tags::-webkit-scrollbar{width:6px;height:6px}.chat-select-dialog-main::-webkit-scrollbar-thumb,.call-user-dialog-main::-webkit-scrollbar-thumb,.call-tag-dialog-main::-webkit-scrollbar-thumb,.checkbox-dialog-check-group::-webkit-scrollbar-thumb,.checkbox-dialog-tags::-webkit-scrollbar-thumb{border-radius:10px;box-shadow:inset 0 0 5px #61b8b31a;background-color:#0003}.chat-select-dialog-main::-webkit-scrollbar-track,.call-user-dialog-main::-webkit-scrollbar-track,.call-tag-dialog-main::-webkit-scrollbar-track,.checkbox-dialog-check-group::-webkit-scrollbar-track,.checkbox-dialog-tags::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #57afbb1a;border-radius:10px;background:#ededed}.disable-scroll{overflow-y:hidden!important}.chat-placeholder-wrap{position:absolute;top:0;left:0;width:100%;margin:0;padding:10px;box-sizing:border-box;color:var(--chat-text-placeholder);pointer-events:none;font-style:oblique;word-break:break-all;z-index:11}.chat-tip-wrap{position:absolute;top:0;left:0;width:auto;height:100%;margin:0;padding:10px 6px 10px 10px;box-sizing:border-box;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:21}.chat-tip-wrap .chat-tip-tag{position:relative;padding:2px 6px;color:var(--chat-primary);border-radius:8px;pointer-events:visible;cursor:pointer;transition:background .3s ease}.chat-tip-wrap .chat-tip-tag .chat-tip-tag-txt{font-size:18px;font-weight:600;font-family:宋体}.chat-tip-wrap .chat-tip-tag .chat-tip-tag-close{top:-4px;right:-4px;position:absolute;font-size:12px;opacity:0;transition:all .3s ease;color:var(--chat-text)}.chat-tip-wrap .chat-tip-tag .chat-tip-tag-close svg{font-size:inherit}.chat-tip-wrap .chat-tip-tag:hover{background:var(--chat-card)}.chat-tip-wrap .chat-tip-tag:hover .chat-tip-tag-close{opacity:1}.chat-tip-popover{position:absolute}.chat-tip-popover .chat-tip-popover-main{display:flex;align-items:center;padding:8px 10px;background:var(--chat-popover);color:var(--chat-popover-text);font-size:13px;border-radius:8px}.chat-tip-popover .chat-tip-popover-main .chat-tip-popover-code{margin-left:4px;opacity:.7;font-size:12px}.chat-tip-popover .chat-tip-popover-main .chat-tip-popover-code.chat-view-show{display:none}.chat-tip-popover .chat-tip-popover-arrow{position:absolute;z-index:2;pointer-events:none;width:16px;height:16px;overflow:hidden;left:50%;transform:translate(-50%) rotate(-180deg)}.chat-tip-popover .chat-tip-popover-arrow:before{box-sizing:border-box;background:var(--chat-popover);position:absolute;bottom:0;inset-inline-start:0;width:16px;height:8px;clip-path:path(\"M 0 8 A 4 4 0 0 0 2.82842712474619 6.82842712474619 L 6.585786437626905 3.0710678118654755 A 2 2 0 0 1 9.414213562373096 3.0710678118654755 L 13.17157287525381 6.82842712474619 A 4 4 0 0 0 16 8 Z\");content:\"\"}.chat-img{min-width:20px;min-height:20px;max-width:100px;max-height:100px;vertical-align:bottom}.chat-tag{margin:0 1px}.chat-grid-input{word-break:break-all}.at-user,.at-tag{color:var(--chat-primary)}.at-select{display:inline-block;cursor:pointer;background:var(--chat-card);color:var(--chat-primary);padding:2px 6px;border-radius:10px;margin:2px;transition:all .3s ease}.at-select svg{margin-left:4px;font-size:12px;transition:all .3s ease}.at-select:hover{color:var(--chat-highlight);background:var(--chat-highlight-card)}.at-select.aim svg{transform:rotate(-180deg)}.at-input{padding:2px 6px;border-radius:10px;margin:0 2px;color:var(--chat-primary);cursor:text;background:var(--chat-card);line-height:1.8}.at-input .input-write{white-space:pre-wrap;word-break:break-all;word-wrap:break-word;padding-left:.1px}.at-input .input-tip{pointer-events:none;-webkit-user-select:none;user-select:none;opacity:.35;word-break:break-all}\n", ""]);
|
|
24671
|
+
// Exports
|
|
24672
|
+
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (___CSS_LOADER_EXPORT___)));
|
|
24673
|
+
|
|
24674
|
+
|
|
23732
24675
|
/***/ }),
|
|
23733
24676
|
|
|
23734
24677
|
/***/ 2828:
|
|
@@ -28784,6 +29727,26 @@ module.exports = function link_pairs(state) {
|
|
|
28784
29727
|
};
|
|
28785
29728
|
|
|
28786
29729
|
|
|
29730
|
+
/***/ }),
|
|
29731
|
+
|
|
29732
|
+
/***/ 6021:
|
|
29733
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
29734
|
+
|
|
29735
|
+
"use strict";
|
|
29736
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
29737
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
29738
|
+
/* harmony export */ });
|
|
29739
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6314);
|
|
29740
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
29741
|
+
// Imports
|
|
29742
|
+
|
|
29743
|
+
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
|
|
29744
|
+
// Module
|
|
29745
|
+
___CSS_LOADER_EXPORT___.push([module.id, ".el-x-send-button .el-button .el-icon-brush[data-v-3e37542a]{transform:rotate(180deg)}", ""]);
|
|
29746
|
+
// Exports
|
|
29747
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
29748
|
+
|
|
29749
|
+
|
|
28787
29750
|
/***/ }),
|
|
28788
29751
|
|
|
28789
29752
|
/***/ 6027:
|
|
@@ -34679,6 +35642,26 @@ module.exports = function parseLinkDestination(str, pos, max) {
|
|
|
34679
35642
|
};
|
|
34680
35643
|
|
|
34681
35644
|
|
|
35645
|
+
/***/ }),
|
|
35646
|
+
|
|
35647
|
+
/***/ 9125:
|
|
35648
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
35649
|
+
|
|
35650
|
+
"use strict";
|
|
35651
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
35652
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
35653
|
+
/* harmony export */ });
|
|
35654
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6314);
|
|
35655
|
+
/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
35656
|
+
// Imports
|
|
35657
|
+
|
|
35658
|
+
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});
|
|
35659
|
+
// Module
|
|
35660
|
+
___CSS_LOADER_EXPORT___.push([module.id, "[data-v-8ce301dc]:root{--color-primary: #409eff;--color-success: #67c23a;--color-warning: #e6a23c;--color-danger: #f56c6c;--color-info: #909399}.el-editor-sender-wrap[data-v-8ce301dc]{position:relative;width:100%;box-sizing:border-box;transition:background .3s;border-radius:calc(4px*2);border-color:#dcdfe6;box-shadow:0 1px 2px 0 rgba(0,0,0,.03),0 1px 6px -1px rgba(0,0,0,.02),0 2px 4px 0 rgba(0,0,0,.02);border-width:0;border-style:solid}.el-editor-sender-wrap[data-v-8ce301dc]:after{content:\"\";position:absolute;inset:0;pointer-events:none;transition:border-color .3s;border-radius:inherit;border-style:inherit;border-color:inherit;border-width:1px}.el-editor-sender-wrap[data-v-8ce301dc]:focus-within{box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.04);border-color:#409eff}.el-editor-sender-wrap[data-v-8ce301dc]:focus-within::after{border-width:2px}.el-editor-sender-wrap .el-editor-sender-header[data-v-8ce301dc]{display:flex;flex-direction:column;gap:8px;width:100%;margin:0;padding:0}.el-editor-sender-wrap .el-editor-sender-header .el-editor-sender-header-container[data-v-8ce301dc]{border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#dcdfe6}.el-editor-sender-wrap .el-editor-sender-content[data-v-8ce301dc]{display:flex;width:100%;gap:8px;padding-block:12px;padding-inline-start:16px;padding-inline-end:12px;box-sizing:border-box;align-items:flex-end}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-prefix[data-v-8ce301dc]{flex:none}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room[data-v-8ce301dc]{position:relative;width:100%;height:100%;display:flex;align-items:center;flex-direction:column;align-self:center;box-sizing:border-box}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc]{flex-shrink:0;width:100%;font-size:14px;min-height:26px;line-height:24px;box-sizing:border-box;overflow-y:auto;overflow-x:hidden}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc] .chat-rich-text{font-family:inherit;padding:0;font-size:inherit}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc] .chat-rich-text .chat-grid-wrap{font-size:inherit}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc] .chat-rich-text .chat-grid-wrap span{font-size:inherit}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc] .chat-placeholder-wrap{font-family:inherit;font-style:normal;color:#c0c4cc;padding:0;font-weight:bold;font-size:inherit;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc] .chat-tip-wrap{transform:translateY(-2px);padding:0 6px 0 0}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room .el-editor-sender-chat[data-v-8ce301dc] .chat-tip-wrap .chat-tip-tag-txt{font-size:16px;font-family:inherit}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-chat-room[data-v-8ce301dc] .chat-tip-popover{padding-bottom:10px}.el-editor-sender-wrap .el-editor-sender-content .el-editor-sender-action-list .el-editor-sender-action-list-presets[data-v-8ce301dc]{display:flex;gap:8px;flex-direction:row-reverse}.el-editor-sender-wrap .el-editor-sender-content.content-variant-updown[data-v-8ce301dc]{display:flex;flex-direction:column;align-items:initial}.el-editor-sender-wrap .el-editor-sender-content.content-variant-updown .el-editor-sender-updown-action-list[data-v-8ce301dc]{display:flex;justify-content:space-between;gap:8px}.el-editor-sender-wrap .el-editor-sender-content.content-variant-updown .el-editor-sender-updown-action-list .el-editor-sender-prefix[data-v-8ce301dc]{flex:initial}.el-editor-sender-wrap .el-editor-sender-content.content-variant-updown .el-editor-sender-updown-action-list .el-editor-sender-action-list[data-v-8ce301dc]{margin-left:auto}.el-editor-sender-wrap .el-editor-sender-footer[data-v-8ce301dc]{border-top-width:1px;border-top-style:solid;border-top-color:#dcdfe6}.el-editor-sender-wrap .slide-enter-active[data-v-8ce301dc],.el-editor-sender-wrap .slide-leave-active[data-v-8ce301dc]{height:calc-size(max-content,size);opacity:1;transition:height var(--el-editor-sender-header-duration),opacity var(--el-editor-sender-header-duration),border var(--el-editor-sender-header-duration);overflow:hidden}.el-editor-sender-wrap .slide-enter[data-v-8ce301dc],.el-editor-sender-wrap .slide-leave-to[data-v-8ce301dc]{height:0;opacity:0 !important}", ""]);
|
|
35661
|
+
// Exports
|
|
35662
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
35663
|
+
|
|
35664
|
+
|
|
34682
35665
|
/***/ }),
|
|
34683
35666
|
|
|
34684
35667
|
/***/ 9295:
|
|
@@ -37138,6 +38121,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
37138
38121
|
ElXBubble: () => (/* reexport */ Bubble["default"]),
|
|
37139
38122
|
ElXBubbleList: () => (/* reexport */ BubbleList["default"]),
|
|
37140
38123
|
ElXConversations: () => (/* reexport */ Conversations["default"]),
|
|
38124
|
+
ElXEditorSender: () => (/* reexport */ EditorSender["default"]),
|
|
37141
38125
|
ElXFilesCard: () => (/* reexport */ FilesCard["default"]),
|
|
37142
38126
|
ElXPrompts: () => (/* reexport */ Prompts["default"]),
|
|
37143
38127
|
ElXSender: () => (/* reexport */ Sender["default"]),
|
|
@@ -37179,6 +38163,8 @@ var ThoughtChain = __webpack_require__(6765);
|
|
|
37179
38163
|
var Typewriter = __webpack_require__(1207);
|
|
37180
38164
|
// EXTERNAL MODULE: ./src/components/Welcome/index.js + 7 modules
|
|
37181
38165
|
var Welcome = __webpack_require__(7795);
|
|
38166
|
+
// EXTERNAL MODULE: ./src/components/EditorSender/index.js + 32 modules
|
|
38167
|
+
var EditorSender = __webpack_require__(1433);
|
|
37182
38168
|
;// ./src/mixins/sendMixin.js
|
|
37183
38169
|
/**
|
|
37184
38170
|
* XRequest 类 - 用于处理 SSE 和 Fetch 请求
|
|
@@ -37306,35 +38292,19 @@ class XRequest {
|
|
|
37306
38292
|
if (!line.trim()) {
|
|
37307
38293
|
return;
|
|
37308
38294
|
}
|
|
37309
|
-
|
|
37310
38295
|
// 处理 data: 开头的行
|
|
37311
38296
|
if (line.startsWith('data: ')) {
|
|
37312
38297
|
const dataContent = line.slice(6);
|
|
37313
|
-
|
|
37314
|
-
// 检查是否是结束标识
|
|
37315
|
-
if (dataContent.trim() === '[DONE]') {
|
|
37316
|
-
this._isFinished = true;
|
|
37317
|
-
this._onFinish && this._onFinish(this._messages);
|
|
37318
|
-
this.abort();
|
|
37319
|
-
return;
|
|
37320
|
-
}
|
|
37321
|
-
|
|
37322
|
-
// 跳过空数据
|
|
37323
38298
|
if (!dataContent.trim()) {
|
|
37324
38299
|
return;
|
|
37325
38300
|
}
|
|
37326
38301
|
try {
|
|
37327
|
-
// 尝试解析和处理数据
|
|
37328
38302
|
let processedData;
|
|
37329
38303
|
try {
|
|
37330
|
-
// 首先尝试作为 JSON 解析
|
|
37331
38304
|
processedData = JSON.parse(dataContent);
|
|
37332
38305
|
} catch {
|
|
37333
|
-
// 如果不是 JSON,使用原始数据
|
|
37334
38306
|
processedData = dataContent;
|
|
37335
38307
|
}
|
|
37336
|
-
// console.log('processedData:', processedData, processedData.answer);
|
|
37337
|
-
|
|
37338
38308
|
const res = this._transformer ? this._transformer(processedData) : processedData;
|
|
37339
38309
|
this._messages.push(res);
|
|
37340
38310
|
this._onMessage && this._onMessage(res);
|
|
@@ -37343,8 +38313,27 @@ class XRequest {
|
|
|
37343
38313
|
this._onError && this._onError(error);
|
|
37344
38314
|
this._controller && this._controller.abort();
|
|
37345
38315
|
}
|
|
38316
|
+
return;
|
|
38317
|
+
}
|
|
38318
|
+
|
|
38319
|
+
// 处理其他 SSE 标准字段
|
|
38320
|
+
// if (line.startsWith('event: ') || line.startsWith('id: ') || line.startsWith('retry: ')) {
|
|
38321
|
+
// console.log('SSE control field:', line);
|
|
38322
|
+
// return;
|
|
38323
|
+
// }
|
|
38324
|
+
|
|
38325
|
+
// 兜底处理
|
|
38326
|
+
if (line.trim()) {
|
|
38327
|
+
try {
|
|
38328
|
+
const res = this._transformer ? this._transformer(line) : line;
|
|
38329
|
+
this._messages.push(res);
|
|
38330
|
+
this._onMessage && this._onMessage(res);
|
|
38331
|
+
} catch (error) {
|
|
38332
|
+
console.error('Error processing non-SSE line:', line, error);
|
|
38333
|
+
this._onError && this._onError(error);
|
|
38334
|
+
this._controller && this._controller.abort();
|
|
38335
|
+
}
|
|
37346
38336
|
}
|
|
37347
|
-
// 可以在这里处理其他类型的行(如果需要)
|
|
37348
38337
|
}
|
|
37349
38338
|
|
|
37350
38339
|
/**
|
|
@@ -38445,12 +39434,13 @@ var zh_CN = __webpack_require__(6449);
|
|
|
38445
39434
|
|
|
38446
39435
|
|
|
38447
39436
|
|
|
39437
|
+
|
|
38448
39438
|
// 导入 mixins
|
|
38449
39439
|
|
|
38450
39440
|
// 导入国际化功能
|
|
38451
39441
|
|
|
38452
39442
|
|
|
38453
|
-
const components = [Typewriter["default"], Bubble["default"], BubbleList["default"], Prompts["default"], Conversations["default"], Thinking["default"], ThoughtChain["default"], Sender["default"], FilesCard["default"], Attachments["default"], Welcome["default"]];
|
|
39443
|
+
const components = [Typewriter["default"], Bubble["default"], BubbleList["default"], Prompts["default"], Conversations["default"], Thinking["default"], ThoughtChain["default"], Sender["default"], FilesCard["default"], Attachments["default"], Welcome["default"], EditorSender["default"]];
|
|
38454
39444
|
const install = function (Vue, opts = {}) {
|
|
38455
39445
|
// 处理国际化配置
|
|
38456
39446
|
if (opts.locale) {
|