html-react-parser
Advanced tools
Comparing version 3.0.4 to 3.0.5
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLReactParser=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o={exports:{}},i={},a={};a.SAME=0;function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}a.CAMELCASE=1,a.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},Object.defineProperty(i,"__esModule",{value:!0});function c(e,t,n,r,o,i,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var u={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((function(e){u[e]=new c(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=l(e,2),n=t[0],r=t[1];u[n]=new c(n,1,!1,r,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){u[e]=new c(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){u[e]=new c(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((function(e){u[e]=new c(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){u[e]=new c(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){u[e]=new c(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){u[e]=new c(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){u[e]=new c(e,5,!1,e.toLowerCase(),null,!1,!1)}));var p=/[\-\:]([a-z])/g,d=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((function(e){var t=e.replace(p,d);u[t]=new c(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((function(e){var t=e.replace(p,d);u[t]=new c(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(p,d);u[t]=new c(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){u[e]=new c(e,1,!1,e.toLowerCase(),null,!1,!1)}));u.xlinkHref=new c("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){u[e]=new c(e,1,!1,e.toLowerCase(),null,!0,!0)}));var f=a,h=f.CAMELCASE,m=f.SAME,y=f.possibleStandardNames,g=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),v=Object.keys(y).reduce((function(e,t){var n=y[t];return n===m?e[t]=t:n===h?e[t.toLowerCase()]=t:e[t]=n,e}),{});i.BOOLEAN=3,i.BOOLEANISH_STRING=2,i.NUMERIC=5,i.OVERLOADED_BOOLEAN=4,i.POSITIVE_NUMERIC=6,i.RESERVED=0,i.STRING=1,i.getPropertyInfo=function(e){return u.hasOwnProperty(e)?u[e]:null},i.isCustomAttribute=g,i.possibleStandardNames=v;var b={},x=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,k=/\n/g,w=/^\s*/,T=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,E=/^:\s*/,C=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,S=/^[;\s]*/,O=/^\s+|\s+$/g,A="";function P(e){return e?e.replace(O,A):A}var N=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(e){var t=e.match(k);t&&(n+=t.length);var o=e.lastIndexOf("\n");r=~o?e.length-o:r+e.length}function i(){var e={line:n,column:r};return function(t){return t.position=new a(e),c(),t}}function a(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function l(o){var i=new Error(t.source+":"+n+":"+r+": "+o);if(i.reason=o,i.filename=t.source,i.line=n,i.column=r,i.source=e,!t.silent)throw i}function s(t){var n=t.exec(e);if(n){var r=n[0];return o(r),e=e.slice(r.length),n}}function c(){s(w)}function u(e){var t;for(e=e||[];t=p();)!1!==t&&e.push(t);return e}function p(){var t=i();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;A!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,A===e.charAt(n-1))return l("End of comment missing");var a=e.slice(2,n-2);return r+=2,o(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}}function d(){var e=i(),t=s(T);if(t){if(p(),!s(E))return l("property missing ':'");var n=s(C),r=e({type:"declaration",property:P(t[0].replace(x,A)),value:n?P(n[0].replace(x,A)):A});return s(S),r}}return a.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=d();)!1!==e&&(t.push(e),u(t));return t}()};var D=function(e,t){var n,r=null;if(!e||"string"!=typeof e)return r;for(var o,i,a=N(e),l="function"==typeof t,s=0,c=a.length;s<c;s++)o=(n=a[s]).property,i=n.value,l?t(o,i,n):i&&(r||(r={}),r[o]=i);return r},I={__esModule:!0,camelCase:void 0},M=/^--[a-zA-Z0-9-]+$/,R=/-([a-z])/g,L=/^[^-]+$/,_=/^-(webkit|moz|ms|o|khtml)-/,j=/^-(ms)-/,F=function(e,t){return t.toUpperCase()},z=function(e,t){return"".concat(t,"-")};I.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||L.test(e)||M.test(e)}(e)?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(j,z):e.replace(_,z)).replace(R,F))},function(e){var t=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var n=t(D),o=I;e.default=function(e,t){var r={};return e&&"string"==typeof e?((0,n.default)(e,(function(e,n){e&&n&&(r[(0,o.camelCase)(e,t)]=n)})),r):r}}(b);var H=n.default,B=b.default;var V={reactCompat:!0};var U=H.version.split(".")[0]>=16,q=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var W={PRESERVE_CUSTOM_ATTRIBUTES:U,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var n,r,o="function"==typeof t,i={},a={};for(n in e)r=e[n],o&&(i=t(n,r))&&2===i.length?a[i[0]]=i[1]:"string"==typeof r&&(a[r]=n);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){if(null!=e)try{t.style=B(e,V)}catch(e){t.style={}}},canTextBeChildOfNode:function(e){return!q.has(e.name)},elementsWithNoTextChildren:q},X=i,G=W,Y=function(e){var t,n,r,o,i,a={},l=(e=e||{}).type&&{reset:!0,submit:!0}[e.type];for(t in e)if(r=e[t],X.isCustomAttribute(t))a[t]=r;else if(o=Z(n=t.toLowerCase()))switch(i=X.getPropertyInfo(o),"checked"!==o&&"value"!==o||l||(o=Z("default"+n)),a[o]=r,i&&i.type){case X.BOOLEAN:a[o]=!0;break;case X.OVERLOADED_BOOLEAN:""===r&&(a[o]=!0)}else G.PRESERVE_CUSTOM_ATTRIBUTES&&(a[t]=r);return G.setStyleProp(e.style,a),a};function Z(e){return X.possibleStandardNames[e]}var $=n.default,K=Y,J=W,Q=J.setStyleProp,ee=J.canTextBeChildOfNode;function te(e){return J.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&J.isCustomComponent(e.name,e.attribs)}var ne=function e(t,n){for(var r,o,i,a,l,s=(n=n||{}).library||$,c=s.cloneElement,u=s.createElement,p=s.isValidElement,d=[],f="function"==typeof n.replace,h=n.trim,m=0,y=t.length;m<y;m++)if(r=t[m],f&&p(i=n.replace(r)))y>1&&(i=c(i,{key:i.key||m})),d.push(i);else if("text"!==r.type){switch(a=r.attribs,te(r)?Q(a.style,a):a&&(a=K(a)),l=null,r.type){case"script":case"style":r.children[0]&&(a.dangerouslySetInnerHTML={__html:r.children[0].data});break;case"tag":"textarea"===r.name&&r.children[0]?a.defaultValue=r.children[0].data:r.children&&r.children.length&&(l=e(r.children,n));break;default:continue}y>1&&(a.key=m),d.push(u(r.name,a,l))}else{if((o=!r.data.trim().length)&&r.parent&&!ee(r.parent))continue;if(h&&o)continue;d.push(r.data)}return 1===d.length?d[0]:d},re="html",oe="head",ie="body",ae=/<([a-zA-Z]+[0-9]?)/,le=/<head[^]*>/i,se=/<body[^]*>/i,ce=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},ue=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},pe="object"==typeof window&&window.DOMParser;if("function"==typeof pe){var de=new pe;ue=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),de.parseFromString(e,"text/html")},ce=ue}if("object"==typeof document&&document.implementation){var fe=document.implementation.createHTMLDocument();ce=function(e,t){return t?(fe.documentElement.querySelector(t).innerHTML=e,fe):(fe.documentElement.innerHTML=e,fe)}}var he,me="object"==typeof document?document.createElement("template"):{};me.content&&(he=function(e){return me.innerHTML=e,me.content.childNodes});var ye,ge=function(e){var t,n,r,o,i=e.match(ae);switch(i&&i[1]&&(t=i[1].toLowerCase()),t){case re:return n=ue(e),le.test(e)||(r=n.querySelector(oe))&&r.parentNode.removeChild(r),se.test(e)||(r=n.querySelector(ie))&&r.parentNode.removeChild(r),n.querySelectorAll(re);case oe:case ie:return o=(n=ce(e)).querySelectorAll(t),se.test(e)&&le.test(e)?o[0].parentNode.childNodes:o;default:return he?he(e):(r=ce(e,ie).querySelector(ie)).childNodes}},ve={},be={},xe={};function ke(){return ye||(ye=1,function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(t=e.ElementType||(e.ElementType={})),e.isTag=function(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style},e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(xe)),xe}var we,Te,Ee={};function Ce(){if(we)return Ee;we=1;var e,t=r&&r.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=r&&r.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.cloneNode=Ee.hasChildren=Ee.isDocument=Ee.isDirective=Ee.isComment=Ee.isText=Ee.isCDATA=Ee.isTag=Ee.Element=Ee.Document=Ee.CDATA=Ee.NodeWithChildren=Ee.ProcessingInstruction=Ee.Comment=Ee.Text=Ee.DataNode=Ee.Node=void 0;var o=ke(),i=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return void 0===e&&(e=!1),x(this,e)},e}();Ee.Node=i;var a=function(e){function n(t){var n=e.call(this)||this;return n.data=t,n}return t(n,e),Object.defineProperty(n.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),n}(i);Ee.DataNode=a;var l=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.Text,t}return t(n,e),Object.defineProperty(n.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),n}(a);Ee.Text=l;var s=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.Comment,t}return t(n,e),Object.defineProperty(n.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),n}(a);Ee.Comment=s;var c=function(e){function n(t,n){var r=e.call(this,n)||this;return r.name=t,r.type=o.ElementType.Directive,r}return t(n,e),Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),n}(a);Ee.ProcessingInstruction=c;var u=function(e){function n(t){var n=e.call(this)||this;return n.children=t,n}return t(n,e),Object.defineProperty(n.prototype,"firstChild",{get:function(){var e;return null!==(e=this.children[0])&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),n}(i);Ee.NodeWithChildren=u;var p=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.CDATA,t}return t(n,e),Object.defineProperty(n.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),n}(u);Ee.CDATA=p;var d=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.ElementType.Root,t}return t(n,e),Object.defineProperty(n.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),n}(u);Ee.Document=d;var f=function(e){function n(t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i="script"===t?o.ElementType.Script:"style"===t?o.ElementType.Style:o.ElementType.Tag);var a=e.call(this,r)||this;return a.name=t,a.attribs=n,a.type=i,a}return t(n,e),Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,r;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(r=e["x-attribsPrefix"])||void 0===r?void 0:r[t]}}))},enumerable:!1,configurable:!0}),n}(u);function h(e){return(0,o.isTag)(e)}function m(e){return e.type===o.ElementType.CDATA}function y(e){return e.type===o.ElementType.Text}function g(e){return e.type===o.ElementType.Comment}function v(e){return e.type===o.ElementType.Directive}function b(e){return e.type===o.ElementType.Root}function x(e,t){var r;if(void 0===t&&(t=!1),y(e))r=new l(e.data);else if(g(e))r=new s(e.data);else if(h(e)){var o=t?k(e.children):[],i=new f(e.name,n({},e.attribs),o);o.forEach((function(e){return e.parent=i})),null!=e.namespace&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]=n({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]=n({},e["x-attribsPrefix"])),r=i}else if(m(e)){o=t?k(e.children):[];var a=new p(o);o.forEach((function(e){return e.parent=a})),r=a}else if(b(e)){o=t?k(e.children):[];var u=new d(o);o.forEach((function(e){return e.parent=u})),e["x-mode"]&&(u["x-mode"]=e["x-mode"]),r=u}else{if(!v(e))throw new Error("Not implemented yet: ".concat(e.type));var x=new c(e.name,e.data);null!=e["x-name"]&&(x["x-name"]=e["x-name"],x["x-publicId"]=e["x-publicId"],x["x-systemId"]=e["x-systemId"]),r=x}return r.startIndex=e.startIndex,r.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(r.sourceCodeLocation=e.sourceCodeLocation),r}function k(e){for(var t=e.map((function(e){return x(e,!0)})),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}return Ee.Element=f,Ee.isTag=h,Ee.isCDATA=m,Ee.isText=y,Ee.isComment=g,Ee.isDirective=v,Ee.isDocument=b,Ee.hasChildren=function(e){return Object.prototype.hasOwnProperty.call(e,"children")},Ee.cloneNode=x,Ee}function Se(){return Te||(Te=1,function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=r&&r.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var o=ke(),i=Ce();n(Ce(),e);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},l=function(){function e(e,t,n){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=a),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:a,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?o.ElementType.Tag:void 0,r=new i.Element(e,t,void 0,n);this.addNode(r),this.tagStack.push(r)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===o.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new i.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===o.ElementType.Comment)this.lastNode.data+=e;else{var t=new i.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new i.Text(""),t=new i.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new i.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();e.DomHandler=l,e.default=l}(be)),be}for(var Oe,Ae={CASE_SENSITIVE_TAG_NAMES:["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]},Pe=Se(),Ne=Ae.CASE_SENSITIVE_TAG_NAMES,De=Pe.Comment,Ie=Pe.Element,Me=Pe.ProcessingInstruction,Re=Pe.Text,Le={},_e=0,je=Ne.length;_e<je;_e++)Oe=Ne[_e],Le[Oe.toLowerCase()]=Oe;function Fe(e){for(var t,n={},r=0,o=e.length;r<o;r++)n[(t=e[r]).name]=t.value;return n}function ze(e){var t=function(e){return Le[e]}(e=e.toLowerCase());return t||e}ve.formatAttributes=Fe,ve.formatDOM=function e(t,n,r){n=n||null;for(var o=[],i=0,a=t.length;i<a;i++){var l,s=t[i];switch(s.nodeType){case 1:(l=new Ie(ze(s.nodeName),Fe(s.attributes))).children=e(s.childNodes,l);break;case 3:l=new Re(s.nodeValue);break;case 8:l=new De(s.nodeValue);break;default:continue}var c=o[i-1]||null;c&&(c.next=l),l.parent=n,l.prev=c,l.next=null,o.push(l)}return r&&((l=new Me(r.substring(0,r.indexOf(" ")).toLowerCase(),r)).next=o[0]||null,l.parent=n,o.unshift(l),o[1]&&(o[1].prev=o[0])),o};var He=ge,Be=ve.formatDOM,Ve=/<(![a-zA-Z\s]+)>/;var Ue=ne,qe=Y,We=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(""===e)return[];var t,n=e.match(Ve);return n&&n[1]&&(t=n[1]),Be(He(e),null,t)};We="function"==typeof We.default?We.default:We;var Xe={lowerCaseAttributeNames:!1};function Ge(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:Ue(We(e,(t=t||{}).htmlparser2||Xe),t)}return Ge.domToReact=Ue,Ge.htmlToDOM=We,Ge.attributesToProps=qe,Ge.Element=Se().Element,o.exports=Ge,o.exports.default=Ge,o.exports})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).HTMLReactParser=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};exports.default={};var o={get exports(){return exports.default},set exports(e){exports.default=e}},i={},a={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0,function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"}(t=e.ElementType||(e.ElementType={})),e.isTag=function(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style},e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(a);var l,s={},c=r&&r.__extends||(l=function(e,t){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},l(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),u=r&&r.__assign||function(){return u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},u.apply(this,arguments)};Object.defineProperty(s,"__esModule",{value:!0}),s.cloneNode=s.hasChildren=s.isDocument=s.isDirective=s.isComment=s.isText=s.isCDATA=s.isTag=s.Element=s.Document=s.CDATA=s.NodeWithChildren=s.ProcessingInstruction=s.Comment=s.Text=s.DataNode=s.Node=void 0;var p=a,d=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return void 0===e&&(e=!1),O(this,e)},e}();s.Node=d;var f=function(e){function t(t){var n=e.call(this)||this;return n.data=t,n}return c(t,e),Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),t}(d);s.DataNode=f;var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=p.ElementType.Text,t}return c(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),t}(f);s.Text=h;var m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=p.ElementType.Comment,t}return c(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),t}(f);s.Comment=m;var y=function(e){function t(t,n){var r=e.call(this,n)||this;return r.name=t,r.type=p.ElementType.Directive,r}return c(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),t}(f);s.ProcessingInstruction=y;var g=function(e){function t(t){var n=e.call(this)||this;return n.children=t,n}return c(t,e),Object.defineProperty(t.prototype,"firstChild",{get:function(){var e;return null!==(e=this.children[0])&&void 0!==e?e:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),t}(d);s.NodeWithChildren=g;var v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=p.ElementType.CDATA,t}return c(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(g);s.CDATA=v;var b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=p.ElementType.Root,t}return c(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(g);s.Document=b;var x=function(e){function t(t,n,r,o){void 0===r&&(r=[]),void 0===o&&(o="script"===t?p.ElementType.Script:"style"===t?p.ElementType.Style:p.ElementType.Tag);var i=e.call(this,r)||this;return i.name=t,i.attribs=n,i.type=o,i}return c(t,e),Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map((function(t){var n,r;return{name:t,value:e.attribs[t],namespace:null===(n=e["x-attribsNamespace"])||void 0===n?void 0:n[t],prefix:null===(r=e["x-attribsPrefix"])||void 0===r?void 0:r[t]}}))},enumerable:!1,configurable:!0}),t}(g);function k(e){return(0,p.isTag)(e)}function w(e){return e.type===p.ElementType.CDATA}function T(e){return e.type===p.ElementType.Text}function E(e){return e.type===p.ElementType.Comment}function C(e){return e.type===p.ElementType.Directive}function S(e){return e.type===p.ElementType.Root}function O(e,t){var n;if(void 0===t&&(t=!1),T(e))n=new h(e.data);else if(E(e))n=new m(e.data);else if(k(e)){var r=t?A(e.children):[],o=new x(e.name,u({},e.attribs),r);r.forEach((function(e){return e.parent=o})),null!=e.namespace&&(o.namespace=e.namespace),e["x-attribsNamespace"]&&(o["x-attribsNamespace"]=u({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(o["x-attribsPrefix"]=u({},e["x-attribsPrefix"])),n=o}else if(w(e)){r=t?A(e.children):[];var i=new v(r);r.forEach((function(e){return e.parent=i})),n=i}else if(S(e)){r=t?A(e.children):[];var a=new b(r);r.forEach((function(e){return e.parent=a})),e["x-mode"]&&(a["x-mode"]=e["x-mode"]),n=a}else{if(!C(e))throw new Error("Not implemented yet: ".concat(e.type));var l=new y(e.name,e.data);null!=e["x-name"]&&(l["x-name"]=e["x-name"],l["x-publicId"]=e["x-publicId"],l["x-systemId"]=e["x-systemId"]),n=l}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function A(e){for(var t=e.map((function(e){return O(e,!0)})),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}s.Element=x,s.isTag=k,s.isCDATA=w,s.isText=T,s.isComment=E,s.isDirective=C,s.isDocument=S,s.hasChildren=function(e){return Object.prototype.hasOwnProperty.call(e,"children")},s.cloneNode=O,function(e){var t=r&&r.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),n=r&&r.__exportStar||function(e,n){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var o=a,i=s;n(s,e);var l={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},c=function(){function e(e,t,n){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,"function"==typeof t&&(n=t,t=l),"object"==typeof e&&(t=e,e=void 0),this.callback=null!=e?e:null,this.options=null!=t?t:l,this.elementCB=null!=n?n:null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?o.ElementType.Tag:void 0,r=new i.Element(e,t,void 0,n);this.addNode(r),this.tagStack.push(r)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===o.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new i.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===o.ElementType.Comment)this.lastNode.data+=e;else{var t=new i.Comment(e);this.addNode(t),this.lastNode=t}},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new i.Text(""),t=new i.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new i.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();e.DomHandler=c,e.default=c}(i);var P="html",N="head",I="body",D=/<([a-zA-Z]+[0-9]?)/,M=/<head[^]*>/i,R=/<body[^]*>/i,L=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},_=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},j="object"==typeof window&&window.DOMParser;if("function"==typeof j){var F=new j;_=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),F.parseFromString(e,"text/html")},L=_}if("object"==typeof document&&document.implementation){var z=document.implementation.createHTMLDocument();L=function(e,t){return t?(z.documentElement.querySelector(t).innerHTML=e,z):(z.documentElement.innerHTML=e,z)}}var H,B="object"==typeof document?document.createElement("template"):{};B.content&&(H=function(e){return B.innerHTML=e,B.content.childNodes});for(var V,U=function(e){var t,n,r,o,i=e.match(D);switch(i&&i[1]&&(t=i[1].toLowerCase()),t){case P:return n=_(e),M.test(e)||(r=n.querySelector(N))&&r.parentNode.removeChild(r),R.test(e)||(r=n.querySelector(I))&&r.parentNode.removeChild(r),n.querySelectorAll(P);case N:case I:return o=(n=L(e)).querySelectorAll(t),R.test(e)&&M.test(e)?o[0].parentNode.childNodes:o;default:return H?H(e):(r=L(e,I).querySelector(I)).childNodes}},q={},W={CASE_SENSITIVE_TAG_NAMES:["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]},X=i,G=W.CASE_SENSITIVE_TAG_NAMES,Y=X.Comment,Z=X.Element,$=X.ProcessingInstruction,K=X.Text,J={},Q=0,ee=G.length;Q<ee;Q++)V=G[Q],J[V.toLowerCase()]=V;function te(e){for(var t,n={},r=0,o=e.length;r<o;r++)n[(t=e[r]).name]=t.value;return n}function ne(e){var t=function(e){return J[e]}(e=e.toLowerCase());return t||e}q.formatAttributes=te,q.formatDOM=function e(t,n,r){n=n||null;for(var o=[],i=0,a=t.length;i<a;i++){var l,s=t[i];switch(s.nodeType){case 1:(l=new Z(ne(s.nodeName),te(s.attributes))).children=e(s.childNodes,l);break;case 3:l=new K(s.nodeValue);break;case 8:l=new Y(s.nodeValue);break;default:continue}var c=o[i-1]||null;c&&(c.next=l),l.parent=n,l.prev=c,l.next=null,o.push(l)}return r&&((l=new $(r.substring(0,r.indexOf(" ")).toLowerCase(),r)).next=o[0]||null,l.parent=n,o.unshift(l),o[1]&&(o[1].prev=o[0])),o};var re=U,oe=q.formatDOM,ie=/<(![a-zA-Z\s]+)>/;var ae=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(""===e)return[];var t,n=e.match(ie);return n&&n[1]&&(t=n[1]),oe(re(e),null,t)},le={},se={};se.SAME=0;function ce(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ue(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ue(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ue(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}se.CAMELCASE=1,se.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},Object.defineProperty(le,"__esModule",{value:!0});function pe(e,t,n,r,o,i,a){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var de={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach((function(e){de[e]=new pe(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=ce(e,2),n=t[0],r=t[1];de[n]=new pe(n,1,!1,r,null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){de[e]=new pe(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){de[e]=new pe(e,2,!1,e,null,!1,!1)})),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach((function(e){de[e]=new pe(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){de[e]=new pe(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){de[e]=new pe(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){de[e]=new pe(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){de[e]=new pe(e,5,!1,e.toLowerCase(),null,!1,!1)}));var fe=/[\-\:]([a-z])/g,he=function(e){return e[1].toUpperCase()};["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach((function(e){var t=e.replace(fe,he);de[t]=new pe(t,1,!1,e,null,!1,!1)})),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach((function(e){var t=e.replace(fe,he);de[t]=new pe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(fe,he);de[t]=new pe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){de[e]=new pe(e,1,!1,e.toLowerCase(),null,!1,!1)}));de.xlinkHref=new pe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){de[e]=new pe(e,1,!1,e.toLowerCase(),null,!0,!0)}));var me=se,ye=me.CAMELCASE,ge=me.SAME,ve=me.possibleStandardNames,be=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),xe=Object.keys(ve).reduce((function(e,t){var n=ve[t];return n===ge?e[t]=t:n===ye?e[t.toLowerCase()]=t:e[t]=n,e}),{});le.BOOLEAN=3,le.BOOLEANISH_STRING=2,le.NUMERIC=5,le.OVERLOADED_BOOLEAN=4,le.POSITIVE_NUMERIC=6,le.RESERVED=0,le.STRING=1,le.getPropertyInfo=function(e){return de.hasOwnProperty(e)?de[e]:null},le.isCustomAttribute=be,le.possibleStandardNames=xe;var ke={},we=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Te=/\n/g,Ee=/^\s*/,Ce=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Se=/^:\s*/,Oe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Ae=/^[;\s]*/,Pe=/^\s+|\s+$/g,Ne="";function Ie(e){return e?e.replace(Pe,Ne):Ne}var De=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(e){var t=e.match(Te);t&&(n+=t.length);var o=e.lastIndexOf("\n");r=~o?e.length-o:r+e.length}function i(){var e={line:n,column:r};return function(t){return t.position=new a(e),c(),t}}function a(e){this.start=e,this.end={line:n,column:r},this.source=t.source}function l(o){var i=new Error(t.source+":"+n+":"+r+": "+o);if(i.reason=o,i.filename=t.source,i.line=n,i.column=r,i.source=e,!t.silent)throw i}function s(t){var n=t.exec(e);if(n){var r=n[0];return o(r),e=e.slice(r.length),n}}function c(){s(Ee)}function u(e){var t;for(e=e||[];t=p();)!1!==t&&e.push(t);return e}function p(){var t=i();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;Ne!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,Ne===e.charAt(n-1))return l("End of comment missing");var a=e.slice(2,n-2);return r+=2,o(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}}function d(){var e=i(),t=s(Ce);if(t){if(p(),!s(Se))return l("property missing ':'");var n=s(Oe),r=e({type:"declaration",property:Ie(t[0].replace(we,Ne)),value:n?Ie(n[0].replace(we,Ne)):Ne});return s(Ae),r}}return a.prototype.content=e,c(),function(){var e,t=[];for(u(t);e=d();)!1!==e&&(t.push(e),u(t));return t}()};var Me=function(e,t){var n,r=null;if(!e||"string"!=typeof e)return r;for(var o,i,a=De(e),l="function"==typeof t,s=0,c=a.length;s<c;s++)o=(n=a[s]).property,i=n.value,l?t(o,i,n):i&&(r||(r={}),r[o]=i);return r},Re={__esModule:!0,camelCase:void 0},Le=/^--[a-zA-Z0-9-]+$/,_e=/-([a-z])/g,je=/^[^-]+$/,Fe=/^-(webkit|moz|ms|o|khtml)-/,ze=/^-(ms)-/,He=function(e,t){return t.toUpperCase()},Be=function(e,t){return"".concat(t,"-")};Re.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||je.test(e)||Le.test(e)}(e)?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(ze,Be):e.replace(Fe,Be)).replace(_e,He))},function(e){var t=r&&r.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};e.__esModule=!0;var n=t(Me),o=Re;e.default=function(e,t){var r={};return e&&"string"==typeof e?((0,n.default)(e,(function(e,n){e&&n&&(r[(0,o.camelCase)(e,t)]=n)})),r):r}}(ke);var Ve=n.default,Ue=ke.default;var qe={reactCompat:!0};var We=Ve.version.split(".")[0]>=16,Xe=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var Ge={PRESERVE_CUSTOM_ATTRIBUTES:We,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var n,r,o="function"==typeof t,i={},a={};for(n in e)r=e[n],o&&(i=t(n,r))&&2===i.length?a[i[0]]=i[1]:"string"==typeof r&&(a[r]=n);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){if(null!=e)try{t.style=Ue(e,qe)}catch(e){t.style={}}},canTextBeChildOfNode:function(e){return!Xe.has(e.name)},elementsWithNoTextChildren:Xe},Ye=le,Ze=Ge,$e=function(e){var t,n,r,o,i,a={},l=(e=e||{}).type&&{reset:!0,submit:!0}[e.type];for(t in e)if(r=e[t],Ye.isCustomAttribute(t))a[t]=r;else if(o=Ke(n=t.toLowerCase()))switch(i=Ye.getPropertyInfo(o),"checked"!==o&&"value"!==o||l||(o=Ke("default"+n)),a[o]=r,i&&i.type){case Ye.BOOLEAN:a[o]=!0;break;case Ye.OVERLOADED_BOOLEAN:""===r&&(a[o]=!0)}else Ze.PRESERVE_CUSTOM_ATTRIBUTES&&(a[t]=r);return Ze.setStyleProp(e.style,a),a};function Ke(e){return Ye.possibleStandardNames[e]}var Je=n.default,Qe=$e,et=Ge,tt=et.setStyleProp,nt=et.canTextBeChildOfNode;function rt(e){return et.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&et.isCustomComponent(e.name,e.attribs)}var ot=function e(t,n){for(var r,o,i,a,l,s=(n=n||{}).library||Je,c=s.cloneElement,u=s.createElement,p=s.isValidElement,d=[],f="function"==typeof n.replace,h=n.trim,m=0,y=t.length;m<y;m++)if(r=t[m],f&&p(i=n.replace(r)))y>1&&(i=c(i,{key:i.key||m})),d.push(i);else if("text"!==r.type){switch(a=r.attribs,rt(r)?tt(a.style,a):a&&(a=Qe(a)),l=null,r.type){case"script":case"style":r.children[0]&&(a.dangerouslySetInnerHTML={__html:r.children[0].data});break;case"tag":"textarea"===r.name&&r.children[0]?a.defaultValue=r.children[0].data:r.children&&r.children.length&&(l=e(r.children,n));break;default:continue}y>1&&(a.key=m),d.push(u(r.name,a,l))}else{if((o=!r.data.trim().length)&&r.parent&&!nt(r.parent))continue;if(h&&o)continue;d.push(r.data)}return 1===d.length?d[0]:d},it=i,at=ae,lt=$e,st=ot;at="function"==typeof at.default?at.default:at;var ct={lowerCaseAttributeNames:!1};function ut(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:st(at(e,(t=t||{}).htmlparser2||ct),t)}return ut.domToReact=st,ut.htmlToDOM=at,ut.attributesToProps=lt,ut.Comment=it.Comment,ut.Element=it.Element,ut.ProcessingInstruction=it.ProcessingInstruction,ut.Text=it.Text,o.exports=ut,exports.default.default=ut,exports.default})); | ||
//# sourceMappingURL=html-react-parser.min.js.map |
// TypeScript Version: 4.7 | ||
/* eslint-disable no-undef, no-unused-vars */ | ||
import { ParserOptions } from 'htmlparser2'; | ||
import { | ||
Comment, | ||
DomHandlerOptions, | ||
Element, | ||
Node, | ||
ProcessingInstruction, | ||
Text | ||
Text, | ||
type DomHandlerOptions | ||
} from 'domhandler'; | ||
import htmlToDOM from 'html-dom-parser'; | ||
import { ParserOptions } from 'htmlparser2'; | ||
@@ -19,3 +20,3 @@ import attributesToProps from './lib/attributes-to-props'; | ||
export type HTMLParser2Options = ParserOptions & DomHandlerOptions; | ||
export { Comment, Element, Node, ProcessingInstruction, Text }; | ||
export { Comment, Element, ProcessingInstruction, Text }; | ||
export type DOMNode = Comment | Element | Node | ProcessingInstruction | Text; | ||
@@ -22,0 +23,0 @@ |
13
index.js
@@ -1,5 +0,7 @@ | ||
var domToReact = require('./lib/dom-to-react'); | ||
var attributesToProps = require('./lib/attributes-to-props'); | ||
var domhandler = require('domhandler'); | ||
var htmlToDOM = require('html-dom-parser'); | ||
var attributesToProps = require('./lib/attributes-to-props'); | ||
var domToReact = require('./lib/dom-to-react'); | ||
// support backwards compatibility for ES Module | ||
@@ -39,6 +41,11 @@ htmlToDOM = | ||
HTMLReactParser.attributesToProps = attributesToProps; | ||
HTMLReactParser.Element = require('domhandler').Element; | ||
// domhandler | ||
HTMLReactParser.Comment = domhandler.Comment; | ||
HTMLReactParser.Element = domhandler.Element; | ||
HTMLReactParser.ProcessingInstruction = domhandler.ProcessingInstruction; | ||
HTMLReactParser.Text = domhandler.Text; | ||
// support CommonJS and ES Modules | ||
module.exports = HTMLReactParser; | ||
module.exports.default = HTMLReactParser; |
{ | ||
"name": "html-react-parser", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "HTML to React parser.", | ||
@@ -53,27 +53,27 @@ "author": "Mark <mark@remarkablemark.org>", | ||
"devDependencies": { | ||
"@commitlint/cli": "17.0.3", | ||
"@commitlint/config-conventional": "17.0.3", | ||
"@rollup/plugin-commonjs": "22.0.2", | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@size-limit/preset-big-lib": "7.0.8", | ||
"@types/react": "18.0.17", | ||
"@typescript-eslint/parser": "5.33.1", | ||
"@commitlint/cli": "17.3.0", | ||
"@commitlint/config-conventional": "17.3.0", | ||
"@rollup/plugin-commonjs": "24.0.0", | ||
"@rollup/plugin-node-resolve": "15.0.1", | ||
"@size-limit/preset-big-lib": "8.1.0", | ||
"@types/react": "18.0.26", | ||
"@typescript-eslint/parser": "5.47.0", | ||
"benchmark": "2.1.4", | ||
"dtslint": "4.2.1", | ||
"eslint": "8.22.0", | ||
"eslint": "8.30.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"husky": "8.0.1", | ||
"jest": "28.1.3", | ||
"jest-environment-jsdom": "28.1.3", | ||
"lint-staged": "13.0.3", | ||
"husky": "8.0.2", | ||
"jest": "29.3.1", | ||
"jest-environment-jsdom": "29.3.1", | ||
"lint-staged": "13.1.0", | ||
"pinst": "3.0.0", | ||
"preact": "10.10.6", | ||
"prettier": "2.7.1", | ||
"preact": "10.11.3", | ||
"prettier": "2.8.1", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.78.1", | ||
"rollup": "2.79.1", | ||
"rollup-plugin-terser": "7.0.2", | ||
"size-limit": "7.0.8", | ||
"typescript": "4.7.4" | ||
"size-limit": "8.1.0", | ||
"typescript": "4.9.4" | ||
}, | ||
@@ -80,0 +80,0 @@ "peerDependencies": { |
@@ -6,2 +6,3 @@ # html-react-parser | ||
[![NPM version](https://img.shields.io/npm/v/html-react-parser.svg)](https://www.npmjs.com/package/html-react-parser) | ||
[![Bundlephobia minified + gzip](https://img.shields.io/bundlephobia/minzip/html-react-parser)](https://bundlephobia.com/package/html-react-parser) | ||
[![Build Status](https://github.com/remarkablemark/html-react-parser/workflows/build/badge.svg?branch=master)](https://github.com/remarkablemark/html-react-parser/actions?query=workflow%3Abuild) | ||
@@ -60,2 +61,3 @@ [![codecov](https://codecov.io/gh/remarkablemark/html-react-parser/branch/master/graph/badge.svg?token=wosFd1DBIR)](https://codecov.io/gh/remarkablemark/html-react-parser) | ||
- [Webpack build warnings](#webpack-build-warnings) | ||
- [TypeScript error](#typescript-error) | ||
- [Performance](#performance) | ||
@@ -382,2 +384,4 @@ - [Contributors](#contributors) | ||
Also, it's recommended to upgrade to the latest version of [typescript](https://www.npmjs.com/package/typescript). | ||
### v2.0.0 | ||
@@ -494,2 +498,15 @@ | ||
### TypeScript error | ||
If you see the TypeScript error: | ||
``` | ||
node_modules/htmlparser2/lib/index.d.ts:2:23 - error TS1005: ',' expected. | ||
2 export { Parser, type ParserOptions }; | ||
~~~~~~~~~~~~~ | ||
``` | ||
Then upgrade to the latest version of [typescript](https://www.npmjs.com/package/typescript). See [#748](https://github.com/remarkablemark/html-react-parser/issues/748). | ||
## Performance | ||
@@ -496,0 +513,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
419364
3010
580