mashlib 1.8.4 → 1.8.5-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mashlib.js CHANGED
@@ -2664,6 +2664,38 @@ if ( true && module.exports) {
2664
2664
  "use strict";
2665
2665
 
2666
2666
 
2667
+ /**
2668
+ * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.
2669
+ *
2670
+ * Works with anything that has a `length` property and index access properties, including NodeList.
2671
+ *
2672
+ * @template {unknown} T
2673
+ * @param {Array<T> | ({length:number, [number]: T})} list
2674
+ * @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate
2675
+ * @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,
2676
+ * allows injecting a custom implementation in tests
2677
+ * @returns {T | undefined}
2678
+ *
2679
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
2680
+ * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find
2681
+ */
2682
+ function find(list, predicate, ac) {
2683
+ if (ac === undefined) {
2684
+ ac = Array.prototype;
2685
+ }
2686
+ if (list && typeof ac.find === 'function') {
2687
+ return ac.find.call(list, predicate);
2688
+ }
2689
+ for (var i = 0; i < list.length; i++) {
2690
+ if (Object.prototype.hasOwnProperty.call(list, i)) {
2691
+ var item = list[i];
2692
+ if (predicate.call(undefined, item, i, list)) {
2693
+ return item;
2694
+ }
2695
+ }
2696
+ }
2697
+ }
2698
+
2667
2699
  /**
2668
2700
  * "Shallow freezes" an object to render it immutable.
2669
2701
  * Uses `Object.freeze` if available,
@@ -2829,6 +2861,7 @@ var NAMESPACE = freeze({
2829
2861
  })
2830
2862
 
2831
2863
  exports.assign = assign;
2864
+ exports.find = find;
2832
2865
  exports.freeze = freeze;
2833
2866
  exports.MIME_TYPE = MIME_TYPE;
2834
2867
  exports.NAMESPACE = NAMESPACE;
@@ -3178,6 +3211,7 @@ exports.DOMParser = DOMParser;
3178
3211
  /* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
3179
3212
  var conventions = __webpack_require__(/*! ./conventions */ "./node_modules/@xmldom/xmldom/lib/conventions.js");
3180
3213
 
3214
+ var find = conventions.find;
3181
3215
  var NAMESPACE = conventions.NAMESPACE;
3182
3216
 
3183
3217
  /**
@@ -3240,7 +3274,9 @@ function arrayIncludes (list) {
3240
3274
 
3241
3275
  function copy(src,dest){
3242
3276
  for(var p in src){
3243
- dest[p] = src[p];
3277
+ if (Object.prototype.hasOwnProperty.call(src, p)) {
3278
+ dest[p] = src[p];
3279
+ }
3244
3280
  }
3245
3281
  }
3246
3282
 
@@ -3334,14 +3370,14 @@ NodeList.prototype = {
3334
3370
  * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.
3335
3371
  * @standard level1
3336
3372
  */
3337
- length:0,
3373
+ length:0,
3338
3374
  /**
3339
3375
  * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.
3340
3376
  * @standard level1
3341
- * @param index unsigned long
3377
+ * @param index unsigned long
3342
3378
  * Index into the collection.
3343
3379
  * @return Node
3344
- * The node at the indexth position in the NodeList, or null if that is not a valid index.
3380
+ * The node at the indexth position in the NodeList, or null if that is not a valid index.
3345
3381
  */
3346
3382
  item: function(index) {
3347
3383
  return this[index] || null;
@@ -3351,7 +3387,23 @@ NodeList.prototype = {
3351
3387
  serializeToString(this[i],buf,isHTML,nodeFilter);
3352
3388
  }
3353
3389
  return buf.join('');
3354
- }
3390
+ },
3391
+ /**
3392
+ * @private
3393
+ * @param {function (Node):boolean} predicate
3394
+ * @returns {Node[]}
3395
+ */
3396
+ filter: function (predicate) {
3397
+ return Array.prototype.filter.call(this, predicate);
3398
+ },
3399
+ /**
3400
+ * @private
3401
+ * @param {Node} item
3402
+ * @returns {number}
3403
+ */
3404
+ indexOf: function (item) {
3405
+ return Array.prototype.indexOf.call(this, item);
3406
+ },
3355
3407
  };
3356
3408
 
3357
3409
  function LiveNodeList(node,refresh){
@@ -3385,7 +3437,7 @@ _extends(LiveNodeList,NodeList);
3385
3437
  * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
3386
3438
  * and does not imply that the DOM specifies an order to these Nodes.
3387
3439
  * NamedNodeMap objects in the DOM are live.
3388
- * used for attributes or DocumentType entities
3440
+ * used for attributes or DocumentType entities
3389
3441
  */
3390
3442
  function NamedNodeMap() {
3391
3443
  };
@@ -3429,7 +3481,7 @@ function _removeNamedNode(el,list,attr){
3429
3481
  }
3430
3482
  }
3431
3483
  }else{
3432
- throw DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr))
3484
+ throw new DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr))
3433
3485
  }
3434
3486
  }
3435
3487
  NamedNodeMap.prototype = {
@@ -3474,10 +3526,10 @@ NamedNodeMap.prototype = {
3474
3526
  var attr = this.getNamedItem(key);
3475
3527
  _removeNamedNode(this._ownerElement,this,attr);
3476
3528
  return attr;
3477
-
3478
-
3529
+
3530
+
3479
3531
  },// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR
3480
-
3532
+
3481
3533
  //for level2
3482
3534
  removeNamedItemNS:function(namespaceURI,localName){
3483
3535
  var attr = this.getNamedItemNS(namespaceURI,localName);
@@ -3623,11 +3675,11 @@ Node.prototype = {
3623
3675
  prefix : null,
3624
3676
  localName : null,
3625
3677
  // Modified in DOM Level 2:
3626
- insertBefore:function(newChild, refChild){//raises
3678
+ insertBefore:function(newChild, refChild){//raises
3627
3679
  return _insertBefore(this,newChild,refChild);
3628
3680
  },
3629
- replaceChild:function(newChild, oldChild){//raises
3630
- this.insertBefore(newChild,oldChild);
3681
+ replaceChild:function(newChild, oldChild){//raises
3682
+ _insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument);
3631
3683
  if(oldChild){
3632
3684
  this.removeChild(oldChild);
3633
3685
  }
@@ -3687,9 +3739,9 @@ Node.prototype = {
3687
3739
  //console.dir(map)
3688
3740
  if(map){
3689
3741
  for(var n in map){
3690
- if(map[n] == namespaceURI){
3691
- return n;
3692
- }
3742
+ if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
3743
+ return n;
3744
+ }
3693
3745
  }
3694
3746
  }
3695
3747
  el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
@@ -3703,7 +3755,7 @@ Node.prototype = {
3703
3755
  var map = el._nsMap;
3704
3756
  //console.dir(map)
3705
3757
  if(map){
3706
- if(prefix in map){
3758
+ if(Object.prototype.hasOwnProperty.call(map, prefix)){
3707
3759
  return map[prefix] ;
3708
3760
  }
3709
3761
  }
@@ -3749,6 +3801,7 @@ function _visitNode(node,callback){
3749
3801
 
3750
3802
 
3751
3803
  function Document(){
3804
+ this.ownerDocument = this;
3752
3805
  }
3753
3806
 
3754
3807
  function _onAddAttribute(doc,el,newAttr){
@@ -3832,48 +3885,313 @@ function _removeChild (parentNode, child) {
3832
3885
  _onUpdateChild(parentNode.ownerDocument, parentNode);
3833
3886
  return child;
3834
3887
  }
3888
+
3889
+ /**
3890
+ * Returns `true` if `node` can be a parent for insertion.
3891
+ * @param {Node} node
3892
+ * @returns {boolean}
3893
+ */
3894
+ function hasValidParentNodeType(node) {
3895
+ return (
3896
+ node &&
3897
+ (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE)
3898
+ );
3899
+ }
3900
+
3901
+ /**
3902
+ * Returns `true` if `node` can be inserted according to it's `nodeType`.
3903
+ * @param {Node} node
3904
+ * @returns {boolean}
3905
+ */
3906
+ function hasInsertableNodeType(node) {
3907
+ return (
3908
+ node &&
3909
+ (isElementNode(node) ||
3910
+ isTextNode(node) ||
3911
+ isDocTypeNode(node) ||
3912
+ node.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||
3913
+ node.nodeType === Node.COMMENT_NODE ||
3914
+ node.nodeType === Node.PROCESSING_INSTRUCTION_NODE)
3915
+ );
3916
+ }
3917
+
3918
+ /**
3919
+ * Returns true if `node` is a DOCTYPE node
3920
+ * @param {Node} node
3921
+ * @returns {boolean}
3922
+ */
3923
+ function isDocTypeNode(node) {
3924
+ return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
3925
+ }
3926
+
3927
+ /**
3928
+ * Returns true if the node is an element
3929
+ * @param {Node} node
3930
+ * @returns {boolean}
3931
+ */
3932
+ function isElementNode(node) {
3933
+ return node && node.nodeType === Node.ELEMENT_NODE;
3934
+ }
3835
3935
  /**
3836
- * preformance key(refChild == null)
3936
+ * Returns true if `node` is a text node
3937
+ * @param {Node} node
3938
+ * @returns {boolean}
3939
+ */
3940
+ function isTextNode(node) {
3941
+ return node && node.nodeType === Node.TEXT_NODE;
3942
+ }
3943
+
3944
+ /**
3945
+ * Check if en element node can be inserted before `child`, or at the end if child is falsy,
3946
+ * according to the presence and position of a doctype node on the same level.
3947
+ *
3948
+ * @param {Document} doc The document node
3949
+ * @param {Node} child the node that would become the nextSibling if the element would be inserted
3950
+ * @returns {boolean} `true` if an element can be inserted before child
3951
+ * @private
3952
+ * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
3953
+ */
3954
+ function isElementInsertionPossible(doc, child) {
3955
+ var parentChildNodes = doc.childNodes || [];
3956
+ if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
3957
+ return false;
3958
+ }
3959
+ var docTypeNode = find(parentChildNodes, isDocTypeNode);
3960
+ return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
3961
+ }
3962
+
3963
+ /**
3964
+ * Check if en element node can be inserted before `child`, or at the end if child is falsy,
3965
+ * according to the presence and position of a doctype node on the same level.
3966
+ *
3967
+ * @param {Node} doc The document node
3968
+ * @param {Node} child the node that would become the nextSibling if the element would be inserted
3969
+ * @returns {boolean} `true` if an element can be inserted before child
3970
+ * @private
3971
+ * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
3837
3972
  */
3838
- function _insertBefore(parentNode,newChild,nextChild){
3839
- var cp = newChild.parentNode;
3973
+ function isElementReplacementPossible(doc, child) {
3974
+ var parentChildNodes = doc.childNodes || [];
3975
+
3976
+ function hasElementChildThatIsNotChild(node) {
3977
+ return isElementNode(node) && node !== child;
3978
+ }
3979
+
3980
+ if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
3981
+ return false;
3982
+ }
3983
+ var docTypeNode = find(parentChildNodes, isDocTypeNode);
3984
+ return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
3985
+ }
3986
+
3987
+ /**
3988
+ * @private
3989
+ * Steps 1-5 of the checks before inserting and before replacing a child are the same.
3990
+ *
3991
+ * @param {Node} parent the parent node to insert `node` into
3992
+ * @param {Node} node the node to insert
3993
+ * @param {Node=} child the node that should become the `nextSibling` of `node`
3994
+ * @returns {Node}
3995
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
3996
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
3997
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
3998
+ * @see https://dom.spec.whatwg.org/#concept-node-replace
3999
+ */
4000
+ function assertPreInsertionValidity1to5(parent, node, child) {
4001
+ // 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a "HierarchyRequestError" DOMException.
4002
+ if (!hasValidParentNodeType(parent)) {
4003
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType);
4004
+ }
4005
+ // 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a "HierarchyRequestError" DOMException.
4006
+ // not implemented!
4007
+ // 3. If `child` is non-null and its parent is not `parent`, then throw a "NotFoundError" DOMException.
4008
+ if (child && child.parentNode !== parent) {
4009
+ throw new DOMException(NOT_FOUND_ERR, 'child not in parent');
4010
+ }
4011
+ if (
4012
+ // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a "HierarchyRequestError" DOMException.
4013
+ !hasInsertableNodeType(node) ||
4014
+ // 5. If either `node` is a Text node and `parent` is a document,
4015
+ // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0
4016
+ // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)
4017
+ // or `node` is a doctype and `parent` is not a document, then throw a "HierarchyRequestError" DOMException.
4018
+ (isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE)
4019
+ ) {
4020
+ throw new DOMException(
4021
+ HIERARCHY_REQUEST_ERR,
4022
+ 'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType
4023
+ );
4024
+ }
4025
+ }
4026
+
4027
+ /**
4028
+ * @private
4029
+ * Step 6 of the checks before inserting and before replacing a child are different.
4030
+ *
4031
+ * @param {Document} parent the parent node to insert `node` into
4032
+ * @param {Node} node the node to insert
4033
+ * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
4034
+ * @returns {Node}
4035
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
4036
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
4037
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
4038
+ * @see https://dom.spec.whatwg.org/#concept-node-replace
4039
+ */
4040
+ function assertPreInsertionValidityInDocument(parent, node, child) {
4041
+ var parentChildNodes = parent.childNodes || [];
4042
+ var nodeChildNodes = node.childNodes || [];
4043
+
4044
+ // DocumentFragment
4045
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
4046
+ var nodeChildElements = nodeChildNodes.filter(isElementNode);
4047
+ // If node has more than one element child or has a Text node child.
4048
+ if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
4049
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');
4050
+ }
4051
+ // Otherwise, if `node` has one element child and either `parent` has an element child,
4052
+ // `child` is a doctype, or `child` is non-null and a doctype is following `child`.
4053
+ if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
4054
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');
4055
+ }
4056
+ }
4057
+ // Element
4058
+ if (isElementNode(node)) {
4059
+ // `parent` has an element child, `child` is a doctype,
4060
+ // or `child` is non-null and a doctype is following `child`.
4061
+ if (!isElementInsertionPossible(parent, child)) {
4062
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');
4063
+ }
4064
+ }
4065
+ // DocumentType
4066
+ if (isDocTypeNode(node)) {
4067
+ // `parent` has a doctype child,
4068
+ if (find(parentChildNodes, isDocTypeNode)) {
4069
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');
4070
+ }
4071
+ var parentElementChild = find(parentChildNodes, isElementNode);
4072
+ // `child` is non-null and an element is preceding `child`,
4073
+ if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
4074
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');
4075
+ }
4076
+ // or `child` is null and `parent` has an element child.
4077
+ if (!child && parentElementChild) {
4078
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');
4079
+ }
4080
+ }
4081
+ }
4082
+
4083
+ /**
4084
+ * @private
4085
+ * Step 6 of the checks before inserting and before replacing a child are different.
4086
+ *
4087
+ * @param {Document} parent the parent node to insert `node` into
4088
+ * @param {Node} node the node to insert
4089
+ * @param {Node | undefined} child the node that should become the `nextSibling` of `node`
4090
+ * @returns {Node}
4091
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
4092
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
4093
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
4094
+ * @see https://dom.spec.whatwg.org/#concept-node-replace
4095
+ */
4096
+ function assertPreReplacementValidityInDocument(parent, node, child) {
4097
+ var parentChildNodes = parent.childNodes || [];
4098
+ var nodeChildNodes = node.childNodes || [];
4099
+
4100
+ // DocumentFragment
4101
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
4102
+ var nodeChildElements = nodeChildNodes.filter(isElementNode);
4103
+ // If `node` has more than one element child or has a Text node child.
4104
+ if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {
4105
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');
4106
+ }
4107
+ // Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.
4108
+ if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
4109
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');
4110
+ }
4111
+ }
4112
+ // Element
4113
+ if (isElementNode(node)) {
4114
+ // `parent` has an element child that is not `child` or a doctype is following `child`.
4115
+ if (!isElementReplacementPossible(parent, child)) {
4116
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');
4117
+ }
4118
+ }
4119
+ // DocumentType
4120
+ if (isDocTypeNode(node)) {
4121
+ function hasDoctypeChildThatIsNotChild(node) {
4122
+ return isDocTypeNode(node) && node !== child;
4123
+ }
4124
+
4125
+ // `parent` has a doctype child that is not `child`,
4126
+ if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {
4127
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');
4128
+ }
4129
+ var parentElementChild = find(parentChildNodes, isElementNode);
4130
+ // or an element is preceding `child`.
4131
+ if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
4132
+ throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');
4133
+ }
4134
+ }
4135
+ }
4136
+
4137
+ /**
4138
+ * @private
4139
+ * @param {Node} parent the parent node to insert `node` into
4140
+ * @param {Node} node the node to insert
4141
+ * @param {Node=} child the node that should become the `nextSibling` of `node`
4142
+ * @returns {Node}
4143
+ * @throws DOMException for several node combinations that would create a DOM that is not well-formed.
4144
+ * @throws DOMException if `child` is provided but is not a child of `parent`.
4145
+ * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity
4146
+ */
4147
+ function _insertBefore(parent, node, child, _inDocumentAssertion) {
4148
+ // To ensure pre-insertion validity of a node into a parent before a child, run these steps:
4149
+ assertPreInsertionValidity1to5(parent, node, child);
4150
+
4151
+ // If parent is a document, and any of the statements below, switched on the interface node implements,
4152
+ // are true, then throw a "HierarchyRequestError" DOMException.
4153
+ if (parent.nodeType === Node.DOCUMENT_NODE) {
4154
+ (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
4155
+ }
4156
+
4157
+ var cp = node.parentNode;
3840
4158
  if(cp){
3841
- cp.removeChild(newChild);//remove and update
4159
+ cp.removeChild(node);//remove and update
3842
4160
  }
3843
- if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
3844
- var newFirst = newChild.firstChild;
4161
+ if(node.nodeType === DOCUMENT_FRAGMENT_NODE){
4162
+ var newFirst = node.firstChild;
3845
4163
  if (newFirst == null) {
3846
- return newChild;
4164
+ return node;
3847
4165
  }
3848
- var newLast = newChild.lastChild;
4166
+ var newLast = node.lastChild;
3849
4167
  }else{
3850
- newFirst = newLast = newChild;
4168
+ newFirst = newLast = node;
3851
4169
  }
3852
- var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild;
4170
+ var pre = child ? child.previousSibling : parent.lastChild;
3853
4171
 
3854
4172
  newFirst.previousSibling = pre;
3855
- newLast.nextSibling = nextChild;
3856
-
3857
-
4173
+ newLast.nextSibling = child;
4174
+
4175
+
3858
4176
  if(pre){
3859
4177
  pre.nextSibling = newFirst;
3860
4178
  }else{
3861
- parentNode.firstChild = newFirst;
4179
+ parent.firstChild = newFirst;
3862
4180
  }
3863
- if(nextChild == null){
3864
- parentNode.lastChild = newLast;
4181
+ if(child == null){
4182
+ parent.lastChild = newLast;
3865
4183
  }else{
3866
- nextChild.previousSibling = newLast;
4184
+ child.previousSibling = newLast;
3867
4185
  }
3868
4186
  do{
3869
- newFirst.parentNode = parentNode;
4187
+ newFirst.parentNode = parent;
3870
4188
  }while(newFirst !== newLast && (newFirst= newFirst.nextSibling))
3871
- _onUpdateChild(parentNode.ownerDocument||parentNode,parentNode);
3872
- //console.log(parentNode.lastChild.nextSibling == null)
3873
- if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
3874
- newChild.firstChild = newChild.lastChild = null;
4189
+ _onUpdateChild(parent.ownerDocument||parent, parent);
4190
+ //console.log(parent.lastChild.nextSibling == null)
4191
+ if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
4192
+ node.firstChild = node.lastChild = null;
3875
4193
  }
3876
- return newChild;
4194
+ return node;
3877
4195
  }
3878
4196
 
3879
4197
  /**
@@ -3928,11 +4246,13 @@ Document.prototype = {
3928
4246
  }
3929
4247
  return newChild;
3930
4248
  }
3931
- if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){
4249
+ _insertBefore(this, newChild, refChild);
4250
+ newChild.ownerDocument = this;
4251
+ if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
3932
4252
  this.documentElement = newChild;
3933
4253
  }
3934
4254
 
3935
- return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild;
4255
+ return newChild;
3936
4256
  },
3937
4257
  removeChild : function(oldChild){
3938
4258
  if(this.documentElement == oldChild){
@@ -3940,6 +4260,17 @@ Document.prototype = {
3940
4260
  }
3941
4261
  return _removeChild(this,oldChild);
3942
4262
  },
4263
+ replaceChild: function (newChild, oldChild) {
4264
+ //raises
4265
+ _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
4266
+ newChild.ownerDocument = this;
4267
+ if (oldChild) {
4268
+ this.removeChild(oldChild);
4269
+ }
4270
+ if (isElementNode(newChild)) {
4271
+ this.documentElement = newChild;
4272
+ }
4273
+ },
3943
4274
  // Introduced in DOM Level 2:
3944
4275
  importNode : function(importedNode,deep){
3945
4276
  return importNode(this,importedNode,deep);
@@ -4126,7 +4457,7 @@ Element.prototype = {
4126
4457
  var attr = this.getAttributeNode(name)
4127
4458
  attr && this.removeAttributeNode(attr);
4128
4459
  },
4129
-
4460
+
4130
4461
  //four real opeartion method
4131
4462
  appendChild:function(newChild){
4132
4463
  if(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){
@@ -4150,7 +4481,7 @@ Element.prototype = {
4150
4481
  var old = this.getAttributeNodeNS(namespaceURI, localName);
4151
4482
  old && this.removeAttributeNode(old);
4152
4483
  },
4153
-
4484
+
4154
4485
  hasAttributeNS : function(namespaceURI, localName){
4155
4486
  return this.getAttributeNodeNS(namespaceURI, localName)!=null;
4156
4487
  },
@@ -4166,7 +4497,7 @@ Element.prototype = {
4166
4497
  getAttributeNodeNS : function(namespaceURI, localName){
4167
4498
  return this.attributes.getNamedItemNS(namespaceURI, localName);
4168
4499
  },
4169
-
4500
+
4170
4501
  getElementsByTagName : function(tagName){
4171
4502
  return new LiveNodeList(this,function(base){
4172
4503
  var ls = [];
@@ -4187,7 +4518,7 @@ Element.prototype = {
4187
4518
  }
4188
4519
  });
4189
4520
  return ls;
4190
-
4521
+
4191
4522
  });
4192
4523
  }
4193
4524
  };
@@ -4216,7 +4547,7 @@ CharacterData.prototype = {
4216
4547
  },
4217
4548
  insertData: function(offset,text) {
4218
4549
  this.replaceData(offset,0,text);
4219
-
4550
+
4220
4551
  },
4221
4552
  appendChild:function(newChild){
4222
4553
  throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])
@@ -4310,7 +4641,7 @@ function nodeSerializeToString(isHtml,nodeFilter){
4310
4641
  var refNode = this.nodeType == 9 && this.documentElement || this;
4311
4642
  var prefix = refNode.prefix;
4312
4643
  var uri = refNode.namespaceURI;
4313
-
4644
+
4314
4645
  if(uri && prefix == null){
4315
4646
  //console.log(prefix)
4316
4647
  var prefix = refNode.lookupPrefix(uri);
@@ -4343,8 +4674,8 @@ function needNamespaceDefine(node, isHTML, visibleNamespaces) {
4343
4674
  if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
4344
4675
  return false;
4345
4676
  }
4346
-
4347
- var i = visibleNamespaces.length
4677
+
4678
+ var i = visibleNamespaces.length
4348
4679
  while (i--) {
4349
4680
  var ns = visibleNamespaces[i];
4350
4681
  // get namespace prefix
@@ -4395,7 +4726,7 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
4395
4726
  var len = attrs.length;
4396
4727
  var child = node.firstChild;
4397
4728
  var nodeName = node.tagName;
4398
-
4729
+
4399
4730
  isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML
4400
4731
 
4401
4732
  var prefixedNodeName = nodeName
@@ -4454,14 +4785,14 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
4454
4785
  serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
4455
4786
  }
4456
4787
 
4457
- // add namespace for current node
4788
+ // add namespace for current node
4458
4789
  if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
4459
4790
  var prefix = node.prefix||'';
4460
4791
  var uri = node.namespaceURI;
4461
4792
  addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
4462
4793
  visibleNamespaces.push({ prefix: prefix, namespace:uri });
4463
4794
  }
4464
-
4795
+
4465
4796
  if(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){
4466
4797
  buf.push('>');
4467
4798
  //if is cdata child node
@@ -4602,11 +4933,13 @@ function importNode(doc,node,deep){
4602
4933
  // attributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};
4603
4934
  function cloneNode(doc,node,deep){
4604
4935
  var node2 = new node.constructor();
4605
- for(var n in node){
4606
- var v = node[n];
4607
- if(typeof v != 'object' ){
4608
- if(v != node2[n]){
4609
- node2[n] = v;
4936
+ for (var n in node) {
4937
+ if (Object.prototype.hasOwnProperty.call(node, n)) {
4938
+ var v = node[n];
4939
+ if (typeof v != "object") {
4940
+ if (v != node2[n]) {
4941
+ node2[n] = v;
4942
+ }
4610
4943
  }
4611
4944
  }
4612
4945
  }
@@ -4674,7 +5007,7 @@ try{
4674
5007
  }
4675
5008
  }
4676
5009
  })
4677
-
5010
+
4678
5011
  function getTextContent(node){
4679
5012
  switch(node.nodeType){
4680
5013
  case ELEMENT_NODE:
@@ -5154,8 +5487,10 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
5154
5487
  if(endIgnoreCaseMach){
5155
5488
  domBuilder.endElement(config.uri,config.localName,tagName);
5156
5489
  if(localNSMap){
5157
- for(var prefix in localNSMap){
5158
- domBuilder.endPrefixMapping(prefix) ;
5490
+ for (var prefix in localNSMap) {
5491
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
5492
+ domBuilder.endPrefixMapping(prefix);
5493
+ }
5159
5494
  }
5160
5495
  }
5161
5496
  if(!endMatch){
@@ -5497,8 +5832,10 @@ function appendElement(el,domBuilder,currentNSMap){
5497
5832
  if(el.closed){
5498
5833
  domBuilder.endElement(ns,localName,tagName);
5499
5834
  if(localNSMap){
5500
- for(prefix in localNSMap){
5501
- domBuilder.endPrefixMapping(prefix)
5835
+ for (prefix in localNSMap) {
5836
+ if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
5837
+ domBuilder.endPrefixMapping(prefix);
5838
+ }
5502
5839
  }
5503
5840
  }
5504
5841
  }else{
@@ -5544,9 +5881,15 @@ function fixSelfClosed(source,elStartEnd,tagName,closeMap){
5544
5881
  return pos<elStartEnd;
5545
5882
  //}
5546
5883
  }
5547
- function _copy(source,target){
5548
- for(var n in source){target[n] = source[n]}
5884
+
5885
+ function _copy (source, target) {
5886
+ for (var n in source) {
5887
+ if (Object.prototype.hasOwnProperty.call(source, n)) {
5888
+ target[n] = source[n];
5889
+ }
5890
+ }
5549
5891
  }
5892
+
5550
5893
  function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
5551
5894
  var next= source.charAt(start+2)
5552
5895
  switch(next){
@@ -8289,10 +8632,10 @@ __webpack_require__.r(__webpack_exports__);
8289
8632
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
8290
8633
  /* harmony export */ });
8291
8634
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
8292
- buildTime: "2022-09-01T20:57:29Z",
8293
- commit: "74a1d67318042a476ff3e2ecc926ab6aacf07224",
8635
+ buildTime: "2022-11-08T15:49:01Z",
8636
+ commit: "1bbd3aac3f0e6df529bfcb7bb1b0d28cbef8aecf",
8294
8637
  npmInfo: {
8295
- mashlib: '1.8.3',
8638
+ mashlib: '1.8.5-alpha',
8296
8639
  npm: '8.18.0',
8297
8640
  node: '14.17.3',
8298
8641
  v8: '8.4.371.23-node.67',
@@ -11971,6 +12314,7 @@ function consoleAssert(expression) {
11971
12314
  __webpack_require__.r(__webpack_exports__);
11972
12315
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11973
12316
  /* harmony export */ "addPersonToGroup": () => (/* binding */ addPersonToGroup),
12317
+ /* harmony export */ "groupMembers": () => (/* binding */ groupMembers),
11974
12318
  /* harmony export */ "sanitizeToAlpha": () => (/* binding */ sanitizeToAlpha),
11975
12319
  /* harmony export */ "saveNewContact": () => (/* binding */ saveNewContact),
11976
12320
  /* harmony export */ "saveNewGroup": () => (/* binding */ saveNewGroup),
@@ -12120,7 +12464,7 @@ async function addPersonToGroup (thing, group) {
12120
12464
  const pname = kb.any(thing, ns.vcard('fn'))
12121
12465
  const gname = kb.any(group, ns.vcard('fn'))
12122
12466
  if (!pname) { return alert('No vcard name known for ' + thing) }
12123
- const already = kb.holds(group, ns.vcard('hasMember'), thing, group.doc())
12467
+ const already = kb.holds(thing, ns.vcard('fn'), null, group.doc())
12124
12468
  if (already) {
12125
12469
  return alert(
12126
12470
  'ALREADY added ' + pname + ' to group ' + gname
@@ -12129,14 +12473,18 @@ async function addPersonToGroup (thing, group) {
12129
12473
  const message = 'Add ' + pname + ' to group ' + gname + '?'
12130
12474
  if (!confirm(message)) return
12131
12475
  const ins = [
12132
- $rdf.st(group, ns.vcard('hasMember'), thing, group.doc()),
12133
12476
  $rdf.st(thing, ns.vcard('fn'), pname, group.doc())
12134
12477
  ]
12135
- // find person webIDs
12478
+ // find person webIDs and insert in vcard:hasMember
12136
12479
  const webIDs = (0,_webidControl__WEBPACK_IMPORTED_MODULE_2__.getPersonas)(kb, thing).map(webid => webid.value)
12137
- webIDs.forEach(webid => {
12138
- ins.push($rdf.st(thing, ns.owl('sameAs'), kb.sym(webid), group.doc()))
12139
- })
12480
+ if (webIDs.length) {
12481
+ webIDs.forEach(webid => {
12482
+ ins.push($rdf.st(kb.sym(webid), ns.owl('sameAs'), thing, group.doc()))
12483
+ ins.push($rdf.st(group, ns.vcard('hasMember'), kb.sym(webid), group.doc()))
12484
+ })
12485
+ } else {
12486
+ ins.push($rdf.st(group, ns.vcard('hasMember'), thing, group.doc()))
12487
+ }
12140
12488
  try {
12141
12489
  await updater.update([], ins)
12142
12490
  // to allow refresh of card groupList
@@ -12148,6 +12496,31 @@ async function addPersonToGroup (thing, group) {
12148
12496
  return thing
12149
12497
  }
12150
12498
 
12499
+ /**
12500
+ * Find persons member of a group
12501
+ */
12502
+
12503
+ function groupMembers (kb, group) {
12504
+ const a = kb.each(group, ns.vcard('hasMember'), null, group.doc())
12505
+ let b = []
12506
+ a.forEach(item => {
12507
+ /* const contacts = kb.each(item, ns.owl('sameAs'), null, group.doc())
12508
+ if (contacts.length) {
12509
+ if (!kb.any(contacts[0], ns.vard('fn'))) b = b.concat(item) // this is the old data model
12510
+ else b = b.concat(contacts)
12511
+ } else { b = b.concat(item) }
12512
+ b = b.concat(item) */
12513
+
12514
+ // to keep compatibility with old data model
12515
+ // check if item is a contact, else it is a WebID and parse 'sameAs' for contacts
12516
+ b = kb.any(item, ns.vcard('fn'), null, group.doc()) ? b.concat(item) : b.concat(kb.each(item, ns.owl('sameAs'), null, group.doc()))
12517
+ })
12518
+ const strings = new Set(b.map(contact => contact.uri)) // remove dups
12519
+ b = [...strings].map(uri => kb.sym(uri))
12520
+ return b
12521
+ }
12522
+
12523
+
12151
12524
 
12152
12525
  /***/ }),
12153
12526
 
@@ -12168,6 +12541,7 @@ __webpack_require__.r(__webpack_exports__);
12168
12541
  /* harmony import */ var _mintNewAddressBook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mintNewAddressBook */ "./node_modules/contacts-pane/mintNewAddressBook.js");
12169
12542
  /* harmony import */ var _individual__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./individual */ "./node_modules/contacts-pane/individual.js");
12170
12543
  /* harmony import */ var _toolsPane__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./toolsPane */ "./node_modules/contacts-pane/toolsPane.js");
12544
+ /* harmony import */ var _groupMembershipControl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./groupMembershipControl */ "./node_modules/contacts-pane/groupMembershipControl.js");
12171
12545
  /* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
12172
12546
  /* Contact AddressBook Pane
12173
12547
  **
@@ -12192,6 +12566,7 @@ to change its state according to an ontology, comment on it, etc.
12192
12566
 
12193
12567
 
12194
12568
 
12569
+
12195
12570
  // const $rdf = UI.rdf
12196
12571
  const ns = solid_ui__WEBPACK_IMPORTED_MODULE_2__.ns
12197
12572
  const utils = solid_ui__WEBPACK_IMPORTED_MODULE_2__.utils
@@ -12388,8 +12763,25 @@ const style = solid_ui__WEBPACK_IMPORTED_MODULE_2__.style
12388
12763
  const nameEmailIndex = kb.any(book, ns.vcard('nameEmailIndex'))
12389
12764
  await kb.fetcher.load(nameEmailIndex)
12390
12765
 
12766
+ // - delete person's WebID's in each Group
12391
12767
  // - delete the references to it in group files and save them back
12392
- // - delete the reference in people.ttl and save it back
12768
+ // - delete the reference in people.ttl and save it back
12769
+
12770
+ // find all Groups
12771
+ const groups = (0,_groupMembershipControl__WEBPACK_IMPORTED_MODULE_6__.groupMembership)(person)
12772
+ let removeFromGroups = []
12773
+ // find person WebID's
12774
+ groups.map( group => {
12775
+ const webids = kb.each(null, ns.owl('sameAs'), person, group.doc())
12776
+ // for each check in each Group that it is not used by an other person then delete
12777
+ webids.map( webid => {
12778
+ if (kb.statementsMatching(webid, ns.owl('sameAs'), null, group.doc()).length = 1) {
12779
+ removeFromGroups = removeFromGroups.concat(kb.statementsMatching(group, ns.vcard('hasMember'), webid, group.doc()))
12780
+ }
12781
+ })
12782
+ })
12783
+ // console.log(removeFromGroups)
12784
+ await kb.updater.updateMany(removeFromGroups)
12393
12785
  await deleteThingAndDoc(person)
12394
12786
  await deleteRecursive(kb, container)
12395
12787
  refreshNames() // "Doesn't work" -- maybe does now with waiting for async
@@ -12588,8 +12980,7 @@ const style = solid_ui__WEBPACK_IMPORTED_MODULE_2__.style
12588
12980
  const groups = Object.keys(selectedGroups).map(groupURI => kb.sym(groupURI))
12589
12981
  groups.forEach(group => {
12590
12982
  if (selectedGroups[group.value]) {
12591
- const a = kb.each(group, ns.vcard('hasMember'), null, group.doc())
12592
- cards = cards.concat(a)
12983
+ cards = cards.concat((0,_contactLogic__WEBPACK_IMPORTED_MODULE_1__.groupMembers)(kb, group))
12593
12984
  }
12594
12985
  })
12595
12986
  cards.sort(compareForSort) // @@ sort by name not UID later
@@ -12749,8 +13140,42 @@ const style = solid_ui__WEBPACK_IMPORTED_MODULE_2__.style
12749
13140
  const groups = groupsInOrder()
12750
13141
  utils.syncTableToArrayReOrdered(groupsMainTable, groups, renderGroupRow)
12751
13142
  refreshGroupsSelected()
13143
+ checkDataModel(groups)
12752
13144
  } // syncGroupTable
12753
13145
 
13146
+ async function checkDataModel(groups) {
13147
+ // check if migration is needed in groups
13148
+ async function updateDataModel(groups) {
13149
+ let ds = []
13150
+ let ins = []
13151
+ groups.forEach(group => {
13152
+ let vcardOrWebids = kb.statementsMatching(null, ns.owl('sameAs'), null, group.doc()).map(st => st.subject)
13153
+ const strings = new Set(vcardOrWebids.map(contact => contact.uri)) // remove dups
13154
+ vcardOrWebids = [...strings].map(uri => kb.sym(uri))
13155
+ vcardOrWebids.forEach(item => {
13156
+ if (kb.each(item, ns.vcard('fn'), null, group.doc()).length) {
13157
+ // delete item, it is an old data model, item is a card not a webid.
13158
+ ds = ds.concat(kb
13159
+ .statementsMatching(item, ns.owl('sameAs'), null, group.doc())
13160
+ .concat(kb.statementsMatching(undefined, undefined, item, group.doc())))
13161
+ // add card webids to group
13162
+ const webids = kb.each(item, ns.owl('sameAs'), null, group.doc())
13163
+ webids.forEach(webid => {
13164
+ ins = ins.concat($rdf.st(webid, ns.owl('sameAs'), item, group.doc()))
13165
+ .concat($rdf.st(group, ns.vcard('hasMember'), webid, group.doc()))
13166
+ })
13167
+ }
13168
+ })
13169
+ })
13170
+ if (ds.length && confirm('Groups data model need to be updated ?')) {
13171
+ await kb.updater.updateMany(ds, ins)
13172
+ alert('Update done')
13173
+ }
13174
+ }
13175
+ await kb.fetcher.load(groups)
13176
+ updateDataModel(groups)
13177
+ } // checkDataModel
13178
+
12754
13179
  // Click on New Group button
12755
13180
  async function newGroupClickHandler (_event) {
12756
13181
  cardMain.innerHTML = ''
@@ -13104,28 +13529,50 @@ const style = solid_ui__WEBPACK_IMPORTED_MODULE_2__.style
13104
13529
  "use strict";
13105
13530
  __webpack_require__.r(__webpack_exports__);
13106
13531
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13532
+ /* harmony export */ "groupMembership": () => (/* binding */ groupMembership),
13107
13533
  /* harmony export */ "renderGroupMemberships": () => (/* binding */ renderGroupMemberships)
13108
13534
  /* harmony export */ });
13109
13535
  /* harmony import */ var solid_ui__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! solid-ui */ "./node_modules/solid-ui/lib/index.js");
13536
+ /* harmony import */ var solid_logic__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
13110
13537
  /* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
13111
13538
 
13112
13539
  // Render a control to record the group memberships we have for this agent
13113
13540
 
13114
13541
 
13542
+
13115
13543
  // const $rdf = UI.rdf
13116
13544
  const ns = solid_ui__WEBPACK_IMPORTED_MODULE_0__.ns
13117
13545
  // const buttons = UI.buttonsn no
13118
13546
  // const widgets = UI.widgets
13119
13547
  const utils = solid_ui__WEBPACK_IMPORTED_MODULE_0__.utils
13120
13548
  // const style = UI.style
13549
+ const kb = solid_logic__WEBPACK_IMPORTED_MODULE_1__.store
13121
13550
 
13122
13551
  // Groups the person is a member of
13552
+ function groupMembership (person) {
13553
+ let groups = kb.statementsMatching(null, ns.owl('sameAs'), person).map(st => st.why)
13554
+ .concat(kb.each(null, ns.vcard('hasMember'), person))
13555
+ const strings = new Set(groups.map(group => group.uri)) // remove dups
13556
+ groups = [...strings].map(uri => kb.sym(uri))
13557
+ return groups
13558
+ }
13559
+
13123
13560
  async function renderGroupMemberships (person, context) {
13124
13561
  // Remove a person from a group
13125
13562
  async function removeFromGroup (thing, group) {
13126
13563
  const pname = kb.any(thing, ns.vcard('fn'))
13127
13564
  const gname = kb.any(group, ns.vcard('fn'))
13128
- const groups = kb.each(null, ns.vcard('hasMember'), thing)
13565
+ // find all WebIDs of thing
13566
+ const thingwebids = kb.each(null, ns.owl('sameAs'), thing, group.doc())
13567
+ // WebID can be deleted only if not used in another thing
13568
+ let webids = []
13569
+ thingwebids.map(webid => {
13570
+ if (kb.statementsMatching(webid, ns.owl('sameAs'), thing, group.doc())) webids = webids.concat(webid)
13571
+ }
13572
+ )
13573
+ let thingOrWebid = thing
13574
+ if (webids.length > 0) thingOrWebid = webids[0]
13575
+ const groups = kb.each(null, ns.vcard('hasMember'), thingOrWebid) // in all groups a person has same structure
13129
13576
  if (groups.length < 2) {
13130
13577
  alert(
13131
13578
  'Must be a member of at least one group. Add to another group first.'
@@ -13134,9 +13581,14 @@ async function renderGroupMemberships (person, context) {
13134
13581
  }
13135
13582
  const message = 'Remove ' + pname + ' from group ' + gname + '?'
13136
13583
  if (confirm(message)) {
13137
- const del = kb
13584
+ let del = kb
13138
13585
  .statementsMatching(person, undefined, undefined, group.doc())
13139
13586
  .concat(kb.statementsMatching(undefined, undefined, person, group.doc()))
13587
+ webids.map(webid => {
13588
+ if (kb.statementsMatching(webid, ns.owl('sameAs'), undefined, group.doc()).length < 2) {
13589
+ del = del.concat(kb.statementsMatching(undefined, undefined, webid, group.doc()))
13590
+ }
13591
+ })
13140
13592
  kb.updater.update(del, [], function (uri, ok, err) {
13141
13593
  if (!ok) {
13142
13594
  const message = 'Error removing member from group ' + group + ': ' + err
@@ -13162,10 +13614,10 @@ async function renderGroupMemberships (person, context) {
13162
13614
  return tr
13163
13615
  }
13164
13616
 
13617
+ // find all groups where person has membership
13165
13618
  function syncGroupList () {
13166
- const groups = kb.each(null, ns.vcard('hasMember'), person)
13167
-
13168
- utils.syncTableToArray(groupList, groups, newRowForGroup)
13619
+ // person and/or WebIDs to be changed
13620
+ utils.syncTableToArray(groupList, groupMembership(person), newRowForGroup)
13169
13621
  }
13170
13622
 
13171
13623
  async function loadGroupsFromBook (book = null) {
@@ -16212,7 +16664,9 @@ function toolsPane (
16212
16664
  function stats () {
16213
16665
  const totalCards = kb.each(undefined, VCARD('inAddressBook'), book).length
16214
16666
  log('' + totalCards + ' cards loaded. ')
16215
- const groups = kb.each(book, VCARD('includesGroup'))
16667
+ let groups = kb.each(book, VCARD('includesGroup'))
16668
+ const strings = new Set(groups.map(group => group.uri)) // remove dups
16669
+ groups = [...strings].map(uri => kb.sym(uri))
16216
16670
  log('' + groups.length + ' total groups. ')
16217
16671
  const gg = []
16218
16672
  for (const g in selectedGroups) {
@@ -16264,7 +16718,7 @@ function toolsPane (
16264
16718
 
16265
16719
  for (let i = 0; i < gg.length; i++) {
16266
16720
  const g = kb.sym(gg[i])
16267
- const a = kb.each(g, ns.vcard('hasMember'))
16721
+ const a = (0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.groupMembers)(kb, g)
16268
16722
  log(solid_ui__WEBPACK_IMPORTED_MODULE_0__.utils.label(g) + ': ' + a.length + ' members')
16269
16723
  for (let j = 0; j < a.length; j++) {
16270
16724
  const card = a[j]
@@ -16484,6 +16938,7 @@ function toolsPane (
16484
16938
  const other = stats.nameLessIndex[cardText]
16485
16939
  if (other) {
16486
16940
  log(' Matches with ' + other)
16941
+ // alain not sure it works we may need to concat with 'sameAs' group.doc (.map(st => st.why))
16487
16942
  const cardGroups = kb.each(null, ns.vcard('hasMember'), card)
16488
16943
  const otherGroups = kb.each(null, ns.vcard('hasMember'), other)
16489
16944
  for (let j = 0; j < cardGroups.length; j++) {
@@ -16559,9 +17014,9 @@ function toolsPane (
16559
17014
  for (let i = 0; i < stats.uniques.length; i++) {
16560
17015
  stats.uniquesSet[stats.uniques[i].uri] = true
16561
17016
  }
16562
- stats.groupMembers = kb
16563
- .statementsMatching(null, ns.vcard('hasMember'))
16564
- .map(st => st.object)
17017
+ stats.groupMembers = []
17018
+ kb.each(null, ns.vcard('hasMember'))
17019
+ .map(group => { stats.groupMembers = stats.groupMembers.concat((0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.groupMembers)(kb, group)) })
16565
17020
  log(' Naive group members ' + stats.groupMembers.length)
16566
17021
  stats.groupMemberSet = []
16567
17022
  for (let j = 0; j < stats.groupMembers.length; j++) {
@@ -16702,7 +17157,10 @@ function toolsPane (
16702
17157
  log(' Regenerating group of uniques...' + cleanGroup)
16703
17158
  const data = sz.statementsToN3(sts)
16704
17159
 
16705
- return kb.fetcher.webOperation('PUT', cleanGroup, { data })
17160
+ return kb.fetcher.webOperation('PUT', cleanGroup, {
17161
+ data: data,
17162
+ contentType: 'text/turtle'
17163
+ })
16706
17164
  })
16707
17165
  .then(() => {
16708
17166
  log(' Done uniques group ' + cleanGroup)
@@ -16742,12 +17200,14 @@ function toolsPane (
16742
17200
  .then(scanForDuplicates)
16743
17201
  .then(checkGroupMembers)
16744
17202
  .then(checkAllNameless)
16745
- .then((resolve, reject) => {
16746
- if (confirm('Write new clean versions?')) {
16747
- resolve(true)
16748
- } else {
16749
- reject()
16750
- }
17203
+ .then(() => {
17204
+ return new Promise(function (resolve, reject) {
17205
+ if (confirm('Write new clean versions?')) {
17206
+ resolve(true)
17207
+ } else {
17208
+ reject()
17209
+ }
17210
+ })
16751
17211
  })
16752
17212
  .then(saveCleanPeople)
16753
17213
  .then(saveAllGroups)
@@ -16787,13 +17247,15 @@ function toolsPane (
16787
17247
 
16788
17248
  const reverseIndex = {}
16789
17249
  const groupless = []
16790
- const groups = kb.each(book, VCARD('includesGroup'))
16791
-
17250
+ let groups = kb.each(book, VCARD('includesGroup'))
17251
+ const strings = new Set(groups.map(group => group.uri)) // remove dups
17252
+ groups = [...strings].map(uri => kb.sym(uri))
16792
17253
  log('' + groups.length + ' total groups. ')
16793
17254
 
16794
17255
  for (let i = 0; i < groups.length; i++) {
16795
17256
  const g = groups[i]
16796
- const a = kb.each(g, ns.vcard('hasMember'))
17257
+ const a = (0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.groupMembers)(kb, g)
17258
+
16797
17259
  log(solid_ui__WEBPACK_IMPORTED_MODULE_0__.utils.label(g) + ': ' + a.length + ' members')
16798
17260
  for (let j = 0; j < a.length; j++) {
16799
17261
  kb.allAliases(a[j]).forEach(function (y) {
@@ -16841,6 +17303,46 @@ function toolsPane (
16841
17303
  fixGrouplessButton.style.cssText = buttonStyle
16842
17304
  fixGrouplessButton.textContent = 'Put all individuals with no group in a new group'
16843
17305
  fixGrouplessButton.addEventListener('click', _event => fixGroupless(book))
17306
+
17307
+ async function fixToOldDataModel (book) {
17308
+ async function updateToOldDataModel(groups) {
17309
+ let ds = []
17310
+ let ins = []
17311
+ groups.forEach(group => {
17312
+ let vcardOrWebids = kb.statementsMatching(null, ns.owl('sameAs'), null, group.doc()).map(st => st.subject)
17313
+ const strings = new Set(vcardOrWebids.map(contact => contact.uri)) // remove dups
17314
+ vcardOrWebids = [...strings].map(uri => kb.sym(uri))
17315
+ vcardOrWebids.forEach(item => {
17316
+ if (!kb.each(item, ns.vcard('fn'), null, group.doc()).length) {
17317
+ // delete item this is a new data model, item is a webid not a card.
17318
+ ds = ds.concat(kb
17319
+ .statementsMatching(item, ns.owl('sameAs'), null, group.doc())
17320
+ .concat(kb.statementsMatching(undefined, undefined, item, group.doc())))
17321
+ // add webid card to group
17322
+ const cards = kb.each(item, ns.owl('sameAs'), null, group.doc())
17323
+ cards.forEach(card => {
17324
+ ins = ins.concat($rdf.st(card, ns.owl('sameAs'), item, group.doc()))
17325
+ .concat($rdf.st(group, ns.vcard('hasMember'), card, group.doc()))
17326
+ })
17327
+ }
17328
+ })
17329
+ })
17330
+ if (ds.length && confirm('Groups can be updated to old data model ?')) {
17331
+ await kb.updater.updateMany(ds, ins)
17332
+ alert('Update done')
17333
+ } else { if (!ds.length) alert('Nothing to update.\nAll Groups already use the old data model.')}
17334
+ }
17335
+ let groups = kb.each(book, VCARD('includesGroup'))
17336
+ const strings = new Set(groups.map(group => group.uri)) // remove dups
17337
+ groups = [...strings].map(uri => kb.sym(uri))
17338
+ updateToOldDataModel(groups)
17339
+ }
17340
+
17341
+ const fixToOldDataModelButton = pane.appendChild(dom.createElement('button'))
17342
+ fixToOldDataModelButton.style.cssText = buttonStyle
17343
+ fixToOldDataModelButton.textContent = 'Revert groups to old data model'
17344
+ fixToOldDataModelButton.addEventListener('click', _event => fixToOldDataModel(book))
17345
+
16844
17346
  } // main
16845
17347
  main()
16846
17348
  return pane
@@ -16930,12 +17432,18 @@ async function addWebIDToContacts (person, webid, urlType, kb) {
16930
17432
  $rdf.st(vcardURLThing, ns.rdf('type'), urlType, person.doc()),
16931
17433
  $rdf.st(vcardURLThing, ns.vcard('value'), webid, person.doc())
16932
17434
  ]
17435
+ // insert WebID in groups
17436
+ // replace person with WebID in vcard:hasMember (WebID may already exist)
17437
+ // insert owl:sameAs
16933
17438
  const groups = kb.each(null, ns.vcard('hasMember'), person)
17439
+ let deletables = []
16934
17440
  groups.forEach(group => {
16935
- insertables.push($rdf.st(person, ns.owl('sameAs'), kb.sym(webid), group.doc()))
17441
+ deletables = deletables.concat(kb.statementsMatching(group, ns.vcard('hasMember'), person, group.doc()))
17442
+ insertables.push($rdf.st(group, ns.vcard('hasMember'), kb.sym(webid), group.doc())) // May exist; do we need to check?
17443
+ insertables.push($rdf.st(kb.sym(webid), ns.owl('sameAs'), person, group.doc()))
16936
17444
  })
16937
17445
  try {
16938
- await (0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.updateMany)([], insertables)
17446
+ await (0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.updateMany)(deletables, insertables)
16939
17447
  } catch (err) { throw new Error(`Could not create webId ${WEBID_NOUN}: ${webid}.`) }
16940
17448
  }
16941
17449
 
@@ -16958,12 +17466,17 @@ async function removeWebIDFromContacts (person, webid, urlType, kb) {
16958
17466
  await kb.updater.update(deletables, [])
16959
17467
 
16960
17468
  // remove webIDs from groups
16961
- const groups = kb.each(null, ns.vcard('hasMember'), person)
16962
- const removeFromGroups = []
16963
- groups.forEach(group => {
16964
- removeFromGroups.push($rdf.st(person, ns.owl('sameAs'), kb.sym(webid), group.doc()))
17469
+ const groups = kb.each(null, ns.vcard('hasMember'), kb.sym(webid))
17470
+ let removeFromGroups = []
17471
+ const insertInGroups = []
17472
+ groups.forEach(async group => {
17473
+ removeFromGroups = removeFromGroups.concat(kb.statementsMatching(kb.sym(webid), ns.owl('sameAs'), person, group.doc()))
17474
+ insertInGroups.push($rdf.st(group, ns.vcard('hasMember'), person, group.doc()))
17475
+ if (kb.statementsMatching(kb.sym(webid), ns.owl('sameAs'), null, group.doc()).length < 2) {
17476
+ removeFromGroups = removeFromGroups.concat(kb.statementsMatching(group, ns.vcard('hasMember'), kb.sym(webid), group.doc()))
17477
+ }
16965
17478
  })
16966
- await (0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.updateMany)(removeFromGroups)
17479
+ await (0,_contactLogic__WEBPACK_IMPORTED_MODULE_2__.updateMany)(removeFromGroups, insertInGroups)
16967
17480
  }
16968
17481
 
16969
17482
  // Trace things the same as this - other IDs for same thing
@@ -46463,8 +46976,8 @@ module.exports = class IdentifierIssuer {
46463
46976
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
46464
46977
 
46465
46978
  "use strict";
46466
- /*
46467
- * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
46979
+ /*!
46980
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
46468
46981
  */
46469
46982
 
46470
46983
 
@@ -46472,8 +46985,6 @@ __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediat
46472
46985
 
46473
46986
  const crypto = self.crypto || self.msCrypto;
46474
46987
 
46475
- // TODO: synchronous version no longer supported in browser
46476
-
46477
46988
  module.exports = class MessageDigest {
46478
46989
  /**
46479
46990
  * Creates a new MessageDigest.
@@ -46491,7 +47002,7 @@ module.exports = class MessageDigest {
46491
47002
  } else if(algorithm === 'sha1') {
46492
47003
  this.algorithm = {name: 'SHA-1'};
46493
47004
  } else {
46494
- throw new Error(`Unsupport algorithm "${algorithm}".`);
47005
+ throw new Error(`Unsupported algorithm "${algorithm}".`);
46495
47006
  }
46496
47007
  this._content = '';
46497
47008
  }
@@ -46523,8 +47034,8 @@ module.exports = class MessageDigest {
46523
47034
  /***/ ((module) => {
46524
47035
 
46525
47036
  "use strict";
46526
- /*
46527
- * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
47037
+ /*!
47038
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
46528
47039
  */
46529
47040
 
46530
47041
 
@@ -46725,18 +47236,16 @@ module.exports = class NQuads {
46725
47236
  }
46726
47237
 
46727
47238
  /**
46728
- * Converts an RDF quad to an N-Quad string (a single quad).
47239
+ * Converts RDF quad components to an N-Quad string (a single quad).
46729
47240
  *
46730
- * @param quad the RDF quad convert.
47241
+ * @param {Object} s - N-Quad subject component.
47242
+ * @param {Object} p - N-Quad predicate component.
47243
+ * @param {Object} o - N-Quad object component.
47244
+ * @param {Object} g - N-Quad graph component.
46731
47245
  *
46732
- * @return the N-Quad string.
47246
+ * @return {string} the N-Quad.
46733
47247
  */
46734
- static serializeQuad(quad) {
46735
- const s = quad.subject;
46736
- const p = quad.predicate;
46737
- const o = quad.object;
46738
- const g = quad.graph;
46739
-
47248
+ static serializeQuadComponents(s, p, o, g) {
46740
47249
  let nquad = '';
46741
47250
 
46742
47251
  // subject can only be NamedNode or BlankNode
@@ -46777,6 +47286,18 @@ module.exports = class NQuads {
46777
47286
  return nquad;
46778
47287
  }
46779
47288
 
47289
+ /**
47290
+ * Converts an RDF quad to an N-Quad string (a single quad).
47291
+ *
47292
+ * @param quad the RDF quad convert.
47293
+ *
47294
+ * @return the N-Quad string.
47295
+ */
47296
+ static serializeQuad(quad) {
47297
+ return NQuads.serializeQuadComponents(
47298
+ quad.subject, quad.predicate, quad.object, quad.graph);
47299
+ }
47300
+
46780
47301
  /**
46781
47302
  * Converts a legacy-formatted dataset to an array of quads dataset per
46782
47303
  * http://rdf.js.org/.
@@ -46927,13 +47448,11 @@ function _unescape(s) {
46927
47448
  /***/ ((module) => {
46928
47449
 
46929
47450
  "use strict";
46930
- /*
46931
- * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
47451
+ /*!
47452
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
46932
47453
  */
46933
47454
 
46934
47455
 
46935
- // TODO: convert to ES6 iterable?
46936
-
46937
47456
  module.exports = class Permuter {
46938
47457
  /**
46939
47458
  * A Permuter iterates over all possible permutations of the given array
@@ -47023,7 +47542,7 @@ module.exports = class Permuter {
47023
47542
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
47024
47543
 
47025
47544
  "use strict";
47026
- /*
47545
+ /*!
47027
47546
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
47028
47547
  */
47029
47548
 
@@ -47034,11 +47553,14 @@ const Permuter = __webpack_require__(/*! ./Permuter */ "./node_modules/rdf-canon
47034
47553
  const NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/lib/NQuads.js");
47035
47554
 
47036
47555
  module.exports = class URDNA2015 {
47037
- constructor({maxDeepIterations = Infinity} = {}) {
47556
+ constructor({
47557
+ createMessageDigest = () => new MessageDigest('sha256'),
47558
+ maxDeepIterations = Infinity
47559
+ } = {}) {
47038
47560
  this.name = 'URDNA2015';
47039
47561
  this.blankNodeInfo = new Map();
47040
47562
  this.canonicalIssuer = new IdentifierIssuer('_:c14n');
47041
- this.hashAlgorithm = 'sha256';
47563
+ this.createMessageDigest = createMessageDigest;
47042
47564
  this.maxDeepIterations = maxDeepIterations;
47043
47565
  this.quads = null;
47044
47566
  this.deepIterations = null;
@@ -47173,13 +47695,15 @@ module.exports = class URDNA2015 {
47173
47695
  // 7.1) Create a copy, quad copy, of quad and replace any existing
47174
47696
  // blank node identifiers using the canonical identifiers
47175
47697
  // previously issued by canonical issuer.
47176
- // Note: We optimize with shallow copies here.
47177
- const q = {...quad};
47178
- q.subject = this._useCanonicalId({component: q.subject});
47179
- q.object = this._useCanonicalId({component: q.object});
47180
- q.graph = this._useCanonicalId({component: q.graph});
47698
+ // Note: We optimize away the copy here.
47699
+ const nQuad = NQuads.serializeQuadComponents(
47700
+ this._componentWithCanonicalId(quad.subject),
47701
+ quad.predicate,
47702
+ this._componentWithCanonicalId(quad.object),
47703
+ this._componentWithCanonicalId(quad.graph)
47704
+ );
47181
47705
  // 7.2) Add quad copy to the normalized dataset.
47182
- normalized.push(NQuads.serializeQuad(q));
47706
+ normalized.push(nQuad);
47183
47707
  }
47184
47708
 
47185
47709
  // sort normalized output
@@ -47227,7 +47751,7 @@ module.exports = class URDNA2015 {
47227
47751
 
47228
47752
  // 5) Return the hash that results from passing the sorted, joined nquads
47229
47753
  // through the hash algorithm.
47230
- const md = new MessageDigest(this.hashAlgorithm);
47754
+ const md = this.createMessageDigest();
47231
47755
  for(const nquad of nquads) {
47232
47756
  md.update(nquad);
47233
47757
  }
@@ -47252,7 +47776,7 @@ module.exports = class URDNA2015 {
47252
47776
 
47253
47777
  // 2) Initialize a string input to the value of position.
47254
47778
  // Note: We use a hash object instead.
47255
- const md = new MessageDigest(this.hashAlgorithm);
47779
+ const md = this.createMessageDigest();
47256
47780
  md.update(position);
47257
47781
 
47258
47782
  // 3) If position is not g, append <, the value of the predicate in quad,
@@ -47281,7 +47805,7 @@ module.exports = class URDNA2015 {
47281
47805
  // 1) Create a hash to related blank nodes map for storing hashes that
47282
47806
  // identify related blank nodes.
47283
47807
  // Note: 2) and 3) handled within `createHashToRelated`
47284
- const md = new MessageDigest(this.hashAlgorithm);
47808
+ const md = this.createMessageDigest();
47285
47809
  const hashToRelated = await this.createHashToRelated(id, issuer);
47286
47810
 
47287
47811
  // 4) Create an empty string, data to hash.
@@ -47524,9 +48048,11 @@ module.exports = class URDNA2015 {
47524
48048
  }
47525
48049
  }
47526
48050
 
47527
- _useCanonicalId({component}) {
48051
+ // canonical ids for 7.1
48052
+ _componentWithCanonicalId(component) {
47528
48053
  if(component.termType === 'BlankNode' &&
47529
48054
  !component.value.startsWith(this.canonicalIssuer.prefix)) {
48055
+ // create new BlankNode
47530
48056
  return {
47531
48057
  termType: 'BlankNode',
47532
48058
  value: this.canonicalIssuer.getId(component.value)
@@ -47554,22 +48080,27 @@ function _stringHashCompare(a, b) {
47554
48080
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
47555
48081
 
47556
48082
  "use strict";
47557
- /*
48083
+ /*!
47558
48084
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
47559
48085
  */
47560
48086
 
47561
48087
 
47562
48088
  const IdentifierIssuer = __webpack_require__(/*! ./IdentifierIssuer */ "./node_modules/rdf-canonize/lib/IdentifierIssuer.js");
48089
+ // FIXME: do not import; convert to requiring a
48090
+ // hash factory
47563
48091
  const MessageDigest = __webpack_require__(/*! ./MessageDigest */ "./node_modules/rdf-canonize/lib/MessageDigest-browser.js");
47564
48092
  const Permuter = __webpack_require__(/*! ./Permuter */ "./node_modules/rdf-canonize/lib/Permuter.js");
47565
48093
  const NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/lib/NQuads.js");
47566
48094
 
47567
48095
  module.exports = class URDNA2015Sync {
47568
- constructor({maxDeepIterations = Infinity} = {}) {
48096
+ constructor({
48097
+ createMessageDigest = () => new MessageDigest('sha256'),
48098
+ maxDeepIterations = Infinity
48099
+ } = {}) {
47569
48100
  this.name = 'URDNA2015';
47570
48101
  this.blankNodeInfo = new Map();
47571
48102
  this.canonicalIssuer = new IdentifierIssuer('_:c14n');
47572
- this.hashAlgorithm = 'sha256';
48103
+ this.createMessageDigest = createMessageDigest;
47573
48104
  this.maxDeepIterations = maxDeepIterations;
47574
48105
  this.quads = null;
47575
48106
  this.deepIterations = null;
@@ -47699,13 +48230,15 @@ module.exports = class URDNA2015Sync {
47699
48230
  // 7.1) Create a copy, quad copy, of quad and replace any existing
47700
48231
  // blank node identifiers using the canonical identifiers
47701
48232
  // previously issued by canonical issuer.
47702
- // Note: We optimize with shallow copies here.
47703
- const q = {...quad};
47704
- q.subject = this._useCanonicalId({component: q.subject});
47705
- q.object = this._useCanonicalId({component: q.object});
47706
- q.graph = this._useCanonicalId({component: q.graph});
48233
+ // Note: We optimize away the copy here.
48234
+ const nQuad = NQuads.serializeQuadComponents(
48235
+ this._componentWithCanonicalId({component: quad.subject}),
48236
+ quad.predicate,
48237
+ this._componentWithCanonicalId({component: quad.object}),
48238
+ this._componentWithCanonicalId({component: quad.graph})
48239
+ );
47707
48240
  // 7.2) Add quad copy to the normalized dataset.
47708
- normalized.push(NQuads.serializeQuad(q));
48241
+ normalized.push(nQuad);
47709
48242
  }
47710
48243
 
47711
48244
  // sort normalized output
@@ -47753,7 +48286,7 @@ module.exports = class URDNA2015Sync {
47753
48286
 
47754
48287
  // 5) Return the hash that results from passing the sorted, joined nquads
47755
48288
  // through the hash algorithm.
47756
- const md = new MessageDigest(this.hashAlgorithm);
48289
+ const md = this.createMessageDigest();
47757
48290
  for(const nquad of nquads) {
47758
48291
  md.update(nquad);
47759
48292
  }
@@ -47778,7 +48311,7 @@ module.exports = class URDNA2015Sync {
47778
48311
 
47779
48312
  // 2) Initialize a string input to the value of position.
47780
48313
  // Note: We use a hash object instead.
47781
- const md = new MessageDigest(this.hashAlgorithm);
48314
+ const md = this.createMessageDigest();
47782
48315
  md.update(position);
47783
48316
 
47784
48317
  // 3) If position is not g, append <, the value of the predicate in quad,
@@ -47807,7 +48340,7 @@ module.exports = class URDNA2015Sync {
47807
48340
  // 1) Create a hash to related blank nodes map for storing hashes that
47808
48341
  // identify related blank nodes.
47809
48342
  // Note: 2) and 3) handled within `createHashToRelated`
47810
- const md = new MessageDigest(this.hashAlgorithm);
48343
+ const md = this.createMessageDigest();
47811
48344
  const hashToRelated = this.createHashToRelated(id, issuer);
47812
48345
 
47813
48346
  // 4) Create an empty string, data to hash.
@@ -48037,9 +48570,11 @@ module.exports = class URDNA2015Sync {
48037
48570
  }
48038
48571
  }
48039
48572
 
48040
- _useCanonicalId({component}) {
48573
+ // canonical ids for 7.1
48574
+ _componentWithCanonicalId({component}) {
48041
48575
  if(component.termType === 'BlankNode' &&
48042
48576
  !component.value.startsWith(this.canonicalIssuer.prefix)) {
48577
+ // create new BlankNode
48043
48578
  return {
48044
48579
  termType: 'BlankNode',
48045
48580
  value: this.canonicalIssuer.getId(component.value)
@@ -48063,18 +48598,19 @@ function _stringHashCompare(a, b) {
48063
48598
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
48064
48599
 
48065
48600
  "use strict";
48066
- /*
48067
- * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
48601
+ /*!
48602
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
48068
48603
  */
48069
48604
 
48070
48605
 
48606
+ const MessageDigest = __webpack_require__(/*! ./MessageDigest */ "./node_modules/rdf-canonize/lib/MessageDigest-browser.js");
48071
48607
  const URDNA2015 = __webpack_require__(/*! ./URDNA2015 */ "./node_modules/rdf-canonize/lib/URDNA2015.js");
48072
48608
 
48073
48609
  module.exports = class URDNA2012 extends URDNA2015 {
48074
48610
  constructor() {
48075
48611
  super();
48076
48612
  this.name = 'URGNA2012';
48077
- this.hashAlgorithm = 'sha1';
48613
+ this.createMessageDigest = () => new MessageDigest('sha1');
48078
48614
  }
48079
48615
 
48080
48616
  // helper for modifying component during Hash First Degree Quads
@@ -48164,18 +48700,19 @@ module.exports = class URDNA2012 extends URDNA2015 {
48164
48700
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
48165
48701
 
48166
48702
  "use strict";
48167
- /*
48703
+ /*!
48168
48704
  * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
48169
48705
  */
48170
48706
 
48171
48707
 
48708
+ const MessageDigest = __webpack_require__(/*! ./MessageDigest */ "./node_modules/rdf-canonize/lib/MessageDigest-browser.js");
48172
48709
  const URDNA2015Sync = __webpack_require__(/*! ./URDNA2015Sync */ "./node_modules/rdf-canonize/lib/URDNA2015Sync.js");
48173
48710
 
48174
48711
  module.exports = class URDNA2012Sync extends URDNA2015Sync {
48175
48712
  constructor() {
48176
48713
  super();
48177
48714
  this.name = 'URGNA2012';
48178
- this.hashAlgorithm = 'sha1';
48715
+ this.createMessageDigest = () => new MessageDigest('sha1');
48179
48716
  }
48180
48717
 
48181
48718
  // helper for modifying component during Hash First Degree Quads
@@ -48256,7 +48793,7 @@ module.exports = class URDNA2012Sync extends URDNA2015Sync {
48256
48793
  /*!************************************************!*\
48257
48794
  !*** ./node_modules/rdf-canonize/lib/index.js ***!
48258
48795
  \************************************************/
48259
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
48796
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
48260
48797
 
48261
48798
  "use strict";
48262
48799
  /**
@@ -48264,7 +48801,7 @@ module.exports = class URDNA2012Sync extends URDNA2015Sync {
48264
48801
  * This library works in the browser and node.js.
48265
48802
  *
48266
48803
  * BSD 3-Clause License
48267
- * Copyright (c) 2016-2021 Digital Bazaar, Inc.
48804
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc.
48268
48805
  * All rights reserved.
48269
48806
  *
48270
48807
  * Redistribution and use in source and binary forms, with or without
@@ -48306,12 +48843,9 @@ try {
48306
48843
  rdfCanonizeNative = __webpack_require__(/*! rdf-canonize-native */ "?2b19");
48307
48844
  } catch(e) {}
48308
48845
 
48309
- const api = {};
48310
- module.exports = api;
48311
-
48312
48846
  // expose helpers
48313
- api.NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/lib/NQuads.js");
48314
- api.IdentifierIssuer = __webpack_require__(/*! ./IdentifierIssuer */ "./node_modules/rdf-canonize/lib/IdentifierIssuer.js");
48847
+ exports.NQuads = __webpack_require__(/*! ./NQuads */ "./node_modules/rdf-canonize/lib/NQuads.js");
48848
+ exports.IdentifierIssuer = __webpack_require__(/*! ./IdentifierIssuer */ "./node_modules/rdf-canonize/lib/IdentifierIssuer.js");
48315
48849
 
48316
48850
  /**
48317
48851
  * Get or set native API.
@@ -48320,7 +48854,7 @@ api.IdentifierIssuer = __webpack_require__(/*! ./IdentifierIssuer */ "./node_mod
48320
48854
  *
48321
48855
  * @return the currently set native API.
48322
48856
  */
48323
- api._rdfCanonizeNative = function(api) {
48857
+ exports._rdfCanonizeNative = function(api) {
48324
48858
  if(api) {
48325
48859
  rdfCanonizeNative = api;
48326
48860
  }
@@ -48330,31 +48864,39 @@ api._rdfCanonizeNative = function(api) {
48330
48864
  /**
48331
48865
  * Asynchronously canonizes an RDF dataset.
48332
48866
  *
48333
- * @param dataset the dataset to canonize.
48334
- * @param options the options to use:
48335
- * algorithm the canonicalization algorithm to use, `URDNA2015` or
48336
- * `URGNA2012`.
48337
- * [useNative] use native implementation (default: false).
48338
- * [maxDeepIterations=Infinity] the maximum number of times to run
48339
- * deep comparison algorithms (such as the N-Degree Hash Quads
48340
- * algorithm used in URDNA2015) before bailing out and throwing an
48341
- * error; this is a useful setting for preventing wasted CPU cycles
48342
- * or DoS when canonizing meaningless or potentially malicious
48343
- * datasets, a recommended value is `1`.
48867
+ * @param {Array} dataset - The dataset to canonize.
48868
+ * @param {object} options - The options to use:
48869
+ * {string} algorithm - The canonicalization algorithm to use, `URDNA2015` or
48870
+ * `URGNA2012`.
48871
+ * {Function} [createMessageDigest] - A factory function for creating a
48872
+ * `MessageDigest` interface that overrides the built-in message digest
48873
+ * implementation used by the canonize algorithm; note that using a hash
48874
+ * algorithm (or HMAC algorithm) that differs from the one specified by
48875
+ * the canonize algorithm will result in different output.
48876
+ * {boolean} [useNative=false] - Use native implementation.
48877
+ * {number} [maxDeepIterations=Infinity] - The maximum number of times to run
48878
+ * deep comparison algorithms (such as the N-Degree Hash Quads algorithm
48879
+ * used in URDNA2015) before bailing out and throwing an error; this is a
48880
+ * useful setting for preventing wasted CPU cycles or DoS when canonizing
48881
+ * meaningless or potentially malicious datasets, a recommended value is
48882
+ * `1`.
48344
48883
  *
48345
48884
  * @return a Promise that resolves to the canonicalized RDF Dataset.
48346
48885
  */
48347
- api.canonize = async function(dataset, options) {
48886
+ exports.canonize = async function(dataset, options) {
48348
48887
  // back-compat with legacy dataset
48349
48888
  if(!Array.isArray(dataset)) {
48350
- dataset = api.NQuads.legacyDatasetToQuads(dataset);
48889
+ dataset = exports.NQuads.legacyDatasetToQuads(dataset);
48351
48890
  }
48352
48891
 
48353
48892
  if(options.useNative) {
48354
48893
  if(!rdfCanonizeNative) {
48355
48894
  throw new Error('rdf-canonize-native not available');
48356
48895
  }
48357
- // TODO: convert native algorithm to Promise-based async
48896
+ if(options.createMessageDigest) {
48897
+ throw new Error(
48898
+ '"createMessageDigest" cannot be used with "useNative".');
48899
+ }
48358
48900
  return new Promise((resolve, reject) =>
48359
48901
  rdfCanonizeNative.canonize(dataset, options, (err, canonical) =>
48360
48902
  err ? reject(err) : resolve(canonical)));
@@ -48364,6 +48906,10 @@ api.canonize = async function(dataset, options) {
48364
48906
  return new URDNA2015(options).main(dataset);
48365
48907
  }
48366
48908
  if(options.algorithm === 'URGNA2012') {
48909
+ if(options.createMessageDigest) {
48910
+ throw new Error(
48911
+ '"createMessageDigest" cannot be used with "URGNA2012".');
48912
+ }
48367
48913
  return new URGNA2012(options).main(dataset);
48368
48914
  }
48369
48915
  if(!('algorithm' in options)) {
@@ -48378,36 +48924,49 @@ api.canonize = async function(dataset, options) {
48378
48924
  * only. It synchronously canonizes an RDF dataset and does not work in the
48379
48925
  * browser.
48380
48926
  *
48381
- * @param dataset the dataset to canonize.
48382
- * @param options the options to use:
48383
- * algorithm the canonicalization algorithm to use, `URDNA2015` or
48384
- * `URGNA2012`.
48385
- * [useNative] use native implementation (default: false).
48386
- * [maxDeepIterations=Infinity] the maximum number of times to run
48387
- * deep comparison algorithms (such as the N-Degree Hash Quads
48388
- * algorithm used in URDNA2015) before bailing out and throwing an
48389
- * error; this is a useful setting for preventing wasted CPU cycles
48390
- * or DoS when canonizing meaningless or potentially malicious
48391
- * datasets, a recommended value is `1`.
48927
+ * @param {Array} dataset - The dataset to canonize.
48928
+ * @param {object} options - The options to use:
48929
+ * {string} algorithm - The canonicalization algorithm to use, `URDNA2015` or
48930
+ * `URGNA2012`.
48931
+ * {Function} [createMessageDigest] - A factory function for creating a
48932
+ * `MessageDigest` interface that overrides the built-in message digest
48933
+ * implementation used by the canonize algorithm; note that using a hash
48934
+ * algorithm (or HMAC algorithm) that differs from the one specified by
48935
+ * the canonize algorithm will result in different output.
48936
+ * {boolean} [useNative=false] - Use native implementation.
48937
+ * {number} [maxDeepIterations=Infinity] - The maximum number of times to run
48938
+ * deep comparison algorithms (such as the N-Degree Hash Quads algorithm
48939
+ * used in URDNA2015) before bailing out and throwing an error; this is a
48940
+ * useful setting for preventing wasted CPU cycles or DoS when canonizing
48941
+ * meaningless or potentially malicious datasets, a recommended value is
48942
+ * `1`.
48392
48943
  *
48393
48944
  * @return the RDF dataset in canonical form.
48394
48945
  */
48395
- api._canonizeSync = function(dataset, options) {
48946
+ exports._canonizeSync = function(dataset, options) {
48396
48947
  // back-compat with legacy dataset
48397
48948
  if(!Array.isArray(dataset)) {
48398
- dataset = api.NQuads.legacyDatasetToQuads(dataset);
48949
+ dataset = exports.NQuads.legacyDatasetToQuads(dataset);
48399
48950
  }
48400
48951
 
48401
48952
  if(options.useNative) {
48402
- if(rdfCanonizeNative) {
48403
- return rdfCanonizeNative.canonizeSync(dataset, options);
48953
+ if(!rdfCanonizeNative) {
48954
+ throw new Error('rdf-canonize-native not available');
48404
48955
  }
48405
- throw new Error('rdf-canonize-native not available');
48956
+ if(options.createMessageDigest) {
48957
+ throw new Error(
48958
+ '"createMessageDigest" cannot be used with "useNative".');
48959
+ }
48960
+ return rdfCanonizeNative.canonizeSync(dataset, options);
48406
48961
  }
48407
48962
  if(options.algorithm === 'URDNA2015') {
48408
48963
  return new URDNA2015Sync(options).main(dataset);
48409
48964
  }
48410
48965
  if(options.algorithm === 'URGNA2012') {
48966
+ if(options.createMessageDigest) {
48967
+ throw new Error(
48968
+ '"createMessageDigest" cannot be used with "URGNA2012".');
48969
+ }
48411
48970
  return new URGNA2012Sync(options).main(dataset);
48412
48971
  }
48413
48972
  if(!('algorithm' in options)) {
@@ -48796,6 +49355,8 @@ var Collection = /*#__PURE__*/function (_Node) {
48796
49355
  }], [{
48797
49356
  key: "toNT",
48798
49357
  value: function toNT(collection) {
49358
+ // return '(' + collection.elements.map(x => x.toNT()).join(' ') + ')'
49359
+ // As lists are not in NT and toNT() must be a reversible function, we kludge it for a list
48799
49360
  return _blank_node__WEBPACK_IMPORTED_MODULE_9__["default"].NTAnonymousNodePrefix + collection.id;
48800
49361
  }
48801
49362
  }]);
@@ -52726,6 +53287,8 @@ __webpack_require__.r(__webpack_exports__);
52726
53287
  /* harmony export */ "isQuad": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isQuad),
52727
53288
  /* harmony export */ "isRDFObject": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isRDFObject),
52728
53289
  /* harmony export */ "isRDFlibObject": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isRDFlibObject),
53290
+ /* harmony export */ "isRDFlibPredicate": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isRDFlibPredicate),
53291
+ /* harmony export */ "isRDFlibSubject": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isRDFlibSubject),
52729
53292
  /* harmony export */ "isStatement": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStatement),
52730
53293
  /* harmony export */ "isStore": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isStore),
52731
53294
  /* harmony export */ "isSubject": () => (/* reexport safe */ _utils_terms__WEBPACK_IMPORTED_MODULE_11__.isSubject),
@@ -60682,6 +61245,13 @@ var Statement = /*#__PURE__*/function () {
60682
61245
  }, {
60683
61246
  key: "toString",
60684
61247
  value: function toString() {
61248
+ /*
61249
+ return [
61250
+ this.subject.toString(),
61251
+ this.predicate.toString(),
61252
+ this.object.toString(),
61253
+ ].join(' ') + ' .'
61254
+ */
60685
61255
  return this.toNT();
60686
61256
  }
60687
61257
  }]);
@@ -61179,11 +61749,11 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
61179
61749
  var objNode = _node__WEBPACK_IMPORTED_MODULE_13__["default"].fromValue(obj);
61180
61750
  why = _node__WEBPACK_IMPORTED_MODULE_13__["default"].fromValue(why);
61181
61751
 
61182
- if (!(0,_utils_terms__WEBPACK_IMPORTED_MODULE_12__.isSubject)(subj)) {
61752
+ if (!(0,_utils_terms__WEBPACK_IMPORTED_MODULE_12__.isRDFlibSubject)(subj)) {
61183
61753
  throw new Error('Subject is not a subject type');
61184
61754
  }
61185
61755
 
61186
- if (!(0,_utils_terms__WEBPACK_IMPORTED_MODULE_12__.isPredicate)(pred)) {
61756
+ if (!(0,_utils_terms__WEBPACK_IMPORTED_MODULE_12__.isRDFlibPredicate)(pred)) {
61187
61757
  throw new Error("Predicate ".concat(pred, " is not a predicate type"));
61188
61758
  }
61189
61759
 
@@ -61740,7 +62310,7 @@ var IndexedFormula = /*#__PURE__*/function (_Formula) {
61740
62310
  }, {
61741
62311
  key: "removeMatches",
61742
62312
  value: function removeMatches(subject, predicate, object, graph) {
61743
- this.removeStatements(this.statementsMatching(subject, predicate, object, graph));
62313
+ this.removeMany(subject, predicate, object, graph);
61744
62314
  return this;
61745
62315
  }
61746
62316
  /**
@@ -62143,7 +62713,6 @@ __webpack_require__.r(__webpack_exports__);
62143
62713
  /* harmony import */ var _utils_terms__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/terms */ "./node_modules/rdflib/esm/utils/terms.js");
62144
62714
  /* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils-js */ "./node_modules/rdflib/esm/utils-js.js");
62145
62715
  /* harmony import */ var _utils_termValue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/termValue */ "./node_modules/rdflib/esm/utils/termValue.js");
62146
- /* provided dependency */ var console = __webpack_require__(/*! ./node_modules/console-browserify/index.js */ "./node_modules/console-browserify/index.js");
62147
62716
 
62148
62717
 
62149
62718
 
@@ -62935,8 +63504,7 @@ var UpdateManager = /*#__PURE__*/function () {
62935
63504
  }));
62936
63505
  });
62937
63506
 
62938
- if (updates.length > 1) {
62939
- console.log("@@ updateMany to ".concat(updates.length, ": ").concat(uniqueDocs));
63507
+ if (updates.length > 1) {// console.log(`@@ updateMany to ${updates.length}: ${uniqueDocs}`)
62940
63508
  }
62941
63509
 
62942
63510
  return Promise.all(updates);
@@ -63110,7 +63678,10 @@ var UpdateManager = /*#__PURE__*/function () {
63110
63678
 
63111
63679
  this.fire(doc.value, query, function (uri, success, body, response) {
63112
63680
  response.elapsedTimeMs = Date.now() - startTime;
63113
- console.log(' UpdateManager: Return ' + (success ? 'success ' : 'FAILURE ') + response.status + ' elapsed ' + response.elapsedTimeMs + 'ms');
63681
+ /* console.log(' UpdateManager: Return ' +
63682
+ (success ? 'success ' : 'FAILURE ') + (response as Response).status +
63683
+ ' elapsed ' + (response as any).elapsedTimeMs + 'ms')
63684
+ */
63114
63685
 
63115
63686
  if (success) {
63116
63687
  try {
@@ -64452,6 +65023,8 @@ __webpack_require__.r(__webpack_exports__);
64452
65023
  /* harmony export */ "isQuad": () => (/* binding */ isQuad),
64453
65024
  /* harmony export */ "isRDFObject": () => (/* binding */ isRDFObject),
64454
65025
  /* harmony export */ "isRDFlibObject": () => (/* binding */ isRDFlibObject),
65026
+ /* harmony export */ "isRDFlibPredicate": () => (/* binding */ isRDFlibPredicate),
65027
+ /* harmony export */ "isRDFlibSubject": () => (/* binding */ isRDFlibSubject),
64455
65028
  /* harmony export */ "isStatement": () => (/* binding */ isStatement),
64456
65029
  /* harmony export */ "isStore": () => (/* binding */ isStore),
64457
65030
  /* harmony export */ "isSubject": () => (/* binding */ isSubject),
@@ -64477,11 +65050,22 @@ function isStore(obj) {
64477
65050
  function isCollection(obj) {
64478
65051
  return isTerm(obj) && obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.CollectionTermType;
64479
65052
  }
64480
- /** TypeGuard for valid RDFlib Object types, also allows Collections */
65053
+ /** TypeGuard for valid RDFlib Object types, also allows Collections, Graphs */
64481
65054
 
64482
65055
  function isRDFlibObject(obj) {
64483
65056
  return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.NamedNodeTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.VariableTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.BlankNodeTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.CollectionTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.LiteralTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.GraphTermType);
64484
65057
  }
65058
+ /** TypeGuard for valid RDFlib Subject types, same as Object as RDFLib symmetrical.
65059
+ */
65060
+
65061
+ function isRDFlibSubject(obj) {
65062
+ return obj && Object.prototype.hasOwnProperty.call(obj, 'termType') && (obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.NamedNodeTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.VariableTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.BlankNodeTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.CollectionTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.LiteralTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.GraphTermType);
65063
+ }
65064
+ /** TypeGuard for valid RDF/JS spec Predicate types */
65065
+
65066
+ function isRDFlibPredicate(obj) {
65067
+ return isTerm(obj) && (obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.NamedNodeTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.BlankNodeTermType || obj.termType === _types__WEBPACK_IMPORTED_MODULE_1__.VariableTermType);
65068
+ }
64485
65069
  /** TypeGuard for RDFLib Variables */
64486
65070
 
64487
65071
  function isVariable(obj) {
@@ -110740,10 +111324,10 @@ Object.defineProperty(exports, "__esModule", ({
110740
111324
  }));
110741
111325
  exports["default"] = void 0;
110742
111326
  var _default = {
110743
- buildTime: "2022-09-01T20:30:09Z",
110744
- commit: "d42788cf287fb2bc47984405dbd6de9dec4469c3",
111327
+ buildTime: "2022-11-08T15:35:58Z",
111328
+ commit: "8089a8e00d37850bfc06b79394eed8a0994efb4a",
110745
111329
  npmInfo: {
110746
- 'solid-panes': '3.5.26',
111330
+ 'solid-panes': '3.5.28-alpha',
110747
111331
  npm: '8.18.0',
110748
111332
  node: '14.17.3',
110749
111333
  v8: '8.4.371.23-node.67',
@@ -143480,7 +144064,6 @@ function _defineProperties(target, props) {
143480
144064
  Object.defineProperty(target, descriptor.key, descriptor);
143481
144065
  }
143482
144066
  }
143483
-
143484
144067
  function _createClass(Constructor, protoProps, staticProps) {
143485
144068
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
143486
144069
  if (staticProps) _defineProperties(Constructor, staticProps);
@@ -143489,7 +144072,6 @@ function _createClass(Constructor, protoProps, staticProps) {
143489
144072
  });
143490
144073
  return Constructor;
143491
144074
  }
143492
-
143493
144075
  function _unsupportedIterableToArray(o, minLen) {
143494
144076
  if (!o) return;
143495
144077
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -143498,19 +144080,14 @@ function _unsupportedIterableToArray(o, minLen) {
143498
144080
  if (n === "Map" || n === "Set") return Array.from(o);
143499
144081
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
143500
144082
  }
143501
-
143502
144083
  function _arrayLikeToArray(arr, len) {
143503
144084
  if (len == null || len > arr.length) len = arr.length;
143504
-
143505
144085
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
143506
-
143507
144086
  return arr2;
143508
144087
  }
143509
-
143510
144088
  function _createForOfIteratorHelperLoose(o, allowArrayLike) {
143511
144089
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
143512
144090
  if (it) return (it = it.call(o)).next.bind(it);
143513
-
143514
144091
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
143515
144092
  if (it) o = it;
143516
144093
  var i = 0;
@@ -143524,7 +144101,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
143524
144101
  };
143525
144102
  };
143526
144103
  }
143527
-
143528
144104
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
143529
144105
  }
143530
144106
 
@@ -143545,7 +144121,6 @@ function getDefaults() {
143545
144121
  sanitize: false,
143546
144122
  sanitizer: null,
143547
144123
  silent: false,
143548
- smartLists: false,
143549
144124
  smartypants: false,
143550
144125
  tokenizer: null,
143551
144126
  walkTokens: null,
@@ -143571,11 +144146,9 @@ var escapeReplacements = {
143571
144146
  '"': '&quot;',
143572
144147
  "'": '&#39;'
143573
144148
  };
143574
-
143575
144149
  var getEscapeReplacement = function getEscapeReplacement(ch) {
143576
144150
  return escapeReplacements[ch];
143577
144151
  };
143578
-
143579
144152
  function escape(html, encode) {
143580
144153
  if (encode) {
143581
144154
  if (escapeTest.test(html)) {
@@ -143586,33 +144159,30 @@ function escape(html, encode) {
143586
144159
  return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
143587
144160
  }
143588
144161
  }
143589
-
143590
144162
  return html;
143591
144163
  }
143592
144164
  var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
144165
+
143593
144166
  /**
143594
144167
  * @param {string} html
143595
144168
  */
143596
-
143597
144169
  function unescape(html) {
143598
144170
  // explicitly match decimal, hex, and named HTML entities
143599
144171
  return html.replace(unescapeTest, function (_, n) {
143600
144172
  n = n.toLowerCase();
143601
144173
  if (n === 'colon') return ':';
143602
-
143603
144174
  if (n.charAt(0) === '#') {
143604
144175
  return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
143605
144176
  }
143606
-
143607
144177
  return '';
143608
144178
  });
143609
144179
  }
143610
144180
  var caret = /(^|[^\[])\^/g;
144181
+
143611
144182
  /**
143612
144183
  * @param {string | RegExp} regex
143613
144184
  * @param {string} opt
143614
144185
  */
143615
-
143616
144186
  function edit(regex, opt) {
143617
144187
  regex = typeof regex === 'string' ? regex : regex.source;
143618
144188
  opt = opt || '';
@@ -143631,48 +144201,43 @@ function edit(regex, opt) {
143631
144201
  }
143632
144202
  var nonWordAndColonTest = /[^\w:]/g;
143633
144203
  var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
144204
+
143634
144205
  /**
143635
144206
  * @param {boolean} sanitize
143636
144207
  * @param {string} base
143637
144208
  * @param {string} href
143638
144209
  */
143639
-
143640
144210
  function cleanUrl(sanitize, base, href) {
143641
144211
  if (sanitize) {
143642
144212
  var prot;
143643
-
143644
144213
  try {
143645
144214
  prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
143646
144215
  } catch (e) {
143647
144216
  return null;
143648
144217
  }
143649
-
143650
144218
  if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
143651
144219
  return null;
143652
144220
  }
143653
144221
  }
143654
-
143655
144222
  if (base && !originIndependentUrl.test(href)) {
143656
144223
  href = resolveUrl(base, href);
143657
144224
  }
143658
-
143659
144225
  try {
143660
144226
  href = encodeURI(href).replace(/%25/g, '%');
143661
144227
  } catch (e) {
143662
144228
  return null;
143663
144229
  }
143664
-
143665
144230
  return href;
143666
144231
  }
143667
144232
  var baseUrls = {};
143668
144233
  var justDomain = /^[^:]+:\/*[^/]*$/;
143669
144234
  var protocol = /^([^:]+:)[\s\S]*$/;
143670
144235
  var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
144236
+
143671
144237
  /**
143672
144238
  * @param {string} base
143673
144239
  * @param {string} href
143674
144240
  */
143675
-
143676
144241
  function resolveUrl(base, href) {
143677
144242
  if (!baseUrls[' ' + base]) {
143678
144243
  // we can ignore everything in base after the last slash of its path component,
@@ -143684,21 +144249,17 @@ function resolveUrl(base, href) {
143684
144249
  baseUrls[' ' + base] = rtrim(base, '/', true);
143685
144250
  }
143686
144251
  }
143687
-
143688
144252
  base = baseUrls[' ' + base];
143689
144253
  var relativeBase = base.indexOf(':') === -1;
143690
-
143691
144254
  if (href.substring(0, 2) === '//') {
143692
144255
  if (relativeBase) {
143693
144256
  return href;
143694
144257
  }
143695
-
143696
144258
  return base.replace(protocol, '$1') + href;
143697
144259
  } else if (href.charAt(0) === '/') {
143698
144260
  if (relativeBase) {
143699
144261
  return href;
143700
144262
  }
143701
-
143702
144263
  return base.replace(domain, '$1') + href;
143703
144264
  } else {
143704
144265
  return base + href;
@@ -143709,52 +144270,46 @@ var noopTest = {
143709
144270
  };
143710
144271
  function merge(obj) {
143711
144272
  var i = 1,
143712
- target,
143713
- key;
143714
-
144273
+ target,
144274
+ key;
143715
144275
  for (; i < arguments.length; i++) {
143716
144276
  target = arguments[i];
143717
-
143718
144277
  for (key in target) {
143719
144278
  if (Object.prototype.hasOwnProperty.call(target, key)) {
143720
144279
  obj[key] = target[key];
143721
144280
  }
143722
144281
  }
143723
144282
  }
143724
-
143725
144283
  return obj;
143726
144284
  }
143727
144285
  function splitCells(tableRow, count) {
143728
144286
  // ensure that every cell-delimiting pipe has a space
143729
144287
  // before it to distinguish it from an escaped pipe
143730
144288
  var row = tableRow.replace(/\|/g, function (match, offset, str) {
143731
- var escaped = false,
144289
+ var escaped = false,
143732
144290
  curr = offset;
144291
+ while (--curr >= 0 && str[curr] === '\\') {
144292
+ escaped = !escaped;
144293
+ }
144294
+ if (escaped) {
144295
+ // odd number of slashes means | is escaped
144296
+ // so we leave it alone
144297
+ return '|';
144298
+ } else {
144299
+ // add space before unescaped |
144300
+ return ' |';
144301
+ }
144302
+ }),
144303
+ cells = row.split(/ \|/);
144304
+ var i = 0;
143733
144305
 
143734
- while (--curr >= 0 && str[curr] === '\\') {
143735
- escaped = !escaped;
143736
- }
143737
-
143738
- if (escaped) {
143739
- // odd number of slashes means | is escaped
143740
- // so we leave it alone
143741
- return '|';
143742
- } else {
143743
- // add space before unescaped |
143744
- return ' |';
143745
- }
143746
- }),
143747
- cells = row.split(/ \|/);
143748
- var i = 0; // First/last cell in a row cannot be empty if it has no leading/trailing pipe
143749
-
144306
+ // First/last cell in a row cannot be empty if it has no leading/trailing pipe
143750
144307
  if (!cells[0].trim()) {
143751
144308
  cells.shift();
143752
144309
  }
143753
-
143754
144310
  if (cells.length > 0 && !cells[cells.length - 1].trim()) {
143755
144311
  cells.pop();
143756
144312
  }
143757
-
143758
144313
  if (cells.length > count) {
143759
144314
  cells.splice(count);
143760
144315
  } else {
@@ -143762,14 +144317,13 @@ function splitCells(tableRow, count) {
143762
144317
  cells.push('');
143763
144318
  }
143764
144319
  }
143765
-
143766
144320
  for (; i < cells.length; i++) {
143767
144321
  // leading or trailing whitespace is ignored per the gfm spec
143768
144322
  cells[i] = cells[i].trim().replace(/\\\|/g, '|');
143769
144323
  }
143770
-
143771
144324
  return cells;
143772
144325
  }
144326
+
143773
144327
  /**
143774
144328
  * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
143775
144329
  * /c*$/ is vulnerable to REDOS.
@@ -143778,20 +144332,18 @@ function splitCells(tableRow, count) {
143778
144332
  * @param {string} c
143779
144333
  * @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
143780
144334
  */
143781
-
143782
144335
  function rtrim(str, c, invert) {
143783
144336
  var l = str.length;
143784
-
143785
144337
  if (l === 0) {
143786
144338
  return '';
143787
- } // Length of suffix matching the invert condition.
143788
-
144339
+ }
143789
144340
 
143790
- var suffLen = 0; // Step left until we fail to match the invert condition.
144341
+ // Length of suffix matching the invert condition.
144342
+ var suffLen = 0;
143791
144343
 
144344
+ // Step left until we fail to match the invert condition.
143792
144345
  while (suffLen < l) {
143793
144346
  var currChar = str.charAt(l - suffLen - 1);
143794
-
143795
144347
  if (currChar === c && !invert) {
143796
144348
  suffLen++;
143797
144349
  } else if (currChar !== c && invert) {
@@ -143800,18 +144352,15 @@ function rtrim(str, c, invert) {
143800
144352
  break;
143801
144353
  }
143802
144354
  }
143803
-
143804
144355
  return str.slice(0, l - suffLen);
143805
144356
  }
143806
144357
  function findClosingBracket(str, b) {
143807
144358
  if (str.indexOf(b[1]) === -1) {
143808
144359
  return -1;
143809
144360
  }
143810
-
143811
144361
  var l = str.length;
143812
144362
  var level = 0,
143813
- i = 0;
143814
-
144363
+ i = 0;
143815
144364
  for (; i < l; i++) {
143816
144365
  if (str[i] === '\\') {
143817
144366
  i++;
@@ -143819,42 +144368,36 @@ function findClosingBracket(str, b) {
143819
144368
  level++;
143820
144369
  } else if (str[i] === b[1]) {
143821
144370
  level--;
143822
-
143823
144371
  if (level < 0) {
143824
144372
  return i;
143825
144373
  }
143826
144374
  }
143827
144375
  }
143828
-
143829
144376
  return -1;
143830
144377
  }
143831
144378
  function checkSanitizeDeprecation(opt) {
143832
144379
  if (opt && opt.sanitize && !opt.silent) {
143833
144380
  console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
143834
144381
  }
143835
- } // copied from https://stackoverflow.com/a/5450113/806777
144382
+ }
143836
144383
 
144384
+ // copied from https://stackoverflow.com/a/5450113/806777
143837
144385
  /**
143838
144386
  * @param {string} pattern
143839
144387
  * @param {number} count
143840
144388
  */
143841
-
143842
144389
  function repeatString(pattern, count) {
143843
144390
  if (count < 1) {
143844
144391
  return '';
143845
144392
  }
143846
-
143847
144393
  var result = '';
143848
-
143849
144394
  while (count > 1) {
143850
144395
  if (count & 1) {
143851
144396
  result += pattern;
143852
144397
  }
143853
-
143854
144398
  count >>= 1;
143855
144399
  pattern += pattern;
143856
144400
  }
143857
-
143858
144401
  return result + pattern;
143859
144402
  }
143860
144403
 
@@ -143862,7 +144405,6 @@ function outputLink(cap, link, raw, lexer) {
143862
144405
  var href = link.href;
143863
144406
  var title = link.title ? escape(link.title) : null;
143864
144407
  var text = cap[1].replace(/\\([\[\]])/g, '$1');
143865
-
143866
144408
  if (cap[0].charAt(0) !== '!') {
143867
144409
  lexer.state.inLink = true;
143868
144410
  var token = {
@@ -143876,7 +144418,6 @@ function outputLink(cap, link, raw, lexer) {
143876
144418
  lexer.state.inLink = false;
143877
144419
  return token;
143878
144420
  }
143879
-
143880
144421
  return {
143881
144422
  type: 'image',
143882
144423
  raw: raw,
@@ -143885,46 +144426,35 @@ function outputLink(cap, link, raw, lexer) {
143885
144426
  text: escape(text)
143886
144427
  };
143887
144428
  }
143888
-
143889
144429
  function indentCodeCompensation(raw, text) {
143890
144430
  var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
143891
-
143892
144431
  if (matchIndentToCode === null) {
143893
144432
  return text;
143894
144433
  }
143895
-
143896
144434
  var indentToCode = matchIndentToCode[1];
143897
144435
  return text.split('\n').map(function (node) {
143898
144436
  var matchIndentInNode = node.match(/^\s+/);
143899
-
143900
144437
  if (matchIndentInNode === null) {
143901
144438
  return node;
143902
144439
  }
143903
-
143904
144440
  var indentInNode = matchIndentInNode[0];
143905
-
143906
144441
  if (indentInNode.length >= indentToCode.length) {
143907
144442
  return node.slice(indentToCode.length);
143908
144443
  }
143909
-
143910
144444
  return node;
143911
144445
  }).join('\n');
143912
144446
  }
144447
+
143913
144448
  /**
143914
144449
  * Tokenizer
143915
144450
  */
143916
-
143917
-
143918
144451
  var Tokenizer = /*#__PURE__*/function () {
143919
144452
  function Tokenizer(options) {
143920
144453
  this.options = options || exports.defaults;
143921
144454
  }
143922
-
143923
144455
  var _proto = Tokenizer.prototype;
143924
-
143925
144456
  _proto.space = function space(src) {
143926
144457
  var cap = this.rules.block.newline.exec(src);
143927
-
143928
144458
  if (cap && cap[0].length > 0) {
143929
144459
  return {
143930
144460
  type: 'space',
@@ -143932,10 +144462,8 @@ var Tokenizer = /*#__PURE__*/function () {
143932
144462
  };
143933
144463
  }
143934
144464
  };
143935
-
143936
144465
  _proto.code = function code(src) {
143937
144466
  var cap = this.rules.block.code.exec(src);
143938
-
143939
144467
  if (cap) {
143940
144468
  var text = cap[0].replace(/^ {1,4}/gm, '');
143941
144469
  return {
@@ -143946,31 +144474,27 @@ var Tokenizer = /*#__PURE__*/function () {
143946
144474
  };
143947
144475
  }
143948
144476
  };
143949
-
143950
144477
  _proto.fences = function fences(src) {
143951
144478
  var cap = this.rules.block.fences.exec(src);
143952
-
143953
144479
  if (cap) {
143954
144480
  var raw = cap[0];
143955
144481
  var text = indentCodeCompensation(raw, cap[3] || '');
143956
144482
  return {
143957
144483
  type: 'code',
143958
144484
  raw: raw,
143959
- lang: cap[2] ? cap[2].trim() : cap[2],
144485
+ lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
143960
144486
  text: text
143961
144487
  };
143962
144488
  }
143963
144489
  };
143964
-
143965
144490
  _proto.heading = function heading(src) {
143966
144491
  var cap = this.rules.block.heading.exec(src);
143967
-
143968
144492
  if (cap) {
143969
- var text = cap[2].trim(); // remove trailing #s
144493
+ var text = cap[2].trim();
143970
144494
 
144495
+ // remove trailing #s
143971
144496
  if (/#$/.test(text)) {
143972
144497
  var trimmed = rtrim(text, '#');
143973
-
143974
144498
  if (this.options.pedantic) {
143975
144499
  text = trimmed.trim();
143976
144500
  } else if (!trimmed || / $/.test(trimmed)) {
@@ -143978,7 +144502,6 @@ var Tokenizer = /*#__PURE__*/function () {
143978
144502
  text = trimmed.trim();
143979
144503
  }
143980
144504
  }
143981
-
143982
144505
  return {
143983
144506
  type: 'heading',
143984
144507
  raw: cap[0],
@@ -143988,10 +144511,8 @@ var Tokenizer = /*#__PURE__*/function () {
143988
144511
  };
143989
144512
  }
143990
144513
  };
143991
-
143992
144514
  _proto.hr = function hr(src) {
143993
144515
  var cap = this.rules.block.hr.exec(src);
143994
-
143995
144516
  if (cap) {
143996
144517
  return {
143997
144518
  type: 'hr',
@@ -143999,10 +144520,8 @@ var Tokenizer = /*#__PURE__*/function () {
143999
144520
  };
144000
144521
  }
144001
144522
  };
144002
-
144003
144523
  _proto.blockquote = function blockquote(src) {
144004
144524
  var cap = this.rules.block.blockquote.exec(src);
144005
-
144006
144525
  if (cap) {
144007
144526
  var text = cap[0].replace(/^ *>[ \t]?/gm, '');
144008
144527
  return {
@@ -144013,10 +144532,8 @@ var Tokenizer = /*#__PURE__*/function () {
144013
144532
  };
144014
144533
  }
144015
144534
  };
144016
-
144017
144535
  _proto.list = function list(src) {
144018
144536
  var cap = this.rules.block.list.exec(src);
144019
-
144020
144537
  if (cap) {
144021
144538
  var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
144022
144539
  var bull = cap[1].trim();
@@ -144030,86 +144547,78 @@ var Tokenizer = /*#__PURE__*/function () {
144030
144547
  items: []
144031
144548
  };
144032
144549
  bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
144033
-
144034
144550
  if (this.options.pedantic) {
144035
144551
  bull = isordered ? bull : '[*+-]';
144036
- } // Get next list item
144037
-
144552
+ }
144038
144553
 
144039
- var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item
144554
+ // Get next list item
144555
+ var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))");
144040
144556
 
144557
+ // Check if current bullet point can start a new List Item
144041
144558
  while (src) {
144042
144559
  endEarly = false;
144043
-
144044
144560
  if (!(cap = itemRegex.exec(src))) {
144045
144561
  break;
144046
144562
  }
144047
-
144048
144563
  if (this.rules.block.hr.test(src)) {
144049
144564
  // End list if bullet was actually HR (possibly move into itemRegex?)
144050
144565
  break;
144051
144566
  }
144052
-
144053
144567
  raw = cap[0];
144054
144568
  src = src.substring(raw.length);
144055
144569
  line = cap[2].split('\n', 1)[0];
144056
144570
  nextLine = src.split('\n', 1)[0];
144057
-
144058
144571
  if (this.options.pedantic) {
144059
144572
  indent = 2;
144060
144573
  itemContents = line.trimLeft();
144061
144574
  } else {
144062
144575
  indent = cap[2].search(/[^ ]/); // Find first non-space char
144063
-
144064
144576
  indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
144065
-
144066
144577
  itemContents = line.slice(indent);
144067
144578
  indent += cap[1].length;
144068
144579
  }
144069
-
144070
144580
  blankLine = false;
144071
-
144072
144581
  if (!line && /^ *$/.test(nextLine)) {
144073
144582
  // Items begin with at most one blank line
144074
144583
  raw += nextLine + '\n';
144075
144584
  src = src.substring(nextLine.length + 1);
144076
144585
  endEarly = true;
144077
144586
  }
144078
-
144079
144587
  if (!endEarly) {
144080
144588
  var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))");
144081
144589
  var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
144082
144590
  var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
144083
- var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#"); // Check if following lines should be included in List Item
144591
+ var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#");
144084
144592
 
144593
+ // Check if following lines should be included in List Item
144085
144594
  while (src) {
144086
144595
  rawLine = src.split('\n', 1)[0];
144087
- line = rawLine; // Re-align to follow commonmark nesting rules
144596
+ line = rawLine;
144088
144597
 
144598
+ // Re-align to follow commonmark nesting rules
144089
144599
  if (this.options.pedantic) {
144090
144600
  line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
144091
- } // End list item if found code fences
144092
-
144601
+ }
144093
144602
 
144603
+ // End list item if found code fences
144094
144604
  if (fencesBeginRegex.test(line)) {
144095
144605
  break;
144096
- } // End list item if found start of new heading
144097
-
144606
+ }
144098
144607
 
144608
+ // End list item if found start of new heading
144099
144609
  if (headingBeginRegex.test(line)) {
144100
144610
  break;
144101
- } // End list item if found start of new bullet
144102
-
144611
+ }
144103
144612
 
144613
+ // End list item if found start of new bullet
144104
144614
  if (nextBulletRegex.test(line)) {
144105
144615
  break;
144106
- } // Horizontal rule found
144107
-
144616
+ }
144108
144617
 
144618
+ // Horizontal rule found
144109
144619
  if (hrRegex.test(src)) {
144110
144620
  break;
144111
144621
  }
144112
-
144113
144622
  if (line.search(/[^ ]/) >= indent || !line.trim()) {
144114
144623
  // Dedent if possible
144115
144624
  itemContents += '\n' + line.slice(indent);
@@ -144120,17 +144629,14 @@ var Tokenizer = /*#__PURE__*/function () {
144120
144629
  // Otherwise, improper indentation ends this item
144121
144630
  break;
144122
144631
  }
144123
-
144124
144632
  if (!blankLine && !line.trim()) {
144125
144633
  // Check if current line is blank
144126
144634
  blankLine = true;
144127
144635
  }
144128
-
144129
144636
  raw += rawLine + '\n';
144130
144637
  src = src.substring(rawLine.length + 1);
144131
144638
  }
144132
144639
  }
144133
-
144134
144640
  if (!list.loose) {
144135
144641
  // If the previous item ended with a blank line, the list is loose
144136
144642
  if (endsWithBlankLine) {
@@ -144138,18 +144644,16 @@ var Tokenizer = /*#__PURE__*/function () {
144138
144644
  } else if (/\n *\n *$/.test(raw)) {
144139
144645
  endsWithBlankLine = true;
144140
144646
  }
144141
- } // Check for task list items
144142
-
144647
+ }
144143
144648
 
144649
+ // Check for task list items
144144
144650
  if (this.options.gfm) {
144145
144651
  istask = /^\[[ xX]\] /.exec(itemContents);
144146
-
144147
144652
  if (istask) {
144148
144653
  ischecked = istask[0] !== '[ ] ';
144149
144654
  itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
144150
144655
  }
144151
144656
  }
144152
-
144153
144657
  list.items.push({
144154
144658
  type: 'list_item',
144155
144659
  raw: raw,
@@ -144159,14 +144663,15 @@ var Tokenizer = /*#__PURE__*/function () {
144159
144663
  text: itemContents
144160
144664
  });
144161
144665
  list.raw += raw;
144162
- } // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
144163
-
144666
+ }
144164
144667
 
144668
+ // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
144165
144669
  list.items[list.items.length - 1].raw = raw.trimRight();
144166
144670
  list.items[list.items.length - 1].text = itemContents.trimRight();
144167
144671
  list.raw = list.raw.trimRight();
144168
- var l = list.items.length; // Item child tokens handled here at end because we needed to have the final item to trim it first
144672
+ var l = list.items.length;
144169
144673
 
144674
+ // Item child tokens handled here at end because we needed to have the final item to trim it first
144170
144675
  for (i = 0; i < l; i++) {
144171
144676
  this.lexer.state.top = false;
144172
144677
  list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
@@ -144176,36 +144681,28 @@ var Tokenizer = /*#__PURE__*/function () {
144176
144681
  var hasMultipleLineBreaks = spacers.every(function (t) {
144177
144682
  var chars = t.raw.split('');
144178
144683
  var lineBreaks = 0;
144179
-
144180
144684
  for (var _iterator = _createForOfIteratorHelperLoose(chars), _step; !(_step = _iterator()).done;) {
144181
144685
  var _char = _step.value;
144182
-
144183
144686
  if (_char === '\n') {
144184
144687
  lineBreaks += 1;
144185
144688
  }
144186
-
144187
144689
  if (lineBreaks > 1) {
144188
144690
  return true;
144189
144691
  }
144190
144692
  }
144191
-
144192
144693
  return false;
144193
144694
  });
144194
-
144195
144695
  if (!list.loose && spacers.length && hasMultipleLineBreaks) {
144196
144696
  // Having a single line break doesn't mean a list is loose. A single line break is terminating the last list item
144197
144697
  list.loose = true;
144198
144698
  list.items[i].loose = true;
144199
144699
  }
144200
144700
  }
144201
-
144202
144701
  return list;
144203
144702
  }
144204
144703
  };
144205
-
144206
144704
  _proto.html = function html(src) {
144207
144705
  var cap = this.rules.block.html.exec(src);
144208
-
144209
144706
  if (cap) {
144210
144707
  var token = {
144211
144708
  type: 'html',
@@ -144213,21 +144710,17 @@ var Tokenizer = /*#__PURE__*/function () {
144213
144710
  pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
144214
144711
  text: cap[0]
144215
144712
  };
144216
-
144217
144713
  if (this.options.sanitize) {
144218
144714
  var text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
144219
144715
  token.type = 'paragraph';
144220
144716
  token.text = text;
144221
144717
  token.tokens = this.lexer.inline(text);
144222
144718
  }
144223
-
144224
144719
  return token;
144225
144720
  }
144226
144721
  };
144227
-
144228
144722
  _proto.def = function def(src) {
144229
144723
  var cap = this.rules.block.def.exec(src);
144230
-
144231
144724
  if (cap) {
144232
144725
  if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
144233
144726
  var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
@@ -144235,15 +144728,13 @@ var Tokenizer = /*#__PURE__*/function () {
144235
144728
  type: 'def',
144236
144729
  tag: tag,
144237
144730
  raw: cap[0],
144238
- href: cap[2],
144239
- title: cap[3]
144731
+ href: cap[2] ? cap[2].replace(this.rules.inline._escapes, '$1') : cap[2],
144732
+ title: cap[3] ? cap[3].replace(this.rules.inline._escapes, '$1') : cap[3]
144240
144733
  };
144241
144734
  }
144242
144735
  };
144243
-
144244
144736
  _proto.table = function table(src) {
144245
144737
  var cap = this.rules.block.table.exec(src);
144246
-
144247
144738
  if (cap) {
144248
144739
  var item = {
144249
144740
  type: 'table',
@@ -144255,12 +144746,10 @@ var Tokenizer = /*#__PURE__*/function () {
144255
144746
  align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
144256
144747
  rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
144257
144748
  };
144258
-
144259
144749
  if (item.header.length === item.align.length) {
144260
144750
  item.raw = cap[0];
144261
144751
  var l = item.align.length;
144262
144752
  var i, j, k, row;
144263
-
144264
144753
  for (i = 0; i < l; i++) {
144265
144754
  if (/^ *-+: *$/.test(item.align[i])) {
144266
144755
  item.align[i] = 'right';
@@ -144272,44 +144761,37 @@ var Tokenizer = /*#__PURE__*/function () {
144272
144761
  item.align[i] = null;
144273
144762
  }
144274
144763
  }
144275
-
144276
144764
  l = item.rows.length;
144277
-
144278
144765
  for (i = 0; i < l; i++) {
144279
144766
  item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
144280
144767
  return {
144281
144768
  text: c
144282
144769
  };
144283
144770
  });
144284
- } // parse child tokens inside headers and cells
144285
- // header child tokens
144771
+ }
144286
144772
 
144773
+ // parse child tokens inside headers and cells
144287
144774
 
144775
+ // header child tokens
144288
144776
  l = item.header.length;
144289
-
144290
144777
  for (j = 0; j < l; j++) {
144291
144778
  item.header[j].tokens = this.lexer.inline(item.header[j].text);
144292
- } // cell child tokens
144293
-
144779
+ }
144294
144780
 
144781
+ // cell child tokens
144295
144782
  l = item.rows.length;
144296
-
144297
144783
  for (j = 0; j < l; j++) {
144298
144784
  row = item.rows[j];
144299
-
144300
144785
  for (k = 0; k < row.length; k++) {
144301
144786
  row[k].tokens = this.lexer.inline(row[k].text);
144302
144787
  }
144303
144788
  }
144304
-
144305
144789
  return item;
144306
144790
  }
144307
144791
  }
144308
144792
  };
144309
-
144310
144793
  _proto.lheading = function lheading(src) {
144311
144794
  var cap = this.rules.block.lheading.exec(src);
144312
-
144313
144795
  if (cap) {
144314
144796
  return {
144315
144797
  type: 'heading',
@@ -144320,10 +144802,8 @@ var Tokenizer = /*#__PURE__*/function () {
144320
144802
  };
144321
144803
  }
144322
144804
  };
144323
-
144324
144805
  _proto.paragraph = function paragraph(src) {
144325
144806
  var cap = this.rules.block.paragraph.exec(src);
144326
-
144327
144807
  if (cap) {
144328
144808
  var text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
144329
144809
  return {
@@ -144334,10 +144814,8 @@ var Tokenizer = /*#__PURE__*/function () {
144334
144814
  };
144335
144815
  }
144336
144816
  };
144337
-
144338
144817
  _proto.text = function text(src) {
144339
144818
  var cap = this.rules.block.text.exec(src);
144340
-
144341
144819
  if (cap) {
144342
144820
  return {
144343
144821
  type: 'text',
@@ -144347,10 +144825,8 @@ var Tokenizer = /*#__PURE__*/function () {
144347
144825
  };
144348
144826
  }
144349
144827
  };
144350
-
144351
144828
  _proto.escape = function escape$1(src) {
144352
144829
  var cap = this.rules.inline.escape.exec(src);
144353
-
144354
144830
  if (cap) {
144355
144831
  return {
144356
144832
  type: 'escape',
@@ -144359,23 +144835,19 @@ var Tokenizer = /*#__PURE__*/function () {
144359
144835
  };
144360
144836
  }
144361
144837
  };
144362
-
144363
144838
  _proto.tag = function tag(src) {
144364
144839
  var cap = this.rules.inline.tag.exec(src);
144365
-
144366
144840
  if (cap) {
144367
144841
  if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
144368
144842
  this.lexer.state.inLink = true;
144369
144843
  } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
144370
144844
  this.lexer.state.inLink = false;
144371
144845
  }
144372
-
144373
144846
  if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
144374
144847
  this.lexer.state.inRawBlock = true;
144375
144848
  } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
144376
144849
  this.lexer.state.inRawBlock = false;
144377
144850
  }
144378
-
144379
144851
  return {
144380
144852
  type: this.options.sanitize ? 'text' : 'html',
144381
144853
  raw: cap[0],
@@ -144385,29 +144857,24 @@ var Tokenizer = /*#__PURE__*/function () {
144385
144857
  };
144386
144858
  }
144387
144859
  };
144388
-
144389
144860
  _proto.link = function link(src) {
144390
144861
  var cap = this.rules.inline.link.exec(src);
144391
-
144392
144862
  if (cap) {
144393
144863
  var trimmedUrl = cap[2].trim();
144394
-
144395
144864
  if (!this.options.pedantic && /^</.test(trimmedUrl)) {
144396
144865
  // commonmark requires matching angle brackets
144397
144866
  if (!/>$/.test(trimmedUrl)) {
144398
144867
  return;
144399
- } // ending angle bracket cannot be escaped
144400
-
144868
+ }
144401
144869
 
144870
+ // ending angle bracket cannot be escaped
144402
144871
  var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
144403
-
144404
144872
  if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
144405
144873
  return;
144406
144874
  }
144407
144875
  } else {
144408
144876
  // find closing parenthesis
144409
144877
  var lastParenIndex = findClosingBracket(cap[2], '()');
144410
-
144411
144878
  if (lastParenIndex > -1) {
144412
144879
  var start = cap[0].indexOf('!') === 0 ? 5 : 4;
144413
144880
  var linkLen = start + cap[1].length + lastParenIndex;
@@ -144416,14 +144883,11 @@ var Tokenizer = /*#__PURE__*/function () {
144416
144883
  cap[3] = '';
144417
144884
  }
144418
144885
  }
144419
-
144420
144886
  var href = cap[2];
144421
144887
  var title = '';
144422
-
144423
144888
  if (this.options.pedantic) {
144424
144889
  // split pedantic href and title
144425
144890
  var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
144426
-
144427
144891
  if (link) {
144428
144892
  href = link[1];
144429
144893
  title = link[3];
@@ -144431,9 +144895,7 @@ var Tokenizer = /*#__PURE__*/function () {
144431
144895
  } else {
144432
144896
  title = cap[3] ? cap[3].slice(1, -1) : '';
144433
144897
  }
144434
-
144435
144898
  href = href.trim();
144436
-
144437
144899
  if (/^</.test(href)) {
144438
144900
  if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
144439
144901
  // pedantic allows starting angle bracket without ending angle bracket
@@ -144442,21 +144904,17 @@ var Tokenizer = /*#__PURE__*/function () {
144442
144904
  href = href.slice(1, -1);
144443
144905
  }
144444
144906
  }
144445
-
144446
144907
  return outputLink(cap, {
144447
144908
  href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
144448
144909
  title: title ? title.replace(this.rules.inline._escapes, '$1') : title
144449
144910
  }, cap[0], this.lexer);
144450
144911
  }
144451
144912
  };
144452
-
144453
144913
  _proto.reflink = function reflink(src, links) {
144454
144914
  var cap;
144455
-
144456
144915
  if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
144457
144916
  var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
144458
144917
  link = links[link.toLowerCase()];
144459
-
144460
144918
  if (!link || !link.href) {
144461
144919
  var text = cap[0].charAt(0);
144462
144920
  return {
@@ -144465,39 +144923,35 @@ var Tokenizer = /*#__PURE__*/function () {
144465
144923
  text: text
144466
144924
  };
144467
144925
  }
144468
-
144469
144926
  return outputLink(cap, link, cap[0], this.lexer);
144470
144927
  }
144471
144928
  };
144472
-
144473
144929
  _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
144474
144930
  if (prevChar === void 0) {
144475
144931
  prevChar = '';
144476
144932
  }
144477
-
144478
144933
  var match = this.rules.inline.emStrong.lDelim.exec(src);
144479
- if (!match) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
144934
+ if (!match) return;
144480
144935
 
144936
+ // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
144481
144937
  if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
144482
144938
  var nextChar = match[1] || match[2] || '';
144483
-
144484
144939
  if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
144485
144940
  var lLength = match[0].length - 1;
144486
144941
  var rDelim,
144487
- rLength,
144488
- delimTotal = lLength,
144489
- midDelimTotal = 0;
144942
+ rLength,
144943
+ delimTotal = lLength,
144944
+ midDelimTotal = 0;
144490
144945
  var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
144491
- endReg.lastIndex = 0; // Clip maskedSrc to same section of string as src (move to lexer?)
144946
+ endReg.lastIndex = 0;
144492
144947
 
144948
+ // Clip maskedSrc to same section of string as src (move to lexer?)
144493
144949
  maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
144494
-
144495
144950
  while ((match = endReg.exec(maskedSrc)) != null) {
144496
144951
  rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
144497
144952
  if (!rDelim) continue; // skip single * in __abc*abc__
144498
144953
 
144499
144954
  rLength = rDelim.length;
144500
-
144501
144955
  if (match[3] || match[4]) {
144502
144956
  // found another Left Delim
144503
144957
  delimTotal += rLength;
@@ -144512,45 +144966,42 @@ var Tokenizer = /*#__PURE__*/function () {
144512
144966
 
144513
144967
  delimTotal -= rLength;
144514
144968
  if (delimTotal > 0) continue; // Haven't found enough closing delimiters
144515
- // Remove extra characters. *a*** -> *a*
144516
144969
 
144517
- rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); // Create `em` if smallest delimiter has odd char count. *a***
144970
+ // Remove extra characters. *a*** -> *a*
144971
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
144972
+ var raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength);
144518
144973
 
144974
+ // Create `em` if smallest delimiter has odd char count. *a***
144519
144975
  if (Math.min(lLength, rLength) % 2) {
144520
- var _text = src.slice(1, lLength + match.index + rLength);
144521
-
144976
+ var _text = raw.slice(1, -1);
144522
144977
  return {
144523
144978
  type: 'em',
144524
- raw: src.slice(0, lLength + match.index + rLength + 1),
144979
+ raw: raw,
144525
144980
  text: _text,
144526
144981
  tokens: this.lexer.inlineTokens(_text)
144527
144982
  };
144528
- } // Create 'strong' if smallest delimiter has even char count. **a***
144529
-
144983
+ }
144530
144984
 
144531
- var text = src.slice(2, lLength + match.index + rLength - 1);
144985
+ // Create 'strong' if smallest delimiter has even char count. **a***
144986
+ var text = raw.slice(2, -2);
144532
144987
  return {
144533
144988
  type: 'strong',
144534
- raw: src.slice(0, lLength + match.index + rLength + 1),
144989
+ raw: raw,
144535
144990
  text: text,
144536
144991
  tokens: this.lexer.inlineTokens(text)
144537
144992
  };
144538
144993
  }
144539
144994
  }
144540
144995
  };
144541
-
144542
144996
  _proto.codespan = function codespan(src) {
144543
144997
  var cap = this.rules.inline.code.exec(src);
144544
-
144545
144998
  if (cap) {
144546
144999
  var text = cap[2].replace(/\n/g, ' ');
144547
145000
  var hasNonSpaceChars = /[^ ]/.test(text);
144548
145001
  var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
144549
-
144550
145002
  if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
144551
145003
  text = text.substring(1, text.length - 1);
144552
145004
  }
144553
-
144554
145005
  text = escape(text, true);
144555
145006
  return {
144556
145007
  type: 'codespan',
@@ -144559,10 +145010,8 @@ var Tokenizer = /*#__PURE__*/function () {
144559
145010
  };
144560
145011
  }
144561
145012
  };
144562
-
144563
145013
  _proto.br = function br(src) {
144564
145014
  var cap = this.rules.inline.br.exec(src);
144565
-
144566
145015
  if (cap) {
144567
145016
  return {
144568
145017
  type: 'br',
@@ -144570,10 +145019,8 @@ var Tokenizer = /*#__PURE__*/function () {
144570
145019
  };
144571
145020
  }
144572
145021
  };
144573
-
144574
145022
  _proto.del = function del(src) {
144575
145023
  var cap = this.rules.inline.del.exec(src);
144576
-
144577
145024
  if (cap) {
144578
145025
  return {
144579
145026
  type: 'del',
@@ -144583,13 +145030,10 @@ var Tokenizer = /*#__PURE__*/function () {
144583
145030
  };
144584
145031
  }
144585
145032
  };
144586
-
144587
145033
  _proto.autolink = function autolink(src, mangle) {
144588
145034
  var cap = this.rules.inline.autolink.exec(src);
144589
-
144590
145035
  if (cap) {
144591
145036
  var text, href;
144592
-
144593
145037
  if (cap[2] === '@') {
144594
145038
  text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
144595
145039
  href = 'mailto:' + text;
@@ -144597,7 +145041,6 @@ var Tokenizer = /*#__PURE__*/function () {
144597
145041
  text = escape(cap[1]);
144598
145042
  href = text;
144599
145043
  }
144600
-
144601
145044
  return {
144602
145045
  type: 'link',
144603
145046
  raw: cap[0],
@@ -144611,34 +145054,27 @@ var Tokenizer = /*#__PURE__*/function () {
144611
145054
  };
144612
145055
  }
144613
145056
  };
144614
-
144615
145057
  _proto.url = function url(src, mangle) {
144616
145058
  var cap;
144617
-
144618
145059
  if (cap = this.rules.inline.url.exec(src)) {
144619
145060
  var text, href;
144620
-
144621
145061
  if (cap[2] === '@') {
144622
145062
  text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
144623
145063
  href = 'mailto:' + text;
144624
145064
  } else {
144625
145065
  // do extended autolink path validation
144626
145066
  var prevCapZero;
144627
-
144628
145067
  do {
144629
145068
  prevCapZero = cap[0];
144630
145069
  cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
144631
145070
  } while (prevCapZero !== cap[0]);
144632
-
144633
145071
  text = escape(cap[0]);
144634
-
144635
145072
  if (cap[1] === 'www.') {
144636
145073
  href = 'http://' + text;
144637
145074
  } else {
144638
145075
  href = text;
144639
145076
  }
144640
145077
  }
144641
-
144642
145078
  return {
144643
145079
  type: 'link',
144644
145080
  raw: cap[0],
@@ -144652,19 +145088,15 @@ var Tokenizer = /*#__PURE__*/function () {
144652
145088
  };
144653
145089
  }
144654
145090
  };
144655
-
144656
145091
  _proto.inlineText = function inlineText(src, smartypants) {
144657
145092
  var cap = this.rules.inline.text.exec(src);
144658
-
144659
145093
  if (cap) {
144660
145094
  var text;
144661
-
144662
145095
  if (this.lexer.state.inRawBlock) {
144663
145096
  text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
144664
145097
  } else {
144665
145098
  text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
144666
145099
  }
144667
-
144668
145100
  return {
144669
145101
  type: 'text',
144670
145102
  raw: cap[0],
@@ -144672,14 +145104,12 @@ var Tokenizer = /*#__PURE__*/function () {
144672
145104
  };
144673
145105
  }
144674
145106
  };
144675
-
144676
145107
  return Tokenizer;
144677
145108
  }();
144678
145109
 
144679
145110
  /**
144680
145111
  * Block-Level Grammar
144681
145112
  */
144682
-
144683
145113
  var block = {
144684
145114
  newline: /^(?: *(?:\n|$))+/,
144685
145115
  code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
@@ -144720,11 +145150,13 @@ block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('headin
144720
145150
  .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
144721
145151
  .getRegex();
144722
145152
  block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
145153
+
144723
145154
  /**
144724
145155
  * Normal Block Grammar
144725
145156
  */
144726
145157
 
144727
145158
  block.normal = merge({}, block);
145159
+
144728
145160
  /**
144729
145161
  * GFM Block Grammar
144730
145162
  */
@@ -144733,8 +145165,8 @@ block.gfm = merge({}, block.normal, {
144733
145165
  table: '^ *([^\\n ].*\\|.*)\\n' // Header
144734
145166
  + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
144735
145167
  + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
144736
-
144737
145168
  });
145169
+
144738
145170
  block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
144739
145171
  .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
144740
145172
  .getRegex();
@@ -144756,10 +145188,10 @@ block.pedantic = merge({}, block.normal, {
144756
145188
  // fences not supported
144757
145189
  paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
144758
145190
  });
145191
+
144759
145192
  /**
144760
145193
  * Inline-Level Grammar
144761
145194
  */
144762
-
144763
145195
  var inline = {
144764
145196
  escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
144765
145197
  autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
@@ -144777,24 +145209,28 @@ var inline = {
144777
145209
  emStrong: {
144778
145210
  lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
144779
145211
  // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
144780
- // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
144781
- rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
144782
- rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
144783
-
145212
+ // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
145213
+ rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
145214
+ rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
144784
145215
  },
145216
+
144785
145217
  code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
144786
145218
  br: /^( {2,}|\\)\n(?!\s*$)/,
144787
145219
  del: noopTest,
144788
145220
  text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
144789
145221
  punctuation: /^([\spunctuation])/
144790
- }; // list of punctuation marks from CommonMark spec
144791
- // without * and _ to handle the different emphasis markers * and _
145222
+ };
144792
145223
 
145224
+ // list of punctuation marks from CommonMark spec
145225
+ // without * and _ to handle the different emphasis markers * and _
144793
145226
  inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
144794
- inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
145227
+ inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
144795
145228
 
145229
+ // sequences em should skip over [title](link), `code`, <html>
144796
145230
  inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
144797
- inline.escapedEmSt = /\\\*|\\_/g;
145231
+ // lookbehind is not available on Safari as of version 16
145232
+ // inline.escapedEmSt = /(?<=(?:^|[^\\)(?:\\[^])*)\\[*_]/g;
145233
+ inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
144798
145234
  inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
144799
145235
  inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
144800
145236
  inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
@@ -144812,11 +145248,13 @@ inline.link = edit(inline.link).replace('label', inline._label).replace('href',
144812
145248
  inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
144813
145249
  inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
144814
145250
  inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
145251
+
144815
145252
  /**
144816
145253
  * Normal Inline Grammar
144817
145254
  */
144818
145255
 
144819
145256
  inline.normal = merge({}, inline);
145257
+
144820
145258
  /**
144821
145259
  * Pedantic Inline Grammar
144822
145260
  */
@@ -144837,6 +145275,7 @@ inline.pedantic = merge({}, inline.normal, {
144837
145275
  link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
144838
145276
  reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
144839
145277
  });
145278
+
144840
145279
  /**
144841
145280
  * GFM Inline Grammar
144842
145281
  */
@@ -144863,46 +145302,46 @@ inline.breaks = merge({}, inline.gfm, {
144863
145302
  * smartypants text replacement
144864
145303
  * @param {string} text
144865
145304
  */
144866
-
144867
145305
  function smartypants(text) {
144868
- return text // em-dashes
144869
- .replace(/---/g, "\u2014") // en-dashes
144870
- .replace(/--/g, "\u2013") // opening singles
144871
- .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
144872
- .replace(/'/g, "\u2019") // opening doubles
144873
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
144874
- .replace(/"/g, "\u201D") // ellipses
145306
+ return text
145307
+ // em-dashes
145308
+ .replace(/---/g, "\u2014")
145309
+ // en-dashes
145310
+ .replace(/--/g, "\u2013")
145311
+ // opening singles
145312
+ .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018")
145313
+ // closing singles & apostrophes
145314
+ .replace(/'/g, "\u2019")
145315
+ // opening doubles
145316
+ .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C")
145317
+ // closing doubles
145318
+ .replace(/"/g, "\u201D")
145319
+ // ellipses
144875
145320
  .replace(/\.{3}/g, "\u2026");
144876
145321
  }
145322
+
144877
145323
  /**
144878
145324
  * mangle email addresses
144879
145325
  * @param {string} text
144880
145326
  */
144881
-
144882
-
144883
145327
  function mangle(text) {
144884
145328
  var out = '',
144885
- i,
144886
- ch;
145329
+ i,
145330
+ ch;
144887
145331
  var l = text.length;
144888
-
144889
145332
  for (i = 0; i < l; i++) {
144890
145333
  ch = text.charCodeAt(i);
144891
-
144892
145334
  if (Math.random() > 0.5) {
144893
145335
  ch = 'x' + ch.toString(16);
144894
145336
  }
144895
-
144896
145337
  out += '&#' + ch + ';';
144897
145338
  }
144898
-
144899
145339
  return out;
144900
145340
  }
145341
+
144901
145342
  /**
144902
145343
  * Block Lexer
144903
145344
  */
144904
-
144905
-
144906
145345
  var Lexer = /*#__PURE__*/function () {
144907
145346
  function Lexer(options) {
144908
145347
  this.tokens = [];
@@ -144922,27 +145361,23 @@ var Lexer = /*#__PURE__*/function () {
144922
145361
  block: block.normal,
144923
145362
  inline: inline.normal
144924
145363
  };
144925
-
144926
145364
  if (this.options.pedantic) {
144927
145365
  rules.block = block.pedantic;
144928
145366
  rules.inline = inline.pedantic;
144929
145367
  } else if (this.options.gfm) {
144930
145368
  rules.block = block.gfm;
144931
-
144932
145369
  if (this.options.breaks) {
144933
145370
  rules.inline = inline.breaks;
144934
145371
  } else {
144935
145372
  rules.inline = inline.gfm;
144936
145373
  }
144937
145374
  }
144938
-
144939
145375
  this.tokenizer.rules = rules;
144940
145376
  }
145377
+
144941
145378
  /**
144942
145379
  * Expose Rules
144943
145380
  */
144944
-
144945
-
144946
145381
  /**
144947
145382
  * Static Lex Method
144948
145383
  */
@@ -144950,45 +145385,37 @@ var Lexer = /*#__PURE__*/function () {
144950
145385
  var lexer = new Lexer(options);
144951
145386
  return lexer.lex(src);
144952
145387
  }
145388
+
144953
145389
  /**
144954
145390
  * Static Lex Inline Method
144955
- */
144956
- ;
144957
-
145391
+ */;
144958
145392
  Lexer.lexInline = function lexInline(src, options) {
144959
145393
  var lexer = new Lexer(options);
144960
145394
  return lexer.inlineTokens(src);
144961
145395
  }
145396
+
144962
145397
  /**
144963
145398
  * Preprocessing
144964
- */
144965
- ;
144966
-
145399
+ */;
144967
145400
  var _proto = Lexer.prototype;
144968
-
144969
145401
  _proto.lex = function lex(src) {
144970
145402
  src = src.replace(/\r\n|\r/g, '\n');
144971
145403
  this.blockTokens(src, this.tokens);
144972
145404
  var next;
144973
-
144974
145405
  while (next = this.inlineQueue.shift()) {
144975
145406
  this.inlineTokens(next.src, next.tokens);
144976
145407
  }
144977
-
144978
145408
  return this.tokens;
144979
145409
  }
145410
+
144980
145411
  /**
144981
145412
  * Lexing
144982
- */
144983
- ;
144984
-
145413
+ */;
144985
145414
  _proto.blockTokens = function blockTokens(src, tokens) {
144986
145415
  var _this = this;
144987
-
144988
145416
  if (tokens === void 0) {
144989
145417
  tokens = [];
144990
145418
  }
144991
-
144992
145419
  if (this.options.pedantic) {
144993
145420
  src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
144994
145421
  } else {
@@ -144996,9 +145423,7 @@ var Lexer = /*#__PURE__*/function () {
144996
145423
  return leading + ' '.repeat(tabs.length);
144997
145424
  });
144998
145425
  }
144999
-
145000
145426
  var token, lastToken, cutSrc, lastParagraphClipped;
145001
-
145002
145427
  while (src) {
145003
145428
  if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
145004
145429
  if (token = extTokenizer.call({
@@ -145008,16 +145433,14 @@ var Lexer = /*#__PURE__*/function () {
145008
145433
  tokens.push(token);
145009
145434
  return true;
145010
145435
  }
145011
-
145012
145436
  return false;
145013
145437
  })) {
145014
145438
  continue;
145015
- } // newline
145016
-
145439
+ }
145017
145440
 
145441
+ // newline
145018
145442
  if (token = this.tokenizer.space(src)) {
145019
145443
  src = src.substring(token.raw.length);
145020
-
145021
145444
  if (token.raw.length === 1 && tokens.length > 0) {
145022
145445
  // if there's a single \n as a spacer, it's terminating the last line,
145023
145446
  // so move it there so that we don't get unecessary paragraph tags
@@ -145025,15 +145448,14 @@ var Lexer = /*#__PURE__*/function () {
145025
145448
  } else {
145026
145449
  tokens.push(token);
145027
145450
  }
145028
-
145029
145451
  continue;
145030
- } // code
145031
-
145452
+ }
145032
145453
 
145454
+ // code
145033
145455
  if (token = this.tokenizer.code(src)) {
145034
145456
  src = src.substring(token.raw.length);
145035
- lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
145036
-
145457
+ lastToken = tokens[tokens.length - 1];
145458
+ // An indented code block cannot interrupt a paragraph.
145037
145459
  if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
145038
145460
  lastToken.raw += '\n' + token.raw;
145039
145461
  lastToken.text += '\n' + token.text;
@@ -145041,57 +145463,55 @@ var Lexer = /*#__PURE__*/function () {
145041
145463
  } else {
145042
145464
  tokens.push(token);
145043
145465
  }
145044
-
145045
145466
  continue;
145046
- } // fences
145047
-
145467
+ }
145048
145468
 
145469
+ // fences
145049
145470
  if (token = this.tokenizer.fences(src)) {
145050
145471
  src = src.substring(token.raw.length);
145051
145472
  tokens.push(token);
145052
145473
  continue;
145053
- } // heading
145054
-
145474
+ }
145055
145475
 
145476
+ // heading
145056
145477
  if (token = this.tokenizer.heading(src)) {
145057
145478
  src = src.substring(token.raw.length);
145058
145479
  tokens.push(token);
145059
145480
  continue;
145060
- } // hr
145061
-
145481
+ }
145062
145482
 
145483
+ // hr
145063
145484
  if (token = this.tokenizer.hr(src)) {
145064
145485
  src = src.substring(token.raw.length);
145065
145486
  tokens.push(token);
145066
145487
  continue;
145067
- } // blockquote
145068
-
145488
+ }
145069
145489
 
145490
+ // blockquote
145070
145491
  if (token = this.tokenizer.blockquote(src)) {
145071
145492
  src = src.substring(token.raw.length);
145072
145493
  tokens.push(token);
145073
145494
  continue;
145074
- } // list
145075
-
145495
+ }
145076
145496
 
145497
+ // list
145077
145498
  if (token = this.tokenizer.list(src)) {
145078
145499
  src = src.substring(token.raw.length);
145079
145500
  tokens.push(token);
145080
145501
  continue;
145081
- } // html
145082
-
145502
+ }
145083
145503
 
145504
+ // html
145084
145505
  if (token = this.tokenizer.html(src)) {
145085
145506
  src = src.substring(token.raw.length);
145086
145507
  tokens.push(token);
145087
145508
  continue;
145088
- } // def
145089
-
145509
+ }
145090
145510
 
145511
+ // def
145091
145512
  if (token = this.tokenizer.def(src)) {
145092
145513
  src = src.substring(token.raw.length);
145093
145514
  lastToken = tokens[tokens.length - 1];
145094
-
145095
145515
  if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
145096
145516
  lastToken.raw += '\n' + token.raw;
145097
145517
  lastToken.text += '\n' + token.raw;
@@ -145102,53 +145522,46 @@ var Lexer = /*#__PURE__*/function () {
145102
145522
  title: token.title
145103
145523
  };
145104
145524
  }
145105
-
145106
145525
  continue;
145107
- } // table (gfm)
145108
-
145526
+ }
145109
145527
 
145528
+ // table (gfm)
145110
145529
  if (token = this.tokenizer.table(src)) {
145111
145530
  src = src.substring(token.raw.length);
145112
145531
  tokens.push(token);
145113
145532
  continue;
145114
- } // lheading
145115
-
145533
+ }
145116
145534
 
145535
+ // lheading
145117
145536
  if (token = this.tokenizer.lheading(src)) {
145118
145537
  src = src.substring(token.raw.length);
145119
145538
  tokens.push(token);
145120
145539
  continue;
145121
- } // top-level paragraph
145122
- // prevent paragraph consuming extensions by clipping 'src' to extension start
145123
-
145540
+ }
145124
145541
 
145542
+ // top-level paragraph
145543
+ // prevent paragraph consuming extensions by clipping 'src' to extension start
145125
145544
  cutSrc = src;
145126
-
145127
145545
  if (this.options.extensions && this.options.extensions.startBlock) {
145128
145546
  (function () {
145129
145547
  var startIndex = Infinity;
145130
145548
  var tempSrc = src.slice(1);
145131
145549
  var tempStart = void 0;
145132
-
145133
145550
  _this.options.extensions.startBlock.forEach(function (getStartIndex) {
145134
145551
  tempStart = getStartIndex.call({
145135
145552
  lexer: this
145136
145553
  }, tempSrc);
145137
-
145138
145554
  if (typeof tempStart === 'number' && tempStart >= 0) {
145139
145555
  startIndex = Math.min(startIndex, tempStart);
145140
145556
  }
145141
145557
  });
145142
-
145143
145558
  if (startIndex < Infinity && startIndex >= 0) {
145144
145559
  cutSrc = src.substring(0, startIndex + 1);
145145
145560
  }
145146
145561
  })();
145147
145562
  }
145148
-
145149
145563
  if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
145150
145564
  lastToken = tokens[tokens.length - 1];
145151
-
145152
145565
  if (lastParagraphClipped && lastToken.type === 'paragraph') {
145153
145566
  lastToken.raw += '\n' + token.raw;
145154
145567
  lastToken.text += '\n' + token.text;
@@ -145157,17 +145570,15 @@ var Lexer = /*#__PURE__*/function () {
145157
145570
  } else {
145158
145571
  tokens.push(token);
145159
145572
  }
145160
-
145161
145573
  lastParagraphClipped = cutSrc.length !== src.length;
145162
145574
  src = src.substring(token.raw.length);
145163
145575
  continue;
145164
- } // text
145165
-
145576
+ }
145166
145577
 
145578
+ // text
145167
145579
  if (token = this.tokenizer.text(src)) {
145168
145580
  src = src.substring(token.raw.length);
145169
145581
  lastToken = tokens[tokens.length - 1];
145170
-
145171
145582
  if (lastToken && lastToken.type === 'text') {
145172
145583
  lastToken.raw += '\n' + token.raw;
145173
145584
  lastToken.text += '\n' + token.text;
@@ -145176,13 +145587,10 @@ var Lexer = /*#__PURE__*/function () {
145176
145587
  } else {
145177
145588
  tokens.push(token);
145178
145589
  }
145179
-
145180
145590
  continue;
145181
145591
  }
145182
-
145183
145592
  if (src) {
145184
145593
  var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
145185
-
145186
145594
  if (this.options.silent) {
145187
145595
  console.error(errMsg);
145188
145596
  break;
@@ -145191,43 +145599,38 @@ var Lexer = /*#__PURE__*/function () {
145191
145599
  }
145192
145600
  }
145193
145601
  }
145194
-
145195
145602
  this.state.top = true;
145196
145603
  return tokens;
145197
145604
  };
145198
-
145199
145605
  _proto.inline = function inline(src, tokens) {
145200
145606
  if (tokens === void 0) {
145201
145607
  tokens = [];
145202
145608
  }
145203
-
145204
145609
  this.inlineQueue.push({
145205
145610
  src: src,
145206
145611
  tokens: tokens
145207
145612
  });
145208
145613
  return tokens;
145209
145614
  }
145615
+
145210
145616
  /**
145211
145617
  * Lexing/Compiling
145212
- */
145213
- ;
145214
-
145618
+ */;
145215
145619
  _proto.inlineTokens = function inlineTokens(src, tokens) {
145216
145620
  var _this2 = this;
145217
-
145218
145621
  if (tokens === void 0) {
145219
145622
  tokens = [];
145220
145623
  }
145624
+ var token, lastToken, cutSrc;
145221
145625
 
145222
- var token, lastToken, cutSrc; // String with links masked to avoid interference with em and strong
145223
-
145626
+ // String with links masked to avoid interference with em and strong
145224
145627
  var maskedSrc = src;
145225
145628
  var match;
145226
- var keepPrevChar, prevChar; // Mask out reflinks
145629
+ var keepPrevChar, prevChar;
145227
145630
 
145631
+ // Mask out reflinks
145228
145632
  if (this.tokens.links) {
145229
145633
  var links = Object.keys(this.tokens.links);
145230
-
145231
145634
  if (links.length > 0) {
145232
145635
  while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
145233
145636
  if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
@@ -145235,25 +145638,24 @@ var Lexer = /*#__PURE__*/function () {
145235
145638
  }
145236
145639
  }
145237
145640
  }
145238
- } // Mask out other blocks
145239
-
145240
-
145641
+ }
145642
+ // Mask out other blocks
145241
145643
  while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
145242
145644
  maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
145243
- } // Mask out escaped em & strong delimiters
145244
-
145645
+ }
145245
145646
 
145647
+ // Mask out escaped em & strong delimiters
145246
145648
  while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
145247
- maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
145649
+ maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
145650
+ this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
145248
145651
  }
145249
-
145250
145652
  while (src) {
145251
145653
  if (!keepPrevChar) {
145252
145654
  prevChar = '';
145253
145655
  }
145656
+ keepPrevChar = false;
145254
145657
 
145255
- keepPrevChar = false; // extensions
145256
-
145658
+ // extensions
145257
145659
  if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
145258
145660
  if (token = extTokenizer.call({
145259
145661
  lexer: _this2
@@ -145262,148 +145664,132 @@ var Lexer = /*#__PURE__*/function () {
145262
145664
  tokens.push(token);
145263
145665
  return true;
145264
145666
  }
145265
-
145266
145667
  return false;
145267
145668
  })) {
145268
145669
  continue;
145269
- } // escape
145270
-
145670
+ }
145271
145671
 
145672
+ // escape
145272
145673
  if (token = this.tokenizer.escape(src)) {
145273
145674
  src = src.substring(token.raw.length);
145274
145675
  tokens.push(token);
145275
145676
  continue;
145276
- } // tag
145277
-
145677
+ }
145278
145678
 
145679
+ // tag
145279
145680
  if (token = this.tokenizer.tag(src)) {
145280
145681
  src = src.substring(token.raw.length);
145281
145682
  lastToken = tokens[tokens.length - 1];
145282
-
145283
145683
  if (lastToken && token.type === 'text' && lastToken.type === 'text') {
145284
145684
  lastToken.raw += token.raw;
145285
145685
  lastToken.text += token.text;
145286
145686
  } else {
145287
145687
  tokens.push(token);
145288
145688
  }
145289
-
145290
145689
  continue;
145291
- } // link
145292
-
145690
+ }
145293
145691
 
145692
+ // link
145294
145693
  if (token = this.tokenizer.link(src)) {
145295
145694
  src = src.substring(token.raw.length);
145296
145695
  tokens.push(token);
145297
145696
  continue;
145298
- } // reflink, nolink
145299
-
145697
+ }
145300
145698
 
145699
+ // reflink, nolink
145301
145700
  if (token = this.tokenizer.reflink(src, this.tokens.links)) {
145302
145701
  src = src.substring(token.raw.length);
145303
145702
  lastToken = tokens[tokens.length - 1];
145304
-
145305
145703
  if (lastToken && token.type === 'text' && lastToken.type === 'text') {
145306
145704
  lastToken.raw += token.raw;
145307
145705
  lastToken.text += token.text;
145308
145706
  } else {
145309
145707
  tokens.push(token);
145310
145708
  }
145311
-
145312
145709
  continue;
145313
- } // em & strong
145314
-
145710
+ }
145315
145711
 
145712
+ // em & strong
145316
145713
  if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
145317
145714
  src = src.substring(token.raw.length);
145318
145715
  tokens.push(token);
145319
145716
  continue;
145320
- } // code
145321
-
145717
+ }
145322
145718
 
145719
+ // code
145323
145720
  if (token = this.tokenizer.codespan(src)) {
145324
145721
  src = src.substring(token.raw.length);
145325
145722
  tokens.push(token);
145326
145723
  continue;
145327
- } // br
145328
-
145724
+ }
145329
145725
 
145726
+ // br
145330
145727
  if (token = this.tokenizer.br(src)) {
145331
145728
  src = src.substring(token.raw.length);
145332
145729
  tokens.push(token);
145333
145730
  continue;
145334
- } // del (gfm)
145335
-
145731
+ }
145336
145732
 
145733
+ // del (gfm)
145337
145734
  if (token = this.tokenizer.del(src)) {
145338
145735
  src = src.substring(token.raw.length);
145339
145736
  tokens.push(token);
145340
145737
  continue;
145341
- } // autolink
145342
-
145738
+ }
145343
145739
 
145740
+ // autolink
145344
145741
  if (token = this.tokenizer.autolink(src, mangle)) {
145345
145742
  src = src.substring(token.raw.length);
145346
145743
  tokens.push(token);
145347
145744
  continue;
145348
- } // url (gfm)
145349
-
145745
+ }
145350
145746
 
145747
+ // url (gfm)
145351
145748
  if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
145352
145749
  src = src.substring(token.raw.length);
145353
145750
  tokens.push(token);
145354
145751
  continue;
145355
- } // text
145356
- // prevent inlineText consuming extensions by clipping 'src' to extension start
145357
-
145752
+ }
145358
145753
 
145754
+ // text
145755
+ // prevent inlineText consuming extensions by clipping 'src' to extension start
145359
145756
  cutSrc = src;
145360
-
145361
145757
  if (this.options.extensions && this.options.extensions.startInline) {
145362
145758
  (function () {
145363
145759
  var startIndex = Infinity;
145364
145760
  var tempSrc = src.slice(1);
145365
145761
  var tempStart = void 0;
145366
-
145367
145762
  _this2.options.extensions.startInline.forEach(function (getStartIndex) {
145368
145763
  tempStart = getStartIndex.call({
145369
145764
  lexer: this
145370
145765
  }, tempSrc);
145371
-
145372
145766
  if (typeof tempStart === 'number' && tempStart >= 0) {
145373
145767
  startIndex = Math.min(startIndex, tempStart);
145374
145768
  }
145375
145769
  });
145376
-
145377
145770
  if (startIndex < Infinity && startIndex >= 0) {
145378
145771
  cutSrc = src.substring(0, startIndex + 1);
145379
145772
  }
145380
145773
  })();
145381
145774
  }
145382
-
145383
145775
  if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
145384
145776
  src = src.substring(token.raw.length);
145385
-
145386
145777
  if (token.raw.slice(-1) !== '_') {
145387
145778
  // Track prevChar before string of ____ started
145388
145779
  prevChar = token.raw.slice(-1);
145389
145780
  }
145390
-
145391
145781
  keepPrevChar = true;
145392
145782
  lastToken = tokens[tokens.length - 1];
145393
-
145394
145783
  if (lastToken && lastToken.type === 'text') {
145395
145784
  lastToken.raw += token.raw;
145396
145785
  lastToken.text += token.text;
145397
145786
  } else {
145398
145787
  tokens.push(token);
145399
145788
  }
145400
-
145401
145789
  continue;
145402
145790
  }
145403
-
145404
145791
  if (src) {
145405
145792
  var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
145406
-
145407
145793
  if (this.options.silent) {
145408
145794
  console.error(errMsg);
145409
145795
  break;
@@ -145412,10 +145798,8 @@ var Lexer = /*#__PURE__*/function () {
145412
145798
  }
145413
145799
  }
145414
145800
  }
145415
-
145416
145801
  return tokens;
145417
145802
  };
145418
-
145419
145803
  _createClass(Lexer, null, [{
145420
145804
  key: "rules",
145421
145805
  get: function get() {
@@ -145425,212 +145809,175 @@ var Lexer = /*#__PURE__*/function () {
145425
145809
  };
145426
145810
  }
145427
145811
  }]);
145428
-
145429
145812
  return Lexer;
145430
145813
  }();
145431
145814
 
145432
145815
  /**
145433
145816
  * Renderer
145434
145817
  */
145435
-
145436
145818
  var Renderer = /*#__PURE__*/function () {
145437
145819
  function Renderer(options) {
145438
145820
  this.options = options || exports.defaults;
145439
145821
  }
145440
-
145441
145822
  var _proto = Renderer.prototype;
145442
-
145443
145823
  _proto.code = function code(_code, infostring, escaped) {
145444
145824
  var lang = (infostring || '').match(/\S*/)[0];
145445
-
145446
145825
  if (this.options.highlight) {
145447
145826
  var out = this.options.highlight(_code, lang);
145448
-
145449
145827
  if (out != null && out !== _code) {
145450
145828
  escaped = true;
145451
145829
  _code = out;
145452
145830
  }
145453
145831
  }
145454
-
145455
145832
  _code = _code.replace(/\n$/, '') + '\n';
145456
-
145457
145833
  if (!lang) {
145458
145834
  return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
145459
145835
  }
145460
-
145461
145836
  return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
145462
145837
  }
145838
+
145463
145839
  /**
145464
145840
  * @param {string} quote
145465
- */
145466
- ;
145467
-
145841
+ */;
145468
145842
  _proto.blockquote = function blockquote(quote) {
145469
145843
  return "<blockquote>\n" + quote + "</blockquote>\n";
145470
145844
  };
145471
-
145472
145845
  _proto.html = function html(_html) {
145473
145846
  return _html;
145474
145847
  }
145848
+
145475
145849
  /**
145476
145850
  * @param {string} text
145477
145851
  * @param {string} level
145478
145852
  * @param {string} raw
145479
145853
  * @param {any} slugger
145480
- */
145481
- ;
145482
-
145854
+ */;
145483
145855
  _proto.heading = function heading(text, level, raw, slugger) {
145484
145856
  if (this.options.headerIds) {
145485
145857
  var id = this.options.headerPrefix + slugger.slug(raw);
145486
145858
  return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
145487
- } // ignore IDs
145488
-
145859
+ }
145489
145860
 
145861
+ // ignore IDs
145490
145862
  return "<h" + level + ">" + text + "</h" + level + ">\n";
145491
145863
  };
145492
-
145493
145864
  _proto.hr = function hr() {
145494
145865
  return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
145495
145866
  };
145496
-
145497
145867
  _proto.list = function list(body, ordered, start) {
145498
145868
  var type = ordered ? 'ol' : 'ul',
145499
- startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
145869
+ startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
145500
145870
  return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
145501
145871
  }
145872
+
145502
145873
  /**
145503
145874
  * @param {string} text
145504
- */
145505
- ;
145506
-
145875
+ */;
145507
145876
  _proto.listitem = function listitem(text) {
145508
145877
  return "<li>" + text + "</li>\n";
145509
145878
  };
145510
-
145511
145879
  _proto.checkbox = function checkbox(checked) {
145512
145880
  return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
145513
145881
  }
145882
+
145514
145883
  /**
145515
145884
  * @param {string} text
145516
- */
145517
- ;
145518
-
145885
+ */;
145519
145886
  _proto.paragraph = function paragraph(text) {
145520
145887
  return "<p>" + text + "</p>\n";
145521
145888
  }
145889
+
145522
145890
  /**
145523
145891
  * @param {string} header
145524
145892
  * @param {string} body
145525
- */
145526
- ;
145527
-
145893
+ */;
145528
145894
  _proto.table = function table(header, body) {
145529
145895
  if (body) body = "<tbody>" + body + "</tbody>";
145530
145896
  return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
145531
145897
  }
145898
+
145532
145899
  /**
145533
145900
  * @param {string} content
145534
- */
145535
- ;
145536
-
145901
+ */;
145537
145902
  _proto.tablerow = function tablerow(content) {
145538
145903
  return "<tr>\n" + content + "</tr>\n";
145539
145904
  };
145540
-
145541
145905
  _proto.tablecell = function tablecell(content, flags) {
145542
145906
  var type = flags.header ? 'th' : 'td';
145543
145907
  var tag = flags.align ? "<" + type + " align=\"" + flags.align + "\">" : "<" + type + ">";
145544
145908
  return tag + content + ("</" + type + ">\n");
145545
145909
  }
145910
+
145546
145911
  /**
145547
145912
  * span level renderer
145548
145913
  * @param {string} text
145549
- */
145550
- ;
145551
-
145914
+ */;
145552
145915
  _proto.strong = function strong(text) {
145553
145916
  return "<strong>" + text + "</strong>";
145554
145917
  }
145918
+
145555
145919
  /**
145556
145920
  * @param {string} text
145557
- */
145558
- ;
145559
-
145921
+ */;
145560
145922
  _proto.em = function em(text) {
145561
145923
  return "<em>" + text + "</em>";
145562
145924
  }
145925
+
145563
145926
  /**
145564
145927
  * @param {string} text
145565
- */
145566
- ;
145567
-
145928
+ */;
145568
145929
  _proto.codespan = function codespan(text) {
145569
145930
  return "<code>" + text + "</code>";
145570
145931
  };
145571
-
145572
145932
  _proto.br = function br() {
145573
145933
  return this.options.xhtml ? '<br/>' : '<br>';
145574
145934
  }
145935
+
145575
145936
  /**
145576
145937
  * @param {string} text
145577
- */
145578
- ;
145579
-
145938
+ */;
145580
145939
  _proto.del = function del(text) {
145581
145940
  return "<del>" + text + "</del>";
145582
145941
  }
145942
+
145583
145943
  /**
145584
145944
  * @param {string} href
145585
145945
  * @param {string} title
145586
145946
  * @param {string} text
145587
- */
145588
- ;
145589
-
145947
+ */;
145590
145948
  _proto.link = function link(href, title, text) {
145591
145949
  href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
145592
-
145593
145950
  if (href === null) {
145594
145951
  return text;
145595
145952
  }
145596
-
145597
145953
  var out = '<a href="' + escape(href) + '"';
145598
-
145599
145954
  if (title) {
145600
145955
  out += ' title="' + title + '"';
145601
145956
  }
145602
-
145603
145957
  out += '>' + text + '</a>';
145604
145958
  return out;
145605
145959
  }
145960
+
145606
145961
  /**
145607
145962
  * @param {string} href
145608
145963
  * @param {string} title
145609
145964
  * @param {string} text
145610
- */
145611
- ;
145612
-
145965
+ */;
145613
145966
  _proto.image = function image(href, title, text) {
145614
145967
  href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
145615
-
145616
145968
  if (href === null) {
145617
145969
  return text;
145618
145970
  }
145619
-
145620
145971
  var out = "<img src=\"" + href + "\" alt=\"" + text + "\"";
145621
-
145622
145972
  if (title) {
145623
145973
  out += " title=\"" + title + "\"";
145624
145974
  }
145625
-
145626
145975
  out += this.options.xhtml ? '/>' : '>';
145627
145976
  return out;
145628
145977
  };
145629
-
145630
145978
  _proto.text = function text(_text) {
145631
145979
  return _text;
145632
145980
  };
145633
-
145634
145981
  return Renderer;
145635
145982
  }();
145636
145983
 
@@ -145640,46 +145987,35 @@ var Renderer = /*#__PURE__*/function () {
145640
145987
  */
145641
145988
  var TextRenderer = /*#__PURE__*/function () {
145642
145989
  function TextRenderer() {}
145643
-
145644
145990
  var _proto = TextRenderer.prototype;
145645
-
145646
145991
  // no need for block level renderers
145647
145992
  _proto.strong = function strong(text) {
145648
145993
  return text;
145649
145994
  };
145650
-
145651
145995
  _proto.em = function em(text) {
145652
145996
  return text;
145653
145997
  };
145654
-
145655
145998
  _proto.codespan = function codespan(text) {
145656
145999
  return text;
145657
146000
  };
145658
-
145659
146001
  _proto.del = function del(text) {
145660
146002
  return text;
145661
146003
  };
145662
-
145663
146004
  _proto.html = function html(text) {
145664
146005
  return text;
145665
146006
  };
145666
-
145667
146007
  _proto.text = function text(_text) {
145668
146008
  return _text;
145669
146009
  };
145670
-
145671
146010
  _proto.link = function link(href, title, text) {
145672
146011
  return '' + text;
145673
146012
  };
145674
-
145675
146013
  _proto.image = function image(href, title, text) {
145676
146014
  return '' + text;
145677
146015
  };
145678
-
145679
146016
  _proto.br = function br() {
145680
146017
  return '';
145681
146018
  };
145682
-
145683
146019
  return TextRenderer;
145684
146020
  }();
145685
146021
 
@@ -145690,69 +146026,60 @@ var Slugger = /*#__PURE__*/function () {
145690
146026
  function Slugger() {
145691
146027
  this.seen = {};
145692
146028
  }
146029
+
145693
146030
  /**
145694
146031
  * @param {string} value
145695
146032
  */
145696
-
145697
-
145698
146033
  var _proto = Slugger.prototype;
145699
-
145700
146034
  _proto.serialize = function serialize(value) {
145701
- return value.toLowerCase().trim() // remove html tags
145702
- .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
146035
+ return value.toLowerCase().trim()
146036
+ // remove html tags
146037
+ .replace(/<[!\/a-z].*?>/ig, '')
146038
+ // remove unwanted chars
145703
146039
  .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
145704
146040
  }
146041
+
145705
146042
  /**
145706
146043
  * Finds the next safe (unique) slug to use
145707
146044
  * @param {string} originalSlug
145708
146045
  * @param {boolean} isDryRun
145709
- */
145710
- ;
145711
-
146046
+ */;
145712
146047
  _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
145713
146048
  var slug = originalSlug;
145714
146049
  var occurenceAccumulator = 0;
145715
-
145716
146050
  if (this.seen.hasOwnProperty(slug)) {
145717
146051
  occurenceAccumulator = this.seen[originalSlug];
145718
-
145719
146052
  do {
145720
146053
  occurenceAccumulator++;
145721
146054
  slug = originalSlug + '-' + occurenceAccumulator;
145722
146055
  } while (this.seen.hasOwnProperty(slug));
145723
146056
  }
145724
-
145725
146057
  if (!isDryRun) {
145726
146058
  this.seen[originalSlug] = occurenceAccumulator;
145727
146059
  this.seen[slug] = 0;
145728
146060
  }
145729
-
145730
146061
  return slug;
145731
146062
  }
146063
+
145732
146064
  /**
145733
146065
  * Convert string to unique id
145734
146066
  * @param {object} [options]
145735
146067
  * @param {boolean} [options.dryrun] Generates the next unique slug without
145736
146068
  * updating the internal accumulator.
145737
- */
145738
- ;
145739
-
146069
+ */;
145740
146070
  _proto.slug = function slug(value, options) {
145741
146071
  if (options === void 0) {
145742
146072
  options = {};
145743
146073
  }
145744
-
145745
146074
  var slug = this.serialize(value);
145746
146075
  return this.getNextSafeSlug(slug, options.dryrun);
145747
146076
  };
145748
-
145749
146077
  return Slugger;
145750
146078
  }();
145751
146079
 
145752
146080
  /**
145753
146081
  * Parsing & Compiling
145754
146082
  */
145755
-
145756
146083
  var Parser = /*#__PURE__*/function () {
145757
146084
  function Parser(options) {
145758
146085
  this.options = options || exports.defaults;
@@ -145762,140 +146089,122 @@ var Parser = /*#__PURE__*/function () {
145762
146089
  this.textRenderer = new TextRenderer();
145763
146090
  this.slugger = new Slugger();
145764
146091
  }
146092
+
145765
146093
  /**
145766
146094
  * Static Parse Method
145767
146095
  */
145768
-
145769
-
145770
146096
  Parser.parse = function parse(tokens, options) {
145771
146097
  var parser = new Parser(options);
145772
146098
  return parser.parse(tokens);
145773
146099
  }
146100
+
145774
146101
  /**
145775
146102
  * Static Parse Inline Method
145776
- */
145777
- ;
145778
-
146103
+ */;
145779
146104
  Parser.parseInline = function parseInline(tokens, options) {
145780
146105
  var parser = new Parser(options);
145781
146106
  return parser.parseInline(tokens);
145782
146107
  }
146108
+
145783
146109
  /**
145784
146110
  * Parse Loop
145785
- */
145786
- ;
145787
-
146111
+ */;
145788
146112
  var _proto = Parser.prototype;
145789
-
145790
146113
  _proto.parse = function parse(tokens, top) {
145791
146114
  if (top === void 0) {
145792
146115
  top = true;
145793
146116
  }
145794
-
145795
146117
  var out = '',
145796
- i,
145797
- j,
145798
- k,
145799
- l2,
145800
- l3,
145801
- row,
145802
- cell,
145803
- header,
145804
- body,
145805
- token,
145806
- ordered,
145807
- start,
145808
- loose,
145809
- itemBody,
145810
- item,
145811
- checked,
145812
- task,
145813
- checkbox,
145814
- ret;
146118
+ i,
146119
+ j,
146120
+ k,
146121
+ l2,
146122
+ l3,
146123
+ row,
146124
+ cell,
146125
+ header,
146126
+ body,
146127
+ token,
146128
+ ordered,
146129
+ start,
146130
+ loose,
146131
+ itemBody,
146132
+ item,
146133
+ checked,
146134
+ task,
146135
+ checkbox,
146136
+ ret;
145815
146137
  var l = tokens.length;
145816
-
145817
146138
  for (i = 0; i < l; i++) {
145818
- token = tokens[i]; // Run any renderer extensions
146139
+ token = tokens[i];
145819
146140
 
146141
+ // Run any renderer extensions
145820
146142
  if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
145821
146143
  ret = this.options.extensions.renderers[token.type].call({
145822
146144
  parser: this
145823
146145
  }, token);
145824
-
145825
146146
  if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
145826
146147
  out += ret || '';
145827
146148
  continue;
145828
146149
  }
145829
146150
  }
145830
-
145831
146151
  switch (token.type) {
145832
146152
  case 'space':
145833
146153
  {
145834
146154
  continue;
145835
146155
  }
145836
-
145837
146156
  case 'hr':
145838
146157
  {
145839
146158
  out += this.renderer.hr();
145840
146159
  continue;
145841
146160
  }
145842
-
145843
146161
  case 'heading':
145844
146162
  {
145845
146163
  out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
145846
146164
  continue;
145847
146165
  }
145848
-
145849
146166
  case 'code':
145850
146167
  {
145851
146168
  out += this.renderer.code(token.text, token.lang, token.escaped);
145852
146169
  continue;
145853
146170
  }
145854
-
145855
146171
  case 'table':
145856
146172
  {
145857
- header = ''; // header
146173
+ header = '';
145858
146174
 
146175
+ // header
145859
146176
  cell = '';
145860
146177
  l2 = token.header.length;
145861
-
145862
146178
  for (j = 0; j < l2; j++) {
145863
146179
  cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
145864
146180
  header: true,
145865
146181
  align: token.align[j]
145866
146182
  });
145867
146183
  }
145868
-
145869
146184
  header += this.renderer.tablerow(cell);
145870
146185
  body = '';
145871
146186
  l2 = token.rows.length;
145872
-
145873
146187
  for (j = 0; j < l2; j++) {
145874
146188
  row = token.rows[j];
145875
146189
  cell = '';
145876
146190
  l3 = row.length;
145877
-
145878
146191
  for (k = 0; k < l3; k++) {
145879
146192
  cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
145880
146193
  header: false,
145881
146194
  align: token.align[k]
145882
146195
  });
145883
146196
  }
145884
-
145885
146197
  body += this.renderer.tablerow(cell);
145886
146198
  }
145887
-
145888
146199
  out += this.renderer.table(header, body);
145889
146200
  continue;
145890
146201
  }
145891
-
145892
146202
  case 'blockquote':
145893
146203
  {
145894
146204
  body = this.parse(token.tokens);
145895
146205
  out += this.renderer.blockquote(body);
145896
146206
  continue;
145897
146207
  }
145898
-
145899
146208
  case 'list':
145900
146209
  {
145901
146210
  ordered = token.ordered;
@@ -145903,20 +146212,16 @@ var Parser = /*#__PURE__*/function () {
145903
146212
  loose = token.loose;
145904
146213
  l2 = token.items.length;
145905
146214
  body = '';
145906
-
145907
146215
  for (j = 0; j < l2; j++) {
145908
146216
  item = token.items[j];
145909
146217
  checked = item.checked;
145910
146218
  task = item.task;
145911
146219
  itemBody = '';
145912
-
145913
146220
  if (item.task) {
145914
146221
  checkbox = this.renderer.checkbox(checked);
145915
-
145916
146222
  if (loose) {
145917
146223
  if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
145918
146224
  item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
145919
-
145920
146225
  if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
145921
146226
  item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
145922
146227
  }
@@ -145930,45 +146235,36 @@ var Parser = /*#__PURE__*/function () {
145930
146235
  itemBody += checkbox;
145931
146236
  }
145932
146237
  }
145933
-
145934
146238
  itemBody += this.parse(item.tokens, loose);
145935
146239
  body += this.renderer.listitem(itemBody, task, checked);
145936
146240
  }
145937
-
145938
146241
  out += this.renderer.list(body, ordered, start);
145939
146242
  continue;
145940
146243
  }
145941
-
145942
146244
  case 'html':
145943
146245
  {
145944
146246
  // TODO parse inline content if parameter markdown=1
145945
146247
  out += this.renderer.html(token.text);
145946
146248
  continue;
145947
146249
  }
145948
-
145949
146250
  case 'paragraph':
145950
146251
  {
145951
146252
  out += this.renderer.paragraph(this.parseInline(token.tokens));
145952
146253
  continue;
145953
146254
  }
145954
-
145955
146255
  case 'text':
145956
146256
  {
145957
146257
  body = token.tokens ? this.parseInline(token.tokens) : token.text;
145958
-
145959
146258
  while (i + 1 < l && tokens[i + 1].type === 'text') {
145960
146259
  token = tokens[++i];
145961
146260
  body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
145962
146261
  }
145963
-
145964
146262
  out += top ? this.renderer.paragraph(body) : body;
145965
146263
  continue;
145966
146264
  }
145967
-
145968
146265
  default:
145969
146266
  {
145970
146267
  var errMsg = 'Token with "' + token.type + '" type was not found.';
145971
-
145972
146268
  if (this.options.silent) {
145973
146269
  console.error(errMsg);
145974
146270
  return;
@@ -145978,101 +146274,86 @@ var Parser = /*#__PURE__*/function () {
145978
146274
  }
145979
146275
  }
145980
146276
  }
145981
-
145982
146277
  return out;
145983
146278
  }
146279
+
145984
146280
  /**
145985
146281
  * Parse Inline Tokens
145986
- */
145987
- ;
145988
-
146282
+ */;
145989
146283
  _proto.parseInline = function parseInline(tokens, renderer) {
145990
146284
  renderer = renderer || this.renderer;
145991
146285
  var out = '',
145992
- i,
145993
- token,
145994
- ret;
146286
+ i,
146287
+ token,
146288
+ ret;
145995
146289
  var l = tokens.length;
145996
-
145997
146290
  for (i = 0; i < l; i++) {
145998
- token = tokens[i]; // Run any renderer extensions
146291
+ token = tokens[i];
145999
146292
 
146293
+ // Run any renderer extensions
146000
146294
  if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
146001
146295
  ret = this.options.extensions.renderers[token.type].call({
146002
146296
  parser: this
146003
146297
  }, token);
146004
-
146005
146298
  if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
146006
146299
  out += ret || '';
146007
146300
  continue;
146008
146301
  }
146009
146302
  }
146010
-
146011
146303
  switch (token.type) {
146012
146304
  case 'escape':
146013
146305
  {
146014
146306
  out += renderer.text(token.text);
146015
146307
  break;
146016
146308
  }
146017
-
146018
146309
  case 'html':
146019
146310
  {
146020
146311
  out += renderer.html(token.text);
146021
146312
  break;
146022
146313
  }
146023
-
146024
146314
  case 'link':
146025
146315
  {
146026
146316
  out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
146027
146317
  break;
146028
146318
  }
146029
-
146030
146319
  case 'image':
146031
146320
  {
146032
146321
  out += renderer.image(token.href, token.title, token.text);
146033
146322
  break;
146034
146323
  }
146035
-
146036
146324
  case 'strong':
146037
146325
  {
146038
146326
  out += renderer.strong(this.parseInline(token.tokens, renderer));
146039
146327
  break;
146040
146328
  }
146041
-
146042
146329
  case 'em':
146043
146330
  {
146044
146331
  out += renderer.em(this.parseInline(token.tokens, renderer));
146045
146332
  break;
146046
146333
  }
146047
-
146048
146334
  case 'codespan':
146049
146335
  {
146050
146336
  out += renderer.codespan(token.text);
146051
146337
  break;
146052
146338
  }
146053
-
146054
146339
  case 'br':
146055
146340
  {
146056
146341
  out += renderer.br();
146057
146342
  break;
146058
146343
  }
146059
-
146060
146344
  case 'del':
146061
146345
  {
146062
146346
  out += renderer.del(this.parseInline(token.tokens, renderer));
146063
146347
  break;
146064
146348
  }
146065
-
146066
146349
  case 'text':
146067
146350
  {
146068
146351
  out += renderer.text(token.text);
146069
146352
  break;
146070
146353
  }
146071
-
146072
146354
  default:
146073
146355
  {
146074
146356
  var errMsg = 'Token with "' + token.type + '" type was not found.';
146075
-
146076
146357
  if (this.options.silent) {
146077
146358
  console.error(errMsg);
146078
146359
  return;
@@ -146082,68 +146363,54 @@ var Parser = /*#__PURE__*/function () {
146082
146363
  }
146083
146364
  }
146084
146365
  }
146085
-
146086
146366
  return out;
146087
146367
  };
146088
-
146089
146368
  return Parser;
146090
146369
  }();
146091
146370
 
146092
146371
  /**
146093
146372
  * Marked
146094
146373
  */
146095
-
146096
146374
  function marked(src, opt, callback) {
146097
146375
  // throw error in case of non string input
146098
146376
  if (typeof src === 'undefined' || src === null) {
146099
146377
  throw new Error('marked(): input parameter is undefined or null');
146100
146378
  }
146101
-
146102
146379
  if (typeof src !== 'string') {
146103
146380
  throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
146104
146381
  }
146105
-
146106
146382
  if (typeof opt === 'function') {
146107
146383
  callback = opt;
146108
146384
  opt = null;
146109
146385
  }
146110
-
146111
146386
  opt = merge({}, marked.defaults, opt || {});
146112
146387
  checkSanitizeDeprecation(opt);
146113
-
146114
146388
  if (callback) {
146115
146389
  var highlight = opt.highlight;
146116
146390
  var tokens;
146117
-
146118
146391
  try {
146119
146392
  tokens = Lexer.lex(src, opt);
146120
146393
  } catch (e) {
146121
146394
  return callback(e);
146122
146395
  }
146123
-
146124
146396
  var done = function done(err) {
146125
146397
  var out;
146126
-
146127
146398
  if (!err) {
146128
146399
  try {
146129
146400
  if (opt.walkTokens) {
146130
146401
  marked.walkTokens(tokens, opt.walkTokens);
146131
146402
  }
146132
-
146133
146403
  out = Parser.parse(tokens, opt);
146134
146404
  } catch (e) {
146135
146405
  err = e;
146136
146406
  }
146137
146407
  }
146138
-
146139
146408
  opt.highlight = highlight;
146140
146409
  return err ? callback(err) : callback(null, out);
146141
146410
  };
146142
-
146143
146411
  if (!highlight || highlight.length < 3) {
146144
146412
  return done();
146145
146413
  }
146146
-
146147
146414
  delete opt.highlight;
146148
146415
  if (!tokens.length) return done();
146149
146416
  var pending = 0;
@@ -146155,14 +146422,11 @@ function marked(src, opt, callback) {
146155
146422
  if (err) {
146156
146423
  return done(err);
146157
146424
  }
146158
-
146159
146425
  if (code != null && code !== token.text) {
146160
146426
  token.text = code;
146161
146427
  token.escaped = true;
146162
146428
  }
146163
-
146164
146429
  pending--;
146165
-
146166
146430
  if (pending === 0) {
146167
146431
  done();
146168
146432
  }
@@ -146170,42 +146434,34 @@ function marked(src, opt, callback) {
146170
146434
  }, 0);
146171
146435
  }
146172
146436
  });
146173
-
146174
146437
  if (pending === 0) {
146175
146438
  done();
146176
146439
  }
146177
-
146178
146440
  return;
146179
146441
  }
146180
-
146181
146442
  function onError(e) {
146182
146443
  e.message += '\nPlease report this to https://github.com/markedjs/marked.';
146183
-
146184
146444
  if (opt.silent) {
146185
146445
  return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
146186
146446
  }
146187
-
146188
146447
  throw e;
146189
146448
  }
146190
-
146191
146449
  try {
146192
146450
  var _tokens = Lexer.lex(src, opt);
146193
-
146194
146451
  if (opt.walkTokens) {
146195
146452
  if (opt.async) {
146196
146453
  return Promise.all(marked.walkTokens(_tokens, opt.walkTokens)).then(function () {
146197
146454
  return Parser.parse(_tokens, opt);
146198
146455
  })["catch"](onError);
146199
146456
  }
146200
-
146201
146457
  marked.walkTokens(_tokens, opt.walkTokens);
146202
146458
  }
146203
-
146204
146459
  return Parser.parse(_tokens, opt);
146205
146460
  } catch (e) {
146206
146461
  onError(e);
146207
146462
  }
146208
146463
  }
146464
+
146209
146465
  /**
146210
146466
  * Options
146211
146467
  */
@@ -146215,9 +146471,9 @@ marked.options = marked.setOptions = function (opt) {
146215
146471
  changeDefaults(marked.defaults);
146216
146472
  return marked;
146217
146473
  };
146218
-
146219
146474
  marked.getDefaults = getDefaults;
146220
146475
  marked.defaults = exports.defaults;
146476
+
146221
146477
  /**
146222
146478
  * Use Extension
146223
146479
  */
@@ -146226,7 +146482,6 @@ marked.use = function () {
146226
146482
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
146227
146483
  args[_key] = arguments[_key];
146228
146484
  }
146229
-
146230
146485
  var opts = merge.apply(void 0, [{}].concat(args));
146231
146486
  var extensions = marked.defaults.extensions || {
146232
146487
  renderers: {},
@@ -146241,43 +146496,35 @@ marked.use = function () {
146241
146496
  if (!ext.name) {
146242
146497
  throw new Error('extension name required');
146243
146498
  }
146244
-
146245
146499
  if (ext.renderer) {
146246
146500
  // Renderer extensions
146247
146501
  var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
146248
-
146249
146502
  if (prevRenderer) {
146250
146503
  // Replace extension with func to run new extension but fall back if false
146251
146504
  extensions.renderers[ext.name] = function () {
146252
146505
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
146253
146506
  args[_key2] = arguments[_key2];
146254
146507
  }
146255
-
146256
146508
  var ret = ext.renderer.apply(this, args);
146257
-
146258
146509
  if (ret === false) {
146259
146510
  ret = prevRenderer.apply(this, args);
146260
146511
  }
146261
-
146262
146512
  return ret;
146263
146513
  };
146264
146514
  } else {
146265
146515
  extensions.renderers[ext.name] = ext.renderer;
146266
146516
  }
146267
146517
  }
146268
-
146269
146518
  if (ext.tokenizer) {
146270
146519
  // Tokenizer Extensions
146271
146520
  if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
146272
146521
  throw new Error("extension level must be 'block' or 'inline'");
146273
146522
  }
146274
-
146275
146523
  if (extensions[ext.level]) {
146276
146524
  extensions[ext.level].unshift(ext.tokenizer);
146277
146525
  } else {
146278
146526
  extensions[ext.level] = [ext.tokenizer];
146279
146527
  }
146280
-
146281
146528
  if (ext.start) {
146282
146529
  // Function to check for start of token
146283
146530
  if (ext.level === 'block') {
@@ -146295,110 +146542,89 @@ marked.use = function () {
146295
146542
  }
146296
146543
  }
146297
146544
  }
146298
-
146299
146545
  if (ext.childTokens) {
146300
146546
  // Child tokens to be visited by walkTokens
146301
146547
  extensions.childTokens[ext.name] = ext.childTokens;
146302
146548
  }
146303
146549
  });
146304
- } // ==-- Parse "overwrite" extensions --== //
146305
-
146550
+ }
146306
146551
 
146552
+ // ==-- Parse "overwrite" extensions --== //
146307
146553
  if (pack.renderer) {
146308
146554
  (function () {
146309
146555
  var renderer = marked.defaults.renderer || new Renderer();
146310
-
146311
146556
  var _loop = function _loop(prop) {
146312
- var prevRenderer = renderer[prop]; // Replace renderer with func to run extension, but fall back if false
146313
-
146557
+ var prevRenderer = renderer[prop];
146558
+ // Replace renderer with func to run extension, but fall back if false
146314
146559
  renderer[prop] = function () {
146315
146560
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
146316
146561
  args[_key3] = arguments[_key3];
146317
146562
  }
146318
-
146319
146563
  var ret = pack.renderer[prop].apply(renderer, args);
146320
-
146321
146564
  if (ret === false) {
146322
146565
  ret = prevRenderer.apply(renderer, args);
146323
146566
  }
146324
-
146325
146567
  return ret;
146326
146568
  };
146327
146569
  };
146328
-
146329
146570
  for (var prop in pack.renderer) {
146330
146571
  _loop(prop);
146331
146572
  }
146332
-
146333
146573
  opts.renderer = renderer;
146334
146574
  })();
146335
146575
  }
146336
-
146337
146576
  if (pack.tokenizer) {
146338
146577
  (function () {
146339
146578
  var tokenizer = marked.defaults.tokenizer || new Tokenizer();
146340
-
146341
146579
  var _loop2 = function _loop2(prop) {
146342
- var prevTokenizer = tokenizer[prop]; // Replace tokenizer with func to run extension, but fall back if false
146343
-
146580
+ var prevTokenizer = tokenizer[prop];
146581
+ // Replace tokenizer with func to run extension, but fall back if false
146344
146582
  tokenizer[prop] = function () {
146345
146583
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
146346
146584
  args[_key4] = arguments[_key4];
146347
146585
  }
146348
-
146349
146586
  var ret = pack.tokenizer[prop].apply(tokenizer, args);
146350
-
146351
146587
  if (ret === false) {
146352
146588
  ret = prevTokenizer.apply(tokenizer, args);
146353
146589
  }
146354
-
146355
146590
  return ret;
146356
146591
  };
146357
146592
  };
146358
-
146359
146593
  for (var prop in pack.tokenizer) {
146360
146594
  _loop2(prop);
146361
146595
  }
146362
-
146363
146596
  opts.tokenizer = tokenizer;
146364
146597
  })();
146365
- } // ==-- Parse WalkTokens extensions --== //
146366
-
146598
+ }
146367
146599
 
146600
+ // ==-- Parse WalkTokens extensions --== //
146368
146601
  if (pack.walkTokens) {
146369
146602
  var _walkTokens = marked.defaults.walkTokens;
146370
-
146371
146603
  opts.walkTokens = function (token) {
146372
146604
  var values = [];
146373
146605
  values.push(pack.walkTokens.call(this, token));
146374
-
146375
146606
  if (_walkTokens) {
146376
146607
  values = values.concat(_walkTokens.call(this, token));
146377
146608
  }
146378
-
146379
146609
  return values;
146380
146610
  };
146381
146611
  }
146382
-
146383
146612
  if (hasExtensions) {
146384
146613
  opts.extensions = extensions;
146385
146614
  }
146386
-
146387
146615
  marked.setOptions(opts);
146388
146616
  });
146389
146617
  };
146618
+
146390
146619
  /**
146391
146620
  * Run callback for every token
146392
146621
  */
146393
146622
 
146394
-
146395
146623
  marked.walkTokens = function (tokens, callback) {
146396
146624
  var values = [];
146397
-
146398
146625
  var _loop3 = function _loop3() {
146399
146626
  var token = _step.value;
146400
146627
  values = values.concat(callback.call(marked, token));
146401
-
146402
146628
  switch (token.type) {
146403
146629
  case 'table':
146404
146630
  {
@@ -146406,25 +146632,20 @@ marked.walkTokens = function (tokens, callback) {
146406
146632
  var cell = _step2.value;
146407
146633
  values = values.concat(marked.walkTokens(cell.tokens, callback));
146408
146634
  }
146409
-
146410
146635
  for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
146411
146636
  var row = _step3.value;
146412
-
146413
146637
  for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
146414
146638
  var _cell = _step4.value;
146415
146639
  values = values.concat(marked.walkTokens(_cell.tokens, callback));
146416
146640
  }
146417
146641
  }
146418
-
146419
146642
  break;
146420
146643
  }
146421
-
146422
146644
  case 'list':
146423
146645
  {
146424
146646
  values = values.concat(marked.walkTokens(token.items, callback));
146425
146647
  break;
146426
146648
  }
146427
-
146428
146649
  default:
146429
146650
  {
146430
146651
  if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
@@ -146438,55 +146659,44 @@ marked.walkTokens = function (tokens, callback) {
146438
146659
  }
146439
146660
  }
146440
146661
  };
146441
-
146442
146662
  for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
146443
146663
  _loop3();
146444
146664
  }
146445
-
146446
146665
  return values;
146447
146666
  };
146667
+
146448
146668
  /**
146449
146669
  * Parse Inline
146450
146670
  * @param {string} src
146451
146671
  */
146452
-
146453
-
146454
146672
  marked.parseInline = function (src, opt) {
146455
146673
  // throw error in case of non string input
146456
146674
  if (typeof src === 'undefined' || src === null) {
146457
146675
  throw new Error('marked.parseInline(): input parameter is undefined or null');
146458
146676
  }
146459
-
146460
146677
  if (typeof src !== 'string') {
146461
146678
  throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
146462
146679
  }
146463
-
146464
146680
  opt = merge({}, marked.defaults, opt || {});
146465
146681
  checkSanitizeDeprecation(opt);
146466
-
146467
146682
  try {
146468
146683
  var tokens = Lexer.lexInline(src, opt);
146469
-
146470
146684
  if (opt.walkTokens) {
146471
146685
  marked.walkTokens(tokens, opt.walkTokens);
146472
146686
  }
146473
-
146474
146687
  return Parser.parseInline(tokens, opt);
146475
146688
  } catch (e) {
146476
146689
  e.message += '\nPlease report this to https://github.com/markedjs/marked.';
146477
-
146478
146690
  if (opt.silent) {
146479
146691
  return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
146480
146692
  }
146481
-
146482
146693
  throw e;
146483
146694
  }
146484
146695
  };
146696
+
146485
146697
  /**
146486
146698
  * Expose
146487
146699
  */
146488
-
146489
-
146490
146700
  marked.Parser = Parser;
146491
146701
  marked.parser = Parser.parse;
146492
146702
  marked.Renderer = Renderer;
@@ -159142,78 +159352,6 @@ const nothing = Symbol.for('lit-nothing');
159142
159352
  * path for rendering.
159143
159353
  */
159144
159354
  const templateCache = new WeakMap();
159145
- /**
159146
- * Renders a value, usually a lit-html TemplateResult, to the container.
159147
- *
159148
- * This example renders the text "Hello, Zoe!" inside a paragraph tag, appending
159149
- * it to the container `document.body`.
159150
- *
159151
- * ```js
159152
- * import {html, render} from 'lit';
159153
- *
159154
- * const name = "Zoe";
159155
- * render(html`<p>Hello, ${name}!</p>`, document.body);
159156
- * ```
159157
- *
159158
- * @param value Any [renderable
159159
- * value](https://lit.dev/docs/templates/expressions/#child-expressions),
159160
- * typically a {@linkcode TemplateResult} created by evaluating a template tag
159161
- * like {@linkcode html} or {@linkcode svg}.
159162
- * @param container A DOM container to render to. The first render will append
159163
- * the rendered value to the container, and subsequent renders will
159164
- * efficiently update the rendered value if the same result type was
159165
- * previously rendered there.
159166
- * @param options See {@linkcode RenderOptions} for options documentation.
159167
- * @see
159168
- * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}
159169
- */
159170
- const render = (value, container, options) => {
159171
- var _a, _b;
159172
- if (DEV_MODE && container == null) {
159173
- // Give a clearer error message than
159174
- // Uncaught TypeError: Cannot read properties of null (reading
159175
- // '_$litPart$')
159176
- // which reads like an internal Lit error.
159177
- throw new TypeError(`The container to render into may not be ${container}`);
159178
- }
159179
- const renderId = DEV_MODE ? debugLogRenderId++ : 0;
159180
- const partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
159181
- // This property needs to remain unminified.
159182
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
159183
- let part = partOwnerNode['_$litPart$'];
159184
- debugLogEvent === null || debugLogEvent === void 0 ? void 0 : debugLogEvent({
159185
- kind: 'begin render',
159186
- id: renderId,
159187
- value,
159188
- container,
159189
- options,
159190
- part,
159191
- });
159192
- if (part === undefined) {
159193
- const endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
159194
- // This property needs to remain unminified.
159195
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
159196
- partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
159197
- }
159198
- part._$setValue(value);
159199
- debugLogEvent === null || debugLogEvent === void 0 ? void 0 : debugLogEvent({
159200
- kind: 'end render',
159201
- id: renderId,
159202
- value,
159203
- container,
159204
- options,
159205
- part,
159206
- });
159207
- return part;
159208
- };
159209
- if (ENABLE_EXTRA_SECURITY_HOOKS) {
159210
- render.setSanitizer = setSanitizer;
159211
- render.createSanitizer = createSanitizer;
159212
- if (DEV_MODE) {
159213
- render._testOnlyClearSanitizerFactoryDoNotCallOrElse =
159214
- _testOnlyClearSanitizerFactoryDoNotCallOrElse;
159215
- }
159216
- }
159217
159355
  const walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */, null, false);
159218
159356
  let sanitizerFactoryInternal = noopSanitizer;
159219
159357
  /**
@@ -160335,11 +160473,83 @@ const polyfillSupport = DEV_MODE
160335
160473
  polyfillSupport === null || polyfillSupport === void 0 ? void 0 : polyfillSupport(Template, ChildPart);
160336
160474
  // IMPORTANT: do not change the property name or the assignment expression.
160337
160475
  // This line will be used in regexes to search for lit-html usage.
160338
- ((_d = global.litHtmlVersions) !== null && _d !== void 0 ? _d : (global.litHtmlVersions = [])).push('2.3.1');
160476
+ ((_d = global.litHtmlVersions) !== null && _d !== void 0 ? _d : (global.litHtmlVersions = [])).push('2.4.0');
160339
160477
  if (DEV_MODE && global.litHtmlVersions.length > 1) {
160340
160478
  issueWarning('multiple-versions', `Multiple versions of Lit loaded. ` +
160341
160479
  `Loading multiple versions is not recommended.`);
160342
160480
  }
160481
+ /**
160482
+ * Renders a value, usually a lit-html TemplateResult, to the container.
160483
+ *
160484
+ * This example renders the text "Hello, Zoe!" inside a paragraph tag, appending
160485
+ * it to the container `document.body`.
160486
+ *
160487
+ * ```js
160488
+ * import {html, render} from 'lit';
160489
+ *
160490
+ * const name = "Zoe";
160491
+ * render(html`<p>Hello, ${name}!</p>`, document.body);
160492
+ * ```
160493
+ *
160494
+ * @param value Any [renderable
160495
+ * value](https://lit.dev/docs/templates/expressions/#child-expressions),
160496
+ * typically a {@linkcode TemplateResult} created by evaluating a template tag
160497
+ * like {@linkcode html} or {@linkcode svg}.
160498
+ * @param container A DOM container to render to. The first render will append
160499
+ * the rendered value to the container, and subsequent renders will
160500
+ * efficiently update the rendered value if the same result type was
160501
+ * previously rendered there.
160502
+ * @param options See {@linkcode RenderOptions} for options documentation.
160503
+ * @see
160504
+ * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}
160505
+ */
160506
+ const render = (value, container, options) => {
160507
+ var _a, _b;
160508
+ if (DEV_MODE && container == null) {
160509
+ // Give a clearer error message than
160510
+ // Uncaught TypeError: Cannot read properties of null (reading
160511
+ // '_$litPart$')
160512
+ // which reads like an internal Lit error.
160513
+ throw new TypeError(`The container to render into may not be ${container}`);
160514
+ }
160515
+ const renderId = DEV_MODE ? debugLogRenderId++ : 0;
160516
+ const partOwnerNode = (_a = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _a !== void 0 ? _a : container;
160517
+ // This property needs to remain unminified.
160518
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
160519
+ let part = partOwnerNode['_$litPart$'];
160520
+ debugLogEvent === null || debugLogEvent === void 0 ? void 0 : debugLogEvent({
160521
+ kind: 'begin render',
160522
+ id: renderId,
160523
+ value,
160524
+ container,
160525
+ options,
160526
+ part,
160527
+ });
160528
+ if (part === undefined) {
160529
+ const endNode = (_b = options === null || options === void 0 ? void 0 : options.renderBefore) !== null && _b !== void 0 ? _b : null;
160530
+ // This property needs to remain unminified.
160531
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
160532
+ partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options !== null && options !== void 0 ? options : {});
160533
+ }
160534
+ part._$setValue(value);
160535
+ debugLogEvent === null || debugLogEvent === void 0 ? void 0 : debugLogEvent({
160536
+ kind: 'end render',
160537
+ id: renderId,
160538
+ value,
160539
+ container,
160540
+ options,
160541
+ part,
160542
+ });
160543
+ return part;
160544
+ };
160545
+ if (ENABLE_EXTRA_SECURITY_HOOKS) {
160546
+ render.setSanitizer = setSanitizer;
160547
+ render.createSanitizer = createSanitizer;
160548
+ if (DEV_MODE) {
160549
+ render._testOnlyClearSanitizerFactoryDoNotCallOrElse =
160550
+ _testOnlyClearSanitizerFactoryDoNotCallOrElse;
160551
+ }
160552
+ }
160343
160553
  //# sourceMappingURL=lit-html.js.map
160344
160554
 
160345
160555
  /***/ }),