ai-assistant-pro 0.0.8 → 0.0.9
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/components/demo/src/chat.vue +12 -1
- package/components/demo/src/main.vue +2 -1
- package/dist/ai-assistant-pro.common.js +2698 -155
- package/dist/ai-assistant-pro.common.js.map +1 -1
- package/dist/ai-assistant-pro.css +1 -1
- package/dist/ai-assistant-pro.umd.js +2697 -154
- package/dist/ai-assistant-pro.umd.js.map +1 -1
- package/dist/ai-assistant-pro.umd.min.js +4 -4
- package/dist/ai-assistant-pro.umd.min.js.map +1 -1
- package/package.json +2 -1
|
@@ -7411,7 +7411,7 @@ __webpack_require__.d(common_utils_namespaceObject, {
|
|
|
7411
7411
|
origin: function() { return origin; }
|
|
7412
7412
|
});
|
|
7413
7413
|
|
|
7414
|
-
;//
|
|
7414
|
+
;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
7415
7415
|
/* eslint-disable no-var */
|
|
7416
7416
|
// This file is imported into lib/wc client bundles.
|
|
7417
7417
|
|
|
@@ -7428,7 +7428,7 @@ if (typeof window !== 'undefined') {
|
|
|
7428
7428
|
// Indicate to webpack that this file can be concatenated
|
|
7429
7429
|
/* harmony default export */ var setPublicPath = (null);
|
|
7430
7430
|
|
|
7431
|
-
;//
|
|
7431
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/main.vue?vue&type=template&id=4903e526&scoped=true
|
|
7432
7432
|
var render = function render() {
|
|
7433
7433
|
var _vm = this,
|
|
7434
7434
|
_c = _vm._self._c;
|
|
@@ -7539,9 +7539,9 @@ var render = function render() {
|
|
|
7539
7539
|
};
|
|
7540
7540
|
var staticRenderFns = [];
|
|
7541
7541
|
|
|
7542
|
-
;//
|
|
7542
|
+
;// ./components/demo/src/main.vue?vue&type=template&id=4903e526&scoped=true
|
|
7543
7543
|
|
|
7544
|
-
;//
|
|
7544
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/hot-search.vue?vue&type=template&id=abf2ffc4&scoped=true
|
|
7545
7545
|
var hot_searchvue_type_template_id_abf2ffc4_scoped_true_render = function render() {
|
|
7546
7546
|
var _vm = this,
|
|
7547
7547
|
_c = _vm._self._c;
|
|
@@ -7573,9 +7573,9 @@ var hot_searchvue_type_template_id_abf2ffc4_scoped_true_staticRenderFns = [funct
|
|
|
7573
7573
|
})]);
|
|
7574
7574
|
}];
|
|
7575
7575
|
|
|
7576
|
-
;//
|
|
7576
|
+
;// ./components/demo/src/hot-search.vue?vue&type=template&id=abf2ffc4&scoped=true
|
|
7577
7577
|
|
|
7578
|
-
;//
|
|
7578
|
+
;// ./node_modules/axios/lib/helpers/bind.js
|
|
7579
7579
|
|
|
7580
7580
|
|
|
7581
7581
|
function bind(fn, thisArg) {
|
|
@@ -7584,7 +7584,7 @@ function bind(fn, thisArg) {
|
|
|
7584
7584
|
};
|
|
7585
7585
|
}
|
|
7586
7586
|
|
|
7587
|
-
;//
|
|
7587
|
+
;// ./node_modules/axios/lib/utils.js
|
|
7588
7588
|
|
|
7589
7589
|
|
|
7590
7590
|
|
|
@@ -8346,7 +8346,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
8346
8346
|
asap
|
|
8347
8347
|
});
|
|
8348
8348
|
|
|
8349
|
-
;//
|
|
8349
|
+
;// ./node_modules/axios/lib/core/AxiosError.js
|
|
8350
8350
|
|
|
8351
8351
|
|
|
8352
8352
|
|
|
@@ -8451,11 +8451,11 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
|
8451
8451
|
|
|
8452
8452
|
/* harmony default export */ var core_AxiosError = (AxiosError);
|
|
8453
8453
|
|
|
8454
|
-
;//
|
|
8454
|
+
;// ./node_modules/axios/lib/helpers/null.js
|
|
8455
8455
|
// eslint-disable-next-line strict
|
|
8456
8456
|
/* harmony default export */ var helpers_null = (null);
|
|
8457
8457
|
|
|
8458
|
-
;//
|
|
8458
|
+
;// ./node_modules/axios/lib/helpers/toFormData.js
|
|
8459
8459
|
|
|
8460
8460
|
|
|
8461
8461
|
|
|
@@ -8676,7 +8676,7 @@ function toFormData(obj, formData, options) {
|
|
|
8676
8676
|
|
|
8677
8677
|
/* harmony default export */ var helpers_toFormData = (toFormData);
|
|
8678
8678
|
|
|
8679
|
-
;//
|
|
8679
|
+
;// ./node_modules/axios/lib/helpers/AxiosURLSearchParams.js
|
|
8680
8680
|
|
|
8681
8681
|
|
|
8682
8682
|
|
|
@@ -8736,7 +8736,7 @@ AxiosURLSearchParams_prototype.toString = function toString(encoder) {
|
|
|
8736
8736
|
|
|
8737
8737
|
/* harmony default export */ var helpers_AxiosURLSearchParams = (AxiosURLSearchParams);
|
|
8738
8738
|
|
|
8739
|
-
;//
|
|
8739
|
+
;// ./node_modules/axios/lib/helpers/buildURL.js
|
|
8740
8740
|
|
|
8741
8741
|
|
|
8742
8742
|
|
|
@@ -8801,7 +8801,7 @@ function buildURL(url, params, options) {
|
|
|
8801
8801
|
return url;
|
|
8802
8802
|
}
|
|
8803
8803
|
|
|
8804
|
-
;//
|
|
8804
|
+
;// ./node_modules/axios/lib/core/InterceptorManager.js
|
|
8805
8805
|
|
|
8806
8806
|
|
|
8807
8807
|
|
|
@@ -8874,7 +8874,7 @@ class InterceptorManager {
|
|
|
8874
8874
|
|
|
8875
8875
|
/* harmony default export */ var core_InterceptorManager = (InterceptorManager);
|
|
8876
8876
|
|
|
8877
|
-
;//
|
|
8877
|
+
;// ./node_modules/axios/lib/defaults/transitional.js
|
|
8878
8878
|
|
|
8879
8879
|
|
|
8880
8880
|
/* harmony default export */ var defaults_transitional = ({
|
|
@@ -8883,23 +8883,23 @@ class InterceptorManager {
|
|
|
8883
8883
|
clarifyTimeoutError: false
|
|
8884
8884
|
});
|
|
8885
8885
|
|
|
8886
|
-
;//
|
|
8886
|
+
;// ./node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
|
|
8887
8887
|
|
|
8888
8888
|
|
|
8889
8889
|
|
|
8890
8890
|
/* harmony default export */ var classes_URLSearchParams = (typeof URLSearchParams !== 'undefined' ? URLSearchParams : helpers_AxiosURLSearchParams);
|
|
8891
8891
|
|
|
8892
|
-
;//
|
|
8892
|
+
;// ./node_modules/axios/lib/platform/browser/classes/FormData.js
|
|
8893
8893
|
|
|
8894
8894
|
|
|
8895
8895
|
/* harmony default export */ var classes_FormData = (typeof FormData !== 'undefined' ? FormData : null);
|
|
8896
8896
|
|
|
8897
|
-
;//
|
|
8897
|
+
;// ./node_modules/axios/lib/platform/browser/classes/Blob.js
|
|
8898
8898
|
|
|
8899
8899
|
|
|
8900
8900
|
/* harmony default export */ var classes_Blob = (typeof Blob !== 'undefined' ? Blob : null);
|
|
8901
8901
|
|
|
8902
|
-
;//
|
|
8902
|
+
;// ./node_modules/axios/lib/platform/browser/index.js
|
|
8903
8903
|
|
|
8904
8904
|
|
|
8905
8905
|
|
|
@@ -8914,7 +8914,7 @@ class InterceptorManager {
|
|
|
8914
8914
|
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
8915
8915
|
});
|
|
8916
8916
|
|
|
8917
|
-
;//
|
|
8917
|
+
;// ./node_modules/axios/lib/platform/common/utils.js
|
|
8918
8918
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
8919
8919
|
|
|
8920
8920
|
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
@@ -8961,7 +8961,7 @@ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
|
8961
8961
|
|
|
8962
8962
|
|
|
8963
8963
|
|
|
8964
|
-
;//
|
|
8964
|
+
;// ./node_modules/axios/lib/platform/index.js
|
|
8965
8965
|
|
|
8966
8966
|
|
|
8967
8967
|
|
|
@@ -8970,7 +8970,7 @@ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
|
8970
8970
|
...browser
|
|
8971
8971
|
});
|
|
8972
8972
|
|
|
8973
|
-
;//
|
|
8973
|
+
;// ./node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
8974
8974
|
|
|
8975
8975
|
|
|
8976
8976
|
|
|
@@ -8990,7 +8990,7 @@ function toURLEncodedForm(data, options) {
|
|
|
8990
8990
|
}, options));
|
|
8991
8991
|
}
|
|
8992
8992
|
|
|
8993
|
-
;//
|
|
8993
|
+
;// ./node_modules/axios/lib/helpers/formDataToJSON.js
|
|
8994
8994
|
|
|
8995
8995
|
|
|
8996
8996
|
|
|
@@ -9087,7 +9087,7 @@ function formDataToJSON(formData) {
|
|
|
9087
9087
|
|
|
9088
9088
|
/* harmony default export */ var helpers_formDataToJSON = (formDataToJSON);
|
|
9089
9089
|
|
|
9090
|
-
;//
|
|
9090
|
+
;// ./node_modules/axios/lib/defaults/index.js
|
|
9091
9091
|
|
|
9092
9092
|
|
|
9093
9093
|
|
|
@@ -9250,7 +9250,7 @@ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
|
9250
9250
|
|
|
9251
9251
|
/* harmony default export */ var lib_defaults = (defaults);
|
|
9252
9252
|
|
|
9253
|
-
;//
|
|
9253
|
+
;// ./node_modules/axios/lib/helpers/parseHeaders.js
|
|
9254
9254
|
|
|
9255
9255
|
|
|
9256
9256
|
|
|
@@ -9307,7 +9307,7 @@ const ignoreDuplicateOf = utils.toObjectSet([
|
|
|
9307
9307
|
return parsed;
|
|
9308
9308
|
});
|
|
9309
9309
|
|
|
9310
|
-
;//
|
|
9310
|
+
;// ./node_modules/axios/lib/core/AxiosHeaders.js
|
|
9311
9311
|
|
|
9312
9312
|
|
|
9313
9313
|
|
|
@@ -9611,7 +9611,7 @@ utils.freezeMethods(AxiosHeaders);
|
|
|
9611
9611
|
|
|
9612
9612
|
/* harmony default export */ var core_AxiosHeaders = (AxiosHeaders);
|
|
9613
9613
|
|
|
9614
|
-
;//
|
|
9614
|
+
;// ./node_modules/axios/lib/core/transformData.js
|
|
9615
9615
|
|
|
9616
9616
|
|
|
9617
9617
|
|
|
@@ -9641,14 +9641,14 @@ function transformData(fns, response) {
|
|
|
9641
9641
|
return data;
|
|
9642
9642
|
}
|
|
9643
9643
|
|
|
9644
|
-
;//
|
|
9644
|
+
;// ./node_modules/axios/lib/cancel/isCancel.js
|
|
9645
9645
|
|
|
9646
9646
|
|
|
9647
9647
|
function isCancel(value) {
|
|
9648
9648
|
return !!(value && value.__CANCEL__);
|
|
9649
9649
|
}
|
|
9650
9650
|
|
|
9651
|
-
;//
|
|
9651
|
+
;// ./node_modules/axios/lib/cancel/CanceledError.js
|
|
9652
9652
|
|
|
9653
9653
|
|
|
9654
9654
|
|
|
@@ -9675,7 +9675,7 @@ utils.inherits(CanceledError, core_AxiosError, {
|
|
|
9675
9675
|
|
|
9676
9676
|
/* harmony default export */ var cancel_CanceledError = (CanceledError);
|
|
9677
9677
|
|
|
9678
|
-
;//
|
|
9678
|
+
;// ./node_modules/axios/lib/core/settle.js
|
|
9679
9679
|
|
|
9680
9680
|
|
|
9681
9681
|
|
|
@@ -9704,7 +9704,7 @@ function settle(resolve, reject, response) {
|
|
|
9704
9704
|
}
|
|
9705
9705
|
}
|
|
9706
9706
|
|
|
9707
|
-
;//
|
|
9707
|
+
;// ./node_modules/axios/lib/helpers/parseProtocol.js
|
|
9708
9708
|
|
|
9709
9709
|
|
|
9710
9710
|
function parseProtocol(url) {
|
|
@@ -9712,7 +9712,7 @@ function parseProtocol(url) {
|
|
|
9712
9712
|
return match && match[1] || '';
|
|
9713
9713
|
}
|
|
9714
9714
|
|
|
9715
|
-
;//
|
|
9715
|
+
;// ./node_modules/axios/lib/helpers/speedometer.js
|
|
9716
9716
|
|
|
9717
9717
|
|
|
9718
9718
|
/**
|
|
@@ -9769,7 +9769,7 @@ function speedometer(samplesCount, min) {
|
|
|
9769
9769
|
|
|
9770
9770
|
/* harmony default export */ var helpers_speedometer = (speedometer);
|
|
9771
9771
|
|
|
9772
|
-
;//
|
|
9772
|
+
;// ./node_modules/axios/lib/helpers/throttle.js
|
|
9773
9773
|
/**
|
|
9774
9774
|
* Throttle decorator
|
|
9775
9775
|
* @param {Function} fn
|
|
@@ -9815,7 +9815,7 @@ function throttle(fn, freq) {
|
|
|
9815
9815
|
|
|
9816
9816
|
/* harmony default export */ var helpers_throttle = (throttle);
|
|
9817
9817
|
|
|
9818
|
-
;//
|
|
9818
|
+
;// ./node_modules/axios/lib/helpers/progressEventReducer.js
|
|
9819
9819
|
|
|
9820
9820
|
|
|
9821
9821
|
|
|
@@ -9861,7 +9861,7 @@ const progressEventDecorator = (total, throttled) => {
|
|
|
9861
9861
|
|
|
9862
9862
|
const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
|
9863
9863
|
|
|
9864
|
-
;//
|
|
9864
|
+
;// ./node_modules/axios/lib/helpers/isURLSameOrigin.js
|
|
9865
9865
|
|
|
9866
9866
|
|
|
9867
9867
|
|
|
@@ -9930,7 +9930,7 @@ const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
|
|
9930
9930
|
};
|
|
9931
9931
|
})());
|
|
9932
9932
|
|
|
9933
|
-
;//
|
|
9933
|
+
;// ./node_modules/axios/lib/helpers/cookies.js
|
|
9934
9934
|
|
|
9935
9935
|
|
|
9936
9936
|
|
|
@@ -9974,7 +9974,7 @@ const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
|
|
|
9974
9974
|
});
|
|
9975
9975
|
|
|
9976
9976
|
|
|
9977
|
-
;//
|
|
9977
|
+
;// ./node_modules/axios/lib/helpers/isAbsoluteURL.js
|
|
9978
9978
|
|
|
9979
9979
|
|
|
9980
9980
|
/**
|
|
@@ -9991,7 +9991,7 @@ function isAbsoluteURL(url) {
|
|
|
9991
9991
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
9992
9992
|
}
|
|
9993
9993
|
|
|
9994
|
-
;//
|
|
9994
|
+
;// ./node_modules/axios/lib/helpers/combineURLs.js
|
|
9995
9995
|
|
|
9996
9996
|
|
|
9997
9997
|
/**
|
|
@@ -10008,7 +10008,7 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
10008
10008
|
: baseURL;
|
|
10009
10009
|
}
|
|
10010
10010
|
|
|
10011
|
-
;//
|
|
10011
|
+
;// ./node_modules/axios/lib/core/buildFullPath.js
|
|
10012
10012
|
|
|
10013
10013
|
|
|
10014
10014
|
|
|
@@ -10031,7 +10031,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|
|
10031
10031
|
return requestedURL;
|
|
10032
10032
|
}
|
|
10033
10033
|
|
|
10034
|
-
;//
|
|
10034
|
+
;// ./node_modules/axios/lib/core/mergeConfig.js
|
|
10035
10035
|
|
|
10036
10036
|
|
|
10037
10037
|
|
|
@@ -10139,7 +10139,7 @@ function mergeConfig(config1, config2) {
|
|
|
10139
10139
|
return config;
|
|
10140
10140
|
}
|
|
10141
10141
|
|
|
10142
|
-
;//
|
|
10142
|
+
;// ./node_modules/axios/lib/helpers/resolveConfig.js
|
|
10143
10143
|
|
|
10144
10144
|
|
|
10145
10145
|
|
|
@@ -10198,7 +10198,7 @@ function mergeConfig(config1, config2) {
|
|
|
10198
10198
|
});
|
|
10199
10199
|
|
|
10200
10200
|
|
|
10201
|
-
;//
|
|
10201
|
+
;// ./node_modules/axios/lib/adapters/xhr.js
|
|
10202
10202
|
|
|
10203
10203
|
|
|
10204
10204
|
|
|
@@ -10397,55 +10397,57 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
|
10397
10397
|
});
|
|
10398
10398
|
});
|
|
10399
10399
|
|
|
10400
|
-
;//
|
|
10400
|
+
;// ./node_modules/axios/lib/helpers/composeSignals.js
|
|
10401
|
+
|
|
10401
10402
|
|
|
10402
10403
|
|
|
10403
10404
|
|
|
10404
10405
|
const composeSignals = (signals, timeout) => {
|
|
10405
|
-
|
|
10406
|
+
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
10406
10407
|
|
|
10407
|
-
|
|
10408
|
+
if (timeout || length) {
|
|
10409
|
+
let controller = new AbortController();
|
|
10408
10410
|
|
|
10409
|
-
|
|
10410
|
-
if (!aborted) {
|
|
10411
|
-
aborted = true;
|
|
10412
|
-
unsubscribe();
|
|
10413
|
-
const err = cancel instanceof Error ? cancel : this.reason;
|
|
10414
|
-
controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err));
|
|
10415
|
-
}
|
|
10416
|
-
}
|
|
10411
|
+
let aborted;
|
|
10417
10412
|
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10413
|
+
const onabort = function (reason) {
|
|
10414
|
+
if (!aborted) {
|
|
10415
|
+
aborted = true;
|
|
10416
|
+
unsubscribe();
|
|
10417
|
+
const err = reason instanceof Error ? reason : this.reason;
|
|
10418
|
+
controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err));
|
|
10419
|
+
}
|
|
10420
|
+
}
|
|
10421
10421
|
|
|
10422
|
-
|
|
10423
|
-
if (signals) {
|
|
10424
|
-
timer && clearTimeout(timer);
|
|
10422
|
+
let timer = timeout && setTimeout(() => {
|
|
10425
10423
|
timer = null;
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
signals
|
|
10424
|
+
onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT))
|
|
10425
|
+
}, timeout)
|
|
10426
|
+
|
|
10427
|
+
const unsubscribe = () => {
|
|
10428
|
+
if (signals) {
|
|
10429
|
+
timer && clearTimeout(timer);
|
|
10430
|
+
timer = null;
|
|
10431
|
+
signals.forEach(signal => {
|
|
10432
|
+
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
|
10433
|
+
});
|
|
10434
|
+
signals = null;
|
|
10435
|
+
}
|
|
10431
10436
|
}
|
|
10432
|
-
}
|
|
10433
10437
|
|
|
10434
|
-
|
|
10438
|
+
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
10435
10439
|
|
|
10436
|
-
|
|
10440
|
+
const {signal} = controller;
|
|
10437
10441
|
|
|
10438
|
-
|
|
10442
|
+
signal.unsubscribe = () => utils.asap(unsubscribe);
|
|
10439
10443
|
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
timer = null;
|
|
10443
|
-
}];
|
|
10444
|
+
return signal;
|
|
10445
|
+
}
|
|
10444
10446
|
}
|
|
10445
10447
|
|
|
10446
10448
|
/* harmony default export */ var helpers_composeSignals = (composeSignals);
|
|
10447
10449
|
|
|
10448
|
-
;//
|
|
10450
|
+
;// ./node_modules/axios/lib/helpers/trackStream.js
|
|
10449
10451
|
|
|
10450
10452
|
const streamChunk = function* (chunk, chunkSize) {
|
|
10451
10453
|
let len = chunk.byteLength;
|
|
@@ -10465,14 +10467,34 @@ const streamChunk = function* (chunk, chunkSize) {
|
|
|
10465
10467
|
}
|
|
10466
10468
|
}
|
|
10467
10469
|
|
|
10468
|
-
const readBytes = async function* (iterable, chunkSize
|
|
10469
|
-
for await (const chunk of iterable) {
|
|
10470
|
-
yield* streamChunk(
|
|
10470
|
+
const readBytes = async function* (iterable, chunkSize) {
|
|
10471
|
+
for await (const chunk of readStream(iterable)) {
|
|
10472
|
+
yield* streamChunk(chunk, chunkSize);
|
|
10471
10473
|
}
|
|
10472
10474
|
}
|
|
10473
10475
|
|
|
10474
|
-
const
|
|
10475
|
-
|
|
10476
|
+
const readStream = async function* (stream) {
|
|
10477
|
+
if (stream[Symbol.asyncIterator]) {
|
|
10478
|
+
yield* stream;
|
|
10479
|
+
return;
|
|
10480
|
+
}
|
|
10481
|
+
|
|
10482
|
+
const reader = stream.getReader();
|
|
10483
|
+
try {
|
|
10484
|
+
for (;;) {
|
|
10485
|
+
const {done, value} = await reader.read();
|
|
10486
|
+
if (done) {
|
|
10487
|
+
break;
|
|
10488
|
+
}
|
|
10489
|
+
yield value;
|
|
10490
|
+
}
|
|
10491
|
+
} finally {
|
|
10492
|
+
await reader.cancel();
|
|
10493
|
+
}
|
|
10494
|
+
}
|
|
10495
|
+
|
|
10496
|
+
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
10497
|
+
const iterator = readBytes(stream, chunkSize);
|
|
10476
10498
|
|
|
10477
10499
|
let bytes = 0;
|
|
10478
10500
|
let done;
|
|
@@ -10514,7 +10536,7 @@ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
|
|
|
10514
10536
|
})
|
|
10515
10537
|
}
|
|
10516
10538
|
|
|
10517
|
-
;//
|
|
10539
|
+
;// ./node_modules/axios/lib/adapters/fetch.js
|
|
10518
10540
|
|
|
10519
10541
|
|
|
10520
10542
|
|
|
@@ -10586,7 +10608,11 @@ const getBodyLength = async (body) => {
|
|
|
10586
10608
|
}
|
|
10587
10609
|
|
|
10588
10610
|
if(utils.isSpecCompliantForm(body)) {
|
|
10589
|
-
|
|
10611
|
+
const _request = new Request(platform.origin, {
|
|
10612
|
+
method: 'POST',
|
|
10613
|
+
body,
|
|
10614
|
+
});
|
|
10615
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
10590
10616
|
}
|
|
10591
10617
|
|
|
10592
10618
|
if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
|
|
@@ -10626,18 +10652,13 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10626
10652
|
|
|
10627
10653
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
10628
10654
|
|
|
10629
|
-
let
|
|
10630
|
-
helpers_composeSignals([signal, cancelToken], timeout) : [];
|
|
10631
|
-
|
|
10632
|
-
let finished, request;
|
|
10655
|
+
let composedSignal = helpers_composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
10633
10656
|
|
|
10634
|
-
|
|
10635
|
-
!finished && setTimeout(() => {
|
|
10636
|
-
composedSignal && composedSignal.unsubscribe();
|
|
10637
|
-
});
|
|
10657
|
+
let request;
|
|
10638
10658
|
|
|
10639
|
-
|
|
10640
|
-
|
|
10659
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
10660
|
+
composedSignal.unsubscribe();
|
|
10661
|
+
});
|
|
10641
10662
|
|
|
10642
10663
|
let requestContentLength;
|
|
10643
10664
|
|
|
@@ -10664,7 +10685,7 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10664
10685
|
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
10665
10686
|
);
|
|
10666
10687
|
|
|
10667
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush
|
|
10688
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
10668
10689
|
}
|
|
10669
10690
|
}
|
|
10670
10691
|
|
|
@@ -10674,7 +10695,7 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10674
10695
|
|
|
10675
10696
|
// Cloudflare Workers throws when credentials are defined
|
|
10676
10697
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
10677
|
-
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
10698
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
10678
10699
|
request = new Request(url, {
|
|
10679
10700
|
...fetchOptions,
|
|
10680
10701
|
signal: composedSignal,
|
|
@@ -10689,7 +10710,7 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10689
10710
|
|
|
10690
10711
|
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
10691
10712
|
|
|
10692
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
|
10713
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
10693
10714
|
const options = {};
|
|
10694
10715
|
|
|
10695
10716
|
['status', 'statusText', 'headers'].forEach(prop => {
|
|
@@ -10706,8 +10727,8 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10706
10727
|
response = new Response(
|
|
10707
10728
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
10708
10729
|
flush && flush();
|
|
10709
|
-
|
|
10710
|
-
}
|
|
10730
|
+
unsubscribe && unsubscribe();
|
|
10731
|
+
}),
|
|
10711
10732
|
options
|
|
10712
10733
|
);
|
|
10713
10734
|
}
|
|
@@ -10716,9 +10737,7 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10716
10737
|
|
|
10717
10738
|
let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
|
|
10718
10739
|
|
|
10719
|
-
!isStreamResponse &&
|
|
10720
|
-
|
|
10721
|
-
stopTimeout && stopTimeout();
|
|
10740
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
10722
10741
|
|
|
10723
10742
|
return await new Promise((resolve, reject) => {
|
|
10724
10743
|
settle(resolve, reject, {
|
|
@@ -10731,7 +10750,7 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10731
10750
|
})
|
|
10732
10751
|
})
|
|
10733
10752
|
} catch (err) {
|
|
10734
|
-
|
|
10753
|
+
unsubscribe && unsubscribe();
|
|
10735
10754
|
|
|
10736
10755
|
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
10737
10756
|
throw Object.assign(
|
|
@@ -10748,7 +10767,7 @@ const resolveBodyLength = async (headers, body) => {
|
|
|
10748
10767
|
|
|
10749
10768
|
|
|
10750
10769
|
|
|
10751
|
-
;//
|
|
10770
|
+
;// ./node_modules/axios/lib/adapters/adapters.js
|
|
10752
10771
|
|
|
10753
10772
|
|
|
10754
10773
|
|
|
@@ -10829,7 +10848,7 @@ const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === n
|
|
|
10829
10848
|
adapters: knownAdapters
|
|
10830
10849
|
});
|
|
10831
10850
|
|
|
10832
|
-
;//
|
|
10851
|
+
;// ./node_modules/axios/lib/core/dispatchRequest.js
|
|
10833
10852
|
|
|
10834
10853
|
|
|
10835
10854
|
|
|
@@ -10912,9 +10931,9 @@ function dispatchRequest(config) {
|
|
|
10912
10931
|
});
|
|
10913
10932
|
}
|
|
10914
10933
|
|
|
10915
|
-
;//
|
|
10916
|
-
const VERSION = "1.7.
|
|
10917
|
-
;//
|
|
10934
|
+
;// ./node_modules/axios/lib/env/data.js
|
|
10935
|
+
const VERSION = "1.7.7";
|
|
10936
|
+
;// ./node_modules/axios/lib/helpers/validator.js
|
|
10918
10937
|
|
|
10919
10938
|
|
|
10920
10939
|
|
|
@@ -11007,7 +11026,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
11007
11026
|
validators
|
|
11008
11027
|
});
|
|
11009
11028
|
|
|
11010
|
-
;//
|
|
11029
|
+
;// ./node_modules/axios/lib/core/Axios.js
|
|
11011
11030
|
|
|
11012
11031
|
|
|
11013
11032
|
|
|
@@ -11237,7 +11256,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
11237
11256
|
|
|
11238
11257
|
/* harmony default export */ var core_Axios = (Axios);
|
|
11239
11258
|
|
|
11240
|
-
;//
|
|
11259
|
+
;// ./node_modules/axios/lib/cancel/CancelToken.js
|
|
11241
11260
|
|
|
11242
11261
|
|
|
11243
11262
|
|
|
@@ -11342,6 +11361,20 @@ class CancelToken {
|
|
|
11342
11361
|
}
|
|
11343
11362
|
}
|
|
11344
11363
|
|
|
11364
|
+
toAbortSignal() {
|
|
11365
|
+
const controller = new AbortController();
|
|
11366
|
+
|
|
11367
|
+
const abort = (err) => {
|
|
11368
|
+
controller.abort(err);
|
|
11369
|
+
};
|
|
11370
|
+
|
|
11371
|
+
this.subscribe(abort);
|
|
11372
|
+
|
|
11373
|
+
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
11374
|
+
|
|
11375
|
+
return controller.signal;
|
|
11376
|
+
}
|
|
11377
|
+
|
|
11345
11378
|
/**
|
|
11346
11379
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
11347
11380
|
* cancels the `CancelToken`.
|
|
@@ -11360,7 +11393,7 @@ class CancelToken {
|
|
|
11360
11393
|
|
|
11361
11394
|
/* harmony default export */ var cancel_CancelToken = (CancelToken);
|
|
11362
11395
|
|
|
11363
|
-
;//
|
|
11396
|
+
;// ./node_modules/axios/lib/helpers/spread.js
|
|
11364
11397
|
|
|
11365
11398
|
|
|
11366
11399
|
/**
|
|
@@ -11390,7 +11423,7 @@ function spread(callback) {
|
|
|
11390
11423
|
};
|
|
11391
11424
|
}
|
|
11392
11425
|
|
|
11393
|
-
;//
|
|
11426
|
+
;// ./node_modules/axios/lib/helpers/isAxiosError.js
|
|
11394
11427
|
|
|
11395
11428
|
|
|
11396
11429
|
|
|
@@ -11406,7 +11439,7 @@ function isAxiosError(payload) {
|
|
|
11406
11439
|
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
11407
11440
|
}
|
|
11408
11441
|
|
|
11409
|
-
;//
|
|
11442
|
+
;// ./node_modules/axios/lib/helpers/HttpStatusCode.js
|
|
11410
11443
|
const HttpStatusCode = {
|
|
11411
11444
|
Continue: 100,
|
|
11412
11445
|
SwitchingProtocols: 101,
|
|
@@ -11479,7 +11512,7 @@ Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
|
11479
11512
|
|
|
11480
11513
|
/* harmony default export */ var helpers_HttpStatusCode = (HttpStatusCode);
|
|
11481
11514
|
|
|
11482
|
-
;//
|
|
11515
|
+
;// ./node_modules/axios/lib/axios.js
|
|
11483
11516
|
|
|
11484
11517
|
|
|
11485
11518
|
|
|
@@ -11570,7 +11603,7 @@ axios.default = axios;
|
|
|
11570
11603
|
// this module should only have a default export
|
|
11571
11604
|
/* harmony default export */ var lib_axios = (axios);
|
|
11572
11605
|
|
|
11573
|
-
;//
|
|
11606
|
+
;// ./components/demo/plugins/cache.js
|
|
11574
11607
|
const sessionCache = {
|
|
11575
11608
|
set(key, value) {
|
|
11576
11609
|
if (!sessionStorage) {
|
|
@@ -11647,12 +11680,12 @@ const localCache = {
|
|
|
11647
11680
|
*/
|
|
11648
11681
|
local: localCache
|
|
11649
11682
|
});
|
|
11650
|
-
;//
|
|
11683
|
+
;// external "element-ui"
|
|
11651
11684
|
var external_element_ui_namespaceObject = require("element-ui");
|
|
11652
11685
|
// EXTERNAL MODULE: ./node_modules/crypto-js/index.js
|
|
11653
11686
|
var crypto_js = __webpack_require__(396);
|
|
11654
11687
|
var crypto_js_default = /*#__PURE__*/__webpack_require__.n(crypto_js);
|
|
11655
|
-
;//
|
|
11688
|
+
;// ./node_modules/js-base64/base64.mjs
|
|
11656
11689
|
/**
|
|
11657
11690
|
* base64.ts
|
|
11658
11691
|
*
|
|
@@ -11948,7 +11981,7 @@ const gBase64 = {
|
|
|
11948
11981
|
// and finally,
|
|
11949
11982
|
|
|
11950
11983
|
|
|
11951
|
-
;//
|
|
11984
|
+
;// ./components/demo/utils/aes-utils.js
|
|
11952
11985
|
|
|
11953
11986
|
|
|
11954
11987
|
const a = 'RU5D';
|
|
@@ -11981,7 +12014,7 @@ function decrypt(word) {
|
|
|
11981
12014
|
let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
|
|
11982
12015
|
return decryptedStr.toString();
|
|
11983
12016
|
}
|
|
11984
|
-
;//
|
|
12017
|
+
;// ./components/demo/utils/constants.js
|
|
11985
12018
|
let appId = '601a39a2a4a7cd88d5ddcef5';
|
|
11986
12019
|
const whiteList = ['/home', '/overview'];
|
|
11987
12020
|
if (({"NODE_ENV":"production","BASE_URL":""}).VITE_APP_BUILD_TYPE === 'aliyun') {
|
|
@@ -11996,7 +12029,7 @@ if (({"NODE_ENV":"production","BASE_URL":""}).VITE_APP_BUILD_TYPE === 'aliyun')
|
|
|
11996
12029
|
publicPath: 'https://agent.icve.com.cn/heatp-portal/do/',
|
|
11997
12030
|
publicPrefix: '/heatp'
|
|
11998
12031
|
});
|
|
11999
|
-
;//
|
|
12032
|
+
;// ./components/demo/utils/request.js
|
|
12000
12033
|
|
|
12001
12034
|
|
|
12002
12035
|
|
|
@@ -12063,7 +12096,7 @@ service.interceptors.response.use(res => {
|
|
|
12063
12096
|
return srkjData.queryData || srkjData.data || srkjData.token;
|
|
12064
12097
|
});
|
|
12065
12098
|
/* harmony default export */ var utils_request = (service);
|
|
12066
|
-
;//
|
|
12099
|
+
;// ./node_modules/@microsoft/fetch-event-source/lib/esm/parse.js
|
|
12067
12100
|
async function getBytes(stream, onChunk) {
|
|
12068
12101
|
const reader = stream.getReader();
|
|
12069
12102
|
let result;
|
|
@@ -12174,7 +12207,7 @@ function newMessage() {
|
|
|
12174
12207
|
};
|
|
12175
12208
|
}
|
|
12176
12209
|
//# sourceMappingURL=parse.js.map
|
|
12177
|
-
;//
|
|
12210
|
+
;// ./node_modules/@microsoft/fetch-event-source/lib/esm/fetch.js
|
|
12178
12211
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
12179
12212
|
var t = {};
|
|
12180
12213
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -12264,7 +12297,7 @@ function defaultOnOpen(response) {
|
|
|
12264
12297
|
}
|
|
12265
12298
|
}
|
|
12266
12299
|
//# sourceMappingURL=fetch.js.map
|
|
12267
|
-
;//
|
|
12300
|
+
;// ./components/demo/api/index.js
|
|
12268
12301
|
|
|
12269
12302
|
|
|
12270
12303
|
|
|
@@ -12387,7 +12420,7 @@ async function sendMessageEventSource(params, signal, onmessage) {
|
|
|
12387
12420
|
onmessage
|
|
12388
12421
|
});
|
|
12389
12422
|
}
|
|
12390
|
-
;//
|
|
12423
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/hot-search.vue?vue&type=script&lang=js
|
|
12391
12424
|
|
|
12392
12425
|
/* harmony default export */ var hot_searchvue_type_script_lang_js = ({
|
|
12393
12426
|
name: 'HotSearch',
|
|
@@ -12434,14 +12467,14 @@ async function sendMessageEventSource(params, signal, onmessage) {
|
|
|
12434
12467
|
this.prologue = prologue;
|
|
12435
12468
|
}
|
|
12436
12469
|
});
|
|
12437
|
-
;//
|
|
12470
|
+
;// ./components/demo/src/hot-search.vue?vue&type=script&lang=js
|
|
12438
12471
|
/* harmony default export */ var src_hot_searchvue_type_script_lang_js = (hot_searchvue_type_script_lang_js);
|
|
12439
|
-
;//
|
|
12472
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/hot-search.vue?vue&type=style&index=0&id=abf2ffc4&prod&lang=scss&scoped=true
|
|
12440
12473
|
// extracted by mini-css-extract-plugin
|
|
12441
12474
|
|
|
12442
|
-
;//
|
|
12475
|
+
;// ./components/demo/src/hot-search.vue?vue&type=style&index=0&id=abf2ffc4&prod&lang=scss&scoped=true
|
|
12443
12476
|
|
|
12444
|
-
;//
|
|
12477
|
+
;// ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
|
|
12445
12478
|
/* globals __VUE_SSR_CONTEXT__ */
|
|
12446
12479
|
|
|
12447
12480
|
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
@@ -12539,7 +12572,7 @@ function normalizeComponent(
|
|
|
12539
12572
|
}
|
|
12540
12573
|
}
|
|
12541
12574
|
|
|
12542
|
-
;//
|
|
12575
|
+
;// ./components/demo/src/hot-search.vue
|
|
12543
12576
|
|
|
12544
12577
|
|
|
12545
12578
|
|
|
@@ -12560,8 +12593,8 @@ var component = normalizeComponent(
|
|
|
12560
12593
|
)
|
|
12561
12594
|
|
|
12562
12595
|
/* harmony default export */ var hot_search = (component.exports);
|
|
12563
|
-
;//
|
|
12564
|
-
var
|
|
12596
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat.vue?vue&type=template&id=322788ca&scoped=true
|
|
12597
|
+
var chatvue_type_template_id_322788ca_scoped_true_render = function render() {
|
|
12565
12598
|
var _vm = this,
|
|
12566
12599
|
_c = _vm._self._c;
|
|
12567
12600
|
return _c('div', {
|
|
@@ -12651,9 +12684,9 @@ var chatvue_type_template_id_069a8301_scoped_true_render = function render() {
|
|
|
12651
12684
|
}) : _vm._e()], 1)]);
|
|
12652
12685
|
}), 0);
|
|
12653
12686
|
};
|
|
12654
|
-
var
|
|
12687
|
+
var chatvue_type_template_id_322788ca_scoped_true_staticRenderFns = [];
|
|
12655
12688
|
|
|
12656
|
-
;//
|
|
12689
|
+
;// ./components/demo/utils/config.js
|
|
12657
12690
|
|
|
12658
12691
|
// import constants from '../utils/constants';
|
|
12659
12692
|
|
|
@@ -12701,7 +12734,7 @@ const getUserInfo = async token => {
|
|
|
12701
12734
|
await ssoAuth(token);
|
|
12702
12735
|
cache.session.setJSON('SRKJ_TOKEN_CACHE', token);
|
|
12703
12736
|
};
|
|
12704
|
-
;//
|
|
12737
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat-tools.vue?vue&type=template&id=78eed5c6&scoped=true
|
|
12705
12738
|
var chat_toolsvue_type_template_id_78eed5c6_scoped_true_render = function render() {
|
|
12706
12739
|
var _vm = this,
|
|
12707
12740
|
_c = _vm._self._c;
|
|
@@ -12865,9 +12898,9 @@ var chat_toolsvue_type_template_id_78eed5c6_scoped_true_render = function render
|
|
|
12865
12898
|
};
|
|
12866
12899
|
var chat_toolsvue_type_template_id_78eed5c6_scoped_true_staticRenderFns = [];
|
|
12867
12900
|
|
|
12868
|
-
;//
|
|
12901
|
+
;// ./components/demo/src/chat-tools.vue?vue&type=template&id=78eed5c6&scoped=true
|
|
12869
12902
|
|
|
12870
|
-
;//
|
|
12903
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat-tools.vue?vue&type=script&lang=js
|
|
12871
12904
|
|
|
12872
12905
|
|
|
12873
12906
|
/* harmony default export */ var chat_toolsvue_type_script_lang_js = ({
|
|
@@ -12985,14 +13018,14 @@ var chat_toolsvue_type_template_id_78eed5c6_scoped_true_staticRenderFns = [];
|
|
|
12985
13018
|
}
|
|
12986
13019
|
}
|
|
12987
13020
|
});
|
|
12988
|
-
;//
|
|
13021
|
+
;// ./components/demo/src/chat-tools.vue?vue&type=script&lang=js
|
|
12989
13022
|
/* harmony default export */ var src_chat_toolsvue_type_script_lang_js = (chat_toolsvue_type_script_lang_js);
|
|
12990
|
-
;//
|
|
13023
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat-tools.vue?vue&type=style&index=0&id=78eed5c6&prod&lang=scss&scoped=true
|
|
12991
13024
|
// extracted by mini-css-extract-plugin
|
|
12992
13025
|
|
|
12993
|
-
;//
|
|
13026
|
+
;// ./components/demo/src/chat-tools.vue?vue&type=style&index=0&id=78eed5c6&prod&lang=scss&scoped=true
|
|
12994
13027
|
|
|
12995
|
-
;//
|
|
13028
|
+
;// ./components/demo/src/chat-tools.vue
|
|
12996
13029
|
|
|
12997
13030
|
|
|
12998
13031
|
|
|
@@ -13013,7 +13046,2513 @@ var chat_tools_component = normalizeComponent(
|
|
|
13013
13046
|
)
|
|
13014
13047
|
|
|
13015
13048
|
/* harmony default export */ var chat_tools = (chat_tools_component.exports);
|
|
13016
|
-
;//
|
|
13049
|
+
;// ./node_modules/marked/lib/marked.esm.js
|
|
13050
|
+
/**
|
|
13051
|
+
* marked v14.1.2 - a markdown parser
|
|
13052
|
+
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
13053
|
+
* https://github.com/markedjs/marked
|
|
13054
|
+
*/
|
|
13055
|
+
|
|
13056
|
+
/**
|
|
13057
|
+
* DO NOT EDIT THIS FILE
|
|
13058
|
+
* The code in this file is generated from files in ./src/
|
|
13059
|
+
*/
|
|
13060
|
+
|
|
13061
|
+
/**
|
|
13062
|
+
* Gets the original marked default options.
|
|
13063
|
+
*/
|
|
13064
|
+
function _getDefaults() {
|
|
13065
|
+
return {
|
|
13066
|
+
async: false,
|
|
13067
|
+
breaks: false,
|
|
13068
|
+
extensions: null,
|
|
13069
|
+
gfm: true,
|
|
13070
|
+
hooks: null,
|
|
13071
|
+
pedantic: false,
|
|
13072
|
+
renderer: null,
|
|
13073
|
+
silent: false,
|
|
13074
|
+
tokenizer: null,
|
|
13075
|
+
walkTokens: null,
|
|
13076
|
+
};
|
|
13077
|
+
}
|
|
13078
|
+
let _defaults = _getDefaults();
|
|
13079
|
+
function changeDefaults(newDefaults) {
|
|
13080
|
+
_defaults = newDefaults;
|
|
13081
|
+
}
|
|
13082
|
+
|
|
13083
|
+
/**
|
|
13084
|
+
* Helpers
|
|
13085
|
+
*/
|
|
13086
|
+
const escapeTest = /[&<>"']/;
|
|
13087
|
+
const escapeReplace = new RegExp(escapeTest.source, 'g');
|
|
13088
|
+
const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
|
|
13089
|
+
const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
|
|
13090
|
+
const escapeReplacements = {
|
|
13091
|
+
'&': '&',
|
|
13092
|
+
'<': '<',
|
|
13093
|
+
'>': '>',
|
|
13094
|
+
'"': '"',
|
|
13095
|
+
"'": ''',
|
|
13096
|
+
};
|
|
13097
|
+
const getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
13098
|
+
function escape$1(html, encode) {
|
|
13099
|
+
if (encode) {
|
|
13100
|
+
if (escapeTest.test(html)) {
|
|
13101
|
+
return html.replace(escapeReplace, getEscapeReplacement);
|
|
13102
|
+
}
|
|
13103
|
+
}
|
|
13104
|
+
else {
|
|
13105
|
+
if (escapeTestNoEncode.test(html)) {
|
|
13106
|
+
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
|
13107
|
+
}
|
|
13108
|
+
}
|
|
13109
|
+
return html;
|
|
13110
|
+
}
|
|
13111
|
+
const caret = /(^|[^\[])\^/g;
|
|
13112
|
+
function edit(regex, opt) {
|
|
13113
|
+
let source = typeof regex === 'string' ? regex : regex.source;
|
|
13114
|
+
opt = opt || '';
|
|
13115
|
+
const obj = {
|
|
13116
|
+
replace: (name, val) => {
|
|
13117
|
+
let valSource = typeof val === 'string' ? val : val.source;
|
|
13118
|
+
valSource = valSource.replace(caret, '$1');
|
|
13119
|
+
source = source.replace(name, valSource);
|
|
13120
|
+
return obj;
|
|
13121
|
+
},
|
|
13122
|
+
getRegex: () => {
|
|
13123
|
+
return new RegExp(source, opt);
|
|
13124
|
+
},
|
|
13125
|
+
};
|
|
13126
|
+
return obj;
|
|
13127
|
+
}
|
|
13128
|
+
function cleanUrl(href) {
|
|
13129
|
+
try {
|
|
13130
|
+
href = encodeURI(href).replace(/%25/g, '%');
|
|
13131
|
+
}
|
|
13132
|
+
catch {
|
|
13133
|
+
return null;
|
|
13134
|
+
}
|
|
13135
|
+
return href;
|
|
13136
|
+
}
|
|
13137
|
+
const noopTest = { exec: () => null };
|
|
13138
|
+
function splitCells(tableRow, count) {
|
|
13139
|
+
// ensure that every cell-delimiting pipe has a space
|
|
13140
|
+
// before it to distinguish it from an escaped pipe
|
|
13141
|
+
const row = tableRow.replace(/\|/g, (match, offset, str) => {
|
|
13142
|
+
let escaped = false;
|
|
13143
|
+
let curr = offset;
|
|
13144
|
+
while (--curr >= 0 && str[curr] === '\\')
|
|
13145
|
+
escaped = !escaped;
|
|
13146
|
+
if (escaped) {
|
|
13147
|
+
// odd number of slashes means | is escaped
|
|
13148
|
+
// so we leave it alone
|
|
13149
|
+
return '|';
|
|
13150
|
+
}
|
|
13151
|
+
else {
|
|
13152
|
+
// add space before unescaped |
|
|
13153
|
+
return ' |';
|
|
13154
|
+
}
|
|
13155
|
+
}), cells = row.split(/ \|/);
|
|
13156
|
+
let i = 0;
|
|
13157
|
+
// First/last cell in a row cannot be empty if it has no leading/trailing pipe
|
|
13158
|
+
if (!cells[0].trim()) {
|
|
13159
|
+
cells.shift();
|
|
13160
|
+
}
|
|
13161
|
+
if (cells.length > 0 && !cells[cells.length - 1].trim()) {
|
|
13162
|
+
cells.pop();
|
|
13163
|
+
}
|
|
13164
|
+
if (count) {
|
|
13165
|
+
if (cells.length > count) {
|
|
13166
|
+
cells.splice(count);
|
|
13167
|
+
}
|
|
13168
|
+
else {
|
|
13169
|
+
while (cells.length < count)
|
|
13170
|
+
cells.push('');
|
|
13171
|
+
}
|
|
13172
|
+
}
|
|
13173
|
+
for (; i < cells.length; i++) {
|
|
13174
|
+
// leading or trailing whitespace is ignored per the gfm spec
|
|
13175
|
+
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
|
|
13176
|
+
}
|
|
13177
|
+
return cells;
|
|
13178
|
+
}
|
|
13179
|
+
/**
|
|
13180
|
+
* Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
|
13181
|
+
* /c*$/ is vulnerable to REDOS.
|
|
13182
|
+
*
|
|
13183
|
+
* @param str
|
|
13184
|
+
* @param c
|
|
13185
|
+
* @param invert Remove suffix of non-c chars instead. Default falsey.
|
|
13186
|
+
*/
|
|
13187
|
+
function rtrim(str, c, invert) {
|
|
13188
|
+
const l = str.length;
|
|
13189
|
+
if (l === 0) {
|
|
13190
|
+
return '';
|
|
13191
|
+
}
|
|
13192
|
+
// Length of suffix matching the invert condition.
|
|
13193
|
+
let suffLen = 0;
|
|
13194
|
+
// Step left until we fail to match the invert condition.
|
|
13195
|
+
while (suffLen < l) {
|
|
13196
|
+
const currChar = str.charAt(l - suffLen - 1);
|
|
13197
|
+
if (currChar === c && !invert) {
|
|
13198
|
+
suffLen++;
|
|
13199
|
+
}
|
|
13200
|
+
else if (currChar !== c && invert) {
|
|
13201
|
+
suffLen++;
|
|
13202
|
+
}
|
|
13203
|
+
else {
|
|
13204
|
+
break;
|
|
13205
|
+
}
|
|
13206
|
+
}
|
|
13207
|
+
return str.slice(0, l - suffLen);
|
|
13208
|
+
}
|
|
13209
|
+
function findClosingBracket(str, b) {
|
|
13210
|
+
if (str.indexOf(b[1]) === -1) {
|
|
13211
|
+
return -1;
|
|
13212
|
+
}
|
|
13213
|
+
let level = 0;
|
|
13214
|
+
for (let i = 0; i < str.length; i++) {
|
|
13215
|
+
if (str[i] === '\\') {
|
|
13216
|
+
i++;
|
|
13217
|
+
}
|
|
13218
|
+
else if (str[i] === b[0]) {
|
|
13219
|
+
level++;
|
|
13220
|
+
}
|
|
13221
|
+
else if (str[i] === b[1]) {
|
|
13222
|
+
level--;
|
|
13223
|
+
if (level < 0) {
|
|
13224
|
+
return i;
|
|
13225
|
+
}
|
|
13226
|
+
}
|
|
13227
|
+
}
|
|
13228
|
+
return -1;
|
|
13229
|
+
}
|
|
13230
|
+
|
|
13231
|
+
function outputLink(cap, link, raw, lexer) {
|
|
13232
|
+
const href = link.href;
|
|
13233
|
+
const title = link.title ? escape$1(link.title) : null;
|
|
13234
|
+
const text = cap[1].replace(/\\([\[\]])/g, '$1');
|
|
13235
|
+
if (cap[0].charAt(0) !== '!') {
|
|
13236
|
+
lexer.state.inLink = true;
|
|
13237
|
+
const token = {
|
|
13238
|
+
type: 'link',
|
|
13239
|
+
raw,
|
|
13240
|
+
href,
|
|
13241
|
+
title,
|
|
13242
|
+
text,
|
|
13243
|
+
tokens: lexer.inlineTokens(text),
|
|
13244
|
+
};
|
|
13245
|
+
lexer.state.inLink = false;
|
|
13246
|
+
return token;
|
|
13247
|
+
}
|
|
13248
|
+
return {
|
|
13249
|
+
type: 'image',
|
|
13250
|
+
raw,
|
|
13251
|
+
href,
|
|
13252
|
+
title,
|
|
13253
|
+
text: escape$1(text),
|
|
13254
|
+
};
|
|
13255
|
+
}
|
|
13256
|
+
function indentCodeCompensation(raw, text) {
|
|
13257
|
+
const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
|
13258
|
+
if (matchIndentToCode === null) {
|
|
13259
|
+
return text;
|
|
13260
|
+
}
|
|
13261
|
+
const indentToCode = matchIndentToCode[1];
|
|
13262
|
+
return text
|
|
13263
|
+
.split('\n')
|
|
13264
|
+
.map(node => {
|
|
13265
|
+
const matchIndentInNode = node.match(/^\s+/);
|
|
13266
|
+
if (matchIndentInNode === null) {
|
|
13267
|
+
return node;
|
|
13268
|
+
}
|
|
13269
|
+
const [indentInNode] = matchIndentInNode;
|
|
13270
|
+
if (indentInNode.length >= indentToCode.length) {
|
|
13271
|
+
return node.slice(indentToCode.length);
|
|
13272
|
+
}
|
|
13273
|
+
return node;
|
|
13274
|
+
})
|
|
13275
|
+
.join('\n');
|
|
13276
|
+
}
|
|
13277
|
+
/**
|
|
13278
|
+
* Tokenizer
|
|
13279
|
+
*/
|
|
13280
|
+
class _Tokenizer {
|
|
13281
|
+
options;
|
|
13282
|
+
rules; // set by the lexer
|
|
13283
|
+
lexer; // set by the lexer
|
|
13284
|
+
constructor(options) {
|
|
13285
|
+
this.options = options || _defaults;
|
|
13286
|
+
}
|
|
13287
|
+
space(src) {
|
|
13288
|
+
const cap = this.rules.block.newline.exec(src);
|
|
13289
|
+
if (cap && cap[0].length > 0) {
|
|
13290
|
+
return {
|
|
13291
|
+
type: 'space',
|
|
13292
|
+
raw: cap[0],
|
|
13293
|
+
};
|
|
13294
|
+
}
|
|
13295
|
+
}
|
|
13296
|
+
code(src) {
|
|
13297
|
+
const cap = this.rules.block.code.exec(src);
|
|
13298
|
+
if (cap) {
|
|
13299
|
+
const text = cap[0].replace(/^(?: {1,4}| {0,3}\t)/gm, '');
|
|
13300
|
+
return {
|
|
13301
|
+
type: 'code',
|
|
13302
|
+
raw: cap[0],
|
|
13303
|
+
codeBlockStyle: 'indented',
|
|
13304
|
+
text: !this.options.pedantic
|
|
13305
|
+
? rtrim(text, '\n')
|
|
13306
|
+
: text,
|
|
13307
|
+
};
|
|
13308
|
+
}
|
|
13309
|
+
}
|
|
13310
|
+
fences(src) {
|
|
13311
|
+
const cap = this.rules.block.fences.exec(src);
|
|
13312
|
+
if (cap) {
|
|
13313
|
+
const raw = cap[0];
|
|
13314
|
+
const text = indentCodeCompensation(raw, cap[3] || '');
|
|
13315
|
+
return {
|
|
13316
|
+
type: 'code',
|
|
13317
|
+
raw,
|
|
13318
|
+
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],
|
|
13319
|
+
text,
|
|
13320
|
+
};
|
|
13321
|
+
}
|
|
13322
|
+
}
|
|
13323
|
+
heading(src) {
|
|
13324
|
+
const cap = this.rules.block.heading.exec(src);
|
|
13325
|
+
if (cap) {
|
|
13326
|
+
let text = cap[2].trim();
|
|
13327
|
+
// remove trailing #s
|
|
13328
|
+
if (/#$/.test(text)) {
|
|
13329
|
+
const trimmed = rtrim(text, '#');
|
|
13330
|
+
if (this.options.pedantic) {
|
|
13331
|
+
text = trimmed.trim();
|
|
13332
|
+
}
|
|
13333
|
+
else if (!trimmed || / $/.test(trimmed)) {
|
|
13334
|
+
// CommonMark requires space before trailing #s
|
|
13335
|
+
text = trimmed.trim();
|
|
13336
|
+
}
|
|
13337
|
+
}
|
|
13338
|
+
return {
|
|
13339
|
+
type: 'heading',
|
|
13340
|
+
raw: cap[0],
|
|
13341
|
+
depth: cap[1].length,
|
|
13342
|
+
text,
|
|
13343
|
+
tokens: this.lexer.inline(text),
|
|
13344
|
+
};
|
|
13345
|
+
}
|
|
13346
|
+
}
|
|
13347
|
+
hr(src) {
|
|
13348
|
+
const cap = this.rules.block.hr.exec(src);
|
|
13349
|
+
if (cap) {
|
|
13350
|
+
return {
|
|
13351
|
+
type: 'hr',
|
|
13352
|
+
raw: rtrim(cap[0], '\n'),
|
|
13353
|
+
};
|
|
13354
|
+
}
|
|
13355
|
+
}
|
|
13356
|
+
blockquote(src) {
|
|
13357
|
+
const cap = this.rules.block.blockquote.exec(src);
|
|
13358
|
+
if (cap) {
|
|
13359
|
+
let lines = rtrim(cap[0], '\n').split('\n');
|
|
13360
|
+
let raw = '';
|
|
13361
|
+
let text = '';
|
|
13362
|
+
const tokens = [];
|
|
13363
|
+
while (lines.length > 0) {
|
|
13364
|
+
let inBlockquote = false;
|
|
13365
|
+
const currentLines = [];
|
|
13366
|
+
let i;
|
|
13367
|
+
for (i = 0; i < lines.length; i++) {
|
|
13368
|
+
// get lines up to a continuation
|
|
13369
|
+
if (/^ {0,3}>/.test(lines[i])) {
|
|
13370
|
+
currentLines.push(lines[i]);
|
|
13371
|
+
inBlockquote = true;
|
|
13372
|
+
}
|
|
13373
|
+
else if (!inBlockquote) {
|
|
13374
|
+
currentLines.push(lines[i]);
|
|
13375
|
+
}
|
|
13376
|
+
else {
|
|
13377
|
+
break;
|
|
13378
|
+
}
|
|
13379
|
+
}
|
|
13380
|
+
lines = lines.slice(i);
|
|
13381
|
+
const currentRaw = currentLines.join('\n');
|
|
13382
|
+
const currentText = currentRaw
|
|
13383
|
+
// precede setext continuation with 4 spaces so it isn't a setext
|
|
13384
|
+
.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1')
|
|
13385
|
+
.replace(/^ {0,3}>[ \t]?/gm, '');
|
|
13386
|
+
raw = raw ? `${raw}\n${currentRaw}` : currentRaw;
|
|
13387
|
+
text = text ? `${text}\n${currentText}` : currentText;
|
|
13388
|
+
// parse blockquote lines as top level tokens
|
|
13389
|
+
// merge paragraphs if this is a continuation
|
|
13390
|
+
const top = this.lexer.state.top;
|
|
13391
|
+
this.lexer.state.top = true;
|
|
13392
|
+
this.lexer.blockTokens(currentText, tokens, true);
|
|
13393
|
+
this.lexer.state.top = top;
|
|
13394
|
+
// if there is no continuation then we are done
|
|
13395
|
+
if (lines.length === 0) {
|
|
13396
|
+
break;
|
|
13397
|
+
}
|
|
13398
|
+
const lastToken = tokens[tokens.length - 1];
|
|
13399
|
+
if (lastToken?.type === 'code') {
|
|
13400
|
+
// blockquote continuation cannot be preceded by a code block
|
|
13401
|
+
break;
|
|
13402
|
+
}
|
|
13403
|
+
else if (lastToken?.type === 'blockquote') {
|
|
13404
|
+
// include continuation in nested blockquote
|
|
13405
|
+
const oldToken = lastToken;
|
|
13406
|
+
const newText = oldToken.raw + '\n' + lines.join('\n');
|
|
13407
|
+
const newToken = this.blockquote(newText);
|
|
13408
|
+
tokens[tokens.length - 1] = newToken;
|
|
13409
|
+
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
|
13410
|
+
text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
|
|
13411
|
+
break;
|
|
13412
|
+
}
|
|
13413
|
+
else if (lastToken?.type === 'list') {
|
|
13414
|
+
// include continuation in nested list
|
|
13415
|
+
const oldToken = lastToken;
|
|
13416
|
+
const newText = oldToken.raw + '\n' + lines.join('\n');
|
|
13417
|
+
const newToken = this.list(newText);
|
|
13418
|
+
tokens[tokens.length - 1] = newToken;
|
|
13419
|
+
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
|
13420
|
+
text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
|
|
13421
|
+
lines = newText.substring(tokens[tokens.length - 1].raw.length).split('\n');
|
|
13422
|
+
continue;
|
|
13423
|
+
}
|
|
13424
|
+
}
|
|
13425
|
+
return {
|
|
13426
|
+
type: 'blockquote',
|
|
13427
|
+
raw,
|
|
13428
|
+
tokens,
|
|
13429
|
+
text,
|
|
13430
|
+
};
|
|
13431
|
+
}
|
|
13432
|
+
}
|
|
13433
|
+
list(src) {
|
|
13434
|
+
let cap = this.rules.block.list.exec(src);
|
|
13435
|
+
if (cap) {
|
|
13436
|
+
let bull = cap[1].trim();
|
|
13437
|
+
const isordered = bull.length > 1;
|
|
13438
|
+
const list = {
|
|
13439
|
+
type: 'list',
|
|
13440
|
+
raw: '',
|
|
13441
|
+
ordered: isordered,
|
|
13442
|
+
start: isordered ? +bull.slice(0, -1) : '',
|
|
13443
|
+
loose: false,
|
|
13444
|
+
items: [],
|
|
13445
|
+
};
|
|
13446
|
+
bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
|
13447
|
+
if (this.options.pedantic) {
|
|
13448
|
+
bull = isordered ? bull : '[*+-]';
|
|
13449
|
+
}
|
|
13450
|
+
// Get next list item
|
|
13451
|
+
const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
|
|
13452
|
+
let endsWithBlankLine = false;
|
|
13453
|
+
// Check if current bullet point can start a new List Item
|
|
13454
|
+
while (src) {
|
|
13455
|
+
let endEarly = false;
|
|
13456
|
+
let raw = '';
|
|
13457
|
+
let itemContents = '';
|
|
13458
|
+
if (!(cap = itemRegex.exec(src))) {
|
|
13459
|
+
break;
|
|
13460
|
+
}
|
|
13461
|
+
if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?)
|
|
13462
|
+
break;
|
|
13463
|
+
}
|
|
13464
|
+
raw = cap[0];
|
|
13465
|
+
src = src.substring(raw.length);
|
|
13466
|
+
let line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
|
13467
|
+
let nextLine = src.split('\n', 1)[0];
|
|
13468
|
+
let blankLine = !line.trim();
|
|
13469
|
+
let indent = 0;
|
|
13470
|
+
if (this.options.pedantic) {
|
|
13471
|
+
indent = 2;
|
|
13472
|
+
itemContents = line.trimStart();
|
|
13473
|
+
}
|
|
13474
|
+
else if (blankLine) {
|
|
13475
|
+
indent = cap[1].length + 1;
|
|
13476
|
+
}
|
|
13477
|
+
else {
|
|
13478
|
+
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
13479
|
+
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
13480
|
+
itemContents = line.slice(indent);
|
|
13481
|
+
indent += cap[1].length;
|
|
13482
|
+
}
|
|
13483
|
+
if (blankLine && /^[ \t]*$/.test(nextLine)) { // Items begin with at most one blank line
|
|
13484
|
+
raw += nextLine + '\n';
|
|
13485
|
+
src = src.substring(nextLine.length + 1);
|
|
13486
|
+
endEarly = true;
|
|
13487
|
+
}
|
|
13488
|
+
if (!endEarly) {
|
|
13489
|
+
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
|
|
13490
|
+
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
|
13491
|
+
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
|
13492
|
+
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
|
13493
|
+
const htmlBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}<[a-z].*>`, 'i');
|
|
13494
|
+
// Check if following lines should be included in List Item
|
|
13495
|
+
while (src) {
|
|
13496
|
+
const rawLine = src.split('\n', 1)[0];
|
|
13497
|
+
let nextLineWithoutTabs;
|
|
13498
|
+
nextLine = rawLine;
|
|
13499
|
+
// Re-align to follow commonmark nesting rules
|
|
13500
|
+
if (this.options.pedantic) {
|
|
13501
|
+
nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
|
|
13502
|
+
nextLineWithoutTabs = nextLine;
|
|
13503
|
+
}
|
|
13504
|
+
else {
|
|
13505
|
+
nextLineWithoutTabs = nextLine.replace(/\t/g, ' ');
|
|
13506
|
+
}
|
|
13507
|
+
// End list item if found code fences
|
|
13508
|
+
if (fencesBeginRegex.test(nextLine)) {
|
|
13509
|
+
break;
|
|
13510
|
+
}
|
|
13511
|
+
// End list item if found start of new heading
|
|
13512
|
+
if (headingBeginRegex.test(nextLine)) {
|
|
13513
|
+
break;
|
|
13514
|
+
}
|
|
13515
|
+
// End list item if found start of html block
|
|
13516
|
+
if (htmlBeginRegex.test(nextLine)) {
|
|
13517
|
+
break;
|
|
13518
|
+
}
|
|
13519
|
+
// End list item if found start of new bullet
|
|
13520
|
+
if (nextBulletRegex.test(nextLine)) {
|
|
13521
|
+
break;
|
|
13522
|
+
}
|
|
13523
|
+
// Horizontal rule found
|
|
13524
|
+
if (hrRegex.test(nextLine)) {
|
|
13525
|
+
break;
|
|
13526
|
+
}
|
|
13527
|
+
if (nextLineWithoutTabs.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible
|
|
13528
|
+
itemContents += '\n' + nextLineWithoutTabs.slice(indent);
|
|
13529
|
+
}
|
|
13530
|
+
else {
|
|
13531
|
+
// not enough indentation
|
|
13532
|
+
if (blankLine) {
|
|
13533
|
+
break;
|
|
13534
|
+
}
|
|
13535
|
+
// paragraph continuation unless last line was a different block level element
|
|
13536
|
+
if (line.replace(/\t/g, ' ').search(/[^ ]/) >= 4) { // indented code block
|
|
13537
|
+
break;
|
|
13538
|
+
}
|
|
13539
|
+
if (fencesBeginRegex.test(line)) {
|
|
13540
|
+
break;
|
|
13541
|
+
}
|
|
13542
|
+
if (headingBeginRegex.test(line)) {
|
|
13543
|
+
break;
|
|
13544
|
+
}
|
|
13545
|
+
if (hrRegex.test(line)) {
|
|
13546
|
+
break;
|
|
13547
|
+
}
|
|
13548
|
+
itemContents += '\n' + nextLine;
|
|
13549
|
+
}
|
|
13550
|
+
if (!blankLine && !nextLine.trim()) { // Check if current line is blank
|
|
13551
|
+
blankLine = true;
|
|
13552
|
+
}
|
|
13553
|
+
raw += rawLine + '\n';
|
|
13554
|
+
src = src.substring(rawLine.length + 1);
|
|
13555
|
+
line = nextLineWithoutTabs.slice(indent);
|
|
13556
|
+
}
|
|
13557
|
+
}
|
|
13558
|
+
if (!list.loose) {
|
|
13559
|
+
// If the previous item ended with a blank line, the list is loose
|
|
13560
|
+
if (endsWithBlankLine) {
|
|
13561
|
+
list.loose = true;
|
|
13562
|
+
}
|
|
13563
|
+
else if (/\n[ \t]*\n[ \t]*$/.test(raw)) {
|
|
13564
|
+
endsWithBlankLine = true;
|
|
13565
|
+
}
|
|
13566
|
+
}
|
|
13567
|
+
let istask = null;
|
|
13568
|
+
let ischecked;
|
|
13569
|
+
// Check for task list items
|
|
13570
|
+
if (this.options.gfm) {
|
|
13571
|
+
istask = /^\[[ xX]\] /.exec(itemContents);
|
|
13572
|
+
if (istask) {
|
|
13573
|
+
ischecked = istask[0] !== '[ ] ';
|
|
13574
|
+
itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
|
|
13575
|
+
}
|
|
13576
|
+
}
|
|
13577
|
+
list.items.push({
|
|
13578
|
+
type: 'list_item',
|
|
13579
|
+
raw,
|
|
13580
|
+
task: !!istask,
|
|
13581
|
+
checked: ischecked,
|
|
13582
|
+
loose: false,
|
|
13583
|
+
text: itemContents,
|
|
13584
|
+
tokens: [],
|
|
13585
|
+
});
|
|
13586
|
+
list.raw += raw;
|
|
13587
|
+
}
|
|
13588
|
+
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
13589
|
+
list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();
|
|
13590
|
+
list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();
|
|
13591
|
+
list.raw = list.raw.trimEnd();
|
|
13592
|
+
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
13593
|
+
for (let i = 0; i < list.items.length; i++) {
|
|
13594
|
+
this.lexer.state.top = false;
|
|
13595
|
+
list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
|
|
13596
|
+
if (!list.loose) {
|
|
13597
|
+
// Check if list should be loose
|
|
13598
|
+
const spacers = list.items[i].tokens.filter(t => t.type === 'space');
|
|
13599
|
+
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
|
|
13600
|
+
list.loose = hasMultipleLineBreaks;
|
|
13601
|
+
}
|
|
13602
|
+
}
|
|
13603
|
+
// Set all items to loose if list is loose
|
|
13604
|
+
if (list.loose) {
|
|
13605
|
+
for (let i = 0; i < list.items.length; i++) {
|
|
13606
|
+
list.items[i].loose = true;
|
|
13607
|
+
}
|
|
13608
|
+
}
|
|
13609
|
+
return list;
|
|
13610
|
+
}
|
|
13611
|
+
}
|
|
13612
|
+
html(src) {
|
|
13613
|
+
const cap = this.rules.block.html.exec(src);
|
|
13614
|
+
if (cap) {
|
|
13615
|
+
const token = {
|
|
13616
|
+
type: 'html',
|
|
13617
|
+
block: true,
|
|
13618
|
+
raw: cap[0],
|
|
13619
|
+
pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
|
|
13620
|
+
text: cap[0],
|
|
13621
|
+
};
|
|
13622
|
+
return token;
|
|
13623
|
+
}
|
|
13624
|
+
}
|
|
13625
|
+
def(src) {
|
|
13626
|
+
const cap = this.rules.block.def.exec(src);
|
|
13627
|
+
if (cap) {
|
|
13628
|
+
const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
|
13629
|
+
const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline.anyPunctuation, '$1') : '';
|
|
13630
|
+
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3];
|
|
13631
|
+
return {
|
|
13632
|
+
type: 'def',
|
|
13633
|
+
tag,
|
|
13634
|
+
raw: cap[0],
|
|
13635
|
+
href,
|
|
13636
|
+
title,
|
|
13637
|
+
};
|
|
13638
|
+
}
|
|
13639
|
+
}
|
|
13640
|
+
table(src) {
|
|
13641
|
+
const cap = this.rules.block.table.exec(src);
|
|
13642
|
+
if (!cap) {
|
|
13643
|
+
return;
|
|
13644
|
+
}
|
|
13645
|
+
if (!/[:|]/.test(cap[2])) {
|
|
13646
|
+
// delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
|
|
13647
|
+
return;
|
|
13648
|
+
}
|
|
13649
|
+
const headers = splitCells(cap[1]);
|
|
13650
|
+
const aligns = cap[2].replace(/^\||\| *$/g, '').split('|');
|
|
13651
|
+
const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : [];
|
|
13652
|
+
const item = {
|
|
13653
|
+
type: 'table',
|
|
13654
|
+
raw: cap[0],
|
|
13655
|
+
header: [],
|
|
13656
|
+
align: [],
|
|
13657
|
+
rows: [],
|
|
13658
|
+
};
|
|
13659
|
+
if (headers.length !== aligns.length) {
|
|
13660
|
+
// header and align columns must be equal, rows can be different.
|
|
13661
|
+
return;
|
|
13662
|
+
}
|
|
13663
|
+
for (const align of aligns) {
|
|
13664
|
+
if (/^ *-+: *$/.test(align)) {
|
|
13665
|
+
item.align.push('right');
|
|
13666
|
+
}
|
|
13667
|
+
else if (/^ *:-+: *$/.test(align)) {
|
|
13668
|
+
item.align.push('center');
|
|
13669
|
+
}
|
|
13670
|
+
else if (/^ *:-+ *$/.test(align)) {
|
|
13671
|
+
item.align.push('left');
|
|
13672
|
+
}
|
|
13673
|
+
else {
|
|
13674
|
+
item.align.push(null);
|
|
13675
|
+
}
|
|
13676
|
+
}
|
|
13677
|
+
for (let i = 0; i < headers.length; i++) {
|
|
13678
|
+
item.header.push({
|
|
13679
|
+
text: headers[i],
|
|
13680
|
+
tokens: this.lexer.inline(headers[i]),
|
|
13681
|
+
header: true,
|
|
13682
|
+
align: item.align[i],
|
|
13683
|
+
});
|
|
13684
|
+
}
|
|
13685
|
+
for (const row of rows) {
|
|
13686
|
+
item.rows.push(splitCells(row, item.header.length).map((cell, i) => {
|
|
13687
|
+
return {
|
|
13688
|
+
text: cell,
|
|
13689
|
+
tokens: this.lexer.inline(cell),
|
|
13690
|
+
header: false,
|
|
13691
|
+
align: item.align[i],
|
|
13692
|
+
};
|
|
13693
|
+
}));
|
|
13694
|
+
}
|
|
13695
|
+
return item;
|
|
13696
|
+
}
|
|
13697
|
+
lheading(src) {
|
|
13698
|
+
const cap = this.rules.block.lheading.exec(src);
|
|
13699
|
+
if (cap) {
|
|
13700
|
+
return {
|
|
13701
|
+
type: 'heading',
|
|
13702
|
+
raw: cap[0],
|
|
13703
|
+
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
|
13704
|
+
text: cap[1],
|
|
13705
|
+
tokens: this.lexer.inline(cap[1]),
|
|
13706
|
+
};
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13709
|
+
paragraph(src) {
|
|
13710
|
+
const cap = this.rules.block.paragraph.exec(src);
|
|
13711
|
+
if (cap) {
|
|
13712
|
+
const text = cap[1].charAt(cap[1].length - 1) === '\n'
|
|
13713
|
+
? cap[1].slice(0, -1)
|
|
13714
|
+
: cap[1];
|
|
13715
|
+
return {
|
|
13716
|
+
type: 'paragraph',
|
|
13717
|
+
raw: cap[0],
|
|
13718
|
+
text,
|
|
13719
|
+
tokens: this.lexer.inline(text),
|
|
13720
|
+
};
|
|
13721
|
+
}
|
|
13722
|
+
}
|
|
13723
|
+
text(src) {
|
|
13724
|
+
const cap = this.rules.block.text.exec(src);
|
|
13725
|
+
if (cap) {
|
|
13726
|
+
return {
|
|
13727
|
+
type: 'text',
|
|
13728
|
+
raw: cap[0],
|
|
13729
|
+
text: cap[0],
|
|
13730
|
+
tokens: this.lexer.inline(cap[0]),
|
|
13731
|
+
};
|
|
13732
|
+
}
|
|
13733
|
+
}
|
|
13734
|
+
escape(src) {
|
|
13735
|
+
const cap = this.rules.inline.escape.exec(src);
|
|
13736
|
+
if (cap) {
|
|
13737
|
+
return {
|
|
13738
|
+
type: 'escape',
|
|
13739
|
+
raw: cap[0],
|
|
13740
|
+
text: escape$1(cap[1]),
|
|
13741
|
+
};
|
|
13742
|
+
}
|
|
13743
|
+
}
|
|
13744
|
+
tag(src) {
|
|
13745
|
+
const cap = this.rules.inline.tag.exec(src);
|
|
13746
|
+
if (cap) {
|
|
13747
|
+
if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
|
|
13748
|
+
this.lexer.state.inLink = true;
|
|
13749
|
+
}
|
|
13750
|
+
else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
|
|
13751
|
+
this.lexer.state.inLink = false;
|
|
13752
|
+
}
|
|
13753
|
+
if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
|
13754
|
+
this.lexer.state.inRawBlock = true;
|
|
13755
|
+
}
|
|
13756
|
+
else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
|
13757
|
+
this.lexer.state.inRawBlock = false;
|
|
13758
|
+
}
|
|
13759
|
+
return {
|
|
13760
|
+
type: 'html',
|
|
13761
|
+
raw: cap[0],
|
|
13762
|
+
inLink: this.lexer.state.inLink,
|
|
13763
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
13764
|
+
block: false,
|
|
13765
|
+
text: cap[0],
|
|
13766
|
+
};
|
|
13767
|
+
}
|
|
13768
|
+
}
|
|
13769
|
+
link(src) {
|
|
13770
|
+
const cap = this.rules.inline.link.exec(src);
|
|
13771
|
+
if (cap) {
|
|
13772
|
+
const trimmedUrl = cap[2].trim();
|
|
13773
|
+
if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
|
13774
|
+
// commonmark requires matching angle brackets
|
|
13775
|
+
if (!(/>$/.test(trimmedUrl))) {
|
|
13776
|
+
return;
|
|
13777
|
+
}
|
|
13778
|
+
// ending angle bracket cannot be escaped
|
|
13779
|
+
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
|
13780
|
+
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
13781
|
+
return;
|
|
13782
|
+
}
|
|
13783
|
+
}
|
|
13784
|
+
else {
|
|
13785
|
+
// find closing parenthesis
|
|
13786
|
+
const lastParenIndex = findClosingBracket(cap[2], '()');
|
|
13787
|
+
if (lastParenIndex > -1) {
|
|
13788
|
+
const start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
|
13789
|
+
const linkLen = start + cap[1].length + lastParenIndex;
|
|
13790
|
+
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
13791
|
+
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
13792
|
+
cap[3] = '';
|
|
13793
|
+
}
|
|
13794
|
+
}
|
|
13795
|
+
let href = cap[2];
|
|
13796
|
+
let title = '';
|
|
13797
|
+
if (this.options.pedantic) {
|
|
13798
|
+
// split pedantic href and title
|
|
13799
|
+
const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
|
13800
|
+
if (link) {
|
|
13801
|
+
href = link[1];
|
|
13802
|
+
title = link[3];
|
|
13803
|
+
}
|
|
13804
|
+
}
|
|
13805
|
+
else {
|
|
13806
|
+
title = cap[3] ? cap[3].slice(1, -1) : '';
|
|
13807
|
+
}
|
|
13808
|
+
href = href.trim();
|
|
13809
|
+
if (/^</.test(href)) {
|
|
13810
|
+
if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {
|
|
13811
|
+
// pedantic allows starting angle bracket without ending angle bracket
|
|
13812
|
+
href = href.slice(1);
|
|
13813
|
+
}
|
|
13814
|
+
else {
|
|
13815
|
+
href = href.slice(1, -1);
|
|
13816
|
+
}
|
|
13817
|
+
}
|
|
13818
|
+
return outputLink(cap, {
|
|
13819
|
+
href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,
|
|
13820
|
+
title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,
|
|
13821
|
+
}, cap[0], this.lexer);
|
|
13822
|
+
}
|
|
13823
|
+
}
|
|
13824
|
+
reflink(src, links) {
|
|
13825
|
+
let cap;
|
|
13826
|
+
if ((cap = this.rules.inline.reflink.exec(src))
|
|
13827
|
+
|| (cap = this.rules.inline.nolink.exec(src))) {
|
|
13828
|
+
const linkString = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
|
13829
|
+
const link = links[linkString.toLowerCase()];
|
|
13830
|
+
if (!link) {
|
|
13831
|
+
const text = cap[0].charAt(0);
|
|
13832
|
+
return {
|
|
13833
|
+
type: 'text',
|
|
13834
|
+
raw: text,
|
|
13835
|
+
text,
|
|
13836
|
+
};
|
|
13837
|
+
}
|
|
13838
|
+
return outputLink(cap, link, cap[0], this.lexer);
|
|
13839
|
+
}
|
|
13840
|
+
}
|
|
13841
|
+
emStrong(src, maskedSrc, prevChar = '') {
|
|
13842
|
+
let match = this.rules.inline.emStrongLDelim.exec(src);
|
|
13843
|
+
if (!match)
|
|
13844
|
+
return;
|
|
13845
|
+
// _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
|
|
13846
|
+
if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
|
|
13847
|
+
return;
|
|
13848
|
+
const nextChar = match[1] || match[2] || '';
|
|
13849
|
+
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
|
13850
|
+
// unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
|
|
13851
|
+
const lLength = [...match[0]].length - 1;
|
|
13852
|
+
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
|
13853
|
+
const endReg = match[0][0] === '*' ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
13854
|
+
endReg.lastIndex = 0;
|
|
13855
|
+
// Clip maskedSrc to same section of string as src (move to lexer?)
|
|
13856
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
13857
|
+
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
13858
|
+
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
13859
|
+
if (!rDelim)
|
|
13860
|
+
continue; // skip single * in __abc*abc__
|
|
13861
|
+
rLength = [...rDelim].length;
|
|
13862
|
+
if (match[3] || match[4]) { // found another Left Delim
|
|
13863
|
+
delimTotal += rLength;
|
|
13864
|
+
continue;
|
|
13865
|
+
}
|
|
13866
|
+
else if (match[5] || match[6]) { // either Left or Right Delim
|
|
13867
|
+
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
13868
|
+
midDelimTotal += rLength;
|
|
13869
|
+
continue; // CommonMark Emphasis Rules 9-10
|
|
13870
|
+
}
|
|
13871
|
+
}
|
|
13872
|
+
delimTotal -= rLength;
|
|
13873
|
+
if (delimTotal > 0)
|
|
13874
|
+
continue; // Haven't found enough closing delimiters
|
|
13875
|
+
// Remove extra characters. *a*** -> *a*
|
|
13876
|
+
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
13877
|
+
// char length can be >1 for unicode characters;
|
|
13878
|
+
const lastCharLength = [...match[0]][0].length;
|
|
13879
|
+
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
|
13880
|
+
// Create `em` if smallest delimiter has odd char count. *a***
|
|
13881
|
+
if (Math.min(lLength, rLength) % 2) {
|
|
13882
|
+
const text = raw.slice(1, -1);
|
|
13883
|
+
return {
|
|
13884
|
+
type: 'em',
|
|
13885
|
+
raw,
|
|
13886
|
+
text,
|
|
13887
|
+
tokens: this.lexer.inlineTokens(text),
|
|
13888
|
+
};
|
|
13889
|
+
}
|
|
13890
|
+
// Create 'strong' if smallest delimiter has even char count. **a***
|
|
13891
|
+
const text = raw.slice(2, -2);
|
|
13892
|
+
return {
|
|
13893
|
+
type: 'strong',
|
|
13894
|
+
raw,
|
|
13895
|
+
text,
|
|
13896
|
+
tokens: this.lexer.inlineTokens(text),
|
|
13897
|
+
};
|
|
13898
|
+
}
|
|
13899
|
+
}
|
|
13900
|
+
}
|
|
13901
|
+
codespan(src) {
|
|
13902
|
+
const cap = this.rules.inline.code.exec(src);
|
|
13903
|
+
if (cap) {
|
|
13904
|
+
let text = cap[2].replace(/\n/g, ' ');
|
|
13905
|
+
const hasNonSpaceChars = /[^ ]/.test(text);
|
|
13906
|
+
const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
|
|
13907
|
+
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
13908
|
+
text = text.substring(1, text.length - 1);
|
|
13909
|
+
}
|
|
13910
|
+
text = escape$1(text, true);
|
|
13911
|
+
return {
|
|
13912
|
+
type: 'codespan',
|
|
13913
|
+
raw: cap[0],
|
|
13914
|
+
text,
|
|
13915
|
+
};
|
|
13916
|
+
}
|
|
13917
|
+
}
|
|
13918
|
+
br(src) {
|
|
13919
|
+
const cap = this.rules.inline.br.exec(src);
|
|
13920
|
+
if (cap) {
|
|
13921
|
+
return {
|
|
13922
|
+
type: 'br',
|
|
13923
|
+
raw: cap[0],
|
|
13924
|
+
};
|
|
13925
|
+
}
|
|
13926
|
+
}
|
|
13927
|
+
del(src) {
|
|
13928
|
+
const cap = this.rules.inline.del.exec(src);
|
|
13929
|
+
if (cap) {
|
|
13930
|
+
return {
|
|
13931
|
+
type: 'del',
|
|
13932
|
+
raw: cap[0],
|
|
13933
|
+
text: cap[2],
|
|
13934
|
+
tokens: this.lexer.inlineTokens(cap[2]),
|
|
13935
|
+
};
|
|
13936
|
+
}
|
|
13937
|
+
}
|
|
13938
|
+
autolink(src) {
|
|
13939
|
+
const cap = this.rules.inline.autolink.exec(src);
|
|
13940
|
+
if (cap) {
|
|
13941
|
+
let text, href;
|
|
13942
|
+
if (cap[2] === '@') {
|
|
13943
|
+
text = escape$1(cap[1]);
|
|
13944
|
+
href = 'mailto:' + text;
|
|
13945
|
+
}
|
|
13946
|
+
else {
|
|
13947
|
+
text = escape$1(cap[1]);
|
|
13948
|
+
href = text;
|
|
13949
|
+
}
|
|
13950
|
+
return {
|
|
13951
|
+
type: 'link',
|
|
13952
|
+
raw: cap[0],
|
|
13953
|
+
text,
|
|
13954
|
+
href,
|
|
13955
|
+
tokens: [
|
|
13956
|
+
{
|
|
13957
|
+
type: 'text',
|
|
13958
|
+
raw: text,
|
|
13959
|
+
text,
|
|
13960
|
+
},
|
|
13961
|
+
],
|
|
13962
|
+
};
|
|
13963
|
+
}
|
|
13964
|
+
}
|
|
13965
|
+
url(src) {
|
|
13966
|
+
let cap;
|
|
13967
|
+
if (cap = this.rules.inline.url.exec(src)) {
|
|
13968
|
+
let text, href;
|
|
13969
|
+
if (cap[2] === '@') {
|
|
13970
|
+
text = escape$1(cap[0]);
|
|
13971
|
+
href = 'mailto:' + text;
|
|
13972
|
+
}
|
|
13973
|
+
else {
|
|
13974
|
+
// do extended autolink path validation
|
|
13975
|
+
let prevCapZero;
|
|
13976
|
+
do {
|
|
13977
|
+
prevCapZero = cap[0];
|
|
13978
|
+
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? '';
|
|
13979
|
+
} while (prevCapZero !== cap[0]);
|
|
13980
|
+
text = escape$1(cap[0]);
|
|
13981
|
+
if (cap[1] === 'www.') {
|
|
13982
|
+
href = 'http://' + cap[0];
|
|
13983
|
+
}
|
|
13984
|
+
else {
|
|
13985
|
+
href = cap[0];
|
|
13986
|
+
}
|
|
13987
|
+
}
|
|
13988
|
+
return {
|
|
13989
|
+
type: 'link',
|
|
13990
|
+
raw: cap[0],
|
|
13991
|
+
text,
|
|
13992
|
+
href,
|
|
13993
|
+
tokens: [
|
|
13994
|
+
{
|
|
13995
|
+
type: 'text',
|
|
13996
|
+
raw: text,
|
|
13997
|
+
text,
|
|
13998
|
+
},
|
|
13999
|
+
],
|
|
14000
|
+
};
|
|
14001
|
+
}
|
|
14002
|
+
}
|
|
14003
|
+
inlineText(src) {
|
|
14004
|
+
const cap = this.rules.inline.text.exec(src);
|
|
14005
|
+
if (cap) {
|
|
14006
|
+
let text;
|
|
14007
|
+
if (this.lexer.state.inRawBlock) {
|
|
14008
|
+
text = cap[0];
|
|
14009
|
+
}
|
|
14010
|
+
else {
|
|
14011
|
+
text = escape$1(cap[0]);
|
|
14012
|
+
}
|
|
14013
|
+
return {
|
|
14014
|
+
type: 'text',
|
|
14015
|
+
raw: cap[0],
|
|
14016
|
+
text,
|
|
14017
|
+
};
|
|
14018
|
+
}
|
|
14019
|
+
}
|
|
14020
|
+
}
|
|
14021
|
+
|
|
14022
|
+
/**
|
|
14023
|
+
* Block-Level Grammar
|
|
14024
|
+
*/
|
|
14025
|
+
const newline = /^(?:[ \t]*(?:\n|$))+/;
|
|
14026
|
+
const blockCode = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
14027
|
+
const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
14028
|
+
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
14029
|
+
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
14030
|
+
const bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
14031
|
+
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
|
|
14032
|
+
.replace(/bull/g, bullet) // lists can interrupt
|
|
14033
|
+
.replace(/blockCode/g, /(?: {4}| {0,3}\t)/) // indented code blocks can interrupt
|
|
14034
|
+
.replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
|
|
14035
|
+
.replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
|
|
14036
|
+
.replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
|
|
14037
|
+
.replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
|
|
14038
|
+
.getRegex();
|
|
14039
|
+
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
14040
|
+
const blockText = /^[^\n]+/;
|
|
14041
|
+
const _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
14042
|
+
const def = edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/)
|
|
14043
|
+
.replace('label', _blockLabel)
|
|
14044
|
+
.replace('title', /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/)
|
|
14045
|
+
.getRegex();
|
|
14046
|
+
const list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/)
|
|
14047
|
+
.replace(/bull/g, bullet)
|
|
14048
|
+
.getRegex();
|
|
14049
|
+
const _tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
|
14050
|
+
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
|
14051
|
+
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
|
14052
|
+
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
|
14053
|
+
+ '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'
|
|
14054
|
+
+ '|tr|track|ul';
|
|
14055
|
+
const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
14056
|
+
const html = edit('^ {0,3}(?:' // optional indentation
|
|
14057
|
+
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
14058
|
+
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
14059
|
+
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
14060
|
+
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
14061
|
+
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
14062
|
+
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6)
|
|
14063
|
+
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag
|
|
14064
|
+
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag
|
|
14065
|
+
+ ')', 'i')
|
|
14066
|
+
.replace('comment', _comment)
|
|
14067
|
+
.replace('tag', _tag)
|
|
14068
|
+
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
|
14069
|
+
.getRegex();
|
|
14070
|
+
const paragraph = edit(_paragraph)
|
|
14071
|
+
.replace('hr', hr)
|
|
14072
|
+
.replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
|
|
14073
|
+
.replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
14074
|
+
.replace('|table', '')
|
|
14075
|
+
.replace('blockquote', ' {0,3}>')
|
|
14076
|
+
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
14077
|
+
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
14078
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
|
14079
|
+
.replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
14080
|
+
.getRegex();
|
|
14081
|
+
const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/)
|
|
14082
|
+
.replace('paragraph', paragraph)
|
|
14083
|
+
.getRegex();
|
|
14084
|
+
/**
|
|
14085
|
+
* Normal Block Grammar
|
|
14086
|
+
*/
|
|
14087
|
+
const blockNormal = {
|
|
14088
|
+
blockquote,
|
|
14089
|
+
code: blockCode,
|
|
14090
|
+
def,
|
|
14091
|
+
fences,
|
|
14092
|
+
heading,
|
|
14093
|
+
hr,
|
|
14094
|
+
html,
|
|
14095
|
+
lheading,
|
|
14096
|
+
list,
|
|
14097
|
+
newline,
|
|
14098
|
+
paragraph,
|
|
14099
|
+
table: noopTest,
|
|
14100
|
+
text: blockText,
|
|
14101
|
+
};
|
|
14102
|
+
/**
|
|
14103
|
+
* GFM Block Grammar
|
|
14104
|
+
*/
|
|
14105
|
+
const gfmTable = edit('^ *([^\\n ].*)\\n' // Header
|
|
14106
|
+
+ ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
|
|
14107
|
+
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)') // Cells
|
|
14108
|
+
.replace('hr', hr)
|
|
14109
|
+
.replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
|
|
14110
|
+
.replace('blockquote', ' {0,3}>')
|
|
14111
|
+
.replace('code', '(?: {4}| {0,3}\t)[^\\n]')
|
|
14112
|
+
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
14113
|
+
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
14114
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
|
14115
|
+
.replace('tag', _tag) // tables can be interrupted by type (6) html blocks
|
|
14116
|
+
.getRegex();
|
|
14117
|
+
const blockGfm = {
|
|
14118
|
+
...blockNormal,
|
|
14119
|
+
table: gfmTable,
|
|
14120
|
+
paragraph: edit(_paragraph)
|
|
14121
|
+
.replace('hr', hr)
|
|
14122
|
+
.replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
|
|
14123
|
+
.replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
|
|
14124
|
+
.replace('table', gfmTable) // interrupt paragraphs with table
|
|
14125
|
+
.replace('blockquote', ' {0,3}>')
|
|
14126
|
+
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
14127
|
+
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
14128
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
|
14129
|
+
.replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
14130
|
+
.getRegex(),
|
|
14131
|
+
};
|
|
14132
|
+
/**
|
|
14133
|
+
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
14134
|
+
*/
|
|
14135
|
+
const blockPedantic = {
|
|
14136
|
+
...blockNormal,
|
|
14137
|
+
html: edit('^ *(?:comment *(?:\\n|\\s*$)'
|
|
14138
|
+
+ '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
|
14139
|
+
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
|
|
14140
|
+
.replace('comment', _comment)
|
|
14141
|
+
.replace(/tag/g, '(?!(?:'
|
|
14142
|
+
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
|
|
14143
|
+
+ '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
|
|
14144
|
+
+ '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
|
|
14145
|
+
.getRegex(),
|
|
14146
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
14147
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
14148
|
+
fences: noopTest, // fences not supported
|
|
14149
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
14150
|
+
paragraph: edit(_paragraph)
|
|
14151
|
+
.replace('hr', hr)
|
|
14152
|
+
.replace('heading', ' *#{1,6} *[^\n]')
|
|
14153
|
+
.replace('lheading', lheading)
|
|
14154
|
+
.replace('|table', '')
|
|
14155
|
+
.replace('blockquote', ' {0,3}>')
|
|
14156
|
+
.replace('|fences', '')
|
|
14157
|
+
.replace('|list', '')
|
|
14158
|
+
.replace('|html', '')
|
|
14159
|
+
.replace('|tag', '')
|
|
14160
|
+
.getRegex(),
|
|
14161
|
+
};
|
|
14162
|
+
/**
|
|
14163
|
+
* Inline-Level Grammar
|
|
14164
|
+
*/
|
|
14165
|
+
const marked_esm_escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
14166
|
+
const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
14167
|
+
const br = /^( {2,}|\\)\n(?!\s*$)/;
|
|
14168
|
+
const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
14169
|
+
// list of unicode punctuation marks, plus any missing characters from CommonMark spec
|
|
14170
|
+
const _punctuation = '\\p{P}\\p{S}';
|
|
14171
|
+
const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
|
|
14172
|
+
.replace(/punctuation/g, _punctuation).getRegex();
|
|
14173
|
+
// sequences em should skip over [title](link), `code`, <html>
|
|
14174
|
+
const blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
|
|
14175
|
+
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u')
|
|
14176
|
+
.replace(/punct/g, _punctuation)
|
|
14177
|
+
.getRegex();
|
|
14178
|
+
const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
14179
|
+
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
14180
|
+
+ '|(?!\\*)[punct](\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
14181
|
+
+ '|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
14182
|
+
+ '|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])' // (3) #***a, ***a can only be Left Delimiter
|
|
14183
|
+
+ '|[\\s](\\*+)(?!\\*)(?=[punct])' // (4) ***# can only be Left Delimiter
|
|
14184
|
+
+ '|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter
|
|
14185
|
+
+ '|[^punct\\s](\\*+)(?=[^punct\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter
|
|
14186
|
+
.replace(/punct/g, _punctuation)
|
|
14187
|
+
.getRegex();
|
|
14188
|
+
// (6) Not allowed for _
|
|
14189
|
+
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
14190
|
+
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
14191
|
+
+ '|(?!_)[punct](_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
|
|
14192
|
+
+ '|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter
|
|
14193
|
+
+ '|(?!_)[punct\\s](_+)(?=[^punct\\s])' // (3) #___a, ___a can only be Left Delimiter
|
|
14194
|
+
+ '|[\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter
|
|
14195
|
+
+ '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter
|
|
14196
|
+
.replace(/punct/g, _punctuation)
|
|
14197
|
+
.getRegex();
|
|
14198
|
+
const anyPunctuation = edit(/\\([punct])/, 'gu')
|
|
14199
|
+
.replace(/punct/g, _punctuation)
|
|
14200
|
+
.getRegex();
|
|
14201
|
+
const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/)
|
|
14202
|
+
.replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/)
|
|
14203
|
+
.replace('email', /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/)
|
|
14204
|
+
.getRegex();
|
|
14205
|
+
const _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();
|
|
14206
|
+
const tag = edit('^comment'
|
|
14207
|
+
+ '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
14208
|
+
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
14209
|
+
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
|
14210
|
+
+ '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
|
|
14211
|
+
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>') // CDATA section
|
|
14212
|
+
.replace('comment', _inlineComment)
|
|
14213
|
+
.replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/)
|
|
14214
|
+
.getRegex();
|
|
14215
|
+
const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
14216
|
+
const marked_esm_link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/)
|
|
14217
|
+
.replace('label', _inlineLabel)
|
|
14218
|
+
.replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/)
|
|
14219
|
+
.replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/)
|
|
14220
|
+
.getRegex();
|
|
14221
|
+
const reflink = edit(/^!?\[(label)\]\[(ref)\]/)
|
|
14222
|
+
.replace('label', _inlineLabel)
|
|
14223
|
+
.replace('ref', _blockLabel)
|
|
14224
|
+
.getRegex();
|
|
14225
|
+
const nolink = edit(/^!?\[(ref)\](?:\[\])?/)
|
|
14226
|
+
.replace('ref', _blockLabel)
|
|
14227
|
+
.getRegex();
|
|
14228
|
+
const reflinkSearch = edit('reflink|nolink(?!\\()', 'g')
|
|
14229
|
+
.replace('reflink', reflink)
|
|
14230
|
+
.replace('nolink', nolink)
|
|
14231
|
+
.getRegex();
|
|
14232
|
+
/**
|
|
14233
|
+
* Normal Inline Grammar
|
|
14234
|
+
*/
|
|
14235
|
+
const inlineNormal = {
|
|
14236
|
+
_backpedal: noopTest, // only used for GFM url
|
|
14237
|
+
anyPunctuation,
|
|
14238
|
+
autolink,
|
|
14239
|
+
blockSkip,
|
|
14240
|
+
br,
|
|
14241
|
+
code: inlineCode,
|
|
14242
|
+
del: noopTest,
|
|
14243
|
+
emStrongLDelim,
|
|
14244
|
+
emStrongRDelimAst,
|
|
14245
|
+
emStrongRDelimUnd,
|
|
14246
|
+
escape: marked_esm_escape,
|
|
14247
|
+
link: marked_esm_link,
|
|
14248
|
+
nolink,
|
|
14249
|
+
punctuation,
|
|
14250
|
+
reflink,
|
|
14251
|
+
reflinkSearch,
|
|
14252
|
+
tag,
|
|
14253
|
+
text: inlineText,
|
|
14254
|
+
url: noopTest,
|
|
14255
|
+
};
|
|
14256
|
+
/**
|
|
14257
|
+
* Pedantic Inline Grammar
|
|
14258
|
+
*/
|
|
14259
|
+
const inlinePedantic = {
|
|
14260
|
+
...inlineNormal,
|
|
14261
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/)
|
|
14262
|
+
.replace('label', _inlineLabel)
|
|
14263
|
+
.getRegex(),
|
|
14264
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
|
14265
|
+
.replace('label', _inlineLabel)
|
|
14266
|
+
.getRegex(),
|
|
14267
|
+
};
|
|
14268
|
+
/**
|
|
14269
|
+
* GFM Inline Grammar
|
|
14270
|
+
*/
|
|
14271
|
+
const inlineGfm = {
|
|
14272
|
+
...inlineNormal,
|
|
14273
|
+
escape: edit(marked_esm_escape).replace('])', '~|])').getRegex(),
|
|
14274
|
+
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
|
|
14275
|
+
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
|
|
14276
|
+
.getRegex(),
|
|
14277
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
14278
|
+
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
14279
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/,
|
|
14280
|
+
};
|
|
14281
|
+
/**
|
|
14282
|
+
* GFM + Line Breaks Inline Grammar
|
|
14283
|
+
*/
|
|
14284
|
+
const inlineBreaks = {
|
|
14285
|
+
...inlineGfm,
|
|
14286
|
+
br: edit(br).replace('{2,}', '*').getRegex(),
|
|
14287
|
+
text: edit(inlineGfm.text)
|
|
14288
|
+
.replace('\\b_', '\\b_| {2,}\\n')
|
|
14289
|
+
.replace(/\{2,\}/g, '*')
|
|
14290
|
+
.getRegex(),
|
|
14291
|
+
};
|
|
14292
|
+
/**
|
|
14293
|
+
* exports
|
|
14294
|
+
*/
|
|
14295
|
+
const block = {
|
|
14296
|
+
normal: blockNormal,
|
|
14297
|
+
gfm: blockGfm,
|
|
14298
|
+
pedantic: blockPedantic,
|
|
14299
|
+
};
|
|
14300
|
+
const inline = {
|
|
14301
|
+
normal: inlineNormal,
|
|
14302
|
+
gfm: inlineGfm,
|
|
14303
|
+
breaks: inlineBreaks,
|
|
14304
|
+
pedantic: inlinePedantic,
|
|
14305
|
+
};
|
|
14306
|
+
|
|
14307
|
+
/**
|
|
14308
|
+
* Block Lexer
|
|
14309
|
+
*/
|
|
14310
|
+
class _Lexer {
|
|
14311
|
+
tokens;
|
|
14312
|
+
options;
|
|
14313
|
+
state;
|
|
14314
|
+
tokenizer;
|
|
14315
|
+
inlineQueue;
|
|
14316
|
+
constructor(options) {
|
|
14317
|
+
// TokenList cannot be created in one go
|
|
14318
|
+
this.tokens = [];
|
|
14319
|
+
this.tokens.links = Object.create(null);
|
|
14320
|
+
this.options = options || _defaults;
|
|
14321
|
+
this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
|
|
14322
|
+
this.tokenizer = this.options.tokenizer;
|
|
14323
|
+
this.tokenizer.options = this.options;
|
|
14324
|
+
this.tokenizer.lexer = this;
|
|
14325
|
+
this.inlineQueue = [];
|
|
14326
|
+
this.state = {
|
|
14327
|
+
inLink: false,
|
|
14328
|
+
inRawBlock: false,
|
|
14329
|
+
top: true,
|
|
14330
|
+
};
|
|
14331
|
+
const rules = {
|
|
14332
|
+
block: block.normal,
|
|
14333
|
+
inline: inline.normal,
|
|
14334
|
+
};
|
|
14335
|
+
if (this.options.pedantic) {
|
|
14336
|
+
rules.block = block.pedantic;
|
|
14337
|
+
rules.inline = inline.pedantic;
|
|
14338
|
+
}
|
|
14339
|
+
else if (this.options.gfm) {
|
|
14340
|
+
rules.block = block.gfm;
|
|
14341
|
+
if (this.options.breaks) {
|
|
14342
|
+
rules.inline = inline.breaks;
|
|
14343
|
+
}
|
|
14344
|
+
else {
|
|
14345
|
+
rules.inline = inline.gfm;
|
|
14346
|
+
}
|
|
14347
|
+
}
|
|
14348
|
+
this.tokenizer.rules = rules;
|
|
14349
|
+
}
|
|
14350
|
+
/**
|
|
14351
|
+
* Expose Rules
|
|
14352
|
+
*/
|
|
14353
|
+
static get rules() {
|
|
14354
|
+
return {
|
|
14355
|
+
block,
|
|
14356
|
+
inline,
|
|
14357
|
+
};
|
|
14358
|
+
}
|
|
14359
|
+
/**
|
|
14360
|
+
* Static Lex Method
|
|
14361
|
+
*/
|
|
14362
|
+
static lex(src, options) {
|
|
14363
|
+
const lexer = new _Lexer(options);
|
|
14364
|
+
return lexer.lex(src);
|
|
14365
|
+
}
|
|
14366
|
+
/**
|
|
14367
|
+
* Static Lex Inline Method
|
|
14368
|
+
*/
|
|
14369
|
+
static lexInline(src, options) {
|
|
14370
|
+
const lexer = new _Lexer(options);
|
|
14371
|
+
return lexer.inlineTokens(src);
|
|
14372
|
+
}
|
|
14373
|
+
/**
|
|
14374
|
+
* Preprocessing
|
|
14375
|
+
*/
|
|
14376
|
+
lex(src) {
|
|
14377
|
+
src = src
|
|
14378
|
+
.replace(/\r\n|\r/g, '\n');
|
|
14379
|
+
this.blockTokens(src, this.tokens);
|
|
14380
|
+
for (let i = 0; i < this.inlineQueue.length; i++) {
|
|
14381
|
+
const next = this.inlineQueue[i];
|
|
14382
|
+
this.inlineTokens(next.src, next.tokens);
|
|
14383
|
+
}
|
|
14384
|
+
this.inlineQueue = [];
|
|
14385
|
+
return this.tokens;
|
|
14386
|
+
}
|
|
14387
|
+
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
|
14388
|
+
if (this.options.pedantic) {
|
|
14389
|
+
src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
|
|
14390
|
+
}
|
|
14391
|
+
let token;
|
|
14392
|
+
let lastToken;
|
|
14393
|
+
let cutSrc;
|
|
14394
|
+
while (src) {
|
|
14395
|
+
if (this.options.extensions
|
|
14396
|
+
&& this.options.extensions.block
|
|
14397
|
+
&& this.options.extensions.block.some((extTokenizer) => {
|
|
14398
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
14399
|
+
src = src.substring(token.raw.length);
|
|
14400
|
+
tokens.push(token);
|
|
14401
|
+
return true;
|
|
14402
|
+
}
|
|
14403
|
+
return false;
|
|
14404
|
+
})) {
|
|
14405
|
+
continue;
|
|
14406
|
+
}
|
|
14407
|
+
// newline
|
|
14408
|
+
if (token = this.tokenizer.space(src)) {
|
|
14409
|
+
src = src.substring(token.raw.length);
|
|
14410
|
+
if (token.raw.length === 1 && tokens.length > 0) {
|
|
14411
|
+
// if there's a single \n as a spacer, it's terminating the last line,
|
|
14412
|
+
// so move it there so that we don't get unnecessary paragraph tags
|
|
14413
|
+
tokens[tokens.length - 1].raw += '\n';
|
|
14414
|
+
}
|
|
14415
|
+
else {
|
|
14416
|
+
tokens.push(token);
|
|
14417
|
+
}
|
|
14418
|
+
continue;
|
|
14419
|
+
}
|
|
14420
|
+
// code
|
|
14421
|
+
if (token = this.tokenizer.code(src)) {
|
|
14422
|
+
src = src.substring(token.raw.length);
|
|
14423
|
+
lastToken = tokens[tokens.length - 1];
|
|
14424
|
+
// An indented code block cannot interrupt a paragraph.
|
|
14425
|
+
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
14426
|
+
lastToken.raw += '\n' + token.raw;
|
|
14427
|
+
lastToken.text += '\n' + token.text;
|
|
14428
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
14429
|
+
}
|
|
14430
|
+
else {
|
|
14431
|
+
tokens.push(token);
|
|
14432
|
+
}
|
|
14433
|
+
continue;
|
|
14434
|
+
}
|
|
14435
|
+
// fences
|
|
14436
|
+
if (token = this.tokenizer.fences(src)) {
|
|
14437
|
+
src = src.substring(token.raw.length);
|
|
14438
|
+
tokens.push(token);
|
|
14439
|
+
continue;
|
|
14440
|
+
}
|
|
14441
|
+
// heading
|
|
14442
|
+
if (token = this.tokenizer.heading(src)) {
|
|
14443
|
+
src = src.substring(token.raw.length);
|
|
14444
|
+
tokens.push(token);
|
|
14445
|
+
continue;
|
|
14446
|
+
}
|
|
14447
|
+
// hr
|
|
14448
|
+
if (token = this.tokenizer.hr(src)) {
|
|
14449
|
+
src = src.substring(token.raw.length);
|
|
14450
|
+
tokens.push(token);
|
|
14451
|
+
continue;
|
|
14452
|
+
}
|
|
14453
|
+
// blockquote
|
|
14454
|
+
if (token = this.tokenizer.blockquote(src)) {
|
|
14455
|
+
src = src.substring(token.raw.length);
|
|
14456
|
+
tokens.push(token);
|
|
14457
|
+
continue;
|
|
14458
|
+
}
|
|
14459
|
+
// list
|
|
14460
|
+
if (token = this.tokenizer.list(src)) {
|
|
14461
|
+
src = src.substring(token.raw.length);
|
|
14462
|
+
tokens.push(token);
|
|
14463
|
+
continue;
|
|
14464
|
+
}
|
|
14465
|
+
// html
|
|
14466
|
+
if (token = this.tokenizer.html(src)) {
|
|
14467
|
+
src = src.substring(token.raw.length);
|
|
14468
|
+
tokens.push(token);
|
|
14469
|
+
continue;
|
|
14470
|
+
}
|
|
14471
|
+
// def
|
|
14472
|
+
if (token = this.tokenizer.def(src)) {
|
|
14473
|
+
src = src.substring(token.raw.length);
|
|
14474
|
+
lastToken = tokens[tokens.length - 1];
|
|
14475
|
+
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
14476
|
+
lastToken.raw += '\n' + token.raw;
|
|
14477
|
+
lastToken.text += '\n' + token.raw;
|
|
14478
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
14479
|
+
}
|
|
14480
|
+
else if (!this.tokens.links[token.tag]) {
|
|
14481
|
+
this.tokens.links[token.tag] = {
|
|
14482
|
+
href: token.href,
|
|
14483
|
+
title: token.title,
|
|
14484
|
+
};
|
|
14485
|
+
}
|
|
14486
|
+
continue;
|
|
14487
|
+
}
|
|
14488
|
+
// table (gfm)
|
|
14489
|
+
if (token = this.tokenizer.table(src)) {
|
|
14490
|
+
src = src.substring(token.raw.length);
|
|
14491
|
+
tokens.push(token);
|
|
14492
|
+
continue;
|
|
14493
|
+
}
|
|
14494
|
+
// lheading
|
|
14495
|
+
if (token = this.tokenizer.lheading(src)) {
|
|
14496
|
+
src = src.substring(token.raw.length);
|
|
14497
|
+
tokens.push(token);
|
|
14498
|
+
continue;
|
|
14499
|
+
}
|
|
14500
|
+
// top-level paragraph
|
|
14501
|
+
// prevent paragraph consuming extensions by clipping 'src' to extension start
|
|
14502
|
+
cutSrc = src;
|
|
14503
|
+
if (this.options.extensions && this.options.extensions.startBlock) {
|
|
14504
|
+
let startIndex = Infinity;
|
|
14505
|
+
const tempSrc = src.slice(1);
|
|
14506
|
+
let tempStart;
|
|
14507
|
+
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
|
14508
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
14509
|
+
if (typeof tempStart === 'number' && tempStart >= 0) {
|
|
14510
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
14511
|
+
}
|
|
14512
|
+
});
|
|
14513
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
14514
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
14515
|
+
}
|
|
14516
|
+
}
|
|
14517
|
+
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
14518
|
+
lastToken = tokens[tokens.length - 1];
|
|
14519
|
+
if (lastParagraphClipped && lastToken?.type === 'paragraph') {
|
|
14520
|
+
lastToken.raw += '\n' + token.raw;
|
|
14521
|
+
lastToken.text += '\n' + token.text;
|
|
14522
|
+
this.inlineQueue.pop();
|
|
14523
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
14524
|
+
}
|
|
14525
|
+
else {
|
|
14526
|
+
tokens.push(token);
|
|
14527
|
+
}
|
|
14528
|
+
lastParagraphClipped = (cutSrc.length !== src.length);
|
|
14529
|
+
src = src.substring(token.raw.length);
|
|
14530
|
+
continue;
|
|
14531
|
+
}
|
|
14532
|
+
// text
|
|
14533
|
+
if (token = this.tokenizer.text(src)) {
|
|
14534
|
+
src = src.substring(token.raw.length);
|
|
14535
|
+
lastToken = tokens[tokens.length - 1];
|
|
14536
|
+
if (lastToken && lastToken.type === 'text') {
|
|
14537
|
+
lastToken.raw += '\n' + token.raw;
|
|
14538
|
+
lastToken.text += '\n' + token.text;
|
|
14539
|
+
this.inlineQueue.pop();
|
|
14540
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
14541
|
+
}
|
|
14542
|
+
else {
|
|
14543
|
+
tokens.push(token);
|
|
14544
|
+
}
|
|
14545
|
+
continue;
|
|
14546
|
+
}
|
|
14547
|
+
if (src) {
|
|
14548
|
+
const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
|
14549
|
+
if (this.options.silent) {
|
|
14550
|
+
console.error(errMsg);
|
|
14551
|
+
break;
|
|
14552
|
+
}
|
|
14553
|
+
else {
|
|
14554
|
+
throw new Error(errMsg);
|
|
14555
|
+
}
|
|
14556
|
+
}
|
|
14557
|
+
}
|
|
14558
|
+
this.state.top = true;
|
|
14559
|
+
return tokens;
|
|
14560
|
+
}
|
|
14561
|
+
inline(src, tokens = []) {
|
|
14562
|
+
this.inlineQueue.push({ src, tokens });
|
|
14563
|
+
return tokens;
|
|
14564
|
+
}
|
|
14565
|
+
/**
|
|
14566
|
+
* Lexing/Compiling
|
|
14567
|
+
*/
|
|
14568
|
+
inlineTokens(src, tokens = []) {
|
|
14569
|
+
let token, lastToken, cutSrc;
|
|
14570
|
+
// String with links masked to avoid interference with em and strong
|
|
14571
|
+
let maskedSrc = src;
|
|
14572
|
+
let match;
|
|
14573
|
+
let keepPrevChar, prevChar;
|
|
14574
|
+
// Mask out reflinks
|
|
14575
|
+
if (this.tokens.links) {
|
|
14576
|
+
const links = Object.keys(this.tokens.links);
|
|
14577
|
+
if (links.length > 0) {
|
|
14578
|
+
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
14579
|
+
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
|
14580
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
14581
|
+
}
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
}
|
|
14585
|
+
// Mask out other blocks
|
|
14586
|
+
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
14587
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
14588
|
+
}
|
|
14589
|
+
// Mask out escaped characters
|
|
14590
|
+
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
|
14591
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
14592
|
+
}
|
|
14593
|
+
while (src) {
|
|
14594
|
+
if (!keepPrevChar) {
|
|
14595
|
+
prevChar = '';
|
|
14596
|
+
}
|
|
14597
|
+
keepPrevChar = false;
|
|
14598
|
+
// extensions
|
|
14599
|
+
if (this.options.extensions
|
|
14600
|
+
&& this.options.extensions.inline
|
|
14601
|
+
&& this.options.extensions.inline.some((extTokenizer) => {
|
|
14602
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
14603
|
+
src = src.substring(token.raw.length);
|
|
14604
|
+
tokens.push(token);
|
|
14605
|
+
return true;
|
|
14606
|
+
}
|
|
14607
|
+
return false;
|
|
14608
|
+
})) {
|
|
14609
|
+
continue;
|
|
14610
|
+
}
|
|
14611
|
+
// escape
|
|
14612
|
+
if (token = this.tokenizer.escape(src)) {
|
|
14613
|
+
src = src.substring(token.raw.length);
|
|
14614
|
+
tokens.push(token);
|
|
14615
|
+
continue;
|
|
14616
|
+
}
|
|
14617
|
+
// tag
|
|
14618
|
+
if (token = this.tokenizer.tag(src)) {
|
|
14619
|
+
src = src.substring(token.raw.length);
|
|
14620
|
+
lastToken = tokens[tokens.length - 1];
|
|
14621
|
+
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
14622
|
+
lastToken.raw += token.raw;
|
|
14623
|
+
lastToken.text += token.text;
|
|
14624
|
+
}
|
|
14625
|
+
else {
|
|
14626
|
+
tokens.push(token);
|
|
14627
|
+
}
|
|
14628
|
+
continue;
|
|
14629
|
+
}
|
|
14630
|
+
// link
|
|
14631
|
+
if (token = this.tokenizer.link(src)) {
|
|
14632
|
+
src = src.substring(token.raw.length);
|
|
14633
|
+
tokens.push(token);
|
|
14634
|
+
continue;
|
|
14635
|
+
}
|
|
14636
|
+
// reflink, nolink
|
|
14637
|
+
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
14638
|
+
src = src.substring(token.raw.length);
|
|
14639
|
+
lastToken = tokens[tokens.length - 1];
|
|
14640
|
+
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
14641
|
+
lastToken.raw += token.raw;
|
|
14642
|
+
lastToken.text += token.text;
|
|
14643
|
+
}
|
|
14644
|
+
else {
|
|
14645
|
+
tokens.push(token);
|
|
14646
|
+
}
|
|
14647
|
+
continue;
|
|
14648
|
+
}
|
|
14649
|
+
// em & strong
|
|
14650
|
+
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
14651
|
+
src = src.substring(token.raw.length);
|
|
14652
|
+
tokens.push(token);
|
|
14653
|
+
continue;
|
|
14654
|
+
}
|
|
14655
|
+
// code
|
|
14656
|
+
if (token = this.tokenizer.codespan(src)) {
|
|
14657
|
+
src = src.substring(token.raw.length);
|
|
14658
|
+
tokens.push(token);
|
|
14659
|
+
continue;
|
|
14660
|
+
}
|
|
14661
|
+
// br
|
|
14662
|
+
if (token = this.tokenizer.br(src)) {
|
|
14663
|
+
src = src.substring(token.raw.length);
|
|
14664
|
+
tokens.push(token);
|
|
14665
|
+
continue;
|
|
14666
|
+
}
|
|
14667
|
+
// del (gfm)
|
|
14668
|
+
if (token = this.tokenizer.del(src)) {
|
|
14669
|
+
src = src.substring(token.raw.length);
|
|
14670
|
+
tokens.push(token);
|
|
14671
|
+
continue;
|
|
14672
|
+
}
|
|
14673
|
+
// autolink
|
|
14674
|
+
if (token = this.tokenizer.autolink(src)) {
|
|
14675
|
+
src = src.substring(token.raw.length);
|
|
14676
|
+
tokens.push(token);
|
|
14677
|
+
continue;
|
|
14678
|
+
}
|
|
14679
|
+
// url (gfm)
|
|
14680
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
|
14681
|
+
src = src.substring(token.raw.length);
|
|
14682
|
+
tokens.push(token);
|
|
14683
|
+
continue;
|
|
14684
|
+
}
|
|
14685
|
+
// text
|
|
14686
|
+
// prevent inlineText consuming extensions by clipping 'src' to extension start
|
|
14687
|
+
cutSrc = src;
|
|
14688
|
+
if (this.options.extensions && this.options.extensions.startInline) {
|
|
14689
|
+
let startIndex = Infinity;
|
|
14690
|
+
const tempSrc = src.slice(1);
|
|
14691
|
+
let tempStart;
|
|
14692
|
+
this.options.extensions.startInline.forEach((getStartIndex) => {
|
|
14693
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
14694
|
+
if (typeof tempStart === 'number' && tempStart >= 0) {
|
|
14695
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
14696
|
+
}
|
|
14697
|
+
});
|
|
14698
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
14699
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
14700
|
+
}
|
|
14701
|
+
}
|
|
14702
|
+
if (token = this.tokenizer.inlineText(cutSrc)) {
|
|
14703
|
+
src = src.substring(token.raw.length);
|
|
14704
|
+
if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started
|
|
14705
|
+
prevChar = token.raw.slice(-1);
|
|
14706
|
+
}
|
|
14707
|
+
keepPrevChar = true;
|
|
14708
|
+
lastToken = tokens[tokens.length - 1];
|
|
14709
|
+
if (lastToken && lastToken.type === 'text') {
|
|
14710
|
+
lastToken.raw += token.raw;
|
|
14711
|
+
lastToken.text += token.text;
|
|
14712
|
+
}
|
|
14713
|
+
else {
|
|
14714
|
+
tokens.push(token);
|
|
14715
|
+
}
|
|
14716
|
+
continue;
|
|
14717
|
+
}
|
|
14718
|
+
if (src) {
|
|
14719
|
+
const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
|
14720
|
+
if (this.options.silent) {
|
|
14721
|
+
console.error(errMsg);
|
|
14722
|
+
break;
|
|
14723
|
+
}
|
|
14724
|
+
else {
|
|
14725
|
+
throw new Error(errMsg);
|
|
14726
|
+
}
|
|
14727
|
+
}
|
|
14728
|
+
}
|
|
14729
|
+
return tokens;
|
|
14730
|
+
}
|
|
14731
|
+
}
|
|
14732
|
+
|
|
14733
|
+
/**
|
|
14734
|
+
* Renderer
|
|
14735
|
+
*/
|
|
14736
|
+
class _Renderer {
|
|
14737
|
+
options;
|
|
14738
|
+
parser; // set by the parser
|
|
14739
|
+
constructor(options) {
|
|
14740
|
+
this.options = options || _defaults;
|
|
14741
|
+
}
|
|
14742
|
+
space(token) {
|
|
14743
|
+
return '';
|
|
14744
|
+
}
|
|
14745
|
+
code({ text, lang, escaped }) {
|
|
14746
|
+
const langString = (lang || '').match(/^\S*/)?.[0];
|
|
14747
|
+
const code = text.replace(/\n$/, '') + '\n';
|
|
14748
|
+
if (!langString) {
|
|
14749
|
+
return '<pre><code>'
|
|
14750
|
+
+ (escaped ? code : escape$1(code, true))
|
|
14751
|
+
+ '</code></pre>\n';
|
|
14752
|
+
}
|
|
14753
|
+
return '<pre><code class="language-'
|
|
14754
|
+
+ escape$1(langString)
|
|
14755
|
+
+ '">'
|
|
14756
|
+
+ (escaped ? code : escape$1(code, true))
|
|
14757
|
+
+ '</code></pre>\n';
|
|
14758
|
+
}
|
|
14759
|
+
blockquote({ tokens }) {
|
|
14760
|
+
const body = this.parser.parse(tokens);
|
|
14761
|
+
return `<blockquote>\n${body}</blockquote>\n`;
|
|
14762
|
+
}
|
|
14763
|
+
html({ text }) {
|
|
14764
|
+
return text;
|
|
14765
|
+
}
|
|
14766
|
+
heading({ tokens, depth }) {
|
|
14767
|
+
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>\n`;
|
|
14768
|
+
}
|
|
14769
|
+
hr(token) {
|
|
14770
|
+
return '<hr>\n';
|
|
14771
|
+
}
|
|
14772
|
+
list(token) {
|
|
14773
|
+
const ordered = token.ordered;
|
|
14774
|
+
const start = token.start;
|
|
14775
|
+
let body = '';
|
|
14776
|
+
for (let j = 0; j < token.items.length; j++) {
|
|
14777
|
+
const item = token.items[j];
|
|
14778
|
+
body += this.listitem(item);
|
|
14779
|
+
}
|
|
14780
|
+
const type = ordered ? 'ol' : 'ul';
|
|
14781
|
+
const startAttr = (ordered && start !== 1) ? (' start="' + start + '"') : '';
|
|
14782
|
+
return '<' + type + startAttr + '>\n' + body + '</' + type + '>\n';
|
|
14783
|
+
}
|
|
14784
|
+
listitem(item) {
|
|
14785
|
+
let itemBody = '';
|
|
14786
|
+
if (item.task) {
|
|
14787
|
+
const checkbox = this.checkbox({ checked: !!item.checked });
|
|
14788
|
+
if (item.loose) {
|
|
14789
|
+
if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
|
|
14790
|
+
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
|
14791
|
+
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
|
14792
|
+
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
|
14793
|
+
}
|
|
14794
|
+
}
|
|
14795
|
+
else {
|
|
14796
|
+
item.tokens.unshift({
|
|
14797
|
+
type: 'text',
|
|
14798
|
+
raw: checkbox + ' ',
|
|
14799
|
+
text: checkbox + ' ',
|
|
14800
|
+
});
|
|
14801
|
+
}
|
|
14802
|
+
}
|
|
14803
|
+
else {
|
|
14804
|
+
itemBody += checkbox + ' ';
|
|
14805
|
+
}
|
|
14806
|
+
}
|
|
14807
|
+
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
|
14808
|
+
return `<li>${itemBody}</li>\n`;
|
|
14809
|
+
}
|
|
14810
|
+
checkbox({ checked }) {
|
|
14811
|
+
return '<input '
|
|
14812
|
+
+ (checked ? 'checked="" ' : '')
|
|
14813
|
+
+ 'disabled="" type="checkbox">';
|
|
14814
|
+
}
|
|
14815
|
+
paragraph({ tokens }) {
|
|
14816
|
+
return `<p>${this.parser.parseInline(tokens)}</p>\n`;
|
|
14817
|
+
}
|
|
14818
|
+
table(token) {
|
|
14819
|
+
let header = '';
|
|
14820
|
+
// header
|
|
14821
|
+
let cell = '';
|
|
14822
|
+
for (let j = 0; j < token.header.length; j++) {
|
|
14823
|
+
cell += this.tablecell(token.header[j]);
|
|
14824
|
+
}
|
|
14825
|
+
header += this.tablerow({ text: cell });
|
|
14826
|
+
let body = '';
|
|
14827
|
+
for (let j = 0; j < token.rows.length; j++) {
|
|
14828
|
+
const row = token.rows[j];
|
|
14829
|
+
cell = '';
|
|
14830
|
+
for (let k = 0; k < row.length; k++) {
|
|
14831
|
+
cell += this.tablecell(row[k]);
|
|
14832
|
+
}
|
|
14833
|
+
body += this.tablerow({ text: cell });
|
|
14834
|
+
}
|
|
14835
|
+
if (body)
|
|
14836
|
+
body = `<tbody>${body}</tbody>`;
|
|
14837
|
+
return '<table>\n'
|
|
14838
|
+
+ '<thead>\n'
|
|
14839
|
+
+ header
|
|
14840
|
+
+ '</thead>\n'
|
|
14841
|
+
+ body
|
|
14842
|
+
+ '</table>\n';
|
|
14843
|
+
}
|
|
14844
|
+
tablerow({ text }) {
|
|
14845
|
+
return `<tr>\n${text}</tr>\n`;
|
|
14846
|
+
}
|
|
14847
|
+
tablecell(token) {
|
|
14848
|
+
const content = this.parser.parseInline(token.tokens);
|
|
14849
|
+
const type = token.header ? 'th' : 'td';
|
|
14850
|
+
const tag = token.align
|
|
14851
|
+
? `<${type} align="${token.align}">`
|
|
14852
|
+
: `<${type}>`;
|
|
14853
|
+
return tag + content + `</${type}>\n`;
|
|
14854
|
+
}
|
|
14855
|
+
/**
|
|
14856
|
+
* span level renderer
|
|
14857
|
+
*/
|
|
14858
|
+
strong({ tokens }) {
|
|
14859
|
+
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
|
14860
|
+
}
|
|
14861
|
+
em({ tokens }) {
|
|
14862
|
+
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
|
14863
|
+
}
|
|
14864
|
+
codespan({ text }) {
|
|
14865
|
+
return `<code>${text}</code>`;
|
|
14866
|
+
}
|
|
14867
|
+
br(token) {
|
|
14868
|
+
return '<br>';
|
|
14869
|
+
}
|
|
14870
|
+
del({ tokens }) {
|
|
14871
|
+
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
|
14872
|
+
}
|
|
14873
|
+
link({ href, title, tokens }) {
|
|
14874
|
+
const text = this.parser.parseInline(tokens);
|
|
14875
|
+
const cleanHref = cleanUrl(href);
|
|
14876
|
+
if (cleanHref === null) {
|
|
14877
|
+
return text;
|
|
14878
|
+
}
|
|
14879
|
+
href = cleanHref;
|
|
14880
|
+
let out = '<a href="' + href + '"';
|
|
14881
|
+
if (title) {
|
|
14882
|
+
out += ' title="' + title + '"';
|
|
14883
|
+
}
|
|
14884
|
+
out += '>' + text + '</a>';
|
|
14885
|
+
return out;
|
|
14886
|
+
}
|
|
14887
|
+
image({ href, title, text }) {
|
|
14888
|
+
const cleanHref = cleanUrl(href);
|
|
14889
|
+
if (cleanHref === null) {
|
|
14890
|
+
return text;
|
|
14891
|
+
}
|
|
14892
|
+
href = cleanHref;
|
|
14893
|
+
let out = `<img src="${href}" alt="${text}"`;
|
|
14894
|
+
if (title) {
|
|
14895
|
+
out += ` title="${title}"`;
|
|
14896
|
+
}
|
|
14897
|
+
out += '>';
|
|
14898
|
+
return out;
|
|
14899
|
+
}
|
|
14900
|
+
text(token) {
|
|
14901
|
+
return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
|
|
14902
|
+
}
|
|
14903
|
+
}
|
|
14904
|
+
|
|
14905
|
+
/**
|
|
14906
|
+
* TextRenderer
|
|
14907
|
+
* returns only the textual part of the token
|
|
14908
|
+
*/
|
|
14909
|
+
class _TextRenderer {
|
|
14910
|
+
// no need for block level renderers
|
|
14911
|
+
strong({ text }) {
|
|
14912
|
+
return text;
|
|
14913
|
+
}
|
|
14914
|
+
em({ text }) {
|
|
14915
|
+
return text;
|
|
14916
|
+
}
|
|
14917
|
+
codespan({ text }) {
|
|
14918
|
+
return text;
|
|
14919
|
+
}
|
|
14920
|
+
del({ text }) {
|
|
14921
|
+
return text;
|
|
14922
|
+
}
|
|
14923
|
+
html({ text }) {
|
|
14924
|
+
return text;
|
|
14925
|
+
}
|
|
14926
|
+
text({ text }) {
|
|
14927
|
+
return text;
|
|
14928
|
+
}
|
|
14929
|
+
link({ text }) {
|
|
14930
|
+
return '' + text;
|
|
14931
|
+
}
|
|
14932
|
+
image({ text }) {
|
|
14933
|
+
return '' + text;
|
|
14934
|
+
}
|
|
14935
|
+
br() {
|
|
14936
|
+
return '';
|
|
14937
|
+
}
|
|
14938
|
+
}
|
|
14939
|
+
|
|
14940
|
+
/**
|
|
14941
|
+
* Parsing & Compiling
|
|
14942
|
+
*/
|
|
14943
|
+
class _Parser {
|
|
14944
|
+
options;
|
|
14945
|
+
renderer;
|
|
14946
|
+
textRenderer;
|
|
14947
|
+
constructor(options) {
|
|
14948
|
+
this.options = options || _defaults;
|
|
14949
|
+
this.options.renderer = this.options.renderer || new _Renderer();
|
|
14950
|
+
this.renderer = this.options.renderer;
|
|
14951
|
+
this.renderer.options = this.options;
|
|
14952
|
+
this.renderer.parser = this;
|
|
14953
|
+
this.textRenderer = new _TextRenderer();
|
|
14954
|
+
}
|
|
14955
|
+
/**
|
|
14956
|
+
* Static Parse Method
|
|
14957
|
+
*/
|
|
14958
|
+
static parse(tokens, options) {
|
|
14959
|
+
const parser = new _Parser(options);
|
|
14960
|
+
return parser.parse(tokens);
|
|
14961
|
+
}
|
|
14962
|
+
/**
|
|
14963
|
+
* Static Parse Inline Method
|
|
14964
|
+
*/
|
|
14965
|
+
static parseInline(tokens, options) {
|
|
14966
|
+
const parser = new _Parser(options);
|
|
14967
|
+
return parser.parseInline(tokens);
|
|
14968
|
+
}
|
|
14969
|
+
/**
|
|
14970
|
+
* Parse Loop
|
|
14971
|
+
*/
|
|
14972
|
+
parse(tokens, top = true) {
|
|
14973
|
+
let out = '';
|
|
14974
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
14975
|
+
const anyToken = tokens[i];
|
|
14976
|
+
// Run any renderer extensions
|
|
14977
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
|
|
14978
|
+
const genericToken = anyToken;
|
|
14979
|
+
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
|
14980
|
+
if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {
|
|
14981
|
+
out += ret || '';
|
|
14982
|
+
continue;
|
|
14983
|
+
}
|
|
14984
|
+
}
|
|
14985
|
+
const token = anyToken;
|
|
14986
|
+
switch (token.type) {
|
|
14987
|
+
case 'space': {
|
|
14988
|
+
out += this.renderer.space(token);
|
|
14989
|
+
continue;
|
|
14990
|
+
}
|
|
14991
|
+
case 'hr': {
|
|
14992
|
+
out += this.renderer.hr(token);
|
|
14993
|
+
continue;
|
|
14994
|
+
}
|
|
14995
|
+
case 'heading': {
|
|
14996
|
+
out += this.renderer.heading(token);
|
|
14997
|
+
continue;
|
|
14998
|
+
}
|
|
14999
|
+
case 'code': {
|
|
15000
|
+
out += this.renderer.code(token);
|
|
15001
|
+
continue;
|
|
15002
|
+
}
|
|
15003
|
+
case 'table': {
|
|
15004
|
+
out += this.renderer.table(token);
|
|
15005
|
+
continue;
|
|
15006
|
+
}
|
|
15007
|
+
case 'blockquote': {
|
|
15008
|
+
out += this.renderer.blockquote(token);
|
|
15009
|
+
continue;
|
|
15010
|
+
}
|
|
15011
|
+
case 'list': {
|
|
15012
|
+
out += this.renderer.list(token);
|
|
15013
|
+
continue;
|
|
15014
|
+
}
|
|
15015
|
+
case 'html': {
|
|
15016
|
+
out += this.renderer.html(token);
|
|
15017
|
+
continue;
|
|
15018
|
+
}
|
|
15019
|
+
case 'paragraph': {
|
|
15020
|
+
out += this.renderer.paragraph(token);
|
|
15021
|
+
continue;
|
|
15022
|
+
}
|
|
15023
|
+
case 'text': {
|
|
15024
|
+
let textToken = token;
|
|
15025
|
+
let body = this.renderer.text(textToken);
|
|
15026
|
+
while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {
|
|
15027
|
+
textToken = tokens[++i];
|
|
15028
|
+
body += '\n' + this.renderer.text(textToken);
|
|
15029
|
+
}
|
|
15030
|
+
if (top) {
|
|
15031
|
+
out += this.renderer.paragraph({
|
|
15032
|
+
type: 'paragraph',
|
|
15033
|
+
raw: body,
|
|
15034
|
+
text: body,
|
|
15035
|
+
tokens: [{ type: 'text', raw: body, text: body }],
|
|
15036
|
+
});
|
|
15037
|
+
}
|
|
15038
|
+
else {
|
|
15039
|
+
out += body;
|
|
15040
|
+
}
|
|
15041
|
+
continue;
|
|
15042
|
+
}
|
|
15043
|
+
default: {
|
|
15044
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
15045
|
+
if (this.options.silent) {
|
|
15046
|
+
console.error(errMsg);
|
|
15047
|
+
return '';
|
|
15048
|
+
}
|
|
15049
|
+
else {
|
|
15050
|
+
throw new Error(errMsg);
|
|
15051
|
+
}
|
|
15052
|
+
}
|
|
15053
|
+
}
|
|
15054
|
+
}
|
|
15055
|
+
return out;
|
|
15056
|
+
}
|
|
15057
|
+
/**
|
|
15058
|
+
* Parse Inline Tokens
|
|
15059
|
+
*/
|
|
15060
|
+
parseInline(tokens, renderer) {
|
|
15061
|
+
renderer = renderer || this.renderer;
|
|
15062
|
+
let out = '';
|
|
15063
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
15064
|
+
const anyToken = tokens[i];
|
|
15065
|
+
// Run any renderer extensions
|
|
15066
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
|
|
15067
|
+
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
|
15068
|
+
if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(anyToken.type)) {
|
|
15069
|
+
out += ret || '';
|
|
15070
|
+
continue;
|
|
15071
|
+
}
|
|
15072
|
+
}
|
|
15073
|
+
const token = anyToken;
|
|
15074
|
+
switch (token.type) {
|
|
15075
|
+
case 'escape': {
|
|
15076
|
+
out += renderer.text(token);
|
|
15077
|
+
break;
|
|
15078
|
+
}
|
|
15079
|
+
case 'html': {
|
|
15080
|
+
out += renderer.html(token);
|
|
15081
|
+
break;
|
|
15082
|
+
}
|
|
15083
|
+
case 'link': {
|
|
15084
|
+
out += renderer.link(token);
|
|
15085
|
+
break;
|
|
15086
|
+
}
|
|
15087
|
+
case 'image': {
|
|
15088
|
+
out += renderer.image(token);
|
|
15089
|
+
break;
|
|
15090
|
+
}
|
|
15091
|
+
case 'strong': {
|
|
15092
|
+
out += renderer.strong(token);
|
|
15093
|
+
break;
|
|
15094
|
+
}
|
|
15095
|
+
case 'em': {
|
|
15096
|
+
out += renderer.em(token);
|
|
15097
|
+
break;
|
|
15098
|
+
}
|
|
15099
|
+
case 'codespan': {
|
|
15100
|
+
out += renderer.codespan(token);
|
|
15101
|
+
break;
|
|
15102
|
+
}
|
|
15103
|
+
case 'br': {
|
|
15104
|
+
out += renderer.br(token);
|
|
15105
|
+
break;
|
|
15106
|
+
}
|
|
15107
|
+
case 'del': {
|
|
15108
|
+
out += renderer.del(token);
|
|
15109
|
+
break;
|
|
15110
|
+
}
|
|
15111
|
+
case 'text': {
|
|
15112
|
+
out += renderer.text(token);
|
|
15113
|
+
break;
|
|
15114
|
+
}
|
|
15115
|
+
default: {
|
|
15116
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
15117
|
+
if (this.options.silent) {
|
|
15118
|
+
console.error(errMsg);
|
|
15119
|
+
return '';
|
|
15120
|
+
}
|
|
15121
|
+
else {
|
|
15122
|
+
throw new Error(errMsg);
|
|
15123
|
+
}
|
|
15124
|
+
}
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
return out;
|
|
15128
|
+
}
|
|
15129
|
+
}
|
|
15130
|
+
|
|
15131
|
+
class _Hooks {
|
|
15132
|
+
options;
|
|
15133
|
+
block;
|
|
15134
|
+
constructor(options) {
|
|
15135
|
+
this.options = options || _defaults;
|
|
15136
|
+
}
|
|
15137
|
+
static passThroughHooks = new Set([
|
|
15138
|
+
'preprocess',
|
|
15139
|
+
'postprocess',
|
|
15140
|
+
'processAllTokens',
|
|
15141
|
+
]);
|
|
15142
|
+
/**
|
|
15143
|
+
* Process markdown before marked
|
|
15144
|
+
*/
|
|
15145
|
+
preprocess(markdown) {
|
|
15146
|
+
return markdown;
|
|
15147
|
+
}
|
|
15148
|
+
/**
|
|
15149
|
+
* Process HTML after marked is finished
|
|
15150
|
+
*/
|
|
15151
|
+
postprocess(html) {
|
|
15152
|
+
return html;
|
|
15153
|
+
}
|
|
15154
|
+
/**
|
|
15155
|
+
* Process all tokens before walk tokens
|
|
15156
|
+
*/
|
|
15157
|
+
processAllTokens(tokens) {
|
|
15158
|
+
return tokens;
|
|
15159
|
+
}
|
|
15160
|
+
/**
|
|
15161
|
+
* Provide function to tokenize markdown
|
|
15162
|
+
*/
|
|
15163
|
+
provideLexer() {
|
|
15164
|
+
return this.block ? _Lexer.lex : _Lexer.lexInline;
|
|
15165
|
+
}
|
|
15166
|
+
/**
|
|
15167
|
+
* Provide function to parse tokens
|
|
15168
|
+
*/
|
|
15169
|
+
provideParser() {
|
|
15170
|
+
return this.block ? _Parser.parse : _Parser.parseInline;
|
|
15171
|
+
}
|
|
15172
|
+
}
|
|
15173
|
+
|
|
15174
|
+
class Marked {
|
|
15175
|
+
defaults = _getDefaults();
|
|
15176
|
+
options = this.setOptions;
|
|
15177
|
+
parse = this.parseMarkdown(true);
|
|
15178
|
+
parseInline = this.parseMarkdown(false);
|
|
15179
|
+
Parser = _Parser;
|
|
15180
|
+
Renderer = _Renderer;
|
|
15181
|
+
TextRenderer = _TextRenderer;
|
|
15182
|
+
Lexer = _Lexer;
|
|
15183
|
+
Tokenizer = _Tokenizer;
|
|
15184
|
+
Hooks = _Hooks;
|
|
15185
|
+
constructor(...args) {
|
|
15186
|
+
this.use(...args);
|
|
15187
|
+
}
|
|
15188
|
+
/**
|
|
15189
|
+
* Run callback for every token
|
|
15190
|
+
*/
|
|
15191
|
+
walkTokens(tokens, callback) {
|
|
15192
|
+
let values = [];
|
|
15193
|
+
for (const token of tokens) {
|
|
15194
|
+
values = values.concat(callback.call(this, token));
|
|
15195
|
+
switch (token.type) {
|
|
15196
|
+
case 'table': {
|
|
15197
|
+
const tableToken = token;
|
|
15198
|
+
for (const cell of tableToken.header) {
|
|
15199
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
15200
|
+
}
|
|
15201
|
+
for (const row of tableToken.rows) {
|
|
15202
|
+
for (const cell of row) {
|
|
15203
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
|
15204
|
+
}
|
|
15205
|
+
}
|
|
15206
|
+
break;
|
|
15207
|
+
}
|
|
15208
|
+
case 'list': {
|
|
15209
|
+
const listToken = token;
|
|
15210
|
+
values = values.concat(this.walkTokens(listToken.items, callback));
|
|
15211
|
+
break;
|
|
15212
|
+
}
|
|
15213
|
+
default: {
|
|
15214
|
+
const genericToken = token;
|
|
15215
|
+
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
|
15216
|
+
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
|
15217
|
+
const tokens = genericToken[childTokens].flat(Infinity);
|
|
15218
|
+
values = values.concat(this.walkTokens(tokens, callback));
|
|
15219
|
+
});
|
|
15220
|
+
}
|
|
15221
|
+
else if (genericToken.tokens) {
|
|
15222
|
+
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
|
15223
|
+
}
|
|
15224
|
+
}
|
|
15225
|
+
}
|
|
15226
|
+
}
|
|
15227
|
+
return values;
|
|
15228
|
+
}
|
|
15229
|
+
use(...args) {
|
|
15230
|
+
const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
15231
|
+
args.forEach((pack) => {
|
|
15232
|
+
// copy options to new object
|
|
15233
|
+
const opts = { ...pack };
|
|
15234
|
+
// set async to true if it was set to true before
|
|
15235
|
+
opts.async = this.defaults.async || opts.async || false;
|
|
15236
|
+
// ==-- Parse "addon" extensions --== //
|
|
15237
|
+
if (pack.extensions) {
|
|
15238
|
+
pack.extensions.forEach((ext) => {
|
|
15239
|
+
if (!ext.name) {
|
|
15240
|
+
throw new Error('extension name required');
|
|
15241
|
+
}
|
|
15242
|
+
if ('renderer' in ext) { // Renderer extensions
|
|
15243
|
+
const prevRenderer = extensions.renderers[ext.name];
|
|
15244
|
+
if (prevRenderer) {
|
|
15245
|
+
// Replace extension with func to run new extension but fall back if false
|
|
15246
|
+
extensions.renderers[ext.name] = function (...args) {
|
|
15247
|
+
let ret = ext.renderer.apply(this, args);
|
|
15248
|
+
if (ret === false) {
|
|
15249
|
+
ret = prevRenderer.apply(this, args);
|
|
15250
|
+
}
|
|
15251
|
+
return ret;
|
|
15252
|
+
};
|
|
15253
|
+
}
|
|
15254
|
+
else {
|
|
15255
|
+
extensions.renderers[ext.name] = ext.renderer;
|
|
15256
|
+
}
|
|
15257
|
+
}
|
|
15258
|
+
if ('tokenizer' in ext) { // Tokenizer Extensions
|
|
15259
|
+
if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {
|
|
15260
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
15261
|
+
}
|
|
15262
|
+
const extLevel = extensions[ext.level];
|
|
15263
|
+
if (extLevel) {
|
|
15264
|
+
extLevel.unshift(ext.tokenizer);
|
|
15265
|
+
}
|
|
15266
|
+
else {
|
|
15267
|
+
extensions[ext.level] = [ext.tokenizer];
|
|
15268
|
+
}
|
|
15269
|
+
if (ext.start) { // Function to check for start of token
|
|
15270
|
+
if (ext.level === 'block') {
|
|
15271
|
+
if (extensions.startBlock) {
|
|
15272
|
+
extensions.startBlock.push(ext.start);
|
|
15273
|
+
}
|
|
15274
|
+
else {
|
|
15275
|
+
extensions.startBlock = [ext.start];
|
|
15276
|
+
}
|
|
15277
|
+
}
|
|
15278
|
+
else if (ext.level === 'inline') {
|
|
15279
|
+
if (extensions.startInline) {
|
|
15280
|
+
extensions.startInline.push(ext.start);
|
|
15281
|
+
}
|
|
15282
|
+
else {
|
|
15283
|
+
extensions.startInline = [ext.start];
|
|
15284
|
+
}
|
|
15285
|
+
}
|
|
15286
|
+
}
|
|
15287
|
+
}
|
|
15288
|
+
if ('childTokens' in ext && ext.childTokens) { // Child tokens to be visited by walkTokens
|
|
15289
|
+
extensions.childTokens[ext.name] = ext.childTokens;
|
|
15290
|
+
}
|
|
15291
|
+
});
|
|
15292
|
+
opts.extensions = extensions;
|
|
15293
|
+
}
|
|
15294
|
+
// ==-- Parse "overwrite" extensions --== //
|
|
15295
|
+
if (pack.renderer) {
|
|
15296
|
+
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
|
15297
|
+
for (const prop in pack.renderer) {
|
|
15298
|
+
if (!(prop in renderer)) {
|
|
15299
|
+
throw new Error(`renderer '${prop}' does not exist`);
|
|
15300
|
+
}
|
|
15301
|
+
if (['options', 'parser'].includes(prop)) {
|
|
15302
|
+
// ignore options property
|
|
15303
|
+
continue;
|
|
15304
|
+
}
|
|
15305
|
+
const rendererProp = prop;
|
|
15306
|
+
const rendererFunc = pack.renderer[rendererProp];
|
|
15307
|
+
const prevRenderer = renderer[rendererProp];
|
|
15308
|
+
// Replace renderer with func to run extension, but fall back if false
|
|
15309
|
+
renderer[rendererProp] = (...args) => {
|
|
15310
|
+
let ret = rendererFunc.apply(renderer, args);
|
|
15311
|
+
if (ret === false) {
|
|
15312
|
+
ret = prevRenderer.apply(renderer, args);
|
|
15313
|
+
}
|
|
15314
|
+
return ret || '';
|
|
15315
|
+
};
|
|
15316
|
+
}
|
|
15317
|
+
opts.renderer = renderer;
|
|
15318
|
+
}
|
|
15319
|
+
if (pack.tokenizer) {
|
|
15320
|
+
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
|
15321
|
+
for (const prop in pack.tokenizer) {
|
|
15322
|
+
if (!(prop in tokenizer)) {
|
|
15323
|
+
throw new Error(`tokenizer '${prop}' does not exist`);
|
|
15324
|
+
}
|
|
15325
|
+
if (['options', 'rules', 'lexer'].includes(prop)) {
|
|
15326
|
+
// ignore options, rules, and lexer properties
|
|
15327
|
+
continue;
|
|
15328
|
+
}
|
|
15329
|
+
const tokenizerProp = prop;
|
|
15330
|
+
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
15331
|
+
const prevTokenizer = tokenizer[tokenizerProp];
|
|
15332
|
+
// Replace tokenizer with func to run extension, but fall back if false
|
|
15333
|
+
// @ts-expect-error cannot type tokenizer function dynamically
|
|
15334
|
+
tokenizer[tokenizerProp] = (...args) => {
|
|
15335
|
+
let ret = tokenizerFunc.apply(tokenizer, args);
|
|
15336
|
+
if (ret === false) {
|
|
15337
|
+
ret = prevTokenizer.apply(tokenizer, args);
|
|
15338
|
+
}
|
|
15339
|
+
return ret;
|
|
15340
|
+
};
|
|
15341
|
+
}
|
|
15342
|
+
opts.tokenizer = tokenizer;
|
|
15343
|
+
}
|
|
15344
|
+
// ==-- Parse Hooks extensions --== //
|
|
15345
|
+
if (pack.hooks) {
|
|
15346
|
+
const hooks = this.defaults.hooks || new _Hooks();
|
|
15347
|
+
for (const prop in pack.hooks) {
|
|
15348
|
+
if (!(prop in hooks)) {
|
|
15349
|
+
throw new Error(`hook '${prop}' does not exist`);
|
|
15350
|
+
}
|
|
15351
|
+
if (['options', 'block'].includes(prop)) {
|
|
15352
|
+
// ignore options and block properties
|
|
15353
|
+
continue;
|
|
15354
|
+
}
|
|
15355
|
+
const hooksProp = prop;
|
|
15356
|
+
const hooksFunc = pack.hooks[hooksProp];
|
|
15357
|
+
const prevHook = hooks[hooksProp];
|
|
15358
|
+
if (_Hooks.passThroughHooks.has(prop)) {
|
|
15359
|
+
// @ts-expect-error cannot type hook function dynamically
|
|
15360
|
+
hooks[hooksProp] = (arg) => {
|
|
15361
|
+
if (this.defaults.async) {
|
|
15362
|
+
return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {
|
|
15363
|
+
return prevHook.call(hooks, ret);
|
|
15364
|
+
});
|
|
15365
|
+
}
|
|
15366
|
+
const ret = hooksFunc.call(hooks, arg);
|
|
15367
|
+
return prevHook.call(hooks, ret);
|
|
15368
|
+
};
|
|
15369
|
+
}
|
|
15370
|
+
else {
|
|
15371
|
+
// @ts-expect-error cannot type hook function dynamically
|
|
15372
|
+
hooks[hooksProp] = (...args) => {
|
|
15373
|
+
let ret = hooksFunc.apply(hooks, args);
|
|
15374
|
+
if (ret === false) {
|
|
15375
|
+
ret = prevHook.apply(hooks, args);
|
|
15376
|
+
}
|
|
15377
|
+
return ret;
|
|
15378
|
+
};
|
|
15379
|
+
}
|
|
15380
|
+
}
|
|
15381
|
+
opts.hooks = hooks;
|
|
15382
|
+
}
|
|
15383
|
+
// ==-- Parse WalkTokens extensions --== //
|
|
15384
|
+
if (pack.walkTokens) {
|
|
15385
|
+
const walkTokens = this.defaults.walkTokens;
|
|
15386
|
+
const packWalktokens = pack.walkTokens;
|
|
15387
|
+
opts.walkTokens = function (token) {
|
|
15388
|
+
let values = [];
|
|
15389
|
+
values.push(packWalktokens.call(this, token));
|
|
15390
|
+
if (walkTokens) {
|
|
15391
|
+
values = values.concat(walkTokens.call(this, token));
|
|
15392
|
+
}
|
|
15393
|
+
return values;
|
|
15394
|
+
};
|
|
15395
|
+
}
|
|
15396
|
+
this.defaults = { ...this.defaults, ...opts };
|
|
15397
|
+
});
|
|
15398
|
+
return this;
|
|
15399
|
+
}
|
|
15400
|
+
setOptions(opt) {
|
|
15401
|
+
this.defaults = { ...this.defaults, ...opt };
|
|
15402
|
+
return this;
|
|
15403
|
+
}
|
|
15404
|
+
lexer(src, options) {
|
|
15405
|
+
return _Lexer.lex(src, options ?? this.defaults);
|
|
15406
|
+
}
|
|
15407
|
+
parser(tokens, options) {
|
|
15408
|
+
return _Parser.parse(tokens, options ?? this.defaults);
|
|
15409
|
+
}
|
|
15410
|
+
parseMarkdown(blockType) {
|
|
15411
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15412
|
+
const parse = (src, options) => {
|
|
15413
|
+
const origOpt = { ...options };
|
|
15414
|
+
const opt = { ...this.defaults, ...origOpt };
|
|
15415
|
+
const throwError = this.onError(!!opt.silent, !!opt.async);
|
|
15416
|
+
// throw error if an extension set async to true but parse was called with async: false
|
|
15417
|
+
if (this.defaults.async === true && origOpt.async === false) {
|
|
15418
|
+
return throwError(new Error('marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.'));
|
|
15419
|
+
}
|
|
15420
|
+
// throw error in case of non string input
|
|
15421
|
+
if (typeof src === 'undefined' || src === null) {
|
|
15422
|
+
return throwError(new Error('marked(): input parameter is undefined or null'));
|
|
15423
|
+
}
|
|
15424
|
+
if (typeof src !== 'string') {
|
|
15425
|
+
return throwError(new Error('marked(): input parameter is of type '
|
|
15426
|
+
+ Object.prototype.toString.call(src) + ', string expected'));
|
|
15427
|
+
}
|
|
15428
|
+
if (opt.hooks) {
|
|
15429
|
+
opt.hooks.options = opt;
|
|
15430
|
+
opt.hooks.block = blockType;
|
|
15431
|
+
}
|
|
15432
|
+
const lexer = opt.hooks ? opt.hooks.provideLexer() : (blockType ? _Lexer.lex : _Lexer.lexInline);
|
|
15433
|
+
const parser = opt.hooks ? opt.hooks.provideParser() : (blockType ? _Parser.parse : _Parser.parseInline);
|
|
15434
|
+
if (opt.async) {
|
|
15435
|
+
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)
|
|
15436
|
+
.then(src => lexer(src, opt))
|
|
15437
|
+
.then(tokens => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens)
|
|
15438
|
+
.then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens)
|
|
15439
|
+
.then(tokens => parser(tokens, opt))
|
|
15440
|
+
.then(html => opt.hooks ? opt.hooks.postprocess(html) : html)
|
|
15441
|
+
.catch(throwError);
|
|
15442
|
+
}
|
|
15443
|
+
try {
|
|
15444
|
+
if (opt.hooks) {
|
|
15445
|
+
src = opt.hooks.preprocess(src);
|
|
15446
|
+
}
|
|
15447
|
+
let tokens = lexer(src, opt);
|
|
15448
|
+
if (opt.hooks) {
|
|
15449
|
+
tokens = opt.hooks.processAllTokens(tokens);
|
|
15450
|
+
}
|
|
15451
|
+
if (opt.walkTokens) {
|
|
15452
|
+
this.walkTokens(tokens, opt.walkTokens);
|
|
15453
|
+
}
|
|
15454
|
+
let html = parser(tokens, opt);
|
|
15455
|
+
if (opt.hooks) {
|
|
15456
|
+
html = opt.hooks.postprocess(html);
|
|
15457
|
+
}
|
|
15458
|
+
return html;
|
|
15459
|
+
}
|
|
15460
|
+
catch (e) {
|
|
15461
|
+
return throwError(e);
|
|
15462
|
+
}
|
|
15463
|
+
};
|
|
15464
|
+
return parse;
|
|
15465
|
+
}
|
|
15466
|
+
onError(silent, async) {
|
|
15467
|
+
return (e) => {
|
|
15468
|
+
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
15469
|
+
if (silent) {
|
|
15470
|
+
const msg = '<p>An error occurred:</p><pre>'
|
|
15471
|
+
+ escape$1(e.message + '', true)
|
|
15472
|
+
+ '</pre>';
|
|
15473
|
+
if (async) {
|
|
15474
|
+
return Promise.resolve(msg);
|
|
15475
|
+
}
|
|
15476
|
+
return msg;
|
|
15477
|
+
}
|
|
15478
|
+
if (async) {
|
|
15479
|
+
return Promise.reject(e);
|
|
15480
|
+
}
|
|
15481
|
+
throw e;
|
|
15482
|
+
};
|
|
15483
|
+
}
|
|
15484
|
+
}
|
|
15485
|
+
|
|
15486
|
+
const markedInstance = new Marked();
|
|
15487
|
+
function marked(src, opt) {
|
|
15488
|
+
return markedInstance.parse(src, opt);
|
|
15489
|
+
}
|
|
15490
|
+
/**
|
|
15491
|
+
* Sets the default options.
|
|
15492
|
+
*
|
|
15493
|
+
* @param options Hash of options
|
|
15494
|
+
*/
|
|
15495
|
+
marked.options =
|
|
15496
|
+
marked.setOptions = function (options) {
|
|
15497
|
+
markedInstance.setOptions(options);
|
|
15498
|
+
marked.defaults = markedInstance.defaults;
|
|
15499
|
+
changeDefaults(marked.defaults);
|
|
15500
|
+
return marked;
|
|
15501
|
+
};
|
|
15502
|
+
/**
|
|
15503
|
+
* Gets the original marked default options.
|
|
15504
|
+
*/
|
|
15505
|
+
marked.getDefaults = _getDefaults;
|
|
15506
|
+
marked.defaults = _defaults;
|
|
15507
|
+
/**
|
|
15508
|
+
* Use Extension
|
|
15509
|
+
*/
|
|
15510
|
+
marked.use = function (...args) {
|
|
15511
|
+
markedInstance.use(...args);
|
|
15512
|
+
marked.defaults = markedInstance.defaults;
|
|
15513
|
+
changeDefaults(marked.defaults);
|
|
15514
|
+
return marked;
|
|
15515
|
+
};
|
|
15516
|
+
/**
|
|
15517
|
+
* Run callback for every token
|
|
15518
|
+
*/
|
|
15519
|
+
marked.walkTokens = function (tokens, callback) {
|
|
15520
|
+
return markedInstance.walkTokens(tokens, callback);
|
|
15521
|
+
};
|
|
15522
|
+
/**
|
|
15523
|
+
* Compiles markdown to HTML without enclosing `p` tag.
|
|
15524
|
+
*
|
|
15525
|
+
* @param src String of markdown source to be compiled
|
|
15526
|
+
* @param options Hash of options
|
|
15527
|
+
* @return String of compiled HTML
|
|
15528
|
+
*/
|
|
15529
|
+
marked.parseInline = markedInstance.parseInline;
|
|
15530
|
+
/**
|
|
15531
|
+
* Expose
|
|
15532
|
+
*/
|
|
15533
|
+
marked.Parser = _Parser;
|
|
15534
|
+
marked.parser = _Parser.parse;
|
|
15535
|
+
marked.Renderer = _Renderer;
|
|
15536
|
+
marked.TextRenderer = _TextRenderer;
|
|
15537
|
+
marked.Lexer = _Lexer;
|
|
15538
|
+
marked.lexer = _Lexer.lex;
|
|
15539
|
+
marked.Tokenizer = _Tokenizer;
|
|
15540
|
+
marked.Hooks = _Hooks;
|
|
15541
|
+
marked.parse = marked;
|
|
15542
|
+
const options = marked.options;
|
|
15543
|
+
const setOptions = marked.setOptions;
|
|
15544
|
+
const use = marked.use;
|
|
15545
|
+
const walkTokens = marked.walkTokens;
|
|
15546
|
+
const parseInline = marked.parseInline;
|
|
15547
|
+
const parse = (/* unused pure expression or super */ null && (marked));
|
|
15548
|
+
const parser = _Parser.parse;
|
|
15549
|
+
const lexer = _Lexer.lex;
|
|
15550
|
+
|
|
15551
|
+
|
|
15552
|
+
//# sourceMappingURL=marked.esm.js.map
|
|
15553
|
+
|
|
15554
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat.vue?vue&type=script&lang=js
|
|
15555
|
+
|
|
13017
15556
|
|
|
13018
15557
|
|
|
13019
15558
|
|
|
@@ -13098,6 +15637,7 @@ const signal = controller.signal;
|
|
|
13098
15637
|
content: this.messageData[list.index - 1].message
|
|
13099
15638
|
};
|
|
13100
15639
|
this.messageData[list.index].message = '';
|
|
15640
|
+
this.messageData[list.index].cacheMessage = '';
|
|
13101
15641
|
this.makeAutoMessage();
|
|
13102
15642
|
}
|
|
13103
15643
|
const params = {
|
|
@@ -13121,6 +15661,7 @@ const signal = controller.signal;
|
|
|
13121
15661
|
this.messageData.push({
|
|
13122
15662
|
type: 'robot',
|
|
13123
15663
|
message: '',
|
|
15664
|
+
cacheMessage: '',
|
|
13124
15665
|
zan: false,
|
|
13125
15666
|
cai: false,
|
|
13126
15667
|
stop: false,
|
|
@@ -13187,7 +15728,8 @@ const signal = controller.signal;
|
|
|
13187
15728
|
this.$emit('on-message-finish', chatId);
|
|
13188
15729
|
return;
|
|
13189
15730
|
}
|
|
13190
|
-
currentList.
|
|
15731
|
+
currentList.cacheMessage += content;
|
|
15732
|
+
currentList.message = marked.parse(currentList.cacheMessage);
|
|
13191
15733
|
currentList.msgId = msgId;
|
|
13192
15734
|
currentList.parentMsgId = parentMsgId;
|
|
13193
15735
|
currentList.chatId = chatId;
|
|
@@ -13228,14 +15770,14 @@ const signal = controller.signal;
|
|
|
13228
15770
|
}
|
|
13229
15771
|
}
|
|
13230
15772
|
});
|
|
13231
|
-
;//
|
|
15773
|
+
;// ./components/demo/src/chat.vue?vue&type=script&lang=js
|
|
13232
15774
|
/* harmony default export */ var src_chatvue_type_script_lang_js = (chatvue_type_script_lang_js);
|
|
13233
|
-
;//
|
|
15775
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/chat.vue?vue&type=style&index=0&id=322788ca&prod&lang=scss&scoped=true
|
|
13234
15776
|
// extracted by mini-css-extract-plugin
|
|
13235
15777
|
|
|
13236
|
-
;//
|
|
15778
|
+
;// ./components/demo/src/chat.vue?vue&type=style&index=0&id=322788ca&prod&lang=scss&scoped=true
|
|
13237
15779
|
|
|
13238
|
-
;//
|
|
15780
|
+
;// ./components/demo/src/chat.vue
|
|
13239
15781
|
|
|
13240
15782
|
|
|
13241
15783
|
|
|
@@ -13246,17 +15788,17 @@ const signal = controller.signal;
|
|
|
13246
15788
|
|
|
13247
15789
|
var chat_component = normalizeComponent(
|
|
13248
15790
|
src_chatvue_type_script_lang_js,
|
|
13249
|
-
|
|
13250
|
-
|
|
15791
|
+
chatvue_type_template_id_322788ca_scoped_true_render,
|
|
15792
|
+
chatvue_type_template_id_322788ca_scoped_true_staticRenderFns,
|
|
13251
15793
|
false,
|
|
13252
15794
|
null,
|
|
13253
|
-
"
|
|
15795
|
+
"322788ca",
|
|
13254
15796
|
null
|
|
13255
15797
|
|
|
13256
15798
|
)
|
|
13257
15799
|
|
|
13258
15800
|
/* harmony default export */ var chat = (chat_component.exports);
|
|
13259
|
-
;//
|
|
15801
|
+
;// ./node_modules/js-cookie/dist/js.cookie.mjs
|
|
13260
15802
|
/*! js-cookie v3.0.5 | MIT */
|
|
13261
15803
|
/* eslint-disable no-var */
|
|
13262
15804
|
function js_cookie_assign (target) {
|
|
@@ -13392,7 +15934,8 @@ var api = init(defaultConverter, { path: '/' });
|
|
|
13392
15934
|
|
|
13393
15935
|
|
|
13394
15936
|
|
|
13395
|
-
;//
|
|
15937
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/main.vue?vue&type=script&lang=js
|
|
15938
|
+
|
|
13396
15939
|
|
|
13397
15940
|
|
|
13398
15941
|
|
|
@@ -13489,7 +16032,7 @@ var api = init(defaultConverter, { path: '/' });
|
|
|
13489
16032
|
}
|
|
13490
16033
|
const obj = {
|
|
13491
16034
|
type: list.role === 'assistant' ? 'robot' : 'user',
|
|
13492
|
-
message: list.content.replace(/\n/g, '<br>'),
|
|
16035
|
+
message: list.role === 'assistant' ? marked.parse(list.content) : list.content.replace(/\n/g, '<br>'),
|
|
13493
16036
|
zan: list.type === 1,
|
|
13494
16037
|
cai: list.type === 2,
|
|
13495
16038
|
stop: list.status === 1,
|
|
@@ -13576,14 +16119,14 @@ var api = init(defaultConverter, { path: '/' });
|
|
|
13576
16119
|
}
|
|
13577
16120
|
}
|
|
13578
16121
|
});
|
|
13579
|
-
;//
|
|
16122
|
+
;// ./components/demo/src/main.vue?vue&type=script&lang=js
|
|
13580
16123
|
/* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
|
|
13581
|
-
;//
|
|
16124
|
+
;// ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./components/demo/src/main.vue?vue&type=style&index=0&id=4903e526&prod&lang=scss&scoped=true
|
|
13582
16125
|
// extracted by mini-css-extract-plugin
|
|
13583
16126
|
|
|
13584
|
-
;//
|
|
16127
|
+
;// ./components/demo/src/main.vue?vue&type=style&index=0&id=4903e526&prod&lang=scss&scoped=true
|
|
13585
16128
|
|
|
13586
|
-
;//
|
|
16129
|
+
;// ./components/demo/src/main.vue
|
|
13587
16130
|
|
|
13588
16131
|
|
|
13589
16132
|
|
|
@@ -13598,19 +16141,19 @@ var main_component = normalizeComponent(
|
|
|
13598
16141
|
staticRenderFns,
|
|
13599
16142
|
false,
|
|
13600
16143
|
null,
|
|
13601
|
-
"
|
|
16144
|
+
"4903e526",
|
|
13602
16145
|
null
|
|
13603
16146
|
|
|
13604
16147
|
)
|
|
13605
16148
|
|
|
13606
16149
|
/* harmony default export */ var main = (main_component.exports);
|
|
13607
|
-
;//
|
|
16150
|
+
;// ./components/demo/index.js
|
|
13608
16151
|
|
|
13609
16152
|
main.install = function (Vue) {
|
|
13610
16153
|
Vue.component(main.name, main);
|
|
13611
16154
|
};
|
|
13612
16155
|
/* harmony default export */ var demo = (main);
|
|
13613
|
-
;//
|
|
16156
|
+
;// ./components/index.js
|
|
13614
16157
|
|
|
13615
16158
|
const components = {
|
|
13616
16159
|
AiAssistant: demo
|
|
@@ -13624,7 +16167,7 @@ const install = function (Vue) {
|
|
|
13624
16167
|
/* harmony default export */ var components_0 = ({
|
|
13625
16168
|
install
|
|
13626
16169
|
});
|
|
13627
|
-
;//
|
|
16170
|
+
;// ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
13628
16171
|
|
|
13629
16172
|
|
|
13630
16173
|
/* harmony default export */ var entry_lib = (components_0);
|