UNPKG

@sumcode/svgify

Version:

A lightweight React component designed to dynamically render and style SVG icons.

4 lines (3 loc) 36.4 kB
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const L=require("./SvgifyContext-Dh47B7AG.cjs"),j=require("react");var v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={},J={},K={},S={},Q={},ee={};(function(e){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;var t;(function(n){n.Root="root",n.Text="text",n.Directive="directive",n.Comment="comment",n.Script="script",n.Style="style",n.Tag="tag",n.CDATA="cdata",n.Doctype="doctype"})(t=e.ElementType||(e.ElementType={}));function r(n){return n.type===t.Tag||n.type===t.Script||n.type===t.Style}e.isTag=r,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})(ee);var h={},R=v&&v.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(n[l]=i[l])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),k=v&&v.__assign||function(){return k=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},k.apply(this,arguments)};Object.defineProperty(h,"__esModule",{value:!0});h.cloneNode=h.hasChildren=h.isDocument=h.isDirective=h.isComment=h.isText=h.isCDATA=h.isTag=h.Element=h.Document=h.CDATA=h.NodeWithChildren=h.ProcessingInstruction=h.Comment=h.Text=h.DataNode=h.Node=void 0;var _=ee,te=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(t){this.parent=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(t){this.prev=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(t){this.next=t},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(t){return t===void 0&&(t=!1),re(this,t)},e}();h.Node=te;var G=function(e){R(t,e);function t(r){var n=e.call(this)||this;return n.data=r,n}return Object.defineProperty(t.prototype,"nodeValue",{get:function(){return this.data},set:function(r){this.data=r},enumerable:!1,configurable:!0}),t}(te);h.DataNode=G;var Ae=function(e){R(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=_.ElementType.Text,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),t}(G);h.Text=Ae;var Ce=function(e){R(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=_.ElementType.Comment,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),t}(G);h.Comment=Ce;var Se=function(e){R(t,e);function t(r,n){var i=e.call(this,n)||this;return i.name=r,i.type=_.ElementType.Directive,i}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),t}(G);h.ProcessingInstruction=Se;var F=function(e){R(t,e);function t(r){var n=e.call(this)||this;return n.children=r,n}return Object.defineProperty(t.prototype,"firstChild",{get:function(){var r;return(r=this.children[0])!==null&&r!==void 0?r: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(r){this.children=r},enumerable:!1,configurable:!0}),t}(te);h.NodeWithChildren=F;var Oe=function(e){R(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=_.ElementType.CDATA,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),t}(F);h.CDATA=Oe;var we=function(e){R(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=_.ElementType.Root,r}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),t}(F);h.Document=we;var ke=function(e){R(t,e);function t(r,n,i,l){i===void 0&&(i=[]),l===void 0&&(l=r==="script"?_.ElementType.Script:r==="style"?_.ElementType.Style:_.ElementType.Tag);var f=e.call(this,i)||this;return f.name=r,f.attribs=n,f.type=l,f}return 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(r){this.name=r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){var r=this;return Object.keys(this.attribs).map(function(n){var i,l;return{name:n,value:r.attribs[n],namespace:(i=r["x-attribsNamespace"])===null||i===void 0?void 0:i[n],prefix:(l=r["x-attribsPrefix"])===null||l===void 0?void 0:l[n]}})},enumerable:!1,configurable:!0}),t}(F);h.Element=ke;function Pe(e){return(0,_.isTag)(e)}h.isTag=Pe;function xe(e){return e.type===_.ElementType.CDATA}h.isCDATA=xe;function Ie(e){return e.type===_.ElementType.Text}h.isText=Ie;function Ne(e){return e.type===_.ElementType.Comment}h.isComment=Ne;function Me(e){return e.type===_.ElementType.Directive}h.isDirective=Me;function De(e){return e.type===_.ElementType.Root}h.isDocument=De;function Xe(e){return Object.prototype.hasOwnProperty.call(e,"children")}h.hasChildren=Xe;function re(e,t){t===void 0&&(t=!1);var r;if(Ie(e))r=new Ae(e.data);else if(Ne(e))r=new Ce(e.data);else if(Pe(e)){var n=t?$(e.children):[],i=new ke(e.name,k({},e.attribs),n);n.forEach(function(a){return a.parent=i}),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]=k({},e["x-attribsNamespace"])),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]=k({},e["x-attribsPrefix"])),r=i}else if(xe(e)){var n=t?$(e.children):[],l=new Oe(n);n.forEach(function(o){return o.parent=l}),r=l}else if(De(e)){var n=t?$(e.children):[],f=new we(n);n.forEach(function(o){return o.parent=f}),e["x-mode"]&&(f["x-mode"]=e["x-mode"]),r=f}else if(Me(e)){var s=new Se(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),r=s}else throw new Error("Not implemented yet: ".concat(e.type));return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}h.cloneNode=re;function $(e){for(var t=e.map(function(n){return re(n,!0)}),r=1;r<t.length;r++)t[r].prev=t[r-1],t[r-1].next=t[r];return t}(function(e){var t=v&&v.__createBinding||(Object.create?function(s,a,o,c){c===void 0&&(c=o);var d=Object.getOwnPropertyDescriptor(a,o);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(s,c,d)}:function(s,a,o,c){c===void 0&&(c=o),s[c]=a[o]}),r=v&&v.__exportStar||function(s,a){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var n=ee,i=h;r(h,e);var l={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},f=function(){function s(a,o,c){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof o=="function"&&(c=o,o=l),typeof a=="object"&&(o=a,a=void 0),this.callback=a??null,this.options=o??l,this.elementCB=c??null}return s.prototype.onparserinit=function(a){this.parser=a},s.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},s.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},s.prototype.onerror=function(a){this.handleCallback(a)},s.prototype.onclosetag=function(){this.lastNode=null;var a=this.tagStack.pop();this.options.withEndIndices&&(a.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(a)},s.prototype.onopentag=function(a,o){var c=this.options.xmlMode?n.ElementType.Tag:void 0,d=new i.Element(a,o,void 0,c);this.addNode(d),this.tagStack.push(d)},s.prototype.ontext=function(a){var o=this.lastNode;if(o&&o.type===n.ElementType.Text)o.data+=a,this.options.withEndIndices&&(o.endIndex=this.parser.endIndex);else{var c=new i.Text(a);this.addNode(c),this.lastNode=c}},s.prototype.oncomment=function(a){if(this.lastNode&&this.lastNode.type===n.ElementType.Comment){this.lastNode.data+=a;return}var o=new i.Comment(a);this.addNode(o),this.lastNode=o},s.prototype.oncommentend=function(){this.lastNode=null},s.prototype.oncdatastart=function(){var a=new i.Text(""),o=new i.CDATA([a]);this.addNode(o),a.parent=o,this.lastNode=a},s.prototype.oncdataend=function(){this.lastNode=null},s.prototype.onprocessinginstruction=function(a,o){var c=new i.ProcessingInstruction(a,o);this.addNode(c)},s.prototype.handleCallback=function(a){if(typeof this.callback=="function")this.callback(a,this.dom);else if(a)throw a},s.prototype.addNode=function(a){var o=this.tagStack[this.tagStack.length-1],c=o.children[o.children.length-1];this.options.withStartIndices&&(a.startIndex=this.parser.startIndex),this.options.withEndIndices&&(a.endIndex=this.parser.endIndex),o.children.push(a),c&&(a.prev=c,c.next=a),a.parent=o,this.lastNode=null},s}();e.DomHandler=f,e.default=f})(Q);var Le={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=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(t,r){return t[r.toLowerCase()]=r,t},{}),e.CARRIAGE_RETURN="\r",e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,"g"),e.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,"g")})(Le);Object.defineProperty(S,"__esModule",{value:!0});S.formatAttributes=je;S.escapeSpecialCharacters=We;S.revertEscapedCharacters=He;S.formatDOM=Ge;var I=Q,x=Le;function $e(e){return x.CASE_SENSITIVE_TAG_NAMES_MAP[e]}function je(e){for(var t={},r=0,n=e.length;r<n;r++){var i=e[r];t[i.name]=i.value}return t}function qe(e){e=e.toLowerCase();var t=$e(e);return t||e}function We(e){return e.replace(x.CARRIAGE_RETURN_REGEX,x.CARRIAGE_RETURN_PLACEHOLDER)}function He(e){return e.replace(x.CARRIAGE_RETURN_PLACEHOLDER_REGEX,x.CARRIAGE_RETURN)}function Ge(e,t,r){t===void 0&&(t=null);for(var n=[],i,l=0,f=e.length;l<f;l++){var s=e[l];switch(s.nodeType){case 1:{var a=qe(s.nodeName);i=new I.Element(a,je(s.attributes)),i.children=Ge(a==="template"?s.content.childNodes:s.childNodes,i);break}case 3:i=new I.Text(He(s.nodeValue));break;case 8:i=new I.Comment(s.nodeValue);break;default:continue}var o=n[l-1]||null;o&&(o.next=i),i.parent=t,i.prev=o,i.next=null,n.push(i)}return r&&(i=new I.ProcessingInstruction(r.substring(0,r.indexOf(" ")).toLowerCase(),r),i.next=n[0]||null,i.parent=t,n.unshift(i),n[1]&&(n[1].prev=n[0])),n}Object.defineProperty(K,"__esModule",{value:!0});K.default=Qe;var Ye=S,ce="html",ue="head",N="body",Ze=/<([a-zA-Z]+[0-9]?)/,fe=/<head[^]*>/i,de=/<body[^]*>/i,H=function(e,t){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},W=function(e,t){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},pe=typeof window=="object"&&window.DOMParser;if(typeof pe=="function"){var Je=new pe,Ke="text/html";W=function(e,t){return t&&(e="<".concat(t,">").concat(e,"</").concat(t,">")),Je.parseFromString(e,Ke)},H=W}if(typeof document=="object"&&document.implementation){var M=document.implementation.createHTMLDocument();H=function(e,t){if(t){var r=M.documentElement.querySelector(t);return r&&(r.innerHTML=e),M}return M.documentElement.innerHTML=e,M}}var D=typeof document=="object"&&document.createElement("template"),Y;D&&D.content&&(Y=function(e){return D.innerHTML=e,D.content.childNodes});function Qe(e){var t,r;e=(0,Ye.escapeSpecialCharacters)(e);var n=e.match(Ze),i=n&&n[1]?n[1].toLowerCase():"";switch(i){case ce:{var l=W(e);if(!fe.test(e)){var f=l.querySelector(ue);(t=f==null?void 0:f.parentNode)===null||t===void 0||t.removeChild(f)}if(!de.test(e)){var f=l.querySelector(N);(r=f==null?void 0:f.parentNode)===null||r===void 0||r.removeChild(f)}return l.querySelectorAll(ce)}case ue:case N:{var s=H(e).querySelectorAll(i);return de.test(e)&&fe.test(e)?s[0].parentNode.childNodes:s}default:{if(Y)return Y(e);var f=H(e,N).querySelector(N);return f.childNodes}}}var et=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(J,"__esModule",{value:!0});J.default=it;var tt=et(K),rt=S,nt=/<(![a-zA-Z\s]+)>/;function it(e){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];var t=e.match(nt),r=t?t[1]:void 0;return(0,rt.formatDOM)((0,tt.default)(e),null,r)}var V={},T={},U={},at=0;U.SAME=at;var ot=1;U.CAMELCASE=ot;U.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};const Fe=0,A=1,B=2,z=3,ne=4,Ve=5,Ue=6;function lt(e){return y.hasOwnProperty(e)?y[e]:null}function E(e,t,r,n,i,l,f){this.acceptsBooleans=t===B||t===z||t===ne,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=l,this.removeEmptyString=f}const y={},st=["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"];st.forEach(e=>{y[e]=new E(e,Fe,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([e,t])=>{y[e]=new E(e,A,!1,t,null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(e=>{y[e]=new E(e,B,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(e=>{y[e]=new E(e,B,!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(e=>{y[e]=new E(e,z,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(e=>{y[e]=new E(e,z,!0,e,null,!1,!1)});["capture","download"].forEach(e=>{y[e]=new E(e,ne,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(e=>{y[e]=new E(e,Ue,!1,e,null,!1,!1)});["rowSpan","start"].forEach(e=>{y[e]=new E(e,Ve,!1,e.toLowerCase(),null,!1,!1)});const ie=/[\-\:]([a-z])/g,ae=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(e=>{const t=e.replace(ie,ae);y[t]=new E(t,A,!1,e,null,!1,!1)});["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(e=>{const t=e.replace(ie,ae);y[t]=new E(t,A,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(e=>{const t=e.replace(ie,ae);y[t]=new E(t,A,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(e=>{y[e]=new E(e,A,!1,e.toLowerCase(),null,!1,!1)});const ct="xlinkHref";y[ct]=new E("xlinkHref",A,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(e=>{y[e]=new E(e,A,!1,e.toLowerCase(),null,!0,!0)});const{CAMELCASE:ut,SAME:ft,possibleStandardNames:he}=U,dt=":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",pt=dt+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",ht=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+pt+"]*$")),mt=Object.keys(he).reduce((e,t)=>{const r=he[t];return r===ft?e[t]=t:r===ut?e[t.toLowerCase()]=t:e[t]=r,e},{});T.BOOLEAN=z;T.BOOLEANISH_STRING=B;T.NUMERIC=Ve;T.OVERLOADED_BOOLEAN=ne;T.POSITIVE_NUMERIC=Ue;T.RESERVED=Fe;T.STRING=A;T.getPropertyInfo=lt;T.isCustomAttribute=ht;T.possibleStandardNames=mt;var oe={},le={},me=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,gt=/\n/g,vt=/^\s*/,yt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Et=/^:\s*/,_t=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Tt=/^[;\s]*/,bt=/^\s+|\s+$/g,Rt=` `,ge="/",ve="*",C="",At="comment",Ct="declaration";function St(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var r=1,n=1;function i(p){var u=p.match(gt);u&&(r+=u.length);var m=p.lastIndexOf(Rt);n=~m?p.length-m:n+p.length}function l(){var p={line:r,column:n};return function(u){return u.position=new f(p),o(),u}}function f(p){this.start=p,this.end={line:r,column:n},this.source=t.source}f.prototype.content=e;function s(p){var u=new Error(t.source+":"+r+":"+n+": "+p);if(u.reason=p,u.filename=t.source,u.line=r,u.column=n,u.source=e,!t.silent)throw u}function a(p){var u=p.exec(e);if(u){var m=u[0];return i(m),e=e.slice(m.length),u}}function o(){a(vt)}function c(p){var u;for(p=p||[];u=d();)u!==!1&&p.push(u);return p}function d(){var p=l();if(!(ge!=e.charAt(0)||ve!=e.charAt(1))){for(var u=2;C!=e.charAt(u)&&(ve!=e.charAt(u)||ge!=e.charAt(u+1));)++u;if(u+=2,C===e.charAt(u-1))return s("End of comment missing");var m=e.slice(2,u-2);return n+=2,i(m),e=e.slice(u),n+=2,p({type:At,comment:m})}}function g(){var p=l(),u=a(yt);if(u){if(d(),!a(Et))return s("property missing ':'");var m=a(_t),O=p({type:Ct,property:ye(u[0].replace(me,C)),value:m?ye(m[0].replace(me,C)):C});return a(Tt),O}}function b(){var p=[];c(p);for(var u;u=g();)u!==!1&&(p.push(u),c(p));return p}return o(),b()}function ye(e){return e?e.replace(bt,C):C}var Ot=St,wt=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(le,"__esModule",{value:!0});le.default=Pt;const kt=wt(Ot);function Pt(e,t){let r=null;if(!e||typeof e!="string")return r;const n=(0,kt.default)(e),i=typeof t=="function";return n.forEach(l=>{if(l.type!=="declaration")return;const{property:f,value:s}=l;i?t(f,s,l):s&&(r=r||{},r[f]=s)}),r}var X={};Object.defineProperty(X,"__esModule",{value:!0});X.camelCase=void 0;var xt=/^--[a-zA-Z0-9_-]+$/,It=/-([a-z])/g,Nt=/^[^-]+$/,Mt=/^-(webkit|moz|ms|o|khtml)-/,Dt=/^-(ms)-/,Lt=function(e){return!e||Nt.test(e)||xt.test(e)},jt=function(e,t){return t.toUpperCase()},Ee=function(e,t){return"".concat(t,"-")},Ht=function(e,t){return t===void 0&&(t={}),Lt(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Dt,Ee):e=e.replace(Mt,Ee),e.replace(It,jt))};X.camelCase=Ht;var Gt=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Ft=Gt(le),Vt=X;function Z(e,t){var r={};return!e||typeof e!="string"||(0,Ft.default)(e,function(n,i){n&&i&&(r[(0,Vt.camelCase)(n,t)]=i)}),r}Z.default=Z;var Ut=Z;(function(e){var t=v&&v.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=l,e.setStyleProp=s;var r=j,n=t(Ut),i=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function l(c,d){return c.includes("-")?!i.has(c):!!(d&&typeof d.is=="string")}var f={reactCompat:!0};function s(c,d){if(typeof c=="string"){if(!c.trim()){d.style={};return}try{d.style=(0,n.default)(c,f)}catch{d.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(r.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var a=function(c){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(c.name)};e.canTextBeChildOfNode=a;var o=function(c){return c};e.returnFirstArg=o})(oe);Object.defineProperty(V,"__esModule",{value:!0});V.default=$t;var w=T,_e=oe,Bt=["checked","value"],zt=["input","select","textarea"],Xt={reset:!0,submit:!0};function $t(e,t){e===void 0&&(e={});var r={},n=!!(e.type&&Xt[e.type]);for(var i in e){var l=e[i];if((0,w.isCustomAttribute)(i)){r[i]=l;continue}var f=i.toLowerCase(),s=Te(f);if(s){var a=(0,w.getPropertyInfo)(s);switch(Bt.includes(s)&&zt.includes(t)&&!n&&(s=Te("default"+f)),r[s]=l,a&&a.type){case w.BOOLEAN:r[s]=!0;break;case w.OVERLOADED_BOOLEAN:l===""&&(r[s]=!0);break}continue}_e.PRESERVE_CUSTOM_ATTRIBUTES&&(r[i]=l)}return(0,_e.setStyleProp)(e.style,r),r}function Te(e){return w.possibleStandardNames[e]}var se={},qt=v&&v.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(se,"__esModule",{value:!0});se.default=Be;var q=j,Wt=qt(V),P=oe,Yt={cloneElement:q.cloneElement,createElement:q.createElement,isValidElement:q.isValidElement};function Be(e,t){t===void 0&&(t={});for(var r=[],n=typeof t.replace=="function",i=t.transform||P.returnFirstArg,l=t.library||Yt,f=l.cloneElement,s=l.createElement,a=l.isValidElement,o=e.length,c=0;c<o;c++){var d=e[c];if(n){var g=t.replace(d,c);if(a(g)){o>1&&(g=f(g,{key:g.key||c})),r.push(i(g,d,c));continue}}if(d.type==="text"){var b=!d.data.trim().length;if(b&&d.parent&&!(0,P.canTextBeChildOfNode)(d.parent)||t.trim&&b)continue;r.push(i(d.data,d,c));continue}var p=d,u={};Zt(p)?((0,P.setStyleProp)(p.attribs.style,p.attribs),u=p.attribs):p.attribs&&(u=(0,Wt.default)(p.attribs,p.name));var m=void 0;switch(d.type){case"script":case"style":d.children[0]&&(u.dangerouslySetInnerHTML={__html:d.children[0].data});break;case"tag":d.name==="textarea"&&d.children[0]?u.defaultValue=d.children[0].data:d.children&&d.children.length&&(m=Be(d.children,t));break;default:continue}o>1&&(u.key=c),r.push(i(s(d.name,u,m),d,c))}return r.length===1?r[0]:r}function Zt(e){return P.PRESERVE_CUSTOM_ATTRIBUTES&&e.type==="tag"&&(0,P.isCustomComponent)(e.name,e.attribs)}(function(e){var t=v&&v.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=s;var r=t(J);e.htmlToDOM=r.default;var n=t(V);e.attributesToProps=n.default;var i=t(se);e.domToReact=i.default;var l=Q;Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return l.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return l.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return l.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return l.Text}});var f={lowerCaseAttributeNames:!1};function s(a,o){if(typeof a!="string")throw new TypeError("First argument must be a string");return a?(0,i.default)((0,r.default)(a,(o==null?void 0:o.htmlparser2)||f),o):[]}})(Re);const be=ze(Re),Jt=be.default||be,Kt=e=>{if(e=e.trim(),e==="none"||e==="transparent")return 0;if(e.startsWith("#"))return e.length===9?parseInt(e.slice(7),16)/255:e.length===5?parseInt(e.slice(4),16)/15:1;if(e.startsWith("rgba")){const t=e.match(/rgba\(.*,\s*([\d.]+)\)/);return t?parseFloat(t[1]):1}return 1},Qt=e=>`color-mix(in srgb, currentColor ${Math.round(e*1e4)/100}%, transparent)`,er=e=>{e.querySelectorAll("style").forEach(r=>{const n=r.textContent||"",i=/([^{}]+)\{([^{}]+)\}/g;let l;for(;(l=i.exec(n))!==null;){const f=l[1].trim(),s=l[2].trim();try{e.querySelectorAll(f).forEach(o=>{const c=o;s.split(";").forEach(g=>{const[b,p]=g.split(":").map(u=>u.trim());b&&p&&c.style.setProperty(b,p)})})}catch(a){console.warn("Invalid selector or error applying style:",f,a)}}r.remove()})},tr=(e,t)=>{const r=e;e.hasAttribute("class")&&e.removeAttribute("class");const n=e.getAttribute("opacity"),i=n?parseFloat(n):1,l=c=>{if(!c)return null;const g=Kt(c)*i;return Qt(g)};n&&e.removeAttribute("opacity");const f=e.hasAttribute("fill"),s=e.hasAttribute("stroke"),a=r.style&&r.style.getPropertyValue("fill"),o=r.style&&r.style.getPropertyValue("stroke");["fill","stroke"].forEach(c=>{const d=e.getAttribute(c);if(d){const g=l(d);g&&e.setAttribute(c,g)}}),r.style&&["fill","stroke"].forEach(c=>{const d=r.style.getPropertyValue(c);if(d){const g=l(d);g&&r.style.setProperty(c,g)}}),rr(e,r,t,f,s,a,o)},rr=(e,t,r,n,i,l,f)=>{r==="fill"?(!n&&!l&&e.setAttribute("fill","color-mix(in srgb, currentColor 100%, transparent)"),e.setAttribute("stroke","none"),t.style&&t.style.removeProperty("stroke")):r==="stroke"?(!i&&!f&&e.setAttribute("stroke","color-mix(in srgb, currentColor 100%, transparent)"),e.setAttribute("fill","none"),t.style&&t.style.removeProperty("fill")):r==="both"?(!n&&!l&&e.setAttribute("fill","color-mix(in srgb, currentColor 100%, transparent)"),!i&&!f&&e.setAttribute("stroke","color-mix(in srgb, currentColor 100%, transparent)")):((n||l)&&!i&&!f&&e.setAttribute("stroke","none"),(i||f)&&!n&&!l&&e.setAttribute("fill","none"))},nr=e=>{const t=e.documentElement;t.removeAttribute("fill"),t.removeAttribute("stroke")},ir=(e,t)=>{const r=e.match(/width="(\d+(\.\d+)?(px|em|rem|%)?)"/),n=e.match(/height="(\d+(\.\d+)?(px|em|rem|%)?)"/);let i=1;if(r&&n){const l=parseFloat(r[1]);i=parseFloat(n[1])/l}else r||(e=e.replace("<svg",'<svg width="1em"')),n||(e=e.replace("<svg",'<svg height="1em"'));return e=e.replace(/height="[^"]*"/,`height="${t*1.5*i}em"`),e=e.replace(/width="[^"]*"/,`width="${t*1.5}em"`),e},ar=({IconName:e="",className:t="",Scale:r=1,FontWeight:n="default",LoadingElement:i="",NotFoundElement:l="",...f})=>{const[s,a]=j.useState(null),{version:o,clearForOldVersion:c,FetchIcon:d}=L.useSvgifyContext();return j.useEffect(()=>{const g=`svgify_${o}_${e}_${n}`,b=()=>{if((Number(localStorage.getItem("svgify_cached_version"))||-1)!==o){localStorage.setItem("svgify_cached_version",JSON.stringify(o));for(const m of Object.keys(localStorage))m.startsWith("svgify_")&&!m.includes(`${o}`)&&m!=="svgify_cached_version"&&localStorage.removeItem(m);c&&localStorage.removeItem(`svgify_${e}`)}},p=async()=>{try{let u=localStorage.getItem(g)||"";if(!u&&d){const m=await d(e);if(m!=null&&m.data){if(u=""+m.data,u.match(/<html/g))throw new Error("Invalid SVG format");u=or(u,n);try{localStorage.setItem(g,JSON.stringify(u))}catch(O){if(O instanceof DOMException&&O.code===22)console.warn("Storage quota exceeded, clearing storage..."),localStorage.clear();else throw O}}}else u=JSON.parse(u);u=ir(u,r),a(u)}catch(u){a("SVGIFY_ERROR"),console.error("Error fetching SVG:",u)}};b(),p()},[e,r,n,o,c,d]),L.jsxRuntimeExports.jsx("span",{className:`svg-font-icon svg_modifier_style ${t||""}`,...f,children:s?s==="SVGIFY_ERROR"?l:Jt(s):i})},or=(e,t)=>{const n=new DOMParser().parseFromString(e,"image/svg+xml");return er(n),n.querySelectorAll("*").forEach(l=>{tr(l,t)}),nr(n),n.documentElement.outerHTML};exports.Svgifier=L.Svgifier;exports.useSvgifyContext=L.useSvgifyContext;exports.default=ar; //# sourceMappingURL=index.cjs.map