html-react-parser
Version:
HTML to React parser.
3 lines (2 loc) • 29.5 kB
JavaScript
!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,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var o,i={},a={},s={},l={};!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"}(o||(o={})),o.Root,o.Text,o.Directive,o.Comment,o.Script,o.Style,o.Tag,o.CDATA,o.Doctype;class c{parent=null;prev=null;next=null;startIndex=null;endIndex=null;get parentNode(){return this.parent}set parentNode(e){this.parent=e}get previousSibling(){return this.prev}set previousSibling(e){this.prev=e}get nextSibling(){return this.next}set nextSibling(e){this.next=e}cloneNode(e=!1){return T(this,e)}}class u extends c{data;constructor(e){super(),this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e}}class d extends u{type=o.Text;get nodeType(){return 3}}class p extends u{type=o.Comment;get nodeType(){return 8}}class f extends u{type=o.Directive;name;constructor(e,t){super(t),this.name=e}get nodeType(){return 1}"x-name";"x-publicId";"x-systemId"}class h extends c{children;constructor(e){super(),this.children=e}get firstChild(){return this.children[0]??null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(e){this.children=e}}class m extends h{type=o.CDATA;get nodeType(){return 4}}class g extends h{type=o.Root;get nodeType(){return 9}}class y extends h{name;attribs;type;constructor(e,t,n=[],r=("script"===e?o.Script:"style"===e?o.Style:o.Tag)){super(n),this.name=e,this.attribs=t,this.type=r}get nodeType(){return 1}get tagName(){return this.name}set tagName(e){this.name=e}get attributes(){return Object.keys(this.attribs).map(e=>({name:e,value:this.attribs[e],namespace:this["x-attribsNamespace"]?.[e],prefix:this["x-attribsPrefix"]?.[e]}))}namespace;"x-attribsNamespace";"x-attribsPrefix"}function v(e){return(t=e).type===o.Tag||t.type===o.Script||t.type===o.Style;var t}function x(e){return e.type===o.CDATA}function b(e){return e.type===o.Text}function k(e){return e.type===o.Comment}function E(e){return e.type===o.Directive}function w(e){return e.type===o.Root}function T(e,t=!1){let n;if(b(e))n=new d(e.data);else if(k(e))n=new p(e.data);else if(v(e)){const r=t?S(e.children):[],o=new y(e.name,{...e.attribs},r);for(const e of r)e.parent=o;null!=e.namespace&&(o.namespace=e.namespace),e["x-attribsNamespace"]&&(o["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(o["x-attribsPrefix"]={...e["x-attribsPrefix"]}),n=o}else if(x(e)){const r=t?S(e.children):[],o=new m(r);for(const e of r)e.parent=o;n=o}else if(w(e)){const r=t?S(e.children):[],o=new g(r);for(const e of r)e.parent=o;e["x-mode"]&&(o["x-mode"]=e["x-mode"]),n=o}else{if(!E(e))throw new Error(`Not implemented yet: ${e.type}`);{const t=new f(e.name,e.data);null!=e["x-name"]&&(t["x-name"]=e["x-name"],t["x-publicId"]=e["x-publicId"],t["x-systemId"]=e["x-systemId"]),n=t}}return n.startIndex=e.startIndex,n.endIndex=e.endIndex,null!=e.sourceCodeLocation&&(n.sourceCodeLocation=e.sourceCodeLocation),n}function S(e){const t=e.map(e=>T(e,!0));for(let e=1;e<t.length;e++)t[e].prev=t[e-1],t[e-1].next=t[e];return t}const C={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class _{dom=[];root=new g(this.dom);callback;options;elementCB;done=!1;tagStack=[this.root];lastNode=null;parser=null;constructor(e,t,n){"function"==typeof t&&(n=t,t=C),"object"==typeof e&&(t=e,e=void 0),this.callback=e??null,this.options=t??C,this.elementCB=n??null}onparserinit(e){this.parser=e}onreset(){this.dom=[],this.root=new g(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(e){this.handleCallback(e)}onclosetag(){this.lastNode=null;const e=this.tagStack.pop();this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)}onopentag(e,t){const n=this.options.xmlMode?o.Tag:void 0,r=new y(e,t,void 0,n);this.addNode(r),this.tagStack.push(r)}ontext(e){const{lastNode:t}=this;if(t&&t.type===o.Text)t.data+=e,this.options.withEndIndices&&this.parser&&(t.endIndex=this.parser.endIndex);else{const t=new d(e);this.addNode(t),this.lastNode=t}}oncomment(e){if(this.lastNode&&this.lastNode.type===o.Comment)return void(this.lastNode.data+=e);const t=new p(e);this.addNode(t),this.lastNode=t}oncommentend(){this.lastNode=null}oncdatastart(){const e=new d(""),t=new m([e]);this.addNode(t),e.parent=t,this.lastNode=e}oncdataend(){this.lastNode=null}onprocessinginstruction(e,t){const n=new f(e,t);this.addNode(n)}handleCallback(e){if("function"==typeof this.callback)this.callback(e,this.dom);else if(e)throw e}addNode(e){const t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&this.parser&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&this.parser&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null}}var O,A,N,M,I=r(Object.freeze({__proto__:null,CDATA:m,Comment:p,DataNode:u,Document:g,DomHandler:_,Element:y,Node:c,NodeWithChildren:h,ProcessingInstruction:f,Text:d,cloneNode:T,default:_,hasChildren:function(e){return Object.hasOwn(e,"children")},isCDATA:x,isComment:k,isDirective:E,isDocument:w,isTag:v,isText:b})),P={};function R(){if(A)return l;A=1,Object.defineProperty(l,"__esModule",{value:!0}),l.hasOpenTag=function(e,t){var n="<"+t,r=e.toLowerCase().indexOf(n);if(-1===r)return!1;var o=e[r+n.length];return">"===o||" "===o||"\t"===o||"\n"===o||"\r"===o||"/"===o},l.escapeSpecialCharacters=function(e){return e.replace(o,i)},l.revertEscapedCharacters=u,l.formatDOM=function e(n,r,o){var i,a,l,d;void 0===r&&(r=null);for(var p,f=[],h=0,m=n.length;h<m;h++){var g=n[h];switch(g.nodeType){case 1:var y=c(g.nodeName);(p=new t.Element(y,s(g.attributes))).children=e("template"===y?g.content.childNodes:g.childNodes,p);break;case 3:p=new t.Text(u(null!==(i=g.nodeValue)&&void 0!==i?i:""));break;case 8:p=new t.Comment(null!==(a=g.nodeValue)&&void 0!==a?a:"");break;default:continue}var v=null!==(l=f[h-1])&&void 0!==l?l:null;v&&(v.next=p),p.parent=r,p.prev=v,p.next=null,f.push(p)}o&&((p=new t.ProcessingInstruction(o.substring(0,o.indexOf(" ")).toLowerCase(),o)).next=null!==(d=f[0])&&void 0!==d?d:null,p.parent=r,f.unshift(p),f[1]&&(f[1].prev=f[0]));return f};var e,t=I,n=(O||(O=1,e=P,Object.defineProperty(e,"__esModule",{value:!0}),e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,t){return e[t.toLowerCase()]=t,e},{})),P),r="\r",o=new RegExp(r,"g"),i="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now().toString(),"__"),a=new RegExp(i,"g");function s(e){for(var t={},n=0,r=e.length;n<r;n++){var o=e[n];t[o.name]=o.value}return t}function c(e){var t=function(e){return n.CASE_SENSITIVE_TAG_NAMES_MAP[e]}(e=e.toLowerCase());return t||e}function u(e){return e.replace(a,r)}return l}function D(){if(M)return a;M=1;var e=a&&a.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(a,"__esModule",{value:!0}),a.default=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var o=r.exec(e),i=o?o[1]:void 0;return(0,n.formatDOM)((0,t.default)(e),null,i)};var t=e(function(){if(N)return s;N=1,Object.defineProperty(s,"__esModule",{value:!0}),s.default=function(s){var l,c,u,p,h,m;s=(0,e.escapeSpecialCharacters)(s);var g=o.exec(s),y=null===(l=null==g?void 0:g[1])||void 0===l?void 0:l.toLowerCase();switch(y){case t:var v=a(s);return(0,e.hasOpenTag)(s,n)||null===(c=null==(b=v.querySelector(n))?void 0:b.parentNode)||void 0===c||c.removeChild(b),(0,e.hasOpenTag)(s,r)||null===(u=null==(b=v.querySelector(r))?void 0:b.parentNode)||void 0===u||u.removeChild(b),v.querySelectorAll(t);case n:case r:var x=i(s).querySelectorAll(y);return(0,e.hasOpenTag)(s,r)&&(0,e.hasOpenTag)(s,n)?null!==(h=null===(p=x[0].parentNode)||void 0===p?void 0:p.childNodes)&&void 0!==h?h:f():x;default:return d?d(s):null!==(m=null==(b=i(s,r).querySelector(r))?void 0:b.childNodes)&&void 0!==m?m:f();var b}};var e=R(),t="html",n="head",r="body",o=/<([a-zA-Z]+[0-9]?)/,i=function(e,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},a=function(e,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},l="object"==typeof window&&window.DOMParser;if("function"==typeof l){var c=new l;i=a=function(e,t){return t&&(e="<".concat(t,">").concat(e,"</").concat(t,">")),c.parseFromString(e,"text/html")}}if("object"==typeof document&&document.implementation){var u=document.implementation.createHTMLDocument();i=function(e,t){if(t){var n=u.documentElement.querySelector(t);return n&&(n.innerHTML=e),u}return u.documentElement.innerHTML=e,u}}var d,p="object"==typeof document&&document.createElement("template");p&&p.content&&(d=function(e){return p.innerHTML=e,p.content.childNodes});var f=function(){return document.createDocumentFragment().childNodes};return s}()),n=R(),r=/<(![a-zA-Z\s]+)>/;return a}var L,F,j={},H={},z={};function B(){if(L)return z;L=1;z.SAME=0;return z.CAMELCASE=1,z.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},z}var V,U,q,G={},X={};function W(){if(q)return X;q=1;var e=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(X,"__esModule",{value:!0}),X.default=function(e,n){let r=null;if(!e||"string"!=typeof e)return r;const o=(0,t.default)(e),i="function"==typeof n;return o.forEach(e=>{if("declaration"!==e.type)return;const{property:t,value:o}=e;i?n(t,o,e):o&&(r=r||{},r[t]=o)}),r};const t=e(function(){if(U)return V;U=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,s=/^\s+|\s+$/g,l="";function c(e){return e?e.replace(s,l):l}return V=function(s,u){if("string"!=typeof s)throw new TypeError("First argument must be a string");if(!s)return[];u=u||{};var d=1,p=1;function f(e){var n=e.match(t);n&&(d+=n.length);var r=e.lastIndexOf("\n");p=~r?e.length-r:p+e.length}function h(){var e={line:d,column:p};return function(t){return t.position=new m(e),v(),t}}function m(e){this.start=e,this.end={line:d,column:p},this.source=u.source}function g(e){var t=new Error(u.source+":"+d+":"+p+": "+e);if(t.reason=e,t.filename=u.source,t.line=d,t.column=p,t.source=s,!u.silent)throw t}function y(e){var t=e.exec(s);if(t){var n=t[0];return f(n),s=s.slice(n.length),t}}function v(){y(n)}function x(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var e=h();if("/"==s.charAt(0)&&"*"==s.charAt(1)){for(var t=2;l!=s.charAt(t)&&("*"!=s.charAt(t)||"/"!=s.charAt(t+1));)++t;if(t+=2,l===s.charAt(t-1))return g("End of comment missing");var n=s.slice(2,t-2);return p+=2,f(n),s=s.slice(t),p+=2,e({type:"comment",comment:n})}}function k(){var t=h(),n=y(r);if(n){if(b(),!y(o))return g("property missing ':'");var s=y(i),u=t({type:"declaration",property:c(n[0].replace(e,l)),value:s?c(s[0].replace(e,l)):l});return y(a),u}}return m.prototype.content=s,v(),function(){var e,t=[];for(x(t);e=k();)!1!==e&&(t.push(e),x(t));return t}()}}());return X}var Y,Z,$,K,J,Q={};function ee(){if(Y)return Q;Y=1,Object.defineProperty(Q,"__esModule",{value:!0}),Q.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(e,t){return t.toUpperCase()},a=function(e,t){return"".concat(t,"-")};return Q.camelCase=function(s,l){return void 0===l&&(l={}),function(t){return!t||n.test(t)||e.test(t)}(s)?s:(s=s.toLowerCase(),(s=l.reactCompat?s.replace(o,a):s.replace(r,a)).replace(t,i))},Q}function te(){return K||(K=1,function(t){var n=G&&G.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=function(e,t){if(!e.includes("-"))return Boolean(t&&"string"==typeof t.is);if(i.has(e))return!1;return!0},t.setStyleProp=function(e,t){if("string"!=typeof e)return;if(!e.trim())return void(t.style={});try{t.style=(0,o.default)(e,a)}catch(e){t.style={}}};const r=e,o=n(function(){if($)return Z;$=1;var e=(Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(W()),t=ee();function n(n,r){var o={};return n&&"string"==typeof n?((0,e.default)(n,function(e,n){e&&n&&(o[(0,t.camelCase)(e,r)]=n)}),o):o}return n.default=n,Z=n}()),i=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);const a={reactCompat:!0};t.PRESERVE_CUSTOM_ATTRIBUTES=Number(r.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);t.canTextBeChildOfNode=e=>!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(e.name);t.returnFirstArg=e=>e}(G)),G}function ne(){if(J)return j;J=1,Object.defineProperty(j,"__esModule",{value:!0}),j.default=function(a={},s){const l={},c=Boolean(a.type&&o[a.type]);for(const o in a){const u=a[o];if((0,e.isCustomAttribute)(o)){l[o]=u;continue}const d=o.toLowerCase();let p=i(d);if(p){const t=(0,e.getPropertyInfo)(p);switch(n.includes(p)&&r.includes(s)&&!c&&(p=i("default"+d)),l[p]=u,null==t?void 0:t.type){case e.BOOLEAN:l[p]=!0;break;case e.OVERLOADED_BOOLEAN:""===u&&(l[p]=!0)}continue}t.PRESERVE_CUSTOM_ATTRIBUTES&&(l[o]=u)}return(0,t.setStyleProp)(a.style,l),l};const e=function(){if(F)return H;function e(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}F=1;const t={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(n=>{t[n]=new e(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([n,r])=>{t[n]=new e(n,1,!1,r,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(n=>{t[n]=new e(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(n=>{t[n]=new e(n,2,!1,n,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(n=>{t[n]=new e(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(n=>{t[n]=new e(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(n=>{t[n]=new e(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(n=>{t[n]=new e(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(n=>{t[n]=new e(n,5,!1,n.toLowerCase(),null,!1,!1)});const n=/[\-\:]([a-z])/g,r=e=>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(o=>{const i=o.replace(n,r);t[i]=new e(i,1,!1,o,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(o=>{const i=o.replace(n,r);t[i]=new e(i,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(o=>{const i=o.replace(n,r);t[i]=new e(i,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(n=>{t[n]=new e(n,1,!1,n.toLowerCase(),null,!1,!1)}),t.xlinkHref=new e("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(n=>{t[n]=new e(n,1,!1,n.toLowerCase(),null,!0,!0)});const{CAMELCASE:o,SAME:i,possibleStandardNames:a}=B(),s=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]*$")),l=Object.keys(a).reduce((e,t)=>{const n=a[t];return n===i?e[t]=t:n===o?e[t.toLowerCase()]=t:e[t]=n,e},{});return H.BOOLEAN=3,H.BOOLEANISH_STRING=2,H.NUMERIC=5,H.OVERLOADED_BOOLEAN=4,H.POSITIVE_NUMERIC=6,H.RESERVED=0,H.STRING=1,H.getPropertyInfo=function(e){return t.hasOwnProperty(e)?t[e]:null},H.isCustomAttribute=s,H.possibleStandardNames=l,H}(),t=te(),n=["checked","value"],r=["input","select","textarea"],o={reset:!0,submit:!0};function i(t){return e.possibleStandardNames[t]}return j}var re,oe,ie={};var ae=(oe||(oe=1,function(t){var n=i&&i.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=function(e,t){var n;if("string"!=typeof e)throw new TypeError("First argument must be a string");return e?(0,a.default)((0,r.default)(e,null!==(n=null==t?void 0:t.htmlparser2)&&void 0!==n?n:l),t):[]};const r=n(D());t.htmlToDOM=r.default;const o=n(ne());t.attributesToProps=o.default;const a=n(function(){if(re)return ie;re=1;var t=ie&&ie.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.default=function e(t,n={}){var s,l,c,u,d;const p=[],f="function"==typeof n.replace,h=null!==(s=n.transform)&&void 0!==s?s:o.returnFirstArg,{cloneElement:m,createElement:g,isValidElement:y}=null!==(l=n.library)&&void 0!==l?l:i,v=t.length;for(let i=0;i<v;i++){const s=t[i];if(f){let e=null===(c=n.replace)||void 0===c?void 0:c.call(n,s,i);if(y(e)){v>1&&(e=m(e,{key:null!==(u=e.key)&&void 0!==u?u:i})),p.push(h(e,s,i));continue}}if("text"===s.type){const e=!s.data.trim().length;if(e&&s.parent&&!(0,o.canTextBeChildOfNode)(s.parent))continue;if(n.trim&&e)continue;p.push(h(s.data,s,i));continue}const l=s;let x,b={};switch(a(l)?((0,o.setStyleProp)(l.attribs.style,l.attribs),b=l.attribs):l.attribs&&(b=(0,r.default)(l.attribs,l.name)),s.type){case"script":case"style":s.children[0]&&(b.dangerouslySetInnerHTML={__html:s.children[0].data});break;case"tag":"textarea"===s.name&&s.children[0]?b.defaultValue=s.children[0].data:(null===(d=s.children)||void 0===d?void 0:d.length)&&(x=e(s.children,n));break;default:continue}v>1&&(b.key=i),p.push(h(g(s.name,b,x),s,i))}return 1===p.length?p[0]:p};const n=e,r=t(ne()),o=te(),i={cloneElement:n.cloneElement,createElement:n.createElement,isValidElement:n.isValidElement};function a(e){return o.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&(0,o.isCustomComponent)(e.name,e.attribs)}return ie}());t.domToReact=a.default;var s=I;Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return s.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return s.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return s.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return s.Text}});const l={lowerCaseAttributeNames:!1}}(i)),i),se=n(ae),le=t({__proto__:null,default:se},[ae]);const ce=se;return Object.assign(ce,le),ce});
//# sourceMappingURL=html-react-parser.min.js.map