tia-gpc-widget 1.1.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/loader.js +12 -13
- package/dist/loader.min.js +2 -2
- package/dist/loader.min.js.map +1 -1
- package/dist/tia-gpc-widget.standalone.css +1 -1
- package/dist/tia-gpc-widget.standalone.js +27 -27
- package/dist/tia-gpc-widget.standalone.js.map +1 -1
- package/dist/tia-gpc.cjs.js +27 -27
- package/dist/tia-gpc.cjs.js.map +1 -1
- package/dist/tia-gpc.css +1 -1
- package/dist/tia-gpc.es.js +5418 -4676
- package/dist/tia-gpc.es.js.map +1 -1
- package/dist/version.json +14 -14
- package/package.json +1 -1
package/dist/tia-gpc.cjs.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),O=require("react"),oe=require("react-i18next"),me=require("lucide-react"),Ft=require("react-hot-toast"),Pi=require("@marsidev/react-turnstile"),Di=require("axios"),at=require("i18next"),Li=require("i18next-browser-languagedetector"),_i=({onClick:e,unreadCount:n=0,widgetConfig:t})=>{const{t:r}=oe.useTranslation(),i=t?.company_name||r("widget.title");return T.jsxs("button",{onClick:e,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[T.jsxs("div",{className:"gpc-floating-content",children:[T.jsx(me.MessageCircle,{className:"gpc-floating-icon"}),T.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",i]})]}),n>0&&T.jsx("span",{className:"gpc-notification-badge",children:n>9?"9+":n})]})},Ri=({theme:e,onToggle:n})=>{const{t}=oe.useTranslation();return T.jsx("button",{onClick:n,className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":t("theme.toggle"),title:t("theme.toggle"),children:e==="light"?T.jsx(me.Moon,{className:"gpc-icon"}):T.jsx(me.Sun,{className:"gpc-icon"})})},kt=[{code:"en",label:"English",flag:"🇬🇧"},{code:"es",label:"Español",flag:"🇪🇸"},{code:"fr",label:"Français",flag:"🇫🇷"}],zi=()=>{const{i18n:e}=oe.useTranslation(),[n,t]=O.useState(!1),r=O.useRef(null),i=kt.find(l=>l.code===e.language)||kt[0],o=l=>{e.changeLanguage(l),t(!1)};return O.useEffect(()=>{const l=a=>{r.current&&!r.current.contains(a.target)&&t(!1)};return n&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[n]),T.jsxs("div",{className:"gpc-language-selector",ref:r,children:[T.jsx("button",{onClick:()=>t(!n),className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":"Cambiar idioma",title:"Cambiar idioma",children:T.jsx(me.Globe,{className:"gpc-icon"})}),n&&T.jsx("div",{className:"gpc-language-dropdown",children:kt.map(l=>T.jsxs("button",{onClick:()=>o(l.code),className:`gpc-language-option ${l.code===i.code?"gpc-language-option-active":""}`,children:[T.jsx("span",{className:"gpc-language-flag",children:l.flag}),T.jsx("span",{className:"gpc-language-label",children:l.label})]},l.code))})]})},Ni=({onClose:e,theme:n,onToggleTheme:t,showBranding:r=!0,widgetConfig:i=null})=>{const{t:o}=oe.useTranslation(),l=i?.company_name||o("widget.title"),a=i?.company_logo_base64,s=a?.startsWith("data:")?a:a?`data:image/png;base64,${a}`:null;return T.jsxs("div",{className:"gpc-chat-header",children:[T.jsxs("div",{className:"gpc-header-content",children:[s&&T.jsx("div",{className:"gpc-header-logo",children:T.jsx("img",{src:s,alt:l,className:"gpc-company-logo"})}),T.jsx("div",{className:"gpc-header-text",children:T.jsx("h2",{className:"gpc-header-title",children:l})})]}),T.jsxs("div",{className:"gpc-header-actions",children:[T.jsx(zi,{}),T.jsx(Ri,{theme:n,onToggle:t}),T.jsx("button",{onClick:e,className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":o("chat.close"),title:o("chat.close"),children:T.jsx(me.ChevronDown,{className:"gpc-icon"})})]})]})};function Oi(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Fi=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Mi=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ji={};function bn(e,n){return(ji.jsx?Mi:Fi).test(e)}const Bi=/[ \t\n\f\r]/g;function Ui(e){return typeof e=="object"?e.type==="text"?wn(e.value):!1:wn(e)}function wn(e){return e.replace(Bi,"")===""}class Je{constructor(n,t,r){this.normal=t,this.property=n,r&&(this.space=r)}}Je.prototype.normal={};Je.prototype.property={};Je.prototype.space=void 0;function cr(e,n){const t={},r={};for(const i of e)Object.assign(t,i.property),Object.assign(r,i.normal);return new Je(t,r,n)}function Mt(e){return e.toLowerCase()}class ne{constructor(n,t){this.attribute=t,this.property=n}}ne.prototype.attribute="";ne.prototype.booleanish=!1;ne.prototype.boolean=!1;ne.prototype.commaOrSpaceSeparated=!1;ne.prototype.commaSeparated=!1;ne.prototype.defined=!1;ne.prototype.mustUseProperty=!1;ne.prototype.number=!1;ne.prototype.overloadedBoolean=!1;ne.prototype.property="";ne.prototype.spaceSeparated=!1;ne.prototype.space=void 0;let Hi=0;const B=Pe(),K=Pe(),jt=Pe(),v=Pe(),W=Pe(),Oe=Pe(),ie=Pe();function Pe(){return 2**++Hi}const Bt=Object.freeze(Object.defineProperty({__proto__:null,boolean:B,booleanish:K,commaOrSpaceSeparated:ie,commaSeparated:Oe,number:v,overloadedBoolean:jt,spaceSeparated:W},Symbol.toStringTag,{value:"Module"})),xt=Object.keys(Bt);class Yt extends ne{constructor(n,t,r,i){let o=-1;if(super(n,t),Sn(this,"space",i),typeof r=="number")for(;++o<xt.length;){const l=xt[o];Sn(this,xt[o],(r&Bt[l])===Bt[l])}}}Yt.prototype.defined=!0;function Sn(e,n,t){t&&(e[n]=t)}function Me(e){const n={},t={};for(const[r,i]of Object.entries(e.properties)){const o=new Yt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),n[r]=o,t[Mt(r)]=r,t[Mt(o.attribute)]=r}return new Je(n,t,e.space)}const fr=Me({properties:{ariaActiveDescendant:null,ariaAtomic:K,ariaAutoComplete:null,ariaBusy:K,ariaChecked:K,ariaColCount:v,ariaColIndex:v,ariaColSpan:v,ariaControls:W,ariaCurrent:null,ariaDescribedBy:W,ariaDetails:null,ariaDisabled:K,ariaDropEffect:W,ariaErrorMessage:null,ariaExpanded:K,ariaFlowTo:W,ariaGrabbed:K,ariaHasPopup:null,ariaHidden:K,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:W,ariaLevel:v,ariaLive:null,ariaModal:K,ariaMultiLine:K,ariaMultiSelectable:K,ariaOrientation:null,ariaOwns:W,ariaPlaceholder:null,ariaPosInSet:v,ariaPressed:K,ariaReadOnly:K,ariaRelevant:null,ariaRequired:K,ariaRoleDescription:W,ariaRowCount:v,ariaRowIndex:v,ariaRowSpan:v,ariaSelected:K,ariaSetSize:v,ariaSort:null,ariaValueMax:v,ariaValueMin:v,ariaValueNow:v,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function hr(e,n){return n in e?e[n]:n}function pr(e,n){return hr(e,n.toLowerCase())}const qi=Me({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oe,acceptCharset:W,accessKey:W,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:W,autoFocus:B,autoPlay:B,blocking:W,capture:null,charSet:null,checked:B,cite:null,className:W,cols:v,colSpan:null,content:null,contentEditable:K,controls:B,controlsList:W,coords:v|Oe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:jt,draggable:K,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:W,height:v,hidden:jt,high:v,href:null,hrefLang:null,htmlFor:W,httpEquiv:W,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:W,itemRef:W,itemScope:B,itemType:W,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:v,manifest:null,max:null,maxLength:v,media:null,method:null,min:null,minLength:v,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:B,optimum:v,pattern:null,ping:W,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:W,required:B,reversed:B,rows:v,rowSpan:v,sandbox:W,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shape:null,size:v,sizes:null,slot:null,span:v,spellCheck:K,src:null,srcDoc:null,srcLang:null,srcSet:null,start:v,step:null,style:null,tabIndex:v,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:K,width:v,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:W,axis:null,background:null,bgColor:null,border:v,borderColor:null,bottomMargin:v,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:v,leftMargin:v,link:null,longDesc:null,lowSrc:null,marginHeight:v,marginWidth:v,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:v,rules:null,scheme:null,scrolling:K,standby:null,summary:null,text:null,topMargin:v,valueType:null,version:null,vAlign:null,vLink:null,vSpace:v,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:B,disableRemotePlayback:B,prefix:null,property:null,results:v,security:null,unselectable:null},space:"html",transform:pr}),Vi=Me({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ie,accentHeight:v,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:v,amplitude:v,arabicForm:null,ascent:v,attributeName:null,attributeType:null,azimuth:v,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:v,by:null,calcMode:null,capHeight:v,className:W,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:v,diffuseConstant:v,direction:null,display:null,dur:null,divisor:v,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:v,enableBackground:null,end:null,event:null,exponent:v,externalResourcesRequired:null,fill:null,fillOpacity:v,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oe,g2:Oe,glyphName:Oe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:v,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:v,horizOriginX:v,horizOriginY:v,id:null,ideographic:v,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:v,k:v,k1:v,k2:v,k3:v,k4:v,kernelMatrix:ie,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:v,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:v,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:v,overlineThickness:v,paintOrder:null,panose1:null,path:null,pathLength:v,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:W,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:v,pointsAtY:v,pointsAtZ:v,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ie,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ie,rev:ie,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ie,requiredFeatures:ie,requiredFonts:ie,requiredFormats:ie,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:v,specularExponent:v,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:v,strikethroughThickness:v,string:null,stroke:null,strokeDashArray:ie,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:v,strokeOpacity:v,strokeWidth:null,style:null,surfaceScale:v,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ie,tabIndex:v,tableValues:null,target:null,targetX:v,targetY:v,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ie,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:v,underlineThickness:v,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:v,values:null,vAlphabetic:v,vMathematical:v,vectorEffect:null,vHanging:v,vIdeographic:v,version:null,vertAdvY:v,vertOriginX:v,vertOriginY:v,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:v,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hr}),mr=Me({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),dr=Me({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:pr}),gr=Me({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),$i={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Gi=/[A-Z]/g,Cn=/-[a-z]/g,Wi=/^data[-\w.:]+$/i;function Ki(e,n){const t=Mt(n);let r=n,i=ne;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&Wi.test(n)){if(n.charAt(4)==="-"){const o=n.slice(5).replace(Cn,Xi);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=n.slice(4);if(!Cn.test(o)){let l=o.replace(Gi,Yi);l.charAt(0)!=="-"&&(l="-"+l),n="data"+l}}i=Yt}return new i(r,n)}function Yi(e){return"-"+e.toLowerCase()}function Xi(e){return e.charAt(1).toUpperCase()}const Qi=cr([fr,qi,mr,dr,gr],"html"),Xt=cr([fr,Vi,mr,dr,gr],"svg");function Ji(e){return e.join(" ").trim()}function yr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Re={},bt,En;function Zi(){if(En)return bt;En=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,a=/^\s+|\s+$/g,s=`
|
|
2
|
-
`,u="/",f="*",c="",p="comment",h="declaration";bt=function(x,E){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];E=E||{};var y=1,C=1;function k(L){var R=L.match(n);R&&(y+=R.length);var F=L.lastIndexOf(s);C=~F?L.length-F:C+L.length}function D(){var L={line:y,column:C};return function(R){return R.position=new z(L),U(),R}}function z(L){this.start=L,this.end={line:y,column:C},this.source=E.source}z.prototype.content=x;function w(L){var R=new Error(E.source+":"+y+":"+C+": "+L);if(R.reason=L,R.filename=E.source,R.line=y,R.column=C,R.source=x,!E.silent)throw R}function _(L){var R=L.exec(x);if(R){var F=R[0];return k(F),x=x.slice(F.length),R}}function U(){_(t)}function j(L){var R;for(L=L||[];R=b();)R!==!1&&L.push(R);return L}function b(){var L=D();if(!(u!=x.charAt(0)||f!=x.charAt(1))){for(var R=2;c!=x.charAt(R)&&(f!=x.charAt(R)||u!=x.charAt(R+1));)++R;if(R+=2,c===x.charAt(R-1))return w("End of comment missing");var F=x.slice(2,R-2);return C+=2,k(F),x=x.slice(R),C+=2,L({type:p,comment:F})}}function P(){var L=D(),R=_(r);if(R){if(b(),!_(i))return w("property missing ':'");var F=_(o),Y=L({type:h,property:g(R[0].replace(e,c)),value:F?g(F[0].replace(e,c)):c});return _(l),Y}}function A(){var L=[];j(L);for(var R;R=P();)R!==!1&&(L.push(R),j(L));return L}return U(),A()};function g(x){return x?x.replace(a,c):c}return bt}var Tn;function el(){if(Tn)return Re;Tn=1;var e=Re&&Re.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Re,"__esModule",{value:!0}),Re.default=t;const n=e(Zi());function t(r,i){let o=null;if(!r||typeof r!="string")return o;const l=(0,n.default)(r),a=typeof i=="function";return l.forEach(s=>{if(s.type!=="declaration")return;const{property:u,value:f}=s;a?i(u,f,s):f&&(o=o||{},o[u]=f)}),o}return Re}var qe={},vn;function tl(){if(vn)return qe;vn=1,Object.defineProperty(qe,"__esModule",{value:!0}),qe.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,t=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(u){return!u||t.test(u)||e.test(u)},l=function(u,f){return f.toUpperCase()},a=function(u,f){return"".concat(f,"-")},s=function(u,f){return f===void 0&&(f={}),o(u)?u:(u=u.toLowerCase(),f.reactCompat?u=u.replace(i,a):u=u.replace(r,a),u.replace(n,l))};return qe.camelCase=s,qe}var Ve,In;function nl(){if(In)return Ve;In=1;var e=Ve&&Ve.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},n=e(el()),t=tl();function r(i,o){var l={};return!i||typeof i!="string"||(0,n.default)(i,function(a,s){a&&s&&(l[(0,t.camelCase)(a,o)]=s)}),l}return r.default=r,Ve=r,Ve}var rl=nl();const il=yr(rl),kr=xr("end"),Qt=xr("start");function xr(e){return n;function n(t){const r=t&&t.position&&t.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ll(e){const n=Qt(e),t=kr(e);if(n&&t)return{start:n,end:t}}function We(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?An(e.position):"start"in e||"end"in e?An(e):"line"in e||"column"in e?Ut(e):""}function Ut(e){return Pn(e&&e.line)+":"+Pn(e&&e.column)}function An(e){return Ut(e&&e.start)+"-"+Ut(e&&e.end)}function Pn(e){return e&&typeof e=="number"?e:1}class Z extends Error{constructor(n,t,r){super(),typeof t=="string"&&(r=t,t=void 0);let i="",o={},l=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof n=="string"?i=n:!o.cause&&n&&(l=!0,i=n.message,o.cause=n),!o.ruleId&&!o.source&&typeof r=="string"){const s=r.indexOf(":");s===-1?o.ruleId=r:(o.source=r.slice(0,s),o.ruleId=r.slice(s+1))}if(!o.place&&o.ancestors&&o.ancestors){const s=o.ancestors[o.ancestors.length-1];s&&(o.place=s.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=We(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Z.prototype.file="";Z.prototype.name="";Z.prototype.reason="";Z.prototype.message="";Z.prototype.stack="";Z.prototype.column=void 0;Z.prototype.line=void 0;Z.prototype.ancestors=void 0;Z.prototype.cause=void 0;Z.prototype.fatal=void 0;Z.prototype.place=void 0;Z.prototype.ruleId=void 0;Z.prototype.source=void 0;const Jt={}.hasOwnProperty,ol=new Map,al=/[A-Z]/g,sl=new Set(["table","tbody","thead","tfoot","tr"]),ul=new Set(["td","th"]),br="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cl(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=kl(t,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=yl(t,n.jsx,n.jsxs)}const i={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?Xt:Qi,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},o=wr(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function wr(e,n,t){if(n.type==="element")return fl(e,n,t);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return hl(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return ml(e,n,t);if(n.type==="mdxjsEsm")return pl(e,n);if(n.type==="root")return dl(e,n,t);if(n.type==="text")return gl(e,n)}function fl(e,n,t){const r=e.schema;let i=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Xt,e.schema=i),e.ancestors.push(n);const o=Cr(e,n.tagName,!1),l=xl(e,n);let a=en(e,n);return sl.has(n.tagName)&&(a=a.filter(function(s){return typeof s=="string"?!Ui(s):!0})),Sr(e,l,o,n),Zt(l,a),e.ancestors.pop(),e.schema=r,e.create(n,o,l,t)}function hl(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Xe(e,n.position)}function pl(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Xe(e,n.position)}function ml(e,n,t){const r=e.schema;let i=r;n.name==="svg"&&r.space==="html"&&(i=Xt,e.schema=i),e.ancestors.push(n);const o=n.name===null?e.Fragment:Cr(e,n.name,!0),l=bl(e,n),a=en(e,n);return Sr(e,l,o,n),Zt(l,a),e.ancestors.pop(),e.schema=r,e.create(n,o,l,t)}function dl(e,n,t){const r={};return Zt(r,en(e,n)),e.create(n,e.Fragment,r,t)}function gl(e,n){return n.value}function Sr(e,n,t,r){typeof t!="string"&&t!==e.Fragment&&e.passNode&&(n.node=r)}function Zt(e,n){if(n.length>0){const t=n.length>1?n:n[0];t&&(e.children=t)}}function yl(e,n,t){return r;function r(i,o,l,a){const u=Array.isArray(l.children)?t:n;return a?u(o,l,a):u(o,l)}}function kl(e,n){return t;function t(r,i,o,l){const a=Array.isArray(o.children),s=Qt(r);return n(i,o,l,a,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function xl(e,n){const t={};let r,i;for(i in n.properties)if(i!=="children"&&Jt.call(n.properties,i)){const o=wl(e,i,n.properties[i]);if(o){const[l,a]=o;e.tableCellAlignToStyle&&l==="align"&&typeof a=="string"&&ul.has(n.tagName)?r=a:t[l]=a}}if(r){const o=t.style||(t.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return t}function bl(e,n){const t={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const l=o.expression;l.type;const a=l.properties[0];a.type,Object.assign(t,e.evaluater.evaluateExpression(a.argument))}else Xe(e,n.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,o=e.evaluater.evaluateExpression(a.expression)}else Xe(e,n.position);else o=r.value===null?!0:r.value;t[i]=o}return t}function en(e,n){const t=[];let r=-1;const i=e.passKeys?new Map:ol;for(;++r<n.children.length;){const o=n.children[r];let l;if(e.passKeys){const s=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(s){const u=i.get(s)||0;l=s+"-"+u,i.set(s,u+1)}}const a=wr(e,o,l);a!==void 0&&t.push(a)}return t}function wl(e,n,t){const r=Ki(e.schema,n);if(!(t==null||typeof t=="number"&&Number.isNaN(t))){if(Array.isArray(t)&&(t=r.commaSeparated?Oi(t):Ji(t)),r.property==="style"){let i=typeof t=="object"?t:Sl(e,String(t));return e.stylePropertyNameCase==="css"&&(i=Cl(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?$i[r.property]||r.property:r.attribute,t]}}function Sl(e,n){try{return il(n,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};const r=t,i=new Z("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=br+"#cannot-parse-style-attribute",i}}function Cr(e,n,t){let r;if(!t)r={type:"Literal",value:n};else if(n.includes(".")){const i=n.split(".");let o=-1,l;for(;++o<i.length;){const a=bn(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};l=l?{type:"MemberExpression",object:l,property:a,computed:!!(o&&a.type==="Literal"),optional:!1}:a}r=l}else r=bn(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const i=r.value;return Jt.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Xe(e)}function Xe(e,n){const t=new Z("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=br+"#cannot-handle-mdx-estrees-without-createevaluater",t}function Cl(e){const n={};let t;for(t in e)Jt.call(e,t)&&(n[El(t)]=e[t]);return n}function El(e){let n=e.replace(al,Tl);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Tl(e){return"-"+e.toLowerCase()}const wt={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},vl={};function tn(e,n){const t=vl,r=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,i=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return Er(e,r,i)}function Er(e,n,t){if(Il(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Dn(e.children,n,t)}return Array.isArray(e)?Dn(e,n,t):""}function Dn(e,n,t){const r=[];let i=-1;for(;++i<e.length;)r[i]=Er(e[i],n,t);return r.join("")}function Il(e){return!!(e&&typeof e=="object")}const Ln=document.createElement("i");function nn(e){const n="&"+e+";";Ln.innerHTML=n;const t=Ln.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function le(e,n,t,r){const i=e.length;let o=0,l;if(n<0?n=-n>i?0:i+n:n=n>i?i:n,t=t>0?t:0,r.length<1e4)l=Array.from(r),l.unshift(n,t),e.splice(...l);else for(t&&e.splice(n,t);o<r.length;)l=r.slice(o,o+1e4),l.unshift(n,0),e.splice(...l),o+=1e4,n+=1e4}function ae(e,n){return e.length>0?(le(e,e.length,0,n),e):n}const _n={}.hasOwnProperty;function Tr(e){const n={};let t=-1;for(;++t<e.length;)Al(n,e[t]);return n}function Al(e,n){let t;for(t in n){const i=(_n.call(e,t)?e[t]:void 0)||(e[t]={}),o=n[t];let l;if(o)for(l in o){_n.call(i,l)||(i[l]=[]);const a=o[l];Pl(i[l],Array.isArray(a)?a:a?[a]:[])}}}function Pl(e,n){let t=-1;const r=[];for(;++t<n.length;)(n[t].add==="after"?e:r).push(n[t]);le(e,0,0,r)}function vr(e,n){const t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function he(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ee=Ee(/[A-Za-z]/),J=Ee(/[\dA-Za-z]/),Dl=Ee(/[#-'*+\--9=?A-Z^-~]/);function ut(e){return e!==null&&(e<32||e===127)}const Ht=Ee(/\d/),Ll=Ee(/[\dA-Fa-f]/),_l=Ee(/[!-/:-@[-`{-~]/);function N(e){return e!==null&&e<-2}function G(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const pt=Ee(new RegExp("\\p{P}|\\p{S}","u")),Ae=Ee(/\s/);function Ee(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function je(e){const n=[];let t=-1,r=0,i=0;for(;++t<e.length;){const o=e.charCodeAt(t);let l="";if(o===37&&J(e.charCodeAt(t+1))&&J(e.charCodeAt(t+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const a=e.charCodeAt(t+1);o<56320&&a>56319&&a<57344?(l=String.fromCharCode(o,a),i=1):l="�"}else l=String.fromCharCode(o);l&&(n.push(e.slice(r,t),encodeURIComponent(l)),r=t+i+1,l=""),i&&(t+=i,i=0)}return n.join("")+e.slice(r)}function V(e,n,t,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(s){return H(s)?(e.enter(t),a(s)):n(s)}function a(s){return H(s)&&o++<i?(e.consume(s),a):(e.exit(t),n(s))}}const Rl={tokenize:zl};function zl(e){const n=e.attempt(this.parser.constructs.contentInitial,r,i);let t;return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),V(e,n,"linePrefix")}function i(a){return e.enter("paragraph"),o(a)}function o(a){const s=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=s),t=s,l(a)}function l(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return N(a)?(e.consume(a),e.exit("chunkText"),o):(e.consume(a),l)}}const Nl={tokenize:Ol},Rn={tokenize:Fl};function Ol(e){const n=this,t=[];let r=0,i,o,l;return a;function a(k){if(r<t.length){const D=t[r];return n.containerState=D[1],e.attempt(D[0].continuation,s,u)(k)}return u(k)}function s(k){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,i&&C();const D=n.events.length;let z=D,w;for(;z--;)if(n.events[z][0]==="exit"&&n.events[z][1].type==="chunkFlow"){w=n.events[z][1].end;break}y(r);let _=D;for(;_<n.events.length;)n.events[_][1].end={...w},_++;return le(n.events,z+1,0,n.events.slice(D)),n.events.length=_,u(k)}return a(k)}function u(k){if(r===t.length){if(!i)return p(k);if(i.currentConstruct&&i.currentConstruct.concrete)return g(k);n.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(Rn,f,c)(k)}function f(k){return i&&C(),y(r),p(k)}function c(k){return n.parser.lazy[n.now().line]=r!==t.length,l=n.now().offset,g(k)}function p(k){return n.containerState={},e.attempt(Rn,h,g)(k)}function h(k){return r++,t.push([n.currentConstruct,n.containerState]),p(k)}function g(k){if(k===null){i&&C(),y(0),e.consume(k);return}return i=i||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),x(k)}function x(k){if(k===null){E(e.exit("chunkFlow"),!0),y(0),e.consume(k);return}return N(k)?(e.consume(k),E(e.exit("chunkFlow")),r=0,n.interrupt=void 0,a):(e.consume(k),x)}function E(k,D){const z=n.sliceStream(k);if(D&&z.push(null),k.previous=o,o&&(o.next=k),o=k,i.defineSkip(k.start),i.write(z),n.parser.lazy[k.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<l&&(!i.events[w][1].end||i.events[w][1].end.offset>l))return;const _=n.events.length;let U=_,j,b;for(;U--;)if(n.events[U][0]==="exit"&&n.events[U][1].type==="chunkFlow"){if(j){b=n.events[U][1].end;break}j=!0}for(y(r),w=_;w<n.events.length;)n.events[w][1].end={...b},w++;le(n.events,U+1,0,n.events.slice(_)),n.events.length=w}}function y(k){let D=t.length;for(;D-- >k;){const z=t[D];n.containerState=z[1],z[0].exit.call(n,e)}t.length=k}function C(){i.write([null]),o=void 0,i=void 0,n.containerState._closeFlow=void 0}}function Fl(e,n,t){return V(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fe(e){if(e===null||G(e)||Ae(e))return 1;if(pt(e))return 2}function mt(e,n,t){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(n=o(n,t),r.push(o))}return n}const qt={name:"attention",resolveAll:Ml,tokenize:jl};function Ml(e,n){let t=-1,r,i,o,l,a,s,u,f;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(r=t;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[r][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;s=e[r][1].end.offset-e[r][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[t][1].start};zn(c,-s),zn(p,s),l={type:s>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:s>1?"strongSequence":"emphasisSequence",start:{...e[t][1].start},end:p},o={type:s>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[t][1].start}},i={type:s>1?"strong":"emphasis",start:{...l.start},end:{...a.end}},e[r][1].end={...l.start},e[t][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ae(u,[["enter",e[r][1],n],["exit",e[r][1],n]])),u=ae(u,[["enter",i,n],["enter",l,n],["exit",l,n],["enter",o,n]]),u=ae(u,mt(n.parser.constructs.insideSpan.null,e.slice(r+1,t),n)),u=ae(u,[["exit",o,n],["enter",a,n],["exit",a,n],["exit",i,n]]),e[t][1].end.offset-e[t][1].start.offset?(f=2,u=ae(u,[["enter",e[t][1],n],["exit",e[t][1],n]])):f=0,le(e,r-1,t-r+3,u),t=r+u.length-f-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function jl(e,n){const t=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Fe(r);let o;return l;function l(s){return o=s,e.enter("attentionSequence"),a(s)}function a(s){if(s===o)return e.consume(s),a;const u=e.exit("attentionSequence"),f=Fe(s),c=!f||f===2&&i||t.includes(s),p=!i||i===2&&f||t.includes(r);return u._open=!!(o===42?c:c&&(i||!p)),u._close=!!(o===42?p:p&&(f||!c)),n(s)}}function zn(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const Bl={name:"autolink",tokenize:Ul};function Ul(e,n,t){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(h){return ee(h)?(e.consume(h),l):h===64?t(h):u(h)}function l(h){return h===43||h===45||h===46||J(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(e.consume(h),r=0,s):(h===43||h===45||h===46||J(h))&&r++<32?(e.consume(h),a):(r=0,u(h))}function s(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):h===null||h===32||h===60||ut(h)?t(h):(e.consume(h),s)}function u(h){return h===64?(e.consume(h),f):Dl(h)?(e.consume(h),u):t(h)}function f(h){return J(h)?c(h):t(h)}function c(h){return h===46?(e.consume(h),r=0,f):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),n):p(h)}function p(h){if((h===45||J(h))&&r++<63){const g=h===45?p:c;return e.consume(h),g}return t(h)}}const Ze={partial:!0,tokenize:Hl};function Hl(e,n,t){return r;function r(o){return H(o)?V(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||N(o)?n(o):t(o)}}const Ir={continuation:{tokenize:Vl},exit:$l,name:"blockQuote",tokenize:ql};function ql(e,n,t){const r=this;return i;function i(l){if(l===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return t(l)}function o(l){return H(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(l))}}function Vl(e,n,t){const r=this;return i;function i(l){return H(l)?V(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(Ir,n,t)(l)}}function $l(e){e.exit("blockQuote")}const Ar={name:"characterEscape",tokenize:Gl};function Gl(e,n,t){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return _l(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(o)}}const Pr={name:"characterReference",tokenize:Wl};function Wl(e,n,t){const r=this;let i=0,o,l;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),s}function s(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,l=J,f(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=Ll,f):(e.enter("characterReferenceValue"),o=7,l=Ht,f(c))}function f(c){if(c===59&&i){const p=e.exit("characterReferenceValue");return l===J&&!nn(r.sliceSerialize(p))?t(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return l(c)&&i++<o?(e.consume(c),f):t(c)}}const Nn={partial:!0,tokenize:Yl},On={concrete:!0,name:"codeFenced",tokenize:Kl};function Kl(e,n,t){const r=this,i={partial:!0,tokenize:z};let o=0,l=0,a;return s;function s(w){return u(w)}function u(w){const _=r.events[r.events.length-1];return o=_&&_[1].type==="linePrefix"?_[2].sliceSerialize(_[1],!0).length:0,a=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(w)}function f(w){return w===a?(l++,e.consume(w),f):l<3?t(w):(e.exit("codeFencedFenceSequence"),H(w)?V(e,c,"whitespace")(w):c(w))}function c(w){return w===null||N(w)?(e.exit("codeFencedFence"),r.interrupt?n(w):e.check(Nn,x,D)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||N(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(w)):H(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),V(e,h,"whitespace")(w)):w===96&&w===a?t(w):(e.consume(w),p)}function h(w){return w===null||N(w)?c(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===null||N(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(w)):w===96&&w===a?t(w):(e.consume(w),g)}function x(w){return e.attempt(i,D,E)(w)}function E(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y}function y(w){return o>0&&H(w)?V(e,C,"linePrefix",o+1)(w):C(w)}function C(w){return w===null||N(w)?e.check(Nn,x,D)(w):(e.enter("codeFlowValue"),k(w))}function k(w){return w===null||N(w)?(e.exit("codeFlowValue"),C(w)):(e.consume(w),k)}function D(w){return e.exit("codeFenced"),n(w)}function z(w,_,U){let j=0;return b;function b(F){return w.enter("lineEnding"),w.consume(F),w.exit("lineEnding"),P}function P(F){return w.enter("codeFencedFence"),H(F)?V(w,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):A(F)}function A(F){return F===a?(w.enter("codeFencedFenceSequence"),L(F)):U(F)}function L(F){return F===a?(j++,w.consume(F),L):j>=l?(w.exit("codeFencedFenceSequence"),H(F)?V(w,R,"whitespace")(F):R(F)):U(F)}function R(F){return F===null||N(F)?(w.exit("codeFencedFence"),_(F)):U(F)}}}function Yl(e,n,t){const r=this;return i;function i(l){return l===null?t(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return r.parser.lazy[r.now().line]?t(l):n(l)}}const St={name:"codeIndented",tokenize:Ql},Xl={partial:!0,tokenize:Jl};function Ql(e,n,t){const r=this;return i;function i(u){return e.enter("codeIndented"),V(e,o,"linePrefix",5)(u)}function o(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?l(u):t(u)}function l(u){return u===null?s(u):N(u)?e.attempt(Xl,l,s)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||N(u)?(e.exit("codeFlowValue"),l(u)):(e.consume(u),a)}function s(u){return e.exit("codeIndented"),n(u)}}function Jl(e,n,t){const r=this;return i;function i(l){return r.parser.lazy[r.now().line]?t(l):N(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):V(e,o,"linePrefix",5)(l)}function o(l){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(l):N(l)?i(l):t(l)}}const Zl={name:"codeText",previous:to,resolve:eo,tokenize:no};function eo(e){let n=e.length-4,t=3,r,i;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=t;++r<n;)if(e[r][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(r=t-1,n++;++r<=n;)i===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(i=r):(r===n||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),n-=r-i-2,r=i+2),i=void 0);return e}function to(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function no(e,n,t){let r=0,i,o;return l;function l(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),s(c))}function s(c){return c===null?t(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),s):c===96?(o=e.enter("codeTextSequence"),i=0,f(c)):N(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||N(c)?(e.exit("codeTextData"),s(c)):(e.consume(c),u)}function f(c){return c===96?(e.consume(c),i++,f):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(c)):(o.type="codeTextData",u(c))}}class ro{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){const r=t??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,t,r){const i=t||0;this.setCursor(Math.trunc(n));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&$e(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),$e(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),$e(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const t=this.left.splice(n,Number.POSITIVE_INFINITY);$e(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);$e(this.left,t.reverse())}}}function $e(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function Dr(e){const n={};let t=-1,r,i,o,l,a,s,u;const f=new ro(e);for(;++t<f.length;){for(;t in n;)t=n[t];if(r=f.get(t),t&&r[1].type==="chunkFlow"&&f.get(t-1)[1].type==="listItemPrefix"&&(s=r[1]._tokenizer.events,o=0,o<s.length&&s[o][1].type==="lineEndingBlank"&&(o+=2),o<s.length&&s[o][1].type==="content"))for(;++o<s.length&&s[o][1].type!=="content";)s[o][1].type==="chunkText"&&(s[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,io(f,t)),t=n[t],u=!0);else if(r[1]._container){for(o=t,i=void 0;o--;)if(l=f.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(i&&(f.get(i)[1].type="lineEndingBlank"),l[1].type="lineEnding",i=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;i&&(r[1].end={...f.get(i)[1].start},a=f.slice(i,t),a.unshift(r),f.splice(i,t-i+1,a))}}return le(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function io(e,n){const t=e.get(n)[1],r=e.get(n)[2];let i=n-1;const o=[];let l=t._tokenizer;l||(l=r.parser[t.contentType](t.start),t._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const a=l.events,s=[],u={};let f,c,p=-1,h=t,g=0,x=0;const E=[x];for(;h;){for(;e.get(++i)[1]!==h;);o.push(i),h._tokenizer||(f=r.sliceStream(h),h.next||f.push(null),c&&l.defineSkip(h.start),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(f),h._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),c=h,h=h.next}for(h=t;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(x=p+1,E.push(x),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(l.events=[],h?(h._tokenizer=void 0,h.previous=void 0):E.pop(),p=E.length;p--;){const y=a.slice(E[p],E[p+1]),C=o.pop();s.push([C,C+y.length-1]),e.splice(C,2,y)}for(s.reverse(),p=-1;++p<s.length;)u[g+s[p][0]]=g+s[p][1],g+=s[p][1]-s[p][0]-1;return u}const lo={resolve:ao,tokenize:so},oo={partial:!0,tokenize:uo};function ao(e){return Dr(e),e}function so(e,n){let t;return r;function r(a){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?o(a):N(a)?e.check(oo,l,o)(a):(e.consume(a),i)}function o(a){return e.exit("chunkContent"),e.exit("content"),n(a)}function l(a){return e.consume(a),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,i}}function uo(e,n,t){const r=this;return i;function i(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),V(e,o,"linePrefix")}function o(l){if(l===null||N(l))return t(l);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?n(l):e.interrupt(r.parser.constructs.flow,t,n)(l)}}function Lr(e,n,t,r,i,o,l,a,s){const u=s||Number.POSITIVE_INFINITY;let f=0;return c;function c(y){return y===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(y),e.exit(o),p):y===null||y===32||y===41||ut(y)?t(y):(e.enter(r),e.enter(l),e.enter(a),e.enter("chunkString",{contentType:"string"}),x(y))}function p(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(i),e.exit(r),n):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(a),p(y)):y===null||y===60||N(y)?t(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function x(y){return!f&&(y===null||y===41||G(y))?(e.exit("chunkString"),e.exit(a),e.exit(l),e.exit(r),n(y)):f<u&&y===40?(e.consume(y),f++,x):y===41?(e.consume(y),f--,x):y===null||y===32||y===40||ut(y)?t(y):(e.consume(y),y===92?E:x)}function E(y){return y===40||y===41||y===92?(e.consume(y),x):x(y)}}function _r(e,n,t,r,i,o){const l=this;let a=0,s;return u;function u(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(o),f}function f(h){return a>999||h===null||h===91||h===93&&!s||h===94&&!a&&"_hiddenFootnoteSupport"in l.parser.constructs?t(h):h===93?(e.exit(o),e.enter(i),e.consume(h),e.exit(i),e.exit(r),n):N(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===null||h===91||h===93||N(h)||a++>999?(e.exit("chunkString"),f(h)):(e.consume(h),s||(s=!H(h)),h===92?p:c)}function p(h){return h===91||h===92||h===93?(e.consume(h),a++,c):c(h)}}function Rr(e,n,t,r,i,o){let l;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),l=p===40?41:p,s):t(p)}function s(p){return p===l?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),n):(e.enter(o),u(p))}function u(p){return p===l?(e.exit(o),s(l)):p===null?t(p):N(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),V(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===l||p===null||N(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?c:f)}function c(p){return p===l||p===92?(e.consume(p),f):f(p)}}function Ke(e,n){let t;return r;function r(i){return N(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t=!0,r):H(i)?V(e,r,t?"linePrefix":"lineSuffix")(i):n(i)}}const co={name:"definition",tokenize:ho},fo={partial:!0,tokenize:po};function ho(e,n,t){const r=this;let i;return o;function o(h){return e.enter("definition"),l(h)}function l(h){return _r.call(r,e,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=he(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),s):t(h)}function s(h){return G(h)?Ke(e,u)(h):u(h)}function u(h){return Lr(e,f,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function f(h){return e.attempt(fo,c,c)(h)}function c(h){return H(h)?V(e,p,"whitespace")(h):p(h)}function p(h){return h===null||N(h)?(e.exit("definition"),r.parser.defined.push(i),n(h)):t(h)}}function po(e,n,t){return r;function r(a){return G(a)?Ke(e,i)(a):t(a)}function i(a){return Rr(e,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return H(a)?V(e,l,"whitespace")(a):l(a)}function l(a){return a===null||N(a)?n(a):t(a)}}const mo={name:"hardBreakEscape",tokenize:go};function go(e,n,t){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return N(o)?(e.exit("hardBreakEscape"),n(o)):t(o)}}const yo={name:"headingAtx",resolve:ko,tokenize:xo};function ko(e,n){let t=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),t-2>r&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(r===t-1||t-4>r&&e[t-2][1].type==="whitespace")&&(t-=r+1===t?2:4),t>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[t][1].end},o={type:"chunkText",start:e[r][1].start,end:e[t][1].end,contentType:"text"},le(e,r,t-r+1,[["enter",i,n],["enter",o,n],["exit",o,n],["exit",i,n]])),e}function xo(e,n,t){let r=0;return i;function i(f){return e.enter("atxHeading"),o(f)}function o(f){return e.enter("atxHeadingSequence"),l(f)}function l(f){return f===35&&r++<6?(e.consume(f),l):f===null||G(f)?(e.exit("atxHeadingSequence"),a(f)):t(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),s(f)):f===null||N(f)?(e.exit("atxHeading"),n(f)):H(f)?V(e,a,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function s(f){return f===35?(e.consume(f),s):(e.exit("atxHeadingSequence"),a(f))}function u(f){return f===null||f===35||G(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),u)}}const bo=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Fn=["pre","script","style","textarea"],wo={concrete:!0,name:"htmlFlow",resolveTo:Eo,tokenize:To},So={partial:!0,tokenize:Io},Co={partial:!0,tokenize:vo};function Eo(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function To(e,n,t){const r=this;let i,o,l,a,s;return u;function u(d){return f(d)}function f(d){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(d),c}function c(d){return d===33?(e.consume(d),p):d===47?(e.consume(d),o=!0,x):d===63?(e.consume(d),i=3,r.interrupt?n:m):ee(d)?(e.consume(d),l=String.fromCharCode(d),E):t(d)}function p(d){return d===45?(e.consume(d),i=2,h):d===91?(e.consume(d),i=5,a=0,g):ee(d)?(e.consume(d),i=4,r.interrupt?n:m):t(d)}function h(d){return d===45?(e.consume(d),r.interrupt?n:m):t(d)}function g(d){const ce="CDATA[";return d===ce.charCodeAt(a++)?(e.consume(d),a===ce.length?r.interrupt?n:A:g):t(d)}function x(d){return ee(d)?(e.consume(d),l=String.fromCharCode(d),E):t(d)}function E(d){if(d===null||d===47||d===62||G(d)){const ce=d===47,Te=l.toLowerCase();return!ce&&!o&&Fn.includes(Te)?(i=1,r.interrupt?n(d):A(d)):bo.includes(l.toLowerCase())?(i=6,ce?(e.consume(d),y):r.interrupt?n(d):A(d)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?t(d):o?C(d):k(d))}return d===45||J(d)?(e.consume(d),l+=String.fromCharCode(d),E):t(d)}function y(d){return d===62?(e.consume(d),r.interrupt?n:A):t(d)}function C(d){return H(d)?(e.consume(d),C):b(d)}function k(d){return d===47?(e.consume(d),b):d===58||d===95||ee(d)?(e.consume(d),D):H(d)?(e.consume(d),k):b(d)}function D(d){return d===45||d===46||d===58||d===95||J(d)?(e.consume(d),D):z(d)}function z(d){return d===61?(e.consume(d),w):H(d)?(e.consume(d),z):k(d)}function w(d){return d===null||d===60||d===61||d===62||d===96?t(d):d===34||d===39?(e.consume(d),s=d,_):H(d)?(e.consume(d),w):U(d)}function _(d){return d===s?(e.consume(d),s=null,j):d===null||N(d)?t(d):(e.consume(d),_)}function U(d){return d===null||d===34||d===39||d===47||d===60||d===61||d===62||d===96||G(d)?z(d):(e.consume(d),U)}function j(d){return d===47||d===62||H(d)?k(d):t(d)}function b(d){return d===62?(e.consume(d),P):t(d)}function P(d){return d===null||N(d)?A(d):H(d)?(e.consume(d),P):t(d)}function A(d){return d===45&&i===2?(e.consume(d),Y):d===60&&i===1?(e.consume(d),X):d===62&&i===4?(e.consume(d),ue):d===63&&i===3?(e.consume(d),m):d===93&&i===5?(e.consume(d),ge):N(d)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(So,ye,L)(d)):d===null||N(d)?(e.exit("htmlFlowData"),L(d)):(e.consume(d),A)}function L(d){return e.check(Co,R,ye)(d)}function R(d){return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),F}function F(d){return d===null||N(d)?L(d):(e.enter("htmlFlowData"),A(d))}function Y(d){return d===45?(e.consume(d),m):A(d)}function X(d){return d===47?(e.consume(d),l="",se):A(d)}function se(d){if(d===62){const ce=l.toLowerCase();return Fn.includes(ce)?(e.consume(d),ue):A(d)}return ee(d)&&l.length<8?(e.consume(d),l+=String.fromCharCode(d),se):A(d)}function ge(d){return d===93?(e.consume(d),m):A(d)}function m(d){return d===62?(e.consume(d),ue):d===45&&i===2?(e.consume(d),m):A(d)}function ue(d){return d===null||N(d)?(e.exit("htmlFlowData"),ye(d)):(e.consume(d),ue)}function ye(d){return e.exit("htmlFlow"),n(d)}}function vo(e,n,t){const r=this;return i;function i(l){return N(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):t(l)}function o(l){return r.parser.lazy[r.now().line]?t(l):n(l)}}function Io(e,n,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ze,n,t)}}const Ao={name:"htmlText",tokenize:Po};function Po(e,n,t){const r=this;let i,o,l;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),s}function s(m){return m===33?(e.consume(m),u):m===47?(e.consume(m),z):m===63?(e.consume(m),k):ee(m)?(e.consume(m),U):t(m)}function u(m){return m===45?(e.consume(m),f):m===91?(e.consume(m),o=0,g):ee(m)?(e.consume(m),C):t(m)}function f(m){return m===45?(e.consume(m),h):t(m)}function c(m){return m===null?t(m):m===45?(e.consume(m),p):N(m)?(l=c,X(m)):(e.consume(m),c)}function p(m){return m===45?(e.consume(m),h):c(m)}function h(m){return m===62?Y(m):m===45?p(m):c(m)}function g(m){const ue="CDATA[";return m===ue.charCodeAt(o++)?(e.consume(m),o===ue.length?x:g):t(m)}function x(m){return m===null?t(m):m===93?(e.consume(m),E):N(m)?(l=x,X(m)):(e.consume(m),x)}function E(m){return m===93?(e.consume(m),y):x(m)}function y(m){return m===62?Y(m):m===93?(e.consume(m),y):x(m)}function C(m){return m===null||m===62?Y(m):N(m)?(l=C,X(m)):(e.consume(m),C)}function k(m){return m===null?t(m):m===63?(e.consume(m),D):N(m)?(l=k,X(m)):(e.consume(m),k)}function D(m){return m===62?Y(m):k(m)}function z(m){return ee(m)?(e.consume(m),w):t(m)}function w(m){return m===45||J(m)?(e.consume(m),w):_(m)}function _(m){return N(m)?(l=_,X(m)):H(m)?(e.consume(m),_):Y(m)}function U(m){return m===45||J(m)?(e.consume(m),U):m===47||m===62||G(m)?j(m):t(m)}function j(m){return m===47?(e.consume(m),Y):m===58||m===95||ee(m)?(e.consume(m),b):N(m)?(l=j,X(m)):H(m)?(e.consume(m),j):Y(m)}function b(m){return m===45||m===46||m===58||m===95||J(m)?(e.consume(m),b):P(m)}function P(m){return m===61?(e.consume(m),A):N(m)?(l=P,X(m)):H(m)?(e.consume(m),P):j(m)}function A(m){return m===null||m===60||m===61||m===62||m===96?t(m):m===34||m===39?(e.consume(m),i=m,L):N(m)?(l=A,X(m)):H(m)?(e.consume(m),A):(e.consume(m),R)}function L(m){return m===i?(e.consume(m),i=void 0,F):m===null?t(m):N(m)?(l=L,X(m)):(e.consume(m),L)}function R(m){return m===null||m===34||m===39||m===60||m===61||m===96?t(m):m===47||m===62||G(m)?j(m):(e.consume(m),R)}function F(m){return m===47||m===62||G(m)?j(m):t(m)}function Y(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),n):t(m)}function X(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),se}function se(m){return H(m)?V(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):ge(m)}function ge(m){return e.enter("htmlTextData"),l(m)}}const rn={name:"labelEnd",resolveAll:Ro,resolveTo:zo,tokenize:No},Do={tokenize:Oo},Lo={tokenize:Fo},_o={tokenize:Mo};function Ro(e){let n=-1;const t=[];for(;++n<e.length;){const r=e[n][1];if(t.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",n+=i}}return e.length!==t.length&&le(e,0,e.length,t),e}function zo(e,n){let t=e.length,r=0,i,o,l,a;for(;t--;)if(i=e[t][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[t][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(l){if(e[t][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=t,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(l=t);const s={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[l][1].end}},f={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[l-2][1].start}};return a=[["enter",s,n],["enter",u,n]],a=ae(a,e.slice(o+1,o+r+3)),a=ae(a,[["enter",f,n]]),a=ae(a,mt(n.parser.constructs.insideSpan.null,e.slice(o+r+4,l-3),n)),a=ae(a,[["exit",f,n],e[l-2],e[l-1],["exit",u,n]]),a=ae(a,e.slice(l+1)),a=ae(a,[["exit",s,n]]),le(e,o,e.length,a),e}function No(e,n,t){const r=this;let i=r.events.length,o,l;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return a;function a(p){return o?o._inactive?c(p):(l=r.parser.defined.includes(he(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),s):t(p)}function s(p){return p===40?e.attempt(Do,f,l?f:c)(p):p===91?e.attempt(Lo,f,l?u:c)(p):l?f(p):c(p)}function u(p){return e.attempt(_o,f,c)(p)}function f(p){return n(p)}function c(p){return o._balanced=!0,t(p)}}function Oo(e,n,t){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return G(c)?Ke(e,o)(c):o(c)}function o(c){return c===41?f(c):Lr(e,l,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function l(c){return G(c)?Ke(e,s)(c):f(c)}function a(c){return t(c)}function s(c){return c===34||c===39||c===40?Rr(e,u,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):f(c)}function u(c){return G(c)?Ke(e,f)(c):f(c)}function f(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),n):t(c)}}function Fo(e,n,t){const r=this;return i;function i(a){return _r.call(r,e,o,l,"reference","referenceMarker","referenceString")(a)}function o(a){return r.parser.defined.includes(he(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(a):t(a)}function l(a){return t(a)}}function Mo(e,n,t){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),n):t(o)}}const jo={name:"labelStartImage",resolveAll:rn.resolveAll,tokenize:Bo};function Bo(e,n,t){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),o}function o(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),l):t(a)}function l(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(a):n(a)}}const Uo={name:"labelStartLink",resolveAll:rn.resolveAll,tokenize:Ho};function Ho(e,n,t){const r=this;return i;function i(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?t(l):n(l)}}const Ct={name:"lineEnding",tokenize:qo};function qo(e,n){return t;function t(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),V(e,n,"linePrefix")}}const st={name:"thematicBreak",tokenize:Vo};function Vo(e,n,t){let r=0,i;return o;function o(u){return e.enter("thematicBreak"),l(u)}function l(u){return i=u,a(u)}function a(u){return u===i?(e.enter("thematicBreakSequence"),s(u)):r>=3&&(u===null||N(u))?(e.exit("thematicBreak"),n(u)):t(u)}function s(u){return u===i?(e.consume(u),r++,s):(e.exit("thematicBreakSequence"),H(u)?V(e,a,"whitespace")(u):a(u))}}const te={continuation:{tokenize:Ko},exit:Xo,name:"list",tokenize:Wo},$o={partial:!0,tokenize:Qo},Go={partial:!0,tokenize:Yo};function Wo(e,n,t){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,l=0;return a;function a(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Ht(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(st,t,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),s(h)}return t(h)}function s(h){return Ht(h)&&++l<10?(e.consume(h),s):(!r.interrupt||l<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):t(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(Ze,r.interrupt?t:f,e.attempt($o,p,c))}function f(h){return r.containerState.initialBlankLine=!0,o++,p(h)}function c(h){return H(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):t(h)}function p(h){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(h)}}function Ko(e,n,t){const r=this;return r.containerState._closeFlow=void 0,e.check(Ze,i,o);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,V(e,n,"listItemIndent",r.containerState.size+1)(a)}function o(a){return r.containerState.furtherBlankLines||!H(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Go,n,l)(a))}function l(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,V(e,e.attempt(te,n,t),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Yo(e,n,t){const r=this;return V(e,i,"listItemIndent",r.containerState.size+1);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?n(o):t(o)}}function Xo(e){e.exit(this.containerState.type)}function Qo(e,n,t){const r=this;return V(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const l=r.events[r.events.length-1];return!H(o)&&l&&l[1].type==="listItemPrefixWhitespace"?n(o):t(o)}}const Mn={name:"setextUnderline",resolveTo:Jo,tokenize:Zo};function Jo(e,n){let t=e.length,r,i,o;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){r=t;break}e[t][1].type==="paragraph"&&(i=t)}else e[t][1].type==="content"&&e.splice(t,1),!o&&e[t][1].type==="definition"&&(o=t);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",l,n]),e.splice(o+1,0,["exit",e[r][1],n]),e[r][1].end={...e[o][1].end}):e[r][1]=l,e.push(["exit",l,n]),e}function Zo(e,n,t){const r=this;let i;return o;function o(u){let f=r.events.length,c;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){c=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,l(u)):t(u)}function l(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),H(u)?V(e,s,"lineSuffix")(u):s(u))}function s(u){return u===null||N(u)?(e.exit("setextHeadingLine"),n(u)):t(u)}}const ea={tokenize:ta};function ta(e){const n=this,t=e.attempt(Ze,r,e.attempt(this.parser.constructs.flowInitial,i,V(e,e.attempt(this.parser.constructs.flow,i,e.attempt(lo,i)),"linePrefix")));return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n.currentConstruct=void 0,t}}const na={resolveAll:Nr()},ra=zr("string"),ia=zr("text");function zr(e){return{resolveAll:Nr(e==="text"?la:void 0),tokenize:n};function n(t){const r=this,i=this.parser.constructs[e],o=t.attempt(i,l,a);return l;function l(f){return u(f)?o(f):a(f)}function a(f){if(f===null){t.consume(f);return}return t.enter("data"),t.consume(f),s}function s(f){return u(f)?(t.exit("data"),o(f)):(t.consume(f),s)}function u(f){if(f===null)return!0;const c=i[f];let p=-1;if(c)for(;++p<c.length;){const h=c[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Nr(e){return n;function n(t,r){let i=-1,o;for(;++i<=t.length;)o===void 0?t[i]&&t[i][1].type==="data"&&(o=i,i++):(!t[i]||t[i][1].type!=="data")&&(i!==o+2&&(t[o][1].end=t[i-1][1].end,t.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(t,r):t}}function la(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){const r=e[t-1][1],i=n.sliceStream(r);let o=i.length,l=-1,a=0,s;for(;o--;){const u=i[o];if(typeof u=="string"){for(l=u.length;u.charCodeAt(l-1)===32;)a++,l--;if(l)break;l=-1}else if(u===-2)s=!0,a++;else if(u!==-1){o++;break}}if(n._contentTypeTextTrailing&&t===e.length&&(a=0),a){const u={type:t===e.length||s||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:r.start._bufferIndex+l,_index:r.start._index+o,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(t,0,["enter",u,n],["exit",u,n]),t+=2)}t++}return e}const oa={42:te,43:te,45:te,48:te,49:te,50:te,51:te,52:te,53:te,54:te,55:te,56:te,57:te,62:Ir},aa={91:co},sa={[-2]:St,[-1]:St,32:St},ua={35:yo,42:st,45:[Mn,st],60:wo,61:Mn,95:st,96:On,126:On},ca={38:Pr,92:Ar},fa={[-5]:Ct,[-4]:Ct,[-3]:Ct,33:jo,38:Pr,42:qt,60:[Bl,Ao],91:Uo,92:[mo,Ar],93:rn,95:qt,96:Zl},ha={null:[qt,na]},pa={null:[42,95]},ma={null:[]},da=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:pa,contentInitial:aa,disable:ma,document:oa,flow:ua,flowInitial:sa,insideSpan:ha,string:ca,text:fa},Symbol.toStringTag,{value:"Module"}));function ga(e,n,t){let r={_bufferIndex:-1,_index:0,line:t&&t.line||1,column:t&&t.column||1,offset:t&&t.offset||0};const i={},o=[];let l=[],a=[];const s={attempt:_(z),check:_(w),consume:C,enter:k,exit:D,interrupt:_(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:x,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:c};let f=n.tokenize.call(u,s);return n.resolveAll&&o.push(n),u;function c(P){return l=ae(l,P),E(),l[l.length-1]!==null?[]:(U(n,0),u.events=mt(o,u.events,u),u.events)}function p(P,A){return ka(h(P),A)}function h(P){return ya(l,P)}function g(){const{_bufferIndex:P,_index:A,line:L,column:R,offset:F}=r;return{_bufferIndex:P,_index:A,line:L,column:R,offset:F}}function x(P){i[P.line]=P.column,b()}function E(){let P;for(;r._index<l.length;){const A=l[r._index];if(typeof A=="string")for(P=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<A.length;)y(A.charCodeAt(r._bufferIndex));else y(A)}}function y(P){f=f(P)}function C(P){N(P)?(r.line++,r.column=1,r.offset+=P===-3?2:1,b()):P!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=P}function k(P,A){const L=A||{};return L.type=P,L.start=g(),u.events.push(["enter",L,u]),a.push(L),L}function D(P){const A=a.pop();return A.end=g(),u.events.push(["exit",A,u]),A}function z(P,A){U(P,A.from)}function w(P,A){A.restore()}function _(P,A){return L;function L(R,F,Y){let X,se,ge,m;return Array.isArray(R)?ye(R):"tokenize"in R?ye([R]):ue(R);function ue(Q){return Be;function Be(we){const De=we!==null&&Q[we],Le=we!==null&&Q.null,tt=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(Le)?Le:Le?[Le]:[]];return ye(tt)(we)}}function ye(Q){return X=Q,se=0,Q.length===0?Y:d(Q[se])}function d(Q){return Be;function Be(we){return m=j(),ge=Q,Q.partial||(u.currentConstruct=Q),Q.name&&u.parser.constructs.disable.null.includes(Q.name)?Te():Q.tokenize.call(A?Object.assign(Object.create(u),A):u,s,ce,Te)(we)}}function ce(Q){return P(ge,m),F}function Te(Q){return m.restore(),++se<X.length?d(X[se]):Y}}}function U(P,A){P.resolveAll&&!o.includes(P)&&o.push(P),P.resolve&&le(u.events,A,u.events.length-A,P.resolve(u.events.slice(A),u)),P.resolveTo&&(u.events=P.resolveTo(u.events,u))}function j(){const P=g(),A=u.previous,L=u.currentConstruct,R=u.events.length,F=Array.from(a);return{from:R,restore:Y};function Y(){r=P,u.previous=A,u.currentConstruct=L,u.events.length=R,a=F,b()}}function b(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ya(e,n){const t=n.start._index,r=n.start._bufferIndex,i=n.end._index,o=n.end._bufferIndex;let l;if(t===i)l=[e[t].slice(r,o)];else{if(l=e.slice(t,i),r>-1){const a=l[0];typeof a=="string"?l[0]=a.slice(r):l.shift()}o>0&&l.push(e[i].slice(0,o))}return l}function ka(e,n){let t=-1;const r=[];let i;for(;++t<e.length;){const o=e[t];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
|
|
3
|
-
`;break}case-3:{
|
|
4
|
-
`;break}case-2:{l=n?" ":" ";break}case-1:{if(!n&&i)continue;l=" ";break}default:l=String.fromCharCode(o)}i=o===-2,r.push(l)}return r.join("")}function xa(e){const r={constructs:Tr([da,...(e||{}).extensions||[]]),content:i(Rl),defined:[],document:i(Nl),flow:i(ea),lazy:{},string:i(ra),text:i(ia)};return r;function i(o){return l;function l(a){return ga(r,o,a)}}}function ba(e){for(;!Dr(e););return e}const jn=/[\0\t\n\r]/g;function wa(){let e=1,n="",t=!0,r;return i;function i(o,l,a){const s=[];let u,f,c,p,h;for(o=n+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),c=0,n="",t&&(o.charCodeAt(0)===65279&&c++,t=void 0);c<o.length;){if(jn.lastIndex=c,u=jn.exec(o),p=u&&u.index!==void 0?u.index:o.length,h=o.charCodeAt(p),!u){n=o.slice(c);break}if(h===10&&c===p&&r)s.push(-3),r=void 0;else switch(r&&(s.push(-5),r=void 0),c<p&&(s.push(o.slice(c,p)),e+=p-c),h){case 0:{s.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,s.push(-2);e++<f;)s.push(-1);break}case 10:{s.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return a&&(r&&s.push(-5),n&&s.push(n),s.push(null)),s}}const Sa=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ca(e){return e.replace(Sa,Ea)}function Ea(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){const i=t.charCodeAt(1),o=i===120||i===88;return vr(t.slice(o?2:1),o?16:10)}return nn(t)||e}const Or={}.hasOwnProperty;function Ta(e,n,t){return typeof n!="string"&&(t=n,n=void 0),va(t)(ba(xa(t).document().write(wa()(e,n,!0))))}function va(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(kn),autolinkProtocol:j,autolinkEmail:j,atxHeading:o(dn),blockQuote:o(Le),characterEscape:j,characterReference:j,codeFenced:o(tt),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(tt,l),codeText:o(bi,l),codeTextData:j,data:j,codeFlowValue:j,definition:o(wi),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(Si),hardBreakEscape:o(gn),hardBreakTrailing:o(gn),htmlFlow:o(yn,l),htmlFlowData:j,htmlText:o(yn,l),htmlTextData:j,image:o(Ci),label:l,link:o(kn),listItem:o(Ei),listItemValue:p,listOrdered:o(xn,c),listUnordered:o(xn),paragraph:o(Ti),reference:d,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(dn),strong:o(vi),thematicBreak:o(Ai)},exit:{atxHeading:s(),atxHeadingSequence:z,autolink:s(),autolinkEmail:De,autolinkProtocol:we,blockQuote:s(),characterEscapeValue:b,characterReferenceMarkerHexadecimal:Te,characterReferenceMarkerNumeric:Te,characterReferenceValue:Q,characterReference:Be,codeFenced:s(E),codeFencedFence:x,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:b,codeIndented:s(y),codeText:s(F),codeTextData:b,data:b,definition:s(),definitionDestinationString:D,definitionLabelString:C,definitionTitleString:k,emphasis:s(),hardBreakEscape:s(A),hardBreakTrailing:s(A),htmlFlow:s(L),htmlFlowData:b,htmlText:s(R),htmlTextData:b,image:s(X),label:ge,labelText:se,lineEnding:P,link:s(Y),listItem:s(),listOrdered:s(),listUnordered:s(),paragraph:s(),referenceString:ce,resourceDestinationString:m,resourceTitleString:ue,resource:ye,setextHeading:s(U),setextHeadingLineSequence:_,setextHeadingText:w,strong:s(),thematicBreak:s()}};Fr(n,(e||{}).mdastExtensions||[]);const t={};return r;function r(S){let I={type:"root",children:[]};const M={stack:[I],tokenStack:[],config:n,enter:a,exit:u,buffer:l,resume:f,data:t},q=[];let $=-1;for(;++$<S.length;)if(S[$][1].type==="listOrdered"||S[$][1].type==="listUnordered")if(S[$][0]==="enter")q.push($);else{const fe=q.pop();$=i(S,fe,$)}for($=-1;++$<S.length;){const fe=n[S[$][0]];Or.call(fe,S[$][1].type)&&fe[S[$][1].type].call(Object.assign({sliceSerialize:S[$][2].sliceSerialize},M),S[$][1])}if(M.tokenStack.length>0){const fe=M.tokenStack[M.tokenStack.length-1];(fe[1]||Bn).call(M,void 0,fe[0])}for(I.position={start:Se(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:Se(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},$=-1;++$<n.transforms.length;)I=n.transforms[$](I)||I;return I}function i(S,I,M){let q=I-1,$=-1,fe=!1,ve,ke,Ue,He;for(;++q<=M;){const re=S[q];switch(re[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{re[0]==="enter"?$++:$--,He=void 0;break}case"lineEndingBlank":{re[0]==="enter"&&(ve&&!He&&!$&&!Ue&&(Ue=q),He=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:He=void 0}if(!$&&re[0]==="enter"&&re[1].type==="listItemPrefix"||$===-1&&re[0]==="exit"&&(re[1].type==="listUnordered"||re[1].type==="listOrdered")){if(ve){let _e=q;for(ke=void 0;_e--;){const xe=S[_e];if(xe[1].type==="lineEnding"||xe[1].type==="lineEndingBlank"){if(xe[0]==="exit")continue;ke&&(S[ke][1].type="lineEndingBlank",fe=!0),xe[1].type="lineEnding",ke=_e}else if(!(xe[1].type==="linePrefix"||xe[1].type==="blockQuotePrefix"||xe[1].type==="blockQuotePrefixWhitespace"||xe[1].type==="blockQuoteMarker"||xe[1].type==="listItemIndent"))break}Ue&&(!ke||Ue<ke)&&(ve._spread=!0),ve.end=Object.assign({},ke?S[ke][1].start:re[1].end),S.splice(ke||q,0,["exit",ve,re[2]]),q++,M++}if(re[1].type==="listItemPrefix"){const _e={type:"listItem",_spread:!1,start:Object.assign({},re[1].start),end:void 0};ve=_e,S.splice(q,0,["enter",_e,re[2]]),q++,M++,Ue=void 0,He=!0}}}return S[I][1]._spread=fe,M}function o(S,I){return M;function M(q){a.call(this,S(q),q),I&&I.call(this,q)}}function l(){this.stack.push({type:"fragment",children:[]})}function a(S,I,M){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([I,M||void 0]),S.position={start:Se(I.start),end:void 0}}function s(S){return I;function I(M){S&&S.call(this,M),u.call(this,M)}}function u(S,I){const M=this.stack.pop(),q=this.tokenStack.pop();if(q)q[0].type!==S.type&&(I?I.call(this,S,q[0]):(q[1]||Bn).call(this,S,q[0]));else throw new Error("Cannot close `"+S.type+"` ("+We({start:S.start,end:S.end})+"): it’s not open");M.position.end=Se(S.end)}function f(){return tn(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(S){if(this.data.expectingFirstListItemValue){const I=this.stack[this.stack.length-2];I.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function h(){const S=this.resume(),I=this.stack[this.stack.length-1];I.lang=S}function g(){const S=this.resume(),I=this.stack[this.stack.length-1];I.meta=S}function x(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const S=this.resume(),I=this.stack[this.stack.length-1];I.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const S=this.resume(),I=this.stack[this.stack.length-1];I.value=S.replace(/(\r?\n|\r)$/g,"")}function C(S){const I=this.resume(),M=this.stack[this.stack.length-1];M.label=I,M.identifier=he(this.sliceSerialize(S)).toLowerCase()}function k(){const S=this.resume(),I=this.stack[this.stack.length-1];I.title=S}function D(){const S=this.resume(),I=this.stack[this.stack.length-1];I.url=S}function z(S){const I=this.stack[this.stack.length-1];if(!I.depth){const M=this.sliceSerialize(S).length;I.depth=M}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function _(S){const I=this.stack[this.stack.length-1];I.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function j(S){const M=this.stack[this.stack.length-1].children;let q=M[M.length-1];(!q||q.type!=="text")&&(q=Ii(),q.position={start:Se(S.start),end:void 0},M.push(q)),this.stack.push(q)}function b(S){const I=this.stack.pop();I.value+=this.sliceSerialize(S),I.position.end=Se(S.end)}function P(S){const I=this.stack[this.stack.length-1];if(this.data.atHardBreak){const M=I.children[I.children.length-1];M.position.end=Se(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(I.type)&&(j.call(this,S),b.call(this,S))}function A(){this.data.atHardBreak=!0}function L(){const S=this.resume(),I=this.stack[this.stack.length-1];I.value=S}function R(){const S=this.resume(),I=this.stack[this.stack.length-1];I.value=S}function F(){const S=this.resume(),I=this.stack[this.stack.length-1];I.value=S}function Y(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const I=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=I,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function X(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const I=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=I,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function se(S){const I=this.sliceSerialize(S),M=this.stack[this.stack.length-2];M.label=Ca(I),M.identifier=he(I).toLowerCase()}function ge(){const S=this.stack[this.stack.length-1],I=this.resume(),M=this.stack[this.stack.length-1];if(this.data.inReference=!0,M.type==="link"){const q=S.children;M.children=q}else M.alt=I}function m(){const S=this.resume(),I=this.stack[this.stack.length-1];I.url=S}function ue(){const S=this.resume(),I=this.stack[this.stack.length-1];I.title=S}function ye(){this.data.inReference=void 0}function d(){this.data.referenceType="collapsed"}function ce(S){const I=this.resume(),M=this.stack[this.stack.length-1];M.label=I,M.identifier=he(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function Te(S){this.data.characterReferenceType=S.type}function Q(S){const I=this.sliceSerialize(S),M=this.data.characterReferenceType;let q;M?(q=vr(I,M==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):q=nn(I);const $=this.stack[this.stack.length-1];$.value+=q}function Be(S){const I=this.stack.pop();I.position.end=Se(S.end)}function we(S){b.call(this,S);const I=this.stack[this.stack.length-1];I.url=this.sliceSerialize(S)}function De(S){b.call(this,S);const I=this.stack[this.stack.length-1];I.url="mailto:"+this.sliceSerialize(S)}function Le(){return{type:"blockquote",children:[]}}function tt(){return{type:"code",lang:null,meta:null,value:""}}function bi(){return{type:"inlineCode",value:""}}function wi(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Si(){return{type:"emphasis",children:[]}}function dn(){return{type:"heading",depth:0,children:[]}}function gn(){return{type:"break"}}function yn(){return{type:"html",value:""}}function Ci(){return{type:"image",title:null,url:"",alt:null}}function kn(){return{type:"link",title:null,url:"",children:[]}}function xn(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function Ei(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function Ti(){return{type:"paragraph",children:[]}}function vi(){return{type:"strong",children:[]}}function Ii(){return{type:"text",value:""}}function Ai(){return{type:"thematicBreak"}}}function Se(e){return{line:e.line,column:e.column,offset:e.offset}}function Fr(e,n){let t=-1;for(;++t<n.length;){const r=n[t];Array.isArray(r)?Fr(e,r):Ia(e,r)}}function Ia(e,n){let t;for(t in n)if(Or.call(n,t))switch(t){case"canContainEols":{const r=n[t];r&&e[t].push(...r);break}case"transforms":{const r=n[t];r&&e[t].push(...r);break}case"enter":case"exit":{const r=n[t];r&&Object.assign(e[t],r);break}}}function Bn(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+We({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+We({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+We({start:n.start,end:n.end})+") is still open")}function Aa(e){const n=this;n.parser=t;function t(r){return Ta(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Pa(e,n){const t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function Da(e,n){const t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
|
|
5
|
-
`}]}function
|
|
6
|
-
`:"",r={};
|
|
7
|
-
`}),
|
|
8
|
-
`});const u={type:"element",tagName:"li",properties:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),T=require("react"),le=require("react-i18next"),se=require("lucide-react"),_e=require("react-hot-toast"),_i=require("@marsidev/react-turnstile"),Ni=require("axios"),dt=require("i18next"),Pi=require("i18next-browser-languagedetector"),Li=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=le.useTranslation(),i=n?.widget_customization?.branding?.company_name||r("widget.title");return x.jsxs("button",{onClick:e,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[x.jsxs("div",{className:"gpc-floating-content",children:[x.jsx(se.MessageCircle,{className:"gpc-floating-icon"}),x.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",i]})]}),t>0&&x.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})},Di=({theme:e,onToggle:t})=>{const{t:n}=le.useTranslation();return x.jsx("button",{onClick:t,className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":n("theme.toggle"),title:n("theme.toggle"),children:e==="light"?x.jsx(se.Moon,{className:"gpc-icon"}):x.jsx(se.Sun,{className:"gpc-icon"})})},zi=()=>{const{i18n:e,t}=le.useTranslation(),n=[{code:"en",label:t("languages.english"),flag:"🇬🇧"},{code:"es",label:t("languages.spanish"),flag:"🇪🇸"},{code:"fr",label:t("languages.french"),flag:"🇫🇷"}],[r,i]=T.useState(!1),s=T.useRef(null),o=n.find(l=>l.code===e.language)||n[0],a=l=>{e.changeLanguage(l),i(!1)};return T.useEffect(()=>{const l=u=>{s.current&&!s.current.contains(u.target)&&i(!1)};return r&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[r]),x.jsxs("div",{className:"gpc-language-selector",ref:s,children:[x.jsx("button",{onClick:()=>i(!r),className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":t("ui.languageSelector.label"),title:t("ui.languageSelector.label"),children:x.jsx(se.Globe,{className:"gpc-icon"})}),r&&x.jsx("div",{className:"gpc-language-dropdown",children:n.map(l=>x.jsxs("button",{onClick:()=>a(l.code),className:`gpc-language-option ${l.code===o.code?"gpc-language-option-active":""}`,children:[x.jsx("span",{className:"gpc-language-flag",children:l.flag}),x.jsx("span",{className:"gpc-language-label",children:l.label})]},l.code))})]})},Ri=({onClose:e,theme:t,onToggleTheme:n,showBranding:r=!0,widgetConfig:i=null,onToggleConversations:s,showConversations:o=!1,conversationsCount:a=0})=>{const{t:l}=le.useTranslation(),u=i?.widget_customization?.branding?.company_name||l("widget.title"),h=i?.widget_customization?.branding?.custom_title,c=i?.widget_customization?.branding?.company_logo_base64,p=h||u,f=c?.startsWith("data:")?c:c?`data:image/png;base64,${c}`:null,d=i?.widget_customization?.colors?.header_background,b=i?.widget_customization?.colors?.header_text,C={};return d&&(C.backgroundColor=d),b&&(C.color=b),x.jsxs("div",{className:"gpc-chat-header",style:C,children:[x.jsxs("div",{className:"gpc-header-content",children:[f&&x.jsx("div",{className:"gpc-header-logo",children:x.jsx("img",{src:f,alt:u,className:"gpc-company-logo"})}),x.jsx("div",{className:"gpc-header-text",children:x.jsx("h2",{className:"gpc-header-title",style:b?{color:b}:{},children:p})})]}),x.jsxs("div",{className:"gpc-header-actions",children:[x.jsx(zi,{}),s&&x.jsxs("button",{onClick:s,className:`gpc-header-button gpc-focus-visible gpc-transition relative ${o?"bg-blue-500 text-white":""}`,"aria-label":l("conversations.toggle","Toggle conversations"),title:l("conversations.toggle","Toggle conversations"),children:[x.jsx(se.MessageSquare,{className:"gpc-icon",size:20}),a>0&&x.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-4 h-4 flex items-center justify-center",children:a>9?"9+":a})]}),x.jsx(Di,{theme:t,onToggle:n}),x.jsx("button",{onClick:e,className:"gpc-header-button gpc-focus-visible gpc-transition","aria-label":l("chat.close"),title:l("chat.close"),children:x.jsx(se.ChevronDown,{className:"gpc-icon"})})]})]})};function Mi(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const ji=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oi=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Fi={};function Cn(e,t){return(Fi.jsx?Oi:ji).test(e)}const Bi=/[ \t\n\f\r]/g;function Ui(e){return typeof e=="object"?e.type==="text"?Sn(e.value):!1:Sn(e)}function Sn(e){return e.replace(Bi,"")===""}class ot{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ot.prototype.normal={};ot.prototype.property={};ot.prototype.space=void 0;function pr(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new ot(n,r,t)}function Vt(e){return e.toLowerCase()}class me{constructor(t,n){this.attribute=n,this.property=t}}me.prototype.attribute="";me.prototype.booleanish=!1;me.prototype.boolean=!1;me.prototype.commaOrSpaceSeparated=!1;me.prototype.commaSeparated=!1;me.prototype.defined=!1;me.prototype.mustUseProperty=!1;me.prototype.number=!1;me.prototype.overloadedBoolean=!1;me.prototype.property="";me.prototype.spaceSeparated=!1;me.prototype.space=void 0;let Hi=0;const U=je(),re=je(),qt=je(),I=je(),Q=je(),Ve=je(),xe=je();function je(){return 2**++Hi}const Wt=Object.freeze(Object.defineProperty({__proto__:null,boolean:U,booleanish:re,commaOrSpaceSeparated:xe,commaSeparated:Ve,number:I,overloadedBoolean:qt,spaceSeparated:Q},Symbol.toStringTag,{value:"Module"})),Tt=Object.keys(Wt);class tn extends me{constructor(t,n,r,i){let s=-1;if(super(t,n),En(this,"space",i),typeof r=="number")for(;++s<Tt.length;){const o=Tt[s];En(this,Tt[s],(r&Wt[o])===Wt[o])}}}tn.prototype.defined=!0;function En(e,t,n){n&&(e[t]=n)}function We(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new tn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Vt(r)]=r,n[Vt(s.attribute)]=r}return new ot(t,n,e.space)}const dr=We({properties:{ariaActiveDescendant:null,ariaAtomic:re,ariaAutoComplete:null,ariaBusy:re,ariaChecked:re,ariaColCount:I,ariaColIndex:I,ariaColSpan:I,ariaControls:Q,ariaCurrent:null,ariaDescribedBy:Q,ariaDetails:null,ariaDisabled:re,ariaDropEffect:Q,ariaErrorMessage:null,ariaExpanded:re,ariaFlowTo:Q,ariaGrabbed:re,ariaHasPopup:null,ariaHidden:re,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Q,ariaLevel:I,ariaLive:null,ariaModal:re,ariaMultiLine:re,ariaMultiSelectable:re,ariaOrientation:null,ariaOwns:Q,ariaPlaceholder:null,ariaPosInSet:I,ariaPressed:re,ariaReadOnly:re,ariaRelevant:null,ariaRequired:re,ariaRoleDescription:Q,ariaRowCount:I,ariaRowIndex:I,ariaRowSpan:I,ariaSelected:re,ariaSetSize:I,ariaSort:null,ariaValueMax:I,ariaValueMin:I,ariaValueNow:I,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mr(e,t){return t in e?e[t]:t}function gr(e,t){return mr(e,t.toLowerCase())}const $i=We({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ve,acceptCharset:Q,accessKey:Q,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:Q,autoFocus:U,autoPlay:U,blocking:Q,capture:null,charSet:null,checked:U,cite:null,className:Q,cols:I,colSpan:null,content:null,contentEditable:re,controls:U,controlsList:Q,coords:I|Ve,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:qt,draggable:re,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:Q,height:I,hidden:qt,high:I,href:null,hrefLang:null,htmlFor:Q,httpEquiv:Q,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:Q,itemRef:Q,itemScope:U,itemType:Q,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:I,manifest:null,max:null,maxLength:I,media:null,method:null,min:null,minLength:I,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:I,pattern:null,ping:Q,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:Q,required:U,reversed:U,rows:I,rowSpan:I,sandbox:Q,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:I,sizes:null,slot:null,span:I,spellCheck:re,src:null,srcDoc:null,srcLang:null,srcSet:null,start:I,step:null,style:null,tabIndex:I,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:re,width:I,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Q,axis:null,background:null,bgColor:null,border:I,borderColor:null,bottomMargin:I,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:I,leftMargin:I,link:null,longDesc:null,lowSrc:null,marginHeight:I,marginWidth:I,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:I,rules:null,scheme:null,scrolling:re,standby:null,summary:null,text:null,topMargin:I,valueType:null,version:null,vAlign:null,vLink:null,vSpace:I,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:I,security:null,unselectable:null},space:"html",transform:gr}),Vi=We({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:xe,accentHeight:I,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:I,amplitude:I,arabicForm:null,ascent:I,attributeName:null,attributeType:null,azimuth:I,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:I,by:null,calcMode:null,capHeight:I,className:Q,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:I,diffuseConstant:I,direction:null,display:null,dur:null,divisor:I,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:I,enableBackground:null,end:null,event:null,exponent:I,externalResourcesRequired:null,fill:null,fillOpacity:I,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ve,g2:Ve,glyphName:Ve,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:I,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:I,horizOriginX:I,horizOriginY:I,id:null,ideographic:I,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:I,k:I,k1:I,k2:I,k3:I,k4:I,kernelMatrix:xe,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:I,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:I,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:I,overlineThickness:I,paintOrder:null,panose1:null,path:null,pathLength:I,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Q,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:I,pointsAtY:I,pointsAtZ:I,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:xe,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:xe,rev:xe,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:xe,requiredFeatures:xe,requiredFonts:xe,requiredFormats:xe,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:I,specularExponent:I,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:I,strikethroughThickness:I,string:null,stroke:null,strokeDashArray:xe,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:I,strokeOpacity:I,strokeWidth:null,style:null,surfaceScale:I,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:xe,tabIndex:I,tableValues:null,target:null,targetX:I,targetY:I,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:xe,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:I,underlineThickness:I,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:I,values:null,vAlphabetic:I,vMathematical:I,vectorEffect:null,vHanging:I,vIdeographic:I,version:null,vertAdvY:I,vertOriginX:I,vertOriginY:I,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:I,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mr}),yr=We({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),xr=We({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gr}),kr=We({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),qi={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Wi=/[A-Z]/g,Tn=/-[a-z]/g,Gi=/^data[-\w.:]+$/i;function Ki(e,t){const n=Vt(t);let r=t,i=me;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Gi.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Tn,Yi);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Tn.test(s)){let o=s.replace(Wi,Xi);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=tn}return new i(r,t)}function Xi(e){return"-"+e.toLowerCase()}function Yi(e){return e.charAt(1).toUpperCase()}const Ji=pr([dr,$i,yr,xr,kr],"html"),nn=pr([dr,Vi,yr,xr,kr],"svg");function Qi(e){return e.join(" ").trim()}function br(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ue={},It,In;function Zi(){if(In)return It;In=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
|
|
2
|
+
`,u="/",h="*",c="",p="comment",f="declaration";It=function(b,C){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];C=C||{};var k=1,v=1;function E(N){var _=N.match(t);_&&(k+=_.length);var M=N.lastIndexOf(l);v=~M?N.length-M:v+N.length}function z(){var N={line:k,column:v};return function(_){return _.position=new P(N),O(),_}}function P(N){this.start=N,this.end={line:k,column:v},this.source=C.source}P.prototype.content=b;function w(N){var _=new Error(C.source+":"+k+":"+v+": "+N);if(_.reason=N,_.filename=C.source,_.line=k,_.column=v,_.source=b,!C.silent)throw _}function R(N){var _=N.exec(b);if(_){var M=_[0];return E(M),b=b.slice(M.length),_}}function O(){R(n)}function F(N){var _;for(N=N||[];_=y();)_!==!1&&N.push(_);return N}function y(){var N=z();if(!(u!=b.charAt(0)||h!=b.charAt(1))){for(var _=2;c!=b.charAt(_)&&(h!=b.charAt(_)||u!=b.charAt(_+1));)++_;if(_+=2,c===b.charAt(_-1))return w("End of comment missing");var M=b.slice(2,_-2);return v+=2,E(M),b=b.slice(_),v+=2,N({type:p,comment:M})}}function A(){var N=z(),_=R(r);if(_){if(y(),!R(i))return w("property missing ':'");var M=R(s),q=N({type:f,property:d(_[0].replace(e,c)),value:M?d(M[0].replace(e,c)):c});return R(o),q}}function D(){var N=[];F(N);for(var _;_=A();)_!==!1&&(N.push(_),F(N));return N}return O(),D()};function d(b){return b?b.replace(a,c):c}return It}var An;function eo(){if(An)return Ue;An=1;var e=Ue&&Ue.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.default=n;const t=e(Zi());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,t.default)(r),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:u,value:h}=l;a?i(u,h,l):h&&(s=s||{},s[u]=h)}),s}return Ue}var Ye={},_n;function to(){if(_n)return Ye;_n=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},o=function(u,h){return h.toUpperCase()},a=function(u,h){return"".concat(h,"-")},l=function(u,h){return h===void 0&&(h={}),s(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,a):u=u.replace(r,a),u.replace(t,o))};return Ye.camelCase=l,Ye}var Je,Nn;function no(){if(Nn)return Je;Nn=1;var e=Je&&Je.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(eo()),n=to();function r(i,s){var o={};return!i||typeof i!="string"||(0,t.default)(i,function(a,l){a&&l&&(o[(0,n.camelCase)(a,s)]=l)}),o}return r.default=r,Je=r,Je}var ro=no();const io=br(ro),wr=vr("end"),rn=vr("start");function vr(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function oo(e){const t=rn(e),n=wr(e);if(t&&n)return{start:t,end:n}}function et(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pn(e.position):"start"in e||"end"in e?Pn(e):"line"in e||"column"in e?Gt(e):""}function Gt(e){return Ln(e&&e.line)+":"+Ln(e&&e.column)}function Pn(e){return Gt(e&&e.start)+"-"+Gt(e&&e.end)}function Ln(e){return e&&typeof e=="number"?e:1}class ce extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=et(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ce.prototype.file="";ce.prototype.name="";ce.prototype.reason="";ce.prototype.message="";ce.prototype.stack="";ce.prototype.column=void 0;ce.prototype.line=void 0;ce.prototype.ancestors=void 0;ce.prototype.cause=void 0;ce.prototype.fatal=void 0;ce.prototype.place=void 0;ce.prototype.ruleId=void 0;ce.prototype.source=void 0;const on={}.hasOwnProperty,so=new Map,ao=/[A-Z]/g,lo=new Set(["table","tbody","thead","tfoot","tr"]),uo=new Set(["td","th"]),Cr="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function co(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ko(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=xo(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?nn:Ji,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=Sr(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function Sr(e,t,n){if(t.type==="element")return ho(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return fo(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mo(e,t,n);if(t.type==="mdxjsEsm")return po(e,t);if(t.type==="root")return go(e,t,n);if(t.type==="text")return yo(e,t)}function ho(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=nn,e.schema=i),e.ancestors.push(t);const s=Tr(e,t.tagName,!1),o=bo(e,t);let a=an(e,t);return lo.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Ui(l):!0})),Er(e,o,s,t),sn(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function fo(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}rt(e,t.position)}function po(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rt(e,t.position)}function mo(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=nn,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:Tr(e,t.name,!0),o=wo(e,t),a=an(e,t);return Er(e,o,s,t),sn(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function go(e,t,n){const r={};return sn(r,an(e,t)),e.create(t,e.Fragment,r,n)}function yo(e,t){return t.value}function Er(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function sn(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xo(e,t,n){return r;function r(i,s,o,a){const u=Array.isArray(o.children)?n:t;return a?u(s,o,a):u(s,o)}}function ko(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=rn(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function bo(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&on.call(t.properties,i)){const s=vo(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&uo.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function wo(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else rt(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else rt(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function an(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:so;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const a=Sr(e,s,o);a!==void 0&&n.push(a)}return n}function vo(e,t,n){const r=Ki(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Mi(n):Qi(n)),r.property==="style"){let i=typeof n=="object"?n:Co(e,String(n));return e.stylePropertyNameCase==="css"&&(i=So(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?qi[r.property]||r.property:r.attribute,n]}}function Co(e,t){try{return io(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ce("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Cr+"#cannot-parse-style-attribute",i}}function Tr(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=Cn(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=Cn(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return on.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);rt(e)}function rt(e,t){const n=new ce("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Cr+"#cannot-handle-mdx-estrees-without-createevaluater",n}function So(e){const t={};let n;for(n in e)on.call(e,n)&&(t[Eo(n)]=e[n]);return t}function Eo(e){let t=e.replace(ao,To);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function To(e){return"-"+e.toLowerCase()}const At={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Io={};function ln(e,t){const n=Io,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ir(e,r,i)}function Ir(e,t,n){if(Ao(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Dn(e.children,t,n)}return Array.isArray(e)?Dn(e,t,n):""}function Dn(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Ir(e[i],t,n);return r.join("")}function Ao(e){return!!(e&&typeof e=="object")}const zn=document.createElement("i");function un(e){const t="&"+e+";";zn.innerHTML=t;const n=zn.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ke(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function be(e,t){return e.length>0?(ke(e,e.length,0,t),e):t}const Rn={}.hasOwnProperty;function Ar(e){const t={};let n=-1;for(;++n<e.length;)_o(t,e[n]);return t}function _o(e,t){let n;for(n in t){const i=(Rn.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){Rn.call(i,o)||(i[o]=[]);const a=s[o];No(i[o],Array.isArray(a)?a:a?[a]:[])}}}function No(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ke(e,0,0,r)}function _r(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ce(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pe=De(/[A-Za-z]/),ue=De(/[\dA-Za-z]/),Po=De(/[#-'*+\--9=?A-Z^-~]/);function gt(e){return e!==null&&(e<32||e===127)}const Kt=De(/\d/),Lo=De(/[\dA-Fa-f]/),Do=De(/[!-/:-@[-`{-~]/);function j(e){return e!==null&&e<-2}function X(e){return e!==null&&(e<0||e===32)}function H(e){return e===-2||e===-1||e===32}const bt=De(new RegExp("\\p{P}|\\p{S}","u")),Me=De(/\s/);function De(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ge(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&ue(e.charCodeAt(n+1))&&ue(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function V(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return H(l)?(e.enter(n),a(l)):t(l)}function a(l){return H(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const zo={tokenize:Ro};function Ro(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),V(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return j(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const Mo={tokenize:jo},Mn={tokenize:Oo};function jo(e){const t=this,n=[];let r=0,i,s,o;return a;function a(E){if(r<n.length){const z=n[r];return t.containerState=z[1],e.attempt(z[0].continuation,l,u)(E)}return u(E)}function l(E){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const z=t.events.length;let P=z,w;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){w=t.events[P][1].end;break}k(r);let R=z;for(;R<t.events.length;)t.events[R][1].end={...w},R++;return ke(t.events,P+1,0,t.events.slice(z)),t.events.length=R,u(E)}return a(E)}function u(E){if(r===n.length){if(!i)return p(E);if(i.currentConstruct&&i.currentConstruct.concrete)return d(E);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Mn,h,c)(E)}function h(E){return i&&v(),k(r),p(E)}function c(E){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,d(E)}function p(E){return t.containerState={},e.attempt(Mn,f,d)(E)}function f(E){return r++,n.push([t.currentConstruct,t.containerState]),p(E)}function d(E){if(E===null){i&&v(),k(0),e.consume(E);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),b(E)}function b(E){if(E===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(E);return}return j(E)?(e.consume(E),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(E),b)}function C(E,z){const P=t.sliceStream(E);if(z&&P.push(null),E.previous=s,s&&(s.next=E),s=E,i.defineSkip(E.start),i.write(P),t.parser.lazy[E.start.line]){let w=i.events.length;for(;w--;)if(i.events[w][1].start.offset<o&&(!i.events[w][1].end||i.events[w][1].end.offset>o))return;const R=t.events.length;let O=R,F,y;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(F){y=t.events[O][1].end;break}F=!0}for(k(r),w=R;w<t.events.length;)t.events[w][1].end={...y},w++;ke(t.events,O+1,0,t.events.slice(R)),t.events.length=w}}function k(E){let z=n.length;for(;z-- >E;){const P=n[z];t.containerState=P[1],P[0].exit.call(t,e)}n.length=E}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Oo(e,t,n){return V(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qe(e){if(e===null||X(e)||Me(e))return 1;if(bt(e))return 2}function wt(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Xt={name:"attention",resolveAll:Fo,tokenize:Bo};function Fo(e,t){let n=-1,r,i,s,o,a,l,u,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const c={...e[r][1].end},p={...e[n][1].start};jn(c,-l),jn(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:c,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=be(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=be(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),u=be(u,wt(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=be(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,u=be(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,ke(e,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Bo(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=qe(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const u=e.exit("attentionSequence"),h=qe(l),c=!h||h===2&&i||n.includes(l),p=!i||i===2&&h||n.includes(r);return u._open=!!(s===42?c:c&&(i||!p)),u._close=!!(s===42?p:p&&(h||!c)),t(l)}}function jn(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Uo={name:"autolink",tokenize:Ho};function Ho(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return pe(f)?(e.consume(f),o):f===64?n(f):u(f)}function o(f){return f===43||f===45||f===46||ue(f)?(r=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||ue(f))&&r++<32?(e.consume(f),a):(r=0,u(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||gt(f)?n(f):(e.consume(f),l)}function u(f){return f===64?(e.consume(f),h):Po(f)?(e.consume(f),u):n(f)}function h(f){return ue(f)?c(f):n(f)}function c(f){return f===46?(e.consume(f),r=0,h):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||ue(f))&&r++<63){const d=f===45?p:c;return e.consume(f),d}return n(f)}}const st={partial:!0,tokenize:$o};function $o(e,t,n){return r;function r(s){return H(s)?V(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||j(s)?t(s):n(s)}}const Nr={continuation:{tokenize:qo},exit:Wo,name:"blockQuote",tokenize:Vo};function Vo(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return H(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function qo(e,t,n){const r=this;return i;function i(o){return H(o)?V(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(Nr,t,n)(o)}}function Wo(e){e.exit("blockQuote")}const Pr={name:"characterEscape",tokenize:Go};function Go(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return Do(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const Lr={name:"characterReference",tokenize:Ko};function Ko(e,t,n){const r=this;let i=0,s,o;return a;function a(c){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),l}function l(c){return c===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(c),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,o=ue,h(c))}function u(c){return c===88||c===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(c),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=Lo,h):(e.enter("characterReferenceValue"),s=7,o=Kt,h(c))}function h(c){if(c===59&&i){const p=e.exit("characterReferenceValue");return o===ue&&!un(r.sliceSerialize(p))?n(c):(e.enter("characterReferenceMarker"),e.consume(c),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(c)&&i++<s?(e.consume(c),h):n(c)}}const On={partial:!0,tokenize:Yo},Fn={concrete:!0,name:"codeFenced",tokenize:Xo};function Xo(e,t,n){const r=this,i={partial:!0,tokenize:P};let s=0,o=0,a;return l;function l(w){return u(w)}function u(w){const R=r.events[r.events.length-1];return s=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,a=w,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(w)}function h(w){return w===a?(o++,e.consume(w),h):o<3?n(w):(e.exit("codeFencedFenceSequence"),H(w)?V(e,c,"whitespace")(w):c(w))}function c(w){return w===null||j(w)?(e.exit("codeFencedFence"),r.interrupt?t(w):e.check(On,b,z)(w)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||j(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(w)):H(w)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),V(e,f,"whitespace")(w)):w===96&&w===a?n(w):(e.consume(w),p)}function f(w){return w===null||j(w)?c(w):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),d(w))}function d(w){return w===null||j(w)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(w)):w===96&&w===a?n(w):(e.consume(w),d)}function b(w){return e.attempt(i,z,C)(w)}function C(w){return e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),k}function k(w){return s>0&&H(w)?V(e,v,"linePrefix",s+1)(w):v(w)}function v(w){return w===null||j(w)?e.check(On,b,z)(w):(e.enter("codeFlowValue"),E(w))}function E(w){return w===null||j(w)?(e.exit("codeFlowValue"),v(w)):(e.consume(w),E)}function z(w){return e.exit("codeFenced"),t(w)}function P(w,R,O){let F=0;return y;function y(M){return w.enter("lineEnding"),w.consume(M),w.exit("lineEnding"),A}function A(M){return w.enter("codeFencedFence"),H(M)?V(w,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):D(M)}function D(M){return M===a?(w.enter("codeFencedFenceSequence"),N(M)):O(M)}function N(M){return M===a?(F++,w.consume(M),N):F>=o?(w.exit("codeFencedFenceSequence"),H(M)?V(w,_,"whitespace")(M):_(M)):O(M)}function _(M){return M===null||j(M)?(w.exit("codeFencedFence"),R(M)):O(M)}}}function Yo(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const _t={name:"codeIndented",tokenize:Qo},Jo={partial:!0,tokenize:Zo};function Qo(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),V(e,s,"linePrefix",5)(u)}function s(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):j(u)?e.attempt(Jo,o,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||j(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function Zo(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):j(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):V(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):j(o)?i(o):n(o)}}const es={name:"codeText",previous:ns,resolve:ts,tokenize:rs};function ts(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ns(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function rs(e,t,n){let r=0,i,s;return o;function o(c){return e.enter("codeText"),e.enter("codeTextSequence"),a(c)}function a(c){return c===96?(e.consume(c),r++,a):(e.exit("codeTextSequence"),l(c))}function l(c){return c===null?n(c):c===32?(e.enter("space"),e.consume(c),e.exit("space"),l):c===96?(s=e.enter("codeTextSequence"),i=0,h(c)):j(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(c))}function u(c){return c===null||c===32||c===96||j(c)?(e.exit("codeTextData"),l(c)):(e.consume(c),u)}function h(c){return c===96?(e.consume(c),i++,h):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(c)):(s.type="codeTextData",u(c))}}class is{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Qe(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qe(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qe(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qe(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qe(this.left,n.reverse())}}}function Qe(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Dr(e){const t={};let n=-1,r,i,s,o,a,l,u;const h=new is(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(r=h.get(n),n&&r[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,os(h,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=h.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...h.get(i)[1].start},a=h.slice(i,n),a.unshift(r),h.splice(i,n-i+1,a))}}return ke(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!u}function os(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let h,c,p=-1,f=n,d=0,b=0;const C=[b];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(h=r.sliceStream(f),f.next||h.push(null),c&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(h),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),c=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(b=p+1,C.push(b),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):C.pop(),p=C.length;p--;){const k=a.slice(C[p],C[p+1]),v=s.pop();l.push([v,v+k.length-1]),e.splice(v,2,k)}for(l.reverse(),p=-1;++p<l.length;)u[d+l[p][0]]=d+l[p][1],d+=l[p][1]-l[p][0]-1;return u}const ss={resolve:ls,tokenize:us},as={partial:!0,tokenize:cs};function ls(e){return Dr(e),e}function us(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):j(a)?e.check(as,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function cs(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),V(e,s,"linePrefix")}function s(o){if(o===null||j(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function zr(e,t,n,r,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let h=0;return c;function c(k){return k===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(k),e.exit(s),p):k===null||k===32||k===41||gt(k)?n(k):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(k))}function p(k){return k===62?(e.enter(s),e.consume(k),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===62?(e.exit("chunkString"),e.exit(a),p(k)):k===null||k===60||j(k)?n(k):(e.consume(k),k===92?d:f)}function d(k){return k===60||k===62||k===92?(e.consume(k),f):f(k)}function b(k){return!h&&(k===null||k===41||X(k))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(k)):h<u&&k===40?(e.consume(k),h++,b):k===41?(e.consume(k),h--,b):k===null||k===32||k===40||gt(k)?n(k):(e.consume(k),k===92?C:b)}function C(k){return k===40||k===41||k===92?(e.consume(k),b):b(k)}}function Rr(e,t,n,r,i,s){const o=this;let a=0,l;return u;function u(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),h}function h(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):j(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===null||f===91||f===93||j(f)||a++>999?(e.exit("chunkString"),h(f)):(e.consume(f),l||(l=!H(f)),f===92?p:c)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,c):c(f)}}function Mr(e,t,n,r,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),o=p===40?41:p,l):n(p)}function l(p){return p===o?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===o?(e.exit(s),l(o)):p===null?n(p):j(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),V(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===o||p===null||j(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?c:h)}function c(p){return p===o||p===92?(e.consume(p),h):h(p)}}function tt(e,t){let n;return r;function r(i){return j(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):H(i)?V(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const hs={name:"definition",tokenize:ps},fs={partial:!0,tokenize:ds};function ps(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return Rr.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=Ce(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return X(f)?tt(e,u)(f):u(f)}function u(f){return zr(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function h(f){return e.attempt(fs,c,c)(f)}function c(f){return H(f)?V(e,p,"whitespace")(f):p(f)}function p(f){return f===null||j(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function ds(e,t,n){return r;function r(a){return X(a)?tt(e,i)(a):n(a)}function i(a){return Mr(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return H(a)?V(e,o,"whitespace")(a):o(a)}function o(a){return a===null||j(a)?t(a):n(a)}}const ms={name:"hardBreakEscape",tokenize:gs};function gs(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return j(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const ys={name:"headingAtx",resolve:xs,tokenize:ks};function xs(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ke(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function ks(e,t,n){let r=0;return i;function i(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(e.consume(h),o):h===null||X(h)?(e.exit("atxHeadingSequence"),a(h)):n(h)}function a(h){return h===35?(e.enter("atxHeadingSequence"),l(h)):h===null||j(h)?(e.exit("atxHeading"),t(h)):H(h)?V(e,a,"whitespace")(h):(e.enter("atxHeadingText"),u(h))}function l(h){return h===35?(e.consume(h),l):(e.exit("atxHeadingSequence"),a(h))}function u(h){return h===null||h===35||X(h)?(e.exit("atxHeadingText"),a(h)):(e.consume(h),u)}}const bs=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Bn=["pre","script","style","textarea"],ws={concrete:!0,name:"htmlFlow",resolveTo:Ss,tokenize:Es},vs={partial:!0,tokenize:Is},Cs={partial:!0,tokenize:Ts};function Ss(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Es(e,t,n){const r=this;let i,s,o,a,l;return u;function u(g){return h(g)}function h(g){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),p):g===47?(e.consume(g),s=!0,b):g===63?(e.consume(g),i=3,r.interrupt?t:m):pe(g)?(e.consume(g),o=String.fromCharCode(g),C):n(g)}function p(g){return g===45?(e.consume(g),i=2,f):g===91?(e.consume(g),i=5,a=0,d):pe(g)?(e.consume(g),i=4,r.interrupt?t:m):n(g)}function f(g){return g===45?(e.consume(g),r.interrupt?t:m):n(g)}function d(g){const fe="CDATA[";return g===fe.charCodeAt(a++)?(e.consume(g),a===fe.length?r.interrupt?t:D:d):n(g)}function b(g){return pe(g)?(e.consume(g),o=String.fromCharCode(g),C):n(g)}function C(g){if(g===null||g===47||g===62||X(g)){const fe=g===47,we=o.toLowerCase();return!fe&&!s&&Bn.includes(we)?(i=1,r.interrupt?t(g):D(g)):bs.includes(o.toLowerCase())?(i=6,fe?(e.consume(g),k):r.interrupt?t(g):D(g)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(g):s?v(g):E(g))}return g===45||ue(g)?(e.consume(g),o+=String.fromCharCode(g),C):n(g)}function k(g){return g===62?(e.consume(g),r.interrupt?t:D):n(g)}function v(g){return H(g)?(e.consume(g),v):y(g)}function E(g){return g===47?(e.consume(g),y):g===58||g===95||pe(g)?(e.consume(g),z):H(g)?(e.consume(g),E):y(g)}function z(g){return g===45||g===46||g===58||g===95||ue(g)?(e.consume(g),z):P(g)}function P(g){return g===61?(e.consume(g),w):H(g)?(e.consume(g),P):E(g)}function w(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),l=g,R):H(g)?(e.consume(g),w):O(g)}function R(g){return g===l?(e.consume(g),l=null,F):g===null||j(g)?n(g):(e.consume(g),R)}function O(g){return g===null||g===34||g===39||g===47||g===60||g===61||g===62||g===96||X(g)?P(g):(e.consume(g),O)}function F(g){return g===47||g===62||H(g)?E(g):n(g)}function y(g){return g===62?(e.consume(g),A):n(g)}function A(g){return g===null||j(g)?D(g):H(g)?(e.consume(g),A):n(g)}function D(g){return g===45&&i===2?(e.consume(g),q):g===60&&i===1?(e.consume(g),Z):g===62&&i===4?(e.consume(g),he):g===63&&i===3?(e.consume(g),m):g===93&&i===5?(e.consume(g),ie):j(g)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(vs,ge,N)(g)):g===null||j(g)?(e.exit("htmlFlowData"),N(g)):(e.consume(g),D)}function N(g){return e.check(Cs,_,ge)(g)}function _(g){return e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),M}function M(g){return g===null||j(g)?N(g):(e.enter("htmlFlowData"),D(g))}function q(g){return g===45?(e.consume(g),m):D(g)}function Z(g){return g===47?(e.consume(g),o="",ae):D(g)}function ae(g){if(g===62){const fe=o.toLowerCase();return Bn.includes(fe)?(e.consume(g),he):D(g)}return pe(g)&&o.length<8?(e.consume(g),o+=String.fromCharCode(g),ae):D(g)}function ie(g){return g===93?(e.consume(g),m):D(g)}function m(g){return g===62?(e.consume(g),he):g===45&&i===2?(e.consume(g),m):D(g)}function he(g){return g===null||j(g)?(e.exit("htmlFlowData"),ge(g)):(e.consume(g),he)}function ge(g){return e.exit("htmlFlow"),t(g)}}function Ts(e,t,n){const r=this;return i;function i(o){return j(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function Is(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(st,t,n)}}const As={name:"htmlText",tokenize:_s};function _s(e,t,n){const r=this;let i,s,o;return a;function a(m){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(m),l}function l(m){return m===33?(e.consume(m),u):m===47?(e.consume(m),P):m===63?(e.consume(m),E):pe(m)?(e.consume(m),O):n(m)}function u(m){return m===45?(e.consume(m),h):m===91?(e.consume(m),s=0,d):pe(m)?(e.consume(m),v):n(m)}function h(m){return m===45?(e.consume(m),f):n(m)}function c(m){return m===null?n(m):m===45?(e.consume(m),p):j(m)?(o=c,Z(m)):(e.consume(m),c)}function p(m){return m===45?(e.consume(m),f):c(m)}function f(m){return m===62?q(m):m===45?p(m):c(m)}function d(m){const he="CDATA[";return m===he.charCodeAt(s++)?(e.consume(m),s===he.length?b:d):n(m)}function b(m){return m===null?n(m):m===93?(e.consume(m),C):j(m)?(o=b,Z(m)):(e.consume(m),b)}function C(m){return m===93?(e.consume(m),k):b(m)}function k(m){return m===62?q(m):m===93?(e.consume(m),k):b(m)}function v(m){return m===null||m===62?q(m):j(m)?(o=v,Z(m)):(e.consume(m),v)}function E(m){return m===null?n(m):m===63?(e.consume(m),z):j(m)?(o=E,Z(m)):(e.consume(m),E)}function z(m){return m===62?q(m):E(m)}function P(m){return pe(m)?(e.consume(m),w):n(m)}function w(m){return m===45||ue(m)?(e.consume(m),w):R(m)}function R(m){return j(m)?(o=R,Z(m)):H(m)?(e.consume(m),R):q(m)}function O(m){return m===45||ue(m)?(e.consume(m),O):m===47||m===62||X(m)?F(m):n(m)}function F(m){return m===47?(e.consume(m),q):m===58||m===95||pe(m)?(e.consume(m),y):j(m)?(o=F,Z(m)):H(m)?(e.consume(m),F):q(m)}function y(m){return m===45||m===46||m===58||m===95||ue(m)?(e.consume(m),y):A(m)}function A(m){return m===61?(e.consume(m),D):j(m)?(o=A,Z(m)):H(m)?(e.consume(m),A):F(m)}function D(m){return m===null||m===60||m===61||m===62||m===96?n(m):m===34||m===39?(e.consume(m),i=m,N):j(m)?(o=D,Z(m)):H(m)?(e.consume(m),D):(e.consume(m),_)}function N(m){return m===i?(e.consume(m),i=void 0,M):m===null?n(m):j(m)?(o=N,Z(m)):(e.consume(m),N)}function _(m){return m===null||m===34||m===39||m===60||m===61||m===96?n(m):m===47||m===62||X(m)?F(m):(e.consume(m),_)}function M(m){return m===47||m===62||X(m)?F(m):n(m)}function q(m){return m===62?(e.consume(m),e.exit("htmlTextData"),e.exit("htmlText"),t):n(m)}function Z(m){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),ae}function ae(m){return H(m)?V(e,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(m):ie(m)}function ie(m){return e.enter("htmlTextData"),o(m)}}const cn={name:"labelEnd",resolveAll:Ds,resolveTo:zs,tokenize:Rs},Ns={tokenize:Ms},Ps={tokenize:js},Ls={tokenize:Os};function Ds(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&ke(e,0,e.length,n),e}function zs(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},h={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",u,t]],a=be(a,e.slice(s+1,s+r+3)),a=be(a,[["enter",h,t]]),a=be(a,wt(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=be(a,[["exit",h,t],e[o-2],e[o-1],["exit",u,t]]),a=be(a,e.slice(o+1)),a=be(a,[["exit",l,t]]),ke(e,s,e.length,a),e}function Rs(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(p){return s?s._inactive?c(p):(o=r.parser.defined.includes(Ce(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(Ns,h,o?h:c)(p):p===91?e.attempt(Ps,h,o?u:c)(p):o?h(p):c(p)}function u(p){return e.attempt(Ls,h,c)(p)}function h(p){return t(p)}function c(p){return s._balanced=!0,n(p)}}function Ms(e,t,n){return r;function r(c){return e.enter("resource"),e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),i}function i(c){return X(c)?tt(e,s)(c):s(c)}function s(c){return c===41?h(c):zr(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(c)}function o(c){return X(c)?tt(e,l)(c):h(c)}function a(c){return n(c)}function l(c){return c===34||c===39||c===40?Mr(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(c):h(c)}function u(c){return X(c)?tt(e,h)(c):h(c)}function h(c){return c===41?(e.enter("resourceMarker"),e.consume(c),e.exit("resourceMarker"),e.exit("resource"),t):n(c)}}function js(e,t,n){const r=this;return i;function i(a){return Rr.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Ce(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function Os(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Fs={name:"labelStartImage",resolveAll:cn.resolveAll,tokenize:Bs};function Bs(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Us={name:"labelStartLink",resolveAll:cn.resolveAll,tokenize:Hs};function Hs(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Nt={name:"lineEnding",tokenize:$s};function $s(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),V(e,t,"linePrefix")}}const mt={name:"thematicBreak",tokenize:Vs};function Vs(e,t,n){let r=0,i;return s;function s(u){return e.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||j(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),H(u)?V(e,a,"whitespace")(u):a(u))}}const de={continuation:{tokenize:Ks},exit:Ys,name:"list",tokenize:Gs},qs={partial:!0,tokenize:Js},Ws={partial:!0,tokenize:Xs};function Gs(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const d=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(d==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:Kt(f)){if(r.containerState.type||(r.containerState.type=d,e.enter(d,{_container:!0})),d==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(mt,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return Kt(f)&&++o<10?(e.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(st,r.interrupt?n:h,e.attempt(qs,p,c))}function h(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function c(f){return H(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Ks(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(st,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,V(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!H(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ws,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,V(e,e.attempt(de,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Xs(e,t,n){const r=this;return V(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function Ys(e){e.exit(this.containerState.type)}function Js(e,t,n){const r=this;return V(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!H(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Un={name:"setextUnderline",resolveTo:Qs,tokenize:Zs};function Qs(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Zs(e,t,n){const r=this;let i;return s;function s(u){let h=r.events.length,c;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){c=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||c)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),H(u)?V(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||j(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ea={tokenize:ta};function ta(e){const t=this,n=e.attempt(st,r,e.attempt(this.parser.constructs.flowInitial,i,V(e,e.attempt(this.parser.constructs.flow,i,e.attempt(ss,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const na={resolveAll:Or()},ra=jr("string"),ia=jr("text");function jr(e){return{resolveAll:Or(e==="text"?oa:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(h){return u(h)?s(h):a(h)}function a(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),l}function l(h){return u(h)?(n.exit("data"),s(h)):(n.consume(h),l)}function u(h){if(h===null)return!0;const c=i[h];let p=-1;if(c)for(;++p<c.length;){const f=c[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Or(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function oa(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const sa={42:de,43:de,45:de,48:de,49:de,50:de,51:de,52:de,53:de,54:de,55:de,56:de,57:de,62:Nr},aa={91:hs},la={[-2]:_t,[-1]:_t,32:_t},ua={35:ys,42:mt,45:[Un,mt],60:ws,61:Un,95:mt,96:Fn,126:Fn},ca={38:Lr,92:Pr},ha={[-5]:Nt,[-4]:Nt,[-3]:Nt,33:Fs,38:Lr,42:Xt,60:[Uo,As],91:Us,92:[ms,Pr],93:cn,95:Xt,96:es},fa={null:[Xt,na]},pa={null:[42,95]},da={null:[]},ma=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:pa,contentInitial:aa,disable:da,document:sa,flow:ua,flowInitial:la,insideSpan:fa,string:ca,text:ha},Symbol.toStringTag,{value:"Module"}));function ga(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:R(P),check:R(w),consume:v,enter:E,exit:z,interrupt:R(w,{interrupt:!0})},u={code:null,containerState:{},defineSkip:b,events:[],now:d,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:c};let h=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function c(A){return o=be(o,A),C(),o[o.length-1]!==null?[]:(O(t,0),u.events=wt(s,u.events,u),u.events)}function p(A,D){return xa(f(A),D)}function f(A){return ya(o,A)}function d(){const{_bufferIndex:A,_index:D,line:N,column:_,offset:M}=r;return{_bufferIndex:A,_index:D,line:N,column:_,offset:M}}function b(A){i[A.line]=A.column,y()}function C(){let A;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(A=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===A&&r._bufferIndex<D.length;)k(D.charCodeAt(r._bufferIndex));else k(D)}}function k(A){h=h(A)}function v(A){j(A)?(r.line++,r.column=1,r.offset+=A===-3?2:1,y()):A!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=A}function E(A,D){const N=D||{};return N.type=A,N.start=d(),u.events.push(["enter",N,u]),a.push(N),N}function z(A){const D=a.pop();return D.end=d(),u.events.push(["exit",D,u]),D}function P(A,D){O(A,D.from)}function w(A,D){D.restore()}function R(A,D){return N;function N(_,M,q){let Z,ae,ie,m;return Array.isArray(_)?ge(_):"tokenize"in _?ge([_]):he(_);function he(ee){return W;function W(G){const Y=G!==null&&ee[G],oe=G!==null&&ee.null,J=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return ge(J)(G)}}function ge(ee){return Z=ee,ae=0,ee.length===0?q:g(ee[ae])}function g(ee){return W;function W(G){return m=F(),ie=ee,ee.partial||(u.currentConstruct=ee),ee.name&&u.parser.constructs.disable.null.includes(ee.name)?we():ee.tokenize.call(D?Object.assign(Object.create(u),D):u,l,fe,we)(G)}}function fe(ee){return A(ie,m),M}function we(ee){return m.restore(),++ae<Z.length?g(Z[ae]):q}}}function O(A,D){A.resolveAll&&!s.includes(A)&&s.push(A),A.resolve&&ke(u.events,D,u.events.length-D,A.resolve(u.events.slice(D),u)),A.resolveTo&&(u.events=A.resolveTo(u.events,u))}function F(){const A=d(),D=u.previous,N=u.currentConstruct,_=u.events.length,M=Array.from(a);return{from:_,restore:q};function q(){r=A,u.previous=D,u.currentConstruct=N,u.events.length=_,a=M,y()}}function y(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ya(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function xa(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
3
|
+
`;break}case-3:{o=`\r
|
|
4
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function ka(e){const r={constructs:Ar([ma,...(e||{}).extensions||[]]),content:i(zo),defined:[],document:i(Mo),flow:i(ea),lazy:{},string:i(ra),text:i(ia)};return r;function i(s){return o;function o(a){return ga(r,s,a)}}}function ba(e){for(;!Dr(e););return e}const Hn=/[\0\t\n\r]/g;function wa(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let u,h,c,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),c=0,t="",n&&(s.charCodeAt(0)===65279&&c++,n=void 0);c<s.length;){if(Hn.lastIndex=c,u=Hn.exec(s),p=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(p),!u){t=s.slice(c);break}if(f===10&&c===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),c<p&&(l.push(s.slice(c,p)),e+=p-c),f){case 0:{l.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,l.push(-2);e++<h;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}c=p+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const va=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Ca(e){return e.replace(va,Sa)}function Sa(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return _r(n.slice(s?2:1),s?16:10)}return un(n)||e}const Fr={}.hasOwnProperty;function Ea(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Ta(n)(ba(ka(n).document().write(wa()(e,t,!0))))}function Ta(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(wn),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(Oe),blockQuote:s(oe),characterEscape:F,characterReference:F,codeFenced:s(J),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(J,o),codeText:s(te,o),codeTextData:F,data:F,codeFlowValue:F,definition:s(ne),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Te),hardBreakEscape:s(lt),hardBreakTrailing:s(lt),htmlFlow:s(Fe,o),htmlFlowData:F,htmlText:s(Fe,o),htmlTextData:F,image:s(Et),label:o,link:s(wn),listItem:s(Si),listItemValue:p,listOrdered:s(vn,c),listUnordered:s(vn),paragraph:s(Ei),reference:g,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Oe),strong:s(Ti),thematicBreak:s(Ai)},exit:{atxHeading:l(),atxHeadingSequence:P,autolink:l(),autolinkEmail:Y,autolinkProtocol:G,blockQuote:l(),characterEscapeValue:y,characterReferenceMarkerHexadecimal:we,characterReferenceMarkerNumeric:we,characterReferenceValue:ee,characterReference:W,codeFenced:l(C),codeFencedFence:b,codeFencedFenceInfo:f,codeFencedFenceMeta:d,codeFlowValue:y,codeIndented:l(k),codeText:l(M),codeTextData:y,data:y,definition:l(),definitionDestinationString:z,definitionLabelString:v,definitionTitleString:E,emphasis:l(),hardBreakEscape:l(D),hardBreakTrailing:l(D),htmlFlow:l(N),htmlFlowData:y,htmlText:l(_),htmlTextData:y,image:l(Z),label:ie,labelText:ae,lineEnding:A,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:fe,resourceDestinationString:m,resourceTitleString:he,resource:ge,setextHeading:l(O),setextHeadingLineSequence:R,setextHeadingText:w,strong:l(),thematicBreak:l()}};Br(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(S){let L={type:"root",children:[]};const B={stack:[L],tokenStack:[],config:t,enter:a,exit:u,buffer:o,resume:h,data:n},$=[];let K=-1;for(;++K<S.length;)if(S[K][1].type==="listOrdered"||S[K][1].type==="listUnordered")if(S[K][0]==="enter")$.push(K);else{const ve=$.pop();K=i(S,ve,K)}for(K=-1;++K<S.length;){const ve=t[S[K][0]];Fr.call(ve,S[K][1].type)&&ve[S[K][1].type].call(Object.assign({sliceSerialize:S[K][2].sliceSerialize},B),S[K][1])}if(B.tokenStack.length>0){const ve=B.tokenStack[B.tokenStack.length-1];(ve[1]||$n).call(B,void 0,ve[0])}for(L.position={start:Pe(S.length>0?S[0][1].start:{line:1,column:1,offset:0}),end:Pe(S.length>0?S[S.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K<t.transforms.length;)L=t.transforms[K](L)||L;return L}function i(S,L,B){let $=L-1,K=-1,ve=!1,ze,Ie,Ke,Xe;for(;++$<=B;){const ye=S[$];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?K++:K--,Xe=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(ze&&!Xe&&!K&&!Ke&&(Ke=$),Xe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Xe=void 0}if(!K&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||K===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(ze){let Be=$;for(Ie=void 0;Be--;){const Ae=S[Be];if(Ae[1].type==="lineEnding"||Ae[1].type==="lineEndingBlank"){if(Ae[0]==="exit")continue;Ie&&(S[Ie][1].type="lineEndingBlank",ve=!0),Ae[1].type="lineEnding",Ie=Be}else if(!(Ae[1].type==="linePrefix"||Ae[1].type==="blockQuotePrefix"||Ae[1].type==="blockQuotePrefixWhitespace"||Ae[1].type==="blockQuoteMarker"||Ae[1].type==="listItemIndent"))break}Ke&&(!Ie||Ke<Ie)&&(ze._spread=!0),ze.end=Object.assign({},Ie?S[Ie][1].start:ye[1].end),S.splice(Ie||$,0,["exit",ze,ye[2]]),$++,B++}if(ye[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};ze=Be,S.splice($,0,["enter",Be,ye[2]]),$++,B++,Ke=void 0,Xe=!0}}}return S[L][1]._spread=ve,B}function s(S,L){return B;function B($){a.call(this,S($),$),L&&L.call(this,$)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(S,L,B){this.stack[this.stack.length-1].children.push(S),this.stack.push(S),this.tokenStack.push([L,B||void 0]),S.position={start:Pe(L.start),end:void 0}}function l(S){return L;function L(B){S&&S.call(this,B),u.call(this,B)}}function u(S,L){const B=this.stack.pop(),$=this.tokenStack.pop();if($)$[0].type!==S.type&&(L?L.call(this,S,$[0]):($[1]||$n).call(this,S,$[0]));else throw new Error("Cannot close `"+S.type+"` ("+et({start:S.start,end:S.end})+"): it’s not open");B.position.end=Pe(S.end)}function h(){return ln(this.stack.pop())}function c(){this.data.expectingFirstListItemValue=!0}function p(S){if(this.data.expectingFirstListItemValue){const L=this.stack[this.stack.length-2];L.start=Number.parseInt(this.sliceSerialize(S),10),this.data.expectingFirstListItemValue=void 0}}function f(){const S=this.resume(),L=this.stack[this.stack.length-1];L.lang=S}function d(){const S=this.resume(),L=this.stack[this.stack.length-1];L.meta=S}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const S=this.resume(),L=this.stack[this.stack.length-1];L.value=S.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const S=this.resume(),L=this.stack[this.stack.length-1];L.value=S.replace(/(\r?\n|\r)$/g,"")}function v(S){const L=this.resume(),B=this.stack[this.stack.length-1];B.label=L,B.identifier=Ce(this.sliceSerialize(S)).toLowerCase()}function E(){const S=this.resume(),L=this.stack[this.stack.length-1];L.title=S}function z(){const S=this.resume(),L=this.stack[this.stack.length-1];L.url=S}function P(S){const L=this.stack[this.stack.length-1];if(!L.depth){const B=this.sliceSerialize(S).length;L.depth=B}}function w(){this.data.setextHeadingSlurpLineEnding=!0}function R(S){const L=this.stack[this.stack.length-1];L.depth=this.sliceSerialize(S).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function F(S){const B=this.stack[this.stack.length-1].children;let $=B[B.length-1];(!$||$.type!=="text")&&($=Ii(),$.position={start:Pe(S.start),end:void 0},B.push($)),this.stack.push($)}function y(S){const L=this.stack.pop();L.value+=this.sliceSerialize(S),L.position.end=Pe(S.end)}function A(S){const L=this.stack[this.stack.length-1];if(this.data.atHardBreak){const B=L.children[L.children.length-1];B.position.end=Pe(S.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(L.type)&&(F.call(this,S),y.call(this,S))}function D(){this.data.atHardBreak=!0}function N(){const S=this.resume(),L=this.stack[this.stack.length-1];L.value=S}function _(){const S=this.resume(),L=this.stack[this.stack.length-1];L.value=S}function M(){const S=this.resume(),L=this.stack[this.stack.length-1];L.value=S}function q(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=L,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function Z(){const S=this.stack[this.stack.length-1];if(this.data.inReference){const L=this.data.referenceType||"shortcut";S.type+="Reference",S.referenceType=L,delete S.url,delete S.title}else delete S.identifier,delete S.label;this.data.referenceType=void 0}function ae(S){const L=this.sliceSerialize(S),B=this.stack[this.stack.length-2];B.label=Ca(L),B.identifier=Ce(L).toLowerCase()}function ie(){const S=this.stack[this.stack.length-1],L=this.resume(),B=this.stack[this.stack.length-1];if(this.data.inReference=!0,B.type==="link"){const $=S.children;B.children=$}else B.alt=L}function m(){const S=this.resume(),L=this.stack[this.stack.length-1];L.url=S}function he(){const S=this.resume(),L=this.stack[this.stack.length-1];L.title=S}function ge(){this.data.inReference=void 0}function g(){this.data.referenceType="collapsed"}function fe(S){const L=this.resume(),B=this.stack[this.stack.length-1];B.label=L,B.identifier=Ce(this.sliceSerialize(S)).toLowerCase(),this.data.referenceType="full"}function we(S){this.data.characterReferenceType=S.type}function ee(S){const L=this.sliceSerialize(S),B=this.data.characterReferenceType;let $;B?($=_r(L,B==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$=un(L);const K=this.stack[this.stack.length-1];K.value+=$}function W(S){const L=this.stack.pop();L.position.end=Pe(S.end)}function G(S){y.call(this,S);const L=this.stack[this.stack.length-1];L.url=this.sliceSerialize(S)}function Y(S){y.call(this,S);const L=this.stack[this.stack.length-1];L.url="mailto:"+this.sliceSerialize(S)}function oe(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function te(){return{type:"inlineCode",value:""}}function ne(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Te(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function lt(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Et(){return{type:"image",title:null,url:"",alt:null}}function wn(){return{type:"link",title:null,url:"",children:[]}}function vn(S){return{type:"list",ordered:S.type==="listOrdered",start:null,spread:S._spread,children:[]}}function Si(S){return{type:"listItem",spread:S._spread,checked:null,children:[]}}function Ei(){return{type:"paragraph",children:[]}}function Ti(){return{type:"strong",children:[]}}function Ii(){return{type:"text",value:""}}function Ai(){return{type:"thematicBreak"}}}function Pe(e){return{line:e.line,column:e.column,offset:e.offset}}function Br(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Br(e,r):Ia(e,r)}}function Ia(e,t){let n;for(n in t)if(Fr.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function $n(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+et({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+et({start:t.start,end:t.end})+") is still open")}function Aa(e){const t=this;t.parser=n;function n(r){return Ea(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _a(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Na(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
5
|
+
`}]}function Pa(e,t){const n=t.value?t.value+`
|
|
6
|
+
`:"",r={};t.lang&&(r.className=["language-"+t.lang]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function La(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Da(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function za(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Ge(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function Ra(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ma(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ur(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function ja(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ur(e,t);const i={src:Ge(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function Oa(e,t){const n={src:Ge(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Fa(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Ba(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ur(e,t);const i={href:Ge(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function Ua(e,t){const n={href:Ge(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Ha(e,t,n){const r=e.all(t),i=n?$a(n):Hr(t),s={},o=[];if(typeof t.checked=="boolean"){const h=r[0];let c;h&&h.type==="element"&&h.tagName==="p"?c=h:(c={type:"element",tagName:"p",properties:{},children:[]},r.unshift(c)),c.children.length>0&&c.children.unshift({type:"text",value:" "}),c.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const h=r[a];(i||a!==0||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
|
|
7
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?o.push(...h.children):o.push(h)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
8
|
+
`});const u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)}function $a(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Hr(n[r])}return t}function Hr(e){const t=e.spread;return t??e.children.length>1}function Va(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function qa(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Wa(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Ga(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ka(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=rn(t.children[1]),l=wr(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function Xa(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const u=[];for(;++l<a;){const c=t.children[l],p={},f=o?o[l]:void 0;f&&(p.align=f);let d={type:"element",tagName:s,properties:p,children:[]};c&&(d.children=e.all(c),e.patch(c,d),d=e.applyData(c,d)),u.push(d)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,h),e.applyData(t,h)}function Ya(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Vn=9,qn=32;function Ja(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(Wn(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(Wn(t.slice(i),i>0,!1)),s.join("")}function Wn(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===Vn||s===qn;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===Vn||s===qn;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Qa(e,t){const n={type:"text",value:Ja(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Za(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const el={blockquote:_a,break:Na,code:Pa,delete:La,emphasis:Da,footnoteReference:za,heading:Ra,html:Ma,imageReference:ja,image:Oa,inlineCode:Fa,linkReference:Ba,link:Ua,listItem:Ha,list:Va,paragraph:qa,root:Wa,strong:Ga,table:Ka,tableCell:Ya,tableRow:Xa,text:Qa,thematicBreak:Za,toml:ut,yaml:ut,definition:ut,footnoteDefinition:ut};function ut(){}const $r=-1,vt=0,nt=1,yt=2,hn=3,fn=4,pn=5,dn=6,Vr=7,qr=8,Gn=typeof self=="object"?self:globalThis,tl=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case vt:case $r:return n(o,i);case nt:{const a=n([],i);for(const l of o)a.push(r(l));return a}case yt:{const a=n({},i);for(const[l,u]of o)a[r(l)]=r(u);return a}case hn:return n(new Date(o),i);case fn:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case pn:{const a=n(new Map,i);for(const[l,u]of o)a.set(r(l),r(u));return a}case dn:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case Vr:{const{name:a,message:l}=o;return n(new Gn[a](l),i)}case qr:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new Gn[s](o),i)};return r},Kn=e=>tl(new Map,e)(0),He="",{toString:nl}={},{keys:rl}=Object,Ze=e=>{const t=typeof e;if(t!=="object"||!e)return[vt,t];const n=nl.call(e).slice(8,-1);switch(n){case"Array":return[nt,He];case"Object":return[yt,He];case"Date":return[hn,He];case"RegExp":return[fn,He];case"Map":return[pn,He];case"Set":return[dn,He];case"DataView":return[nt,n]}return n.includes("Array")?[nt,n]:n.includes("Error")?[Vr,n]:[yt,n]},ct=([e,t])=>e===vt&&(t==="function"||t==="symbol"),il=(e,t,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Ze(o);switch(a){case vt:{let h=o;switch(l){case"bigint":a=qr,h=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);h=null;break;case"undefined":return i([$r],o)}return i([a,h],o)}case nt:{if(l){let p=o;return l==="DataView"?p=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(p=new Uint8Array(o)),i([l,[...p]],o)}const h=[],c=i([a,h],o);for(const p of o)h.push(s(p));return c}case yt:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const h=[],c=i([a,h],o);for(const p of rl(o))(e||!ct(Ze(o[p])))&&h.push([s(p),s(o[p])]);return c}case hn:return i([a,o.toISOString()],o);case fn:{const{source:h,flags:c}=o;return i([a,{source:h,flags:c}],o)}case pn:{const h=[],c=i([a,h],o);for(const[p,f]of o)(e||!(ct(Ze(p))||ct(Ze(f))))&&h.push([s(p),s(f)]);return c}case dn:{const h=[],c=i([a,h],o);for(const p of o)(e||!ct(Ze(p)))&&h.push(s(p));return c}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Xn=(e,{json:t,lossy:n}={})=>{const r=[];return il(!(t||n),!!t,new Map,r)(e),r},xt=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Kn(Xn(e,t)):structuredClone(e):(e,t)=>Kn(Xn(e,t));function ol(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function sl(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function al(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ol,r=e.options.footnoteBackLabel||sl,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[l]);if(!u)continue;const h=e.all(u),c=String(u.identifier).toUpperCase(),p=Ge(c.toLowerCase());let f=0;const d=[],b=e.footnoteCounts.get(c);for(;b!==void 0&&++f<=b;){d.length>0&&d.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,f);typeof v=="string"&&(v={type:"text",value:v}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,f),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const v=C.children[C.children.length-1];v&&v.type==="text"?v.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...d)}else h.push(...d);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(h,!0)};e.patch(u,k),a.push(k)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...xt(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
9
9
|
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
|
|
10
|
-
`}]}}const
|
|
11
|
-
`});++r<e.length;)r&&
|
|
12
|
-
`}),
|
|
13
|
-
`}),
|
|
14
|
-
`},i),o}function Ss(e,n){return e&&"run"in e?async function(t,r){const i=Kn(t,{file:r,...n});await e.run(i,r)}:function(t,r){return Kn(t,{file:r,...e||n})}}function Yn(e){if(e)throw e}var Et,Xn;function Cs(){if(Xn)return Et;Xn=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):n.call(u)==="[object Array]"},o=function(u){if(!u||n.call(u)!=="[object Object]")return!1;var f=e.call(u,"constructor"),c=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!f&&!c)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},l=function(u,f){t&&f.name==="__proto__"?t(u,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):u[f.name]=f.newValue},a=function(u,f){if(f==="__proto__")if(e.call(u,f)){if(r)return r(u,f).value}else return;return u[f]};return Et=function s(){var u,f,c,p,h,g,x=arguments[0],E=1,y=arguments.length,C=!1;for(typeof x=="boolean"&&(C=x,x=arguments[1]||{},E=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});E<y;++E)if(u=arguments[E],u!=null)for(f in u)c=a(x,f),p=a(u,f),x!==p&&(C&&p&&(o(p)||(h=i(p)))?(h?(h=!1,g=c&&i(c)?c:[]):g=c&&o(c)?c:{},l(x,{name:f,newValue:s(C,g,p)})):typeof p<"u"&&l(x,{name:f,newValue:p}));return x},Et}var Es=Cs();const Tt=yr(Es);function Gt(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Ts(){const e=[],n={run:t,use:r};return n;function t(...i){let o=-1;const l=i.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);a(null,...i);function a(s,...u){const f=e[++o];let c=-1;if(s){l(s);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,f?vs(f,a)(...u):l(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),n}}function vs(e,n){let t;return r;function r(...l){const a=e.length>l.length;let s;a&&l.push(i);try{s=e.apply(this,l)}catch(u){const f=u;if(a&&t)throw f;return i(f)}a||(s&&s.then&&typeof s.then=="function"?s.then(o,i):s instanceof Error?i(s):o(s))}function i(l,...a){t||(t=!0,n(l,...a))}function o(l){i(null,l)}}const pe={basename:Is,dirname:As,extname:Ps,join:Ds,sep:"/"};function Is(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');et(e);let t=0,r=-1,i=e.length,o;if(n===void 0||n.length===0||n.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){t=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(t,r)}if(n===e)return"";let l=-1,a=n.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){t=i+1;break}}else l<0&&(o=!0,l=i+1),a>-1&&(e.codePointAt(i)===n.codePointAt(a--)?a<0&&(r=i):(a=-1,r=l));return t===r?r=l:r<0&&(r=e.length),e.slice(t,r)}function As(e){if(et(e),e.length===0)return".";let n=-1,t=e.length,r;for(;--t;)if(e.codePointAt(t)===47){if(r){n=t;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function Ps(e){et(e);let n=e.length,t=-1,r=0,i=-1,o=0,l;for(;n--;){const a=e.codePointAt(n);if(a===47){if(l){r=n+1;break}continue}t<0&&(l=!0,t=n+1),a===46?i<0?i=n:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||t<0||o===0||o===1&&i===t-1&&i===r+1?"":e.slice(i,t)}function Ds(...e){let n=-1,t;for(;++n<e.length;)et(e[n]),e[n]&&(t=t===void 0?e[n]:t+"/"+e[n]);return t===void 0?".":Ls(t)}function Ls(e){et(e);const n=e.codePointAt(0)===47;let t=_s(e,!n);return t.length===0&&!n&&(t="."),t.length>0&&e.codePointAt(e.length-1)===47&&(t+="/"),n?"/"+t:t}function _s(e,n){let t="",r=0,i=-1,o=0,l=-1,a,s;for(;++l<=e.length;){if(l<e.length)a=e.codePointAt(l);else{if(a===47)break;a=47}if(a===47){if(!(i===l-1||o===1))if(i!==l-1&&o===2){if(t.length<2||r!==2||t.codePointAt(t.length-1)!==46||t.codePointAt(t.length-2)!==46){if(t.length>2){if(s=t.lastIndexOf("/"),s!==t.length-1){s<0?(t="",r=0):(t=t.slice(0,s),r=t.length-1-t.lastIndexOf("/")),i=l,o=0;continue}}else if(t.length>0){t="",r=0,i=l,o=0;continue}}n&&(t=t.length>0?t+"/..":"..",r=2)}else t.length>0?t+="/"+e.slice(i+1,l):t=e.slice(i+1,l),r=l-i-1;i=l,o=0}else a===46&&o>-1?o++:o=-1}return t}function et(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Rs={cwd:zs};function zs(){return"/"}function Wt(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ns(e){if(typeof e=="string")e=new URL(e);else if(!Wt(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return Os(e)}function Os(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let t=-1;for(;++t<n.length;)if(n.codePointAt(t)===37&&n.codePointAt(t+1)===50){const r=n.codePointAt(t+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(n)}const vt=["history","path","basename","stem","extname","dirname"];class $r{constructor(n){let t;n?Wt(n)?t={path:n}:typeof n=="string"||Fs(n)?t={value:n}:t=n:t={},this.cwd="cwd"in t?"":Rs.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<vt.length;){const o=vt[r];o in t&&t[o]!==void 0&&t[o]!==null&&(this[o]=o==="history"?[...t[o]]:t[o])}let i;for(i in t)vt.includes(i)||(this[i]=t[i])}get basename(){return typeof this.path=="string"?pe.basename(this.path):void 0}set basename(n){At(n,"basename"),It(n,"basename"),this.path=pe.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?pe.dirname(this.path):void 0}set dirname(n){Qn(this.basename,"dirname"),this.path=pe.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?pe.extname(this.path):void 0}set extname(n){if(It(n,"extname"),Qn(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=pe.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Wt(n)&&(n=Ns(n)),At(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?pe.basename(this.path,this.extname):void 0}set stem(n){At(n,"stem"),It(n,"stem"),this.path=pe.join(this.dirname||"",n+(this.extname||""))}fail(n,t,r){const i=this.message(n,t,r);throw i.fatal=!0,i}info(n,t,r){const i=this.message(n,t,r);return i.fatal=void 0,i}message(n,t,r){const i=new Z(n,t,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function It(e,n){if(e&&e.includes(pe.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+pe.sep+"`")}function At(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Qn(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function Fs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ms=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),js={}.hasOwnProperty;class cn extends Ms{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Ts()}copy(){const n=new cn;let t=-1;for(;++t<this.attachers.length;){const r=this.attachers[t];n.use(...r)}return n.data(Tt(!0,{},this.namespace)),n}data(n,t){return typeof n=="string"?arguments.length===2?(Lt("data",this.frozen),this.namespace[n]=t,this):js.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Lt("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=t.call(n,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const t=it(n),r=this.parser||this.Parser;return Pt("parse",r),r(String(t),t)}process(n,t){const r=this;return this.freeze(),Pt("process",this.parser||this.Parser),Dt("process",this.compiler||this.Compiler),t?i(void 0,t):new Promise(i);function i(o,l){const a=it(n),s=r.parse(a);r.run(s,a,function(f,c,p){if(f||!c||!p)return u(f);const h=c,g=r.stringify(h,p);Hs(g)?p.value=g:p.result=g,u(f,p)});function u(f,c){f||!c?l(f):o?o(c):t(void 0,c)}}}processSync(n){let t=!1,r;return this.freeze(),Pt("processSync",this.parser||this.Parser),Dt("processSync",this.compiler||this.Compiler),this.process(n,i),Zn("processSync","process",t),r;function i(o,l){t=!0,Yn(o),r=l}}run(n,t,r){Jn(n),this.freeze();const i=this.transformers;return!r&&typeof t=="function"&&(r=t,t=void 0),r?o(void 0,r):new Promise(o);function o(l,a){const s=it(t);i.run(n,s,u);function u(f,c,p){const h=c||n;f?a(f):l?l(h):r(void 0,h,p)}}}runSync(n,t){let r=!1,i;return this.run(n,t,o),Zn("runSync","run",r),i;function o(l,a){Yn(l),i=a,r=!0}}stringify(n,t){this.freeze();const r=it(t),i=this.compiler||this.Compiler;return Dt("stringify",i),Jn(n),i(n,r)}use(n,...t){const r=this.attachers,i=this.namespace;if(Lt("use",this.frozen),n!=null)if(typeof n=="function")s(n,t);else if(typeof n=="object")Array.isArray(n)?a(n):l(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function o(u){if(typeof u=="function")s(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[f,...c]=u;s(f,c)}else l(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function l(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(i.settings=Tt(!0,i.settings,u.settings))}function a(u){let f=-1;if(u!=null)if(Array.isArray(u))for(;++f<u.length;){const c=u[f];o(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function s(u,f){let c=-1,p=-1;for(;++c<r.length;)if(r[c][0]===u){p=c;break}if(p===-1)r.push([u,...f]);else if(f.length>0){let[h,...g]=f;const x=r[p][1];Gt(x)&&Gt(h)&&(h=Tt(!0,x,h)),r[p]=[u,h,...g]}}}}const Bs=new cn().freeze();function Pt(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Dt(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Lt(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Jn(e){if(!Gt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Zn(e,n,t){if(!t)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function it(e){return Us(e)?e:new $r(e)}function Us(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Hs(e){return typeof e=="string"||qs(e)}function qs(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vs="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",er=[],tr={allowDangerousHtml:!0},$s=/^(https?|ircs?|mailto|xmpp)$/i,Gs=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ws(e){const n=Ks(e),t=Ys(e);return Xs(n.runSync(n.parse(t),t),e)}function Ks(e){const n=e.rehypePlugins||er,t=e.remarkPlugins||er,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...tr}:tr;return Bs().use(Aa).use(t).use(Ss,r).use(n)}function Ys(e){const n=e.children||"",t=new $r;return typeof n=="string"&&(t.value=n),t}function Xs(e,n){const t=n.allowedElements,r=n.allowElement,i=n.components,o=n.disallowedElements,l=n.skipHtml,a=n.unwrapDisallowed,s=n.urlTransform||Qs;for(const f of Gs)Object.hasOwn(n,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+Vs+f.id,void 0);return un(e,u),cl(e,{Fragment:T.Fragment,components:i,ignoreInvalidStyle:!0,jsx:T.jsx,jsxs:T.jsxs,passKeys:!0,passNode:!0});function u(f,c,p){if(f.type==="raw"&&p&&typeof c=="number")return l?p.children.splice(c,1):p.children[c]={type:"text",value:f.value},c;if(f.type==="element"){let h;for(h in wt)if(Object.hasOwn(wt,h)&&Object.hasOwn(f.properties,h)){const g=f.properties[h],x=wt[h];(x===null||x.includes(f.tagName))&&(f.properties[h]=s(String(g||""),h,f))}}if(f.type==="element"){let h=t?!t.includes(f.tagName):o?o.includes(f.tagName):!1;if(!h&&r&&typeof c=="number"&&(h=!r(f,c,p)),h&&p&&typeof c=="number")return a&&f.children?p.children.splice(c,1,...f.children):p.children.splice(c,1),c}}}function Qs(e){const n=e.indexOf(":"),t=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return n===-1||i!==-1&&n>i||t!==-1&&n>t||r!==-1&&n>r||$s.test(e.slice(0,n))?e:""}function nr(e,n){const t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+n.length);return r}function Js(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Zs(e,n,t){const i=gt((t||{}).ignore||[]),o=eu(n);let l=-1;for(;++l<o.length;)Vr(e,"text",a);function a(u,f){let c=-1,p;for(;++c<f.length;){const h=f[c],g=p?p.children:void 0;if(i(h,g?g.indexOf(h):void 0,p))return;p=h}if(p)return s(u,f)}function s(u,f){const c=f[f.length-1],p=o[l][0],h=o[l][1];let g=0;const E=c.children.indexOf(u);let y=!1,C=[];p.lastIndex=0;let k=p.exec(u.value);for(;k;){const D=k.index,z={index:k.index,input:k.input,stack:[...f,u]};let w=h(...k,z);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=D+1:(g!==D&&C.push({type:"text",value:u.value.slice(g,D)}),Array.isArray(w)?C.push(...w):w&&C.push(w),g=D+k[0].length,y=!0),!p.global)break;k=p.exec(u.value)}return y?(g<u.value.length&&C.push({type:"text",value:u.value.slice(g)}),c.children.splice(E,1,...C)):C=[u],E+C.length}}function eu(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<t.length;){const i=t[r];n.push([tu(i[0]),nu(i[1])])}return n}function tu(e){return typeof e=="string"?new RegExp(Js(e),"g"):e}function nu(e){return typeof e=="function"?e:function(){return e}}const _t="phrasing",Rt=["autolink","link","image","label"];function ru(){return{transforms:[cu],enter:{literalAutolink:lu,literalAutolinkEmail:zt,literalAutolinkHttp:zt,literalAutolinkWww:zt},exit:{literalAutolink:uu,literalAutolinkEmail:su,literalAutolinkHttp:ou,literalAutolinkWww:au}}}function iu(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:_t,notInConstruct:Rt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:_t,notInConstruct:Rt},{character:":",before:"[ps]",after:"\\/",inConstruct:_t,notInConstruct:Rt}]}}function lu(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function zt(e){this.config.enter.autolinkProtocol.call(this,e)}function ou(e){this.config.exit.autolinkProtocol.call(this,e)}function au(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function su(e){this.config.exit.autolinkEmail.call(this,e)}function uu(e){this.exit(e)}function cu(e){Zs(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,fu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),hu]],{ignore:["link","linkReference"]})}function fu(e,n,t,r,i){let o="";if(!Gr(i)||(/^w/i.test(n)&&(t=n+t,n="",o="http://"),!pu(t)))return!1;const l=mu(t+r);if(!l[0])return!1;const a={type:"link",title:null,url:o+n+l[0],children:[{type:"text",value:n+l[0]}]};return l[1]?[a,{type:"text",value:l[1]}]:a}function hu(e,n,t,r){return!Gr(r,!0)||/[-\d_]$/.test(t)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+t,children:[{type:"text",value:n+"@"+t}]}}function pu(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function mu(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let t=n[0],r=t.indexOf(")");const i=nr(e,"(");let o=nr(e,")");for(;r!==-1&&i>o;)e+=t.slice(0,r+1),t=t.slice(r+1),r=t.indexOf(")"),o++;return[e,t]}function Gr(e,n){const t=e.input.charCodeAt(e.index-1);return(e.index===0||Ae(t)||pt(t))&&(!n||t!==47)}Wr.peek=Cu;function du(){this.buffer()}function gu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yu(){this.buffer()}function ku(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function xu(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=he(this.sliceSerialize(e)).toLowerCase(),t.label=n}function bu(e){this.exit(e)}function wu(e){const n=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=he(this.sliceSerialize(e)).toLowerCase(),t.label=n}function Su(e){this.exit(e)}function Cu(){return"["}function Wr(e,n,t,r){const i=t.createTracker(r);let o=i.move("[^");const l=t.enter("footnoteReference"),a=t.enter("reference");return o+=i.move(t.safe(t.associationId(e),{after:"]",before:o})),a(),l(),o+=i.move("]"),o}function Eu(){return{enter:{gfmFootnoteCallString:du,gfmFootnoteCall:gu,gfmFootnoteDefinitionLabelString:yu,gfmFootnoteDefinition:ku},exit:{gfmFootnoteCallString:xu,gfmFootnoteCall:bu,gfmFootnoteDefinitionLabelString:wu,gfmFootnoteDefinition:Su}}}function Tu(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:t,footnoteReference:Wr},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(r,i,o,l){const a=o.createTracker(l);let s=a.move("[^");const u=o.enter("footnoteDefinition"),f=o.enter("label");return s+=a.move(o.safe(o.associationId(r),{before:s,after:"]"})),f(),s+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),s+=a.move((n?`
|
|
15
|
-
`:" ")+
|
|
16
|
-
`)}function
|
|
17
|
-
`&&
|
|
18
|
-
`}function
|
|
19
|
-
`,encode:["`"],...a.current()})),c()}return
|
|
20
|
-
`),
|
|
21
|
-
`)),
|
|
22
|
-
`,...
|
|
10
|
+
`}]}}const Ct=(function(e){if(e==null)return hl;if(typeof e=="function")return St(e);if(typeof e=="object")return Array.isArray(e)?ll(e):ul(e);if(typeof e=="string")return cl(e);throw new Error("Expected function, string, or object as test")});function ll(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ct(e[n]);return St(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function ul(e){const t=e;return St(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function cl(e){return St(t);function t(n){return n&&n.type===e}}function St(e){return t;function t(n,r,i){return!!(fl(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function hl(){return!0}function fl(e){return e!==null&&typeof e=="object"&&"type"in e}const Wr=[],pl=!0,Yt=!1,dl="skip";function Gr(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=Ct(i),o=r?-1:1;a(e,void 0,[])();function a(l,u,h){const c=l&&typeof l=="object"?l:{};if(typeof c.type=="string"){const f=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(l.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Wr,d,b,C;if((!t||s(l,u,h[h.length-1]||void 0))&&(f=ml(n(l,h)),f[0]===Yt))return f;if("children"in l&&l.children){const k=l;if(k.children&&f[0]!==dl)for(b=(r?k.children.length:-1)+o,C=h.concat(k);b>-1&&b<k.children.length;){const v=k.children[b];if(d=a(v,b,C)(),d[0]===Yt)return d;b=typeof d[1]=="number"?d[1]:b+o}}return f}}}function ml(e){return Array.isArray(e)?e:typeof e=="number"?[pl,e]:e==null?Wr:[e]}function mn(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),Gr(e,s,a,i);function a(l,u){const h=u[u.length-1],c=h?h.children.indexOf(l):void 0;return o(l,c,h)}}const Jt={}.hasOwnProperty,gl={};function yl(e,t){const n=t||gl,r=new Map,i=new Map,s=new Map,o={...el,...n.handlers},a={all:u,applyData:kl,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:xl,wrap:wl};return mn(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const c=h.type==="definition"?r:i,p=String(h.identifier).toUpperCase();c.has(p)||c.set(p,h)}}),a;function l(h,c){const p=h.type,f=a.handlers[p];if(Jt.call(a.handlers,p)&&f)return f(a,h,c);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in h){const{children:b,...C}=h,k=xt(C);return k.children=a.all(h),k}return xt(h)}return(a.options.unknownHandler||bl)(a,h,c)}function u(h){const c=[];if("children"in h){const p=h.children;let f=-1;for(;++f<p.length;){const d=a.one(p[f],h);if(d){if(f&&p[f-1].type==="break"&&(!Array.isArray(d)&&d.type==="text"&&(d.value=Yn(d.value)),!Array.isArray(d)&&d.type==="element")){const b=d.children[0];b&&b.type==="text"&&(b.value=Yn(b.value))}Array.isArray(d)?c.push(...d):c.push(d)}}}return c}}function xl(e,t){e.position&&(t.position=oo(e))}function kl(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,xt(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function bl(e,t){const n=t.data||{},r="value"in t&&!(Jt.call(n,"hProperties")||Jt.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wl(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
11
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
12
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
13
|
+
`}),n}function Yn(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Jn(e,t){const n=yl(e,t),r=n.one(e,void 0),i=al(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
|
|
14
|
+
`},i),s}function vl(e,t){return e&&"run"in e?async function(n,r){const i=Jn(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Jn(n,{file:r,...e||t})}}function Qn(e){if(e)throw e}var Pt,Zn;function Cl(){if(Zn)return Pt;Zn=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var h=e.call(u,"constructor"),c=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!h&&!c)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},o=function(u,h){n&&h.name==="__proto__"?n(u,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):u[h.name]=h.newValue},a=function(u,h){if(h==="__proto__")if(e.call(u,h)){if(r)return r(u,h).value}else return;return u[h]};return Pt=function l(){var u,h,c,p,f,d,b=arguments[0],C=1,k=arguments.length,v=!1;for(typeof b=="boolean"&&(v=b,b=arguments[1]||{},C=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});C<k;++C)if(u=arguments[C],u!=null)for(h in u)c=a(b,h),p=a(u,h),b!==p&&(v&&p&&(s(p)||(f=i(p)))?(f?(f=!1,d=c&&i(c)?c:[]):d=c&&s(c)?c:{},o(b,{name:h,newValue:l(v,d,p)})):typeof p<"u"&&o(b,{name:h,newValue:p}));return b},Pt}var Sl=Cl();const Lt=br(Sl);function Qt(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function El(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...u){const h=e[++s];let c=-1;if(l){o(l);return}for(;++c<i.length;)(u[c]===null||u[c]===void 0)&&(u[c]=i[c]);i=u,h?Tl(h,a)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Tl(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(i);try{l=e.apply(this,o)}catch(u){const h=u;if(a&&n)throw h;return i(h)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,t(o,...a))}function s(o){i(null,o)}}const Se={basename:Il,dirname:Al,extname:_l,join:Nl,sep:"/"};function Il(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');at(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(e.codePointAt(i)===t.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Al(e){if(at(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function _l(e){at(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Nl(...e){let t=-1,n;for(;++t<e.length;)at(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Pl(n)}function Pl(e){at(e);const t=e.codePointAt(0)===47;let n=Ll(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Ll(e,t){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function at(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Dl={cwd:zl};function zl(){return"/"}function Zt(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Rl(e){if(typeof e=="string")e=new URL(e);else if(!Zt(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Ml(e)}function Ml(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Dt=["history","path","basename","stem","extname","dirname"];class Kr{constructor(t){let n;t?Zt(t)?n={path:t}:typeof t=="string"||jl(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Dl.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Dt.length;){const s=Dt[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Dt.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Se.basename(this.path):void 0}set basename(t){Rt(t,"basename"),zt(t,"basename"),this.path=Se.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Se.dirname(this.path):void 0}set dirname(t){er(this.basename,"dirname"),this.path=Se.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Se.extname(this.path):void 0}set extname(t){if(zt(t,"extname"),er(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Se.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Zt(t)&&(t=Rl(t)),Rt(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Se.basename(this.path,this.extname):void 0}set stem(t){Rt(t,"stem"),zt(t,"stem"),this.path=Se.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new ce(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function zt(e,t){if(e&&e.includes(Se.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Se.sep+"`")}function Rt(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function er(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function jl(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ol=(function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),Fl={}.hasOwnProperty;class gn extends Ol{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=El()}copy(){const t=new gn;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Lt(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ot("data",this.frozen),this.namespace[t]=n,this):Fl.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ot("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ht(t),r=this.parser||this.Parser;return Mt("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Mt("process",this.parser||this.Parser),jt("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=ht(t),l=r.parse(a);r.run(l,a,function(h,c,p){if(h||!c||!p)return u(h);const f=c,d=r.stringify(f,p);Hl(d)?p.value=d:p.result=d,u(h,p)});function u(h,c){h||!c?o(h):s?s(c):n(void 0,c)}}}processSync(t){let n=!1,r;return this.freeze(),Mt("processSync",this.parser||this.Parser),jt("processSync",this.compiler||this.Compiler),this.process(t,i),nr("processSync","process",n),r;function i(s,o){n=!0,Qn(s),r=o}}run(t,n,r){tr(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=ht(n);i.run(t,l,u);function u(h,c,p){const f=c||t;h?a(h):o?o(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),nr("runSync","run",r),i;function s(o,a){Qn(o),i=a,r=!0}}stringify(t,n){this.freeze();const r=ht(n),i=this.compiler||this.Compiler;return jt("stringify",i),tr(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Ot("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[h,...c]=u;l(h,c)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(i.settings=Lt(!0,i.settings,u.settings))}function a(u){let h=-1;if(u!=null)if(Array.isArray(u))for(;++h<u.length;){const c=u[h];s(c)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,h){let c=-1,p=-1;for(;++c<r.length;)if(r[c][0]===u){p=c;break}if(p===-1)r.push([u,...h]);else if(h.length>0){let[f,...d]=h;const b=r[p][1];Qt(b)&&Qt(f)&&(f=Lt(!0,b,f)),r[p]=[u,f,...d]}}}}const Bl=new gn().freeze();function Mt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function jt(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ot(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function tr(e){if(!Qt(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nr(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ht(e){return Ul(e)?e:new Kr(e)}function Ul(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Hl(e){return typeof e=="string"||$l(e)}function $l(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vl="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rr=[],ir={allowDangerousHtml:!0},ql=/^(https?|ircs?|mailto|xmpp)$/i,Wl=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Gl(e){const t=Kl(e),n=Xl(e);return Yl(t.runSync(t.parse(n),n),e)}function Kl(e){const t=e.rehypePlugins||rr,n=e.remarkPlugins||rr,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...ir}:ir;return Bl().use(Aa).use(n).use(vl,r).use(t)}function Xl(e){const t=e.children||"",n=new Kr;return typeof t=="string"&&(n.value=t),n}function Yl(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||Jl;for(const h of Wl)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+Vl+h.id,void 0);return mn(e,u),co(e,{Fragment:x.Fragment,components:i,ignoreInvalidStyle:!0,jsx:x.jsx,jsxs:x.jsxs,passKeys:!0,passNode:!0});function u(h,c,p){if(h.type==="raw"&&p&&typeof c=="number")return o?p.children.splice(c,1):p.children[c]={type:"text",value:h.value},c;if(h.type==="element"){let f;for(f in At)if(Object.hasOwn(At,f)&&Object.hasOwn(h.properties,f)){const d=h.properties[f],b=At[f];(b===null||b.includes(h.tagName))&&(h.properties[f]=l(String(d||""),f,h))}}if(h.type==="element"){let f=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!f&&r&&typeof c=="number"&&(f=!r(h,c,p)),f&&p&&typeof c=="number")return a&&h.children?p.children.splice(c,1,...h.children):p.children.splice(c,1),c}}}function Jl(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||ql.test(e.slice(0,t))?e:""}function or(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Ql(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Zl(e,t,n){const i=Ct((n||{}).ignore||[]),s=eu(t);let o=-1;for(;++o<s.length;)Gr(e,"text",a);function a(u,h){let c=-1,p;for(;++c<h.length;){const f=h[c],d=p?p.children:void 0;if(i(f,d?d.indexOf(f):void 0,p))return;p=f}if(p)return l(u,h)}function l(u,h){const c=h[h.length-1],p=s[o][0],f=s[o][1];let d=0;const C=c.children.indexOf(u);let k=!1,v=[];p.lastIndex=0;let E=p.exec(u.value);for(;E;){const z=E.index,P={index:E.index,input:E.input,stack:[...h,u]};let w=f(...E,P);if(typeof w=="string"&&(w=w.length>0?{type:"text",value:w}:void 0),w===!1?p.lastIndex=z+1:(d!==z&&v.push({type:"text",value:u.value.slice(d,z)}),Array.isArray(w)?v.push(...w):w&&v.push(w),d=z+E[0].length,k=!0),!p.global)break;E=p.exec(u.value)}return k?(d<u.value.length&&v.push({type:"text",value:u.value.slice(d)}),c.children.splice(C,1,...v)):v=[u],C+v.length}}function eu(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([tu(i[0]),nu(i[1])])}return t}function tu(e){return typeof e=="string"?new RegExp(Ql(e),"g"):e}function nu(e){return typeof e=="function"?e:function(){return e}}const Ft="phrasing",Bt=["autolink","link","image","label"];function ru(){return{transforms:[cu],enter:{literalAutolink:ou,literalAutolinkEmail:Ut,literalAutolinkHttp:Ut,literalAutolinkWww:Ut},exit:{literalAutolink:uu,literalAutolinkEmail:lu,literalAutolinkHttp:su,literalAutolinkWww:au}}}function iu(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ft,notInConstruct:Bt},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ft,notInConstruct:Bt},{character:":",before:"[ps]",after:"\\/",inConstruct:Ft,notInConstruct:Bt}]}}function ou(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ut(e){this.config.enter.autolinkProtocol.call(this,e)}function su(e){this.config.exit.autolinkProtocol.call(this,e)}function au(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function lu(e){this.config.exit.autolinkEmail.call(this,e)}function uu(e){this.exit(e)}function cu(e){Zl(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,hu],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),fu]],{ignore:["link","linkReference"]})}function hu(e,t,n,r,i){let s="";if(!Xr(i)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!pu(n)))return!1;const o=du(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function fu(e,t,n,r){return!Xr(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function pu(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function du(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=or(e,"(");let s=or(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Xr(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Me(n)||bt(n))&&(!t||n!==47)}Yr.peek=Cu;function mu(){this.buffer()}function gu(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yu(){this.buffer()}function xu(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ku(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ce(this.sliceSerialize(e)).toLowerCase(),n.label=t}function bu(e){this.exit(e)}function wu(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ce(this.sliceSerialize(e)).toLowerCase(),n.label=t}function vu(e){this.exit(e)}function Cu(){return"["}function Yr(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function Su(){return{enter:{gfmFootnoteCallString:mu,gfmFootnoteCall:gu,gfmFootnoteDefinitionLabelString:yu,gfmFootnoteDefinition:xu},exit:{gfmFootnoteCallString:ku,gfmFootnoteCall:bu,gfmFootnoteDefinitionLabelString:wu,gfmFootnoteDefinition:vu}}}function Eu(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Yr},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const u=s.enter("footnoteDefinition"),h=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),h(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
|
|
15
|
+
`:" ")+s.indentLines(s.containerFlow(r,a.current()),t?Jr:Tu))),u(),l}}function Tu(e,t,n){return t===0?e:Jr(e,t,n)}function Jr(e,t,n){return(n?"":" ")+e}const Iu=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Qr.peek=Lu;function Au(){return{canContainEols:["delete"],enter:{strikethrough:Nu},exit:{strikethrough:Pu}}}function _u(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Iu}],handlers:{delete:Qr}}}function Nu(e){this.enter({type:"delete",children:[]},e)}function Pu(e){this.exit(e)}function Qr(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function Lu(){return"~"}function Du(e){return e.length}function zu(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Du,s=[],o=[],a=[],l=[];let u=0,h=-1;for(;++h<e.length;){const b=[],C=[];let k=-1;for(e[h].length>u&&(u=e[h].length);++k<e[h].length;){const v=Ru(e[h][k]);if(n.alignDelimiters!==!1){const E=i(v);C[k]=E,(l[k]===void 0||E>l[k])&&(l[k]=E)}b.push(v)}o[h]=b,a[h]=C}let c=-1;if(typeof r=="object"&&"length"in r)for(;++c<u;)s[c]=sr(r[c]);else{const b=sr(r);for(;++c<u;)s[c]=b}c=-1;const p=[],f=[];for(;++c<u;){const b=s[c];let C="",k="";b===99?(C=":",k=":"):b===108?C=":":b===114&&(k=":");let v=n.alignDelimiters===!1?1:Math.max(1,l[c]-C.length-k.length);const E=C+"-".repeat(v)+k;n.alignDelimiters!==!1&&(v=C.length+v+k.length,v>l[c]&&(l[c]=v),f[c]=v),p[c]=E}o.splice(1,0,p),a.splice(1,0,f),h=-1;const d=[];for(;++h<o.length;){const b=o[h],C=a[h];c=-1;const k=[];for(;++c<u;){const v=b[c]||"";let E="",z="";if(n.alignDelimiters!==!1){const P=l[c]-(C[c]||0),w=s[c];w===114?E=" ".repeat(P):w===99?P%2?(E=" ".repeat(P/2+.5),z=" ".repeat(P/2-.5)):(E=" ".repeat(P/2),z=E):z=" ".repeat(P)}n.delimiterStart!==!1&&!c&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||c)&&k.push(" "),n.alignDelimiters!==!1&&k.push(E),k.push(v),n.alignDelimiters!==!1&&k.push(z),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||c!==u-1)&&k.push("|")}d.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return d.join(`
|
|
16
|
+
`)}function Ru(e){return e==null?"":String(e)}function sr(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Mu(e,t,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),ju);return i(),o}function ju(e,t,n){return">"+(n?"":" ")+e}function Ou(e,t){return ar(e,t.inConstruct,!0)&&!ar(e,t.notInConstruct,!1)}function ar(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function lr(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
17
|
+
`&&Ou(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
18
|
+
`}function Fu(e,t){const n=String(e);let r=n.indexOf(t),i=r,s=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+t.length,r=n.indexOf(t,i);return o}function Bu(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Uu(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Hu(e,t,n,r){const i=Uu(n),s=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(Bu(e,n)){const c=n.enter("codeIndented"),p=n.indentLines(s,$u);return c(),p}const a=n.createTracker(r),l=i.repeat(Math.max(Fu(s,i)+1,3)),u=n.enter("codeFenced");let h=a.move(l);if(e.lang){const c=n.enter(`codeFencedLang${o}`);h+=a.move(n.safe(e.lang,{before:h,after:" ",encode:["`"],...a.current()})),c()}if(e.lang&&e.meta){const c=n.enter(`codeFencedMeta${o}`);h+=a.move(" "),h+=a.move(n.safe(e.meta,{before:h,after:`
|
|
19
|
+
`,encode:["`"],...a.current()})),c()}return h+=a.move(`
|
|
20
|
+
`),s&&(h+=a.move(s+`
|
|
21
|
+
`)),h+=a.move(l),u(),h}function $u(e,t,n){return(n?"":" ")+e}function yn(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Vu(e,t,n,r){const i=yn(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":`
|
|
22
|
+
`,...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function qu(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function it(e){return"&#x"+e.toString(16).toUpperCase()+";"}function kt(e,t,n){const r=qe(e),i=qe(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Zr.peek=Wu;function Zr(e,t,n,r){const i=qu(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),h=kt(r.before.charCodeAt(r.before.length-1),u,i);h.inside&&(l=it(u)+l.slice(1));const c=l.charCodeAt(l.length-1),p=kt(r.after.charCodeAt(0),c,i);p.inside&&(l=l.slice(0,-1)+it(c));const f=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},a+l+f}function Wu(e,t,n){return n.options.emphasis||"*"}function Gu(e,t){let n=!1;return mn(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Yt}),!!((!e.depth||e.depth<3)&&ln(e)&&(t.options.setext||n))}function Ku(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(Gu(e,n)){const h=n.enter("headingSetext"),c=n.enter("phrasing"),p=n.containerPhrasing(e,{...s.current(),before:`
|
|
23
23
|
`,after:`
|
|
24
|
-
`});return c(),
|
|
24
|
+
`});return c(),h(),p+`
|
|
25
25
|
`+(i===1?"=":"-").repeat(p.length-(Math.max(p.lastIndexOf("\r"),p.lastIndexOf(`
|
|
26
|
-
`))+1))}const
|
|
27
|
-
`,...
|
|
28
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:
|
|
29
|
-
`))}function s(h,g,x,E){const y=x.enter("tableCell"),C=x.enter("phrasing"),k=x.containerPhrasing(h,{...E,before:o,after:o});return C(),y(),k}function u(h,g){return zu(h,{align:g,alignDelimiters:r,padding:t,stringLength:i})}function f(h,g,x){const E=h.children;let y=-1;const C=[],k=g.enter("table");for(;++y<E.length;)C[y]=c(E[y],g,x);return k(),C}function c(h,g,x){const E=h.children;let y=-1;const C=[],k=g.enter("tableRow");for(;++y<E.length;)C[y]=s(E[y],h,g,x);return k(),C}function p(h,g,x){let E=oi.inlineCode(h,g,x);return x.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function wc(){return{exit:{taskListCheckValueChecked:ar,taskListCheckValueUnchecked:ar,paragraph:Cc}}}function Sc(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Ec}}}function ar(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function Cc(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const t=this.stack[this.stack.length-1];t.type;const r=t.children[0];if(r&&r.type==="text"){const i=n.children;let o=-1,l;for(;++o<i.length;){const a=i[o];if(a.type==="paragraph"){l=a;break}}l===t&&(r.value=r.value.slice(1),r.value.length===0?t.children.shift():t.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,t.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Ec(e,n,t,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",a=t.createTracker(r);o&&a.move(l);let s=oi.listItem(e,n,t,{...r,...a.current()});return o&&(s=s.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),s;function u(f){return f+l}}function Tc(){return[ru(),Eu(),Au(),mc(),wc()]}function vc(e){return{extensions:[iu(),Tu(e),Pu(),bc(e),Sc()]}}const Ic={tokenize:Rc,partial:!0},ai={tokenize:zc,partial:!0},si={tokenize:Nc,partial:!0},ui={tokenize:Oc,partial:!0},Ac={tokenize:Fc,partial:!0},ci={name:"wwwAutolink",tokenize:Lc,previous:hi},fi={name:"protocolAutolink",tokenize:_c,previous:pi},be={name:"emailAutolink",tokenize:Dc,previous:mi},de={};function Pc(){return{text:de}}let Ie=48;for(;Ie<123;)de[Ie]=be,Ie++,Ie===58?Ie=65:Ie===91&&(Ie=97);de[43]=be;de[45]=be;de[46]=be;de[95]=be;de[72]=[be,fi];de[104]=[be,fi];de[87]=[be,ci];de[119]=[be,ci];function Dc(e,n,t){const r=this;let i,o;return l;function l(c){return!Kt(c)||!mi.call(r,r.previous)||pn(r.events)?t(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return Kt(c)?(e.consume(c),a):c===64?(e.consume(c),s):t(c)}function s(c){return c===46?e.check(Ac,f,u)(c):c===45||c===95||J(c)?(o=!0,e.consume(c),s):f(c)}function u(c){return e.consume(c),i=!0,s}function f(c){return o&&i&&ee(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(c)):t(c)}}function Lc(e,n,t){const r=this;return i;function i(l){return l!==87&&l!==119||!hi.call(r,r.previous)||pn(r.events)?t(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Ic,e.attempt(ai,e.attempt(si,o),t),t)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(l)}}function _c(e,n,t){const r=this;let i="",o=!1;return l;function l(c){return(c===72||c===104)&&pi.call(r,r.previous)&&!pn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):t(c)}function a(c){if(ee(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(c),s}return t(c)}function s(c){return c===47?(e.consume(c),o?u:(o=!0,s)):t(c)}function u(c){return c===null||ut(c)||G(c)||Ae(c)||pt(c)?t(c):e.attempt(ai,e.attempt(si,f),t)(c)}function f(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(c)}}function Rc(e,n,t){let r=0;return i;function i(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),i):l===46&&r===3?(e.consume(l),o):t(l)}function o(l){return l===null?t(l):n(l)}}function zc(e,n,t){let r,i,o;return l;function l(u){return u===46||u===95?e.check(ui,s,a)(u):u===null||G(u)||Ae(u)||u!==45&&pt(u)?s(u):(o=!0,e.consume(u),l)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),l}function s(u){return i||r||!o?t(u):n(u)}}function Nc(e,n){let t=0,r=0;return i;function i(l){return l===40?(t++,e.consume(l),i):l===41&&r<t?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(ui,n,o)(l):l===null||G(l)||Ae(l)?n(l):(e.consume(l),i)}function o(l){return l===41&&r++,e.consume(l),i}}function Oc(e,n,t){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),o):a===93?(e.consume(a),i):a===60||a===null||G(a)||Ae(a)?n(a):t(a)}function i(a){return a===null||a===40||a===91||G(a)||Ae(a)?n(a):r(a)}function o(a){return ee(a)?l(a):t(a)}function l(a){return a===59?(e.consume(a),r):ee(a)?(e.consume(a),l):t(a)}}function Fc(e,n,t){return r;function r(o){return e.consume(o),i}function i(o){return J(o)?t(o):n(o)}}function hi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||G(e)}function pi(e){return!ee(e)}function mi(e){return!(e===47||Kt(e))}function Kt(e){return e===43||e===45||e===46||e===95||J(e)}function pn(e){let n=e.length,t=!1;for(;n--;){const r=e[n][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){t=!0;break}if(r._gfmAutolinkLiteralWalkedInto){t=!1;break}}return e.length>0&&!t&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const Mc={tokenize:Gc,partial:!0};function jc(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qc,continuation:{tokenize:Vc},exit:$c}},text:{91:{name:"gfmFootnoteCall",tokenize:Hc},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Bc,resolveTo:Uc}}}}function Bc(e,n,t){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;i--;){const s=r.events[i][1];if(s.type==="labelImage"){l=s;break}if(s.type==="gfmFootnoteCall"||s.type==="labelLink"||s.type==="label"||s.type==="image"||s.type==="link")break}return a;function a(s){if(!l||!l._balanced)return t(s);const u=he(r.sliceSerialize({start:l.end,end:r.now()}));return u.codePointAt(0)!==94||!o.includes(u.slice(1))?t(s):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),n(s))}}function Uc(e,n){let t=e.length;for(;t--;)if(e[t][1].type==="labelImage"&&e[t][0]==="enter"){e[t][1];break}e[t+1][1].type="data",e[t+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[t+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[t+3][1].end),end:Object.assign({},e[t+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},a=[e[t+1],e[t+2],["enter",r,n],e[t+3],e[t+4],["enter",i,n],["exit",i,n],["enter",o,n],["enter",l,n],["exit",l,n],["exit",o,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice(t,e.length-t+1,...a),e}function Hc(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,l;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),s}function s(c){return c!==94?t(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(o>999||c===93&&!l||c===null||c===91||G(c))return t(c);if(c===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(he(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):t(c)}return G(c)||(l=!0),o++,e.consume(c),c===92?f:u}function f(c){return c===91||c===92||c===93?(e.consume(c),o++,u):u(c)}}function qc(e,n,t){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,l=0,a;return s;function s(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):t(g)}function f(g){if(l>999||g===93&&!a||g===null||g===91||G(g))return t(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return o=he(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return G(g)||(a=!0),l++,e.consume(g),g===92?c:f}function c(g){return g===91||g===92||g===93?(e.consume(g),l++,f):f(g)}function p(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(o)||i.push(o),V(e,h,"gfmFootnoteDefinitionWhitespace")):t(g)}function h(g){return n(g)}}function Vc(e,n,t){return e.check(Ze,n,e.attempt(Mc,n,t))}function $c(e){e.exit("gfmFootnoteDefinition")}function Gc(e,n,t){const r=this;return V(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?n(o):t(o)}}function Wc(e){let t=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return t==null&&(t=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(l,a){let s=-1;for(;++s<l.length;)if(l[s][0]==="enter"&&l[s][1].type==="strikethroughSequenceTemporary"&&l[s][1]._close){let u=s;for(;u--;)if(l[u][0]==="exit"&&l[u][1].type==="strikethroughSequenceTemporary"&&l[u][1]._open&&l[s][1].end.offset-l[s][1].start.offset===l[u][1].end.offset-l[u][1].start.offset){l[s][1].type="strikethroughSequence",l[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},l[u][1].start),end:Object.assign({},l[s][1].end)},c={type:"strikethroughText",start:Object.assign({},l[u][1].end),end:Object.assign({},l[s][1].start)},p=[["enter",f,a],["enter",l[u][1],a],["exit",l[u][1],a],["enter",c,a]],h=a.parser.constructs.insideSpan.null;h&&le(p,p.length,0,mt(h,l.slice(u+1,s),a)),le(p,p.length,0,[["exit",c,a],["enter",l[s][1],a],["exit",l[s][1],a],["exit",f,a]]),le(l,u-1,s-u+3,p),s=u+p.length-2;break}}for(s=-1;++s<l.length;)l[s][1].type==="strikethroughSequenceTemporary"&&(l[s][1].type="data");return l}function o(l,a,s){const u=this.previous,f=this.events;let c=0;return p;function p(g){return u===126&&f[f.length-1][1].type!=="characterEscape"?s(g):(l.enter("strikethroughSequenceTemporary"),h(g))}function h(g){const x=Fe(u);if(g===126)return c>1?s(g):(l.consume(g),c++,h);if(c<2&&!t)return s(g);const E=l.exit("strikethroughSequenceTemporary"),y=Fe(g);return E._open=!y||y===2&&!!x,E._close=!x||x===2&&!!y,a(g)}}}class Kc{constructor(){this.map=[]}add(n,t,r){Yc(this,n,t,r)}consume(n){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let t=this.map.length;const r=[];for(;t>0;)t-=1,r.push(n.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),n.length=this.map[t][0];r.push(n.slice()),n.length=0;let i=r.pop();for(;i;){for(const o of i)n.push(o);i=r.pop()}this.map.length=0}}function Yc(e,n,t,r){let i=0;if(!(t===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===n){e.map[i][1]+=t,e.map[i][2].push(...r);return}i+=1}e.map.push([n,t,r])}}function Xc(e,n){let t=!1;const r=[];for(;n<e.length;){const i=e[n];if(t){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(t=!0);n+=1}return r}function Qc(){return{flow:{null:{name:"table",tokenize:Jc,resolveAll:Zc}}}}function Jc(e,n,t){const r=this;let i=0,o=0,l;return a;function a(b){let P=r.events.length-1;for(;P>-1;){const R=r.events[P][1].type;if(R==="lineEnding"||R==="linePrefix")P--;else break}const A=P>-1?r.events[P][1].type:null,L=A==="tableHead"||A==="tableRow"?w:s;return L===w&&r.parser.lazy[r.now().line]?t(b):L(b)}function s(b){return e.enter("tableHead"),e.enter("tableRow"),u(b)}function u(b){return b===124||(l=!0,o+=1),f(b)}function f(b){return b===null?t(b):N(b)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):t(b):H(b)?V(e,f,"whitespace")(b):(o+=1,l&&(l=!1,i+=1),b===124?(e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),l=!0,f):(e.enter("data"),c(b)))}function c(b){return b===null||b===124||G(b)?(e.exit("data"),f(b)):(e.consume(b),b===92?p:c)}function p(b){return b===92||b===124?(e.consume(b),c):c(b)}function h(b){return r.interrupt=!1,r.parser.lazy[r.now().line]?t(b):(e.enter("tableDelimiterRow"),l=!1,H(b)?V(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):g(b))}function g(b){return b===45||b===58?E(b):b===124?(l=!0,e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),x):z(b)}function x(b){return H(b)?V(e,E,"whitespace")(b):E(b)}function E(b){return b===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(b),e.exit("tableDelimiterMarker"),y):b===45?(o+=1,y(b)):b===null||N(b)?D(b):z(b)}function y(b){return b===45?(e.enter("tableDelimiterFiller"),C(b)):z(b)}function C(b){return b===45?(e.consume(b),C):b===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(b),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(b))}function k(b){return H(b)?V(e,D,"whitespace")(b):D(b)}function D(b){return b===124?g(b):b===null||N(b)?!l||i!==o?z(b):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(b)):z(b)}function z(b){return t(b)}function w(b){return e.enter("tableRow"),_(b)}function _(b){return b===124?(e.enter("tableCellDivider"),e.consume(b),e.exit("tableCellDivider"),_):b===null||N(b)?(e.exit("tableRow"),n(b)):H(b)?V(e,_,"whitespace")(b):(e.enter("data"),U(b))}function U(b){return b===null||b===124||G(b)?(e.exit("data"),_(b)):(e.consume(b),b===92?j:U)}function j(b){return b===92||b===124?(e.consume(b),U):U(b)}}function Zc(e,n){let t=-1,r=!0,i=0,o=[0,0,0,0],l=[0,0,0,0],a=!1,s=0,u,f,c;const p=new Kc;for(;++t<e.length;){const h=e[t],g=h[1];h[0]==="enter"?g.type==="tableHead"?(a=!1,s!==0&&(sr(p,n,s,u,f),f=void 0,s=0),u={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(t,0,[["enter",u,n]])):g.type==="tableRow"||g.type==="tableDelimiterRow"?(r=!0,c=void 0,o=[0,0,0,0],l=[0,t+1,0,0],a&&(a=!1,f={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},p.add(t,0,[["enter",f,n]])),i=g.type==="tableDelimiterRow"?2:f?3:1):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],c=lt(p,n,o,i,void 0,c),o=[0,0,0,0]),l[2]=t)):g.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(l[0]=l[1],c=lt(p,n,o,i,void 0,c)),o=l,l=[o[1],t,0,0])):g.type==="tableHead"?(a=!0,s=t):g.type==="tableRow"||g.type==="tableDelimiterRow"?(s=t,o[1]!==0?(l[0]=l[1],c=lt(p,n,o,i,t,c)):l[1]!==0&&(c=lt(p,n,l,i,t,c)),i=0):i&&(g.type==="data"||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")&&(l[3]=t)}for(s!==0&&sr(p,n,s,u,f),p.consume(n.events),t=-1;++t<n.events.length;){const h=n.events[t];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=Xc(n.events,t))}return e}function lt(e,n,t,r,i,o){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";t[0]!==0&&(o.end=Object.assign({},Ne(n.events,t[0])),e.add(t[0],0,[["exit",o,n]]));const s=Ne(n.events,t[1]);if(o={type:l,start:Object.assign({},s),end:Object.assign({},s)},e.add(t[1],0,[["enter",o,n]]),t[2]!==0){const u=Ne(n.events,t[2]),f=Ne(n.events,t[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(t[2],0,[["enter",c,n]]),r!==2){const p=n.events[t[2]],h=n.events[t[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",t[3]>t[2]+1){const g=t[2]+1,x=t[3]-t[2]-1;e.add(g,x,[])}}e.add(t[3]+1,0,[["exit",c,n]])}return i!==void 0&&(o.end=Object.assign({},Ne(n.events,i)),e.add(i,0,[["exit",o,n]]),o=void 0),o}function sr(e,n,t,r,i){const o=[],l=Ne(n.events,t);i&&(i.end=Object.assign({},l),o.push(["exit",i,n])),r.end=Object.assign({},l),o.push(["exit",r,n]),e.add(t+1,0,o)}function Ne(e,n){const t=e[n],r=t[0]==="enter"?"start":"end";return t[1][r]}const ef={name:"tasklistCheck",tokenize:nf};function tf(){return{text:{91:ef}}}function nf(e,n,t){const r=this;return i;function i(s){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?t(s):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),o)}function o(s){return G(s)?(e.enter("taskListCheckValueUnchecked"),e.consume(s),e.exit("taskListCheckValueUnchecked"),l):s===88||s===120?(e.enter("taskListCheckValueChecked"),e.consume(s),e.exit("taskListCheckValueChecked"),l):t(s)}function l(s){return s===93?(e.enter("taskListCheckMarker"),e.consume(s),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):t(s)}function a(s){return N(s)?n(s):H(s)?e.check({tokenize:rf},n,t)(s):t(s)}}function rf(e,n,t){return V(e,r,"whitespace");function r(i){return i===null?t(i):n(i)}}function lf(e){return Tr([Pc(),jc(),Wc(e),Qc(),tf()])}const of={};function af(e){const n=this,t=e||of,r=n.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(lf(t)),o.push(Tc()),l.push(vc(t))}const di="https://www.tiagpctest.softiabot.com",sf="0x4AAAAAAB-BKyDZcYYqCbid",gi={BOTTOM_RIGHT:"bottom-right",BOTTOM_LEFT:"bottom-left",TOP_RIGHT:"top-right",TOP_LEFT:"top-left"},yi={LIGHT:"light",DARK:"dark",AUTO:"auto"},ki={SPANISH:"es",ENGLISH:"en",FRANCES:"fr"},uf={MOBILE:640},Ce={theme:yi.AUTO,position:gi.BOTTOM_RIGHT,language:ki.ENGLISH,width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0},cf={API_REQUEST:3e4},ur={MAX_LENGTH:2e3},ff=()=>window.innerWidth<uf.MOBILE,hf=e=>{try{return new Date(e).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})}catch{return""}},pf=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,Ot=()=>crypto.randomUUID(),mf=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",df=e=>e.trim().slice(0,2e3),gf=({size:e="md",className:n=""})=>{const t={sm:"w-4 h-4 border-2",md:"w-6 h-6 border-2",lg:"w-8 h-8 border-3"};return T.jsx("div",{className:`gpc-spinner ${t[e]} ${n}`,role:"status","aria-label":"Cargando",children:T.jsx("span",{className:"sr-only",children:"Cargando..."})})},yf=()=>T.jsxs("div",{className:"gpc-typing-indicator",role:"status","aria-label":"Escribiendo",children:[T.jsx("span",{className:"gpc-typing-dot"}),T.jsx("span",{className:"gpc-typing-dot"}),T.jsx("span",{className:"gpc-typing-dot"})]}),kf=({message:e,showMetadata:n=!1,messageRef:t=null})=>{const{t:r}=oe.useTranslation(),i=e.role==="user",o=!i&&e.isStreaming&&!e.content;return T.jsxs("div",{ref:t,className:`gpc-message ${i?"gpc-message-user":"gpc-message-assistant"}`,role:"article","aria-label":i?"Mensaje del usuario":"Mensaje del asistente",children:[T.jsx("div",{className:"gpc-message-content",children:o?T.jsx(yf,{}):i?e.content.trim():T.jsx(Ws,{remarkPlugins:[af],components:{table:({node:l,...a})=>T.jsx("div",{className:"gpc-table-wrapper",children:T.jsx("table",{className:"gpc-table",...a})}),thead:({node:l,...a})=>T.jsx("thead",{className:"gpc-table-head",...a}),tbody:({node:l,...a})=>T.jsx("tbody",{className:"gpc-table-body",...a}),tr:({node:l,...a})=>T.jsx("tr",{className:"gpc-table-row",...a}),th:({node:l,...a})=>T.jsx("th",{className:"gpc-table-header",...a}),td:({node:l,...a})=>T.jsx("td",{className:"gpc-table-cell",...a})},children:e.content})}),T.jsx("div",{className:`gpc-message-timestamp ${i?"gpc-message-timestamp-user":""}`,children:hf(e.timestamp)}),!i&&n&&e.metadata&&T.jsxs("div",{className:"gpc-message-metadata",children:[e.metadata.tokensUsed&&T.jsxs("div",{className:"gpc-metadata-item",children:[T.jsxs("strong",{children:[r("metadata.tokensUsed"),":"]})," ",e.metadata.tokensUsed]}),e.metadata.responseTimeMs&&T.jsxs("div",{className:"gpc-metadata-item",children:[T.jsxs("strong",{children:[r("metadata.responseTime"),":"]})," ",pf(e.metadata.responseTimeMs)]}),e.metadata.model&&T.jsxs("div",{className:"gpc-metadata-item",children:[T.jsxs("strong",{children:[r("metadata.model"),":"]})," ",e.metadata.model]})]})]})},xf=({messages:e,isLoading:n,showMetadata:t=!1,widgetConfig:r=null})=>{const{t:i}=oe.useTranslation(),o=O.useRef(null),l=O.useRef(null),a=O.useRef(e.length);O.useEffect(()=>{const c=e.length>a.current,p=e[e.length-1];c&&p&&(p.role==="user"?o.current?.scrollIntoView({behavior:"smooth"}):p.role==="assistant"&&p.isStreaming&&setTimeout(()=>{l.current?.scrollIntoView({behavior:"smooth",block:"start"})},100)),a.current=e.length},[e]);const s=r?.company_name||"TIA GPC",u=r?.company_logo_base64,f=u?.startsWith("data:")?u:u?`data:image/png;base64,${u}`:null;return e.length===0&&!n?T.jsx("div",{className:"gpc-messages-container",children:T.jsxs("div",{className:"gpc-empty-state",children:[f?T.jsx("div",{className:"gpc-welcome-logo",children:T.jsx("img",{src:f,alt:s,className:"gpc-welcome-company-logo"})}):T.jsx(me.MessageSquare,{className:"gpc-empty-icon"}),T.jsx("h3",{className:"gpc-empty-title",children:i("chat.welcome",{companyName:s})}),T.jsx("p",{className:"gpc-empty-text",children:i("chat.emptyState")})]})}):T.jsxs("div",{className:"gpc-messages-container gpc-scrollbar gpc-smooth-scroll",children:[e.map((c,p)=>T.jsx(kf,{message:c,showMetadata:t,messageRef:p===e.length-1?l:null},c.id)),T.jsx("div",{ref:o})]})},bf=1.2,wf=2e3,Sf=({onTranscript:e,isLoading:n,disabled:t,onRecordingStateChange:r,onAnalyserChange:i})=>{const{t:o}=oe.useTranslation(),[l,a]=O.useState(!1),[s,u]=O.useState(!1),f=O.useRef(null),c=O.useRef([]),p=O.useRef(null),h=O.useRef(null),g=O.useRef(null),x=O.useRef(null),E=O.useRef(null);O.useEffect(()=>()=>{f.current?.state==="recording"&&f.current.stop(),p.current&&p.current.state!=="closed"&&p.current.close(),E.current&&clearInterval(E.current)},[]),O.useEffect(()=>{r&&r(l||s)},[l,s,r]),O.useEffect(()=>{i&&i(h.current)},[h.current,i]);const y=()=>{if(!h.current||!g.current)return;h.current.getByteTimeDomainData(g.current);let _=0;for(let b=0;b<g.current.length;b++){const P=(g.current[b]-128)/128;_+=P*P}if(Math.sqrt(_/g.current.length)*100<bf){if(x.current||(x.current=Date.now()),Date.now()-x.current>wf){k();return}}else x.current=null},C=async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){alert(o("voice.unsupported"));return}const _=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:48e3,channelCount:1}});p.current=new(window.AudioContext||window.webkitAudioContext),h.current=p.current.createAnalyser(),p.current.createMediaStreamSource(_).connect(h.current),h.current.fftSize=1024,h.current.smoothingTimeConstant=.4,h.current.minDecibels=-85,h.current.maxDecibels=-15;const j=h.current.frequencyBinCount;g.current=new Uint8Array(j);const b=new MediaRecorder(_,{mimeType:"audio/webm;codecs=opus"});f.current=b,c.current=[],x.current=null,b.ondataavailable=P=>{P.data.size>0&&c.current.push(P.data)},b.onstop=async()=>{if(E.current&&(clearInterval(E.current),E.current=null),p.current&&p.current.state!=="closed"&&p.current.close(),x.current=null,c.current.length===0){console.warn("No audio data recorded");return}const P=new Blob(c.current,{type:"audio/webm"});u(!0);try{await e(P)}catch(A){console.error("Transcription error:",A),alert(o("voice.error"))}finally{u(!1),c.current=[]}},b.start(100),a(!0),E.current=setInterval(()=>{y()},100)}catch(_){console.error("Error accessing microphone:",_),_.name==="NotAllowedError"||_.name==="PermissionDeniedError"?alert(o("voice.permissionDenied")):alert(o("voice.unsupported"))}},k=()=>{!l&&f.current?.state!=="recording"||(f.current&&f.current.state==="recording"&&f.current.stop(),E.current&&(clearInterval(E.current),E.current=null),x.current=null,a(!1),f.current&&f.current.stream&&f.current.stream.getTracks().forEach(_=>_.stop()))},D=()=>{l?k():C()},z=t||n||s,w=o(s?"voice.processing":l?"voice.stop":"voice.record");return T.jsx("button",{type:"button",onClick:D,disabled:z,className:`gpc-voice-button ${l?"gpc-voice-recording":""}`,"aria-label":w,title:w,children:s?T.jsx("span",{className:"gpc-spinner"}):l?T.jsx(me.MicOff,{className:"gpc-icon gpc-voice-icon-active"}):T.jsx(me.Mic,{className:"gpc-icon"})})},Cf=({analyser:e,isRecording:n})=>{const t=O.useRef(null),r=O.useRef(null);return O.useEffect(()=>{if(!n||!e||!t.current)return;const i=t.current,o=i.getContext("2d"),l=e.frequencyBinCount,a=new Uint8Array(l),s=window.devicePixelRatio||1,u=i.getBoundingClientRect();i.width=u.width*s,i.height=u.height*s,o.scale(s,s);const f=u.width,c=u.height,p=40,h=3,g=2,x=()=>{if(!n)return;r.current=requestAnimationFrame(x),e.getByteFrequencyData(a),o.clearRect(0,0,f,c);const E=p*(h+g),y=(f-E)/2;for(let C=0;C<p;C++){const k=Math.floor(C*l/p),z=a[k]/255,w=Math.max(2,z*c*.8),_=y+C*(h+g),U=(c-w)/2,j=o.createLinearGradient(0,U,0,U+w);j.addColorStop(0,"rgba(59, 130, 246, 0.8)"),j.addColorStop(1,"rgba(96, 165, 250, 0.6)"),o.fillStyle=j,o.fillRect(_,U,h,w)}};return x(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,n]),n?T.jsx("div",{className:"gpc-audio-waveform-container",children:T.jsx("canvas",{ref:t,className:"gpc-audio-waveform-canvas","aria-label":"Audio waveform visualization"})}):null},Ef=({onSendMessage:e,isLoading:n,disabled:t,gpcService:r})=>{const{t:i}=oe.useTranslation(),[o,l]=O.useState(""),[a,s]=O.useState(!1),[u,f]=O.useState(null),c=O.useRef(null);O.useEffect(()=>{!t&&!n&&!a&&c.current?.focus()},[t,n,a]);const p=async k=>{k.preventDefault();const D=df(o);if(!(!D||n||t||a))try{await e(D),l("")}catch(z){console.error("Error sending message:",z)}},h=k=>{k.key==="Enter"&&!k.shiftKey&&!a&&(k.preventDefault(),p(k))},g=async k=>{if(!r)throw new Error("GPC Service not available");const D=await r.transcribeAudio(k);D.success&&D.text&&(l(D.text),c.current?.focus())},x=k=>{s(k)},E=k=>{f(k)},y=o.trim().length>0&&!n&&!t&&!a,C=n||t||a;return T.jsxs("form",{onSubmit:p,className:"gpc-input-container",children:[T.jsxs("div",{className:"gpc-input-wrapper",children:[T.jsx("input",{ref:c,type:"text",value:o,onChange:k=>l(k.target.value),onKeyDown:h,placeholder:a?"":i("chat.placeholder"),disabled:C,maxLength:ur.MAX_LENGTH,className:`gpc-input ${a?"gpc-input-recording":""}`,"aria-label":i("chat.placeholder"),"aria-describedby":"chat-input-help"}),T.jsx(Cf,{analyser:u,isRecording:a})]}),T.jsx(Sf,{onTranscript:g,isLoading:n,disabled:t,onRecordingStateChange:x,onAnalyserChange:E}),T.jsx("button",{type:"submit",disabled:!y,className:"gpc-send-button","aria-label":i("chat.send"),title:i("chat.send"),children:n?T.jsx("span",{className:"gpc-spinner"}):T.jsx(me.Send,{className:"gpc-icon"})}),T.jsxs("span",{id:"chat-input-help",className:"gpc-sr-only",children:[i("chat.placeholder"),". Máximo ",ur.MAX_LENGTH," caracteres."]})]})},Tf=({siteKey:e,onSuccess:n,onError:t})=>{const{t:r}=oe.useTranslation(),[i,o]=O.useState(!1),[l,a]=O.useState(null),s=async f=>{o(!0),a(null);try{await n(f)}catch(c){console.error("Turnstile validation error:",c),a(r("turnstile.error")),t?.(c)}finally{o(!1)}},u=f=>{console.error("Turnstile widget error:",f),a(r("turnstile.error")),t?.(new Error(r("turnstile.error")))};return T.jsxs("div",{className:"gpc-validator-container",children:[T.jsxs("div",{className:"gpc-validator-header",children:[T.jsx("h3",{className:"gpc-validator-title",children:r("chat.validation")}),T.jsx("p",{className:"gpc-validator-subtitle",children:r("turnstile.verifying")})]}),!l&&T.jsx("div",{className:"gpc-animate-fade-in",children:T.jsx(Pi.Turnstile,{siteKey:e,onSuccess:s,onError:u,options:{theme:"light",size:"normal"}})}),i&&T.jsxs("div",{className:"gpc-validator-loading",children:[T.jsx(gf,{size:"md"}),T.jsx("p",{className:"gpc-validator-text",children:r("chat.validation")})]}),l&&T.jsxs("div",{className:"gpc-validator-error",children:[T.jsx(me.AlertCircle,{className:"gpc-error-icon"}),T.jsxs("div",{className:"gpc-error-content",children:[T.jsx("p",{className:"gpc-error-title",children:r("errors.validation")}),T.jsx("p",{className:"gpc-error-message",children:l}),T.jsx("button",{onClick:()=>window.location.reload(),className:"gpc-error-button",children:r("chat.retry")})]})]})]})},vf=(e,n,t)=>{const{t:r}=oe.useTranslation(),[i,o]=O.useState([]),[l,a]=O.useState(!1),[s,u]=O.useState(null),f=O.useCallback(async h=>{if(!h.trim()||l)return;if(!n){Ft.error("Validación anti-bot pendiente");return}const g={id:Ot(),role:"user",content:h.trim(),timestamp:new Date().toISOString()};o(y=>[...y,g]),a(!0),u(null);const x=Ot(),E={id:x,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0};o(y=>[...y,E]);try{const y=await e.sendMessage(h,n,C=>{o(k=>k.map(D=>D.id===x?{...D,content:D.content+C}:D))});o(C=>C.map(k=>k.id===x?{id:y.data.message_id,role:"assistant",content:y.data.response,timestamp:y.data.created_at,isStreaming:!1,metadata:{costUsd:y.data.cost_usd,creditBalanceUsd:y.data.credit_balance_usd,inputTokens:y.data.input_tokens,outputTokens:y.data.output_tokens,responseTimeMs:y.data.response_time_ms,modelUsed:y.data.model_used}}:k))}catch(y){o(_=>_.filter(U=>U.id!==x));let C;try{C=JSON.parse(y.message)}catch{C={statusCode:500,message:y.message}}let k;const D=C.statusCode||500,z=C.errorCode||"";switch(D===401&&z==="SESSION_EXPIRED"&&(k=r("errors.sessionExpired","Session expired, please verify again"),t&&t()),D){case 401:k||(k=r("errors.unauthorized"));break;case 402:k=r("errors.insufficientCredits");break;case 403:z.includes("DOMAIN")||z.includes("UNAUTHORIZED")?k=r("errors.domainUnauthorized"):k=r("errors.validation");break;case 429:k=r("errors.rateLimit");break;case 503:case 502:case 504:k=r("errors.aiServiceUnavailable");break;case 500:k=r("errors.serverError");break;default:k=r("errors.generic")}u(k),Ft.error(k,{duration:4e3,position:"top-center"});const w={id:Ot(),role:"assistant",content:k,timestamp:new Date().toISOString()};o(_=>[..._,w])}finally{a(!1)}},[e,n,l,r,t]),c=O.useCallback(()=>{o([]),u(null)},[]),p=O.useCallback(()=>{u(null)},[]);return{messages:i,isLoading:l,error:s,sendMessage:f,clearMessages:c,clearError:p}},If=(e="auto")=>{const[n,t]=O.useState(e),[r,i]=O.useState("light");return O.useEffect(()=>{if(i(n==="auto"?mf():n),n==="auto"){const a=window.matchMedia("(prefers-color-scheme: dark)"),s=u=>{i(u.matches?"dark":"light")};return a.addEventListener("change",s),()=>{a.removeEventListener("change",s)}}},[n]),{theme:r,themeMode:n,setThemeMode:t,toggleTheme:()=>{t(l=>l==="auto"?r==="light"?"dark":"light":l==="light"?"dark":"light")}}},Af=({gpcService:e,licenseToken:n,widgetConfig:t,turnstileSiteKey:r,onClose:i,themeMode:o,showBranding:l=!0,showMetadata:a=!1,onError:s})=>{const{t:u}=oe.useTranslation(),[f,c]=O.useState(null),[p,h]=O.useState(!1),{theme:g,toggleTheme:x}=If(o),E=O.useCallback(()=>{h(!1),c(null),e&&e.renewSessionToken()},[e]),{messages:y,isLoading:C,sendMessage:k}=vf(e,f,E);O.useEffect(()=>{e&&e.hasValidCachedSession()&&(h(!0),c("CACHED_SESSION"))},[e]);const D=z=>{c(z),h(!0),e&&e.validateSession()};return O.useEffect(()=>()=>{e&&e.releaseSession().catch(z=>{console.error("Failed to release session:",z)})},[e]),T.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${g==="dark"?"gpc-dark":""}`,children:[T.jsx(Ni,{onClose:i,theme:g,onToggleTheme:x,showBranding:l,widgetConfig:t}),p?T.jsxs(T.Fragment,{children:[T.jsx(xf,{messages:y,isLoading:C,showMetadata:a,widgetConfig:t}),T.jsx(Ef,{onSendMessage:k,isLoading:C,disabled:!1,gpcService:e})]}):T.jsx(Tf,{siteKey:r,onSuccess:D,onError:s}),l&&T.jsx("div",{className:"gpc-footer",children:T.jsx("span",{className:"gpc-footer-text",children:u("widget.poweredBy")})}),T.jsx(Ft.Toaster,{position:"top-center"})]})};class mn{constructor(n,t){this.licenseToken=t,this.sessionToken=this._getOrCreateSessionToken(t),this.api=Di.create({baseURL:n||di,timeout:cf.API_REQUEST,headers:{"Content-Type":"application/json"}}),this.api.interceptors.request.use(r=>(this.licenseToken&&(r.headers.Authorization=`Bearer ${this.licenseToken}`),r))}_generateSessionToken(){return"session_"+Array.from(crypto.getRandomValues(new Uint8Array(28))).map(n=>n.toString(16).padStart(2,"0")).join("")}_getStorageKey(n){return`tiagpc_session_${n.substring(0,16)}`}_getOrCreateSessionToken(n){const t=this._getStorageKey(n);try{const i=localStorage.getItem(t);if(i){const{sessionToken:o,timestamp:l,validated:a}=JSON.parse(i),s=Date.now(),u=1440*60*1e3;if(a&&s-l<u)return o;localStorage.removeItem(t)}}catch(i){console.warn("[TIA GPC] Error leyendo sesión de localStorage:",i)}return this._generateSessionToken()}hasValidCachedSession(){const n=this._getStorageKey(this.licenseToken);try{const t=localStorage.getItem(n);if(t){const{sessionToken:r,timestamp:i,validated:o}=JSON.parse(t),l=Date.now(),a=1440*60*1e3;return o&&l-i<a}}catch(t){console.warn("[TIA GPC] Error verificando sesión:",t)}return!1}_saveSessionToken(n,t,r=!1){const i=this._getStorageKey(n);try{const o={sessionToken:t,timestamp:Date.now(),validated:r};localStorage.setItem(i,JSON.stringify(o))}catch(o){console.warn("[TIA GPC] Error guardando sesión en localStorage:",o)}}_clearSessionToken(n){const t=this._getStorageKey(n);try{localStorage.removeItem(t)}catch(r){console.warn("[TIA GPC] Error limpiando sesión:",r)}}async sendMessage(n,t,r){if(!this.licenseToken)throw new Error("License token is required.");const i=this.hasValidCachedSession();if(!t&&!i)throw new Error("Turnstile token is required for anti-bot validation.");const l=`${this.api.defaults.baseURL}/ask`;try{const a=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.licenseToken}`},body:JSON.stringify({message:n,turnstile_token:t||"CACHED_SESSION",session_token:this.sessionToken})});if(!a.ok){const g=await a.json().catch(()=>({}));throw new Error(JSON.stringify({statusCode:a.status,errorCode:g.error_code||"UNKNOWN_ERROR",message:g.message||"Request failed",retryAfter:g.retry_after_seconds||null}))}const s=a.body.getReader(),u=new TextDecoder;let f="",c="",p=null,h=null;for(;;){const{done:g,value:x}=await s.read();if(g)break;f+=u.decode(x,{stream:!0});const E=f.split(`
|
|
30
|
-
`);f=E.pop();for(const y of E){if(!y.trim()||!y.startsWith("data: "))continue;const C=y.replace("data: ","").trim();if(C!=="[DONE]")try{const k=JSON.parse(C);if(k.type==="content")c+=k.text,r&&r(k.text);else if(k.type==="metadata")p=k;else if(k.type==="summary")h=k;else if(k.type==="error")throw new Error(JSON.stringify({statusCode:k.status_code||500,errorCode:k.error_code,message:k.message,retryAfter:null}))}catch(k){if(k.message&&k.message.startsWith("{"))throw k;console.error("Error parsing SSE event:",k)}}}if(!h)throw new Error("No summary received from server");return{success:!0,data:{message_id:h.message_id,response:c,cost_usd:h.cost_usd,credit_balance_usd:h.credit_balance_usd,input_tokens:h.input_tokens,output_tokens:h.output_tokens,response_time_ms:h.response_time_ms,model_used:h.model_used,created_at:h.created_at}}}catch(a){throw a.message.startsWith("{")?a:new Error(JSON.stringify({statusCode:500,errorCode:"NETWORK_ERROR",message:a.message,retryAfter:null}))}}async transcribeAudio(n){if(!this.licenseToken)throw new Error("License token is required.");try{const t=new FormData;return t.append("file",n,"audio.webm"),(await this.api.post("/transcribe",t,{headers:{"Content-Type":"multipart/form-data"}})).data}catch(t){this._handleError(t)}}async releaseSession(){if(!this.licenseToken){console.warn("No license token available to release session");return}try{return(await this.api.post("/release-session",{session_token:this.sessionToken})).data}catch(n){console.error("Failed to release session:",n.message)}}async getInitConfig(){if(!this.licenseToken)throw new Error("License token is required.");try{return(await this.api.get("/init")).data}catch(n){this._handleError(n)}}async checkHealth(){try{return(await this.api.get("/health")).data}catch(n){return{status:"unhealthy",error:n.message}}}getSessionToken(){return this.sessionToken}renewSessionToken(){const n=this._generateSessionToken();this.sessionToken=n,this._saveSessionToken(this.licenseToken,n)}validateSession(){this._saveSessionToken(this.licenseToken,this.sessionToken,!0)}_handleError(n){if(n.response){const t=n.response.data,i={statusCode:n.response.status,errorCode:t.error_code||"UNKNOWN_ERROR",message:t.message||"Request failed",retryAfter:t.retry_after_seconds||null};throw new Error(JSON.stringify(i))}else throw n.request?new Error(JSON.stringify({statusCode:503,errorCode:"NETWORK_ERROR",message:"No response from server",retryAfter:null})):new Error(JSON.stringify({statusCode:500,errorCode:"INTERNAL_ERROR",message:n.message,retryAfter:null}))}}let ot=null;const Pf=(e,n)=>((!ot||n&&ot.licenseToken!==n)&&(ot=new mn(e,n)),ot),Df={title:"TIA GPC",poweredBy:"Desarrollado por TIA GPC",questionsTo:"Preguntas a"},Lf={title:"Asistente",placeholder:"Escribe tu pregunta...",send:"Enviar",close:"Cerrar",welcome:"¡Hola! Bienvenido a {{companyName}}. ¿En qué puedo ayudarte hoy?",emptyState:"Inicia una conversación escribiendo tu pregunta",validation:"Verificando seguridad...",retry:"Reintentar"},_f={record:"Grabar audio",recording:"Grabando...",stop:"Detener grabación",processing:"Transcribiendo audio...",error:"Error al transcribir audio",unsupported:"Tu navegador no soporta grabación de audio",permissionDenied:"Permiso de micrófono denegado"},Rf={light:"Claro",dark:"Oscuro",toggle:"Cambiar tema"},zf={unauthorized:"Autenticación fallida. Por favor, verifica tu token de licencia e intenta nuevamente.",validation:"Verificación anti-bot fallida. Por favor, recarga la página e intenta nuevamente.",network:"No se pudo conectar al servidor. Verifica tu conexión a internet.",rateLimit:"Has realizado demasiadas consultas o se alcanzó el límite de usuarios concurrentes. Por favor, espera un momento antes de continuar.",session:"Tu sesión ha expirado por inactividad. Por favor, recarga la página para continuar.",insufficientCredits:"Créditos insuficientes. Por favor, recarga créditos desde tu panel de administración para continuar usando TIA GPC.",generic:"Ha ocurrido un error inesperado. Por favor, intenta nuevamente.",aiServiceUnavailable:"El asistente está temporalmente no disponible. Por favor, intenta de nuevo en unos momentos.",serverError:"El servidor encontró un problema. Por favor, intenta de nuevo más tarde.",domainUnauthorized:"Este dominio no está autorizado para usar este widget. Por favor, contacta a tu administrador."},Nf={verifying:"Verificando que eres humano...",error:"No se pudo completar la verificación de seguridad. Por favor, recarga la página e intenta nuevamente."},Of={tokensUsed:"Tokens usados",responseTime:"Tiempo de respuesta",model:"Modelo"},Ff={widget:Df,chat:Lf,voice:_f,theme:Rf,errors:zf,turnstile:Nf,metadata:Of},Mf={title:"TIA GPC",poweredBy:"Powered by TIA GPC",questionsTo:"Questions to"},jf={title:"Assistant",placeholder:"Type your question...",send:"Send",close:"Close",welcome:"Hello! Welcome to {{companyName}}. How can I help you today?",emptyState:"Start a conversation by typing your question",validation:"Verifying security...",retry:"Retry"},Bf={record:"Record audio",recording:"Recording...",stop:"Stop recording",processing:"Transcribing audio...",error:"Error transcribing audio",unsupported:"Your browser does not support audio recording",permissionDenied:"Microphone permission denied"},Uf={light:"Light",dark:"Dark",toggle:"Toggle theme"},Hf={unauthorized:"Authentication failed. Please check your license token and try again.",validation:"Bot verification failed. Please reload the page and try again.",network:"Unable to connect to the server. Please check your internet connection.",rateLimit:"You've made too many requests or the concurrent user limit has been reached. Please wait a moment before continuing.",session:"Your session has expired due to inactivity. Please reload the page to continue.",insufficientCredits:"Insufficient credits. Please reload credits from your admin panel to continue using TIA GPC.",generic:"An unexpected error has occurred. Please try again.",aiServiceUnavailable:"The assistant is temporarily unavailable. Please try again in a few moments.",serverError:"The server encountered a problem. Please try again later.",domainUnauthorized:"This domain is not authorized to use this widget. Please contact your administrator."},qf={verifying:"Verifying you're human...",error:"Security verification could not be completed. Please reload the page and try again."},Vf={tokensUsed:"Tokens used",responseTime:"Response time",model:"Model"},$f={widget:Mf,chat:jf,voice:Bf,theme:Uf,errors:Hf,turnstile:qf,metadata:Vf},Gf={title:"TIA GPC",poweredBy:"Propulsé par TIA GPC",questionsTo:"Questions à"},Wf={title:"Assistant",placeholder:"Tapez votre question...",send:"Envoyer",close:"Fermer",welcome:"Bonjour ! Bienvenue à {{companyName}}. Comment puis-je vous aider aujourd'hui ?",emptyState:"Commencez une conversation en tapant votre question",validation:"Vérification de sécurité...",retry:"Réessayer"},Kf={record:"Enregistrer audio",recording:"Enregistrement...",stop:"Arrêter l'enregistrement",processing:"Transcription audio...",error:"Erreur de transcription audio",unsupported:"Votre navigateur ne prend pas en charge l'enregistrement audio",permissionDenied:"Permission du microphone refusée"},Yf={light:"Clair",dark:"Sombre",toggle:"Changer de thème"},Xf={unauthorized:"Échec de l'authentification. Veuillez vérifier votre jeton de licence et réessayer.",validation:"La vérification anti-bot a échoué. Veuillez recharger la page et réessayer.",network:"Impossible de se connecter au serveur. Veuillez vérifier votre connexion internet.",rateLimit:"Vous avez fait trop de demandes ou la limite d'utilisateurs concurrents a été atteinte. Veuillez patienter un moment avant de continuer.",session:"Votre session a expiré en raison d'inactivité. Veuillez recharger la page pour continuer.",insufficientCredits:"Crédits insuffisants. Veuillez recharger des crédits depuis votre panneau d'administration pour continuer à utiliser TIA GPC.",generic:"Une erreur inattendue s'est produite. Veuillez réessayer.",aiServiceUnavailable:"L'assistant est temporairement indisponible. Veuillez réessayer dans quelques instants.",serverError:"Le serveur a rencontré un problème. Veuillez réessayer plus tard.",domainUnauthorized:"Ce domaine n'est pas autorisé à utiliser ce widget. Veuillez contacter votre administrateur."},Qf={verifying:"Vérification que vous êtes humain...",error:"La vérification de sécurité n'a pas pu être complétée. Veuillez recharger la page et réessayer."},Jf={tokensUsed:"Tokens utilisés",responseTime:"Temps de réponse",model:"Modèle"},Zf={widget:Gf,chat:Wf,voice:Kf,theme:Yf,errors:Xf,turnstile:Qf,metadata:Jf};at.use(Li).use(oe.initReactI18next).init({resources:{en:{translation:$f},es:{translation:Ff},fr:{translation:Zf}},fallbackLng:"en",supportedLngs:["en","es","fr"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const xi=({token:e,turnstileSiteKey:n=sf,theme:t=Ce.theme,position:r=Ce.position,language:i=Ce.language,primaryColor:o,width:l=Ce.width,height:a=Ce.height,apiUrl:s=di,onReady:u,onError:f,onClose:c,autoOpen:p=Ce.autoOpen,showBranding:h=Ce.showBranding,mobileFullscreen:g=Ce.mobileFullscreen,...x})=>{const[E,y]=O.useState(p),[C,k]=O.useState(!1),[D,z]=O.useState(null),[w,_]=O.useState(!0),U=O.useMemo(()=>new mn(s,e),[s,e]);if(O.useEffect(()=>{const A=()=>{k(ff())};return A(),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[]),O.useEffect(()=>{i&&at.changeLanguage&&at.changeLanguage(i)},[i]),O.useEffect(()=>{(async()=>{if(!e){_(!1);return}try{const L=await U.getInitConfig();L.success&&(z(L.data),u&&u(L.data))}catch(L){console.error("[TIA GPC Widget] Error loading config:",L),f&&f(L)}finally{_(!1)}})()},[e,U,u,f]),!e)return console.error('[TIA GPC Widget] Error: "token" prop is required'),null;const j=()=>{y(!1),c?.()},b=()=>C&&g?"gpc-position-bottom-right":`gpc-position-${r}`,P=()=>{const A={};return o&&(A["--gpc-color-primary"]=o),(!C||!g)&&(l&&(A["--gpc-widget-width"]=l),a&&(A["--gpc-widget-height"]=a)),A};return T.jsx(oe.I18nextProvider,{i18n:at,children:T.jsxs("div",{className:`gpc-widget gpc-widget-container ${b()} ${t==="dark"?"gpc-dark":""}`,style:P(),children:[!E&&T.jsx(_i,{onClick:()=>y(!0),widgetConfig:D}),E&&!w&&T.jsx(Af,{gpcService:U,licenseToken:e,widgetConfig:D,turnstileSiteKey:n,onClose:j,themeMode:t,showBranding:h,showMetadata:x.showMetadata||!1,onError:f})]})})};xi.defaultProps={theme:"auto",position:"bottom-right",language:"en",width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0};exports.GPCService=mn;exports.LANGUAGES=ki;exports.THEMES=yi;exports.TiaGPCWidget=xi;exports.WIDGET_POSITIONS=gi;exports.getGPCService=Pf;
|
|
26
|
+
`))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:`
|
|
27
|
+
`,...s.current()});return/^[\t ]/.test(u)&&(u=it(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}ei.peek=Xu;function ei(e){return e.value||""}function Xu(){return"<"}ti.peek=Yu;function ti(e,t,n,r){const i=yn(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),o(),u}function Yu(){return"!"}ni.peek=Ju;function ni(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=h,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function Ju(){return"!"}ri.peek=Qu;function ri(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return i+r+i}function Qu(){return"`"}function ii(e,t){const n=ln(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}oi.peek=Zu;function oi(e,t,n,r){const i=yn(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(ii(e,n)){const h=n.stack;n.stack=[],a=n.enter("autolink");let c=o.move("<");return c+=o.move(n.containerPhrasing(e,{before:c,after:">",...o.current()})),c+=o.move(">"),a(),n.stack=h,c}a=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),a(),u}function Zu(e,t,n){return ii(e,n)?"<":"["}si.peek=ec;function si(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const h=n.stack;n.stack=[],o=n.enter("reference");const c=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=h,s(),i==="full"||!u||u!==c?l+=a.move(c+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function ec(){return"["}function xn(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function tc(e){const t=xn(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function nc(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ai(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function rc(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?nc(n):xn(n);const a=e.ordered?o==="."?")":".":tc(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),ai(n)===o&&h){let c=-1;for(;++c<e.children.length;){const p=e.children[c];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),u}function ic(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function oc(e,t,n,r){const i=ic(n);let s=n.bulletCurrent||xn(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),h);return l(),u;function h(c,p,f){return p?(f?"":" ".repeat(o))+c:(f?s:s+" ".repeat(o-s.length))+c}}function sc(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),i(),o}const ac=Ct(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function lc(e,t,n,r){return(e.children.some(function(o){return ac(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function uc(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}li.peek=cc;function li(e,t,n,r){const i=uc(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(e,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),h=kt(r.before.charCodeAt(r.before.length-1),u,i);h.inside&&(l=it(u)+l.slice(1));const c=l.charCodeAt(l.length-1),p=kt(r.after.charCodeAt(0),c,i);p.inside&&(l=l.slice(0,-1)+it(c));const f=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:p.outside,before:h.outside},a+l+f}function cc(e,t,n){return n.options.strong||"*"}function hc(e,t,n,r){return n.safe(e.value,r)}function fc(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function pc(e,t,n){const r=(ai(n)+(n.options.ruleSpaces?" ":"")).repeat(fc(n));return n.options.ruleSpaces?r.slice(0,-1):r}const ui={blockquote:Mu,break:lr,code:Hu,definition:Vu,emphasis:Zr,hardBreak:lr,heading:Ku,html:ei,image:ti,imageReference:ni,inlineCode:ri,link:oi,linkReference:si,list:rc,listItem:oc,paragraph:sc,root:lc,strong:li,text:hc,thematicBreak:pc};function dc(){return{enter:{table:mc,tableData:ur,tableHeader:ur,tableRow:yc},exit:{codeText:xc,table:gc,tableData:Ht,tableHeader:Ht,tableRow:Ht}}}function mc(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function gc(e){this.exit(e),this.data.inTable=void 0}function yc(e){this.enter({type:"tableRow",children:[]},e)}function Ht(e){this.exit(e)}function ur(e){this.enter({type:"tableCell",children:[]},e)}function xc(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,kc));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function kc(e,t){return t==="|"?t:e}function bc(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
28
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:o,tableCell:l,tableRow:a}};function o(f,d,b,C){return u(h(f,b,C),f.align)}function a(f,d,b,C){const k=c(f,b,C),v=u([k]);return v.slice(0,v.indexOf(`
|
|
29
|
+
`))}function l(f,d,b,C){const k=b.enter("tableCell"),v=b.enter("phrasing"),E=b.containerPhrasing(f,{...C,before:s,after:s});return v(),k(),E}function u(f,d){return zu(f,{align:d,alignDelimiters:r,padding:n,stringLength:i})}function h(f,d,b){const C=f.children;let k=-1;const v=[],E=d.enter("table");for(;++k<C.length;)v[k]=c(C[k],d,b);return E(),v}function c(f,d,b){const C=f.children;let k=-1;const v=[],E=d.enter("tableRow");for(;++k<C.length;)v[k]=l(C[k],f,d,b);return E(),v}function p(f,d,b){let C=ui.inlineCode(f,d,b);return b.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function wc(){return{exit:{taskListCheckValueChecked:cr,taskListCheckValueUnchecked:cr,paragraph:Cc}}}function vc(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Sc}}}function cr(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Cc(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function Sc(e,t,n,r){const i=e.children[0],s=typeof e.checked=="boolean"&&i&&i.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=ui.listItem(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(h){return h+o}}function Ec(){return[ru(),Su(),Au(),dc(),wc()]}function Tc(e){return{extensions:[iu(),Eu(e),_u(),bc(e),vc()]}}const Ic={tokenize:Dc,partial:!0},ci={tokenize:zc,partial:!0},hi={tokenize:Rc,partial:!0},fi={tokenize:Mc,partial:!0},Ac={tokenize:jc,partial:!0},pi={name:"wwwAutolink",tokenize:Pc,previous:mi},di={name:"protocolAutolink",tokenize:Lc,previous:gi},Ne={name:"emailAutolink",tokenize:Nc,previous:yi},Ee={};function _c(){return{text:Ee}}let Re=48;for(;Re<123;)Ee[Re]=Ne,Re++,Re===58?Re=65:Re===91&&(Re=97);Ee[43]=Ne;Ee[45]=Ne;Ee[46]=Ne;Ee[95]=Ne;Ee[72]=[Ne,di];Ee[104]=[Ne,di];Ee[87]=[Ne,pi];Ee[119]=[Ne,pi];function Nc(e,t,n){const r=this;let i,s;return o;function o(c){return!en(c)||!yi.call(r,r.previous)||kn(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(c))}function a(c){return en(c)?(e.consume(c),a):c===64?(e.consume(c),l):n(c)}function l(c){return c===46?e.check(Ac,h,u)(c):c===45||c===95||ue(c)?(s=!0,e.consume(c),l):h(c)}function u(c){return e.consume(c),i=!0,l}function h(c){return s&&i&&pe(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(c)):n(c)}}function Pc(e,t,n){const r=this;return i;function i(o){return o!==87&&o!==119||!mi.call(r,r.previous)||kn(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Ic,e.attempt(ci,e.attempt(hi,s),n),n)(o))}function s(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Lc(e,t,n){const r=this;let i="",s=!1;return o;function o(c){return(c===72||c===104)&&gi.call(r,r.previous)&&!kn(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(c),e.consume(c),a):n(c)}function a(c){if(pe(c)&&i.length<5)return i+=String.fromCodePoint(c),e.consume(c),a;if(c===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(c),l}return n(c)}function l(c){return c===47?(e.consume(c),s?u:(s=!0,l)):n(c)}function u(c){return c===null||gt(c)||X(c)||Me(c)||bt(c)?n(c):e.attempt(ci,e.attempt(hi,h),n)(c)}function h(c){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(c)}}function Dc(e,t,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),i):o===46&&r===3?(e.consume(o),s):n(o)}function s(o){return o===null?n(o):t(o)}}function zc(e,t,n){let r,i,s;return o;function o(u){return u===46||u===95?e.check(fi,l,a)(u):u===null||X(u)||Me(u)||u!==45&&bt(u)?l(u):(s=!0,e.consume(u),o)}function a(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),o}function l(u){return i||r||!s?n(u):t(u)}}function Rc(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(fi,t,s)(o):o===null||X(o)||Me(o)?t(o):(e.consume(o),i)}function s(o){return o===41&&r++,e.consume(o),i}}function Mc(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),s):a===93?(e.consume(a),i):a===60||a===null||X(a)||Me(a)?t(a):n(a)}function i(a){return a===null||a===40||a===91||X(a)||Me(a)?t(a):r(a)}function s(a){return pe(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):pe(a)?(e.consume(a),o):n(a)}}function jc(e,t,n){return r;function r(s){return e.consume(s),i}function i(s){return ue(s)?n(s):t(s)}}function mi(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||X(e)}function gi(e){return!pe(e)}function yi(e){return!(e===47||en(e))}function en(e){return e===43||e===45||e===46||e===95||ue(e)}function kn(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Oc={tokenize:Wc,partial:!0};function Fc(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:$c,continuation:{tokenize:Vc},exit:qc}},text:{91:{name:"gfmFootnoteCall",tokenize:Hc},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Bc,resolveTo:Uc}}}}function Bc(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const u=Ce(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Uc(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function Hc(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(c){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),l}function l(c){return c!==94?n(c):(e.enter("gfmFootnoteCallMarker"),e.consume(c),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(c){if(s>999||c===93&&!o||c===null||c===91||X(c))return n(c);if(c===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(Ce(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(c)}return X(c)||(o=!0),s++,e.consume(c),c===92?h:u}function h(c){return c===91||c===92||c===93?(e.consume(c),s++,u):u(c)}}function $c(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(d){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(d),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(d){return d===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(d),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(d)}function h(d){if(o>999||d===93&&!a||d===null||d===91||X(d))return n(d);if(d===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return s=Ce(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(d),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return X(d)||(a=!0),o++,e.consume(d),d===92?c:h}function c(d){return d===91||d===92||d===93?(e.consume(d),o++,h):h(d)}function p(d){return d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),i.includes(s)||i.push(s),V(e,f,"gfmFootnoteDefinitionWhitespace")):n(d)}function f(d){return t(d)}}function Vc(e,t,n){return e.check(st,t,e.attempt(Oc,t,n))}function qc(e){e.exit("gfmFootnoteDefinition")}function Wc(e,t,n){const r=this;return V(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(s):n(s)}}function Gc(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},c={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},p=[["enter",h,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",c,a]],f=a.parser.constructs.insideSpan.null;f&&ke(p,p.length,0,wt(f,o.slice(u+1,l),a)),ke(p,p.length,0,[["exit",c,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",h,a]]),ke(o,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,h=this.events;let c=0;return p;function p(d){return u===126&&h[h.length-1][1].type!=="characterEscape"?l(d):(o.enter("strikethroughSequenceTemporary"),f(d))}function f(d){const b=qe(u);if(d===126)return c>1?l(d):(o.consume(d),c++,f);if(c<2&&!n)return l(d);const C=o.exit("strikethroughSequenceTemporary"),k=qe(d);return C._open=!k||k===2&&!!b,C._close=!b||b===2&&!!k,a(d)}}}class Kc{constructor(){this.map=[]}add(t,n,r){Xc(this,t,n,r)}consume(t){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Xc(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Yc(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Jc(){return{flow:{null:{name:"table",tokenize:Qc,resolveAll:Zc}}}}function Qc(e,t,n){const r=this;let i=0,s=0,o;return a;function a(y){let A=r.events.length-1;for(;A>-1;){const _=r.events[A][1].type;if(_==="lineEnding"||_==="linePrefix")A--;else break}const D=A>-1?r.events[A][1].type:null,N=D==="tableHead"||D==="tableRow"?w:l;return N===w&&r.parser.lazy[r.now().line]?n(y):N(y)}function l(y){return e.enter("tableHead"),e.enter("tableRow"),u(y)}function u(y){return y===124||(o=!0,s+=1),h(y)}function h(y){return y===null?n(y):j(y)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),f):n(y):H(y)?V(e,h,"whitespace")(y):(s+=1,o&&(o=!1,i+=1),y===124?(e.enter("tableCellDivider"),e.consume(y),e.exit("tableCellDivider"),o=!0,h):(e.enter("data"),c(y)))}function c(y){return y===null||y===124||X(y)?(e.exit("data"),h(y)):(e.consume(y),y===92?p:c)}function p(y){return y===92||y===124?(e.consume(y),c):c(y)}function f(y){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(y):(e.enter("tableDelimiterRow"),o=!1,H(y)?V(e,d,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):d(y))}function d(y){return y===45||y===58?C(y):y===124?(o=!0,e.enter("tableCellDivider"),e.consume(y),e.exit("tableCellDivider"),b):P(y)}function b(y){return H(y)?V(e,C,"whitespace")(y):C(y)}function C(y){return y===58?(s+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(y),e.exit("tableDelimiterMarker"),k):y===45?(s+=1,k(y)):y===null||j(y)?z(y):P(y)}function k(y){return y===45?(e.enter("tableDelimiterFiller"),v(y)):P(y)}function v(y){return y===45?(e.consume(y),v):y===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(y),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(y))}function E(y){return H(y)?V(e,z,"whitespace")(y):z(y)}function z(y){return y===124?d(y):y===null||j(y)?!o||i!==s?P(y):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(y)):P(y)}function P(y){return n(y)}function w(y){return e.enter("tableRow"),R(y)}function R(y){return y===124?(e.enter("tableCellDivider"),e.consume(y),e.exit("tableCellDivider"),R):y===null||j(y)?(e.exit("tableRow"),t(y)):H(y)?V(e,R,"whitespace")(y):(e.enter("data"),O(y))}function O(y){return y===null||y===124||X(y)?(e.exit("data"),R(y)):(e.consume(y),y===92?F:O)}function F(y){return y===92||y===124?(e.consume(y),O):O(y)}}function Zc(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,h,c;const p=new Kc;for(;++n<e.length;){const f=e[n],d=f[1];f[0]==="enter"?d.type==="tableHead"?(a=!1,l!==0&&(hr(p,t,l,u,h),h=void 0,l=0),u={type:"table",start:Object.assign({},d.start),end:Object.assign({},d.end)},p.add(n,0,[["enter",u,t]])):d.type==="tableRow"||d.type==="tableDelimiterRow"?(r=!0,c=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,h={type:"tableBody",start:Object.assign({},d.start),end:Object.assign({},d.end)},p.add(n,0,[["enter",h,t]])),i=d.type==="tableDelimiterRow"?2:h?3:1):i&&(d.type==="data"||d.type==="tableDelimiterMarker"||d.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],c=ft(p,t,s,i,void 0,c),s=[0,0,0,0]),o[2]=n)):d.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],c=ft(p,t,s,i,void 0,c)),s=o,o=[s[1],n,0,0])):d.type==="tableHead"?(a=!0,l=n):d.type==="tableRow"||d.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],c=ft(p,t,s,i,n,c)):o[1]!==0&&(c=ft(p,t,o,i,n,c)),i=0):i&&(d.type==="data"||d.type==="tableDelimiterMarker"||d.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&hr(p,t,l,u,h),p.consume(t.events),n=-1;++n<t.events.length;){const f=t.events[n];f[0]==="enter"&&f[1].type==="table"&&(f[1]._align=Yc(t.events,n))}return e}function ft(e,t,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},$e(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const l=$e(t.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const u=$e(t.events,n[2]),h=$e(t.events,n[3]),c={type:a,start:Object.assign({},u),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",c,t]]),r!==2){const p=t.events[n[2]],f=t.events[n[3]];if(p[1].end=Object.assign({},f[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const d=n[2]+1,b=n[3]-n[2]-1;e.add(d,b,[])}}e.add(n[3]+1,0,[["exit",c,t]])}return i!==void 0&&(s.end=Object.assign({},$e(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function hr(e,t,n,r,i){const s=[],o=$e(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function $e(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const eh={name:"tasklistCheck",tokenize:nh};function th(){return{text:{91:eh}}}function nh(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),s)}function s(l){return X(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return j(l)?t(l):H(l)?e.check({tokenize:rh},t,n)(l):n(l)}}function rh(e,t,n){return V(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function ih(e){return Ar([_c(),Fc(),Gc(e),Jc(),th()])}const oh={};function sh(e){const t=this,n=e||oh,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(ih(n)),s.push(Ec()),o.push(Tc(n))}const xi="https://www.tiagpctest.softiabot.com",ah="0x4AAAAAAB-BKyDZcYYqCbid",ki={BOTTOM_RIGHT:"bottom-right",BOTTOM_LEFT:"bottom-left",TOP_RIGHT:"top-right",TOP_LEFT:"top-left"},bi={LIGHT:"light",DARK:"dark",AUTO:"auto"},wi={SPANISH:"es",ENGLISH:"en",FRANCES:"fr"},lh={MOBILE:640},Le={theme:bi.AUTO,position:ki.BOTTOM_RIGHT,language:wi.ENGLISH,width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0},uh={API_REQUEST:3e4},fr={MAX_LENGTH:2e3},ch=()=>window.innerWidth<lh.MOBILE,hh=e=>{try{return new Date(e).toLocaleTimeString("es-ES",{hour:"2-digit",minute:"2-digit"})}catch{return""}},fh=e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`,$t=()=>crypto.randomUUID(),ph=()=>window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",dh=e=>e.trim().slice(0,2e3),mh=({size:e="md",className:t=""})=>{const{t:n}=le.useTranslation(),r={sm:"w-4 h-4 border-2",md:"w-6 h-6 border-2",lg:"w-8 h-8 border-3"};return x.jsx("div",{className:`gpc-spinner ${r[e]} ${t}`,role:"status","aria-label":n("ui.spinner.loading"),children:x.jsx("span",{className:"sr-only",children:n("ui.spinner.loading")})})},gh=()=>{const{t:e}=le.useTranslation();return x.jsxs("div",{className:"gpc-typing-indicator",role:"status","aria-label":e("ui.typingIndicator.typing"),children:[x.jsx("span",{className:"gpc-typing-dot"}),x.jsx("span",{className:"gpc-typing-dot"}),x.jsx("span",{className:"gpc-typing-dot"})]})},yh=({message:e,showMetadata:t=!1,messageRef:n=null})=>{const{t:r}=le.useTranslation(),i=e.role==="user",s=!i&&e.isStreaming&&!e.content;return x.jsxs("div",{ref:n,className:`gpc-message ${i?"gpc-message-user":"gpc-message-assistant"}`,role:"article","aria-label":r(i?"ui.message.userMessage":"ui.message.assistantMessage"),children:[x.jsx("div",{className:"gpc-message-content",children:s?x.jsx(gh,{}):i?e.content.trim():x.jsx(Gl,{remarkPlugins:[sh],components:{table:({node:o,...a})=>x.jsx("div",{className:"gpc-table-wrapper",children:x.jsx("table",{className:"gpc-table",...a})}),thead:({node:o,...a})=>x.jsx("thead",{className:"gpc-table-head",...a}),tbody:({node:o,...a})=>x.jsx("tbody",{className:"gpc-table-body",...a}),tr:({node:o,...a})=>x.jsx("tr",{className:"gpc-table-row",...a}),th:({node:o,...a})=>x.jsx("th",{className:"gpc-table-header",...a}),td:({node:o,...a})=>x.jsx("td",{className:"gpc-table-cell",...a})},children:e.content})}),x.jsx("div",{className:`gpc-message-timestamp ${i?"gpc-message-timestamp-user":""}`,children:hh(e.timestamp)}),!i&&t&&e.metadata&&x.jsxs("div",{className:"gpc-message-metadata",children:[e.metadata.tokensUsed&&x.jsxs("div",{className:"gpc-metadata-item",children:[x.jsxs("strong",{children:[r("metadata.tokensUsed"),":"]})," ",e.metadata.tokensUsed]}),e.metadata.responseTimeMs&&x.jsxs("div",{className:"gpc-metadata-item",children:[x.jsxs("strong",{children:[r("metadata.responseTime"),":"]})," ",fh(e.metadata.responseTimeMs)]}),e.metadata.model&&x.jsxs("div",{className:"gpc-metadata-item",children:[x.jsxs("strong",{children:[r("metadata.model"),":"]})," ",e.metadata.model]})]})]})},xh=({messages:e,isLoading:t,showMetadata:n=!1,widgetConfig:r=null,hasMoreMessages:i=!1,isLoadingMoreMessages:s=!1,onLoadMoreMessages:o=null})=>{const{t:a}=le.useTranslation(),l=T.useRef(null),u=T.useRef(null),h=T.useRef(0),c=T.useRef(!1),p=T.useRef(null),f=T.useRef(null),d=T.useRef(0);T.useLayoutEffect(()=>{e.length>0&&!c.current&&(l.current?.scrollIntoView({behavior:"instant"}),c.current=!0,h.current=e.length)},[e.length]),T.useEffect(()=>{if(!o)return;const z=new IntersectionObserver(P=>{P[0].isIntersecting&&i&&!s&&(p.current&&(d.current=p.current.scrollHeight),o())},{threshold:1});return f.current&&z.observe(f.current),()=>{f.current&&z.unobserve(f.current)}},[i,s,o]),T.useEffect(()=>{if(s===!1&&d.current>0&&p.current){const P=p.current.scrollHeight-d.current;p.current.scrollTop=P,d.current=0}},[s]),T.useEffect(()=>{const z=e.length,P=h.current,w=e[z-1],R=z>P+1;z>0&&c.current&&(R?setTimeout(()=>{l.current?.scrollIntoView({behavior:"instant"})},150):z>P&&w&&(w.role==="user"?l.current?.scrollIntoView({behavior:"smooth"}):w.role==="assistant"&&w.isStreaming&&setTimeout(()=>{u.current?.scrollIntoView({behavior:"smooth",block:"start"})},100))),h.current=z},[e]);const b=r?.widget_customization?.branding?.company_name||"TIA GPC",C=r?.widget_customization?.branding?.company_logo_base64,k=r?.widget_customization?.welcome_message,v=C?.startsWith("data:")?C:C?`data:image/png;base64,${C}`:null,E=k||a("chat.welcome",{companyName:b});return e.length===0&&!t?x.jsx("div",{className:"gpc-messages-container",children:x.jsxs("div",{className:"gpc-empty-state",children:[v?x.jsx("div",{className:"gpc-welcome-logo",children:x.jsx("img",{src:v,alt:b,className:"gpc-welcome-company-logo"})}):x.jsx(se.MessageSquare,{className:"gpc-empty-icon"}),x.jsx("h3",{className:"gpc-empty-title",children:E}),x.jsx("p",{className:"gpc-empty-text",children:a("chat.emptyState")})]})}):x.jsxs("div",{ref:p,className:"gpc-messages-container gpc-scrollbar gpc-smooth-scroll",children:[i&&x.jsx("div",{style:{textAlign:"center",padding:"10px"},children:s?x.jsxs("div",{className:"gpc-loading-more-messages",children:[x.jsx("div",{className:"gpc-loading-spinner"}),x.jsx("span",{children:a("chat.loadingMore","Loading older messages...")})]}):x.jsx("div",{ref:f,style:{height:"1px"}})}),e.map((z,P)=>x.jsx(yh,{message:z,showMetadata:n,messageRef:P===e.length-1?u:null},z.id)),x.jsx("div",{ref:l})]})},kh=1.2,bh=2e3,wh=({onTranscript:e,isLoading:t,disabled:n,onRecordingStateChange:r,onAnalyserChange:i})=>{const{t:s}=le.useTranslation(),[o,a]=T.useState(!1),[l,u]=T.useState(!1),h=T.useRef(null),c=T.useRef([]),p=T.useRef(null),f=T.useRef(null),d=T.useRef(null),b=T.useRef(null),C=T.useRef(null);T.useEffect(()=>()=>{h.current?.state==="recording"&&h.current.stop(),p.current&&p.current.state!=="closed"&&p.current.close(),C.current&&clearInterval(C.current)},[]),T.useEffect(()=>{r&&r(o||l)},[o,l,r]),T.useEffect(()=>{i&&i(f.current)},[f.current,i]);const k=()=>{if(!f.current||!d.current)return;f.current.getByteTimeDomainData(d.current);let R=0;for(let y=0;y<d.current.length;y++){const A=(d.current[y]-128)/128;R+=A*A}if(Math.sqrt(R/d.current.length)*100<kh){if(b.current||(b.current=Date.now()),Date.now()-b.current>bh){E();return}}else b.current=null},v=async()=>{try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){alert(s("voice.unsupported"));return}const R=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,sampleRate:48e3,channelCount:1}});p.current=new(window.AudioContext||window.webkitAudioContext),f.current=p.current.createAnalyser(),p.current.createMediaStreamSource(R).connect(f.current),f.current.fftSize=1024,f.current.smoothingTimeConstant=.4,f.current.minDecibels=-85,f.current.maxDecibels=-15;const F=f.current.frequencyBinCount;d.current=new Uint8Array(F);const y=new MediaRecorder(R,{mimeType:"audio/webm;codecs=opus"});h.current=y,c.current=[],b.current=null,y.ondataavailable=A=>{A.data.size>0&&c.current.push(A.data)},y.onstop=async()=>{if(C.current&&(clearInterval(C.current),C.current=null),p.current&&p.current.state!=="closed"&&p.current.close(),b.current=null,c.current.length===0){console.warn("No audio data recorded");return}const A=new Blob(c.current,{type:"audio/webm"});u(!0);try{await e(A)}catch(D){console.error("Transcription error:",D),alert(s("voice.error"))}finally{u(!1),c.current=[]}},y.start(100),a(!0),C.current=setInterval(()=>{k()},100)}catch(R){console.error("Error accessing microphone:",R),R.name==="NotAllowedError"||R.name==="PermissionDeniedError"?alert(s("voice.permissionDenied")):alert(s("voice.unsupported"))}},E=()=>{!o&&h.current?.state!=="recording"||(h.current&&h.current.state==="recording"&&h.current.stop(),C.current&&(clearInterval(C.current),C.current=null),b.current=null,a(!1),h.current&&h.current.stream&&h.current.stream.getTracks().forEach(R=>R.stop()))},z=()=>{o?E():v()},P=n||t||l,w=s(l?"voice.processing":o?"voice.stop":"voice.record");return x.jsx("button",{type:"button",onClick:z,disabled:P,className:`gpc-voice-button ${o?"gpc-voice-recording":""}`,"aria-label":w,title:w,children:l?x.jsx("span",{className:"gpc-spinner"}):o?x.jsx(se.MicOff,{className:"gpc-icon gpc-voice-icon-active"}):x.jsx(se.Mic,{className:"gpc-icon"})})},vh=({analyser:e,isRecording:t})=>{const n=T.useRef(null),r=T.useRef(null);return T.useEffect(()=>{if(!t||!e||!n.current)return;const i=n.current,s=i.getContext("2d"),o=e.frequencyBinCount,a=new Uint8Array(o),l=window.devicePixelRatio||1,u=i.getBoundingClientRect();i.width=u.width*l,i.height=u.height*l,s.scale(l,l);const h=u.width,c=u.height,p=40,f=3,d=2,b=()=>{if(!t)return;r.current=requestAnimationFrame(b),e.getByteFrequencyData(a),s.clearRect(0,0,h,c);const C=p*(f+d),k=(h-C)/2;for(let v=0;v<p;v++){const E=Math.floor(v*o/p),P=a[E]/255,w=Math.max(2,P*c*.8),R=k+v*(f+d),O=(c-w)/2,F=s.createLinearGradient(0,O,0,O+w);F.addColorStop(0,"rgba(59, 130, 246, 0.8)"),F.addColorStop(1,"rgba(96, 165, 250, 0.6)"),s.fillStyle=F,s.fillRect(R,O,f,w)}};return b(),()=>{r.current&&cancelAnimationFrame(r.current)}},[e,t]),t?x.jsx("div",{className:"gpc-audio-waveform-container",children:x.jsx("canvas",{ref:n,className:"gpc-audio-waveform-canvas","aria-label":"Audio waveform visualization"})}):null},Ch=({onSendMessage:e,isLoading:t,disabled:n,gpcService:r,showBranding:i=!0})=>{const{t:s}=le.useTranslation(),[o,a]=T.useState(""),[l,u]=T.useState(!1),[h,c]=T.useState(null),p=T.useRef(null);T.useEffect(()=>{!n&&!t&&!l&&p.current?.focus()},[n,t,l]),T.useEffect(()=>{p.current&&(p.current.style.height="auto",p.current.style.height=`${Math.min(p.current.scrollHeight,120)}px`)},[o]);const f=async P=>{P.preventDefault();const w=dh(o);if(!(!w||t||n||l))try{await e(w),a(""),p.current&&(p.current.style.height="auto")}catch(R){console.error("Error sending message:",R)}},d=P=>{P.key==="Enter"&&!P.shiftKey&&!l&&(P.preventDefault(),f(P))},b=async P=>{if(!r)throw new Error(s("toast.gpcServiceNotAvailable"));const w=await r.transcribeAudio(P);w.success&&w.text&&(a(w.text),p.current?.focus())},C=P=>{u(P)},k=P=>{c(P)},v=o.trim().length>0&&!t&&!n&&!l,E=t||n||l,z=n||o.trim().length>0;return x.jsxs("form",{onSubmit:f,className:"gpc-input-container",children:[x.jsxs("div",{className:"gpc-input-wrapper",children:[x.jsx("textarea",{ref:p,value:o,onChange:P=>a(P.target.value),onKeyDown:d,placeholder:l?"":s("chat.placeholder"),disabled:E,maxLength:fr.MAX_LENGTH,className:`gpc-input gpc-textarea ${l?"gpc-input-recording":""}`,"aria-label":s("chat.placeholder"),"aria-describedby":"chat-input-help",rows:1}),x.jsx(vh,{analyser:h,isRecording:l})]}),x.jsxs("div",{className:"gpc-input-actions-right",children:[x.jsx(wh,{onTranscript:b,isLoading:t,disabled:z,onRecordingStateChange:C,onAnalyserChange:k}),x.jsx("button",{type:"submit",disabled:!v,className:"gpc-send-button","aria-label":s("chat.send"),title:s("chat.send"),children:t?x.jsx("span",{className:"gpc-spinner"}):x.jsx(se.Send,{className:"gpc-icon"})})]}),i&&x.jsx("span",{className:"gpc-footer-text",children:s("widget.poweredBy")}),x.jsxs("span",{id:"chat-input-help",className:"gpc-sr-only",children:[s("chat.placeholder"),"."," ",s("input.maxCharacters",{count:fr.MAX_LENGTH})]})]})},Sh=({siteKey:e,onSuccess:t,onError:n})=>{const{t:r}=le.useTranslation(),[i,s]=T.useState(!1),[o,a]=T.useState(null),l=async h=>{s(!0),a(null);try{await t(h)}catch(c){console.error("Turnstile validation error:",c),a(r("turnstile.error")),n?.(c)}finally{s(!1)}},u=h=>{console.error("Turnstile widget error:",h),a(r("turnstile.error")),n?.(new Error(r("turnstile.error")))};return x.jsxs("div",{className:"gpc-validator-container",children:[x.jsxs("div",{className:"gpc-validator-header",children:[x.jsx("h3",{className:"gpc-validator-title",children:r("chat.validation")}),x.jsx("p",{className:"gpc-validator-subtitle",children:r("turnstile.verifying")})]}),!o&&x.jsx("div",{className:"gpc-animate-fade-in",children:x.jsx(_i.Turnstile,{siteKey:e,onSuccess:l,onError:u,options:{theme:"light",size:"normal"}})}),i&&x.jsxs("div",{className:"gpc-validator-loading",children:[x.jsx(mh,{size:"md"}),x.jsx("p",{className:"gpc-validator-text",children:r("chat.validation")})]}),o&&x.jsxs("div",{className:"gpc-validator-error",children:[x.jsx(se.AlertCircle,{className:"gpc-error-icon"}),x.jsxs("div",{className:"gpc-error-content",children:[x.jsx("p",{className:"gpc-error-title",children:r("errors.validation")}),x.jsx("p",{className:"gpc-error-message",children:o}),x.jsx("button",{onClick:()=>window.location.reload(),className:"gpc-error-button",children:r("chat.retry")})]})]})]})},Eh=({isOpen:e,onClose:t,onConfirm:n,message:r,confirmText:i,cancelText:s,variant:o="danger"})=>{const{t:a}=le.useTranslation();if(!e)return null;const l=()=>{n(),t()};return x.jsx("div",{className:"gpc-confirm-toast-container gpc-animate-slide-down",children:x.jsxs("div",{className:`gpc-confirm-toast ${o==="danger"?"gpc-confirm-toast-danger":""}`,children:[x.jsx("p",{className:"gpc-confirm-toast-message",children:r}),x.jsxs("div",{className:"gpc-confirm-toast-actions",children:[x.jsx("button",{onClick:t,className:"gpc-confirm-toast-button gpc-confirm-toast-button-cancel gpc-focus-visible gpc-transition",children:s||a("conversations.cancel","Cancel")}),x.jsx("button",{onClick:l,className:"gpc-confirm-toast-button gpc-confirm-toast-button-confirm gpc-focus-visible gpc-transition",children:i||a("conversations.delete","Delete")})]})]})})},Th=({conversations:e,totalConversations:t,currentConversationId:n,onSelectConversation:r,onNewConversation:i,onRenameConversation:s,onDeleteConversation:o,isLoadingHistory:a,hasMoreConversations:l,isLoadingMoreConversations:u,onLoadMore:h})=>{const{t:c}=le.useTranslation(),p=T.useRef(null),[f,d]=T.useState(null),[b,C]=T.useState(""),[k,v]=T.useState({isOpen:!1,id:null,title:""});T.useEffect(()=>{const y=new IntersectionObserver(A=>{A[0].isIntersecting&&l&&!u&&!a&&h()},{threshold:1});return p.current&&y.observe(p.current),()=>{p.current&&y.unobserve(p.current)}},[l,u,a,h]);const E=y=>{const A=new Date(y),N=new Date-A,_=Math.floor(N/6e4),M=Math.floor(N/36e5),q=Math.floor(N/864e5);return _<1?c("time.justNow","Just now"):_<60?c("time.minutesAgo",`${_} min ago`,{count:_}):M<24?c("time.hoursAgo",`${M}h ago`,{count:M}):q<7?c("time.daysAgo",`${q}d ago`,{count:q}):A.toLocaleDateString()},z=y=>{d(y.conversation_id),C(y.title||"")},P=()=>{d(null),C("")},w=y=>{b.trim()&&s&&(s(y,b.trim()),d(null),C(""))},R=(y,A)=>{v({isOpen:!0,id:y,title:A||c("conversations.untitled","Untitled conversation")})},O=()=>{k.id&&o&&o(k.id),v({isOpen:!1,id:null,title:""})},F=()=>{v({isOpen:!1,id:null,title:""})};return x.jsxs("div",{className:"gpc-conversations-container",children:[x.jsxs("div",{className:"gpc-conversations-header",children:[x.jsx("h3",{className:"gpc-conversations-title",children:c("conversations.title","Conversations")}),x.jsxs("button",{onClick:i,className:"gpc-new-conversation-button gpc-focus-visible gpc-transition",disabled:a,"aria-label":c("conversations.new","New"),children:[x.jsx(se.MessageSquare,{size:16}),x.jsx("span",{children:c("conversations.new","New")})]})]}),x.jsx("div",{className:"gpc-conversations-list",children:e.length===0?x.jsxs("div",{className:"gpc-conversations-empty",children:[x.jsx(se.MessageSquare,{size:48,className:"gpc-conversations-empty-icon"}),x.jsx("p",{className:"gpc-conversations-empty-text",children:c("conversations.empty","No conversations yet")}),x.jsx("p",{className:"gpc-conversations-empty-hint",children:c("conversations.emptyHint","Start a conversation to see it here")})]}):x.jsxs("div",{className:"gpc-conversations-items",children:[e.map(y=>x.jsx("div",{className:`gpc-conversation-item gpc-animate-fade-in ${n===y.conversation_id?"gpc-conversation-item-active":""} ${a?"gpc-conversation-item-disabled":""}`,children:x.jsx("div",{className:"gpc-conversation-content gpc-transition",onClick:()=>f!==y.conversation_id&&!a&&r(y.conversation_id),children:f===y.conversation_id?x.jsxs("div",{className:"gpc-conversation-edit",children:[x.jsx("input",{type:"text",value:b,onChange:A=>C(A.target.value),onKeyDown:A=>{A.key==="Enter"&&w(y.conversation_id),A.key==="Escape"&&P()},className:"gpc-conversation-edit-input gpc-focus-visible",placeholder:c("conversations.untitled","Untitled conversation"),autoFocus:!0,maxLength:200}),x.jsxs("div",{className:"gpc-conversation-edit-actions",children:[x.jsx("button",{onClick:()=>w(y.conversation_id),className:"gpc-conversation-action-button gpc-conversation-action-save gpc-focus-visible gpc-transition",title:c("conversations.save","Save"),"aria-label":c("conversations.save","Save"),children:x.jsx(se.Check,{size:16})}),x.jsx("button",{onClick:P,className:"gpc-conversation-action-button gpc-conversation-action-cancel gpc-focus-visible gpc-transition",title:c("conversations.cancel","Cancel"),"aria-label":c("conversations.cancel","Cancel"),children:x.jsx(se.X,{size:16})})]})]}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"gpc-conversation-header",children:[x.jsx("h4",{className:"gpc-conversation-title",children:y.title||c("conversations.untitled","Untitled conversation")}),x.jsxs("div",{className:"gpc-conversation-actions",children:[x.jsx("button",{onClick:A=>{A.stopPropagation(),z(y)},className:"gpc-conversation-action-button gpc-focus-visible gpc-transition",disabled:a,title:c("conversations.rename","Rename"),"aria-label":c("conversations.rename","Rename"),children:x.jsx(se.Pencil,{size:16})}),x.jsx("button",{onClick:A=>{A.stopPropagation(),R(y.conversation_id,y.title||c("conversations.untitled","Untitled conversation"))},className:"gpc-conversation-action-button gpc-conversation-action-delete gpc-focus-visible gpc-transition",disabled:a,title:c("conversations.delete","Delete"),"aria-label":c("conversations.delete","Delete"),children:x.jsx(se.Trash2,{size:16})})]})]}),x.jsxs("div",{className:"gpc-conversation-metadata",children:[x.jsxs("div",{className:"gpc-conversation-meta-item",children:[x.jsx(se.MessageSquare,{size:12}),x.jsx("span",{children:y.total_messages})]}),x.jsxs("div",{className:"gpc-conversation-meta-item",children:[x.jsx(se.Clock,{size:12}),x.jsx("span",{children:E(y.last_modification_date)})]})]})]})})},y.conversation_id)),u&&x.jsxs("div",{className:"gpc-conversations-loading",children:[x.jsx("div",{className:"gpc-loading-spinner"}),x.jsx("span",{children:c("conversations.loadingMore","Loading more...")})]}),l&&!u&&x.jsx("div",{ref:p,style:{height:"1px"}})]})}),x.jsx(Eh,{isOpen:k.isOpen,onClose:F,onConfirm:O,message:c("conversations.confirmDelete",{title:k.title,defaultValue:`Delete "${k.title}"?`}),confirmText:c("conversations.delete","Delete"),cancelText:c("conversations.cancel","Cancel"),variant:"danger"})]})},Ih=(e,t,n)=>{const{t:r}=le.useTranslation(),[i,s]=T.useState([]),[o,a]=T.useState(!1),[l,u]=T.useState(null),[h,c]=T.useState(null),[p,f]=T.useState([]),[d,b]=T.useState(0),[C,k]=T.useState(!1),[v,E]=T.useState(!0),[z,P]=T.useState(0),[w,R]=T.useState(!0),[O,F]=T.useState(!1),[y,A]=T.useState(0),[D,N]=T.useState(!1),[_,M]=T.useState(!1),q=T.useCallback(async W=>{if(!W.trim()||o)return;if(!t){_e.error(r("toast.antiBotValidationPending"));return}const G={id:$t(),role:"user",content:W.trim(),timestamp:new Date().toISOString()};s(J=>[...J,G]),a(!0),u(null);const Y=$t(),oe={id:Y,role:"assistant",content:"",timestamp:new Date().toISOString(),isStreaming:!0};s(J=>[...J,oe]);try{const J=await e.sendMessage(W,t,te=>{s(ne=>ne.map(Te=>Te.id===Y?{...Te,content:Te.content+te}:Te))},h);s(te=>te.map(ne=>ne.id===Y?{id:J.data.message_id,role:"assistant",content:J.data.response,timestamp:J.data.created_at,isStreaming:!1,metadata:{costUsd:J.data.cost_usd,creditBalanceUsd:J.data.credit_balance_usd,inputTokens:J.data.input_tokens,outputTokens:J.data.output_tokens,responseTimeMs:J.data.response_time_ms,modelUsed:J.data.model_used}}:ne)),J.data.conversation_id&&c(J.data.conversation_id),m()}catch(J){s(Fe=>Fe.filter(Et=>Et.id!==Y));let te;try{te=JSON.parse(J.message)}catch{te={statusCode:500,message:J.message}}let ne;const Te=te.statusCode||500,Oe=te.errorCode||"";switch(Te===401&&Oe==="SESSION_EXPIRED"&&(ne=r("toast.sessionExpired"),n&&n()),Te){case 401:ne||(ne=r("errors.unauthorized"));break;case 402:ne=r("errors.insufficientCredits");break;case 403:Oe.includes("DOMAIN")||Oe.includes("UNAUTHORIZED")?ne=r("errors.domainUnauthorized"):ne=r("errors.validation");break;case 429:ne=r("errors.rateLimit");break;case 503:case 502:case 504:ne=r("errors.aiServiceUnavailable");break;case 500:ne=r("errors.serverError");break;default:ne=r("errors.generic")}u(ne),_e.error(ne,{duration:4e3,position:"top-center"});const lt={id:$t(),role:"assistant",content:ne,timestamp:new Date().toISOString()};s(Fe=>[...Fe,lt])}finally{a(!1)}},[e,t,o,r,n,h]),Z=T.useCallback(()=>{s([]),u(null)},[]),ae=T.useCallback(()=>{u(null)},[]),ie=T.useCallback(async(W,G=!0)=>{if(!(!e||!W)){k(!0);try{const Y=G?0:y,oe=await e.getConversationHistory(W,50,Y);if(oe.success&&oe.data.messages){const J=oe.data.messages.flatMap(te=>[{id:`${te.message_id}-question`,role:"user",content:te.question,timestamp:te.creation_date},{id:te.message_id,role:"assistant",content:te.answer,timestamp:te.creation_date}]);G?(s(J),A(oe.data.count)):(s(te=>[...J,...te]),A(te=>te+oe.data.count)),N(oe.data.has_more),c(W)}}catch(Y){console.error("Error loading conversation history:",Y),_e.error(r("toast.failedLoadHistory"))}finally{k(!1)}}},[e,r,y]),m=T.useCallback(async(W=!0)=>{if(e)try{const G=W?0:z,Y=await e.listConversations(20,G);Y.success&&Y.data.conversations&&(W?(f(Y.data.conversations),P(Y.data.count)):(f(oe=>[...oe,...Y.data.conversations]),P(oe=>oe+Y.data.count)),R(Y.data.has_more),b(Y.data.total||0))}catch(G){console.error("Error loading conversations:",G)}},[e,z]),he=T.useCallback(async()=>{if(!(!e||O||!w)){F(!0);try{await m(!1)}finally{F(!1)}}},[e,O,w,m]),ge=T.useCallback(async()=>{if(!(!e||!h||_||!D)){M(!0);try{await ie(h,!1)}finally{M(!1)}}},[e,h,_,D,ie]),g=T.useCallback(()=>{s([]),c(null),u(null),e&&e.clearLastConversation(),_e.success(r("toast.newConversationStarted"))},[r,e]),fe=T.useCallback(async W=>{await ie(W)},[ie]),we=T.useCallback(async(W,G)=>{if(e)try{await e.updateConversationTitle(W,G),await m(!0),_e.success(r("toast.conversationRenamed"))}catch(Y){console.error("Error renaming conversation:",Y),_e.error(r("toast.failedRenameConversation"))}},[e,m,r]),ee=T.useCallback(async W=>{if(e)try{await e.deleteConversation(W),W===h&&(s([]),c(null)),await m(!0),_e.success(r("toast.conversationDeleted"))}catch(G){console.error("Error deleting conversation:",G),_e.error(r("toast.failedDeleteConversation"))}},[e,h,m,r]);return T.useEffect(()=>{(async()=>{if(!e){E(!1);return}try{const G=e.getLastConversation();G&&(s(G.messages),c(G.conversationId))}catch(G){console.error("[TIA GPC] Error restaurando conversación:",G)}finally{E(!1)}})()},[e]),T.useEffect(()=>{e&&!v&&m()},[e,m,v]),T.useEffect(()=>{e&&i.length>0&&!v&&e.saveLastConversation(h,i)},[e,i,h,v]),{messages:i,isLoading:o,error:l,sendMessage:q,clearMessages:Z,clearError:ae,currentConversationId:h,conversations:p,totalConversations:d,isLoadingHistory:C,loadConversationHistory:ie,loadConversations:m,startNewConversation:g,switchConversation:fe,renameConversation:we,deleteConversation:ee,isRestoringConversation:v,hasMoreConversations:w,isLoadingMoreConversations:O,loadMoreConversations:he,hasMoreMessages:D,isLoadingMoreMessages:_,loadMoreMessages:ge}},Ah=(e="auto")=>{const[t,n]=T.useState(e),[r,i]=T.useState("light");return T.useEffect(()=>{n(e)},[e]),T.useEffect(()=>{if(i(t==="auto"?ph():t),t==="auto"){const a=window.matchMedia("(prefers-color-scheme: dark)"),l=u=>{i(u.matches?"dark":"light")};return a.addEventListener("change",l),()=>{a.removeEventListener("change",l)}}},[t]),{theme:r,themeMode:t,setThemeMode:n,toggleTheme:()=>{n(o=>o==="auto"?r==="light"?"dark":"light":o==="light"?"dark":"light")}}},_h=({gpcService:e,licenseToken:t,widgetConfig:n,turnstileSiteKey:r,onClose:i,themeMode:s,showBranding:o=!0,showMetadata:a=!1,onError:l})=>{const{t:u}=le.useTranslation(),[h,c]=T.useState(null),[p,f]=T.useState(!1),[d,b]=T.useState(!1),[C,k]=T.useState(!0),{theme:v,toggleTheme:E}=Ah(s),z=T.useCallback(()=>{f(!1),c(null),e&&e.resetTurnstileValidation()},[e]),{messages:P,isLoading:w,sendMessage:R,currentConversationId:O,conversations:F,totalConversations:y,isLoadingHistory:A,startNewConversation:D,switchConversation:N,renameConversation:_,deleteConversation:M,isRestoringConversation:q,hasMoreConversations:Z,isLoadingMoreConversations:ae,loadMoreConversations:ie,hasMoreMessages:m,isLoadingMoreMessages:he,loadMoreMessages:ge}=Ih(e,h,z),g=T.useCallback(()=>{b(W=>!W)},[]),fe=T.useCallback(W=>{N(W),b(!1)},[N]),we=T.useCallback(()=>{D(),b(!1)},[D]);T.useEffect(()=>{(async()=>{k(!0),e&&e.hasValidCachedSession()&&(f(!0),c("CACHED_SESSION")),k(!1)})()},[e]);const ee=W=>{c(W),f(!0),e&&e.validateSession()};return T.useEffect(()=>()=>{e&&e.releaseSession().catch(W=>{console.error("Failed to release session:",W)})},[e]),x.jsxs("div",{className:`gpc-chat-window gpc-animate-fade-in ${v==="dark"?"gpc-dark":""}`,children:[x.jsx(Ri,{onClose:i,theme:v,onToggleTheme:E,showBranding:o,widgetConfig:n,onToggleConversations:g,showConversations:d,conversationsCount:y}),C?x.jsxs("div",{className:"gpc-loading-container",children:[x.jsx("div",{className:"gpc-loading-spinner"}),x.jsx("p",{children:u("widget.validatingSession","Validating session...")})]}):p?x.jsxs(x.Fragment,{children:[x.jsx(xh,{messages:P,isLoading:w||A||q,showMetadata:a,widgetConfig:n,hasMoreMessages:m,isLoadingMoreMessages:he,onLoadMoreMessages:ge}),x.jsx(Ch,{onSendMessage:R,isLoading:w||q,disabled:q,gpcService:e,showBranding:o}),d&&x.jsx("div",{className:"gpc-conversations-overlay",children:x.jsx(Th,{conversations:F,totalConversations:y,currentConversationId:O,onSelectConversation:fe,onNewConversation:we,onRenameConversation:_,onDeleteConversation:M,isLoadingHistory:A,hasMoreConversations:Z,isLoadingMoreConversations:ae,onLoadMore:ie})})]}):x.jsx(Sh,{siteKey:r,onSuccess:ee,onError:l}),x.jsx(_e.Toaster,{position:"top-center"})]})};class Nh{constructor(t,n){this.licenseToken=n,this.baseURL=t||xi,this.client=Ni.create({baseURL:this.baseURL,timeout:uh.API_REQUEST,headers:{"Content-Type":"application/json"}}),this.client.interceptors.request.use(r=>(this.licenseToken&&(r.headers.Authorization=`Bearer ${this.licenseToken}`),r))}handleError(t){if(t.response){const n=t.response.data,i={statusCode:t.response.status,errorCode:n.error_code||"UNKNOWN_ERROR",message:n.message||"Request failed",retryAfter:n.retry_after_seconds||null};throw new Error(JSON.stringify(i))}else throw t.request?new Error(JSON.stringify({statusCode:503,errorCode:"NETWORK_ERROR",message:"No response from server",retryAfter:null})):new Error(JSON.stringify({statusCode:500,errorCode:"INTERNAL_ERROR",message:t.message,retryAfter:null}))}async get(t,n={}){try{return(await this.client.get(t,n)).data}catch(r){this.handleError(r)}}async post(t,n,r={}){try{return(await this.client.post(t,n,r)).data}catch(i){this.handleError(i)}}async put(t,n,r={}){try{return(await this.client.put(t,n,r)).data}catch(i){this.handleError(i)}}async patch(t,n,r={}){try{return(await this.client.patch(t,n,r)).data}catch(i){this.handleError(i)}}async delete(t,n={}){try{return(await this.client.delete(t,n)).data}catch(r){this.handleError(r)}}getClient(){return this.client}}class vi{constructor(t="tiagpc"){this.prefix=t}_getKey(t){return`${this.prefix}_${t}`}set(t,n){try{const r=this._getKey(t),i=JSON.stringify(n);return localStorage.setItem(r,i),!0}catch(r){return console.warn(`[StorageService] Error guardando ${t}:`,r),!1}}get(t){try{const n=this._getKey(t),r=localStorage.getItem(n);return r===null?null:JSON.parse(r)}catch(n){return console.warn(`[StorageService] Error leyendo ${t}:`,n),this.remove(t),null}}remove(t){try{const n=this._getKey(t);return localStorage.removeItem(n),!0}catch(n){return console.warn(`[StorageService] Error eliminando ${t}:`,n),!1}}has(t){const n=this._getKey(t);return localStorage.getItem(n)!==null}clear(){try{return Object.keys(localStorage).filter(r=>r.startsWith(`${this.prefix}_`)).forEach(r=>{localStorage.removeItem(r)}),!0}catch(t){return console.warn("[StorageService] Error limpiando datos:",t),!1}}setWithTimestamp(t,n){return this.set(t,{data:n,timestamp:Date.now()})}getWithExpiry(t,n){const r=this.get(t);return!r||!r.timestamp?null:Date.now()-r.timestamp>n?(this.remove(t),null):r.data}}class Ph{constructor(t,n){this.licenseToken=t,this.httpClient=n,this.storage=new vi("tiagpc"),this.sessionToken=this._getOrCreateSessionToken()}_generateSessionToken(){return"session_"+Array.from(crypto.getRandomValues(new Uint8Array(28))).map(t=>t.toString(16).padStart(2,"0")).join("")}_getSessionKey(){return`session_${this.licenseToken.substring(0,16)}`}_getOrCreateSessionToken(){const t=this._getSessionKey(),n=this.storage.get(t);if(n&&n.sessionToken)return n.sessionToken;const r=this._generateSessionToken();return this._saveSessionToken(r,!1),r}_saveSessionToken(t,n=!1){const r=this._getSessionKey();this.storage.set(r,{sessionToken:t,timestamp:Date.now(),validated:n})}hasValidCachedSession(){const t=this._getSessionKey(),n=this.storage.get(t);if(!n)return!1;const{validated:r,timestamp:i}=n,s=Date.now(),o=1440*60*1e3;return r&&s-i<o}async validateTurnstileSession(){try{return await this.httpClient.post("/validate-session",{session_token:this.sessionToken})}catch{return this.clearSession(),{success:!1,valid:!1}}}validateSession(){this._saveSessionToken(this.sessionToken,!0)}resetTurnstileValidation(){this._saveSessionToken(this.sessionToken,!1)}getSessionToken(){return this.sessionToken}renewSessionToken(){const t=this._generateSessionToken();return this.sessionToken=t,this._saveSessionToken(t,!1),t}clearSession(){const t=this._getSessionKey();this.storage.remove(t)}async releaseSession(){if(!this.licenseToken){console.warn("[SessionService] No license token available to release session");return}try{return await this.httpClient.post("/release-session",{session_token:this.sessionToken})}catch(t){console.error("[SessionService] Failed to release session:",t.message)}}}class Lh{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r,this.storage=new vi("tiagpc")}_getLastConversationKey(){return`last_conversation_${this.licenseToken.substring(0,16)}`}async listConversations(t=20,n=0){return await this.httpClient.get("/conversations",{params:{limit:t,offset:n},headers:{"X-Session-Token":this.sessionToken}})}async getConversationHistory(t,n=50,r=0){return await this.httpClient.get(`/conversation/${t}/history`,{params:{limit:n,offset:r}})}async getCurrentConversation(){return await this.httpClient.get("/conversation/current",{headers:{"X-Session-Token":this.sessionToken}})}saveLastConversation(t,n){const r=this._getLastConversationKey();return this.storage.setWithTimestamp(r,{conversationId:t,messages:n})}getLastConversation(t=1440*60*1e3){const n=this._getLastConversationKey();return this.storage.getWithExpiry(n,t)}clearLastConversation(){const t=this._getLastConversationKey();return this.storage.remove(t)}hasLastConversation(){const t=this._getLastConversationKey();return this.storage.has(t)}async updateConversationTitle(t,n){return await this.httpClient.patch(`/conversation/${t}/title`,{new_title:n},{headers:{"X-Session-Token":this.sessionToken}})}async deleteConversation(t){return await this.httpClient.delete(`/conversation/${t}`,{headers:{"X-Session-Token":this.sessionToken}})}}class Dh{constructor(t,n,r){this.licenseToken=t,this.sessionToken=n,this.httpClient=r}async sendMessage(t,n,r,i=null){const o=`${this.httpClient.baseURL}/ask`,a={message:t,turnstile_token:n||"CACHED_SESSION",session_token:this.sessionToken};i&&(a.conversation_id=i);try{const l=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.licenseToken}`},body:JSON.stringify(a)});if(!l.ok){const u=await l.json().catch(()=>({}));throw new Error(JSON.stringify({statusCode:l.status,errorCode:u.error_code||"UNKNOWN_ERROR",message:u.message||"Request failed",retryAfter:u.retry_after_seconds||null}))}return await this._processSSEResponse(l,r)}catch(l){throw l.message.startsWith("{")?l:new Error(JSON.stringify({statusCode:500,errorCode:"NETWORK_ERROR",message:l.message,retryAfter:null}))}}async _processSSEResponse(t,n){const r=t.body.getReader(),i=new TextDecoder;let s="",o="",a=null,l=null;for(;;){const{done:u,value:h}=await r.read();if(u)break;s+=i.decode(h,{stream:!0});const c=s.split(`
|
|
30
|
+
`);s=c.pop();for(const p of c){if(!p.trim()||!p.startsWith("data: "))continue;const f=p.replace("data: ","").trim();if(f!=="[DONE]")try{const d=JSON.parse(f);if(d.type==="content")o+=d.text,n&&n(d.text);else if(d.type==="metadata")a=d;else if(d.type==="summary")l=d;else if(d.type==="error")throw new Error(JSON.stringify({statusCode:d.status_code||500,errorCode:d.error_code,message:d.message,retryAfter:null}))}catch(d){if(d.message&&d.message.startsWith("{"))throw d;console.error("[MessageService] Error parsing SSE event:",d)}}}if(!l)throw new Error("No summary received from server");return{success:!0,data:{message_id:l.message_id,conversation_id:l.conversation_id,response:o,cost_usd:l.cost_usd,credit_balance_usd:l.credit_balance_usd,input_tokens:l.input_tokens,output_tokens:l.output_tokens,response_time_ms:l.response_time_ms,model_used:l.model_used,created_at:l.created_at}}}async transcribeAudio(t){const n=new FormData;return n.append("file",t,"audio.webm"),(await this.httpClient.getClient().post("/transcribe",n,{headers:{"Content-Type":"multipart/form-data"}})).data}}class bn{constructor(t,n){if(!n)throw new Error("License token is required");this.licenseToken=n,this.httpClient=new Nh(t,n),this.sessionService=new Ph(n,this.httpClient),this.conversationService=new Lh(n,this.sessionService.getSessionToken(),this.httpClient),this.messageService=new Dh(n,this.sessionService.getSessionToken(),this.httpClient)}getSessionToken(){return this.sessionService.getSessionToken()}hasValidCachedSession(){return this.sessionService.hasValidCachedSession()}async validateTurnstileSession(){return await this.sessionService.validateTurnstileSession()}validateSession(){this.sessionService.validateSession()}resetTurnstileValidation(){this.sessionService.resetTurnstileValidation()}renewSessionToken(){const t=this.sessionService.renewSessionToken();return this.conversationService.sessionToken=t,this.messageService.sessionToken=t,t}async releaseSession(){return await this.sessionService.releaseSession()}async listConversations(t=20){return await this.conversationService.listConversations(t)}async getConversationHistory(t,n=50){return await this.conversationService.getConversationHistory(t,n)}async getCurrentConversation(){return await this.conversationService.getCurrentConversation()}saveLastConversation(t,n){return this.conversationService.saveLastConversation(t,n)}getLastConversation(t=1440*60*1e3){return this.conversationService.getLastConversation(t)}clearLastConversation(){return this.conversationService.clearLastConversation()}async updateConversationTitle(t,n){return await this.conversationService.updateConversationTitle(t,n)}async deleteConversation(t){return await this.conversationService.deleteConversation(t)}async sendMessage(t,n,r,i=null){if(!this.licenseToken)throw new Error("License token is required.");const s=this.hasValidCachedSession();if(!n&&!s)throw new Error("Turnstile token is required for anti-bot validation.");return await this.messageService.sendMessage(t,n,r,i)}async transcribeAudio(t){if(!this.licenseToken)throw new Error("License token is required.");return await this.messageService.transcribeAudio(t)}async getInitConfig(){if(!this.licenseToken)throw new Error("License token is required.");return await this.httpClient.get("/init")}async checkHealth(){try{return await this.httpClient.get("/health")}catch(t){return{status:"unhealthy",error:t.message}}}}let pt=null;const zh=(e,t)=>((!pt||t&&pt.licenseToken!==t)&&(pt=new bn(e,t)),pt),Rh={title:"TIA GPC",poweredBy:"Desarrollado por TIA GPC",questionsTo:"Preguntas a",validatingSession:"Validando sesión..."},Mh={title:"Asistente",placeholder:"Escribe tu pregunta...",send:"Enviar",close:"Cerrar",welcome:"¡Hola! Bienvenido a {{companyName}}. ¿En qué puedo ayudarte hoy?",emptyState:"Inicia una conversación escribiendo tu pregunta",validation:"Verificando seguridad...",retry:"Reintentar",loadingMore:"Cargando mensajes anteriores..."},jh={record:"Grabar audio",recording:"Grabando...",stop:"Detener grabación",processing:"Transcribiendo audio...",error:"Error al transcribir audio",unsupported:"Tu navegador no soporta grabación de audio",permissionDenied:"Permiso de micrófono denegado"},Oh={light:"Claro",dark:"Oscuro",toggle:"Cambiar tema"},Fh={unauthorized:"Autenticación fallida. Por favor, verifica tu token de licencia e intenta nuevamente.",validation:"Verificación anti-bot fallida. Por favor, recarga la página e intenta nuevamente.",network:"No se pudo conectar al servidor. Verifica tu conexión a internet.",rateLimit:"Has realizado demasiadas consultas o se alcanzó el límite de usuarios concurrentes. Por favor, espera un momento antes de continuar.",session:"Tu sesión ha expirado por inactividad. Por favor, recarga la página para continuar.",insufficientCredits:"Créditos insuficientes. Por favor, recarga créditos desde tu panel de administración para continuar usando TIA GPC.",generic:"Ha ocurrido un error inesperado. Por favor, intenta nuevamente.",aiServiceUnavailable:"El asistente está temporalmente no disponible. Por favor, intenta de nuevo en unos momentos.",serverError:"El servidor encontró un problema. Por favor, intenta de nuevo más tarde.",domainUnauthorized:"Este dominio no está autorizado para usar este widget. Por favor, contacta a tu administrador."},Bh={verifying:"Verificando que eres humano...",error:"No se pudo completar la verificación de seguridad. Por favor, recarga la página e intenta nuevamente."},Uh={tokensUsed:"Tokens usados",responseTime:"Tiempo de respuesta",model:"Modelo"},Hh={title:"Conversaciones",new:"Nueva",empty:"No hay conversaciones aún",emptyHint:"Inicia una conversación para verla aquí",untitled:"Conversación sin título",loadingMore:"Cargando más...",toggle:"Alternar conversaciones",rename:"Renombrar",delete:"Eliminar",save:"Guardar",cancel:"Cancelar",confirmDelete:'¿Eliminar "{{title}}"?'},$h={justNow:"Justo ahora",minutesAgo:"hace {{count}} min",minutesAgo_one:"hace 1 min",minutesAgo_other:"hace {{count}} min",hoursAgo:"hace {{count}}h",hoursAgo_one:"hace 1h",hoursAgo_other:"hace {{count}}h",daysAgo:"hace {{count}}d",daysAgo_one:"hace 1d",daysAgo_other:"hace {{count}}d"},Vh={languageSelector:{label:"Cambiar idioma"},spinner:{loading:"Cargando"},typingIndicator:{typing:"Escribiendo"},message:{userMessage:"Mensaje del usuario",assistantMessage:"Mensaje del asistente"}},qh={english:"English",spanish:"Español",french:"Français"},Wh={maxCharacters:"Máximo {{count}} caracteres"},Gh={antiBotValidationPending:"Validación anti-bot pendiente",newConversationStarted:"Nueva conversación iniciada",failedLoadHistory:"No se pudo cargar el historial de la conversación",sessionExpired:"Sesión expirada, por favor verifica nuevamente",gpcServiceNotAvailable:"Servicio GPC no disponible",conversationRenamed:"Conversación renombrada exitosamente",failedRenameConversation:"No se pudo renombrar la conversación",conversationDeleted:"Conversación eliminada exitosamente",failedDeleteConversation:"No se pudo eliminar la conversación"},Kh={widget:Rh,chat:Mh,voice:jh,theme:Oh,errors:Fh,turnstile:Bh,metadata:Uh,conversations:Hh,time:$h,ui:Vh,languages:qh,input:Wh,toast:Gh},Xh={title:"TIA GPC",poweredBy:"Powered by TIA GPC",questionsTo:"Questions to",validatingSession:"Validating session..."},Yh={title:"Assistant",placeholder:"Type your question...",send:"Send",close:"Close",welcome:"Hello! Welcome to {{companyName}}. How can I help you today?",emptyState:"Start a conversation by typing your question",validation:"Verifying security...",retry:"Retry",loadingMore:"Loading older messages..."},Jh={record:"Record audio",recording:"Recording...",stop:"Stop recording",processing:"Transcribing audio...",error:"Error transcribing audio",unsupported:"Your browser does not support audio recording",permissionDenied:"Microphone permission denied"},Qh={light:"Light",dark:"Dark",toggle:"Toggle theme"},Zh={unauthorized:"Authentication failed. Please check your license token and try again.",validation:"Bot verification failed. Please reload the page and try again.",network:"Unable to connect to the server. Please check your internet connection.",rateLimit:"You've made too many requests or the concurrent user limit has been reached. Please wait a moment before continuing.",session:"Your session has expired due to inactivity. Please reload the page to continue.",insufficientCredits:"Insufficient credits. Please reload credits from your admin panel to continue using TIA GPC.",generic:"An unexpected error has occurred. Please try again.",aiServiceUnavailable:"The assistant is temporarily unavailable. Please try again in a few moments.",serverError:"The server encountered a problem. Please try again later.",domainUnauthorized:"This domain is not authorized to use this widget. Please contact your administrator."},ef={verifying:"Verifying you're human...",error:"Security verification could not be completed. Please reload the page and try again."},tf={tokensUsed:"Tokens used",responseTime:"Response time",model:"Model"},nf={title:"Conversations",new:"New",empty:"No conversations yet",emptyHint:"Start a conversation to see it here",untitled:"Untitled conversation",loadingMore:"Loading more...",toggle:"Toggle conversations",rename:"Rename",delete:"Delete",save:"Save",cancel:"Cancel",confirmDelete:'Delete "{{title}}"?'},rf={justNow:"Just now",minutesAgo:"{{count}} min ago",minutesAgo_one:"1 min ago",minutesAgo_other:"{{count}} min ago",hoursAgo:"{{count}}h ago",hoursAgo_one:"1h ago",hoursAgo_other:"{{count}}h ago",daysAgo:"{{count}}d ago",daysAgo_one:"1d ago",daysAgo_other:"{{count}}d ago"},of={languageSelector:{label:"Change language"},spinner:{loading:"Loading"},typingIndicator:{typing:"Typing"},message:{userMessage:"User message",assistantMessage:"Assistant message"}},sf={english:"English",spanish:"Español",french:"Français"},af={maxCharacters:"Maximum {{count}} characters"},lf={antiBotValidationPending:"Anti-bot validation pending",newConversationStarted:"New conversation started",failedLoadHistory:"Failed to load conversation history",sessionExpired:"Session expired, please verify again",gpcServiceNotAvailable:"GPC Service not available",conversationRenamed:"Conversation renamed successfully",failedRenameConversation:"Failed to rename conversation",conversationDeleted:"Conversation deleted successfully",failedDeleteConversation:"Failed to delete conversation"},uf={widget:Xh,chat:Yh,voice:Jh,theme:Qh,errors:Zh,turnstile:ef,metadata:tf,conversations:nf,time:rf,ui:of,languages:sf,input:af,toast:lf},cf={title:"TIA GPC",poweredBy:"Propulsé par TIA GPC",questionsTo:"Questions à",validatingSession:"Validation de la session..."},hf={title:"Assistant",placeholder:"Tapez votre question...",send:"Envoyer",close:"Fermer",welcome:"Bonjour ! Bienvenue à {{companyName}}. Comment puis-je vous aider aujourd'hui ?",emptyState:"Commencez une conversation en tapant votre question",validation:"Vérification de sécurité...",retry:"Réessayer",loadingMore:"Chargement des messages précédents..."},ff={record:"Enregistrer audio",recording:"Enregistrement...",stop:"Arrêter l'enregistrement",processing:"Transcription audio...",error:"Erreur de transcription audio",unsupported:"Votre navigateur ne prend pas en charge l'enregistrement audio",permissionDenied:"Permission du microphone refusée"},pf={light:"Clair",dark:"Sombre",toggle:"Changer de thème"},df={unauthorized:"Échec de l'authentification. Veuillez vérifier votre jeton de licence et réessayer.",validation:"La vérification anti-bot a échoué. Veuillez recharger la page et réessayer.",network:"Impossible de se connecter au serveur. Veuillez vérifier votre connexion internet.",rateLimit:"Vous avez fait trop de demandes ou la limite d'utilisateurs concurrents a été atteinte. Veuillez patienter un moment avant de continuer.",session:"Votre session a expiré en raison d'inactivité. Veuillez recharger la page pour continuer.",insufficientCredits:"Crédits insuffisants. Veuillez recharger des crédits depuis votre panneau d'administration pour continuer à utiliser TIA GPC.",generic:"Une erreur inattendue s'est produite. Veuillez réessayer.",aiServiceUnavailable:"L'assistant est temporairement indisponible. Veuillez réessayer dans quelques instants.",serverError:"Le serveur a rencontré un problème. Veuillez réessayer plus tard.",domainUnauthorized:"Ce domaine n'est pas autorisé à utiliser ce widget. Veuillez contacter votre administrateur."},mf={verifying:"Vérification que vous êtes humain...",error:"La vérification de sécurité n'a pas pu être complétée. Veuillez recharger la page et réessayer."},gf={tokensUsed:"Tokens utilisés",responseTime:"Temps de réponse",model:"Modèle"},yf={title:"Conversations",new:"Nouvelle",empty:"Aucune conversation pour le moment",emptyHint:"Démarrez une conversation pour la voir ici",untitled:"Conversation sans titre",loadingMore:"Chargement...",toggle:"Basculer les conversations",rename:"Renommer",delete:"Supprimer",save:"Enregistrer",cancel:"Annuler",confirmDelete:'Supprimer "{{title}}" ?'},xf={justNow:"À l'instant",minutesAgo:"il y a {{count}} min",minutesAgo_one:"il y a 1 min",minutesAgo_other:"il y a {{count}} min",hoursAgo:"il y a {{count}}h",hoursAgo_one:"il y a 1h",hoursAgo_other:"il y a {{count}}h",daysAgo:"il y a {{count}}j",daysAgo_one:"il y a 1j",daysAgo_other:"il y a {{count}}j"},kf={languageSelector:{label:"Changer de langue"},spinner:{loading:"Chargement"},typingIndicator:{typing:"Écriture en cours"},message:{userMessage:"Message de l'utilisateur",assistantMessage:"Message de l'assistant"}},bf={english:"English",spanish:"Español",french:"Français"},wf={maxCharacters:"Maximum {{count}} caractères"},vf={antiBotValidationPending:"Validation anti-bot en attente",newConversationStarted:"Nouvelle conversation démarrée",failedLoadHistory:"Échec du chargement de l'historique de la conversation",sessionExpired:"Session expirée, veuillez vérifier à nouveau",gpcServiceNotAvailable:"Service GPC non disponible",conversationRenamed:"Conversation renommée avec succès",failedRenameConversation:"Échec du renommage de la conversation",conversationDeleted:"Conversation supprimée avec succès",failedDeleteConversation:"Échec de la suppression de la conversation"},Cf={widget:cf,chat:hf,voice:ff,theme:pf,errors:df,turnstile:mf,metadata:gf,conversations:yf,time:xf,ui:kf,languages:bf,input:wf,toast:vf};dt.use(Pi).use(le.initReactI18next).init({resources:{en:{translation:uf},es:{translation:Kh},fr:{translation:Cf}},fallbackLng:"en",supportedLngs:["en","es","fr"],interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator"],caches:["localStorage"]}});const Ci=({token:e,turnstileSiteKey:t=ah,theme:n=Le.theme,position:r=Le.position,language:i=Le.language,primaryColor:s,width:o=Le.width,height:a=Le.height,apiUrl:l=xi,onReady:u,onError:h,onClose:c,autoOpen:p=Le.autoOpen,showBranding:f=Le.showBranding,mobileFullscreen:d=Le.mobileFullscreen,...b})=>{const[C,k]=T.useState(!1),[v,E]=T.useState(null),[z,P]=T.useState(!0);v?.widget_customization?.behavior?.auto_open;const[w,R]=T.useState(!1),O=T.useMemo(()=>new bn(l,e),[l,e]);if(T.useEffect(()=>{const N=()=>{k(ch())};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),T.useEffect(()=>{const N=v?.widget_customization?.language||i;N&&dt.changeLanguage&&dt.changeLanguage(N)},[i,v]),T.useEffect(()=>{(async()=>{if(!e){P(!1);return}try{const _=await O.getInitConfig();_.success&&(E(_.data),(_.data?.widget_customization?.behavior?.auto_open??p)&&R(!0),u&&u(_.data))}catch(_){console.error("[TIA GPC Widget] Error loading config:",_),h&&h(_)}finally{P(!1)}})()},[e,O,u,h,p]),T.useEffect(()=>{const N=()=>{if(!O)return;const _=O.getSessionToken(),M=O.httpClient.baseURL,q=O.licenseToken;fetch(`${M}/release-session`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q}`},body:JSON.stringify({session_token:_}),keepalive:!0}).catch(()=>{})};return window.addEventListener("beforeunload",N),()=>{window.removeEventListener("beforeunload",N)}},[O]),!e)return console.error('[TIA GPC Widget] Error: "token" prop is required'),null;const F=()=>{R(!1),c?.()},y=()=>{const N=v?.widget_customization?.position||r,_=v?.widget_customization?.behavior?.mobile_fullscreen??d;return C&&_?"gpc-position-bottom-right":`gpc-position-${N}`},A=()=>{const N={},_=v?.widget_customization?.colors?.primary||s,M=v?.widget_customization?.colors?.header_background,q=v?.widget_customization?.colors?.header_text;_&&(N["--gpc-color-primary"]=_),M&&(N["--gpc-header-bg"]=M),q&&(N["--gpc-header-text"]=q);const Z=v?.widget_customization?.dimensions?.width||o,ae=v?.widget_customization?.dimensions?.height||a,ie=v?.widget_customization?.behavior?.mobile_fullscreen??d;return(!C||!ie)&&(Z&&(N["--gpc-widget-width"]=Z),ae&&(N["--gpc-widget-height"]=ae)),N},D=v?.widget_customization?.theme||n;return x.jsx(le.I18nextProvider,{i18n:dt,children:x.jsxs("div",{className:`gpc-widget gpc-widget-container ${y()} ${D==="dark"?"gpc-dark":""}`,style:A(),children:[!w&&x.jsx(Li,{onClick:()=>R(!0),widgetConfig:v}),w&&!z&&x.jsx(_h,{gpcService:O,licenseToken:e,widgetConfig:v,turnstileSiteKey:t,onClose:F,themeMode:D,showBranding:f,showMetadata:b.showMetadata||!1,onError:h})]})})};Ci.defaultProps={theme:"auto",position:"bottom-right",language:"en",width:"400px",height:"600px",autoOpen:!1,showBranding:!0,mobileFullscreen:!0};exports.GPCService=bn;exports.LANGUAGES=wi;exports.THEMES=bi;exports.TiaGPCWidget=Ci;exports.WIDGET_POSITIONS=ki;exports.getGPCService=zh;
|
|
31
31
|
//# sourceMappingURL=tia-gpc.cjs.js.map
|