is-html-tag-opening 3.0.10 → 3.0.11
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/LICENSE +1 -1
- package/README.md +2 -6
- package/dist/is-html-tag-opening.esm.js +4 -4
- package/dist/is-html-tag-opening.umd.js +6 -6
- package/package.json +7 -5
- package/types/index.d.ts +9 -5
- package/types/util.d.ts +2 -2
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2022 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -26,14 +26,12 @@
|
|
|
26
26
|
|
|
27
27
|
## Install
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
npm i is-html-tag-opening
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
If you need a legacy version which works with `require`, use version 2.1.0
|
|
36
|
-
|
|
37
35
|
## Quick Take
|
|
38
36
|
|
|
39
37
|
```js
|
|
@@ -65,8 +63,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
65
63
|
|
|
66
64
|
MIT License
|
|
67
65
|
|
|
68
|
-
Copyright (c) 2010-
|
|
69
|
-
|
|
66
|
+
Copyright (c) 2010-2022 Roy Revelt and other contributors
|
|
70
67
|
|
|
71
68
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
72
|
-
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name is-html-tag-opening
|
|
3
3
|
* @fileoverview Does an HTML tag start at given position?
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.11
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/is-html-tag-opening/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{matchRight as N,matchRightIncl as S}from"string-match-left-right";import{left as c}from"string-left-right";var b={allowCustomTagNames:!1,skipOpeningBracket:!1},
|
|
11
|
-
`,"\r"]};return n.allowCustomTagNames?((n.skipOpeningBracket&&(e[t-1]==="<"||e[t-1]==="/"&&e[c(e,a)]==="<")||s[0]==="<"&&s[1]&&s[1].trim())&&($.test(s)||/^<\w+$/.test(s))||k.test(s)&&p(e,t)||
|
|
12
|
-
`,"\r"]})&&(o=!0)),!o&&e[t]==="<"&&e[t+1]&&e[t+1].trim()&&N(e,t,
|
|
10
|
+
import{matchRight as N,matchRightIncl as S}from"string-match-left-right";import{left as c}from"string-left-right";var b={allowCustomTagNames:!1,skipOpeningBracket:!1},m="\\",g=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h1 - h6","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xml"];function d(e){return e===void 0||e.toUpperCase()===e.toLowerCase()&&!/\d/.test(e)&&e!=="="}import{left as T}from"string-left-right";function p(e,t){return e[t]==="<"||e[T(e,t)]==="<"}var f="3.0.11";var K=f;function U(e,t=0,h){if(typeof e!="string")throw new Error(`is-html-tag-opening: [THROW_ID_01] the first input argument should have been a string but it was given as "${typeof e}", value being ${JSON.stringify(e,null,4)}`);if(!Number.isInteger(t)||t<0)throw new Error(`is-html-tag-opening: [THROW_ID_02] the second input argument should have been a natural number string index but it was given as "${typeof t}", value being ${JSON.stringify(t,null,4)}`);let n={...b,...h},r="[\\\\ \\t\\r\\n/]*",i="._a-z0-9\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\uFFFF",w=new RegExp(`^<${n.skipOpeningBracket?"?":""}${r}\\w+${r}\\/?${r}>`,"g"),k=new RegExp(`^<${n.skipOpeningBracket?"?":""}${r}[${i}]+[-${i}]*${r}>`,"g"),y=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\w+\\s+\\w+(?:-\\w+)?\\s*=\\s*['"\\w]`,"g"),E=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\w+\\s+[${i}]+[-${i}]*(?:-\\w+)?\\s*=\\s*['"\\w]`),D=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\/?\\s*\\w+\\s*\\/?\\s*>`,"g"),O=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\/?\\s*[${i}]+[-${i}]*\\s*\\/?\\s*>`,"g"),R=new RegExp(`^<${n.skipOpeningBracket?"?":""}${r}\\w+(?:\\s*\\w+)?\\s*\\w+=['"]`,"g"),V=new RegExp(`^<${n.skipOpeningBracket?"?":""}${r}[${i}]+[-${i}]*\\s+(?:\\s*\\w+)?\\s*\\w+=['"]`,"g"),$=new RegExp(`^<${n.skipOpeningBracket?"?\\/?":""}(${r}[${i}]+)+${r}[\\\\/=>]`,""),v=new RegExp("^\\/\\s*\\w+s*>"),s=t?e.slice(t):e,a=c(e,t),l=!1,o=!1,B={cb:d,i:!0,trimCharsBeforeMatching:["/",m,"!"," "," ",`
|
|
11
|
+
`,"\r"]};return n.allowCustomTagNames?((n.skipOpeningBracket&&(e[t-1]==="<"||e[t-1]==="/"&&e[c(e,a)]==="<")||s[0]==="<"&&s[1]&&s[1].trim())&&($.test(s)||/^<\w+$/.test(s))||k.test(s)&&p(e,t)||E.test(s)||O.test(s)&&p(e,t)||V.test(s)||e[t]==="/"&&e[a]!=="<"&&v.test(s))&&(o=!0):(((n.skipOpeningBracket&&(e[t-1]==="<"||e[t-1]==="/"&&e[c(e,a)]==="<")||(s[0]==="<"||s[0]==="/"&&(!e[a]||e[a]!=="<"))&&s[1]&&s[1].trim())&&$.test(s)||w.test(s)&&p(e,t)||y.test(s)||D.test(s)&&p(e,t)||R.test(s))&&(l=!0),l&&S(e,t,g,{cb:u=>u===void 0?((e[t]==="<"&&e[t+1]&&e[t+1].trim()||e[t-1]==="<")&&(o=!0),!0):u.toUpperCase()===u.toLowerCase()&&!/\d/.test(u)&&u!=="=",i:!0,trimCharsBeforeMatching:["<","/",m,"!"," "," ",`
|
|
12
|
+
`,"\r"]})&&(o=!0)),!o&&e[t]==="<"&&e[t+1]&&e[t+1].trim()&&N(e,t,g,B)&&(o=!0),typeof e=="string"&&t<e.length&&o}export{b as defaults,U as isOpening,K as version};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name is-html-tag-opening
|
|
3
3
|
* @fileoverview Does an HTML tag start at given position?
|
|
4
|
-
* @version 3.0.
|
|
4
|
+
* @version 3.0.11
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/is-html-tag-opening/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var isHtmlTagOpening=(()=>{var ve=Object.create;var L=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames,mt=Object.getOwnPropertySymbols,Ae=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var bt=(t,e,r)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e)=>{for(var r in e||(e={}))dt.call(e,r)&&bt(t,r,e[r]);if(mt)for(var r of mt(e))Ee.call(e,r)&&bt(t,r,e[r]);return t};var yt=t=>L(t,"__esModule",{value:!0});var wt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Me=(t,e)=>{for(var r in e)L(t,r,{get:e[r],enumerable:!0})},$t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!dt.call(t,i)&&(r||i!=="default")&&L(t,i,{get:()=>e[i],enumerable:!(n=Ce(e,i))||n.enumerable});return t},_t=(t,e)=>$t(yt(L(t!=null?ve(Ae(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Te=(t=>(e,r)=>t&&t.get(e)||(r=$t(yt({}),e,1),t&&t.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var jt=wt((En,Rt)=>{var je="[object Object]";function Be(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function xe(t,e){return function(r){return t(e(r))}}var Ie=Function.prototype,Tt=Object.prototype,St=Ie.toString,Le=Tt.hasOwnProperty,De=St.call(Object),Ne=Tt.toString,ke=xe(Object.getPrototypeOf,Object);function Ve(t){return!!t&&typeof t=="object"}function He(t){if(!Ve(t)||Ne.call(t)!=je||Be(t))return!1;var e=ke(t);if(e===null)return!0;var r=Le.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&St.call(r)==De}Rt.exports=He});var we=wt((k,x)=>{var Pe=200,Bt="__lodash_hash_undefined__",xt=9007199254740991,Z="[object Arguments]",qe="[object Array]",It="[object Boolean]",Lt="[object Date]",Fe="[object Error]",z="[object Function]",Dt="[object GeneratorFunction]",q="[object Map]",Nt="[object Number]",Q="[object Object]",kt="[object Promise]",Vt="[object RegExp]",F="[object Set]",Ht="[object String]",Pt="[object Symbol]",tt="[object WeakMap]",qt="[object ArrayBuffer]",W="[object DataView]",Ft="[object Float32Array]",Wt="[object Float64Array]",Gt="[object Int8Array]",Jt="[object Int16Array]",Ut="[object Int32Array]",Kt="[object Uint8Array]",Yt="[object Uint8ClampedArray]",Xt="[object Uint16Array]",Zt="[object Uint32Array]",We=/[\\^$.*+?()[\]{}|]/g,Ge=/\w*$/,Je=/^\[object .+?Constructor\]$/,Ue=/^(?:0|[1-9]\d*)$/,c={};c[Z]=c[qe]=c[qt]=c[W]=c[It]=c[Lt]=c[Ft]=c[Wt]=c[Gt]=c[Jt]=c[Ut]=c[q]=c[Nt]=c[Q]=c[Vt]=c[F]=c[Ht]=c[Pt]=c[Kt]=c[Yt]=c[Xt]=c[Zt]=!0;c[Fe]=c[z]=c[tt]=!1;var Ke=typeof global=="object"&&global&&global.Object===Object&&global,Ye=typeof self=="object"&&self&&self.Object===Object&&self,C=Ke||Ye||Function("return this")(),zt=typeof k=="object"&&k&&!k.nodeType&&k,Qt=zt&&typeof x=="object"&&x&&!x.nodeType&&x,Xe=Qt&&Qt.exports===zt;function Ze(t,e){return t.set(e[0],e[1]),t}function ze(t,e){return t.add(e),t}function Qe(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function tr(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function te(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function er(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function rr(t,e){return t==null?void 0:t[e]}function ee(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function re(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function et(t,e){return function(r){return t(e(r))}}function ne(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var nr=Array.prototype,ir=Function.prototype,G=Object.prototype,rt=C["__core-js_shared__"],ie=function(){var t=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),oe=ir.toString,A=G.hasOwnProperty,J=G.toString,or=RegExp("^"+oe.call(A).replace(We,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=Xe?C.Buffer:void 0,ae=C.Symbol,ue=C.Uint8Array,sr=et(Object.getPrototypeOf,Object),ar=Object.create,ur=G.propertyIsEnumerable,lr=nr.splice,le=Object.getOwnPropertySymbols,cr=se?se.isBuffer:void 0,fr=et(Object.keys,Object),nt=B(C,"DataView"),D=B(C,"Map"),it=B(C,"Promise"),ot=B(C,"Set"),st=B(C,"WeakMap"),N=B(Object,"create"),gr=S(nt),hr=S(D),pr=S(it),mr=S(ot),dr=S(st),ce=ae?ae.prototype:void 0,fe=ce?ce.valueOf:void 0;function M(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function br(){this.__data__=N?N(null):{}}function yr(t){return this.has(t)&&delete this.__data__[t]}function wr(t){var e=this.__data__;if(N){var r=e[t];return r===Bt?void 0:r}return A.call(e,t)?e[t]:void 0}function $r(t){var e=this.__data__;return N?e[t]!==void 0:A.call(e,t)}function _r(t,e){var r=this.__data__;return r[t]=N&&e===void 0?Bt:e,this}M.prototype.clear=br;M.prototype.delete=yr;M.prototype.get=wr;M.prototype.has=$r;M.prototype.set=_r;function O(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vr(){this.__data__=[]}function Cr(t){var e=this.__data__,r=U(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():lr.call(e,r,1),!0}function Or(t){var e=this.__data__,r=U(e,t);return r<0?void 0:e[r][1]}function Ar(t){return U(this.__data__,t)>-1}function Er(t,e){var r=this.__data__,n=U(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}O.prototype.clear=vr;O.prototype.delete=Cr;O.prototype.get=Or;O.prototype.has=Ar;O.prototype.set=Er;function R(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Mr(){this.__data__={hash:new M,map:new(D||O),string:new M}}function Tr(t){return K(this,t).delete(t)}function Sr(t){return K(this,t).get(t)}function Rr(t){return K(this,t).has(t)}function jr(t,e){return K(this,t).set(t,e),this}R.prototype.clear=Mr;R.prototype.delete=Tr;R.prototype.get=Sr;R.prototype.has=Rr;R.prototype.set=jr;function j(t){this.__data__=new O(t)}function Br(){this.__data__=new O}function xr(t){return this.__data__.delete(t)}function Ir(t){return this.__data__.get(t)}function Lr(t){return this.__data__.has(t)}function Dr(t,e){var r=this.__data__;if(r instanceof O){var n=r.__data__;if(!D||n.length<Pe-1)return n.push([t,e]),this;r=this.__data__=new R(n)}return r.set(t,e),this}j.prototype.clear=Br;j.prototype.delete=xr;j.prototype.get=Ir;j.prototype.has=Lr;j.prototype.set=Dr;function Nr(t,e){var r=lt(t)||un(t)?er(t.length,String):[],n=r.length,i=!!n;for(var o in t)(e||A.call(t,o))&&!(i&&(o=="length"||nn(o,n)))&&r.push(o);return r}function ge(t,e,r){var n=t[e];(!(A.call(t,e)&&de(n,r))||r===void 0&&!(e in t))&&(t[e]=r)}function U(t,e){for(var r=t.length;r--;)if(de(t[r][0],e))return r;return-1}function kr(t,e){return t&&he(e,ct(e),t)}function at(t,e,r,n,i,o,u){var s;if(n&&(s=o?n(t,i,o,u):n(t)),s!==void 0)return s;if(!Y(t))return t;var f=lt(t);if(f){if(s=tn(t),!e)return Zr(t,s)}else{var d=T(t),h=d==z||d==Dt;if(cn(t))return Wr(t,e);if(d==Q||d==Z||h&&!o){if(ee(t))return o?t:{};if(s=en(h?{}:t),!e)return zr(t,kr(s,t))}else{if(!c[d])return o?t:{};s=rn(t,d,at,e)}}u||(u=new j);var g=u.get(t);if(g)return g;if(u.set(t,s),!f)var m=r?Qr(t):ct(t);return Qe(m||t,function(b,a){m&&(a=b,b=t[a]),ge(s,a,at(b,e,r,n,a,t,u))}),s}function Vr(t){return Y(t)?ar(t):{}}function Hr(t,e,r){var n=e(t);return lt(t)?n:tr(n,r(t))}function Pr(t){return J.call(t)}function qr(t){if(!Y(t)||sn(t))return!1;var e=ye(t)||ee(t)?or:Je;return e.test(S(t))}function Fr(t){if(!me(t))return fr(t);var e=[];for(var r in Object(t))A.call(t,r)&&r!="constructor"&&e.push(r);return e}function Wr(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function ut(t){var e=new t.constructor(t.byteLength);return new ue(e).set(new ue(t)),e}function Gr(t,e){var r=e?ut(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function Jr(t,e,r){var n=e?r(re(t),!0):re(t);return te(n,Ze,new t.constructor)}function Ur(t){var e=new t.constructor(t.source,Ge.exec(t));return e.lastIndex=t.lastIndex,e}function Kr(t,e,r){var n=e?r(ne(t),!0):ne(t);return te(n,ze,new t.constructor)}function Yr(t){return fe?Object(fe.call(t)):{}}function Xr(t,e){var r=e?ut(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Zr(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function he(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var u=e[i],s=n?n(r[u],t[u],u,r,t):void 0;ge(r,u,s===void 0?t[u]:s)}return r}function zr(t,e){return he(t,pe(t),e)}function Qr(t){return Hr(t,ct,pe)}function K(t,e){var r=t.__data__;return on(e)?r[typeof e=="string"?"string":"hash"]:r.map}function B(t,e){var r=rr(t,e);return qr(r)?r:void 0}var pe=le?et(le,Object):hn,T=Pr;(nt&&T(new nt(new ArrayBuffer(1)))!=W||D&&T(new D)!=q||it&&T(it.resolve())!=kt||ot&&T(new ot)!=F||st&&T(new st)!=tt)&&(T=function(t){var e=J.call(t),r=e==Q?t.constructor:void 0,n=r?S(r):void 0;if(n)switch(n){case gr:return W;case hr:return q;case pr:return kt;case mr:return F;case dr:return tt}return e});function tn(t){var e=t.length,r=t.constructor(e);return e&&typeof t[0]=="string"&&A.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function en(t){return typeof t.constructor=="function"&&!me(t)?Vr(sr(t)):{}}function rn(t,e,r,n){var i=t.constructor;switch(e){case qt:return ut(t);case It:case Lt:return new i(+t);case W:return Gr(t,n);case Ft:case Wt:case Gt:case Jt:case Ut:case Kt:case Yt:case Xt:case Zt:return Xr(t,n);case q:return Jr(t,n,r);case Nt:case Ht:return new i(t);case Vt:return Ur(t);case F:return Kr(t,n,r);case Pt:return Yr(t)}}function nn(t,e){return e=e==null?xt:e,!!e&&(typeof t=="number"||Ue.test(t))&&t>-1&&t%1==0&&t<e}function on(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function sn(t){return!!ie&&ie in t}function me(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||G;return t===r}function S(t){if(t!=null){try{return oe.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function an(t){return at(t,!0,!0)}function de(t,e){return t===e||t!==t&&e!==e}function un(t){return ln(t)&&A.call(t,"callee")&&(!ur.call(t,"callee")||J.call(t)==Z)}var lt=Array.isArray;function be(t){return t!=null&&fn(t.length)&&!ye(t)}function ln(t){return gn(t)&&be(t)}var cn=cr||pn;function ye(t){var e=Y(t)?J.call(t):"";return e==z||e==Dt}function fn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=xt}function Y(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function gn(t){return!!t&&typeof t=="object"}function ct(t){return be(t)?Nr(t):Fr(t)}function hn(){return[]}function pn(){return!1}x.exports=an});var _n={};Me(_n,{defaults:()=>gt,isOpening:()=>$n,version:()=>wn});function vt(t){return typeof t=="string"?t.length?[t]:[]:t}function Ct(t){return t&&typeof t=="object"&&!Array.isArray(t)}function P(t){return typeof t=="string"}var Ot={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Se=t=>t+1;function Re(t,e,r,n,i=!1,o=Se){let u=typeof r=="function"?r():r;if(+e<0&&i&&u==="EOL")return u;let s=v(v({},Ot),n);if(e>=t.length&&!i)return!1;let f=i?1:r.length,d=0,h=!1,g=!1,m=!1,b=s.maxMismatches,a=e,y=!1,l=!1,p=!1;function _(){return d===1&&b<s.maxMismatches-1}for(;t[a];){let w=o(a);if(s.trimBeforeMatching&&t[a].trim()===""){if(!t[w]&&i&&r==="EOL")return!0;a=o(a);continue}if(s&&!s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.includes(t[a])||(s==null?void 0:s.i)&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(E=>E.toLowerCase()).includes(t[a].toLowerCase())){if(i&&r==="EOL"&&!t[w])return!0;a=o(a);continue}let H=w>a?r[r.length-f]:r[f-1];if(!s.i&&t[a]===H||s.i&&t[a].toLowerCase()===H.toLowerCase()){if(y||(y=!0),m||(m=!0),f===r.length){if(l=!0,b!==s.maxMismatches)return!1}else f===1&&(p=!0);if(f-=1,d++,_())return!1;if(!f)return d!==r.length||b===s.maxMismatches||!h?a:!1}else if(!h&&!d&&(h=!0),s.maxMismatches&&b&&a){b-=1;for(let E=0;E<=b;E++){let $=w>a?r[r.length-f+1+E]:r[f-2-E],X=t[o(a)];if($&&(!s.i&&t[a]===$||s.i&&t[a].toLowerCase()===$.toLowerCase())&&(!s.firstMustMatch||f!==r.length)){if(d++,_())return!1;f-=2,y=!0;break}else if(X&&$&&(!s.i&&X===$||s.i&&X.toLowerCase()===$.toLowerCase())&&(!s.firstMustMatch||f!==r.length)){if(!d&&!s.hungry)return!1;f-=1,y=!0;break}else if($===void 0&&b>=0&&y&&(!s.firstMustMatch||l)&&(!s.lastMustMatch||p))return a}y||(g=a)}else return a===0&&f===1&&!s.lastMustMatch&&m?0:!1;if(g!==!1&&g!==a&&(g=!1),f<1)return a;a=o(a)}if(f>0)return i&&u==="EOL"?!0:s&&s.maxMismatches>=f&&m?g||0:!1}function At(t,e,r,n,i){if(Ct(i)&&Object.prototype.hasOwnProperty.call(i,"trimBeforeMatching")&&typeof i.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${t}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(i.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o=v(v({},Ot),i);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=vt(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(h=>P(h)?h:String(h)),!P(e)||!e.length)return!1;if(!Number.isInteger(r)||r<0)throw new Error(`string-match-left-right/${t}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof r}, equal to:
|
|
10
|
+
var isHtmlTagOpening=(()=>{var ve=Object.create;var L=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames,mt=Object.getOwnPropertySymbols,Ae=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable;var bt=(t,e,r)=>e in t?L(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e)=>{for(var r in e||(e={}))dt.call(e,r)&&bt(t,r,e[r]);if(mt)for(var r of mt(e))Ee.call(e,r)&&bt(t,r,e[r]);return t};var yt=t=>L(t,"__esModule",{value:!0});var wt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Me=(t,e)=>{for(var r in e)L(t,r,{get:e[r],enumerable:!0})},$t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!dt.call(t,i)&&(r||i!=="default")&&L(t,i,{get:()=>e[i],enumerable:!(n=Ce(e,i))||n.enumerable});return t},_t=(t,e)=>$t(yt(L(t!=null?ve(Ae(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),Te=(t=>(e,r)=>t&&t.get(e)||(r=$t(yt({}),e,1),t&&t.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var jt=wt((En,Rt)=>{var je="[object Object]";function xe(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function Be(t,e){return function(r){return t(e(r))}}var Ie=Function.prototype,Tt=Object.prototype,St=Ie.toString,Le=Tt.hasOwnProperty,De=St.call(Object),Ne=Tt.toString,ke=Be(Object.getPrototypeOf,Object);function Ve(t){return!!t&&typeof t=="object"}function He(t){if(!Ve(t)||Ne.call(t)!=je||xe(t))return!1;var e=ke(t);if(e===null)return!0;var r=Le.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&St.call(r)==De}Rt.exports=He});var we=wt((k,B)=>{var Pe=200,xt="__lodash_hash_undefined__",Bt=9007199254740991,Z="[object Arguments]",qe="[object Array]",It="[object Boolean]",Lt="[object Date]",Fe="[object Error]",z="[object Function]",Dt="[object GeneratorFunction]",q="[object Map]",Nt="[object Number]",Q="[object Object]",kt="[object Promise]",Vt="[object RegExp]",F="[object Set]",Ht="[object String]",Pt="[object Symbol]",tt="[object WeakMap]",qt="[object ArrayBuffer]",W="[object DataView]",Ft="[object Float32Array]",Wt="[object Float64Array]",Gt="[object Int8Array]",Jt="[object Int16Array]",Ut="[object Int32Array]",Kt="[object Uint8Array]",Yt="[object Uint8ClampedArray]",Xt="[object Uint16Array]",Zt="[object Uint32Array]",We=/[\\^$.*+?()[\]{}|]/g,Ge=/\w*$/,Je=/^\[object .+?Constructor\]$/,Ue=/^(?:0|[1-9]\d*)$/,c={};c[Z]=c[qe]=c[qt]=c[W]=c[It]=c[Lt]=c[Ft]=c[Wt]=c[Gt]=c[Jt]=c[Ut]=c[q]=c[Nt]=c[Q]=c[Vt]=c[F]=c[Ht]=c[Pt]=c[Kt]=c[Yt]=c[Xt]=c[Zt]=!0;c[Fe]=c[z]=c[tt]=!1;var Ke=typeof global=="object"&&global&&global.Object===Object&&global,Ye=typeof self=="object"&&self&&self.Object===Object&&self,C=Ke||Ye||Function("return this")(),zt=typeof k=="object"&&k&&!k.nodeType&&k,Qt=zt&&typeof B=="object"&&B&&!B.nodeType&&B,Xe=Qt&&Qt.exports===zt;function Ze(t,e){return t.set(e[0],e[1]),t}function ze(t,e){return t.add(e),t}function Qe(t,e){for(var r=-1,n=t?t.length:0;++r<n&&e(t[r],r,t)!==!1;);return t}function tr(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function te(t,e,r,n){var i=-1,o=t?t.length:0;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r}function er(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function rr(t,e){return t==null?void 0:t[e]}function ee(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}function re(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function et(t,e){return function(r){return t(e(r))}}function ne(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var nr=Array.prototype,ir=Function.prototype,G=Object.prototype,rt=C["__core-js_shared__"],ie=function(){var t=/[^.]+$/.exec(rt&&rt.keys&&rt.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),oe=ir.toString,A=G.hasOwnProperty,J=G.toString,or=RegExp("^"+oe.call(A).replace(We,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=Xe?C.Buffer:void 0,ae=C.Symbol,ue=C.Uint8Array,sr=et(Object.getPrototypeOf,Object),ar=Object.create,ur=G.propertyIsEnumerable,lr=nr.splice,le=Object.getOwnPropertySymbols,cr=se?se.isBuffer:void 0,fr=et(Object.keys,Object),nt=x(C,"DataView"),D=x(C,"Map"),it=x(C,"Promise"),ot=x(C,"Set"),st=x(C,"WeakMap"),N=x(Object,"create"),gr=S(nt),hr=S(D),pr=S(it),mr=S(ot),dr=S(st),ce=ae?ae.prototype:void 0,fe=ce?ce.valueOf:void 0;function M(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function br(){this.__data__=N?N(null):{}}function yr(t){return this.has(t)&&delete this.__data__[t]}function wr(t){var e=this.__data__;if(N){var r=e[t];return r===xt?void 0:r}return A.call(e,t)?e[t]:void 0}function $r(t){var e=this.__data__;return N?e[t]!==void 0:A.call(e,t)}function _r(t,e){var r=this.__data__;return r[t]=N&&e===void 0?xt:e,this}M.prototype.clear=br;M.prototype.delete=yr;M.prototype.get=wr;M.prototype.has=$r;M.prototype.set=_r;function O(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function vr(){this.__data__=[]}function Cr(t){var e=this.__data__,r=U(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():lr.call(e,r,1),!0}function Or(t){var e=this.__data__,r=U(e,t);return r<0?void 0:e[r][1]}function Ar(t){return U(this.__data__,t)>-1}function Er(t,e){var r=this.__data__,n=U(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}O.prototype.clear=vr;O.prototype.delete=Cr;O.prototype.get=Or;O.prototype.has=Ar;O.prototype.set=Er;function R(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Mr(){this.__data__={hash:new M,map:new(D||O),string:new M}}function Tr(t){return K(this,t).delete(t)}function Sr(t){return K(this,t).get(t)}function Rr(t){return K(this,t).has(t)}function jr(t,e){return K(this,t).set(t,e),this}R.prototype.clear=Mr;R.prototype.delete=Tr;R.prototype.get=Sr;R.prototype.has=Rr;R.prototype.set=jr;function j(t){this.__data__=new O(t)}function xr(){this.__data__=new O}function Br(t){return this.__data__.delete(t)}function Ir(t){return this.__data__.get(t)}function Lr(t){return this.__data__.has(t)}function Dr(t,e){var r=this.__data__;if(r instanceof O){var n=r.__data__;if(!D||n.length<Pe-1)return n.push([t,e]),this;r=this.__data__=new R(n)}return r.set(t,e),this}j.prototype.clear=xr;j.prototype.delete=Br;j.prototype.get=Ir;j.prototype.has=Lr;j.prototype.set=Dr;function Nr(t,e){var r=lt(t)||un(t)?er(t.length,String):[],n=r.length,i=!!n;for(var o in t)(e||A.call(t,o))&&!(i&&(o=="length"||nn(o,n)))&&r.push(o);return r}function ge(t,e,r){var n=t[e];(!(A.call(t,e)&&de(n,r))||r===void 0&&!(e in t))&&(t[e]=r)}function U(t,e){for(var r=t.length;r--;)if(de(t[r][0],e))return r;return-1}function kr(t,e){return t&&he(e,ct(e),t)}function at(t,e,r,n,i,o,u){var s;if(n&&(s=o?n(t,i,o,u):n(t)),s!==void 0)return s;if(!Y(t))return t;var f=lt(t);if(f){if(s=tn(t),!e)return Zr(t,s)}else{var d=T(t),h=d==z||d==Dt;if(cn(t))return Wr(t,e);if(d==Q||d==Z||h&&!o){if(ee(t))return o?t:{};if(s=en(h?{}:t),!e)return zr(t,kr(s,t))}else{if(!c[d])return o?t:{};s=rn(t,d,at,e)}}u||(u=new j);var g=u.get(t);if(g)return g;if(u.set(t,s),!f)var m=r?Qr(t):ct(t);return Qe(m||t,function(b,a){m&&(a=b,b=t[a]),ge(s,a,at(b,e,r,n,a,t,u))}),s}function Vr(t){return Y(t)?ar(t):{}}function Hr(t,e,r){var n=e(t);return lt(t)?n:tr(n,r(t))}function Pr(t){return J.call(t)}function qr(t){if(!Y(t)||sn(t))return!1;var e=ye(t)||ee(t)?or:Je;return e.test(S(t))}function Fr(t){if(!me(t))return fr(t);var e=[];for(var r in Object(t))A.call(t,r)&&r!="constructor"&&e.push(r);return e}function Wr(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}function ut(t){var e=new t.constructor(t.byteLength);return new ue(e).set(new ue(t)),e}function Gr(t,e){var r=e?ut(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}function Jr(t,e,r){var n=e?r(re(t),!0):re(t);return te(n,Ze,new t.constructor)}function Ur(t){var e=new t.constructor(t.source,Ge.exec(t));return e.lastIndex=t.lastIndex,e}function Kr(t,e,r){var n=e?r(ne(t),!0):ne(t);return te(n,ze,new t.constructor)}function Yr(t){return fe?Object(fe.call(t)):{}}function Xr(t,e){var r=e?ut(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Zr(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function he(t,e,r,n){r||(r={});for(var i=-1,o=e.length;++i<o;){var u=e[i],s=n?n(r[u],t[u],u,r,t):void 0;ge(r,u,s===void 0?t[u]:s)}return r}function zr(t,e){return he(t,pe(t),e)}function Qr(t){return Hr(t,ct,pe)}function K(t,e){var r=t.__data__;return on(e)?r[typeof e=="string"?"string":"hash"]:r.map}function x(t,e){var r=rr(t,e);return qr(r)?r:void 0}var pe=le?et(le,Object):hn,T=Pr;(nt&&T(new nt(new ArrayBuffer(1)))!=W||D&&T(new D)!=q||it&&T(it.resolve())!=kt||ot&&T(new ot)!=F||st&&T(new st)!=tt)&&(T=function(t){var e=J.call(t),r=e==Q?t.constructor:void 0,n=r?S(r):void 0;if(n)switch(n){case gr:return W;case hr:return q;case pr:return kt;case mr:return F;case dr:return tt}return e});function tn(t){var e=t.length,r=t.constructor(e);return e&&typeof t[0]=="string"&&A.call(t,"index")&&(r.index=t.index,r.input=t.input),r}function en(t){return typeof t.constructor=="function"&&!me(t)?Vr(sr(t)):{}}function rn(t,e,r,n){var i=t.constructor;switch(e){case qt:return ut(t);case It:case Lt:return new i(+t);case W:return Gr(t,n);case Ft:case Wt:case Gt:case Jt:case Ut:case Kt:case Yt:case Xt:case Zt:return Xr(t,n);case q:return Jr(t,n,r);case Nt:case Ht:return new i(t);case Vt:return Ur(t);case F:return Kr(t,n,r);case Pt:return Yr(t)}}function nn(t,e){return e=e==null?Bt:e,!!e&&(typeof t=="number"||Ue.test(t))&&t>-1&&t%1==0&&t<e}function on(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function sn(t){return!!ie&&ie in t}function me(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||G;return t===r}function S(t){if(t!=null){try{return oe.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function an(t){return at(t,!0,!0)}function de(t,e){return t===e||t!==t&&e!==e}function un(t){return ln(t)&&A.call(t,"callee")&&(!ur.call(t,"callee")||J.call(t)==Z)}var lt=Array.isArray;function be(t){return t!=null&&fn(t.length)&&!ye(t)}function ln(t){return gn(t)&&be(t)}var cn=cr||pn;function ye(t){var e=Y(t)?J.call(t):"";return e==z||e==Dt}function fn(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Bt}function Y(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function gn(t){return!!t&&typeof t=="object"}function ct(t){return be(t)?Nr(t):Fr(t)}function hn(){return[]}function pn(){return!1}B.exports=an});var _n={};Me(_n,{defaults:()=>gt,isOpening:()=>$n,version:()=>wn});function vt(t){return typeof t=="string"?t.length?[t]:[]:t}function Ct(t){return t&&typeof t=="object"&&!Array.isArray(t)}function P(t){return typeof t=="string"}var Ot={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},Se=t=>t+1;function Re(t,e,r,n,i=!1,o=Se){let u=typeof r=="function"?r():r;if(+e<0&&i&&u==="EOL")return u;let s=v(v({},Ot),n);if(e>=t.length&&!i)return!1;let f=i?1:r.length,d=0,h=!1,g=!1,m=!1,b=s.maxMismatches,a=e,y=!1,l=!1,p=!1;function _(){return d===1&&b<s.maxMismatches-1}for(;t[a];){let w=o(a);if(s.trimBeforeMatching&&t[a].trim()===""){if(!t[w]&&i&&r==="EOL")return!0;a=o(a);continue}if(s&&!s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.includes(t[a])||(s==null?void 0:s.i)&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(E=>E.toLowerCase()).includes(t[a].toLowerCase())){if(i&&r==="EOL"&&!t[w])return!0;a=o(a);continue}let H=w>a?r[r.length-f]:r[f-1];if(!s.i&&t[a]===H||s.i&&t[a].toLowerCase()===H.toLowerCase()){if(y||(y=!0),m||(m=!0),f===r.length){if(l=!0,b!==s.maxMismatches)return!1}else f===1&&(p=!0);if(f-=1,d++,_())return!1;if(!f)return d!==r.length||b===s.maxMismatches||!h?a:!1}else if(!h&&!d&&(h=!0),s.maxMismatches&&b&&a){b-=1;for(let E=0;E<=b;E++){let $=w>a?r[r.length-f+1+E]:r[f-2-E],X=t[o(a)];if($&&(!s.i&&t[a]===$||s.i&&t[a].toLowerCase()===$.toLowerCase())&&(!s.firstMustMatch||f!==r.length)){if(d++,_())return!1;f-=2,y=!0;break}else if(X&&$&&(!s.i&&X===$||s.i&&X.toLowerCase()===$.toLowerCase())&&(!s.firstMustMatch||f!==r.length)){if(!d&&!s.hungry)return!1;f-=1,y=!0;break}else if($===void 0&&b>=0&&y&&(!s.firstMustMatch||l)&&(!s.lastMustMatch||p))return a}y||(g=a)}else return a===0&&f===1&&!s.lastMustMatch&&m?0:!1;if(g!==!1&&g!==a&&(g=!1),f<1)return a;a=o(a)}if(f>0)return i&&u==="EOL"?!0:s&&s.maxMismatches>=f&&m?g||0:!1}function At(t,e,r,n,i){if(Ct(i)&&Object.prototype.hasOwnProperty.call(i,"trimBeforeMatching")&&typeof i.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${t}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(i.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o=v(v({},Ot),i);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=vt(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(h=>P(h)?h:String(h)),!P(e)||!e.length)return!1;if(!Number.isInteger(r)||r<0)throw new Error(`string-match-left-right/${t}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof r}, equal to:
|
|
11
11
|
${JSON.stringify(r,null,4)}`);let u,s;if(P(n))u=[n];else if(Array.isArray(n))u=n;else if(!n)u=n;else if(typeof n=="function")u=[],u.push(n);else throw new Error(`string-match-left-right/${t}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof n}, equal to:
|
|
12
12
|
${JSON.stringify(n,null,4)}`);if(i&&!Ct(i))throw new Error(`string-match-left-right/${t}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof i}", and equal to:
|
|
13
13
|
${JSON.stringify(i,null,4)}`);let f=0,d="";if((o==null?void 0:o.trimCharsBeforeMatching)&&o.trimCharsBeforeMatching.some((h,g)=>h.length>1?(f=g,d=h,!0):!1))throw new Error(`string-match-left-right/${t}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${f} is longer than 1 character, ${d.length} (equals to ${d}). Please split it into separate characters and put into array as separate elements.`);if(!u||!Array.isArray(u)||Array.isArray(u)&&!u.length||Array.isArray(u)&&u.length===1&&P(u[0])&&!u[0].trim()){if(typeof o.cb=="function"){let g,m=r;if((t==="matchLeftIncl"||t==="matchRight")&&(m+=1),t[5]==="L")for(let l=m;l--;){let p=e[l];if((!o.trimBeforeMatching||o.trimBeforeMatching&&p!==void 0&&p.trim())&&(!o.trimCharsBeforeMatching||!o.trimCharsBeforeMatching.length||p!==void 0&&!o.trimCharsBeforeMatching.includes(p))){g=l;break}}else if(t.startsWith("matchRight"))for(let l=m;l<e.length;l++){let p=e[l];if((!o.trimBeforeMatching||o.trimBeforeMatching&&p.trim())&&(!o.trimCharsBeforeMatching||!o.trimCharsBeforeMatching.length||!o.trimCharsBeforeMatching.includes(p))){g=l;break}}if(g===void 0)return!1;let b=e[g],a=g+1,y="";return a&&a>0&&(y=e.slice(0,a)),t[5]==="L"||g&&g>0&&(y=e.slice(g)),o.cb(b,y,g)}let h="";throw i||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${t}(): [THROW_ID_08] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!${h}`)}for(let h=0,g=u.length;h<g;h++){s=typeof u[h]=="function";let m=u[h],b,a,y="",l=r;t==="matchRight"?l+=1:t==="matchLeft"&&(l-=1);let p=Re(e,l,m,o,s,_=>t[5]==="L"?_-1:_+1);if(p&&s&&typeof m=="function"&&m()==="EOL")return m()&&(o.cb?o.cb(b,y,a):!0)?m():!1;if(Number.isInteger(p)&&(a=t.startsWith("matchLeft")?p-1:p+1,t[5]==="L"?y=e.slice(0,p):y=e.slice(a)),a<0&&(a=void 0),e[a]&&(b=e[a]),Number.isInteger(p)&&(o.cb?o.cb(b,y,a):!0))return m}return!1}function Et(t,e,r,n){return At("matchRightIncl",t,e,r,n)}function Mt(t,e,r,n){return At("matchRight",t,e,r,n)}var mn=_t(jt(),1),dn=_t(we(),1);var ft="\xA0";function bn({str:t,idx:e,stopAtNewlines:r,stopAtRawNbsp:n}){if(typeof t!="string"||!t.length||((!e||typeof e!="number")&&(e=0),e<1))return null;if(t[~-e]&&(t[~-e].trim()||r&&`
|
|
14
14
|
\r`.includes(t[~-e])||n&&t[~-e]===ft))return~-e;if(t[e-2]&&(t[e-2].trim()||r&&`
|
|
15
15
|
\r`.includes(t[e-2])||n&&t[e-2]===ft))return e-2;for(let i=e;i--;)if(t[i]&&(t[i].trim()||r&&`
|
|
16
|
-
\r`.includes(t[i])||n&&t[i]===ft))return i;return null}function I(t,e=0){return bn({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}var gt={allowCustomTagNames:!1,skipOpeningBracket:!1},ht="\\",pt=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h1 - h6","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xml"];function $e(t){return t===void 0||t.toUpperCase()===t.toLowerCase()&&!/\d/.test(t)&&t!=="="}function V(t,e){return t[e]==="<"||t[I(t,e)]==="<"}var _e="3.0.
|
|
16
|
+
\r`.includes(t[i])||n&&t[i]===ft))return i;return null}function I(t,e=0){return bn({str:t,idx:e,stopAtNewlines:!1,stopAtRawNbsp:!1})}var gt={allowCustomTagNames:!1,skipOpeningBracket:!1},ht="\\",pt=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h1 - h6","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xml"];function $e(t){return t===void 0||t.toUpperCase()===t.toLowerCase()&&!/\d/.test(t)&&t!=="="}function V(t,e){return t[e]==="<"||t[I(t,e)]==="<"}var _e="3.0.11";var wn=_e;function $n(t,e=0,r){if(typeof t!="string")throw new Error(`is-html-tag-opening: [THROW_ID_01] the first input argument should have been a string but it was given as "${typeof t}", value being ${JSON.stringify(t,null,4)}`);if(!Number.isInteger(e)||e<0)throw new Error(`is-html-tag-opening: [THROW_ID_02] the second input argument should have been a natural number string index but it was given as "${typeof e}", value being ${JSON.stringify(e,null,4)}`);let n=v(v({},gt),r),i="[\\\\ \\t\\r\\n/]*",o="._a-z0-9\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\uFFFF",u=new RegExp(`^<${n.skipOpeningBracket?"?":""}${i}\\w+${i}\\/?${i}>`,"g"),s=new RegExp(`^<${n.skipOpeningBracket?"?":""}${i}[${o}]+[-${o}]*${i}>`,"g"),f=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\w+\\s+\\w+(?:-\\w+)?\\s*=\\s*['"\\w]`,"g"),d=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\w+\\s+[${o}]+[-${o}]*(?:-\\w+)?\\s*=\\s*['"\\w]`),h=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\/?\\s*\\w+\\s*\\/?\\s*>`,"g"),g=new RegExp(`^<${n.skipOpeningBracket?"?":""}\\s*\\/?\\s*[${o}]+[-${o}]*\\s*\\/?\\s*>`,"g"),m=new RegExp(`^<${n.skipOpeningBracket?"?":""}${i}\\w+(?:\\s*\\w+)?\\s*\\w+=['"]`,"g"),b=new RegExp(`^<${n.skipOpeningBracket?"?":""}${i}[${o}]+[-${o}]*\\s+(?:\\s*\\w+)?\\s*\\w+=['"]`,"g"),a=new RegExp(`^<${n.skipOpeningBracket?"?\\/?":""}(${i}[${o}]+)+${i}[\\\\/=>]`,""),y=new RegExp("^\\/\\s*\\w+s*>"),l=e?t.slice(e):t,p=I(t,e),_=!1,w=!1,H={cb:$e,i:!0,trimCharsBeforeMatching:["/",ht,"!"," "," ",`
|
|
17
17
|
`,"\r"]};return n.allowCustomTagNames?((n.skipOpeningBracket&&(t[e-1]==="<"||t[e-1]==="/"&&t[I(t,p)]==="<")||l[0]==="<"&&l[1]&&l[1].trim())&&(a.test(l)||/^<\w+$/.test(l))||s.test(l)&&V(t,e)||d.test(l)||g.test(l)&&V(t,e)||b.test(l)||t[e]==="/"&&t[p]!=="<"&&y.test(l))&&(w=!0):(((n.skipOpeningBracket&&(t[e-1]==="<"||t[e-1]==="/"&&t[I(t,p)]==="<")||(l[0]==="<"||l[0]==="/"&&(!t[p]||t[p]!=="<"))&&l[1]&&l[1].trim())&&a.test(l)||u.test(l)&&V(t,e)||f.test(l)||h.test(l)&&V(t,e)||m.test(l))&&(_=!0),_&&Et(t,e,pt,{cb:$=>$===void 0?((t[e]==="<"&&t[e+1]&&t[e+1].trim()||t[e-1]==="<")&&(w=!0),!0):$.toUpperCase()===$.toLowerCase()&&!/\d/.test($)&&$!=="=",i:!0,trimCharsBeforeMatching:["<","/",ht,"!"," "," ",`
|
|
18
18
|
`,"\r"]})&&(w=!0)),!w&&t[e]==="<"&&t[e+1]&&t[e+1].trim()&&Mt(t,e,pt,H)&&(w=!0),typeof t=="string"&&e<t.length&&w}return Te(_n);})();
|
|
19
19
|
/**
|
|
20
20
|
* @name arrayiffy-if-string
|
|
21
21
|
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
|
|
22
|
-
* @version 4.0.
|
|
22
|
+
* @version 4.0.11
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/arrayiffy-if-string/}
|
|
@@ -27,7 +27,7 @@ ${JSON.stringify(i,null,4)}`);let f=0,d="";if((o==null?void 0:o.trimCharsBeforeM
|
|
|
27
27
|
/**
|
|
28
28
|
* @name string-left-right
|
|
29
29
|
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
|
|
30
|
-
* @version 5.0.
|
|
30
|
+
* @version 5.0.11
|
|
31
31
|
* @author Roy Revelt, Codsen Ltd
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/string-left-right/}
|
|
@@ -35,7 +35,7 @@ ${JSON.stringify(i,null,4)}`);let f=0,d="";if((o==null?void 0:o.trimCharsBeforeM
|
|
|
35
35
|
/**
|
|
36
36
|
* @name string-match-left-right
|
|
37
37
|
* @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
|
|
38
|
-
* @version 8.0.
|
|
38
|
+
* @version 8.0.11
|
|
39
39
|
* @author Roy Revelt, Codsen Ltd
|
|
40
40
|
* @license MIT
|
|
41
41
|
* {@link https://codsen.com/os/string-match-left-right/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "is-html-tag-opening",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"description": "Does an HTML tag start at given position?",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bracket",
|
|
@@ -38,13 +38,15 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
40
40
|
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
41
|
-
"dts": "rollup -c",
|
|
41
|
+
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|
|
42
42
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
43
43
|
"lect": "node '../../ops/lect/lect.js'",
|
|
44
44
|
"letspublish": "yarn publish || :",
|
|
45
45
|
"lint": "eslint . --fix",
|
|
46
46
|
"perf": "node perf/check.js",
|
|
47
47
|
"prepare": "echo 'ready'",
|
|
48
|
+
"prettier": "prettier",
|
|
49
|
+
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
48
50
|
"pretest": "yarn run lect && yarn run build",
|
|
49
51
|
"test": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
50
52
|
"unit": "uvu test"
|
|
@@ -67,10 +69,10 @@
|
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
"dependencies": {
|
|
70
|
-
"string-left-right": "^5.0.
|
|
71
|
-
"string-match-left-right": "^8.0.
|
|
72
|
+
"string-left-right": "^5.0.11",
|
|
73
|
+
"string-match-left-right": "^8.0.11"
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
|
-
"test-mixer": "^3.0.
|
|
76
|
+
"test-mixer": "^3.0.11"
|
|
75
77
|
}
|
|
76
78
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
declare const defaultOpts: {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
allowCustomTagNames: boolean;
|
|
3
|
+
skipOpeningBracket: boolean;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
declare const version: string;
|
|
7
7
|
interface Opts {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
allowCustomTagNames: boolean;
|
|
9
|
+
skipOpeningBracket: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function isOpening(
|
|
11
|
+
declare function isOpening(
|
|
12
|
+
str: string,
|
|
13
|
+
idx?: number,
|
|
14
|
+
originalOpts?: Partial<Opts>
|
|
15
|
+
): boolean;
|
|
12
16
|
|
|
13
17
|
export { defaultOpts as defaults, isOpening, version };
|
package/types/util.d.ts
CHANGED