randmarcomps 1.295.0 → 1.296.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/randmarcomps.d.ts +29 -0
- package/dist/randmarcomps.js +1068 -367
- package/dist/randmarcomps.umd.cjs +21 -19
- package/package.json +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(sr,lr){typeof exports=="object"&&typeof module<"u"?lr(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","react-router-dom"],lr):(sr=typeof globalThis<"u"?globalThis:sr||self,lr(sr.randmarcomps={},sr.jsxRuntime,sr.React,sr.ReactDOM,sr["react-router-dom"]))})(this,function(exports,jsxRuntime,React,ReactDOM,reactRouterDom){"use strict";var Gn=Object.defineProperty;var kn=sr=>{throw TypeError(sr)};var Wn=(sr,lr,tr)=>lr in sr?Gn(sr,lr,{enumerable:!0,configurable:!0,writable:!0,value:tr}):sr[lr]=tr;var ir=(sr,lr,tr)=>Wn(sr,typeof lr!="symbol"?lr+"":lr,tr),Kn=(sr,lr,tr)=>lr.has(sr)||kn("Cannot "+tr);var ar=(sr,lr,tr)=>(Kn(sr,lr,"read from private field"),tr?tr.call(sr):lr.get(sr)),qr=(sr,lr,tr)=>lr.has(sr)?kn("Cannot add the same private member more than once"):lr instanceof WeakSet?lr.add(sr):lr.set(sr,tr);var sr,lr,tr,tn,rn,Ur,Kr;function _interopNamespaceDefault(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const React__namespace=_interopNamespaceDefault(React),ReactDOM__namespace=_interopNamespaceDefault(ReactDOM);var Bt=Object.defineProperty,At=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,Y$2=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,vt=(t,e,n)=>e in t?Bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,St=(t,e)=>{for(var n in e||(e={}))gt.call(e,n)&&vt(t,n,e[n]);if(Y$2)for(var n of Y$2(e))Et.call(e,n)&&vt(t,n,e[n]);return t},bt=(t,e)=>At(t,kt(e)),Pt=(t,e)=>{var n={};for(var o in t)gt.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&Y$2)for(var o of Y$2(t))e.indexOf(o)<0&&Et.call(t,o)&&(n[o]=t[o]);return n};function ht(t){let e=setTimeout(t,0),n=setTimeout(t,10),o=setTimeout(t,50);return[e,n,o]}function _t(t){let e=React__namespace.useRef();return React__namespace.useEffect(()=>{e.current=t}),e.current}var Ot=18,wt=40,Gt=`${wt}px`,xt=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function Tt({containerRef:t,inputRef:e,pushPasswordManagerStrategy:n,isFocused:o}){let[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(!1),[b,_]=React__namespace.useState(!1),S=React__namespace.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&l&&f,[l,f,n]),R=React__namespace.useCallback(()=>{let C=t.current,E=e.current;if(!C||!E||b||n==="none")return;let A=C,I=A.getBoundingClientRect().left+A.offsetWidth,M=A.getBoundingClientRect().top+A.offsetHeight/2,j=I-Ot,q=M;document.querySelectorAll(xt).length===0&&document.elementFromPoint(j,q)===C||(d(!0),_(!0))},[t,e,b,n]);return React__namespace.useEffect(()=>{let C=t.current;if(!C||n==="none")return;function E(){let I=window.innerWidth-C.getBoundingClientRect().right;g(I>=wt)}E();let A=setInterval(E,1e3);return()=>{clearInterval(A)}},[t,n]),React__namespace.useEffect(()=>{let C=o||document.activeElement===e.current;if(n==="none"||!C)return;let E=setTimeout(R,0),A=setTimeout(R,2e3),I=setTimeout(R,5e3),M=setTimeout(()=>{_(!0)},6e3);return()=>{clearTimeout(E),clearTimeout(A),clearTimeout(I),clearTimeout(M)}},[e,o,n,R]),{hasPWMBadge:l,willPushPWMBadge:S,PWM_BADGE_SPACE_WIDTH:Gt}}var jt=React__namespace.createContext({}),Lt=React__namespace.forwardRef((t,e)=>{var n=t,{value:o,onChange:l,maxLength:d,textAlign:f="left",pattern:g,placeholder:b,inputMode:_="numeric",onComplete:S,pushPasswordManagerStrategy:R="increase-width",pasteTransformer:C,containerClassName:E,noScriptCSSFallback:A=Nt,render:I,children:M}=n,j=Pt(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),q,z,Q,F,V;let[te,ne]=React__namespace.useState(typeof j.defaultValue=="string"?j.defaultValue:""),se=o??te,ge=_t(se),oe=React__namespace.useCallback(Je=>{l==null||l(Je),ne(Je)},[l]),Ae=React__namespace.useMemo(()=>g?typeof g=="string"?new RegExp(g):g:null,[g]),je=React__namespace.useRef(null),Ne=React__namespace.useRef(null),Oe=React__namespace.useRef({value:se,onChange:oe,isIOS:typeof window<"u"&&((z=(q=window==null?void 0:window.CSS)==null?void 0:q.supports)==null?void 0:z.call(q,"-webkit-touch-callout","none"))}),Fe=React__namespace.useRef({prev:[(Q=je.current)==null?void 0:Q.selectionStart,(F=je.current)==null?void 0:F.selectionEnd,(V=je.current)==null?void 0:V.selectionDirection]});React__namespace.useImperativeHandle(e,()=>je.current,[]),React__namespace.useEffect(()=>{let Je=je.current,yt=Ne.current;if(!Je||!yt)return;Oe.current.value!==Je.value&&Oe.current.onChange(Je.value),Fe.current.prev=[Je.selectionStart,Je.selectionEnd,Je.selectionDirection];function Mt(){if(document.activeElement!==Je){He(null),tt(null);return}let Ft=Je.selectionStart,Ke=Je.selectionEnd,at=Je.selectionDirection,Qe=Je.maxLength,ct=Je.value,ft=Fe.current.prev,dt=-1,Rt=-1,zt;if(ct.length!==0&&Ft!==null&&Ke!==null){let pt=Ft===Ke,Sr=Ft===ct.length&&ct.length<Qe;if(pt&&!Sr){let mt=Ft;if(mt===0)dt=0,Rt=1,zt="forward";else if(mt===Qe)dt=mt-1,Rt=mt,zt="backward";else if(Qe>1&&ct.length>1){let Zt=0;if(ft[0]!==null&&ft[1]!==null){zt=mt<ft[1]?"backward":"forward";let Wt=ft[0]===ft[1]&&ft[0]<Qe;zt==="backward"&&!Wt&&(Zt=-1)}dt=Zt+mt,Rt=Zt+mt+1}}dt!==-1&&Rt!==-1&&dt!==Rt&&je.current.setSelectionRange(dt,Rt,zt)}let Yt=dt!==-1?dt:Ft,or=Rt!==-1?Rt:Ke,dr=zt??at;He(Yt),tt(or),Fe.current.prev=[Yt,or,dr]}if(document.addEventListener("selectionchange",Mt,{capture:!0}),Mt(),document.activeElement===Je&&qe(!0),!document.getElementById("input-otp-style")){let Ft=document.createElement("style");if(Ft.id="input-otp-style",document.head.appendChild(Ft),Ft.sheet){let Ke="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";$$1(Ft.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),$$1(Ft.sheet,`[data-input-otp]:autofill { ${Ke} }`),$$1(Ft.sheet,`[data-input-otp]:-webkit-autofill { ${Ke} }`),$$1(Ft.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),$$1(Ft.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let qt=()=>{yt&&yt.style.setProperty("--root-height",`${Je.clientHeight}px`)};qt();let Ht=new ResizeObserver(qt);return Ht.observe(Je),()=>{document.removeEventListener("selectionchange",Mt,{capture:!0}),Ht.disconnect()}},[]);let[ze,$e]=React__namespace.useState(!1),[Be,qe]=React__namespace.useState(!1),[Ge,He]=React__namespace.useState(null),[Ze,tt]=React__namespace.useState(null);React__namespace.useEffect(()=>{ht(()=>{var Je,yt,Mt,qt;(Je=je.current)==null||Je.dispatchEvent(new Event("input"));let Ht=(yt=je.current)==null?void 0:yt.selectionStart,Ft=(Mt=je.current)==null?void 0:Mt.selectionEnd,Ke=(qt=je.current)==null?void 0:qt.selectionDirection;Ht!==null&&Ft!==null&&(He(Ht),tt(Ft),Fe.current.prev=[Ht,Ft,Ke])})},[se,Be]),React__namespace.useEffect(()=>{ge!==void 0&&se!==ge&&ge.length<d&&se.length===d&&(S==null||S(se))},[d,S,ge,se]);let Ye=Tt({containerRef:Ne,inputRef:je,pushPasswordManagerStrategy:R,isFocused:Be}),rt=React__namespace.useCallback(Je=>{let yt=Je.currentTarget.value.slice(0,d);if(yt.length>0&&Ae&&!Ae.test(yt)){Je.preventDefault();return}typeof ge=="string"&&yt.length<ge.length&&document.dispatchEvent(new Event("selectionchange")),oe(yt)},[d,oe,ge,Ae]),Xe=React__namespace.useCallback(()=>{var Je;if(je.current){let yt=Math.min(je.current.value.length,d-1),Mt=je.current.value.length;(Je=je.current)==null||Je.setSelectionRange(yt,Mt),He(yt),tt(Mt)}qe(!0)},[d]),it=React__namespace.useCallback(Je=>{var yt,Mt;let qt=je.current;if(!C&&(!Oe.current.isIOS||!Je.clipboardData||!qt))return;let Ht=Je.clipboardData.getData("text/plain"),Ft=C?C(Ht):Ht;Je.preventDefault();let Ke=(yt=je.current)==null?void 0:yt.selectionStart,at=(Mt=je.current)==null?void 0:Mt.selectionEnd,Qe=(Ke!==at?se.slice(0,Ke)+Ft+se.slice(at):se.slice(0,Ke)+Ft+se.slice(Ke)).slice(0,d);if(Qe.length>0&&Ae&&!Ae.test(Qe))return;qt.value=Qe,oe(Qe);let ct=Math.min(Qe.length,d-1),ft=Qe.length;qt.setSelectionRange(ct,ft),He(ct),tt(ft)},[d,oe,Ae,se]),et=React__namespace.useMemo(()=>({position:"relative",cursor:j.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[j.disabled]),st=React__namespace.useMemo(()=>({position:"absolute",inset:0,width:Ye.willPushPWMBadge?`calc(100% + ${Ye.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:Ye.willPushPWMBadge?`inset(0 ${Ye.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:f,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[Ye.PWM_BADGE_SPACE_WIDTH,Ye.willPushPWMBadge,f]),ot=React__namespace.useMemo(()=>React__namespace.createElement("input",bt(St({autoComplete:j.autoComplete||"one-time-code"},j),{"data-input-otp":!0,"data-input-otp-placeholder-shown":se.length===0||void 0,"data-input-otp-mss":Ge,"data-input-otp-mse":Ze,inputMode:_,pattern:Ae==null?void 0:Ae.source,"aria-placeholder":b,style:st,maxLength:d,value:se,ref:je,onPaste:Je=>{var yt;it(Je),(yt=j.onPaste)==null||yt.call(j,Je)},onChange:rt,onMouseOver:Je=>{var yt;$e(!0),(yt=j.onMouseOver)==null||yt.call(j,Je)},onMouseLeave:Je=>{var yt;$e(!1),(yt=j.onMouseLeave)==null||yt.call(j,Je)},onFocus:Je=>{var yt;Xe(),(yt=j.onFocus)==null||yt.call(j,Je)},onBlur:Je=>{var yt;qe(!1),(yt=j.onBlur)==null||yt.call(j,Je)}})),[rt,Xe,it,_,st,d,Ze,Ge,j,Ae==null?void 0:Ae.source,se]),Ue=React__namespace.useMemo(()=>({slots:Array.from({length:d}).map((Je,yt)=>{var Mt;let qt=Be&&Ge!==null&&Ze!==null&&(Ge===Ze&&yt===Ge||yt>=Ge&&yt<Ze),Ht=se[yt]!==void 0?se[yt]:null,Ft=se[0]!==void 0?null:(Mt=b==null?void 0:b[yt])!=null?Mt:null;return{char:Ht,placeholderChar:Ft,isActive:qt,hasFakeCaret:qt&&Ht===null}}),isFocused:Be,isHovering:!j.disabled&&ze}),[Be,ze,d,Ze,Ge,j.disabled,se]),Ct=React__namespace.useMemo(()=>I?I(Ue):React__namespace.createElement(jt.Provider,{value:Ue},M),[M,Ue,I]);return React__namespace.createElement(React__namespace.Fragment,null,A!==null&&React__namespace.createElement("noscript",null,React__namespace.createElement("style",null,A)),React__namespace.createElement("div",{ref:Ne,"data-input-otp-container":!0,style:et,className:E},Ct,React__namespace.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ot)))});Lt.displayName="Input";function $$1(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var Nt=`
|
|
1
|
+
(function(sr,lr){typeof exports=="object"&&typeof module<"u"?lr(exports,require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom","react-router-dom"],lr):(sr=typeof globalThis<"u"?globalThis:sr||self,lr(sr.randmarcomps={},sr.jsxRuntime,sr.React,sr.ReactDOM,sr["react-router-dom"]))})(this,function(exports,jsxRuntime,React,ReactDOM,reactRouterDom){"use strict";var Kn=Object.defineProperty;var Mn=sr=>{throw TypeError(sr)};var Yn=(sr,lr,rr)=>lr in sr?Kn(sr,lr,{enumerable:!0,configurable:!0,writable:!0,value:rr}):sr[lr]=rr;var Qt=(sr,lr,rr)=>Yn(sr,typeof lr!="symbol"?lr+"":lr,rr),Zn=(sr,lr,rr)=>lr.has(sr)||Mn("Cannot "+rr);var ar=(sr,lr,rr)=>(Zn(sr,lr,"read from private field"),rr?rr.call(sr):lr.get(sr)),Hr=(sr,lr,rr)=>lr.has(sr)?Mn("Cannot add the same private member more than once"):lr instanceof WeakSet?lr.add(sr):lr.set(sr,rr);var sr,lr,rr,nn,an,zr,Zr;function _interopNamespaceDefault(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const React__namespace=_interopNamespaceDefault(React),ReactDOM__namespace=_interopNamespaceDefault(ReactDOM);var Bt=Object.defineProperty,At=Object.defineProperties,kt=Object.getOwnPropertyDescriptors,Y$2=Object.getOwnPropertySymbols,gt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,vt=(t,e,n)=>e in t?Bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,St=(t,e)=>{for(var n in e||(e={}))gt.call(e,n)&&vt(t,n,e[n]);if(Y$2)for(var n of Y$2(e))Et.call(e,n)&&vt(t,n,e[n]);return t},bt=(t,e)=>At(t,kt(e)),Pt=(t,e)=>{var n={};for(var o in t)gt.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(t!=null&&Y$2)for(var o of Y$2(t))e.indexOf(o)<0&&Et.call(t,o)&&(n[o]=t[o]);return n};function ht(t){let e=setTimeout(t,0),n=setTimeout(t,10),o=setTimeout(t,50);return[e,n,o]}function _t(t){let e=React__namespace.useRef();return React__namespace.useEffect(()=>{e.current=t}),e.current}var Ot=18,wt=40,Gt=`${wt}px`,xt=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function Tt({containerRef:t,inputRef:e,pushPasswordManagerStrategy:n,isFocused:o}){let[l,d]=React__namespace.useState(!1),[f,g]=React__namespace.useState(!1),[b,_]=React__namespace.useState(!1),S=React__namespace.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&l&&f,[l,f,n]),R=React__namespace.useCallback(()=>{let C=t.current,E=e.current;if(!C||!E||b||n==="none")return;let A=C,I=A.getBoundingClientRect().left+A.offsetWidth,M=A.getBoundingClientRect().top+A.offsetHeight/2,j=I-Ot,q=M;document.querySelectorAll(xt).length===0&&document.elementFromPoint(j,q)===C||(d(!0),_(!0))},[t,e,b,n]);return React__namespace.useEffect(()=>{let C=t.current;if(!C||n==="none")return;function E(){let I=window.innerWidth-C.getBoundingClientRect().right;g(I>=wt)}E();let A=setInterval(E,1e3);return()=>{clearInterval(A)}},[t,n]),React__namespace.useEffect(()=>{let C=o||document.activeElement===e.current;if(n==="none"||!C)return;let E=setTimeout(R,0),A=setTimeout(R,2e3),I=setTimeout(R,5e3),M=setTimeout(()=>{_(!0)},6e3);return()=>{clearTimeout(E),clearTimeout(A),clearTimeout(I),clearTimeout(M)}},[e,o,n,R]),{hasPWMBadge:l,willPushPWMBadge:S,PWM_BADGE_SPACE_WIDTH:Gt}}var jt=React__namespace.createContext({}),Lt=React__namespace.forwardRef((t,e)=>{var n=t,{value:o,onChange:l,maxLength:d,textAlign:f="left",pattern:g,placeholder:b,inputMode:_="numeric",onComplete:S,pushPasswordManagerStrategy:R="increase-width",pasteTransformer:C,containerClassName:E,noScriptCSSFallback:A=Nt,render:I,children:M}=n,j=Pt(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),q,z,Q,F,V;let[te,ne]=React__namespace.useState(typeof j.defaultValue=="string"?j.defaultValue:""),se=o??te,ge=_t(se),oe=React__namespace.useCallback(Je=>{l==null||l(Je),ne(Je)},[l]),Ae=React__namespace.useMemo(()=>g?typeof g=="string"?new RegExp(g):g:null,[g]),je=React__namespace.useRef(null),Ne=React__namespace.useRef(null),Oe=React__namespace.useRef({value:se,onChange:oe,isIOS:typeof window<"u"&&((z=(q=window==null?void 0:window.CSS)==null?void 0:q.supports)==null?void 0:z.call(q,"-webkit-touch-callout","none"))}),Fe=React__namespace.useRef({prev:[(Q=je.current)==null?void 0:Q.selectionStart,(F=je.current)==null?void 0:F.selectionEnd,(V=je.current)==null?void 0:V.selectionDirection]});React__namespace.useImperativeHandle(e,()=>je.current,[]),React__namespace.useEffect(()=>{let Je=je.current,yt=Ne.current;if(!Je||!yt)return;Oe.current.value!==Je.value&&Oe.current.onChange(Je.value),Fe.current.prev=[Je.selectionStart,Je.selectionEnd,Je.selectionDirection];function Mt(){if(document.activeElement!==Je){He(null),tt(null);return}let Ft=Je.selectionStart,Ke=Je.selectionEnd,at=Je.selectionDirection,Qe=Je.maxLength,ct=Je.value,ft=Fe.current.prev,dt=-1,Rt=-1,zt;if(ct.length!==0&&Ft!==null&&Ke!==null){let pt=Ft===Ke,Sr=Ft===ct.length&&ct.length<Qe;if(pt&&!Sr){let mt=Ft;if(mt===0)dt=0,Rt=1,zt="forward";else if(mt===Qe)dt=mt-1,Rt=mt,zt="backward";else if(Qe>1&&ct.length>1){let Zt=0;if(ft[0]!==null&&ft[1]!==null){zt=mt<ft[1]?"backward":"forward";let Wt=ft[0]===ft[1]&&ft[0]<Qe;zt==="backward"&&!Wt&&(Zt=-1)}dt=Zt+mt,Rt=Zt+mt+1}}dt!==-1&&Rt!==-1&&dt!==Rt&&je.current.setSelectionRange(dt,Rt,zt)}let Yt=dt!==-1?dt:Ft,or=Rt!==-1?Rt:Ke,dr=zt??at;He(Yt),tt(or),Fe.current.prev=[Yt,or,dr]}if(document.addEventListener("selectionchange",Mt,{capture:!0}),Mt(),document.activeElement===Je&&qe(!0),!document.getElementById("input-otp-style")){let Ft=document.createElement("style");if(Ft.id="input-otp-style",document.head.appendChild(Ft),Ft.sheet){let Ke="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";$$1(Ft.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),$$1(Ft.sheet,`[data-input-otp]:autofill { ${Ke} }`),$$1(Ft.sheet,`[data-input-otp]:-webkit-autofill { ${Ke} }`),$$1(Ft.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),$$1(Ft.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let qt=()=>{yt&&yt.style.setProperty("--root-height",`${Je.clientHeight}px`)};qt();let Ht=new ResizeObserver(qt);return Ht.observe(Je),()=>{document.removeEventListener("selectionchange",Mt,{capture:!0}),Ht.disconnect()}},[]);let[ze,$e]=React__namespace.useState(!1),[Be,qe]=React__namespace.useState(!1),[Ge,He]=React__namespace.useState(null),[Ze,tt]=React__namespace.useState(null);React__namespace.useEffect(()=>{ht(()=>{var Je,yt,Mt,qt;(Je=je.current)==null||Je.dispatchEvent(new Event("input"));let Ht=(yt=je.current)==null?void 0:yt.selectionStart,Ft=(Mt=je.current)==null?void 0:Mt.selectionEnd,Ke=(qt=je.current)==null?void 0:qt.selectionDirection;Ht!==null&&Ft!==null&&(He(Ht),tt(Ft),Fe.current.prev=[Ht,Ft,Ke])})},[se,Be]),React__namespace.useEffect(()=>{ge!==void 0&&se!==ge&&ge.length<d&&se.length===d&&(S==null||S(se))},[d,S,ge,se]);let Ye=Tt({containerRef:Ne,inputRef:je,pushPasswordManagerStrategy:R,isFocused:Be}),rt=React__namespace.useCallback(Je=>{let yt=Je.currentTarget.value.slice(0,d);if(yt.length>0&&Ae&&!Ae.test(yt)){Je.preventDefault();return}typeof ge=="string"&&yt.length<ge.length&&document.dispatchEvent(new Event("selectionchange")),oe(yt)},[d,oe,ge,Ae]),Xe=React__namespace.useCallback(()=>{var Je;if(je.current){let yt=Math.min(je.current.value.length,d-1),Mt=je.current.value.length;(Je=je.current)==null||Je.setSelectionRange(yt,Mt),He(yt),tt(Mt)}qe(!0)},[d]),it=React__namespace.useCallback(Je=>{var yt,Mt;let qt=je.current;if(!C&&(!Oe.current.isIOS||!Je.clipboardData||!qt))return;let Ht=Je.clipboardData.getData("text/plain"),Ft=C?C(Ht):Ht;Je.preventDefault();let Ke=(yt=je.current)==null?void 0:yt.selectionStart,at=(Mt=je.current)==null?void 0:Mt.selectionEnd,Qe=(Ke!==at?se.slice(0,Ke)+Ft+se.slice(at):se.slice(0,Ke)+Ft+se.slice(Ke)).slice(0,d);if(Qe.length>0&&Ae&&!Ae.test(Qe))return;qt.value=Qe,oe(Qe);let ct=Math.min(Qe.length,d-1),ft=Qe.length;qt.setSelectionRange(ct,ft),He(ct),tt(ft)},[d,oe,Ae,se]),et=React__namespace.useMemo(()=>({position:"relative",cursor:j.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[j.disabled]),st=React__namespace.useMemo(()=>({position:"absolute",inset:0,width:Ye.willPushPWMBadge?`calc(100% + ${Ye.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:Ye.willPushPWMBadge?`inset(0 ${Ye.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:f,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[Ye.PWM_BADGE_SPACE_WIDTH,Ye.willPushPWMBadge,f]),ot=React__namespace.useMemo(()=>React__namespace.createElement("input",bt(St({autoComplete:j.autoComplete||"one-time-code"},j),{"data-input-otp":!0,"data-input-otp-placeholder-shown":se.length===0||void 0,"data-input-otp-mss":Ge,"data-input-otp-mse":Ze,inputMode:_,pattern:Ae==null?void 0:Ae.source,"aria-placeholder":b,style:st,maxLength:d,value:se,ref:je,onPaste:Je=>{var yt;it(Je),(yt=j.onPaste)==null||yt.call(j,Je)},onChange:rt,onMouseOver:Je=>{var yt;$e(!0),(yt=j.onMouseOver)==null||yt.call(j,Je)},onMouseLeave:Je=>{var yt;$e(!1),(yt=j.onMouseLeave)==null||yt.call(j,Je)},onFocus:Je=>{var yt;Xe(),(yt=j.onFocus)==null||yt.call(j,Je)},onBlur:Je=>{var yt;qe(!1),(yt=j.onBlur)==null||yt.call(j,Je)}})),[rt,Xe,it,_,st,d,Ze,Ge,j,Ae==null?void 0:Ae.source,se]),Ue=React__namespace.useMemo(()=>({slots:Array.from({length:d}).map((Je,yt)=>{var Mt;let qt=Be&&Ge!==null&&Ze!==null&&(Ge===Ze&&yt===Ge||yt>=Ge&&yt<Ze),Ht=se[yt]!==void 0?se[yt]:null,Ft=se[0]!==void 0?null:(Mt=b==null?void 0:b[yt])!=null?Mt:null;return{char:Ht,placeholderChar:Ft,isActive:qt,hasFakeCaret:qt&&Ht===null}}),isFocused:Be,isHovering:!j.disabled&&ze}),[Be,ze,d,Ze,Ge,j.disabled,se]),Ct=React__namespace.useMemo(()=>I?I(Ue):React__namespace.createElement(jt.Provider,{value:Ue},M),[M,Ue,I]);return React__namespace.createElement(React__namespace.Fragment,null,A!==null&&React__namespace.createElement("noscript",null,React__namespace.createElement("style",null,A)),React__namespace.createElement("div",{ref:Ne,"data-input-otp-container":!0,style:et,className:E},Ct,React__namespace.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},ot)))});Lt.displayName="Input";function $$1(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var Nt=`
|
|
2
2
|
[data-input-otp] {
|
|
3
3
|
--nojs-bg: white !important;
|
|
4
4
|
--nojs-fg: black !important;
|
|
@@ -467,7 +467,7 @@ This could lead to inefficient memoization and unnecessary re-renders.
|
|
|
467
467
|
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:l})}}},runInputStabilityCheck=(t,e,n)=>{const{memoize:o,memoizeOptions:l}=e,{inputSelectorResults:d,inputSelectorResultsCopy:f}=t,g=o(()=>({}),...l);if(!(g.apply(null,d)===g.apply(null,f))){let _;try{throw new Error}catch(S){({stack:_}=S)}console.warn(`An input selector returned a different result when passed same arguments.
|
|
468
468
|
This means your output selector will likely run more frequently than intended.
|
|
469
469
|
Avoid returning a new reference inside your input selector, e.g.
|
|
470
|
-
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:d,secondInputs:f,stack:_})}},globalDevModeChecks={inputStabilityCheck:"once",identityFunctionCheck:"once"};function assertIsFunction(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function assertIsObject(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function assertIsArrayOfFunctions(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${e}[${n}]`)}}var ensureIsArray=t=>Array.isArray(t)?t:[t];function getDependencies(t){const e=Array.isArray(t[0])?t[0]:t;return assertIsArrayOfFunctions(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function collectInputSelectorResults(t,e){const n=[],{length:o}=t;for(let l=0;l<o;l++)n.push(t[l].apply(null,e));return n}var getDevModeChecksExecutionInfo=(t,e)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...globalDevModeChecks,...e};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&t,run:runIdentityFunctionCheck},inputStabilityCheck:{shouldRun:o==="always"||o==="once"&&t,run:runInputStabilityCheck}}},StrongRef=class{constructor(t){this.value=t}deref(){return this.value}},Ref=typeof WeakRef<"u"?WeakRef:StrongRef,UNTERMINATED=0,TERMINATED=1;function createCacheNode(){return{s:UNTERMINATED,v:void 0,o:null,p:null}}function weakMapMemoize(t,e={}){let n=createCacheNode();const{resultEqualityCheck:o}=e;let l,d=0;function f(){var R;let g=n;const{length:b}=arguments;for(let C=0,E=b;C<E;C++){const A=arguments[C];if(typeof A=="function"||typeof A=="object"&&A!==null){let I=g.o;I===null&&(g.o=I=new WeakMap);const M=I.get(A);M===void 0?(g=createCacheNode(),I.set(A,g)):g=M}else{let I=g.p;I===null&&(g.p=I=new Map);const M=I.get(A);M===void 0?(g=createCacheNode(),I.set(A,g)):g=M}}const _=g;let S;if(g.s===TERMINATED)S=g.v;else if(S=t.apply(null,arguments),d++,o){const C=((R=l==null?void 0:l.deref)==null?void 0:R.call(l))??l;C!=null&&o(C,S)&&(S=C,d!==0&&d--),l=typeof S=="object"&&S!==null||typeof S=="function"?new Ref(S):S}return _.s=TERMINATED,_.v=S,S}return f.clearCache=()=>{n=createCacheNode(),f.resetResultsCount()},f.resultsCount=()=>d,f.resetResultsCount=()=>{d=0},f}function createSelectorCreator(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,o=(...l)=>{let d=0,f=0,g,b={},_=l.pop();typeof _=="object"&&(b=_,_=l.pop()),assertIsFunction(_,`createSelector expects an output function after the inputs, but received: [${typeof _}]`);const S={...n,...b},{memoize:R,memoizeOptions:C=[],argsMemoize:E=weakMapMemoize,argsMemoizeOptions:A=[],devModeChecks:I={}}=S,M=ensureIsArray(C),j=ensureIsArray(A),q=getDependencies(l),z=R(function(){return d++,_.apply(null,arguments)},...M);let Q=!0;const F=E(function(){f++;const te=collectInputSelectorResults(q,arguments);if(g=z.apply(null,te),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:ne,inputStabilityCheck:se}=getDevModeChecksExecutionInfo(Q,I);if(ne.shouldRun&&ne.run(_,te,g),se.shouldRun){const ge=collectInputSelectorResults(q,arguments);se.run({inputSelectorResults:te,inputSelectorResultsCopy:ge},{memoize:R,memoizeOptions:M},arguments)}Q&&(Q=!1)}return g},...j);return Object.assign(F,{resultFunc:_,memoizedResultFunc:z,dependencies:q,dependencyRecomputations:()=>f,resetDependencyRecomputations:()=>{f=0},lastResult:()=>g,recomputations:()=>d,resetRecomputations:()=>{d=0},memoize:R,argsMemoize:E})};return Object.assign(o,{withTypes:()=>o}),o}var createSelector=createSelectorCreator(weakMapMemoize),createStructuredSelector=Object.assign((t,e=createSelector)=>{assertIsObject(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),o=n.map(d=>t[d]);return e(o,(...d)=>d.reduce((f,g,b)=>(f[n[b]]=g,f),{}))},{withTypes:()=>createStructuredSelector}),hasMatchFunction=t=>t&&typeof t.match=="function";function createAction(t,e){function n(...o){if(e){let l=e(...o);if(!l)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(0):"prepareAction did not return an object");return{type:t,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:t,payload:o[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=o=>isAction(o)&&o.type===t,n}function freezeDraftable(t){return isDraftable(t)?produce(t,()=>{}):t}function getOrInsertComputed(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}var SHOULD_AUTOBATCH="RTK_autoBatch",prepareAutoBatched=()=>t=>({payload:t,meta:{[SHOULD_AUTOBATCH]:!0}});function executeReducerBuilderCallback(t){const e={},n=[];let o;const l={addCase(d,f){if(process.env.NODE_ENV!=="production"){if(n.length>0)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const g=typeof d=="string"?d:d.type;if(!g)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(28):"`builder.addCase` cannot be called with an empty action type");if(g in e)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${g}'`);return e[g]=f,l},addMatcher(d,f){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:d,reducer:f}),l},addDefaultCase(d){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(31):"`builder.addDefaultCase` can only be called once");return o=d,l}};return t(l),[e,n,o]}function isStateFunction(t){return typeof t=="function"}function createReducer(t,e){if(process.env.NODE_ENV!=="production"&&typeof e=="object")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let[n,o,l]=executeReducerBuilderCallback(e),d;if(isStateFunction(t))d=()=>freezeDraftable(t());else{const g=freezeDraftable(t);d=()=>g}function f(g=d(),b){let _=[n[b.type],...o.filter(({matcher:S})=>S(b)).map(({reducer:S})=>S)];return _.filter(S=>!!S).length===0&&(_=[l]),_.reduce((S,R)=>{if(R)if(isDraft(S)){const E=R(S,b);return E===void 0?S:E}else{if(isDraftable(S))return produce(S,C=>R(C,b));{const C=R(S,b);if(C===void 0){if(S===null)return S;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}}return S},g)}return f.getInitialState=d,f}var matches$1=(t,e)=>hasMatchFunction(t)?t.match(e):t(e);function isAnyOf(...t){return e=>t.some(n=>matches$1(n,e))}function isAllOf(...t){return e=>t.every(n=>matches$1(n,e))}function hasExpectedRequestMetadata(t,e){if(!t||!t.meta)return!1;const n=typeof t.meta.requestId=="string",o=e.indexOf(t.meta.requestStatus)>-1;return n&&o}function isAsyncThunkArray(t){return typeof t[0]=="function"&&"pending"in t[0]&&"fulfilled"in t[0]&&"rejected"in t[0]}function isPending(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["pending"]):isAsyncThunkArray(t)?isAnyOf(...t.map(e=>e.pending)):isPending()(t[0])}function isRejected(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["rejected"]):isAsyncThunkArray(t)?isAnyOf(...t.map(e=>e.rejected)):isRejected()(t[0])}function isRejectedWithValue(...t){const e=n=>n&&n.meta&&n.meta.rejectedWithValue;return t.length===0?isAllOf(isRejected(...t),e):isAsyncThunkArray(t)?isAllOf(isRejected(...t),e):isRejectedWithValue()(t[0])}function isFulfilled(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["fulfilled"]):isAsyncThunkArray(t)?isAnyOf(...t.map(e=>e.fulfilled)):isFulfilled()(t[0])}function isAsyncThunkAction(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["pending","fulfilled","rejected"]):isAsyncThunkArray(t)?isAnyOf(...t.flatMap(e=>[e.pending,e.rejected,e.fulfilled])):isAsyncThunkAction()(t[0])}var urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nanoid=(t=21)=>{let e="",n=t;for(;n--;)e+=urlAlphabet[Math.random()*64|0];return e},commonProperties=["name","message","stack","code"],RejectWithValue=class{constructor(t,e){ir(this,"_type");this.payload=t,this.meta=e}},FulfillWithMeta=class{constructor(t,e){ir(this,"_type");this.payload=t,this.meta=e}},miniSerializeError=t=>{if(typeof t=="object"&&t!==null){const e={};for(const n of commonProperties)typeof t[n]=="string"&&(e[n]=t[n]);return e}return{message:String(t)}},externalAbortMessage="External signal was aborted",createAsyncThunk=(()=>{function t(e,n,o){const l=createAction(e+"/fulfilled",(b,_,S,R)=>({payload:b,meta:{...R||{},arg:S,requestId:_,requestStatus:"fulfilled"}})),d=createAction(e+"/pending",(b,_,S)=>({payload:void 0,meta:{...S||{},arg:_,requestId:b,requestStatus:"pending"}})),f=createAction(e+"/rejected",(b,_,S,R,C)=>({payload:R,error:(o&&o.serializeError||miniSerializeError)(b||"Rejected"),meta:{...C||{},arg:S,requestId:_,rejectedWithValue:!!R,requestStatus:"rejected",aborted:(b==null?void 0:b.name)==="AbortError",condition:(b==null?void 0:b.name)==="ConditionError"}}));function g(b,{signal:_}={}){return(S,R,C)=>{const E=o!=null&&o.idGenerator?o.idGenerator(b):nanoid(),A=new AbortController;let I,M;function j(z){M=z,A.abort()}_&&(_.aborted?j(externalAbortMessage):_.addEventListener("abort",()=>j(externalAbortMessage),{once:!0}));const q=async function(){var F,V;let z;try{let te=(F=o==null?void 0:o.condition)==null?void 0:F.call(o,b,{getState:R,extra:C});if(isThenable(te)&&(te=await te),te===!1||A.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const ne=new Promise((se,ge)=>{I=()=>{ge({name:"AbortError",message:M||"Aborted"})},A.signal.addEventListener("abort",I)});S(d(E,b,(V=o==null?void 0:o.getPendingMeta)==null?void 0:V.call(o,{requestId:E,arg:b},{getState:R,extra:C}))),z=await Promise.race([ne,Promise.resolve(n(b,{dispatch:S,getState:R,extra:C,requestId:E,signal:A.signal,abort:j,rejectWithValue:(se,ge)=>new RejectWithValue(se,ge),fulfillWithValue:(se,ge)=>new FulfillWithMeta(se,ge)})).then(se=>{if(se instanceof RejectWithValue)throw se;return se instanceof FulfillWithMeta?l(se.payload,E,b,se.meta):l(se,E,b)})])}catch(te){z=te instanceof RejectWithValue?f(null,E,b,te.payload,te.meta):f(te,E,b)}finally{I&&A.signal.removeEventListener("abort",I)}return o&&!o.dispatchConditionRejection&&f.match(z)&&z.meta.condition||S(z),z}();return Object.assign(q,{abort:j,requestId:E,arg:b,unwrap(){return q.then(unwrapResult)}})}}return Object.assign(g,{pending:d,rejected:f,fulfilled:l,settled:isAnyOf(f,l),typePrefix:e})}return t.withTypes=()=>t,t})();function unwrapResult(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function isThenable(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var asyncThunkSymbol=Symbol.for("rtk-slice-createasyncthunk");function getType$1(t,e){return`${t}/${e}`}function buildCreateSlice({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[asyncThunkSymbol];return function(l){const{name:d,reducerPath:f=d}=l;if(!d)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(11):"`name` is a required option for createSlice");typeof process<"u"&&process.env.NODE_ENV==="development"&&l.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const g=(typeof l.reducers=="function"?l.reducers(buildReducerCreators()):l.reducers)||{},b=Object.keys(g),_={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},S={addCase(Q,F){const V=typeof Q=="string"?Q:Q.type;if(!V)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(12):"`context.addCase` cannot be called with an empty action type");if(V in _.sliceCaseReducersByType)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(13):"`context.addCase` cannot be called with two reducers for the same action type: "+V);return _.sliceCaseReducersByType[V]=F,S},addMatcher(Q,F){return _.sliceMatchers.push({matcher:Q,reducer:F}),S},exposeAction(Q,F){return _.actionCreators[Q]=F,S},exposeCaseReducer(Q,F){return _.sliceCaseReducersByName[Q]=F,S}};b.forEach(Q=>{const F=g[Q],V={reducerName:Q,type:getType$1(d,Q),createNotation:typeof l.reducers=="function"};isAsyncThunkSliceReducerDefinition(F)?handleThunkCaseReducerDefinition(V,F,S,e):handleNormalReducerDefinition(V,F,S)});function R(){if(process.env.NODE_ENV!=="production"&&typeof l.extraReducers=="object")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[Q={},F=[],V=void 0]=typeof l.extraReducers=="function"?executeReducerBuilderCallback(l.extraReducers):[l.extraReducers],te={...Q,..._.sliceCaseReducersByType};return createReducer(l.initialState,ne=>{for(let se in te)ne.addCase(se,te[se]);for(let se of _.sliceMatchers)ne.addMatcher(se.matcher,se.reducer);for(let se of F)ne.addMatcher(se.matcher,se.reducer);V&&ne.addDefaultCase(V)})}const C=Q=>Q,E=new Map,A=new WeakMap;let I;function M(Q,F){return I||(I=R()),I(Q,F)}function j(){return I||(I=R()),I.getInitialState()}function q(Q,F=!1){function V(ne){let se=ne[Q];if(typeof se>"u"){if(F)se=getOrInsertComputed(A,V,j);else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(15):"selectSlice returned undefined for an uninjected slice reducer")}return se}function te(ne=C){const se=getOrInsertComputed(E,F,()=>new WeakMap);return getOrInsertComputed(se,ne,()=>{const ge={};for(const[oe,Ae]of Object.entries(l.selectors??{}))ge[oe]=wrapSelector(Ae,ne,()=>getOrInsertComputed(A,ne,j),F);return ge})}return{reducerPath:Q,getSelectors:te,get selectors(){return te(V)},selectSlice:V}}const z={name:d,reducer:M,actions:_.actionCreators,caseReducers:_.sliceCaseReducersByName,getInitialState:j,...q(f),injectInto(Q,{reducerPath:F,...V}={}){const te=F??f;return Q.inject({reducerPath:te,reducer:M},V),{...z,...q(te,!0)}}};return z}}function wrapSelector(t,e,n,o){function l(d,...f){let g=e(d);if(typeof g>"u"){if(o)g=n();else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(16):"selectState returned undefined for an uninjected slice reducer")}return t(g,...f)}return l.unwrapped=t,l}var createSlice=buildCreateSlice();function buildReducerCreators(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function handleNormalReducerDefinition({type:t,reducerName:e,createNotation:n},o,l){let d,f;if("reducer"in o){if(n&&!isCaseReducerWithPrepareDefinition(o))throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");d=o.reducer,f=o.prepare}else d=o;l.addCase(t,d).exposeCaseReducer(e,d).exposeAction(e,f?createAction(t,f):createAction(t))}function isAsyncThunkSliceReducerDefinition(t){return t._reducerDefinitionType==="asyncThunk"}function isCaseReducerWithPrepareDefinition(t){return t._reducerDefinitionType==="reducerWithPrepare"}function handleThunkCaseReducerDefinition({type:t,reducerName:e},n,o,l){if(!l)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:d,fulfilled:f,pending:g,rejected:b,settled:_,options:S}=n,R=l(t,d,S);o.exposeAction(e,R),f&&o.addCase(R.fulfilled,f),g&&o.addCase(R.pending,g),b&&o.addCase(R.rejected,b),_&&o.addMatcher(R.settled,_),o.exposeCaseReducer(e,{fulfilled:f||noop$1,pending:g||noop$1,rejected:b||noop$1,settled:_||noop$1})}function noop$1(){}function formatProdErrorMessage(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var SchemaError=class extends Error{constructor(e){super(e[0].message);ir(this,"issues");this.name="SchemaError",this.issues=e}},QueryStatus=(t=>(t.uninitialized="uninitialized",t.pending="pending",t.fulfilled="fulfilled",t.rejected="rejected",t))(QueryStatus||{});function getRequestStatusFlags(t){return{status:t,isUninitialized:t==="uninitialized",isLoading:t==="pending",isSuccess:t==="fulfilled",isError:t==="rejected"}}var isPlainObject2=isPlainObject$4;function copyWithStructuralSharing(t,e){if(t===e||!(isPlainObject2(t)&&isPlainObject2(e)||Array.isArray(t)&&Array.isArray(e)))return e;const n=Object.keys(e),o=Object.keys(t);let l=n.length===o.length;const d=Array.isArray(e)?[]:{};for(const f of n)d[f]=copyWithStructuralSharing(t[f],e[f]),l&&(l=t[f]===d[f]);return l?t:d}function countObjectKeys$1(t){let e=0;for(const n in t)e++;return e}var flatten=t=>[].concat(...t);function isAbsoluteUrl(t){return new RegExp("(^|:)//").test(t)}function isDocumentVisible(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function isNotNullish(t){return t!=null}function isOnline(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var withoutTrailingSlash=t=>t.replace(/\/$/,""),withoutLeadingSlash=t=>t.replace(/^\//,"");function joinUrls(t,e){if(!t)return e;if(!e)return t;if(isAbsoluteUrl(e))return e;const n=t.endsWith("/")||!e.startsWith("?")?"/":"";return t=withoutTrailingSlash(t),e=withoutLeadingSlash(e),`${t}${n}${e}`}function getOrInsert(t,e,n){return t.has(e)?t.get(e):t.set(e,n).get(e)}var defaultFetchFn=(...t)=>fetch(...t),defaultValidateStatus=t=>t.status>=200&&t.status<=299,defaultIsJsonContentType=t=>/ion\/(vnd\.api\+)?json/.test(t.get("content-type")||"");function stripUndefined(t){if(!isPlainObject$4(t))return t;const e={...t};for(const[n,o]of Object.entries(e))o===void 0&&delete e[n];return e}function fetchBaseQuery({baseUrl:t,prepareHeaders:e=R=>R,fetchFn:n=defaultFetchFn,paramsSerializer:o,isJsonContentType:l=defaultIsJsonContentType,jsonContentType:d="application/json",jsonReplacer:f,timeout:g,responseHandler:b,validateStatus:_,...S}={}){return typeof fetch>"u"&&n===defaultFetchFn&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(C,E,A)=>{const{getState:I,extra:M,endpoint:j,forced:q,type:z}=E;let Q,{url:F,headers:V=new Headers(S.headers),params:te=void 0,responseHandler:ne=b??"json",validateStatus:se=_??defaultValidateStatus,timeout:ge=g,...oe}=typeof C=="string"?{url:C}:C,Ae,je=E.signal;ge&&(Ae=new AbortController,E.signal.addEventListener("abort",Ae.abort),je=Ae.signal);let Ne={...S,signal:je,...oe};V=new Headers(stripUndefined(V)),Ne.headers=await e(V,{getState:I,arg:C,extra:M,endpoint:j,forced:q,type:z,extraOptions:A})||V;const Oe=tt=>typeof tt=="object"&&(isPlainObject$4(tt)||Array.isArray(tt)||typeof tt.toJSON=="function");if(!Ne.headers.has("content-type")&&Oe(Ne.body)&&Ne.headers.set("content-type",d),Oe(Ne.body)&&l(Ne.headers)&&(Ne.body=JSON.stringify(Ne.body,f)),te){const tt=~F.indexOf("?")?"&":"?",Ye=o?o(te):new URLSearchParams(stripUndefined(te));F+=tt+Ye}F=joinUrls(t,F);const Fe=new Request(F,Ne);Q={request:new Request(F,Ne)};let $e,Be=!1,qe=Ae&&setTimeout(()=>{Be=!0,Ae.abort()},ge);try{$e=await n(Fe)}catch(tt){return{error:{status:Be?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(tt)},meta:Q}}finally{qe&&clearTimeout(qe),Ae==null||Ae.signal.removeEventListener("abort",Ae.abort)}const Ge=$e.clone();Q.response=Ge;let He,Ze="";try{let tt;if(await Promise.all([R($e,ne).then(Ye=>He=Ye,Ye=>tt=Ye),Ge.text().then(Ye=>Ze=Ye,()=>{})]),tt)throw tt}catch(tt){return{error:{status:"PARSING_ERROR",originalStatus:$e.status,data:Ze,error:String(tt)},meta:Q}}return se($e,He)?{data:He,meta:Q}:{error:{status:$e.status,data:He},meta:Q}};async function R(C,E){if(typeof E=="function")return E(C);if(E==="content-type"&&(E=l(C.headers)?"json":"text"),E==="json"){const A=await C.text();return A.length?JSON.parse(A):null}return C.text()}}var HandledError=class{constructor(t,e=void 0){this.value=t,this.meta=e}},onFocus=createAction("__rtkq/focused"),onFocusLost=createAction("__rtkq/unfocused"),onOnline=createAction("__rtkq/online"),onOffline=createAction("__rtkq/offline");function isQueryDefinition$1(t){return t.type==="query"}function isMutationDefinition$1(t){return t.type==="mutation"}function isInfiniteQueryDefinition$1(t){return t.type==="infinitequery"}function isAnyQueryDefinition(t){return isQueryDefinition$1(t)||isInfiniteQueryDefinition$1(t)}function calculateProvidedBy(t,e,n,o,l,d){return isFunction$5(t)?t(e,n,o,l).filter(isNotNullish).map(expandTagDescription).map(d):Array.isArray(t)?t.map(expandTagDescription).map(d):[]}function isFunction$5(t){return typeof t=="function"}function expandTagDescription(t){return typeof t=="string"?{type:t}:t}function asSafePromise(t,e){return t.catch(e)}var forceQueryFnSymbol=Symbol("forceQueryFn"),isUpsertQuery=t=>typeof t[forceQueryFnSymbol]=="function";function buildInitiate({serializeQueryArgs:t,queryThunk:e,infiniteQueryThunk:n,mutationThunk:o,api:l,context:d}){const f=new Map,g=new Map,{unsubscribeQueryResult:b,removeMutationResult:_,updateSubscriptionOptions:S}=l.internalActions;return{buildInitiateQuery:j,buildInitiateInfiniteQuery:q,buildInitiateMutation:z,getRunningQueryThunk:R,getRunningMutationThunk:C,getRunningQueriesThunk:E,getRunningMutationsThunk:A};function R(Q,F){return V=>{var se;const te=d.endpointDefinitions[Q],ne=t({queryArgs:F,endpointDefinition:te,endpointName:Q});return(se=f.get(V))==null?void 0:se[ne]}}function C(Q,F){return V=>{var te;return(te=g.get(V))==null?void 0:te[F]}}function E(){return Q=>Object.values(f.get(Q)||{}).filter(isNotNullish)}function A(){return Q=>Object.values(g.get(Q)||{}).filter(isNotNullish)}function I(Q){if(process.env.NODE_ENV!=="production"){if(I.triggered)return;const F=Q(l.internalActions.internal_getRTKQSubscriptions());if(I.triggered=!0,typeof F!="object"||typeof(F==null?void 0:F.type)=="string")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(34):`Warning: Middleware for RTK-Query API at reducerPath "${l.reducerPath}" has not been added to the store.
|
|
470
|
+
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:d,secondInputs:f,stack:_})}},globalDevModeChecks={inputStabilityCheck:"once",identityFunctionCheck:"once"};function assertIsFunction(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function assertIsObject(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function assertIsArrayOfFunctions(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${e}[${n}]`)}}var ensureIsArray=t=>Array.isArray(t)?t:[t];function getDependencies(t){const e=Array.isArray(t[0])?t[0]:t;return assertIsArrayOfFunctions(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function collectInputSelectorResults(t,e){const n=[],{length:o}=t;for(let l=0;l<o;l++)n.push(t[l].apply(null,e));return n}var getDevModeChecksExecutionInfo=(t,e)=>{const{identityFunctionCheck:n,inputStabilityCheck:o}={...globalDevModeChecks,...e};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&t,run:runIdentityFunctionCheck},inputStabilityCheck:{shouldRun:o==="always"||o==="once"&&t,run:runInputStabilityCheck}}},StrongRef=class{constructor(t){this.value=t}deref(){return this.value}},Ref=typeof WeakRef<"u"?WeakRef:StrongRef,UNTERMINATED=0,TERMINATED=1;function createCacheNode(){return{s:UNTERMINATED,v:void 0,o:null,p:null}}function weakMapMemoize(t,e={}){let n=createCacheNode();const{resultEqualityCheck:o}=e;let l,d=0;function f(){var R;let g=n;const{length:b}=arguments;for(let C=0,E=b;C<E;C++){const A=arguments[C];if(typeof A=="function"||typeof A=="object"&&A!==null){let I=g.o;I===null&&(g.o=I=new WeakMap);const M=I.get(A);M===void 0?(g=createCacheNode(),I.set(A,g)):g=M}else{let I=g.p;I===null&&(g.p=I=new Map);const M=I.get(A);M===void 0?(g=createCacheNode(),I.set(A,g)):g=M}}const _=g;let S;if(g.s===TERMINATED)S=g.v;else if(S=t.apply(null,arguments),d++,o){const C=((R=l==null?void 0:l.deref)==null?void 0:R.call(l))??l;C!=null&&o(C,S)&&(S=C,d!==0&&d--),l=typeof S=="object"&&S!==null||typeof S=="function"?new Ref(S):S}return _.s=TERMINATED,_.v=S,S}return f.clearCache=()=>{n=createCacheNode(),f.resetResultsCount()},f.resultsCount=()=>d,f.resetResultsCount=()=>{d=0},f}function createSelectorCreator(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,o=(...l)=>{let d=0,f=0,g,b={},_=l.pop();typeof _=="object"&&(b=_,_=l.pop()),assertIsFunction(_,`createSelector expects an output function after the inputs, but received: [${typeof _}]`);const S={...n,...b},{memoize:R,memoizeOptions:C=[],argsMemoize:E=weakMapMemoize,argsMemoizeOptions:A=[],devModeChecks:I={}}=S,M=ensureIsArray(C),j=ensureIsArray(A),q=getDependencies(l),z=R(function(){return d++,_.apply(null,arguments)},...M);let Q=!0;const F=E(function(){f++;const te=collectInputSelectorResults(q,arguments);if(g=z.apply(null,te),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:ne,inputStabilityCheck:se}=getDevModeChecksExecutionInfo(Q,I);if(ne.shouldRun&&ne.run(_,te,g),se.shouldRun){const ge=collectInputSelectorResults(q,arguments);se.run({inputSelectorResults:te,inputSelectorResultsCopy:ge},{memoize:R,memoizeOptions:M},arguments)}Q&&(Q=!1)}return g},...j);return Object.assign(F,{resultFunc:_,memoizedResultFunc:z,dependencies:q,dependencyRecomputations:()=>f,resetDependencyRecomputations:()=>{f=0},lastResult:()=>g,recomputations:()=>d,resetRecomputations:()=>{d=0},memoize:R,argsMemoize:E})};return Object.assign(o,{withTypes:()=>o}),o}var createSelector=createSelectorCreator(weakMapMemoize),createStructuredSelector=Object.assign((t,e=createSelector)=>{assertIsObject(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),o=n.map(d=>t[d]);return e(o,(...d)=>d.reduce((f,g,b)=>(f[n[b]]=g,f),{}))},{withTypes:()=>createStructuredSelector}),hasMatchFunction=t=>t&&typeof t.match=="function";function createAction(t,e){function n(...o){if(e){let l=e(...o);if(!l)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(0):"prepareAction did not return an object");return{type:t,payload:l.payload,..."meta"in l&&{meta:l.meta},..."error"in l&&{error:l.error}}}return{type:t,payload:o[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=o=>isAction(o)&&o.type===t,n}function freezeDraftable(t){return isDraftable(t)?produce(t,()=>{}):t}function getOrInsertComputed(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}var SHOULD_AUTOBATCH="RTK_autoBatch",prepareAutoBatched=()=>t=>({payload:t,meta:{[SHOULD_AUTOBATCH]:!0}});function executeReducerBuilderCallback(t){const e={},n=[];let o;const l={addCase(d,f){if(process.env.NODE_ENV!=="production"){if(n.length>0)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const g=typeof d=="string"?d:d.type;if(!g)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(28):"`builder.addCase` cannot be called with an empty action type");if(g in e)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${g}'`);return e[g]=f,l},addMatcher(d,f){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:d,reducer:f}),l},addDefaultCase(d){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(31):"`builder.addDefaultCase` can only be called once");return o=d,l}};return t(l),[e,n,o]}function isStateFunction(t){return typeof t=="function"}function createReducer(t,e){if(process.env.NODE_ENV!=="production"&&typeof e=="object")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let[n,o,l]=executeReducerBuilderCallback(e),d;if(isStateFunction(t))d=()=>freezeDraftable(t());else{const g=freezeDraftable(t);d=()=>g}function f(g=d(),b){let _=[n[b.type],...o.filter(({matcher:S})=>S(b)).map(({reducer:S})=>S)];return _.filter(S=>!!S).length===0&&(_=[l]),_.reduce((S,R)=>{if(R)if(isDraft(S)){const E=R(S,b);return E===void 0?S:E}else{if(isDraftable(S))return produce(S,C=>R(C,b));{const C=R(S,b);if(C===void 0){if(S===null)return S;throw Error("A case reducer on a non-draftable value must not return undefined")}return C}}return S},g)}return f.getInitialState=d,f}var matches$1=(t,e)=>hasMatchFunction(t)?t.match(e):t(e);function isAnyOf(...t){return e=>t.some(n=>matches$1(n,e))}function isAllOf(...t){return e=>t.every(n=>matches$1(n,e))}function hasExpectedRequestMetadata(t,e){if(!t||!t.meta)return!1;const n=typeof t.meta.requestId=="string",o=e.indexOf(t.meta.requestStatus)>-1;return n&&o}function isAsyncThunkArray(t){return typeof t[0]=="function"&&"pending"in t[0]&&"fulfilled"in t[0]&&"rejected"in t[0]}function isPending(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["pending"]):isAsyncThunkArray(t)?isAnyOf(...t.map(e=>e.pending)):isPending()(t[0])}function isRejected(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["rejected"]):isAsyncThunkArray(t)?isAnyOf(...t.map(e=>e.rejected)):isRejected()(t[0])}function isRejectedWithValue(...t){const e=n=>n&&n.meta&&n.meta.rejectedWithValue;return t.length===0?isAllOf(isRejected(...t),e):isAsyncThunkArray(t)?isAllOf(isRejected(...t),e):isRejectedWithValue()(t[0])}function isFulfilled(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["fulfilled"]):isAsyncThunkArray(t)?isAnyOf(...t.map(e=>e.fulfilled)):isFulfilled()(t[0])}function isAsyncThunkAction(...t){return t.length===0?e=>hasExpectedRequestMetadata(e,["pending","fulfilled","rejected"]):isAsyncThunkArray(t)?isAnyOf(...t.flatMap(e=>[e.pending,e.rejected,e.fulfilled])):isAsyncThunkAction()(t[0])}var urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nanoid=(t=21)=>{let e="",n=t;for(;n--;)e+=urlAlphabet[Math.random()*64|0];return e},commonProperties=["name","message","stack","code"],RejectWithValue=class{constructor(t,e){Qt(this,"_type");this.payload=t,this.meta=e}},FulfillWithMeta=class{constructor(t,e){Qt(this,"_type");this.payload=t,this.meta=e}},miniSerializeError=t=>{if(typeof t=="object"&&t!==null){const e={};for(const n of commonProperties)typeof t[n]=="string"&&(e[n]=t[n]);return e}return{message:String(t)}},externalAbortMessage="External signal was aborted",createAsyncThunk=(()=>{function t(e,n,o){const l=createAction(e+"/fulfilled",(b,_,S,R)=>({payload:b,meta:{...R||{},arg:S,requestId:_,requestStatus:"fulfilled"}})),d=createAction(e+"/pending",(b,_,S)=>({payload:void 0,meta:{...S||{},arg:_,requestId:b,requestStatus:"pending"}})),f=createAction(e+"/rejected",(b,_,S,R,C)=>({payload:R,error:(o&&o.serializeError||miniSerializeError)(b||"Rejected"),meta:{...C||{},arg:S,requestId:_,rejectedWithValue:!!R,requestStatus:"rejected",aborted:(b==null?void 0:b.name)==="AbortError",condition:(b==null?void 0:b.name)==="ConditionError"}}));function g(b,{signal:_}={}){return(S,R,C)=>{const E=o!=null&&o.idGenerator?o.idGenerator(b):nanoid(),A=new AbortController;let I,M;function j(z){M=z,A.abort()}_&&(_.aborted?j(externalAbortMessage):_.addEventListener("abort",()=>j(externalAbortMessage),{once:!0}));const q=async function(){var F,V;let z;try{let te=(F=o==null?void 0:o.condition)==null?void 0:F.call(o,b,{getState:R,extra:C});if(isThenable(te)&&(te=await te),te===!1||A.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const ne=new Promise((se,ge)=>{I=()=>{ge({name:"AbortError",message:M||"Aborted"})},A.signal.addEventListener("abort",I)});S(d(E,b,(V=o==null?void 0:o.getPendingMeta)==null?void 0:V.call(o,{requestId:E,arg:b},{getState:R,extra:C}))),z=await Promise.race([ne,Promise.resolve(n(b,{dispatch:S,getState:R,extra:C,requestId:E,signal:A.signal,abort:j,rejectWithValue:(se,ge)=>new RejectWithValue(se,ge),fulfillWithValue:(se,ge)=>new FulfillWithMeta(se,ge)})).then(se=>{if(se instanceof RejectWithValue)throw se;return se instanceof FulfillWithMeta?l(se.payload,E,b,se.meta):l(se,E,b)})])}catch(te){z=te instanceof RejectWithValue?f(null,E,b,te.payload,te.meta):f(te,E,b)}finally{I&&A.signal.removeEventListener("abort",I)}return o&&!o.dispatchConditionRejection&&f.match(z)&&z.meta.condition||S(z),z}();return Object.assign(q,{abort:j,requestId:E,arg:b,unwrap(){return q.then(unwrapResult)}})}}return Object.assign(g,{pending:d,rejected:f,fulfilled:l,settled:isAnyOf(f,l),typePrefix:e})}return t.withTypes=()=>t,t})();function unwrapResult(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function isThenable(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var asyncThunkSymbol=Symbol.for("rtk-slice-createasyncthunk");function getType$1(t,e){return`${t}/${e}`}function buildCreateSlice({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[asyncThunkSymbol];return function(l){const{name:d,reducerPath:f=d}=l;if(!d)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(11):"`name` is a required option for createSlice");typeof process<"u"&&process.env.NODE_ENV==="development"&&l.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const g=(typeof l.reducers=="function"?l.reducers(buildReducerCreators()):l.reducers)||{},b=Object.keys(g),_={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},S={addCase(Q,F){const V=typeof Q=="string"?Q:Q.type;if(!V)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(12):"`context.addCase` cannot be called with an empty action type");if(V in _.sliceCaseReducersByType)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(13):"`context.addCase` cannot be called with two reducers for the same action type: "+V);return _.sliceCaseReducersByType[V]=F,S},addMatcher(Q,F){return _.sliceMatchers.push({matcher:Q,reducer:F}),S},exposeAction(Q,F){return _.actionCreators[Q]=F,S},exposeCaseReducer(Q,F){return _.sliceCaseReducersByName[Q]=F,S}};b.forEach(Q=>{const F=g[Q],V={reducerName:Q,type:getType$1(d,Q),createNotation:typeof l.reducers=="function"};isAsyncThunkSliceReducerDefinition(F)?handleThunkCaseReducerDefinition(V,F,S,e):handleNormalReducerDefinition(V,F,S)});function R(){if(process.env.NODE_ENV!=="production"&&typeof l.extraReducers=="object")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[Q={},F=[],V=void 0]=typeof l.extraReducers=="function"?executeReducerBuilderCallback(l.extraReducers):[l.extraReducers],te={...Q,..._.sliceCaseReducersByType};return createReducer(l.initialState,ne=>{for(let se in te)ne.addCase(se,te[se]);for(let se of _.sliceMatchers)ne.addMatcher(se.matcher,se.reducer);for(let se of F)ne.addMatcher(se.matcher,se.reducer);V&&ne.addDefaultCase(V)})}const C=Q=>Q,E=new Map,A=new WeakMap;let I;function M(Q,F){return I||(I=R()),I(Q,F)}function j(){return I||(I=R()),I.getInitialState()}function q(Q,F=!1){function V(ne){let se=ne[Q];if(typeof se>"u"){if(F)se=getOrInsertComputed(A,V,j);else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(15):"selectSlice returned undefined for an uninjected slice reducer")}return se}function te(ne=C){const se=getOrInsertComputed(E,F,()=>new WeakMap);return getOrInsertComputed(se,ne,()=>{const ge={};for(const[oe,Ae]of Object.entries(l.selectors??{}))ge[oe]=wrapSelector(Ae,ne,()=>getOrInsertComputed(A,ne,j),F);return ge})}return{reducerPath:Q,getSelectors:te,get selectors(){return te(V)},selectSlice:V}}const z={name:d,reducer:M,actions:_.actionCreators,caseReducers:_.sliceCaseReducersByName,getInitialState:j,...q(f),injectInto(Q,{reducerPath:F,...V}={}){const te=F??f;return Q.inject({reducerPath:te,reducer:M},V),{...z,...q(te,!0)}}};return z}}function wrapSelector(t,e,n,o){function l(d,...f){let g=e(d);if(typeof g>"u"){if(o)g=n();else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(16):"selectState returned undefined for an uninjected slice reducer")}return t(g,...f)}return l.unwrapped=t,l}var createSlice=buildCreateSlice();function buildReducerCreators(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function handleNormalReducerDefinition({type:t,reducerName:e,createNotation:n},o,l){let d,f;if("reducer"in o){if(n&&!isCaseReducerWithPrepareDefinition(o))throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");d=o.reducer,f=o.prepare}else d=o;l.addCase(t,d).exposeCaseReducer(e,d).exposeAction(e,f?createAction(t,f):createAction(t))}function isAsyncThunkSliceReducerDefinition(t){return t._reducerDefinitionType==="asyncThunk"}function isCaseReducerWithPrepareDefinition(t){return t._reducerDefinitionType==="reducerWithPrepare"}function handleThunkCaseReducerDefinition({type:t,reducerName:e},n,o,l){if(!l)throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:d,fulfilled:f,pending:g,rejected:b,settled:_,options:S}=n,R=l(t,d,S);o.exposeAction(e,R),f&&o.addCase(R.fulfilled,f),g&&o.addCase(R.pending,g),b&&o.addCase(R.rejected,b),_&&o.addMatcher(R.settled,_),o.exposeCaseReducer(e,{fulfilled:f||noop$1,pending:g||noop$1,rejected:b||noop$1,settled:_||noop$1})}function noop$1(){}function formatProdErrorMessage(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var SchemaError=class extends Error{constructor(e){super(e[0].message);Qt(this,"issues");this.name="SchemaError",this.issues=e}},QueryStatus=(t=>(t.uninitialized="uninitialized",t.pending="pending",t.fulfilled="fulfilled",t.rejected="rejected",t))(QueryStatus||{});function getRequestStatusFlags(t){return{status:t,isUninitialized:t==="uninitialized",isLoading:t==="pending",isSuccess:t==="fulfilled",isError:t==="rejected"}}var isPlainObject2=isPlainObject$4;function copyWithStructuralSharing(t,e){if(t===e||!(isPlainObject2(t)&&isPlainObject2(e)||Array.isArray(t)&&Array.isArray(e)))return e;const n=Object.keys(e),o=Object.keys(t);let l=n.length===o.length;const d=Array.isArray(e)?[]:{};for(const f of n)d[f]=copyWithStructuralSharing(t[f],e[f]),l&&(l=t[f]===d[f]);return l?t:d}function countObjectKeys$1(t){let e=0;for(const n in t)e++;return e}var flatten=t=>[].concat(...t);function isAbsoluteUrl(t){return new RegExp("(^|:)//").test(t)}function isDocumentVisible(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}function isNotNullish(t){return t!=null}function isOnline(){return typeof navigator>"u"||navigator.onLine===void 0?!0:navigator.onLine}var withoutTrailingSlash=t=>t.replace(/\/$/,""),withoutLeadingSlash=t=>t.replace(/^\//,"");function joinUrls(t,e){if(!t)return e;if(!e)return t;if(isAbsoluteUrl(e))return e;const n=t.endsWith("/")||!e.startsWith("?")?"/":"";return t=withoutTrailingSlash(t),e=withoutLeadingSlash(e),`${t}${n}${e}`}function getOrInsert(t,e,n){return t.has(e)?t.get(e):t.set(e,n).get(e)}var defaultFetchFn=(...t)=>fetch(...t),defaultValidateStatus=t=>t.status>=200&&t.status<=299,defaultIsJsonContentType=t=>/ion\/(vnd\.api\+)?json/.test(t.get("content-type")||"");function stripUndefined(t){if(!isPlainObject$4(t))return t;const e={...t};for(const[n,o]of Object.entries(e))o===void 0&&delete e[n];return e}function fetchBaseQuery({baseUrl:t,prepareHeaders:e=R=>R,fetchFn:n=defaultFetchFn,paramsSerializer:o,isJsonContentType:l=defaultIsJsonContentType,jsonContentType:d="application/json",jsonReplacer:f,timeout:g,responseHandler:b,validateStatus:_,...S}={}){return typeof fetch>"u"&&n===defaultFetchFn&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),async(C,E,A)=>{const{getState:I,extra:M,endpoint:j,forced:q,type:z}=E;let Q,{url:F,headers:V=new Headers(S.headers),params:te=void 0,responseHandler:ne=b??"json",validateStatus:se=_??defaultValidateStatus,timeout:ge=g,...oe}=typeof C=="string"?{url:C}:C,Ae,je=E.signal;ge&&(Ae=new AbortController,E.signal.addEventListener("abort",Ae.abort),je=Ae.signal);let Ne={...S,signal:je,...oe};V=new Headers(stripUndefined(V)),Ne.headers=await e(V,{getState:I,arg:C,extra:M,endpoint:j,forced:q,type:z,extraOptions:A})||V;const Oe=tt=>typeof tt=="object"&&(isPlainObject$4(tt)||Array.isArray(tt)||typeof tt.toJSON=="function");if(!Ne.headers.has("content-type")&&Oe(Ne.body)&&Ne.headers.set("content-type",d),Oe(Ne.body)&&l(Ne.headers)&&(Ne.body=JSON.stringify(Ne.body,f)),te){const tt=~F.indexOf("?")?"&":"?",Ye=o?o(te):new URLSearchParams(stripUndefined(te));F+=tt+Ye}F=joinUrls(t,F);const Fe=new Request(F,Ne);Q={request:new Request(F,Ne)};let $e,Be=!1,qe=Ae&&setTimeout(()=>{Be=!0,Ae.abort()},ge);try{$e=await n(Fe)}catch(tt){return{error:{status:Be?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(tt)},meta:Q}}finally{qe&&clearTimeout(qe),Ae==null||Ae.signal.removeEventListener("abort",Ae.abort)}const Ge=$e.clone();Q.response=Ge;let He,Ze="";try{let tt;if(await Promise.all([R($e,ne).then(Ye=>He=Ye,Ye=>tt=Ye),Ge.text().then(Ye=>Ze=Ye,()=>{})]),tt)throw tt}catch(tt){return{error:{status:"PARSING_ERROR",originalStatus:$e.status,data:Ze,error:String(tt)},meta:Q}}return se($e,He)?{data:He,meta:Q}:{error:{status:$e.status,data:He},meta:Q}};async function R(C,E){if(typeof E=="function")return E(C);if(E==="content-type"&&(E=l(C.headers)?"json":"text"),E==="json"){const A=await C.text();return A.length?JSON.parse(A):null}return C.text()}}var HandledError=class{constructor(t,e=void 0){this.value=t,this.meta=e}},onFocus=createAction("__rtkq/focused"),onFocusLost=createAction("__rtkq/unfocused"),onOnline=createAction("__rtkq/online"),onOffline=createAction("__rtkq/offline");function isQueryDefinition$1(t){return t.type==="query"}function isMutationDefinition$1(t){return t.type==="mutation"}function isInfiniteQueryDefinition$1(t){return t.type==="infinitequery"}function isAnyQueryDefinition(t){return isQueryDefinition$1(t)||isInfiniteQueryDefinition$1(t)}function calculateProvidedBy(t,e,n,o,l,d){return isFunction$5(t)?t(e,n,o,l).filter(isNotNullish).map(expandTagDescription).map(d):Array.isArray(t)?t.map(expandTagDescription).map(d):[]}function isFunction$5(t){return typeof t=="function"}function expandTagDescription(t){return typeof t=="string"?{type:t}:t}function asSafePromise(t,e){return t.catch(e)}var forceQueryFnSymbol=Symbol("forceQueryFn"),isUpsertQuery=t=>typeof t[forceQueryFnSymbol]=="function";function buildInitiate({serializeQueryArgs:t,queryThunk:e,infiniteQueryThunk:n,mutationThunk:o,api:l,context:d}){const f=new Map,g=new Map,{unsubscribeQueryResult:b,removeMutationResult:_,updateSubscriptionOptions:S}=l.internalActions;return{buildInitiateQuery:j,buildInitiateInfiniteQuery:q,buildInitiateMutation:z,getRunningQueryThunk:R,getRunningMutationThunk:C,getRunningQueriesThunk:E,getRunningMutationsThunk:A};function R(Q,F){return V=>{var se;const te=d.endpointDefinitions[Q],ne=t({queryArgs:F,endpointDefinition:te,endpointName:Q});return(se=f.get(V))==null?void 0:se[ne]}}function C(Q,F){return V=>{var te;return(te=g.get(V))==null?void 0:te[F]}}function E(){return Q=>Object.values(f.get(Q)||{}).filter(isNotNullish)}function A(){return Q=>Object.values(g.get(Q)||{}).filter(isNotNullish)}function I(Q){if(process.env.NODE_ENV!=="production"){if(I.triggered)return;const F=Q(l.internalActions.internal_getRTKQSubscriptions());if(I.triggered=!0,typeof F!="object"||typeof(F==null?void 0:F.type)=="string")throw new Error(process.env.NODE_ENV==="production"?formatProdErrorMessage(34):`Warning: Middleware for RTK-Query API at reducerPath "${l.reducerPath}" has not been added to the store.
|
|
471
471
|
You must add the middleware for RTK-Query to function correctly!`)}}function M(Q,F){const V=(te,{subscribe:ne=!0,forceRefetch:se,subscriptionOptions:ge,[forceQueryFnSymbol]:oe,...Ae}={})=>(je,Ne)=>{var Xe;const Oe=t({queryArgs:te,endpointDefinition:F,endpointName:Q});let Fe;const ze={...Ae,type:"query",subscribe:ne,forceRefetch:se,subscriptionOptions:ge,endpointName:Q,originalArgs:te,queryCacheKey:Oe,[forceQueryFnSymbol]:oe};if(isQueryDefinition$1(F))Fe=e(ze);else{const{direction:it,initialPageParam:et}=Ae;Fe=n({...ze,direction:it,initialPageParam:et})}const $e=l.endpoints[Q].select(te),Be=je(Fe),qe=$e(Ne());I(je);const{requestId:Ge,abort:He}=Be,Ze=qe.requestId!==Ge,tt=(Xe=f.get(je))==null?void 0:Xe[Oe],Ye=()=>$e(Ne()),rt=Object.assign(oe?Be.then(Ye):Ze&&!tt?Promise.resolve(qe):Promise.all([tt,Be]).then(Ye),{arg:te,requestId:Ge,subscriptionOptions:ge,queryCacheKey:Oe,abort:He,async unwrap(){const it=await rt;if(it.isError)throw it.error;return it.data},refetch:()=>je(V(te,{subscribe:!1,forceRefetch:!0})),unsubscribe(){ne&&je(b({queryCacheKey:Oe,requestId:Ge}))},updateSubscriptionOptions(it){rt.subscriptionOptions=it,je(S({endpointName:Q,requestId:Ge,queryCacheKey:Oe,options:it}))}});if(!tt&&!Ze&&!oe){const it=getOrInsert(f,je,{});it[Oe]=rt,rt.then(()=>{delete it[Oe],countObjectKeys$1(it)||f.delete(je)})}return rt};return V}function j(Q,F){return M(Q,F)}function q(Q,F){return M(Q,F)}function z(Q){return(F,{track:V=!0,fixedCacheKey:te}={})=>(ne,se)=>{const ge=o({type:"mutation",endpointName:Q,originalArgs:F,track:V,fixedCacheKey:te}),oe=ne(ge);I(ne);const{requestId:Ae,abort:je,unwrap:Ne}=oe,Oe=asSafePromise(oe.unwrap().then(Be=>({data:Be})),Be=>({error:Be})),Fe=()=>{ne(_({requestId:Ae,fixedCacheKey:te}))},ze=Object.assign(Oe,{arg:oe.arg,requestId:Ae,abort:je,unwrap:Ne,reset:Fe}),$e=g.get(ne)||{};return g.set(ne,$e),$e[Ae]=ze,ze.then(()=>{delete $e[Ae],countObjectKeys$1($e)||g.delete(ne)}),te&&($e[te]=ze,ze.then(()=>{$e[te]===ze&&(delete $e[te],countObjectKeys$1($e)||g.delete(ne))})),ze}}}var NamedSchemaError=class extends SchemaError{constructor(t,e,n,o){super(t),this.value=e,this.schemaName=n,this._bqMeta=o}};async function parseWithSchema(t,e,n,o){const l=await t["~standard"].validate(e);if(l.issues)throw new NamedSchemaError(l.issues,e,n,o);return l.value}function defaultTransformResponse(t){return t}var addShouldAutoBatch=(t={})=>({...t,[SHOULD_AUTOBATCH]:!0});function buildThunks({reducerPath:t,baseQuery:e,context:{endpointDefinitions:n},serializeQueryArgs:o,api:l,assertTagType:d,selectors:f,onSchemaFailure:g,catchSchemaFailure:b,skipSchemaValidation:_}){const S=(oe,Ae,je,Ne)=>(Oe,Fe)=>{const ze=n[oe],$e=o({queryArgs:Ae,endpointDefinition:ze,endpointName:oe});if(Oe(l.internalActions.queryResultPatched({queryCacheKey:$e,patches:je})),!Ne)return;const Be=l.endpoints[oe].select(Ae)(Fe()),qe=calculateProvidedBy(ze.providesTags,Be.data,void 0,Ae,{},d);Oe(l.internalActions.updateProvidedBy([{queryCacheKey:$e,providedTags:qe}]))};function R(oe,Ae,je=0){const Ne=[Ae,...oe];return je&&Ne.length>je?Ne.slice(0,-1):Ne}function C(oe,Ae,je=0){const Ne=[...oe,Ae];return je&&Ne.length>je?Ne.slice(1):Ne}const E=(oe,Ae,je,Ne=!0)=>(Oe,Fe)=>{const $e=l.endpoints[oe].select(Ae)(Fe()),Be={patches:[],inversePatches:[],undo:()=>Oe(l.util.patchQueryData(oe,Ae,Be.inversePatches,Ne))};if($e.status==="uninitialized")return Be;let qe;if("data"in $e)if(isDraftable($e.data)){const[Ge,He,Ze]=produceWithPatches($e.data,je);Be.patches.push(...He),Be.inversePatches.push(...Ze),qe=Ge}else qe=je($e.data),Be.patches.push({op:"replace",path:[],value:qe}),Be.inversePatches.push({op:"replace",path:[],value:$e.data});return Be.patches.length===0||Oe(l.util.patchQueryData(oe,Ae,Be.patches,Ne)),Be},A=(oe,Ae,je)=>Ne=>Ne(l.endpoints[oe].initiate(Ae,{subscribe:!1,forceRefetch:!0,[forceQueryFnSymbol]:()=>({data:je})})),I=(oe,Ae)=>oe.query&&oe[Ae]?oe[Ae]:defaultTransformResponse,M=async(oe,{signal:Ae,abort:je,rejectWithValue:Ne,fulfillWithValue:Oe,dispatch:Fe,getState:ze,extra:$e})=>{var He,Ze;const Be=n[oe.endpointName],{metaSchema:qe,skipSchemaValidation:Ge=_}=Be;try{let tt=I(Be,"transformResponse");const Ye={signal:Ae,abort:je,dispatch:Fe,getState:ze,extra:$e,endpoint:oe.endpointName,type:oe.type,forced:oe.type==="query"?j(oe,ze()):void 0,queryCacheKey:oe.type==="query"?oe.queryCacheKey:void 0},rt=oe.type==="query"?oe[forceQueryFnSymbol]:void 0;let Xe;const it=async(st,ot,Ue,Ct)=>{if(ot==null&&st.pages.length)return Promise.resolve({data:st});const Je={queryArg:oe.originalArgs,pageParam:ot},yt=await et(Je),Mt=Ct?R:C;return{data:{pages:Mt(st.pages,yt.data,Ue),pageParams:Mt(st.pageParams,ot,Ue)},meta:yt.meta}};async function et(st){let ot;const{extraOptions:Ue,argSchema:Ct,rawResponseSchema:Je,responseSchema:yt}=Be;if(Ct&&!Ge&&(st=await parseWithSchema(Ct,st,"argSchema",{})),rt?ot=rt():Be.query?ot=await e(Be.query(st),Ye,Ue):ot=await Be.queryFn(st,Ye,Ue,Ht=>e(Ht,Ye,Ue)),typeof process<"u"&&process.env.NODE_ENV==="development"){const Ht=Be.query?"`baseQuery`":"`queryFn`";let Ft;if(!ot)Ft=`${Ht} did not return anything.`;else if(typeof ot!="object")Ft=`${Ht} did not return an object.`;else if(ot.error&&ot.data)Ft=`${Ht} returned an object containing both \`error\` and \`result\`.`;else if(ot.error===void 0&&ot.data===void 0)Ft=`${Ht} returned an object containing neither a valid \`error\` and \`result\`. At least one of them should not be \`undefined\``;else for(const Ke of Object.keys(ot))if(Ke!=="error"&&Ke!=="data"&&Ke!=="meta"){Ft=`The object returned by ${Ht} has the unknown property ${Ke}.`;break}Ft&&console.error(`Error encountered handling the endpoint ${oe.endpointName}.
|
|
472
472
|
${Ft}
|
|
473
473
|
It needs to return an object with either the shape \`{ data: <value> }\` or \`{ error: <value> }\` that may contain an optional \`meta\` property.
|
|
@@ -997,7 +997,7 @@ Server response (text): ${_}`}throw new Error(g)}return await f.json()}catch(f){
|
|
|
997
997
|
`,_="/",S="*",R="",C="comment",E="declaration";inlineStyleParser=function(I,M){if(typeof I!="string")throw new TypeError("First argument must be a string");if(!I)return[];M=M||{};var j=1,q=1;function z(je){var Ne=je.match(e);Ne&&(j+=Ne.length);var Oe=je.lastIndexOf(b);q=~Oe?je.length-Oe:q+je.length}function Q(){var je={line:j,column:q};return function(Ne){return Ne.position=new F(je),ne(),Ne}}function F(je){this.start=je,this.end={line:j,column:q},this.source=M.source}F.prototype.content=I;function V(je){var Ne=new Error(M.source+":"+j+":"+q+": "+je);if(Ne.reason=je,Ne.filename=M.source,Ne.line=j,Ne.column=q,Ne.source=I,!M.silent)throw Ne}function te(je){var Ne=je.exec(I);if(Ne){var Oe=Ne[0];return z(Oe),I=I.slice(Oe.length),Ne}}function ne(){te(n)}function se(je){var Ne;for(je=je||[];Ne=ge();)Ne!==!1&&je.push(Ne);return je}function ge(){var je=Q();if(!(_!=I.charAt(0)||S!=I.charAt(1))){for(var Ne=2;R!=I.charAt(Ne)&&(S!=I.charAt(Ne)||_!=I.charAt(Ne+1));)++Ne;if(Ne+=2,R===I.charAt(Ne-1))return V("End of comment missing");var Oe=I.slice(2,Ne-2);return q+=2,z(Oe),I=I.slice(Ne),q+=2,je({type:C,comment:Oe})}}function oe(){var je=Q(),Ne=te(o);if(Ne){if(ge(),!te(l))return V("property missing ':'");var Oe=te(d),Fe=je({type:E,property:A(Ne[0].replace(t,R)),value:Oe?A(Oe[0].replace(t,R)):R});return te(f),Fe}}function Ae(){var je=[];se(je);for(var Ne;Ne=oe();)Ne!==!1&&(je.push(Ne),se(je));return je}return ne(),Ae()};function A(I){return I?I.replace(g,R):R}return inlineStyleParser}var hasRequiredCjs$1;function requireCjs$1(){if(hasRequiredCjs$1)return cjs$1;hasRequiredCjs$1=1;var t=cjs$1&&cjs$1.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs$1,"__esModule",{value:!0}),cjs$1.default=n;var e=t(requireInlineStyleParser());function n(o,l){var d=null;if(!o||typeof o!="string")return d;var f=(0,e.default)(o),g=typeof l=="function";return f.forEach(function(b){if(b.type==="declaration"){var _=b.property,S=b.value;g?l(_,S,b):S&&(d=d||{},d[_]=S)}}),d}return cjs$1}var utilities={},hasRequiredUtilities$1;function requireUtilities$1(){if(hasRequiredUtilities$1)return utilities;hasRequiredUtilities$1=1,Object.defineProperty(utilities,"__esModule",{value:!0}),utilities.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,d=function(_){return!_||n.test(_)||t.test(_)},f=function(_,S){return S.toUpperCase()},g=function(_,S){return"".concat(S,"-")},b=function(_,S){return S===void 0&&(S={}),d(_)?_:(_=_.toLowerCase(),S.reactCompat?_=_.replace(l,g):_=_.replace(o,g),_.replace(e,f))};return utilities.camelCase=b,utilities}var cjs,hasRequiredCjs;function requireCjs(){if(hasRequiredCjs)return cjs;hasRequiredCjs=1;var t=cjs&&cjs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},e=t(requireCjs$1()),n=requireUtilities$1();function o(l,d){var f={};return!l||typeof l!="string"||(0,e.default)(l,function(g,b){g&&b&&(f[(0,n.camelCase)(g,d)]=b)}),f}return o.default=o,cjs=o,cjs}var hasRequiredUtilities;function requireUtilities(){return hasRequiredUtilities||(hasRequiredUtilities=1,function(t){var e=utilities$1&&utilities$1.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(t,"__esModule",{value:!0}),t.returnFirstArg=t.canTextBeChildOfNode=t.ELEMENTS_WITH_NO_TEXT_CHILDREN=t.PRESERVE_CUSTOM_ATTRIBUTES=void 0,t.isCustomComponent=d,t.setStyleProp=g;var n=React,o=e(requireCjs()),l=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function d(S,R){return S.includes("-")?!l.has(S):!!(R&&typeof R.is=="string")}var f={reactCompat:!0};function g(S,R){if(typeof S=="string"){if(!S.trim()){R.style={};return}try{R.style=(0,o.default)(S,f)}catch{R.style={}}}}t.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,t.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var b=function(S){return!t.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(S.name)};t.canTextBeChildOfNode=b;var _=function(S){return S};t.returnFirstArg=_}(utilities$1)),utilities$1}var hasRequiredAttributesToProps;function requireAttributesToProps(){if(hasRequiredAttributesToProps)return attributesToProps;hasRequiredAttributesToProps=1,Object.defineProperty(attributesToProps,"__esModule",{value:!0}),attributesToProps.default=d;var t=requireLib$1(),e=requireUtilities(),n=["checked","value"],o=["input","select","textarea"],l={reset:!0,submit:!0};function d(g,b){g===void 0&&(g={});var _={},S=!!(g.type&&l[g.type]);for(var R in g){var C=g[R];if((0,t.isCustomAttribute)(R)){_[R]=C;continue}var E=R.toLowerCase(),A=f(E);if(A){var I=(0,t.getPropertyInfo)(A);switch(n.includes(A)&&o.includes(b)&&!S&&(A=f("default"+E)),_[A]=C,I&&I.type){case t.BOOLEAN:_[A]=!0;break;case t.OVERLOADED_BOOLEAN:C===""&&(_[A]=!0);break}continue}e.PRESERVE_CUSTOM_ATTRIBUTES&&(_[R]=C)}return(0,e.setStyleProp)(g.style,_),_}function f(g){return t.possibleStandardNames[g]}return attributesToProps}var domToReact={},hasRequiredDomToReact;function requireDomToReact(){if(hasRequiredDomToReact)return domToReact;hasRequiredDomToReact=1;var t=domToReact&&domToReact.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(domToReact,"__esModule",{value:!0}),domToReact.default=d;var e=React,n=t(requireAttributesToProps()),o=requireUtilities(),l={cloneElement:e.cloneElement,createElement:e.createElement,isValidElement:e.isValidElement};function d(g,b){b===void 0&&(b={});for(var _=[],S=typeof b.replace=="function",R=b.transform||o.returnFirstArg,C=b.library||l,E=C.cloneElement,A=C.createElement,I=C.isValidElement,M=g.length,j=0;j<M;j++){var q=g[j];if(S){var z=b.replace(q,j);if(I(z)){M>1&&(z=E(z,{key:z.key||j})),_.push(R(z,q,j));continue}}if(q.type==="text"){var Q=!q.data.trim().length;if(Q&&q.parent&&!(0,o.canTextBeChildOfNode)(q.parent)||b.trim&&Q)continue;_.push(R(q.data,q,j));continue}var F=q,V={};f(F)?((0,o.setStyleProp)(F.attribs.style,F.attribs),V=F.attribs):F.attribs&&(V=(0,n.default)(F.attribs,F.name));var te=void 0;switch(q.type){case"script":case"style":q.children[0]&&(V.dangerouslySetInnerHTML={__html:q.children[0].data});break;case"tag":q.name==="textarea"&&q.children[0]?V.defaultValue=q.children[0].data:q.children&&q.children.length&&(te=d(q.children,b));break;default:continue}M>1&&(V.key=j),_.push(R(A(q.name,V,te),q,j))}return _.length===1?_[0]:_}function f(g){return o.PRESERVE_CUSTOM_ATTRIBUTES&&g.type==="tag"&&(0,o.isCustomComponent)(g.name,g.attribs)}return domToReact}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(t){var e=lib$3&&lib$3.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(t,"__esModule",{value:!0}),t.htmlToDOM=t.domToReact=t.attributesToProps=t.Text=t.ProcessingInstruction=t.Element=t.Comment=void 0,t.default=g;var n=e(requireHtmlToDom());t.htmlToDOM=n.default;var o=e(requireAttributesToProps());t.attributesToProps=o.default;var l=e(requireDomToReact());t.domToReact=l.default;var d=requireLib$2();Object.defineProperty(t,"Comment",{enumerable:!0,get:function(){return d.Comment}}),Object.defineProperty(t,"Element",{enumerable:!0,get:function(){return d.Element}}),Object.defineProperty(t,"ProcessingInstruction",{enumerable:!0,get:function(){return d.ProcessingInstruction}}),Object.defineProperty(t,"Text",{enumerable:!0,get:function(){return d.Text}});var f={lowerCaseAttributeNames:!1};function g(b,_){if(typeof b!="string")throw new TypeError("First argument must be a string");return b?(0,l.default)((0,n.default)(b,(_==null?void 0:_.htmlparser2)||f),_):[]}}(lib$3)),lib$3}var libExports=requireLib();const HTMLReactParser=getDefaultExportFromCjs$1(libExports),parser=HTMLReactParser.default||HTMLReactParser;function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _defaults=_getDefaults();function changeDefaults(t){_defaults=t}var noopTest={exec:()=>null};function edit(t,e=""){let n=typeof t=="string"?t:t.source;const o={replace:(l,d)=>{let f=typeof d=="string"?d:d.source;return f=f.replace(other.caret,"$1"),n=n.replace(l,f),o},getRegex:()=>new RegExp(n,e)};return o}var other={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},newline=/^(?:[ \t]*(?:\n|$))+/,blockCode=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheadingCore=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,lheading=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lheadingGfm=edit(lheadingCore).replace(/bull/g,bullet).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list$1=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html$2=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote,code:blockCode,def,fences,heading,hr,html:html$2,lheading,list:list$1,newline,paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,lheading:lheadingGfm,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading",` *#{1,6} *[^
|
|
998
998
|
]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$1=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation=/[\p{P}\p{S}]/u,_punctuationOrSpace=/[\s\p{P}\p{S}]/u,_notPunctuationOrSpace=/[^\s\p{P}\p{S}]/u,punctuation=edit(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,_punctuationOrSpace).getRegex(),_punctuationGfmStrongEm=/(?!~)[\p{P}\p{S}]/u,_punctuationOrSpaceGfmStrongEm=/(?!~)[\s\p{P}\p{S}]/u,_notPunctuationOrSpaceGfmStrongEm=/(?:[^\s\p{P}\p{S}]|~)/u,blockSkip=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelimCore=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,emStrongLDelim=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuation).getRegex(),emStrongLDelimGfm=edit(emStrongLDelimCore,"u").replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimAstCore="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",emStrongRDelimAst=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAstGfm=edit(emStrongRDelimAstCore,"gu").replace(/notPunctSpace/g,_notPunctuationOrSpaceGfmStrongEm).replace(/punctSpace/g,_punctuationOrSpaceGfmStrongEm).replace(/punct/g,_punctuationGfmStrongEm).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_notPunctuationOrSpace).replace(/punctSpace/g,_punctuationOrSpace).replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\(punct)/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape:escape$1,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,emStrongRDelimAst:emStrongRDelimAstGfm,emStrongLDelim:emStrongLDelimGfm,url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic},escapeReplacements={"&":"&","<":"<",">":">",'"':""","'":"'"},getEscapeReplacement=t=>escapeReplacements[t];function escape2(t,e){if(e){if(other.escapeTest.test(t))return t.replace(other.escapeReplace,getEscapeReplacement)}else if(other.escapeTestNoEncode.test(t))return t.replace(other.escapeReplaceNoEncode,getEscapeReplacement);return t}function cleanUrl(t){try{t=encodeURI(t).replace(other.percentDecode,"%")}catch{return null}return t}function splitCells(t,e){var d;const n=t.replace(other.findPipe,(f,g,b)=>{let _=!1,S=g;for(;--S>=0&&b[S]==="\\";)_=!_;return _?"|":" |"}),o=n.split(other.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((d=o.at(-1))!=null&&d.trim())&&o.pop(),e)if(o.length>e)o.splice(e);else for(;o.length<e;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(other.slashPipe,"|");return o}function rtrim(t,e,n){const o=t.length;if(o===0)return"";let l=0;for(;l<o&&t.charAt(o-l-1)===e;)l++;return t.slice(0,o-l)}function findClosingBracket(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===e[0])n++;else if(t[o]===e[1]&&(n--,n<0))return o;return n>0?-2:-1}function outputLink(t,e,n,o,l){const d=e.href,f=e.title||null,g=t[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const b={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:d,title:f,text:g,tokens:o.inlineTokens(g)};return o.state.inLink=!1,b}function indentCodeCompensation(t,e,n){const o=t.match(n.other.indentCodeCompensation);if(o===null)return e;const l=o[1];return e.split(`
|
|
999
999
|
`).map(d=>{const f=d.match(n.other.beginningSpace);if(f===null)return d;const[g]=f;return g.length>=l.length?d.slice(l.length):d}).join(`
|
|
1000
|
-
`)}var _Tokenizer=class{constructor(t){
|
|
1000
|
+
`)}var _Tokenizer=class{constructor(t){Qt(this,"options");Qt(this,"rules");Qt(this,"lexer");this.options=t||_defaults}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:rtrim(n,`
|
|
1001
1001
|
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],o=indentCodeCompensation(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const o=rtrim(n,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(n=o.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:rtrim(e[0],`
|
|
1002
1002
|
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=rtrim(e[0],`
|
|
1003
1003
|
`).split(`
|
|
@@ -1019,7 +1019,7 @@ ${S}`:S;const R=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
1019
1019
|
`+C}!E&&!C.trim()&&(E=!0),_+=V+`
|
|
1020
1020
|
`,t=t.substring(V.length+1),R=te.slice(A)}}l.loose||(f?l.loose=!0:this.rules.other.doubleBlankLine.test(_)&&(f=!0));let I=null,M;this.options.gfm&&(I=this.rules.other.listIsTask.exec(S),I&&(M=I[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:_,task:!!I,checked:M,loose:!1,text:S,tokens:[]}),l.raw+=_}const g=l.items.at(-1);if(g)g.raw=g.raw.trimEnd(),g.text=g.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let b=0;b<l.items.length;b++)if(this.lexer.state.top=!1,l.items[b].tokens=this.lexer.blockTokens(l.items[b].text,[]),!l.loose){const _=l.items[b].tokens.filter(R=>R.type==="space"),S=_.length>0&&_.some(R=>this.rules.other.anyLine.test(R.raw));l.loose=S}if(l.loose)for(let b=0;b<l.items.length;b++)l.items[b].loose=!0;return l}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:o,title:l}}}table(t){var f;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=splitCells(e[1]),o=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(f=e[3])!=null&&f.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
1021
1021
|
`):[],d={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===o.length){for(const g of o)this.rules.other.tableAlignRight.test(g)?d.align.push("right"):this.rules.other.tableAlignCenter.test(g)?d.align.push("center"):this.rules.other.tableAlignLeft.test(g)?d.align.push("left"):d.align.push(null);for(let g=0;g<n.length;g++)d.header.push({text:n[g],tokens:this.lexer.inline(n[g]),header:!0,align:d.align[g]});for(const g of l)d.rows.push(splitCells(g,d.header.length).map((b,_)=>({text:b,tokens:this.lexer.inline(b),header:!1,align:d.align[_]})));return d}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
|
|
1022
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const d=rtrim(n.slice(0,-1),"\\");if((n.length-d.length)%2===0)return}else{const d=findClosingBracket(e[2],"()");if(d===-2)return;if(d>-1){const g=(e[0].indexOf("!")===0?5:4)+e[1].length+d;e[2]=e[2].substring(0,d),e[0]=e[0].substring(0,g).trim(),e[3]=""}}let o=e[2],l="";if(this.options.pedantic){const d=this.rules.other.pedanticHrefTitle.exec(o);d&&(o=d[1],l=d[3])}else l=e[3]?e[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?o=o.slice(1):o=o.slice(1,-1)),outputLink(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const o=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=e[o.toLowerCase()];if(!l){const d=n[0].charAt(0);return{type:"text",raw:d,text:d}}return outputLink(n,l,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const d=[...o[0]].length-1;let f,g,b=d,_=0;const S=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(S.lastIndex=0,e=e.slice(-1*t.length+d);(o=S.exec(e))!=null;){if(f=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!f)continue;if(g=[...f].length,o[3]||o[4]){b+=g;continue}else if((o[5]||o[6])&&d%3&&!((d+g)%3)){_+=g;continue}if(b-=g,b>0)continue;g=Math.min(g,g+b+_);const R=[...o[0]][0].length,C=t.slice(0,d+o.index+R+g);if(Math.min(d,g)%2){const A=C.slice(1,-1);return{type:"em",raw:C,text:A,tokens:this.lexer.inlineTokens(A)}}const E=C.slice(2,-2);return{type:"strong",raw:C,text:E,tokens:this.lexer.inlineTokens(E)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(n),l=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return o&&l&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,o;return e[2]==="@"?(n=e[1],o="mailto:"+n):(n=e[1],o=n),{type:"link",raw:e[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let o,l;if(e[2]==="@")o=e[0],l="mailto:"+o;else{let d;do d=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(d!==e[0]);o=e[0],e[1]==="www."?l="http://"+e[0]:l=e[0]}return{type:"link",raw:e[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},_Lexer=class
|
|
1022
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const d=rtrim(n.slice(0,-1),"\\");if((n.length-d.length)%2===0)return}else{const d=findClosingBracket(e[2],"()");if(d===-2)return;if(d>-1){const g=(e[0].indexOf("!")===0?5:4)+e[1].length+d;e[2]=e[2].substring(0,d),e[0]=e[0].substring(0,g).trim(),e[3]=""}}let o=e[2],l="";if(this.options.pedantic){const d=this.rules.other.pedanticHrefTitle.exec(o);d&&(o=d[1],l=d[3])}else l=e[3]?e[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?o=o.slice(1):o=o.slice(1,-1)),outputLink(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const o=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=e[o.toLowerCase()];if(!l){const d=n[0].charAt(0);return{type:"text",raw:d,text:d}}return outputLink(n,l,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const d=[...o[0]].length-1;let f,g,b=d,_=0;const S=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(S.lastIndex=0,e=e.slice(-1*t.length+d);(o=S.exec(e))!=null;){if(f=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!f)continue;if(g=[...f].length,o[3]||o[4]){b+=g;continue}else if((o[5]||o[6])&&d%3&&!((d+g)%3)){_+=g;continue}if(b-=g,b>0)continue;g=Math.min(g,g+b+_);const R=[...o[0]][0].length,C=t.slice(0,d+o.index+R+g);if(Math.min(d,g)%2){const A=C.slice(1,-1);return{type:"em",raw:C,text:A,tokens:this.lexer.inlineTokens(A)}}const E=C.slice(2,-2);return{type:"strong",raw:C,text:E,tokens:this.lexer.inlineTokens(E)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(n),l=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return o&&l&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,o;return e[2]==="@"?(n=e[1],o="mailto:"+n):(n=e[1],o=n),{type:"link",raw:e[0],text:n,href:o,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let o,l;if(e[2]==="@")o=e[0],l="mailto:"+o;else{let d;do d=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(d!==e[0]);o=e[0],e[1]==="www."?l="http://"+e[0]:l=e[0]}return{type:"link",raw:e[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},_Lexer=class yn{constructor(e){Qt(this,"tokens");Qt(this,"options");Qt(this,"state");Qt(this,"tokenizer");Qt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_defaults,this.options.tokenizer=this.options.tokenizer||new _Tokenizer,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other,block:block.normal,inline:inline.normal};this.options.pedantic?(n.block=block.pedantic,n.inline=inline.pedantic):this.options.gfm&&(n.block=block.gfm,this.options.breaks?n.inline=inline.breaks:n.inline=inline.gfm),this.tokenizer.rules=n}static get rules(){return{block,inline}}static lex(e,n){return new yn(n).lex(e)}static lexInline(e,n){return new yn(n).inlineTokens(e)}lex(e){e=e.replace(other.carriageReturn,`
|
|
1023
1023
|
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const o=this.inlineQueue[n];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],o=!1){var l,d,f;for(this.options.pedantic&&(e=e.replace(other.tabCharGlobal," ").replace(other.spaceLine,""));e;){let g;if((d=(l=this.options.extensions)==null?void 0:l.block)!=null&&d.some(_=>(g=_.call({lexer:this},e,n))?(e=e.substring(g.raw.length),n.push(g),!0):!1))continue;if(g=this.tokenizer.space(e)){e=e.substring(g.raw.length);const _=n.at(-1);g.raw.length===1&&_!==void 0?_.raw+=`
|
|
1024
1024
|
`:n.push(g);continue}if(g=this.tokenizer.code(e)){e=e.substring(g.raw.length);const _=n.at(-1);(_==null?void 0:_.type)==="paragraph"||(_==null?void 0:_.type)==="text"?(_.raw+=`
|
|
1025
1025
|
`+g.raw,_.text+=`
|
|
@@ -1029,7 +1029,7 @@ ${S}`:S;const R=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
1029
1029
|
`+g.raw,_.text+=`
|
|
1030
1030
|
`+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=_.text):n.push(g),o=b.length!==e.length,e=e.substring(g.raw.length);continue}if(g=this.tokenizer.text(e)){e=e.substring(g.raw.length);const _=n.at(-1);(_==null?void 0:_.type)==="text"?(_.raw+=`
|
|
1031
1031
|
`+g.raw,_.text+=`
|
|
1032
|
-
`+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=_.text):n.push(g);continue}if(e){const _="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var g,b,_;let o=e,l=null;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)S.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,l.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let d=!1,f="";for(;e;){d||(f=""),d=!1;let S;if((b=(g=this.options.extensions)==null?void 0:g.inline)!=null&&b.some(C=>(S=C.call({lexer:this},e,n))?(e=e.substring(S.raw.length),n.push(S),!0):!1))continue;if(S=this.tokenizer.escape(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.tag(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.link(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(S.raw.length);const C=n.at(-1);S.type==="text"&&(C==null?void 0:C.type)==="text"?(C.raw+=S.raw,C.text+=S.text):n.push(S);continue}if(S=this.tokenizer.emStrong(e,o,f)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.codespan(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.br(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.del(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.autolink(e)){e=e.substring(S.raw.length),n.push(S);continue}if(!this.state.inLink&&(S=this.tokenizer.url(e))){e=e.substring(S.raw.length),n.push(S);continue}let R=e;if((_=this.options.extensions)!=null&&_.startInline){let C=1/0;const E=e.slice(1);let A;this.options.extensions.startInline.forEach(I=>{A=I.call({lexer:this},E),typeof A=="number"&&A>=0&&(C=Math.min(C,A))}),C<1/0&&C>=0&&(R=e.substring(0,C+1))}if(S=this.tokenizer.inlineText(R)){e=e.substring(S.raw.length),S.raw.slice(-1)!=="_"&&(f=S.raw.slice(-1)),d=!0;const C=n.at(-1);(C==null?void 0:C.type)==="text"?(C.raw+=S.raw,C.text+=S.text):n.push(S);continue}if(e){const C="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(C);break}else throw new Error(C)}}return n}},_Renderer=class{constructor(t){
|
|
1032
|
+
`+g.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=_.text):n.push(g);continue}if(e){const _="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var g,b,_;let o=e,l=null;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)S.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,l.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(l=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let d=!1,f="";for(;e;){d||(f=""),d=!1;let S;if((b=(g=this.options.extensions)==null?void 0:g.inline)!=null&&b.some(C=>(S=C.call({lexer:this},e,n))?(e=e.substring(S.raw.length),n.push(S),!0):!1))continue;if(S=this.tokenizer.escape(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.tag(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.link(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(S.raw.length);const C=n.at(-1);S.type==="text"&&(C==null?void 0:C.type)==="text"?(C.raw+=S.raw,C.text+=S.text):n.push(S);continue}if(S=this.tokenizer.emStrong(e,o,f)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.codespan(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.br(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.del(e)){e=e.substring(S.raw.length),n.push(S);continue}if(S=this.tokenizer.autolink(e)){e=e.substring(S.raw.length),n.push(S);continue}if(!this.state.inLink&&(S=this.tokenizer.url(e))){e=e.substring(S.raw.length),n.push(S);continue}let R=e;if((_=this.options.extensions)!=null&&_.startInline){let C=1/0;const E=e.slice(1);let A;this.options.extensions.startInline.forEach(I=>{A=I.call({lexer:this},E),typeof A=="number"&&A>=0&&(C=Math.min(C,A))}),C<1/0&&C>=0&&(R=e.substring(0,C+1))}if(S=this.tokenizer.inlineText(R)){e=e.substring(S.raw.length),S.raw.slice(-1)!=="_"&&(f=S.raw.slice(-1)),d=!0;const C=n.at(-1);(C==null?void 0:C.type)==="text"?(C.raw+=S.raw,C.text+=S.text):n.push(S);continue}if(e){const C="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(C);break}else throw new Error(C)}}return n}},_Renderer=class{constructor(t){Qt(this,"options");Qt(this,"parser");this.options=t||_defaults}space(t){return""}code({text:t,lang:e,escaped:n}){var d;const o=(d=(e||"").match(other.notSpaceStart))==null?void 0:d[0],l=t.replace(other.endingNewline,"")+`
|
|
1033
1033
|
`;return o?'<pre><code class="language-'+escape2(o)+'">'+(n?l:escape2(l,!0))+`</code></pre>
|
|
1034
1034
|
`:"<pre><code>"+(n?l:escape2(l,!0))+`</code></pre>
|
|
1035
1035
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
@@ -1047,10 +1047,10 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1047
1047
|
`}tablerow({text:t}){return`<tr>
|
|
1048
1048
|
${t}</tr>
|
|
1049
1049
|
`}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
1050
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const o=this.parser.parseInline(n),l=cleanUrl(t);if(l===null)return o;t=l;let d='<a href="'+t+'"';return e&&(d+=' title="'+escape2(e)+'"'),d+=">"+o+"</a>",d}image({href:t,title:e,text:n,tokens:o}){o&&(n=this.parser.parseInline(o,this.parser.textRenderer));const l=cleanUrl(t);if(l===null)return escape2(n);t=l;let d=`<img src="${t}" alt="${n}"`;return e&&(d+=` title="${escape2(e)}"`),d+=">",d}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape2(t.text)}},_TextRenderer=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},_Parser=class
|
|
1051
|
-
`+this.renderer.text(_);n?o+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):o+=S;continue}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}parseInline(e,n=this.renderer){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){o+=_||"";continue}}const b=g;switch(b.type){case"escape":{o+=n.text(b);break}case"html":{o+=n.html(b);break}case"link":{o+=n.link(b);break}case"image":{o+=n.image(b);break}case"strong":{o+=n.strong(b);break}case"em":{o+=n.em(b);break}case"codespan":{o+=n.codespan(b);break}case"br":{o+=n.br(b);break}case"del":{o+=n.del(b);break}case"text":{o+=n.text(b);break}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}},_Hooks=(sr=class{constructor(t){
|
|
1052
|
-
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+escape2(n.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(n);throw n}}},markedInstance=new Marked;function marked(t,e){return markedInstance.parse(t,e)}marked.options=marked.setOptions=function(t){return markedInstance.setOptions(t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...t){return markedInstance.use(...t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(t,e){return markedInstance.walkTokens(t,e)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply:apply$1,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),apply$1||(apply$1=function(e,n,o){return e.apply(n,o)}),construct||(construct=function(e,n){return new e(...n)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),l=1;l<n;l++)o[l-1]=arguments[l];return apply$1(t,e,o)}}function unconstruct(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return construct(t,n)}}function addToSet(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(t,null);let o=e.length;for(;o--;){let l=e[o];if(typeof l=="string"){const d=n(l);d!==l&&(isFrozen(e)||(e[o]=d),l=d)}t[l]=!0}return t}function cleanArray(t){for(let e=0;e<t.length;e++)objectHasOwnProperty(t,e)||(t[e]=null);return t}function clone(t){const e=create(null);for(const[n,o]of entries(t))objectHasOwnProperty(t,n)&&(Array.isArray(o)?e[n]=cleanArray(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=clone(o):e[n]=o);return e}function lookupGetter(t,e){for(;t!==null;){const o=getOwnPropertyDescriptor(t,e);if(o){if(o.get)return unapply(o.get);if(typeof o.value=="function")return unapply(o.value)}t=getPrototypeOf(t)}function n(){return null}return n}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text$1=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=function t(){return typeof window>"u"?null:window},_createTrustedTypesPolicy=function t(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";n&&n.hasAttribute(l)&&(o=n.getAttribute(l));const d="dompurify"+(o?"#"+o:"");try{return e.createPolicy(d,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},_createHooksMap=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function createDOMPurify(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const e=Kt=>createDOMPurify(Kt);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==NODE_TYPE.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,l=o.currentScript,{DocumentFragment:d,HTMLTemplateElement:f,Node:g,Element:b,NodeFilter:_,NamedNodeMap:S=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:R,DOMParser:C,trustedTypes:E}=t,A=b.prototype,I=lookupGetter(A,"cloneNode"),M=lookupGetter(A,"remove"),j=lookupGetter(A,"nextSibling"),q=lookupGetter(A,"childNodes"),z=lookupGetter(A,"parentNode");if(typeof f=="function"){const Kt=n.createElement("template");Kt.content&&Kt.content.ownerDocument&&(n=Kt.content.ownerDocument)}let Q,F="";const{implementation:V,createNodeIterator:te,createDocumentFragment:ne,getElementsByTagName:se}=n,{importNode:ge}=o;let oe=_createHooksMap();e.isSupported=typeof entries=="function"&&typeof z=="function"&&V&&V.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ae,ERB_EXPR:je,TMPLIT_EXPR:Ne,DATA_ATTR:Oe,ARIA_ATTR:Fe,IS_SCRIPT_OR_DATA:ze,ATTR_WHITESPACE:$e,CUSTOM_ELEMENT:Be}=EXPRESSIONS;let{IS_ALLOWED_URI:qe}=EXPRESSIONS,Ge=null;const He=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text$1]);let Ze=null;const tt=addToSet({},[...html,...svg,...mathMl,...xml]);let Ye=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),rt=null,Xe=null,it=!0,et=!0,st=!1,ot=!0,Ue=!1,Ct=!0,Je=!1,yt=!1,Mt=!1,qt=!1,Ht=!1,Ft=!1,Ke=!0,at=!1;const Qe="user-content-";let ct=!0,ft=!1,dt={},Rt=null;const zt=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Yt=null;const or=addToSet({},["audio","video","img","source","image","track"]);let dr=null;const pt=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sr="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml";let Wt=Zt,nr=!1,ur=null;const Nr=addToSet({},[Sr,mt,Zt],stringToString);let Tr=addToSet({},["mi","mo","mn","ms","mtext"]),gr=addToSet({},["annotation-xml"]);const xr=addToSet({},["title","style","font","a","script"]);let er=null;const Mr=["application/xhtml+xml","text/html"],Xt="text/html";let mr=null,Ir=null;const hn=n.createElement("form"),Dr=function(nt){return nt instanceof RegExp||nt instanceof Function},wr=function(){let nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ir&&Ir===nt)){if((!nt||typeof nt!="object")&&(nt={}),nt=clone(nt),er=Mr.indexOf(nt.PARSER_MEDIA_TYPE)===-1?Xt:nt.PARSER_MEDIA_TYPE,mr=er==="application/xhtml+xml"?stringToString:stringToLowerCase,Ge=objectHasOwnProperty(nt,"ALLOWED_TAGS")?addToSet({},nt.ALLOWED_TAGS,mr):He,Ze=objectHasOwnProperty(nt,"ALLOWED_ATTR")?addToSet({},nt.ALLOWED_ATTR,mr):tt,ur=objectHasOwnProperty(nt,"ALLOWED_NAMESPACES")?addToSet({},nt.ALLOWED_NAMESPACES,stringToString):Nr,dr=objectHasOwnProperty(nt,"ADD_URI_SAFE_ATTR")?addToSet(clone(pt),nt.ADD_URI_SAFE_ATTR,mr):pt,Yt=objectHasOwnProperty(nt,"ADD_DATA_URI_TAGS")?addToSet(clone(or),nt.ADD_DATA_URI_TAGS,mr):or,Rt=objectHasOwnProperty(nt,"FORBID_CONTENTS")?addToSet({},nt.FORBID_CONTENTS,mr):zt,rt=objectHasOwnProperty(nt,"FORBID_TAGS")?addToSet({},nt.FORBID_TAGS,mr):clone({}),Xe=objectHasOwnProperty(nt,"FORBID_ATTR")?addToSet({},nt.FORBID_ATTR,mr):clone({}),dt=objectHasOwnProperty(nt,"USE_PROFILES")?nt.USE_PROFILES:!1,it=nt.ALLOW_ARIA_ATTR!==!1,et=nt.ALLOW_DATA_ATTR!==!1,st=nt.ALLOW_UNKNOWN_PROTOCOLS||!1,ot=nt.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=nt.SAFE_FOR_TEMPLATES||!1,Ct=nt.SAFE_FOR_XML!==!1,Je=nt.WHOLE_DOCUMENT||!1,qt=nt.RETURN_DOM||!1,Ht=nt.RETURN_DOM_FRAGMENT||!1,Ft=nt.RETURN_TRUSTED_TYPE||!1,Mt=nt.FORCE_BODY||!1,Ke=nt.SANITIZE_DOM!==!1,at=nt.SANITIZE_NAMED_PROPS||!1,ct=nt.KEEP_CONTENT!==!1,ft=nt.IN_PLACE||!1,qe=nt.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,Wt=nt.NAMESPACE||Zt,Tr=nt.MATHML_TEXT_INTEGRATION_POINTS||Tr,gr=nt.HTML_INTEGRATION_POINTS||gr,Ye=nt.CUSTOM_ELEMENT_HANDLING||{},nt.CUSTOM_ELEMENT_HANDLING&&Dr(nt.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ye.tagNameCheck=nt.CUSTOM_ELEMENT_HANDLING.tagNameCheck),nt.CUSTOM_ELEMENT_HANDLING&&Dr(nt.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ye.attributeNameCheck=nt.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),nt.CUSTOM_ELEMENT_HANDLING&&typeof nt.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=nt.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(et=!1),Ht&&(qt=!0),dt&&(Ge=addToSet({},text$1),Ze=[],dt.html===!0&&(addToSet(Ge,html$1),addToSet(Ze,html)),dt.svg===!0&&(addToSet(Ge,svg$1),addToSet(Ze,svg),addToSet(Ze,xml)),dt.svgFilters===!0&&(addToSet(Ge,svgFilters),addToSet(Ze,svg),addToSet(Ze,xml)),dt.mathMl===!0&&(addToSet(Ge,mathMl$1),addToSet(Ze,mathMl),addToSet(Ze,xml))),nt.ADD_TAGS&&(Ge===He&&(Ge=clone(Ge)),addToSet(Ge,nt.ADD_TAGS,mr)),nt.ADD_ATTR&&(Ze===tt&&(Ze=clone(Ze)),addToSet(Ze,nt.ADD_ATTR,mr)),nt.ADD_URI_SAFE_ATTR&&addToSet(dr,nt.ADD_URI_SAFE_ATTR,mr),nt.FORBID_CONTENTS&&(Rt===zt&&(Rt=clone(Rt)),addToSet(Rt,nt.FORBID_CONTENTS,mr)),ct&&(Ge["#text"]=!0),Je&&addToSet(Ge,["html","head","body"]),Ge.table&&(addToSet(Ge,["tbody"]),delete rt.tbody),nt.TRUSTED_TYPES_POLICY){if(typeof nt.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof nt.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=nt.TRUSTED_TYPES_POLICY,F=Q.createHTML("")}else Q===void 0&&(Q=_createTrustedTypesPolicy(E,l)),Q!==null&&typeof F=="string"&&(F=Q.createHTML(""));freeze&&freeze(nt),Ir=nt}},nn=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),Or=addToSet({},[...mathMl$1,...mathMlDisallowed]),Br=function(nt){let It=z(nt);(!It||!It.tagName)&&(It={namespaceURI:Wt,tagName:"template"});const Ut=stringToLowerCase(nt.tagName),cr=stringToLowerCase(It.tagName);return ur[nt.namespaceURI]?nt.namespaceURI===mt?It.namespaceURI===Zt?Ut==="svg":It.namespaceURI===Sr?Ut==="svg"&&(cr==="annotation-xml"||Tr[cr]):!!nn[Ut]:nt.namespaceURI===Sr?It.namespaceURI===Zt?Ut==="math":It.namespaceURI===mt?Ut==="math"&&gr[cr]:!!Or[Ut]:nt.namespaceURI===Zt?It.namespaceURI===mt&&!gr[cr]||It.namespaceURI===Sr&&!Tr[cr]?!1:!Or[Ut]&&(xr[Ut]||!nn[Ut]):!!(er==="application/xhtml+xml"&&ur[nt.namespaceURI]):!1},Rr=function(nt){arrayPush(e.removed,{element:nt});try{z(nt).removeChild(nt)}catch{M(nt)}},jr=function(nt,It){try{arrayPush(e.removed,{attribute:It.getAttributeNode(nt),from:It})}catch{arrayPush(e.removed,{attribute:null,from:It})}if(It.removeAttribute(nt),nt==="is")if(qt||Ht)try{Rr(It)}catch{}else try{It.setAttribute(nt,"")}catch{}},Yr=function(nt){let It=null,Ut=null;if(Mt)nt="<remove></remove>"+nt;else{const pr=stringMatch(nt,/^[\r\n\t ]+/);Ut=pr&&pr[0]}er==="application/xhtml+xml"&&Wt===Zt&&(nt='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+nt+"</body></html>");const cr=Q?Q.createHTML(nt):nt;if(Wt===Zt)try{It=new C().parseFromString(cr,er)}catch{}if(!It||!It.documentElement){It=V.createDocument(Wt,"template",null);try{It.documentElement.innerHTML=nr?F:cr}catch{}}const vr=It.body||It.documentElement;return nt&&Ut&&vr.insertBefore(n.createTextNode(Ut),vr.childNodes[0]||null),Wt===Zt?se.call(It,Je?"html":"body")[0]:Je?It.documentElement:vr},Zr=function(nt){return te.call(nt.ownerDocument||nt,nt,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT|_.SHOW_PROCESSING_INSTRUCTION|_.SHOW_CDATA_SECTION,null)},Hr=function(nt){return nt instanceof R&&(typeof nt.nodeName!="string"||typeof nt.textContent!="string"||typeof nt.removeChild!="function"||!(nt.attributes instanceof S)||typeof nt.removeAttribute!="function"||typeof nt.setAttribute!="function"||typeof nt.namespaceURI!="string"||typeof nt.insertBefore!="function"||typeof nt.hasChildNodes!="function")},Xr=function(nt){return typeof g=="function"&&nt instanceof g};function Ar(Kt,nt,It){arrayForEach(Kt,Ut=>{Ut.call(e,nt,It,Ir)})}const an=function(nt){let It=null;if(Ar(oe.beforeSanitizeElements,nt,null),Hr(nt))return Rr(nt),!0;const Ut=mr(nt.nodeName);if(Ar(oe.uponSanitizeElement,nt,{tagName:Ut,allowedTags:Ge}),Ct&&nt.hasChildNodes()&&!Xr(nt.firstElementChild)&®ExpTest(/<[/\w!]/g,nt.innerHTML)&®ExpTest(/<[/\w!]/g,nt.textContent)||nt.nodeType===NODE_TYPE.progressingInstruction||Ct&&nt.nodeType===NODE_TYPE.comment&®ExpTest(/<[/\w]/g,nt.data))return Rr(nt),!0;if(!Ge[Ut]||rt[Ut]){if(!rt[Ut]&&on(Ut)&&(Ye.tagNameCheck instanceof RegExp&®ExpTest(Ye.tagNameCheck,Ut)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(Ut)))return!1;if(ct&&!Rt[Ut]){const cr=z(nt)||nt.parentNode,vr=q(nt)||nt.childNodes;if(vr&&cr){const pr=vr.length;for(let _r=pr-1;_r>=0;--_r){const Pr=I(vr[_r],!0);Pr.__removalCount=(nt.__removalCount||0)+1,cr.insertBefore(Pr,j(nt))}}}return Rr(nt),!0}return nt instanceof b&&!Br(nt)||(Ut==="noscript"||Ut==="noembed"||Ut==="noframes")&®ExpTest(/<\/no(script|embed|frames)/i,nt.innerHTML)?(Rr(nt),!0):(Ue&&nt.nodeType===NODE_TYPE.text&&(It=nt.textContent,arrayForEach([Ae,je,Ne],cr=>{It=stringReplace(It,cr," ")}),nt.textContent!==It&&(arrayPush(e.removed,{element:nt.cloneNode()}),nt.textContent=It)),Ar(oe.afterSanitizeElements,nt,null),!1)},sn=function(nt,It,Ut){if(Ke&&(It==="id"||It==="name")&&(Ut in n||Ut in hn))return!1;if(!(et&&!Xe[It]&®ExpTest(Oe,It))){if(!(it&®ExpTest(Fe,It))){if(!Ze[It]||Xe[It]){if(!(on(nt)&&(Ye.tagNameCheck instanceof RegExp&®ExpTest(Ye.tagNameCheck,nt)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(nt))&&(Ye.attributeNameCheck instanceof RegExp&®ExpTest(Ye.attributeNameCheck,It)||Ye.attributeNameCheck instanceof Function&&Ye.attributeNameCheck(It))||It==="is"&&Ye.allowCustomizedBuiltInElements&&(Ye.tagNameCheck instanceof RegExp&®ExpTest(Ye.tagNameCheck,Ut)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(Ut))))return!1}else if(!dr[It]){if(!regExpTest(qe,stringReplace(Ut,$e,""))){if(!((It==="src"||It==="xlink:href"||It==="href")&&nt!=="script"&&stringIndexOf(Ut,"data:")===0&&Yt[nt])){if(!(st&&!regExpTest(ze,stringReplace(Ut,$e,"")))){if(Ut)return!1}}}}}}return!0},on=function(nt){return nt!=="annotation-xml"&&stringMatch(nt,Be)},Jr=function(nt){Ar(oe.beforeSanitizeAttributes,nt,null);const{attributes:It}=nt;if(!It||Hr(nt))return;const Ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ze,forceKeepAttr:void 0};let cr=It.length;for(;cr--;){const vr=It[cr],{name:pr,namespaceURI:_r,value:Pr}=vr,Vr=mr(pr),Qr=Pr;let Vt=pr==="value"?Qr:stringTrim(Qr);if(Ut.attrName=Vr,Ut.attrValue=Vt,Ut.keepAttr=!0,Ut.forceKeepAttr=void 0,Ar(oe.uponSanitizeAttribute,nt,Ut),Vt=Ut.attrValue,at&&(Vr==="id"||Vr==="name")&&(jr(pr,nt),Vt=Qe+Vt),Ct&®ExpTest(/((--!?|])>)|<\/(style|title)/i,Vt)){jr(pr,nt);continue}if(Ut.forceKeepAttr)continue;if(!Ut.keepAttr){jr(pr,nt);continue}if(!ot&®ExpTest(/\/>/i,Vt)){jr(pr,nt);continue}Ue&&arrayForEach([Ae,je,Ne],Cr=>{Vt=stringReplace(Vt,Cr," ")});const Lr=mr(nt.nodeName);if(!sn(Lr,Vr,Vt)){jr(pr,nt);continue}if(Q&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!_r)switch(E.getAttributeType(Lr,Vr)){case"TrustedHTML":{Vt=Q.createHTML(Vt);break}case"TrustedScriptURL":{Vt=Q.createScriptURL(Vt);break}}if(Vt!==Qr)try{_r?nt.setAttributeNS(_r,pr,Vt):nt.setAttribute(pr,Vt),Hr(nt)?Rr(nt):arrayPop(e.removed)}catch{jr(pr,nt)}}Ar(oe.afterSanitizeAttributes,nt,null)},un=function Kt(nt){let It=null;const Ut=Zr(nt);for(Ar(oe.beforeSanitizeShadowDOM,nt,null);It=Ut.nextNode();)Ar(oe.uponSanitizeShadowNode,It,null),an(It),Jr(It),It.content instanceof d&&Kt(It.content);Ar(oe.afterSanitizeShadowDOM,nt,null)};return e.sanitize=function(Kt){let nt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},It=null,Ut=null,cr=null,vr=null;if(nr=!Kt,nr&&(Kt="<!-->"),typeof Kt!="string"&&!Xr(Kt))if(typeof Kt.toString=="function"){if(Kt=Kt.toString(),typeof Kt!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!e.isSupported)return Kt;if(yt||wr(nt),e.removed=[],typeof Kt=="string"&&(ft=!1),ft){if(Kt.nodeName){const Pr=mr(Kt.nodeName);if(!Ge[Pr]||rt[Pr])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(Kt instanceof g)It=Yr("<!---->"),Ut=It.ownerDocument.importNode(Kt,!0),Ut.nodeType===NODE_TYPE.element&&Ut.nodeName==="BODY"||Ut.nodeName==="HTML"?It=Ut:It.appendChild(Ut);else{if(!qt&&!Ue&&!Je&&Kt.indexOf("<")===-1)return Q&&Ft?Q.createHTML(Kt):Kt;if(It=Yr(Kt),!It)return qt?null:Ft?F:""}It&&Mt&&Rr(It.firstChild);const pr=Zr(ft?Kt:It);for(;cr=pr.nextNode();)an(cr),Jr(cr),cr.content instanceof d&&un(cr.content);if(ft)return Kt;if(qt){if(Ht)for(vr=ne.call(It.ownerDocument);It.firstChild;)vr.appendChild(It.firstChild);else vr=It;return(Ze.shadowroot||Ze.shadowrootmode)&&(vr=ge.call(o,vr,!0)),vr}let _r=Je?It.outerHTML:It.innerHTML;return Je&&Ge["!doctype"]&&It.ownerDocument&&It.ownerDocument.doctype&&It.ownerDocument.doctype.name&®ExpTest(DOCTYPE_NAME,It.ownerDocument.doctype.name)&&(_r="<!DOCTYPE "+It.ownerDocument.doctype.name+`>
|
|
1053
|
-
`+_r),Ue&&arrayForEach([Ae,je,Ne],Pr=>{_r=stringReplace(_r,Pr," ")}),Q&&Ft?Q.createHTML(_r):_r},e.setConfig=function(){let Kt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wr(Kt),yt=!0},e.clearConfig=function(){Ir=null,yt=!1},e.isValidAttribute=function(Kt,nt,It){Ir||wr({});const Ut=mr(Kt),cr=mr(nt);return sn(Ut,cr,It)},e.addHook=function(Kt,nt){typeof nt=="function"&&arrayPush(oe[Kt],nt)},e.removeHook=function(Kt,nt){if(nt!==void 0){const It=arrayLastIndexOf(oe[Kt],nt);return It===-1?void 0:arraySplice(oe[Kt],It,1)[0]}return arrayPop(oe[Kt])},e.removeHooks=function(Kt){oe[Kt]=[]},e.removeAllHooks=function(){oe=_createHooksMap()},e}var purify=createDOMPurify();function markdownToSafeHTML(t){var e=marked(t,{async:!1});return purify.sanitize(e,{ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","b","strong","i","em","u","s","sub","sup","mark","code","pre","blockquote","q","ul","ol","li","dl","dt","dd","p","div","span","br","hr","table","thead","tbody","tfoot","tr","th","td"]})}function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})})]})]})}function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${d}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:parser(markdownToSafeHTML(l.content))})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),I=React__namespace.useRef(!1),M=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),M&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),M&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",sortChats=(t,e)=>t.unread>0&&e.unread===0?-1:e.unread>0&&t.unread===0?1:t.name.localeCompare(e.name),ChatLayout=React.forwardRef(({userId:t,userName:e,inputRef:n,assistantOnly:o,className:l,initialPrompt:d},f)=>{const{data:g,refetch:b}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t},{skip:o===!0}),[_]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[S,{isLoading:R}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[C,E]=React.useState(!1),A=React.useRef(null),I=React.useRef(!1),[M]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[j]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdReadMutation(),[q]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:z,botMessages:Q,clearBotMessages:F,botReady:V,debugMessages:te,botStatus:ne,reset:se}=useAIAssistant({userId:t,smartAndSlow:C});React.useEffect(()=>{const mt={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,messages:[],conversationID:-1};if(o===!0){Ge([mt]);return}if(!g)return;(async()=>{const Wt=g.map(async ur=>{var Tr,gr,xr;const Nr=await q({routeApplicationId:t,conversationId:ur.ConversationId});return{partner1:ur.Participant1,partner2:ur.Participant2,name:((Tr=ur.Participant)==null?void 0:Tr.PublicName)??"missing public name",unread:((gr=Nr.data)==null?void 0:gr.filter(er=>!er.Read&&er.SenderId!=t).length)??0,pending:ur.Status!=="Approved",messages:((xr=Nr.data)==null?void 0:xr.map(er=>({id:"history"+er.MessageId,fromPartnerID:er.SenderId,toPartnerID:er.SenderId==ur.Participant1?ur.Participant2:ur.Participant1,senderName:er.SenderName??"missing name",timestamp:new Date(er.SentDate+"Z").getTime(),content:er.Content??"no content"})))??[],conversationID:ur.ConversationId}}),nr=await Promise.all(Wt);nr.sort(sortChats),Ge([mt,...nr]),setTimeout(()=>{var ur;return(ur=Ue.current)==null?void 0:ur.focus()},50)})()},[g,o,t]);const[ge,oe]=React.useState("approved"),[Ae,je]=React.useState([t,ASSISTANT_ID]),[Ne,Oe]=React.useState(""),[Fe,ze]=React.useState(null),[$e,Be]=React.useState(null),[qe,Ge]=React.useState([]),[He,Ze]=React.useState(""),[tt,Ye]=React.useState(null),rt=React.useRef(null),Xe=React.useRef(null),[it,et]=React.useState(null),[st,ot]=React.useState([]),Ue=n||Xe,Ct=React.useRef(null),{toast:Je}=useToast(),yt=()=>qe.find(mt=>mt.partner1===(Ae==null?void 0:Ae[0])&&mt.partner2===(Ae==null?void 0:Ae[1])),Mt=()=>(Ae==null?void 0:Ae[0])===ASSISTANT_ID||(Ae==null?void 0:Ae[1])===ASSISTANT_ID;function qt(){const mt=yt();mt&&(Mt()||j({routeApplicationId:t,conversationId:mt.conversationID}))}React.useEffect(()=>{d&&V&&(I.current||Mt()&&(I.current=!0,Ke(d)))},[d,V,Ae,I]),React.useEffect(()=>{Fe&&Ae&&(Ke(Fe),ze(null))},[Fe,Ae]);const Ht=React.useMemo(()=>qe.filter(mt=>{if(mt.partner1===ASSISTANT_ID||mt.partner2===ASSISTANT_ID)return!0;const Wt=mt.name.toLowerCase().includes(He.toLowerCase());return ge==="approved"?Wt&&!mt.pending:ge==="pending"?Wt&&mt.pending:Wt}),[qe,He,ge]);React.useEffect(()=>{var mt;it!==null&&(Je({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(mt=Ue.current)==null||mt.focus())},[it]),React.useEffect(()=>{Q.length!==0&&(Q.forEach(mt=>{if(!mt||mt.isComponent)return;const Zt={id:mt.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:mt.timestamp.getTime(),content:mt.content};Ft(Zt)}),F())},[Q]);function Ft(mt){Ge(Zt=>Zt.map(Wt=>{let nr=Wt.partner1===mt.fromPartnerID&&Wt.partner2===mt.toPartnerID;return nr||(nr=Wt.partner1===mt.toPartnerID&&Wt.partner2===mt.fromPartnerID),!nr||Wt.messages.some(ur=>ur.id===mt.id)?Wt:(Be([Wt.partner1,Wt.partner2]),{...Wt,unread:Wt.unread+1,messages:[...Wt.messages,mt]})}).sort(sortChats))}React.useEffect(()=>{if(o===!0)return;const mt=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return mt.on("ReceiveMessage",Ft),mt.start().catch(Zt=>console.error("Error connecting to SignalR hub:",Zt)),Ye(mt),()=>{mt&&mt.stop()}},[t,o]),React.useEffect(()=>{($e==null?void 0:$e[0])!==(Ae==null?void 0:Ae[0])||($e==null?void 0:$e[1])!==(Ae==null?void 0:Ae[1])||(qt(),Ge(mt=>mt.map(Zt=>Zt.partner1===(Ae==null?void 0:Ae[0])&&Zt.partner2===(Ae==null?void 0:Ae[1])?{...Zt,unread:0}:Zt)),setTimeout(()=>{var mt;return(mt=rt.current)==null?void 0:mt.scrollIntoView({behavior:"smooth"})},50))},[$e,Ae]),React.useEffect(()=>{var Zt;if(!Ae)return;const mt=yt();mt&&((Zt=Ue.current)==null||Zt.focus(),mt.unread>0&&(qt(),Ge(Wt=>Wt.map(nr=>nr.partner1===Ae[0]&&nr.partner2===Ae[1]?{...nr,unread:0}:nr))),setTimeout(()=>{var Wt;return(Wt=rt.current)==null?void 0:Wt.scrollIntoView({behavior:"smooth"})},50))},[qe,Ae]);const Ke=mt=>{if(!Ae)return;const Zt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Ae[0]===t?Ae[1]:Ae[0],content:mt+(it?` (${it==null?void 0:it.name} attached)`:""),timestamp:Date.now()};Ge(Wt=>Wt.map(nr=>nr.partner1===Ae[0]&&nr.partner2===Ae[1]?{...nr,messages:[...nr.messages,Zt]}:nr)),Be([Ae[0],Ae[1]]),Zt.toPartnerID==ASSISTANT_ID?(z(Zt.content,it??void 0),it&&ot(Wt=>[...Wt,it.name])):tt.invoke("NewMessage",Zt).catch(Wt=>console.error("Error sending message:",Wt)),Oe(""),et(null),Ct.current&&(Ct.current.value="")},at=(mt,Zt)=>{if(!qe.length||o!==!0&&!tt||!V)return!1;const Wt=qe.find(nr=>nr.conversationID===mt);return Wt?(Wt.pending&&setTimeout(()=>oe("pending"),300),je([Wt.partner1,Wt.partner2]),Zt&&ze(Zt),!0):!1};if(React.useImperativeHandle(f,()=>({setActiveChatAndSendMessage:at})),!V)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})})});const Qe=mt=>{var Wt;if(!Mt())return;const Zt=(Wt=mt.clipboardData)==null?void 0:Wt.items;if(Zt){for(let nr=0;nr<Zt.length;nr++)if(Zt[nr].type.indexOf("image")!==-1){const ur=Zt[nr].getAsFile();if(ur){et(ur);return}}}},ct=()=>{!Ne.trim()||!Ae||o!==!0&&!tt||Ke(Ne)},ft=mt=>{mt.target.files&&mt.target.files[0]?et(mt.target.files[0]):et(null)},dt=()=>{var mt;(mt=Ct.current)==null||mt.click()},Rt=()=>{var mt;et(null),Je({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(mt=Ue.current)==null||mt.focus()},zt=()=>{const Zt={messages:qe.find(Wt=>Wt.partner1===ASSISTANT_ID||Wt.partner2===ASSISTANT_ID),debug:te};_({applicationId:t,emailAddress:e,body:Zt})},Yt=async()=>{A.current&&(A.current.disabled=!0),await M({routeApplicationId:t,partnerId:"2"}),await b()},or=()=>{Ge(mt=>mt.map(Wt=>Wt.partner1!==ASSISTANT_ID&&Wt.partner2!==ASSISTANT_ID?Wt:{...Wt,messages:[]})),ot([]),se()},dr=()=>{Ae&&S({routeApplicationId:t,partnerId:Ae[0]==t?Ae[1]:Ae[0]}).then(()=>{oe("approved")})},pt=yt(),Sr=qe.filter(mt=>mt.pending).length;return jsxRuntime.jsxs("div",{className:cn("flex overflow-hidden",l),children:[o!==!0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),qe.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:He,onChange:mt=>Ze(mt.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:ge,onValueChange:oe,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",Sr>0&&`(${Sr})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:qe.findIndex(mt=>mt.partner1==="2"||mt.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:A,onClick:()=>Yt(),children:"Chat with Randmar"},"b1"):ge==="approved"&&qe.length>=5?null:jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:qe.length>0&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(mt=>mt.partner1!==ASSISTANT_ID&&mt.partner2!==ASSISTANT_ID),activeChat:pt??null,onSelectChat:je})}),jsxRuntime.jsx(Separator$1,{className:"mt-auto"}),jsxRuntime.jsx("div",{className:"pt-1",children:qe.find(mt=>mt.partner1===ASSISTANT_ID||mt.partner2===ASSISTANT_ID)&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(mt=>mt.partner1===ASSISTANT_ID||mt.partner2===ASSISTANT_ID),activeChat:pt??null,onSelectChat:je,assistantStickyMode:!0})})]})}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:Ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:Ae[0]==ASSISTANT_ID||Ae[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!ne,checked:C,onCheckedChange:mt=>{or(),setTimeout(()=>E(mt),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>or(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>zt()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${Ae[0]===t?Ae[1]:Ae[0]}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:pt==null?void 0:pt.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${Ae[0]===t?Ae[1]:Ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),pt!=null&&pt.pending&&pt.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(pt==null?void 0:pt.messages)??[],currentUserId:t,isAssistantChat:Mt(),botStatus:Mt()?ne:""}),jsxRuntime.jsx("div",{ref:rt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(pt==null?void 0:pt.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:R,onClick:()=>dr(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:Ue,placeholder:"Type a message...",value:Ne,onPaste:Qe,onChange:mt=>Oe(mt.target.value),onKeyDown:mt=>{mt.key!=="Enter"||mt.shiftKey||(mt.preventDefault(),ct())},className:pt!=null&&pt.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:pt!=null&&pt.pending?"collapse":"ml-2 h-8 w-8",disabled:!!ne||(pt==null?void 0:pt.pending),onClick:ct,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),Mt()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:ft,className:"hidden",ref:Ct}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:dt,className:pt!=null&&pt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(pt==null?void 0:pt.pending)||!!it,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Rt,className:pt!=null&&pt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(pt==null?void 0:pt.pending)||!it,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{"data-thin":Mt(),className:"w-[480px] flex flex-col border-l flex-4 data-[thin=true]:flex-2",children:Mt()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[it?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",it.name," (pending send...)"]})}):st.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),st.slice().reverse().map(mt=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",mt]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:te})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((Ae==null?void 0:Ae[0])===t?Ae[1]:Ae==null?void 0:Ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}var isCheckBoxInput=t=>t.type==="checkbox",isDateObject=t=>t instanceof Date,isNullOrUndefined=t=>t==null;const isObjectType=t=>typeof t=="object";var isObject=t=>!isNullOrUndefined(t)&&!Array.isArray(t)&&isObjectType(t)&&!isDateObject(t),getEventValue=t=>isObject(t)&&t.target?isCheckBoxInput(t.target)?t.target.checked:t.target.value:t,getNodeParentName=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,isNameInFieldArray=(t,e)=>t.has(getNodeParentName(e)),isPlainObject$1=t=>{const e=t.constructor&&t.constructor.prototype;return isObject(e)&&e.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(t){let e;const n=Array.isArray(t),o=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(isWeb&&(t instanceof Blob||o))&&(n||isObject(t)))if(e=n?[]:{},!n&&!isPlainObject$1(t))e=t;else for(const l in t)t.hasOwnProperty(l)&&(e[l]=cloneObject(t[l]));else return t;return e}var compact=t=>Array.isArray(t)?t.filter(Boolean):[],isUndefined=t=>t===void 0,get=(t,e,n)=>{if(!e||!isObject(t))return n;const o=compact(e.split(/[,[\].]+?/)).reduce((l,d)=>isNullOrUndefined(l)?l:l[d],t);return isUndefined(o)||o===t?isUndefined(t[e])?n:t[e]:o},isBoolean=t=>typeof t=="boolean",isKey=t=>/^\w*$/.test(t),stringToPath=t=>compact(t.replace(/["|']|\]/g,"").split(/\.|\[/)),set=(t,e,n)=>{let o=-1;const l=isKey(e)?[e]:stringToPath(e),d=l.length,f=d-1;for(;++o<d;){const g=l[o];let b=n;if(o!==f){const _=t[g];b=isObject(_)||Array.isArray(_)?_:isNaN(+l[o+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;t[g]=b,t=t[g]}};const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};React.createContext(null);var getProxyFormState=(t,e,n,o=!0)=>{const l={defaultValues:e._defaultValues};for(const d in t)Object.defineProperty(l,d,{get:()=>{const f=d;return e._proxyFormState[f]!==VALIDATION_MODE.all&&(e._proxyFormState[f]=!o||VALIDATION_MODE.all),t[f]}});return l};const useIsomorphicLayoutEffect$1=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect;var isString=t=>typeof t=="string",generateWatchOutput=(t,e,n,o,l)=>isString(t)?(o&&e.watch.add(t),get(n,t,l)):Array.isArray(t)?t.map(d=>(o&&e.watch.add(d),get(n,d))):(o&&(e.watchAll=!0),n),appendErrors=(t,e,n,o,l)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[o]:l||!0}}:{},convertToArrayPayload=t=>Array.isArray(t)?t:[t],createSubject=()=>{let t=[];return{get observers(){return t},next:l=>{for(const d of t)d.next&&d.next(l)},subscribe:l=>(t.push(l),{unsubscribe:()=>{t=t.filter(d=>d!==l)}}),unsubscribe:()=>{t=[]}}},isPrimitive=t=>isNullOrUndefined(t)||!isObjectType(t);function deepEqual$1(t,e){if(isPrimitive(t)||isPrimitive(e))return t===e;if(isDateObject(t)&&isDateObject(e))return t.getTime()===e.getTime();const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const l of n){const d=t[l];if(!o.includes(l))return!1;if(l!=="ref"){const f=e[l];if(isDateObject(d)&&isDateObject(f)||isObject(d)&&isObject(f)||Array.isArray(d)&&Array.isArray(f)?!deepEqual$1(d,f):d!==f)return!1}}return!0}var isEmptyObject$1=t=>isObject(t)&&!Object.keys(t).length,isFileInput=t=>t.type==="file",isFunction$3=t=>typeof t=="function",isHTMLElement=t=>{if(!isWeb)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},isMultipleSelect=t=>t.type==="select-multiple",isRadioInput=t=>t.type==="radio",isRadioOrCheckbox=t=>isRadioInput(t)||isCheckBoxInput(t),live=t=>isHTMLElement(t)&&t.isConnected;function baseGet(t,e){const n=e.slice(0,-1).length;let o=0;for(;o<n;)t=isUndefined(t)?o++:t[e[o++]];return t}function isEmptyArray(t){for(const e in t)if(t.hasOwnProperty(e)&&!isUndefined(t[e]))return!1;return!0}function unset(t,e){const n=Array.isArray(e)?e:isKey(e)?[e]:stringToPath(e),o=n.length===1?t:baseGet(t,n),l=n.length-1,d=n[l];return o&&delete o[d],l!==0&&(isObject(o)&&isEmptyObject$1(o)||Array.isArray(o)&&isEmptyArray(o))&&unset(t,n.slice(0,-1)),t}var objectHasFunction=t=>{for(const e in t)if(isFunction$3(t[e]))return!0;return!1};function markFieldsDirty(t,e={}){const n=Array.isArray(t);if(isObject(t)||n)for(const o in t)Array.isArray(t[o])||isObject(t[o])&&!objectHasFunction(t[o])?(e[o]=Array.isArray(t[o])?[]:{},markFieldsDirty(t[o],e[o])):isNullOrUndefined(t[o])||(e[o]=!0);return e}function getDirtyFieldsFromDefaultValues(t,e,n){const o=Array.isArray(t);if(isObject(t)||o)for(const l in t)Array.isArray(t[l])||isObject(t[l])&&!objectHasFunction(t[l])?isUndefined(e)||isPrimitive(n[l])?n[l]=Array.isArray(t[l])?markFieldsDirty(t[l],[]):{...markFieldsDirty(t[l])}:getDirtyFieldsFromDefaultValues(t[l],isNullOrUndefined(e)?{}:e[l],n[l]):n[l]=!deepEqual$1(t[l],e[l]);return n}var getDirtyFields=(t,e)=>getDirtyFieldsFromDefaultValues(t,e,markFieldsDirty(e));const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!isUndefined(t[0].attributes.value)?isUndefined(t[0].value)||t[0].value===""?validResult:{value:t[0].value,isValid:!0}:validResult:defaultResult}return defaultResult},getFieldValueAs=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:o})=>isUndefined(t)?t:e?t===""?NaN:t&&+t:n&&isString(t)?new Date(t):o?o(t):t;const defaultReturn={isValid:!1,value:null};var getRadioValue=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,defaultReturn):defaultReturn;function getFieldValue(t){const e=t.ref;return isFileInput(e)?e.files:isRadioInput(e)?getRadioValue(t.refs).value:isMultipleSelect(e)?[...e.selectedOptions].map(({value:n})=>n):isCheckBoxInput(e)?getCheckboxValue(t.refs).value:getFieldValueAs(isUndefined(e.value)?t.ref.value:e.value,t)}var getResolverOptions=(t,e,n,o)=>{const l={};for(const d of t){const f=get(e,d);f&&set(l,d,f._f)}return{criteriaMode:n,names:[...t],fields:l,shouldUseNativeValidation:o}},isRegex=t=>t instanceof RegExp,getRuleValue=t=>isUndefined(t)?t:isRegex(t)?t.source:isObject(t)?isRegex(t.value)?t.value.source:t.value:t,getValidationModes=t=>({isOnSubmit:!t||t===VALIDATION_MODE.onSubmit,isOnBlur:t===VALIDATION_MODE.onBlur,isOnChange:t===VALIDATION_MODE.onChange,isOnAll:t===VALIDATION_MODE.all,isOnTouch:t===VALIDATION_MODE.onTouched});const ASYNC_FUNCTION="AsyncFunction";var hasPromiseValidation=t=>!!t&&!!t.validate&&!!(isFunction$3(t.validate)&&t.validate.constructor.name===ASYNC_FUNCTION||isObject(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ASYNC_FUNCTION)),hasValidation=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),isWatched=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(o=>t.startsWith(o)&&/^\.\w+/.test(t.slice(o.length))));const iterateFieldsByAction=(t,e,n,o)=>{for(const l of n||Object.keys(t)){const d=get(t,l);if(d){const{_f:f,...g}=d;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],l)&&!o)return!0;if(f.ref&&e(f.ref,f.name)&&!o)return!0;if(iterateFieldsByAction(g,e))break}else if(isObject(g)&&iterateFieldsByAction(g,e))break}}};function schemaErrorLookup(t,e,n){const o=get(t,n);if(o||isKey(n))return{error:o,name:n};const l=n.split(".");for(;l.length;){const d=l.join("."),f=get(e,d),g=get(t,d);if(f&&!Array.isArray(f)&&n!==d)return{name:n};if(g&&g.type)return{name:d,error:g};if(g&&g.root&&g.root.type)return{name:`${d}.root`,error:g.root};l.pop()}return{name:n}}var shouldRenderFormState=(t,e,n,o)=>{n(t);const{name:l,...d}=t;return isEmptyObject$1(d)||Object.keys(d).length>=Object.keys(e).length||Object.keys(d).find(f=>e[f]===(!o||VALIDATION_MODE.all))},shouldSubscribeByName=(t,e,n)=>!t||!e||t===e||convertToArrayPayload(t).some(o=>o&&(n?o===e:o.startsWith(e)||e.startsWith(o))),skipValidation=(t,e,n,o,l)=>l.isOnAll?!1:!n&&l.isOnTouch?!(e||t):(n?o.isOnBlur:l.isOnBlur)?!t:(n?o.isOnChange:l.isOnChange)?t:!0,unsetEmptyArray=(t,e)=>!compact(get(t,e)).length&&unset(t,e),updateFieldArrayRootError=(t,e,n)=>{const o=convertToArrayPayload(get(t,n));return set(o,"root",e[n]),set(t,n,o),t},isMessage=t=>isString(t);function getValidateError(t,e,n="validate"){if(isMessage(t)||Array.isArray(t)&&t.every(isMessage)||isBoolean(t)&&!t)return{type:n,message:isMessage(t)?t:"",ref:e}}var getValueAndMessage=t=>isObject(t)&&!isRegex(t)?t:{value:t,message:""},validateField=async(t,e,n,o,l,d)=>{const{ref:f,refs:g,required:b,maxLength:_,minLength:S,min:R,max:C,pattern:E,validate:A,name:I,valueAsNumber:M,mount:j}=t._f,q=get(n,I);if(!j||e.has(I))return{};const z=g?g[0]:f,Q=Ae=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(Ae)?"":Ae||""),z.reportValidity())},F={},V=isRadioInput(f),te=isCheckBoxInput(f),ne=V||te,se=(M||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,I,o,F),oe=(Ae,je,Ne,Oe=INPUT_VALIDATION_RULES.maxLength,Fe=INPUT_VALIDATION_RULES.minLength)=>{const ze=Ae?je:Ne;F[I]={type:Ae?Oe:Fe,message:ze,ref:f,...ge(Ae?Oe:Fe,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(se||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||V&&!getRadioValue(g).isValid)){const{value:Ae,message:je}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(Ae&&(F[I]={type:INPUT_VALIDATION_RULES.required,message:je,ref:z,...ge(INPUT_VALIDATION_RULES.required,je)},!o))return Q(je),F}if(!se&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let Ae,je;const Ne=getValueAndMessage(C),Oe=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Fe=f.valueAsNumber||q&&+q;isNullOrUndefined(Ne.value)||(Ae=Fe>Ne.value),isNullOrUndefined(Oe.value)||(je=Fe<Oe.value)}else{const Fe=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),$e=f.type=="time",Be=f.type=="week";isString(Ne.value)&&q&&(Ae=$e?ze(q)>ze(Ne.value):Be?q>Ne.value:Fe>new Date(Ne.value)),isString(Oe.value)&&q&&(je=$e?ze(q)<ze(Oe.value):Be?q<Oe.value:Fe<new Date(Oe.value))}if((Ae||je)&&(oe(!!Ae,Ne.message,Oe.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[I].message),F}if((_||S)&&!se&&(isString(q)||d&&Array.isArray(q))){const Ae=getValueAndMessage(_),je=getValueAndMessage(S),Ne=!isNullOrUndefined(Ae.value)&&q.length>+Ae.value,Oe=!isNullOrUndefined(je.value)&&q.length<+je.value;if((Ne||Oe)&&(oe(Ne,Ae.message,je.message),!o))return Q(F[I].message),F}if(E&&!se&&isString(q)){const{value:Ae,message:je}=getValueAndMessage(E);if(isRegex(Ae)&&!q.match(Ae)&&(F[I]={type:INPUT_VALIDATION_RULES.pattern,message:je,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,je)},!o))return Q(je),F}if(A){if(isFunction$3(A)){const Ae=await A(q,n),je=getValidateError(Ae,z);if(je&&(F[I]={...je,...ge(INPUT_VALIDATION_RULES.validate,je.message)},!o))return Q(je.message),F}else if(isObject(A)){let Ae={};for(const je in A){if(!isEmptyObject$1(Ae)&&!o)break;const Ne=getValidateError(await A[je](q,n),z,je);Ne&&(Ae={...Ne,...ge(je,Ne.message)},Q(Ne.message),o&&(F[I]=Ae))}if(!isEmptyObject$1(Ae)&&(F[I]={ref:z,...Ae},!o))return F}}return Q(!0),F};const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions$1,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$3(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const o={};let l=isObject(e.defaultValues)||isObject(e.values)?cloneObject(e.defaultValues||e.values)||{}:{},d=e.shouldUnregister?{}:cloneObject(l),f={action:!1,mount:!1,watch:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,_=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let R={...S};const C={array:createSubject(),state:createSubject()},E=e.criteriaMode===VALIDATION_MODE.all,A=Ke=>at=>{clearTimeout(_),_=setTimeout(Ke,at)},I=async Ke=>{if(!e.disabled&&(S.isValid||R.isValid||Ke)){const at=e.resolver?isEmptyObject$1((await te()).errors):await se(o,!0);at!==n.isValid&&C.state.next({isValid:at})}},M=(Ke,at)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((Ke||Array.from(g.mount)).forEach(Qe=>{Qe&&(at?set(n.validatingFields,Qe,at):unset(n.validatingFields,Qe))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(Ke,at=[],Qe,ct,ft=!0,dt=!0)=>{if(ct&&Qe&&!e.disabled){if(f.action=!0,dt&&Array.isArray(get(o,Ke))){const Rt=Qe(get(o,Ke),ct.argA,ct.argB);ft&&set(o,Ke,Rt)}if(dt&&Array.isArray(get(n.errors,Ke))){const Rt=Qe(get(n.errors,Ke),ct.argA,ct.argB);ft&&set(n.errors,Ke,Rt),unsetEmptyArray(n.errors,Ke)}if((S.touchedFields||R.touchedFields)&&dt&&Array.isArray(get(n.touchedFields,Ke))){const Rt=Qe(get(n.touchedFields,Ke),ct.argA,ct.argB);ft&&set(n.touchedFields,Ke,Rt)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:Ke,isDirty:oe(Ke,at),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,Ke,at)},q=(Ke,at)=>{set(n.errors,Ke,at),C.state.next({errors:n.errors})},z=Ke=>{n.errors=Ke,C.state.next({errors:n.errors,isValid:!1})},Q=(Ke,at,Qe,ct)=>{const ft=get(o,Ke);if(ft){const dt=get(d,Ke,isUndefined(Qe)?get(l,Ke):Qe);isUndefined(dt)||ct&&ct.defaultChecked||at?set(d,Ke,at?dt:getFieldValue(ft._f)):Ne(Ke,dt),f.mount&&I()}},F=(Ke,at,Qe,ct,ft)=>{let dt=!1,Rt=!1;const zt={name:Ke};if(!e.disabled){if(!Qe||ct){(S.isDirty||R.isDirty)&&(Rt=n.isDirty,n.isDirty=zt.isDirty=oe(),dt=Rt!==zt.isDirty);const Yt=deepEqual$1(get(l,Ke),at);Rt=!!get(n.dirtyFields,Ke),Yt?unset(n.dirtyFields,Ke):set(n.dirtyFields,Ke,!0),zt.dirtyFields=n.dirtyFields,dt=dt||(S.dirtyFields||R.dirtyFields)&&Rt!==!Yt}if(Qe){const Yt=get(n.touchedFields,Ke);Yt||(set(n.touchedFields,Ke,Qe),zt.touchedFields=n.touchedFields,dt=dt||(S.touchedFields||R.touchedFields)&&Yt!==Qe)}dt&&ft&&C.state.next(zt)}return dt?zt:{}},V=(Ke,at,Qe,ct)=>{const ft=get(n.errors,Ke),dt=(S.isValid||R.isValid)&&isBoolean(at)&&n.isValid!==at;if(e.delayError&&Qe?(b=A(()=>q(Ke,Qe)),b(e.delayError)):(clearTimeout(_),b=null,Qe?set(n.errors,Ke,Qe):unset(n.errors,Ke)),(Qe?!deepEqual$1(ft,Qe):ft)||!isEmptyObject$1(ct)||dt){const Rt={...ct,...dt&&isBoolean(at)?{isValid:at}:{},errors:n.errors,name:Ke};n={...n,...Rt},C.state.next(Rt)}},te=async Ke=>{M(Ke,!0);const at=await e.resolver(d,e.context,getResolverOptions(Ke||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return M(Ke),at},ne=async Ke=>{const{errors:at}=await te(Ke);if(Ke)for(const Qe of Ke){const ct=get(at,Qe);ct?set(n.errors,Qe,ct):unset(n.errors,Qe)}else n.errors=at;return at},se=async(Ke,at,Qe={valid:!0})=>{for(const ct in Ke){const ft=Ke[ct];if(ft){const{_f:dt,...Rt}=ft;if(dt){const zt=g.array.has(dt.name),Yt=ft._f&&hasPromiseValidation(ft._f);Yt&&S.validatingFields&&M([ct],!0);const or=await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation&&!at,zt);if(Yt&&S.validatingFields&&M([ct]),or[dt.name]&&(Qe.valid=!1,at))break;!at&&(get(or,dt.name)?zt?updateFieldArrayRootError(n.errors,or,dt.name):set(n.errors,dt.name,or[dt.name]):unset(n.errors,dt.name))}!isEmptyObject$1(Rt)&&await se(Rt,at,Qe)}}return Qe.valid},ge=()=>{for(const Ke of g.unMount){const at=get(o,Ke);at&&(at._f.refs?at._f.refs.every(Qe=>!live(Qe)):!live(at._f.ref))&&Xe(Ke)}g.unMount=new Set},oe=(Ke,at)=>!e.disabled&&(Ke&&at&&set(d,Ke,at),!deepEqual$1(qe(),l)),Ae=(Ke,at,Qe)=>generateWatchOutput(Ke,g,{...f.mount?d:isUndefined(at)?l:isString(Ke)?{[Ke]:at}:at},Qe,at),je=Ke=>compact(get(f.mount?d:l,Ke,e.shouldUnregister?get(l,Ke,[]):[])),Ne=(Ke,at,Qe={})=>{const ct=get(o,Ke);let ft=at;if(ct){const dt=ct._f;dt&&(!dt.disabled&&set(d,Ke,getFieldValueAs(at,dt)),ft=isHTMLElement(dt.ref)&&isNullOrUndefined(at)?"":at,isMultipleSelect(dt.ref)?[...dt.ref.options].forEach(Rt=>Rt.selected=ft.includes(Rt.value)):dt.refs?isCheckBoxInput(dt.ref)?dt.refs.forEach(Rt=>{(!Rt.defaultChecked||!Rt.disabled)&&(Array.isArray(ft)?Rt.checked=!!ft.find(zt=>zt===Rt.value):Rt.checked=ft===Rt.value||!!ft)}):dt.refs.forEach(Rt=>Rt.checked=Rt.value===ft):isFileInput(dt.ref)?dt.ref.value="":(dt.ref.value=ft,dt.ref.type||C.state.next({name:Ke,values:cloneObject(d)})))}(Qe.shouldDirty||Qe.shouldTouch)&&F(Ke,ft,Qe.shouldTouch,Qe.shouldDirty,!0),Qe.shouldValidate&&Be(Ke)},Oe=(Ke,at,Qe)=>{for(const ct in at){if(!at.hasOwnProperty(ct))return;const ft=at[ct],dt=Ke+"."+ct,Rt=get(o,dt);(g.array.has(Ke)||isObject(ft)||Rt&&!Rt._f)&&!isDateObject(ft)?Oe(dt,ft,Qe):Ne(dt,ft,Qe)}},Fe=(Ke,at,Qe={})=>{const ct=get(o,Ke),ft=g.array.has(Ke),dt=cloneObject(at);set(d,Ke,dt),ft?(C.array.next({name:Ke,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&Qe.shouldDirty&&C.state.next({name:Ke,dirtyFields:getDirtyFields(l,d),isDirty:oe(Ke,dt)})):ct&&!ct._f&&!isNullOrUndefined(dt)?Oe(Ke,dt,Qe):Ne(Ke,dt,Qe),isWatched(Ke,g)&&C.state.next({...n}),C.state.next({name:f.mount?Ke:void 0,values:cloneObject(d)})},ze=async Ke=>{f.mount=!0;const at=Ke.target;let Qe=at.name,ct=!0;const ft=get(o,Qe),dt=Yt=>{ct=Number.isNaN(Yt)||isDateObject(Yt)&&isNaN(Yt.getTime())||deepEqual$1(Yt,get(d,Qe,Yt))},Rt=getValidationModes(e.mode),zt=getValidationModes(e.reValidateMode);if(ft){let Yt,or;const dr=at.type?getFieldValue(ft._f):getEventValue(Ke),pt=Ke.type===EVENTS.BLUR||Ke.type===EVENTS.FOCUS_OUT,Sr=!hasValidation(ft._f)&&!e.resolver&&!get(n.errors,Qe)&&!ft._f.deps||skipValidation(pt,get(n.touchedFields,Qe),n.isSubmitted,zt,Rt),mt=isWatched(Qe,g,pt);set(d,Qe,dr),pt?(ft._f.onBlur&&ft._f.onBlur(Ke),b&&b(0)):ft._f.onChange&&ft._f.onChange(Ke);const Zt=F(Qe,dr,pt),Wt=!isEmptyObject$1(Zt)||mt;if(!pt&&C.state.next({name:Qe,type:Ke.type,values:cloneObject(d)}),Sr)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?pt&&I():pt||I()),Wt&&C.state.next({name:Qe,...mt?{}:Zt});if(!pt&&mt&&C.state.next({...n}),e.resolver){const{errors:nr}=await te([Qe]);if(dt(dr),ct){const ur=schemaErrorLookup(n.errors,o,Qe),Nr=schemaErrorLookup(nr,o,ur.name||Qe);Yt=Nr.error,Qe=Nr.name,or=isEmptyObject$1(nr)}}else M([Qe],!0),Yt=(await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation))[Qe],M([Qe]),dt(dr),ct&&(Yt?or=!1:(S.isValid||R.isValid)&&(or=await se(o,!0)));ct&&(ft._f.deps&&Be(ft._f.deps),V(Qe,or,Yt,Zt))}},$e=(Ke,at)=>{if(get(n.errors,at)&&Ke.focus)return Ke.focus(),1},Be=async(Ke,at={})=>{let Qe,ct;const ft=convertToArrayPayload(Ke);if(e.resolver){const dt=await ne(isUndefined(Ke)?Ke:ft);Qe=isEmptyObject$1(dt),ct=Ke?!ft.some(Rt=>get(dt,Rt)):Qe}else Ke?(ct=(await Promise.all(ft.map(async dt=>{const Rt=get(o,dt);return await se(Rt&&Rt._f?{[dt]:Rt}:Rt)}))).every(Boolean),!(!ct&&!n.isValid)&&I()):ct=Qe=await se(o);return C.state.next({...!isString(Ke)||(S.isValid||R.isValid)&&Qe!==n.isValid?{}:{name:Ke},...e.resolver||!Ke?{isValid:Qe}:{},errors:n.errors}),at.shouldFocus&&!ct&&iterateFieldsByAction(o,$e,Ke?ft:g.mount),ct},qe=Ke=>{const at={...f.mount?d:l};return isUndefined(Ke)?at:isString(Ke)?get(at,Ke):Ke.map(Qe=>get(at,Qe))},Ge=(Ke,at)=>({invalid:!!get((at||n).errors,Ke),isDirty:!!get((at||n).dirtyFields,Ke),error:get((at||n).errors,Ke),isValidating:!!get(n.validatingFields,Ke),isTouched:!!get((at||n).touchedFields,Ke)}),He=Ke=>{Ke&&convertToArrayPayload(Ke).forEach(at=>unset(n.errors,at)),C.state.next({errors:Ke?n.errors:{}})},Ze=(Ke,at,Qe)=>{const ct=(get(o,Ke,{_f:{}})._f||{}).ref,ft=get(n.errors,Ke)||{},{ref:dt,message:Rt,type:zt,...Yt}=ft;set(n.errors,Ke,{...Yt,...at,ref:ct}),C.state.next({name:Ke,errors:n.errors,isValid:!1}),Qe&&Qe.shouldFocus&&ct&&ct.focus&&ct.focus()},tt=(Ke,at)=>isFunction$3(Ke)?C.state.subscribe({next:Qe=>Ke(Ae(void 0,at),Qe)}):Ae(Ke,at,!0),Ye=Ke=>C.state.subscribe({next:at=>{shouldSubscribeByName(Ke.name,at.name,Ke.exact)&&shouldRenderFormState(at,Ke.formState||S,qt,Ke.reRenderRoot)&&Ke.callback({values:{...d},...n,...at})}}).unsubscribe,rt=Ke=>(f.mount=!0,R={...R,...Ke.formState},Ye({...Ke,formState:R})),Xe=(Ke,at={})=>{for(const Qe of Ke?convertToArrayPayload(Ke):g.mount)g.mount.delete(Qe),g.array.delete(Qe),at.keepValue||(unset(o,Qe),unset(d,Qe)),!at.keepError&&unset(n.errors,Qe),!at.keepDirty&&unset(n.dirtyFields,Qe),!at.keepTouched&&unset(n.touchedFields,Qe),!at.keepIsValidating&&unset(n.validatingFields,Qe),!e.shouldUnregister&&!at.keepDefaultValue&&unset(l,Qe);C.state.next({values:cloneObject(d)}),C.state.next({...n,...at.keepDirty?{isDirty:oe()}:{}}),!at.keepIsValid&&I()},it=({disabled:Ke,name:at})=>{(isBoolean(Ke)&&f.mount||Ke||g.disabled.has(at))&&(Ke?g.disabled.add(at):g.disabled.delete(at))},et=(Ke,at={})=>{let Qe=get(o,Ke);const ct=isBoolean(at.disabled)||isBoolean(e.disabled);return set(o,Ke,{...Qe||{},_f:{...Qe&&Qe._f?Qe._f:{ref:{name:Ke}},name:Ke,mount:!0,...at}}),g.mount.add(Ke),Qe?it({disabled:isBoolean(at.disabled)?at.disabled:e.disabled,name:Ke}):Q(Ke,!0,at.value),{...ct?{disabled:at.disabled||e.disabled}:{},...e.progressive?{required:!!at.required,min:getRuleValue(at.min),max:getRuleValue(at.max),minLength:getRuleValue(at.minLength),maxLength:getRuleValue(at.maxLength),pattern:getRuleValue(at.pattern)}:{},name:Ke,onChange:ze,onBlur:ze,ref:ft=>{if(ft){et(Ke,at),Qe=get(o,Ke);const dt=isUndefined(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,Rt=isRadioOrCheckbox(dt),zt=Qe._f.refs||[];if(Rt?zt.find(Yt=>Yt===dt):dt===Qe._f.ref)return;set(o,Ke,{_f:{...Qe._f,...Rt?{refs:[...zt.filter(live),dt,...Array.isArray(get(l,Ke))?[{}]:[]],ref:{type:dt.type,name:Ke}}:{ref:dt}}}),Q(Ke,!1,void 0,dt)}else Qe=get(o,Ke,{}),Qe._f&&(Qe._f.mount=!1),(e.shouldUnregister||at.shouldUnregister)&&!(isNameInFieldArray(g.array,Ke)&&f.action)&&g.unMount.add(Ke)}}},st=()=>e.shouldFocusError&&iterateFieldsByAction(o,$e,g.mount),ot=Ke=>{isBoolean(Ke)&&(C.state.next({disabled:Ke}),iterateFieldsByAction(o,(at,Qe)=>{const ct=get(o,Qe);ct&&(at.disabled=ct._f.disabled||Ke,Array.isArray(ct._f.refs)&&ct._f.refs.forEach(ft=>{ft.disabled=ct._f.disabled||Ke}))},0,!1))},Ue=(Ke,at)=>async Qe=>{let ct;Qe&&(Qe.preventDefault&&Qe.preventDefault(),Qe.persist&&Qe.persist());let ft=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:dt,values:Rt}=await te();n.errors=dt,ft=Rt}else await se(o);if(g.disabled.size)for(const dt of g.disabled)set(ft,dt,void 0);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await Ke(ft,Qe)}catch(dt){ct=dt}}else at&&await at({...n.errors},Qe),st(),setTimeout(st);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!ct,submitCount:n.submitCount+1,errors:n.errors}),ct)throw ct},Ct=(Ke,at={})=>{get(o,Ke)&&(isUndefined(at.defaultValue)?Fe(Ke,cloneObject(get(l,Ke))):(Fe(Ke,at.defaultValue),set(l,Ke,cloneObject(at.defaultValue))),at.keepTouched||unset(n.touchedFields,Ke),at.keepDirty||(unset(n.dirtyFields,Ke),n.isDirty=at.defaultValue?oe(Ke,cloneObject(get(l,Ke))):oe()),at.keepError||(unset(n.errors,Ke),S.isValid&&I()),C.state.next({...n}))},Je=(Ke,at={})=>{const Qe=Ke?cloneObject(Ke):l,ct=cloneObject(Qe),ft=isEmptyObject$1(Ke),dt=ft?l:ct;if(at.keepDefaultValues||(l=Qe),!at.keepValues){if(at.keepDirtyValues){const Rt=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const zt of Array.from(Rt))get(n.dirtyFields,zt)?set(dt,zt,get(d,zt)):Fe(zt,get(dt,zt))}else{if(isWeb&&isUndefined(Ke))for(const Rt of g.mount){const zt=get(o,Rt);if(zt&&zt._f){const Yt=Array.isArray(zt._f.refs)?zt._f.refs[0]:zt._f.ref;if(isHTMLElement(Yt)){const or=Yt.closest("form");if(or){or.reset();break}}}}for(const Rt of g.mount)Fe(Rt,get(dt,Rt))}d=cloneObject(dt),C.array.next({values:{...dt}}),C.state.next({values:{...dt}})}g={mount:at.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!at.keepIsValid||!!at.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:at.keepSubmitCount?n.submitCount:0,isDirty:ft?!1:at.keepDirty?n.isDirty:!!(at.keepDefaultValues&&!deepEqual$1(Ke,l)),isSubmitted:at.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ft?{}:at.keepDirtyValues?at.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:at.keepDefaultValues&&Ke?getDirtyFields(l,Ke):at.keepDirty?n.dirtyFields:{},touchedFields:at.keepTouched?n.touchedFields:{},errors:at.keepErrors?n.errors:{},isSubmitSuccessful:at.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},yt=(Ke,at)=>Je(isFunction$3(Ke)?Ke(d):Ke,at),Mt=(Ke,at={})=>{const Qe=get(o,Ke),ct=Qe&&Qe._f;if(ct){const ft=ct.refs?ct.refs[0]:ct.ref;ft.focus&&(ft.focus(),at.shouldSelect&&isFunction$3(ft.select)&&ft.select())}},qt=Ke=>{n={...n,...Ke}},Ft={control:{register:et,unregister:Xe,getFieldState:Ge,handleSubmit:Ue,setError:Ze,_subscribe:Ye,_runSchema:te,_focusError:st,_getWatch:Ae,_getDirty:oe,_setValid:I,_setFieldArray:j,_setDisabledField:it,_setErrors:z,_getFieldArray:je,_reset:Je,_resetDefaultValues:()=>isFunction$3(e.defaultValues)&&e.defaultValues().then(Ke=>{yt(Ke,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:ot,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(Ke){f=Ke},get _defaultValues(){return l},get _names(){return g},set _names(Ke){g=Ke},get _formState(){return n},get _options(){return e},set _options(Ke){e={...e,...Ke}}},subscribe:rt,trigger:Be,register:et,handleSubmit:Ue,watch:tt,setValue:Fe,getValues:qe,reset:yt,resetField:Ct,clearErrors:He,unregister:Xe,setError:Ze,setFocus:Mt,getFieldState:Ge};return{...Ft,formControl:Ft}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$3(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:isFunction$3(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:createFormControl(t),formState:o},t.formControl&&t.defaultValues&&!isFunction$3(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const d=e.current.control;return d._options=t,useIsomorphicLayoutEffect$1(()=>{const f=d._subscribe({formState:d._proxyFormState,callback:()=>l({...d._formState}),reRenderRoot:!0});return l(g=>({...g,isReady:!0})),d._formState.isReady=!0,f},[d]),React.useEffect(()=>d._disableForm(t.disabled),[d,t.disabled]),React.useEffect(()=>{t.mode&&(d._options.mode=t.mode),t.reValidateMode&&(d._options.reValidateMode=t.reValidateMode)},[d,t.mode,t.reValidateMode]),React.useEffect(()=>{t.errors&&(d._setErrors(t.errors),d._focusError())},[d,t.errors]),React.useEffect(()=>{t.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,t.shouldUnregister]),React.useEffect(()=>{if(d._proxyFormState.isDirty){const f=d._getDirty();f!==o.isDirty&&d._subjects.state.next({isDirty:f})}},[d,o.isDirty]),React.useEffect(()=>{t.values&&!deepEqual$1(t.values,n.current)?(d._reset(t.values,d._options.resetOptions),n.current=t.values,l(f=>({...f}))):d._resetDefaultValues()},[d,t.values]),React.useEffect(()=>{d._state.mount||(d._setValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),e.current.formState=getProxyFormState(o,d),e.current}var defaultErrorHandler=function(t){process.env.NODE_ENV!=="production"&&console.error(t)},defaultWarnHandler=function(t){process.env.NODE_ENV!=="production"&&console.warn(t)},DEFAULT_INTL_CONFIG={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:defaultErrorHandler,onWarn:defaultWarnHandler};function invariant(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}function invariantIntlContext(t){invariant(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}__assign$1(__assign$1({},DEFAULT_INTL_CONFIG),{textComponent:React__namespace.Fragment});var reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
|
|
1050
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${escape2(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const o=this.parser.parseInline(n),l=cleanUrl(t);if(l===null)return o;t=l;let d='<a href="'+t+'"';return e&&(d+=' title="'+escape2(e)+'"'),d+=">"+o+"</a>",d}image({href:t,title:e,text:n,tokens:o}){o&&(n=this.parser.parseInline(o,this.parser.textRenderer));const l=cleanUrl(t);if(l===null)return escape2(n);t=l;let d=`<img src="${t}" alt="${n}"`;return e&&(d+=` title="${escape2(e)}"`),d+=">",d}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:escape2(t.text)}},_TextRenderer=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},_Parser=class vn{constructor(e){Qt(this,"options");Qt(this,"renderer");Qt(this,"textRenderer");this.options=e||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,n){return new vn(n).parse(e)}static parseInline(e,n){return new vn(n).parseInline(e)}parse(e,n=!0){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=g,S=this.options.extensions.renderers[_.type].call({parser:this},_);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(_.type)){o+=S||"";continue}}const b=g;switch(b.type){case"space":{o+=this.renderer.space(b);continue}case"hr":{o+=this.renderer.hr(b);continue}case"heading":{o+=this.renderer.heading(b);continue}case"code":{o+=this.renderer.code(b);continue}case"table":{o+=this.renderer.table(b);continue}case"blockquote":{o+=this.renderer.blockquote(b);continue}case"list":{o+=this.renderer.list(b);continue}case"html":{o+=this.renderer.html(b);continue}case"paragraph":{o+=this.renderer.paragraph(b);continue}case"text":{let _=b,S=this.renderer.text(_);for(;f+1<e.length&&e[f+1].type==="text";)_=e[++f],S+=`
|
|
1051
|
+
`+this.renderer.text(_);n?o+=this.renderer.paragraph({type:"paragraph",raw:S,text:S,tokens:[{type:"text",raw:S,text:S,escaped:!0}]}):o+=S;continue}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}parseInline(e,n=this.renderer){var l,d;let o="";for(let f=0;f<e.length;f++){const g=e[f];if((d=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&d[g.type]){const _=this.options.extensions.renderers[g.type].call({parser:this},g);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){o+=_||"";continue}}const b=g;switch(b.type){case"escape":{o+=n.text(b);break}case"html":{o+=n.html(b);break}case"link":{o+=n.link(b);break}case"image":{o+=n.image(b);break}case"strong":{o+=n.strong(b);break}case"em":{o+=n.em(b);break}case"codespan":{o+=n.codespan(b);break}case"br":{o+=n.br(b);break}case"del":{o+=n.del(b);break}case"text":{o+=n.text(b);break}default:{const _='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return o}},_Hooks=(sr=class{constructor(t){Qt(this,"options");Qt(this,"block");this.options=t||_defaults}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?_Lexer.lex:_Lexer.lexInline}provideParser(){return this.block?_Parser.parse:_Parser.parseInline}},Qt(sr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),sr),Marked=class{constructor(...t){Qt(this,"defaults",_getDefaults());Qt(this,"options",this.setOptions);Qt(this,"parse",this.parseMarkdown(!0));Qt(this,"parseInline",this.parseMarkdown(!1));Qt(this,"Parser",_Parser);Qt(this,"Renderer",_Renderer);Qt(this,"TextRenderer",_TextRenderer);Qt(this,"Lexer",_Lexer);Qt(this,"Tokenizer",_Tokenizer);Qt(this,"Hooks",_Hooks);this.use(...t)}walkTokens(t,e){var o,l;let n=[];for(const d of t)switch(n=n.concat(e.call(this,d)),d.type){case"table":{const f=d;for(const g of f.header)n=n.concat(this.walkTokens(g.tokens,e));for(const g of f.rows)for(const b of g)n=n.concat(this.walkTokens(b.tokens,e));break}case"list":{const f=d;n=n.concat(this.walkTokens(f.items,e));break}default:{const f=d;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[f.type]?this.defaults.extensions.childTokens[f.type].forEach(g=>{const b=f[g].flat(1/0);n=n.concat(this.walkTokens(b,e))}):f.tokens&&(n=n.concat(this.walkTokens(f.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const o={...n};if(o.async=this.defaults.async||o.async||!1,n.extensions&&(n.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const d=e.renderers[l.name];d?e.renderers[l.name]=function(...f){let g=l.renderer.apply(this,f);return g===!1&&(g=d.apply(this,f)),g}:e.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const d=e[l.level];d?d.unshift(l.tokenizer):e[l.level]=[l.tokenizer],l.start&&(l.level==="block"?e.startBlock?e.startBlock.push(l.start):e.startBlock=[l.start]:l.level==="inline"&&(e.startInline?e.startInline.push(l.start):e.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(e.childTokens[l.name]=l.childTokens)}),o.extensions=e),n.renderer){const l=this.defaults.renderer||new _Renderer(this.defaults);for(const d in n.renderer){if(!(d in l))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;const f=d,g=n.renderer[f],b=l[f];l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S||""}}o.renderer=l}if(n.tokenizer){const l=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const d in n.tokenizer){if(!(d in l))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;const f=d,g=n.tokenizer[f],b=l[f];l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S}}o.tokenizer=l}if(n.hooks){const l=this.defaults.hooks||new _Hooks;for(const d in n.hooks){if(!(d in l))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;const f=d,g=n.hooks[f],b=l[f];_Hooks.passThroughHooks.has(d)?l[f]=_=>{if(this.defaults.async)return Promise.resolve(g.call(l,_)).then(R=>b.call(l,R));const S=g.call(l,_);return b.call(l,S)}:l[f]=(..._)=>{let S=g.apply(l,_);return S===!1&&(S=b.apply(l,_)),S}}o.hooks=l}if(n.walkTokens){const l=this.defaults.walkTokens,d=n.walkTokens;o.walkTokens=function(f){let g=[];return g.push(d.call(this,f)),l&&(g=g.concat(l.call(this,f))),g}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return _Lexer.lex(t,e??this.defaults)}parser(t,e){return _Parser.parse(t,e??this.defaults)}parseMarkdown(t){return(n,o)=>{const l={...o},d={...this.defaults,...l},f=this.onError(!!d.silent,!!d.async);if(this.defaults.async===!0&&l.async===!1)return f(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));d.hooks&&(d.hooks.options=d,d.hooks.block=t);const g=d.hooks?d.hooks.provideLexer():t?_Lexer.lex:_Lexer.lexInline,b=d.hooks?d.hooks.provideParser():t?_Parser.parse:_Parser.parseInline;if(d.async)return Promise.resolve(d.hooks?d.hooks.preprocess(n):n).then(_=>g(_,d)).then(_=>d.hooks?d.hooks.processAllTokens(_):_).then(_=>d.walkTokens?Promise.all(this.walkTokens(_,d.walkTokens)).then(()=>_):_).then(_=>b(_,d)).then(_=>d.hooks?d.hooks.postprocess(_):_).catch(f);try{d.hooks&&(n=d.hooks.preprocess(n));let _=g(n,d);d.hooks&&(_=d.hooks.processAllTokens(_)),d.walkTokens&&this.walkTokens(_,d.walkTokens);let S=b(_,d);return d.hooks&&(S=d.hooks.postprocess(S)),S}catch(_){return f(_)}}}onError(t,e){return n=>{if(n.message+=`
|
|
1052
|
+
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+escape2(n.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(n);throw n}}},markedInstance=new Marked;function marked(t,e){return markedInstance.parse(t,e)}marked.options=marked.setOptions=function(t){return markedInstance.setOptions(t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...t){return markedInstance.use(...t),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(t,e){return markedInstance.walkTokens(t,e)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply:apply$1,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=function(e){return e}),seal||(seal=function(e){return e}),apply$1||(apply$1=function(e,n,o){return e.apply(n,o)}),construct||(construct=function(e,n){return new e(...n)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),l=1;l<n;l++)o[l-1]=arguments[l];return apply$1(t,e,o)}}function unconstruct(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return construct(t,n)}}function addToSet(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(t,null);let o=e.length;for(;o--;){let l=e[o];if(typeof l=="string"){const d=n(l);d!==l&&(isFrozen(e)||(e[o]=d),l=d)}t[l]=!0}return t}function cleanArray(t){for(let e=0;e<t.length;e++)objectHasOwnProperty(t,e)||(t[e]=null);return t}function clone(t){const e=create(null);for(const[n,o]of entries(t))objectHasOwnProperty(t,n)&&(Array.isArray(o)?e[n]=cleanArray(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=clone(o):e[n]=o);return e}function lookupGetter(t,e){for(;t!==null;){const o=getOwnPropertyDescriptor(t,e);if(o){if(o.get)return unapply(o.get);if(typeof o.value=="function")return unapply(o.value)}t=getPrototypeOf(t)}function n(){return null}return n}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text$1=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=function t(){return typeof window>"u"?null:window},_createTrustedTypesPolicy=function t(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";n&&n.hasAttribute(l)&&(o=n.getAttribute(l));const d="dompurify"+(o?"#"+o:"");try{return e.createPolicy(d,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},_createHooksMap=function t(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function createDOMPurify(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const e=Kt=>createDOMPurify(Kt);if(e.version="3.2.6",e.removed=[],!t||!t.document||t.document.nodeType!==NODE_TYPE.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,l=o.currentScript,{DocumentFragment:d,HTMLTemplateElement:f,Node:g,Element:b,NodeFilter:_,NamedNodeMap:S=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:R,DOMParser:C,trustedTypes:E}=t,A=b.prototype,I=lookupGetter(A,"cloneNode"),M=lookupGetter(A,"remove"),j=lookupGetter(A,"nextSibling"),q=lookupGetter(A,"childNodes"),z=lookupGetter(A,"parentNode");if(typeof f=="function"){const Kt=n.createElement("template");Kt.content&&Kt.content.ownerDocument&&(n=Kt.content.ownerDocument)}let Q,F="";const{implementation:V,createNodeIterator:te,createDocumentFragment:ne,getElementsByTagName:se}=n,{importNode:ge}=o;let oe=_createHooksMap();e.isSupported=typeof entries=="function"&&typeof z=="function"&&V&&V.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ae,ERB_EXPR:je,TMPLIT_EXPR:Ne,DATA_ATTR:Oe,ARIA_ATTR:Fe,IS_SCRIPT_OR_DATA:ze,ATTR_WHITESPACE:$e,CUSTOM_ELEMENT:Be}=EXPRESSIONS;let{IS_ALLOWED_URI:qe}=EXPRESSIONS,Ge=null;const He=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text$1]);let Ze=null;const tt=addToSet({},[...html,...svg,...mathMl,...xml]);let Ye=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),rt=null,Xe=null,it=!0,et=!0,st=!1,ot=!0,Ue=!1,Ct=!0,Je=!1,yt=!1,Mt=!1,qt=!1,Ht=!1,Ft=!1,Ke=!0,at=!1;const Qe="user-content-";let ct=!0,ft=!1,dt={},Rt=null;const zt=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Yt=null;const or=addToSet({},["audio","video","img","source","image","track"]);let dr=null;const pt=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sr="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml";let Wt=Zt,ir=!1,ur=null;const jr=addToSet({},[Sr,mt,Zt],stringToString);let wr=addToSet({},["mi","mo","mn","ms","mtext"]),gr=addToSet({},["annotation-xml"]);const xr=addToSet({},["title","style","font","a","script"]);let tr=null;const $r=["application/xhtml+xml","text/html"],Xt="text/html";let mr=null,Mr=null;const gn=n.createElement("form"),Lr=function(nt){return nt instanceof RegExp||nt instanceof Function},Er=function(){let nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Mr&&Mr===nt)){if((!nt||typeof nt!="object")&&(nt={}),nt=clone(nt),tr=$r.indexOf(nt.PARSER_MEDIA_TYPE)===-1?Xt:nt.PARSER_MEDIA_TYPE,mr=tr==="application/xhtml+xml"?stringToString:stringToLowerCase,Ge=objectHasOwnProperty(nt,"ALLOWED_TAGS")?addToSet({},nt.ALLOWED_TAGS,mr):He,Ze=objectHasOwnProperty(nt,"ALLOWED_ATTR")?addToSet({},nt.ALLOWED_ATTR,mr):tt,ur=objectHasOwnProperty(nt,"ALLOWED_NAMESPACES")?addToSet({},nt.ALLOWED_NAMESPACES,stringToString):jr,dr=objectHasOwnProperty(nt,"ADD_URI_SAFE_ATTR")?addToSet(clone(pt),nt.ADD_URI_SAFE_ATTR,mr):pt,Yt=objectHasOwnProperty(nt,"ADD_DATA_URI_TAGS")?addToSet(clone(or),nt.ADD_DATA_URI_TAGS,mr):or,Rt=objectHasOwnProperty(nt,"FORBID_CONTENTS")?addToSet({},nt.FORBID_CONTENTS,mr):zt,rt=objectHasOwnProperty(nt,"FORBID_TAGS")?addToSet({},nt.FORBID_TAGS,mr):clone({}),Xe=objectHasOwnProperty(nt,"FORBID_ATTR")?addToSet({},nt.FORBID_ATTR,mr):clone({}),dt=objectHasOwnProperty(nt,"USE_PROFILES")?nt.USE_PROFILES:!1,it=nt.ALLOW_ARIA_ATTR!==!1,et=nt.ALLOW_DATA_ATTR!==!1,st=nt.ALLOW_UNKNOWN_PROTOCOLS||!1,ot=nt.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ue=nt.SAFE_FOR_TEMPLATES||!1,Ct=nt.SAFE_FOR_XML!==!1,Je=nt.WHOLE_DOCUMENT||!1,qt=nt.RETURN_DOM||!1,Ht=nt.RETURN_DOM_FRAGMENT||!1,Ft=nt.RETURN_TRUSTED_TYPE||!1,Mt=nt.FORCE_BODY||!1,Ke=nt.SANITIZE_DOM!==!1,at=nt.SANITIZE_NAMED_PROPS||!1,ct=nt.KEEP_CONTENT!==!1,ft=nt.IN_PLACE||!1,qe=nt.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,Wt=nt.NAMESPACE||Zt,wr=nt.MATHML_TEXT_INTEGRATION_POINTS||wr,gr=nt.HTML_INTEGRATION_POINTS||gr,Ye=nt.CUSTOM_ELEMENT_HANDLING||{},nt.CUSTOM_ELEMENT_HANDLING&&Lr(nt.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ye.tagNameCheck=nt.CUSTOM_ELEMENT_HANDLING.tagNameCheck),nt.CUSTOM_ELEMENT_HANDLING&&Lr(nt.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ye.attributeNameCheck=nt.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),nt.CUSTOM_ELEMENT_HANDLING&&typeof nt.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=nt.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ue&&(et=!1),Ht&&(qt=!0),dt&&(Ge=addToSet({},text$1),Ze=[],dt.html===!0&&(addToSet(Ge,html$1),addToSet(Ze,html)),dt.svg===!0&&(addToSet(Ge,svg$1),addToSet(Ze,svg),addToSet(Ze,xml)),dt.svgFilters===!0&&(addToSet(Ge,svgFilters),addToSet(Ze,svg),addToSet(Ze,xml)),dt.mathMl===!0&&(addToSet(Ge,mathMl$1),addToSet(Ze,mathMl),addToSet(Ze,xml))),nt.ADD_TAGS&&(Ge===He&&(Ge=clone(Ge)),addToSet(Ge,nt.ADD_TAGS,mr)),nt.ADD_ATTR&&(Ze===tt&&(Ze=clone(Ze)),addToSet(Ze,nt.ADD_ATTR,mr)),nt.ADD_URI_SAFE_ATTR&&addToSet(dr,nt.ADD_URI_SAFE_ATTR,mr),nt.FORBID_CONTENTS&&(Rt===zt&&(Rt=clone(Rt)),addToSet(Rt,nt.FORBID_CONTENTS,mr)),ct&&(Ge["#text"]=!0),Je&&addToSet(Ge,["html","head","body"]),Ge.table&&(addToSet(Ge,["tbody"]),delete rt.tbody),nt.TRUSTED_TYPES_POLICY){if(typeof nt.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof nt.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Q=nt.TRUSTED_TYPES_POLICY,F=Q.createHTML("")}else Q===void 0&&(Q=_createTrustedTypesPolicy(E,l)),Q!==null&&typeof F=="string"&&(F=Q.createHTML(""));freeze&&freeze(nt),Mr=nt}},sn=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),Dr=addToSet({},[...mathMl$1,...mathMlDisallowed]),Fr=function(nt){let It=z(nt);(!It||!It.tagName)&&(It={namespaceURI:Wt,tagName:"template"});const Ut=stringToLowerCase(nt.tagName),cr=stringToLowerCase(It.tagName);return ur[nt.namespaceURI]?nt.namespaceURI===mt?It.namespaceURI===Zt?Ut==="svg":It.namespaceURI===Sr?Ut==="svg"&&(cr==="annotation-xml"||wr[cr]):!!sn[Ut]:nt.namespaceURI===Sr?It.namespaceURI===Zt?Ut==="math":It.namespaceURI===mt?Ut==="math"&&gr[cr]:!!Dr[Ut]:nt.namespaceURI===Zt?It.namespaceURI===mt&&!gr[cr]||It.namespaceURI===Sr&&!wr[cr]?!1:!Dr[Ut]&&(xr[Ut]||!sn[Ut]):!!(tr==="application/xhtml+xml"&&ur[nt.namespaceURI]):!1},Rr=function(nt){arrayPush(e.removed,{element:nt});try{z(nt).removeChild(nt)}catch{M(nt)}},Or=function(nt,It){try{arrayPush(e.removed,{attribute:It.getAttributeNode(nt),from:It})}catch{arrayPush(e.removed,{attribute:null,from:It})}if(It.removeAttribute(nt),nt==="is")if(qt||Ht)try{Rr(It)}catch{}else try{It.setAttribute(nt,"")}catch{}},Xr=function(nt){let It=null,Ut=null;if(Mt)nt="<remove></remove>"+nt;else{const pr=stringMatch(nt,/^[\r\n\t ]+/);Ut=pr&&pr[0]}tr==="application/xhtml+xml"&&Wt===Zt&&(nt='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+nt+"</body></html>");const cr=Q?Q.createHTML(nt):nt;if(Wt===Zt)try{It=new C().parseFromString(cr,tr)}catch{}if(!It||!It.documentElement){It=V.createDocument(Wt,"template",null);try{It.documentElement.innerHTML=ir?F:cr}catch{}}const vr=It.body||It.documentElement;return nt&&Ut&&vr.insertBefore(n.createTextNode(Ut),vr.childNodes[0]||null),Wt===Zt?se.call(It,Je?"html":"body")[0]:Je?It.documentElement:vr},Jr=function(nt){return te.call(nt.ownerDocument||nt,nt,_.SHOW_ELEMENT|_.SHOW_COMMENT|_.SHOW_TEXT|_.SHOW_PROCESSING_INSTRUCTION|_.SHOW_CDATA_SECTION,null)},Gr=function(nt){return nt instanceof R&&(typeof nt.nodeName!="string"||typeof nt.textContent!="string"||typeof nt.removeChild!="function"||!(nt.attributes instanceof S)||typeof nt.removeAttribute!="function"||typeof nt.setAttribute!="function"||typeof nt.namespaceURI!="string"||typeof nt.insertBefore!="function"||typeof nt.hasChildNodes!="function")},Qr=function(nt){return typeof g=="function"&&nt instanceof g};function Ir(Kt,nt,It){arrayForEach(Kt,Ut=>{Ut.call(e,nt,It,Mr)})}const on=function(nt){let It=null;if(Ir(oe.beforeSanitizeElements,nt,null),Gr(nt))return Rr(nt),!0;const Ut=mr(nt.nodeName);if(Ir(oe.uponSanitizeElement,nt,{tagName:Ut,allowedTags:Ge}),Ct&&nt.hasChildNodes()&&!Qr(nt.firstElementChild)&®ExpTest(/<[/\w!]/g,nt.innerHTML)&®ExpTest(/<[/\w!]/g,nt.textContent)||nt.nodeType===NODE_TYPE.progressingInstruction||Ct&&nt.nodeType===NODE_TYPE.comment&®ExpTest(/<[/\w]/g,nt.data))return Rr(nt),!0;if(!Ge[Ut]||rt[Ut]){if(!rt[Ut]&&dn(Ut)&&(Ye.tagNameCheck instanceof RegExp&®ExpTest(Ye.tagNameCheck,Ut)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(Ut)))return!1;if(ct&&!Rt[Ut]){const cr=z(nt)||nt.parentNode,vr=q(nt)||nt.childNodes;if(vr&&cr){const pr=vr.length;for(let _r=pr-1;_r>=0;--_r){const Pr=I(vr[_r],!0);Pr.__removalCount=(nt.__removalCount||0)+1,cr.insertBefore(Pr,j(nt))}}}return Rr(nt),!0}return nt instanceof b&&!Fr(nt)||(Ut==="noscript"||Ut==="noembed"||Ut==="noframes")&®ExpTest(/<\/no(script|embed|frames)/i,nt.innerHTML)?(Rr(nt),!0):(Ue&&nt.nodeType===NODE_TYPE.text&&(It=nt.textContent,arrayForEach([Ae,je,Ne],cr=>{It=stringReplace(It,cr," ")}),nt.textContent!==It&&(arrayPush(e.removed,{element:nt.cloneNode()}),nt.textContent=It)),Ir(oe.afterSanitizeElements,nt,null),!1)},un=function(nt,It,Ut){if(Ke&&(It==="id"||It==="name")&&(Ut in n||Ut in gn))return!1;if(!(et&&!Xe[It]&®ExpTest(Oe,It))){if(!(it&®ExpTest(Fe,It))){if(!Ze[It]||Xe[It]){if(!(dn(nt)&&(Ye.tagNameCheck instanceof RegExp&®ExpTest(Ye.tagNameCheck,nt)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(nt))&&(Ye.attributeNameCheck instanceof RegExp&®ExpTest(Ye.attributeNameCheck,It)||Ye.attributeNameCheck instanceof Function&&Ye.attributeNameCheck(It))||It==="is"&&Ye.allowCustomizedBuiltInElements&&(Ye.tagNameCheck instanceof RegExp&®ExpTest(Ye.tagNameCheck,Ut)||Ye.tagNameCheck instanceof Function&&Ye.tagNameCheck(Ut))))return!1}else if(!dr[It]){if(!regExpTest(qe,stringReplace(Ut,$e,""))){if(!((It==="src"||It==="xlink:href"||It==="href")&&nt!=="script"&&stringIndexOf(Ut,"data:")===0&&Yt[nt])){if(!(st&&!regExpTest(ze,stringReplace(Ut,$e,"")))){if(Ut)return!1}}}}}}return!0},dn=function(nt){return nt!=="annotation-xml"&&stringMatch(nt,Be)},en=function(nt){Ir(oe.beforeSanitizeAttributes,nt,null);const{attributes:It}=nt;if(!It||Gr(nt))return;const Ut={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ze,forceKeepAttr:void 0};let cr=It.length;for(;cr--;){const vr=It[cr],{name:pr,namespaceURI:_r,value:Pr}=vr,Br=mr(pr),tn=Pr;let Vt=pr==="value"?tn:stringTrim(tn);if(Ut.attrName=Br,Ut.attrValue=Vt,Ut.keepAttr=!0,Ut.forceKeepAttr=void 0,Ir(oe.uponSanitizeAttribute,nt,Ut),Vt=Ut.attrValue,at&&(Br==="id"||Br==="name")&&(Or(pr,nt),Vt=Qe+Vt),Ct&®ExpTest(/((--!?|])>)|<\/(style|title)/i,Vt)){Or(pr,nt);continue}if(Ut.forceKeepAttr)continue;if(!Ut.keepAttr){Or(pr,nt);continue}if(!ot&®ExpTest(/\/>/i,Vt)){Or(pr,nt);continue}Ue&&arrayForEach([Ae,je,Ne],Cr=>{Vt=stringReplace(Vt,Cr," ")});const qr=mr(nt.nodeName);if(!un(qr,Br,Vt)){Or(pr,nt);continue}if(Q&&typeof E=="object"&&typeof E.getAttributeType=="function"&&!_r)switch(E.getAttributeType(qr,Br)){case"TrustedHTML":{Vt=Q.createHTML(Vt);break}case"TrustedScriptURL":{Vt=Q.createScriptURL(Vt);break}}if(Vt!==tn)try{_r?nt.setAttributeNS(_r,pr,Vt):nt.setAttribute(pr,Vt),Gr(nt)?Rr(nt):arrayPop(e.removed)}catch{Or(pr,nt)}}Ir(oe.afterSanitizeAttributes,nt,null)},fn=function Kt(nt){let It=null;const Ut=Jr(nt);for(Ir(oe.beforeSanitizeShadowDOM,nt,null);It=Ut.nextNode();)Ir(oe.uponSanitizeShadowNode,It,null),on(It),en(It),It.content instanceof d&&Kt(It.content);Ir(oe.afterSanitizeShadowDOM,nt,null)};return e.sanitize=function(Kt){let nt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},It=null,Ut=null,cr=null,vr=null;if(ir=!Kt,ir&&(Kt="<!-->"),typeof Kt!="string"&&!Qr(Kt))if(typeof Kt.toString=="function"){if(Kt=Kt.toString(),typeof Kt!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!e.isSupported)return Kt;if(yt||Er(nt),e.removed=[],typeof Kt=="string"&&(ft=!1),ft){if(Kt.nodeName){const Pr=mr(Kt.nodeName);if(!Ge[Pr]||rt[Pr])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(Kt instanceof g)It=Xr("<!---->"),Ut=It.ownerDocument.importNode(Kt,!0),Ut.nodeType===NODE_TYPE.element&&Ut.nodeName==="BODY"||Ut.nodeName==="HTML"?It=Ut:It.appendChild(Ut);else{if(!qt&&!Ue&&!Je&&Kt.indexOf("<")===-1)return Q&&Ft?Q.createHTML(Kt):Kt;if(It=Xr(Kt),!It)return qt?null:Ft?F:""}It&&Mt&&Rr(It.firstChild);const pr=Jr(ft?Kt:It);for(;cr=pr.nextNode();)on(cr),en(cr),cr.content instanceof d&&fn(cr.content);if(ft)return Kt;if(qt){if(Ht)for(vr=ne.call(It.ownerDocument);It.firstChild;)vr.appendChild(It.firstChild);else vr=It;return(Ze.shadowroot||Ze.shadowrootmode)&&(vr=ge.call(o,vr,!0)),vr}let _r=Je?It.outerHTML:It.innerHTML;return Je&&Ge["!doctype"]&&It.ownerDocument&&It.ownerDocument.doctype&&It.ownerDocument.doctype.name&®ExpTest(DOCTYPE_NAME,It.ownerDocument.doctype.name)&&(_r="<!DOCTYPE "+It.ownerDocument.doctype.name+`>
|
|
1053
|
+
`+_r),Ue&&arrayForEach([Ae,je,Ne],Pr=>{_r=stringReplace(_r,Pr," ")}),Q&&Ft?Q.createHTML(_r):_r},e.setConfig=function(){let Kt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Er(Kt),yt=!0},e.clearConfig=function(){Mr=null,yt=!1},e.isValidAttribute=function(Kt,nt,It){Mr||Er({});const Ut=mr(Kt),cr=mr(nt);return un(Ut,cr,It)},e.addHook=function(Kt,nt){typeof nt=="function"&&arrayPush(oe[Kt],nt)},e.removeHook=function(Kt,nt){if(nt!==void 0){const It=arrayLastIndexOf(oe[Kt],nt);return It===-1?void 0:arraySplice(oe[Kt],It,1)[0]}return arrayPop(oe[Kt])},e.removeHooks=function(Kt){oe[Kt]=[]},e.removeAllHooks=function(){oe=_createHooksMap()},e}var purify=createDOMPurify();function markdownToSafeHTML(t){var e=marked(t,{async:!1});return purify.sanitize(e,{ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","b","strong","i","em","u","s","sub","sup","mark","code","pre","blockquote","q","ul","ol","li","dl","dt","dd","p","div","span","br","hr","table","thead","tbody","tfoot","tr","th","td"]})}function SkeletonMessage({botStatus:t}){return jsxRuntime.jsxs("div",{className:"flex items-start gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 mt-1 rounded-full bg-gray-300 animate-pulse flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:["Assistant",jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:new Date().toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})})]}),jsxRuntime.jsx("div",{className:"rounded-md p-3 break-words bg-white border rounded-tl-none",children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-150"}),jsxRuntime.jsx("div",{className:"h-2 w-2 rounded-full bg-primary animate-pulse delay-300"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:t})]})})]})]})}function ChatMessages({messages:t,currentUserId:e,botStatus:n,isAssistantChat:o}){return jsxRuntime.jsxs("div",{children:[t.map(l=>{const d=l.fromPartnerID===e;return jsxRuntime.jsxs("div",{className:cn("flex items-start gap-2 mt-2 mb-2",d&&"flex-row-reverse"),children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 mt-1",children:jsxRuntime.jsx(AvatarImage,{src:`https://api.dicebear.com/9.x/thumbs/svg?seed=${md5(l.senderName+l.fromPartnerID)}&flip=${d}`})}),jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[70%]",children:[jsxRuntime.jsxs("p",{className:"mb-1",children:[l.senderName,jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground mt-1 ml-3",children:(()=>{const f=new Date(l.timestamp);return isToday(f)?f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0}):isYesterday(f)?`Yesterday, ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`:`${f.toLocaleDateString([],{month:"short",day:"numeric"})} ${f.toLocaleTimeString([],{hour:"numeric",minute:"2-digit",hour12:!0})}`})()})]}),jsxRuntime.jsx("div",{className:cn("rounded-md p-3 break-words [&_li]:ml-6 [&_li]:list-disc [&_h1]:text-lg [&_h1]:font-bold [&_h1]:mt-4 [&_h2]:font-bold [&_h2]:mt-4 [&_h3]:mt-4 ",d?"bg-primary text-white rounded-tr-none":"bg-white border rounded-tl-none"),children:parser(markdownToSafeHTML(l.content))})]})]},l.id)}),n!==""&&jsxRuntime.jsx(SkeletonMessage,{botStatus:n}),t.length===0&&!o&&jsxRuntime.jsx("div",{className:"text-center text-muted-foreground py-8",children:"No messages yet"}),t.length===0&&n===""&&o&&jsxRuntime.jsxs("div",{className:"text-center py-8",children:[jsxRuntime.jsx("p",{children:"The Randmar Assistant is ready to help you. Ask anything about products, orders, carts, shipments and tracking numbers."}),jsxRuntime.jsx("p",{children:jsxRuntime.jsx("strong",{children:'Try it now, type "my open orders"!'})})]})]})}var SWITCH_NAME="Switch",[createSwitchContext,createSwitchScope]=createContextScope(SWITCH_NAME),[SwitchProvider,useSwitchContext]=createSwitchContext(SWITCH_NAME),Switch$1=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,name:o,checked:l,defaultChecked:d,required:f,disabled:g,value:b="on",onCheckedChange:_,form:S,...R}=t,[C,E]=React__namespace.useState(null),A=useComposedRefs(e,z=>E(z)),I=React__namespace.useRef(!1),M=C?S||!!C.closest("form"):!0,[j,q]=useControllableState({prop:l,defaultProp:d??!1,onChange:_,caller:SWITCH_NAME});return jsxRuntime.jsxs(SwitchProvider,{scope:n,checked:j,disabled:g,children:[jsxRuntime.jsx(Primitive.button,{type:"button",role:"switch","aria-checked":j,"aria-required":f,"data-state":getState$2(j),"data-disabled":g?"":void 0,disabled:g,value:b,...R,ref:A,onClick:composeEventHandlers(t.onClick,z=>{q(Q=>!Q),M&&(I.current=z.isPropagationStopped(),I.current||z.stopPropagation())})}),M&&jsxRuntime.jsx(SwitchBubbleInput,{control:C,bubbles:!I.current,name:o,value:b,checked:j,required:f,disabled:g,form:S,style:{transform:"translateX(-100%)"}})]})});Switch$1.displayName=SWITCH_NAME;var THUMB_NAME="SwitchThumb",SwitchThumb=React__namespace.forwardRef((t,e)=>{const{__scopeSwitch:n,...o}=t,l=useSwitchContext(THUMB_NAME,n);return jsxRuntime.jsx(Primitive.span,{"data-state":getState$2(l.checked),"data-disabled":l.disabled?"":void 0,...o,ref:e})});SwitchThumb.displayName=THUMB_NAME;var BUBBLE_INPUT_NAME$2="SwitchBubbleInput",SwitchBubbleInput=React__namespace.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:o=!0,...l},d)=>{const f=React__namespace.useRef(null),g=useComposedRefs(f,d),b=usePrevious(n),_=useSize(e);return React__namespace.useEffect(()=>{const S=f.current;if(!S)return;const R=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(R,"checked").set;if(b!==n&&E){const A=new Event("click",{bubbles:o});E.call(S,n),S.dispatchEvent(A)}},[b,n,o]),jsxRuntime.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...l,tabIndex:-1,ref:g,style:{...l.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});SwitchBubbleInput.displayName=BUBBLE_INPUT_NAME$2;function getState$2(t){return t?"checked":"unchecked"}var Root$1=Switch$1,Thumb=SwitchThumb;const Switch=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Root$1,{className:cn("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:jsxRuntime.jsx(Thumb,{className:cn("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Switch.displayName=Root$1.displayName;const DebugMessageDisplay=({debugMessages:t})=>{const[e,n]=React.useState({}),o=l=>{n(d=>({...d,[l]:!d[l]}))};return jsxRuntime.jsx("div",{children:t.map((l,d)=>{if(typeof l=="string")return jsxRuntime.jsx("p",{className:"text-slate-600",children:l},d);{const f=e[d];return jsxRuntime.jsxs("div",{className:"cursor-pointer",onClick:()=>o(d),children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("p",{className:"text-slate-600 mr-2",children:l[0]}),jsxRuntime.jsx("span",{className:"text-slate-500 text-xs",children:f?"▲":"▼"})]}),f&&jsxRuntime.jsx("p",{className:"text-slate-400 pl-4",children:l[1]})]},d)}})})},ASSISTANT_ID="RandmarAIChatAssistant",sortChats=(t,e)=>t.unread>0&&e.unread===0?-1:e.unread>0&&t.unread===0?1:t.name.localeCompare(e.name),ChatLayout=React.forwardRef(({userId:t,userName:e,inputRef:n,assistantOnly:o,className:l,initialPrompt:d},f)=>{const{data:g,refetch:b}=useGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationsQuery({routeApplicationId:t},{skip:o===!0}),[_]=usePostV4PartnerByApplicationIdAccountDebugFeedbackMutation(),[S,{isLoading:R}]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[C,E]=React.useState(!1),A=React.useRef(null),I=React.useRef(!1),[M]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationPartnerAndPartnerIdMutation(),[j]=usePostV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdReadMutation(),[q]=useLazyGetV4PartnerByRouteApplicationIdBusinessDevelopmentConversationAndConversationIdMessagesQuery(),{handleSubmitToBot:z,botMessages:Q,clearBotMessages:F,botReady:V,debugMessages:te,botStatus:ne,reset:se}=useAIAssistant({userId:t,smartAndSlow:C});React.useEffect(()=>{const mt={partner1:t,partner2:ASSISTANT_ID,name:"Randmar Assistant",unread:0,pending:!1,messages:[],conversationID:-1};if(o===!0){Ge([mt]);return}if(!g)return;(async()=>{const Wt=g.map(async ur=>{var wr,gr,xr;const jr=await q({routeApplicationId:t,conversationId:ur.ConversationId});return{partner1:ur.Participant1,partner2:ur.Participant2,name:((wr=ur.Participant)==null?void 0:wr.PublicName)??"missing public name",unread:((gr=jr.data)==null?void 0:gr.filter(tr=>!tr.Read&&tr.SenderId!=t).length)??0,pending:ur.Status!=="Approved",messages:((xr=jr.data)==null?void 0:xr.map(tr=>({id:"history"+tr.MessageId,fromPartnerID:tr.SenderId,toPartnerID:tr.SenderId==ur.Participant1?ur.Participant2:ur.Participant1,senderName:tr.SenderName??"missing name",timestamp:new Date(tr.SentDate+"Z").getTime(),content:tr.Content??"no content"})))??[],conversationID:ur.ConversationId}}),ir=await Promise.all(Wt);ir.sort(sortChats),Ge([mt,...ir]),setTimeout(()=>{var ur;return(ur=Ue.current)==null?void 0:ur.focus()},50)})()},[g,o,t]);const[ge,oe]=React.useState("approved"),[Ae,je]=React.useState([t,ASSISTANT_ID]),[Ne,Oe]=React.useState(""),[Fe,ze]=React.useState(null),[$e,Be]=React.useState(null),[qe,Ge]=React.useState([]),[He,Ze]=React.useState(""),[tt,Ye]=React.useState(null),rt=React.useRef(null),Xe=React.useRef(null),[it,et]=React.useState(null),[st,ot]=React.useState([]),Ue=n||Xe,Ct=React.useRef(null),{toast:Je}=useToast(),yt=()=>qe.find(mt=>mt.partner1===(Ae==null?void 0:Ae[0])&&mt.partner2===(Ae==null?void 0:Ae[1])),Mt=()=>(Ae==null?void 0:Ae[0])===ASSISTANT_ID||(Ae==null?void 0:Ae[1])===ASSISTANT_ID;function qt(){const mt=yt();mt&&(Mt()||j({routeApplicationId:t,conversationId:mt.conversationID}))}React.useEffect(()=>{d&&V&&(I.current||Mt()&&(I.current=!0,Ke(d)))},[d,V,Ae,I]),React.useEffect(()=>{Fe&&Ae&&(Ke(Fe),ze(null))},[Fe,Ae]);const Ht=React.useMemo(()=>qe.filter(mt=>{if(mt.partner1===ASSISTANT_ID||mt.partner2===ASSISTANT_ID)return!0;const Wt=mt.name.toLowerCase().includes(He.toLowerCase());return ge==="approved"?Wt&&!mt.pending:ge==="pending"?Wt&&mt.pending:Wt}),[qe,He,ge]);React.useEffect(()=>{var mt;it!==null&&(Je({title:"File attached",description:"Add your instruction before sending.",variant:"success"}),(mt=Ue.current)==null||mt.focus())},[it]),React.useEffect(()=>{Q.length!==0&&(Q.forEach(mt=>{if(!mt||mt.isComponent)return;const Zt={id:mt.timestamp.toString(),fromPartnerID:ASSISTANT_ID,toPartnerID:t,senderName:"Assistant",timestamp:mt.timestamp.getTime(),content:mt.content};Ft(Zt)}),F())},[Q]);function Ft(mt){Ge(Zt=>Zt.map(Wt=>{let ir=Wt.partner1===mt.fromPartnerID&&Wt.partner2===mt.toPartnerID;return ir||(ir=Wt.partner1===mt.toPartnerID&&Wt.partner2===mt.fromPartnerID),!ir||Wt.messages.some(ur=>ur.id===mt.id)?Wt:(Be([Wt.partner1,Wt.partner2]),{...Wt,unread:Wt.unread+1,messages:[...Wt.messages,mt]})}).sort(sortChats))}React.useEffect(()=>{if(o===!0)return;const mt=new HubConnectionBuilder().withUrl("https://api.randmar.io/hub",{accessTokenFactory:()=>localStorage.getItem("access_token"),headers:{"X-Impersonated-Id":t}}).configureLogging(LogLevel.Information).withAutomaticReconnect().withHubProtocol(new JsonHubProtocol).build();return mt.on("ReceiveMessage",Ft),mt.start().catch(Zt=>console.error("Error connecting to SignalR hub:",Zt)),Ye(mt),()=>{mt&&mt.stop()}},[t,o]),React.useEffect(()=>{($e==null?void 0:$e[0])!==(Ae==null?void 0:Ae[0])||($e==null?void 0:$e[1])!==(Ae==null?void 0:Ae[1])||(qt(),Ge(mt=>mt.map(Zt=>Zt.partner1===(Ae==null?void 0:Ae[0])&&Zt.partner2===(Ae==null?void 0:Ae[1])?{...Zt,unread:0}:Zt)),setTimeout(()=>{var mt;return(mt=rt.current)==null?void 0:mt.scrollIntoView({behavior:"smooth"})},50))},[$e,Ae]),React.useEffect(()=>{var Zt;if(!Ae)return;const mt=yt();mt&&((Zt=Ue.current)==null||Zt.focus(),mt.unread>0&&(qt(),Ge(Wt=>Wt.map(ir=>ir.partner1===Ae[0]&&ir.partner2===Ae[1]?{...ir,unread:0}:ir))),setTimeout(()=>{var Wt;return(Wt=rt.current)==null?void 0:Wt.scrollIntoView({behavior:"smooth"})},50))},[qe,Ae]);const Ke=mt=>{if(!Ae)return;const Zt={id:crypto.randomUUID(),senderName:e,fromPartnerID:t,toPartnerID:Ae[0]===t?Ae[1]:Ae[0],content:mt+(it?` (${it==null?void 0:it.name} attached)`:""),timestamp:Date.now()};Ge(Wt=>Wt.map(ir=>ir.partner1===Ae[0]&&ir.partner2===Ae[1]?{...ir,messages:[...ir.messages,Zt]}:ir)),Be([Ae[0],Ae[1]]),Zt.toPartnerID==ASSISTANT_ID?(z(Zt.content,it??void 0),it&&ot(Wt=>[...Wt,it.name])):tt.invoke("NewMessage",Zt).catch(Wt=>console.error("Error sending message:",Wt)),Oe(""),et(null),Ct.current&&(Ct.current.value="")},at=(mt,Zt)=>{if(!qe.length||o!==!0&&!tt||!V)return!1;const Wt=qe.find(ir=>ir.conversationID===mt);return Wt?(Wt.pending&&setTimeout(()=>oe("pending"),300),je([Wt.partner1,Wt.partner2]),Zt&&ze(Zt),!0):!1};if(React.useImperativeHandle(f,()=>({setActiveChatAndSendMessage:at})),!V)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),jsxRuntime.jsx("p",{children:"Loading API functions..."})]})})});const Qe=mt=>{var Wt;if(!Mt())return;const Zt=(Wt=mt.clipboardData)==null?void 0:Wt.items;if(Zt){for(let ir=0;ir<Zt.length;ir++)if(Zt[ir].type.indexOf("image")!==-1){const ur=Zt[ir].getAsFile();if(ur){et(ur);return}}}},ct=()=>{!Ne.trim()||!Ae||o!==!0&&!tt||Ke(Ne)},ft=mt=>{mt.target.files&&mt.target.files[0]?et(mt.target.files[0]):et(null)},dt=()=>{var mt;(mt=Ct.current)==null||mt.click()},Rt=()=>{var mt;et(null),Je({title:"File removed",description:"No file will be sent to the assistant.",variant:"secondary"}),(mt=Ue.current)==null||mt.focus()},zt=()=>{const Zt={messages:qe.find(Wt=>Wt.partner1===ASSISTANT_ID||Wt.partner2===ASSISTANT_ID),debug:te};_({applicationId:t,emailAddress:e,body:Zt})},Yt=async()=>{A.current&&(A.current.disabled=!0),await M({routeApplicationId:t,partnerId:"2"}),await b()},or=()=>{Ge(mt=>mt.map(Wt=>Wt.partner1!==ASSISTANT_ID&&Wt.partner2!==ASSISTANT_ID?Wt:{...Wt,messages:[]})),ot([]),se()},dr=()=>{Ae&&S({routeApplicationId:t,partnerId:Ae[0]==t?Ae[1]:Ae[0]}).then(()=>{oe("approved")})},pt=yt(),Sr=qe.filter(mt=>mt.pending).length;return jsxRuntime.jsxs("div",{className:cn("flex overflow-hidden",l),children:[o!==!0&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"w-[260px] p-4 pt-3 flex flex-col border-r",children:[jsxRuntime.jsx("div",{className:"p-4 font-semibold border-b",children:"Communications"}),qe.length>1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(Search,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),jsxRuntime.jsx(Input,{placeholder:"Search chats...",className:"pl-8 h-9",value:He,onChange:mt=>Ze(mt.target.value)})]})}),jsxRuntime.jsx(Tabs,{value:ge,onValueChange:oe,className:"w-full mb-1",children:jsxRuntime.jsxs(TabsList,{className:"grid grid-cols-6 h-9 mx-2",children:[jsxRuntime.jsx(TabsTrigger,{value:"approved",className:"text-xs col-span-3",children:"Approved"}),jsxRuntime.jsxs(TabsTrigger,{value:"pending",className:"text-xs col-span-3",children:["Pending ",Sr>0&&`(${Sr})`]})]})})]}),jsxRuntime.jsx("div",{className:"mt-1 mb-1",children:qe.findIndex(mt=>mt.partner1==="2"||mt.partner2==="2")<0?jsxRuntime.jsx(Button,{className:"w-full",ref:A,onClick:()=>Yt(),children:"Chat with Randmar"},"b1"):ge==="approved"&&qe.length>=5?null:jsxRuntime.jsx("a",{target:"_blank",href:`https://dashboard.randmar.io/${t}/ExploreManufacturers`,children:jsxRuntime.jsx(Button,{className:"w-full",children:"Explore manufacturers"},"b2")})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1",children:qe.length>0&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(mt=>mt.partner1!==ASSISTANT_ID&&mt.partner2!==ASSISTANT_ID),activeChat:pt??null,onSelectChat:je})}),jsxRuntime.jsx(Separator$1,{className:"mt-auto"}),jsxRuntime.jsx("div",{className:"pt-1",children:qe.find(mt=>mt.partner1===ASSISTANT_ID||mt.partner2===ASSISTANT_ID)&&jsxRuntime.jsx(ChatList,{userId:t,chats:Ht.filter(mt=>mt.partner1===ASSISTANT_ID||mt.partner2===ASSISTANT_ID),activeChat:pt??null,onSelectChat:je,assistantStickyMode:!0})})]})}),jsxRuntime.jsx("div",{className:"flex-5 flex flex-col",children:Ae?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:Ae[0]==ASSISTANT_ID||Ae[1]==ASSISTANT_ID?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:jsxRuntime.jsx(Bot,{className:"text-primary fill-white min-h-full"})}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:"Randmar Assistant"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 ml-auto",children:[jsxRuntime.jsx(Switch,{id:"smartSwitch",disabled:!!ne,checked:C,onCheckedChange:mt=>{or(),setTimeout(()=>E(mt),20)}}),jsxRuntime.jsx(Label$2,{htmlFor:"smartSwitch",children:"Think harder"})]}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",onClick:()=>or(),children:jsxRuntime.jsx(MessageCircleX,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"ml-1",confirmationDialog:{title:"Report Issue",content:"This action will send a copy of your chat to Randmar. Send it?",onConfirm:()=>zt()},children:jsxRuntime.jsx(MessageSquareShare,{className:"h-5 w-5"})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Avatar,{className:"h-8 w-8 flex-shrink-0 rounded-none",children:[jsxRuntime.jsx(AvatarImage,{src:`https://api.randmar.io/v4/Partner/${Ae[0]===t?Ae[1]:Ae[0]}/Account/Logo?height=72&width=72`,className:" object-contain "}),jsxRuntime.jsx(AvatarFallback,{children:jsxRuntime.jsx(Handshake,{className:"text-primary fill-white min-h-full"})})]}),jsxRuntime.jsx("div",{className:"ml-3 font-medium",children:pt==null?void 0:pt.name}),jsxRuntime.jsx("div",{className:"flex items-center space-x-2 ml-auto",children:jsxRuntime.jsx("a",{href:`https://dashboard.randmar.io/${t}/Partner/${Ae[0]===t?Ae[1]:Ae[0]}`,target:"_blank",children:jsxRuntime.jsx(Button,{children:"View Partner"})})})]})}),pt!=null&&pt.pending&&pt.partner1==t?jsxRuntime.jsx("p",{className:"mt-8 p-2 mx-auto",children:"This conversation is awaiting approval by the other party — please check back later."}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:[jsxRuntime.jsx(ChatMessages,{messages:(pt==null?void 0:pt.messages)??[],currentUserId:t,isAssistantChat:Mt(),botStatus:Mt()?ne:""}),jsxRuntime.jsx("div",{ref:rt})]}),jsxRuntime.jsxs("div",{className:"p-4 border-t border-r flex",children:[(pt==null?void 0:pt.pending)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{disabled:R,onClick:()=>dr(),children:[jsxRuntime.jsx(Handshake,{}),"Accept Conversation Request"]}),jsxRuntime.jsxs(Button,{disabled:!0,className:"ml-2",children:[jsxRuntime.jsx(ThumbsDown,{}),"Block Partner"]})]}),jsxRuntime.jsx(Textarea,{ref:Ue,placeholder:"Type a message...",value:Ne,onPaste:Qe,onChange:mt=>Oe(mt.target.value),onKeyDown:mt=>{mt.key!=="Enter"||mt.shiftKey||(mt.preventDefault(),ct())},className:pt!=null&&pt.pending?"collapse":"flex-1 resize-none"}),jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx(Button,{size:"icon",variant:"default",className:pt!=null&&pt.pending?"collapse":"ml-2 h-8 w-8",disabled:!!ne||(pt==null?void 0:pt.pending),onClick:ct,children:jsxRuntime.jsx(Send,{className:"h-6 w-6"})}),Mt()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Input,{type:"file",onChange:ft,className:"hidden",ref:Ct}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:dt,className:pt!=null&&pt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(pt==null?void 0:pt.pending)||!!it,children:jsxRuntime.jsx(Paperclip,{className:"h-5 w-5"})}),jsxRuntime.jsx(Button,{size:"icon",variant:"default",onClick:Rt,className:pt!=null&&pt.pending?"collapse":"ml-2 h-8 w-8",disabled:ne!==""||(pt==null?void 0:pt.pending)||!it,children:jsxRuntime.jsx(Trash,{className:"h-5 w-5"})})]})]})]})]})]}):jsxRuntime.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a chat to start messaging"})}),jsxRuntime.jsx("div",{"data-thin":Mt(),className:"w-[480px] flex flex-col border-l flex-4 data-[thin=true]:flex-2",children:Mt()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Sources and System Info"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[it?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",it.name," (pending send...)"]})}):st.length?jsxRuntime.jsx(jsxRuntime.Fragment,{}):jsxRuntime.jsx("p",{children:"No files attached to this conversation yet."}),st.slice().reverse().map(mt=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsx(File,{})," ",mt]})}))]})}),jsxRuntime.jsx(ScrollArea,{className:"flex-4 border-t pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"space-y-2",children:jsxRuntime.jsx(DebugMessageDisplay,{debugMessages:te})})})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex items-center p-4 border-b",children:jsxRuntime.jsx("p",{className:"h-9 text-base/9",children:"Partner Overview"})}),jsxRuntime.jsx(ScrollArea,{className:"flex-1 pl-2 pr-2 bg-slate-50",children:jsxRuntime.jsx("div",{className:"mt-1",children:jsxRuntime.jsx(PartnerRelationshipPage,{applicationId:t,partnerId:((Ae==null?void 0:Ae[0])===t?Ae[1]:Ae==null?void 0:Ae[0])??t,userEmail:e,shopifyHostName:void 0,isSuperAdmin:!1})})})]})})]})});function UnsavedChangesDialog({isOpen:t,onClose:e,onConfirm:n,title:o,description:l,confirmText:d="Confirm",cancelText:f="Cancel"}){return jsxRuntime.jsx(Dialog,{open:t,onOpenChange:e,children:jsxRuntime.jsxs(DialogContent,{className:"sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:o}),jsxRuntime.jsx(DialogDescription,{children:l})]}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:e,children:f}),jsxRuntime.jsx(Button,{onClick:n,children:d})]})]})})}function useRouterNavigationGuard(t){const[e,n]=React.useState(!1),o=reactRouterDom.useBlocker(React.useCallback(({currentLocation:g,nextLocation:b})=>{const _=g.pathname!==b.pathname||g.search!==b.search||g.hash!==b.hash;return t()&&_},[t]));React.useEffect(()=>{o.state==="blocked"&&n(!0)},[o]),React.useEffect(()=>{const g=b=>{if(t())return b.preventDefault(),"You have unsaved changes. Are you sure you want to leave?"};return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[t]);const l=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.proceed()},[o]),d=React.useCallback(()=>{n(!1),o.state==="blocked"&&o.reset()},[o]),f=React.useCallback(()=>jsxRuntime.jsx(UnsavedChangesDialog,{isOpen:e,onClose:d,onConfirm:l,title:"Unsaved Changes",description:"You have unsaved changes. Are you sure you want to leave? Your changes will be lost.",confirmText:"Discard Changes",cancelText:"Stay on Page"}),[e,d,l]);return{showDialog:e,handleConfirm:l,handleCancel:d,NavigationGuardDialog:f}}var isCheckBoxInput=t=>t.type==="checkbox",isDateObject=t=>t instanceof Date,isNullOrUndefined=t=>t==null;const isObjectType=t=>typeof t=="object";var isObject=t=>!isNullOrUndefined(t)&&!Array.isArray(t)&&isObjectType(t)&&!isDateObject(t),getEventValue=t=>isObject(t)&&t.target?isCheckBoxInput(t.target)?t.target.checked:t.target.value:t,getNodeParentName=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,isNameInFieldArray=(t,e)=>t.has(getNodeParentName(e)),isPlainObject$1=t=>{const e=t.constructor&&t.constructor.prototype;return isObject(e)&&e.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(t){let e;const n=Array.isArray(t),o=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(isWeb&&(t instanceof Blob||o))&&(n||isObject(t)))if(e=n?[]:{},!n&&!isPlainObject$1(t))e=t;else for(const l in t)t.hasOwnProperty(l)&&(e[l]=cloneObject(t[l]));else return t;return e}var compact=t=>Array.isArray(t)?t.filter(Boolean):[],isUndefined=t=>t===void 0,get=(t,e,n)=>{if(!e||!isObject(t))return n;const o=compact(e.split(/[,[\].]+?/)).reduce((l,d)=>isNullOrUndefined(l)?l:l[d],t);return isUndefined(o)||o===t?isUndefined(t[e])?n:t[e]:o},isBoolean=t=>typeof t=="boolean",isKey=t=>/^\w*$/.test(t),stringToPath=t=>compact(t.replace(/["|']|\]/g,"").split(/\.|\[/)),set=(t,e,n)=>{let o=-1;const l=isKey(e)?[e]:stringToPath(e),d=l.length,f=d-1;for(;++o<d;){const g=l[o];let b=n;if(o!==f){const _=t[g];b=isObject(_)||Array.isArray(_)?_:isNaN(+l[o+1])?{}:[]}if(g==="__proto__"||g==="constructor"||g==="prototype")return;t[g]=b,t=t[g]}};const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};React.createContext(null);var getProxyFormState=(t,e,n,o=!0)=>{const l={defaultValues:e._defaultValues};for(const d in t)Object.defineProperty(l,d,{get:()=>{const f=d;return e._proxyFormState[f]!==VALIDATION_MODE.all&&(e._proxyFormState[f]=!o||VALIDATION_MODE.all),t[f]}});return l};const useIsomorphicLayoutEffect$1=typeof window<"u"?React__namespace.useLayoutEffect:React__namespace.useEffect;var isString=t=>typeof t=="string",generateWatchOutput=(t,e,n,o,l)=>isString(t)?(o&&e.watch.add(t),get(n,t,l)):Array.isArray(t)?t.map(d=>(o&&e.watch.add(d),get(n,d))):(o&&(e.watchAll=!0),n),appendErrors=(t,e,n,o,l)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[o]:l||!0}}:{},convertToArrayPayload=t=>Array.isArray(t)?t:[t],createSubject=()=>{let t=[];return{get observers(){return t},next:l=>{for(const d of t)d.next&&d.next(l)},subscribe:l=>(t.push(l),{unsubscribe:()=>{t=t.filter(d=>d!==l)}}),unsubscribe:()=>{t=[]}}},isPrimitive=t=>isNullOrUndefined(t)||!isObjectType(t);function deepEqual$1(t,e){if(isPrimitive(t)||isPrimitive(e))return t===e;if(isDateObject(t)&&isDateObject(e))return t.getTime()===e.getTime();const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const l of n){const d=t[l];if(!o.includes(l))return!1;if(l!=="ref"){const f=e[l];if(isDateObject(d)&&isDateObject(f)||isObject(d)&&isObject(f)||Array.isArray(d)&&Array.isArray(f)?!deepEqual$1(d,f):d!==f)return!1}}return!0}var isEmptyObject$1=t=>isObject(t)&&!Object.keys(t).length,isFileInput=t=>t.type==="file",isFunction$3=t=>typeof t=="function",isHTMLElement=t=>{if(!isWeb)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},isMultipleSelect=t=>t.type==="select-multiple",isRadioInput=t=>t.type==="radio",isRadioOrCheckbox=t=>isRadioInput(t)||isCheckBoxInput(t),live=t=>isHTMLElement(t)&&t.isConnected;function baseGet(t,e){const n=e.slice(0,-1).length;let o=0;for(;o<n;)t=isUndefined(t)?o++:t[e[o++]];return t}function isEmptyArray(t){for(const e in t)if(t.hasOwnProperty(e)&&!isUndefined(t[e]))return!1;return!0}function unset(t,e){const n=Array.isArray(e)?e:isKey(e)?[e]:stringToPath(e),o=n.length===1?t:baseGet(t,n),l=n.length-1,d=n[l];return o&&delete o[d],l!==0&&(isObject(o)&&isEmptyObject$1(o)||Array.isArray(o)&&isEmptyArray(o))&&unset(t,n.slice(0,-1)),t}var objectHasFunction=t=>{for(const e in t)if(isFunction$3(t[e]))return!0;return!1};function markFieldsDirty(t,e={}){const n=Array.isArray(t);if(isObject(t)||n)for(const o in t)Array.isArray(t[o])||isObject(t[o])&&!objectHasFunction(t[o])?(e[o]=Array.isArray(t[o])?[]:{},markFieldsDirty(t[o],e[o])):isNullOrUndefined(t[o])||(e[o]=!0);return e}function getDirtyFieldsFromDefaultValues(t,e,n){const o=Array.isArray(t);if(isObject(t)||o)for(const l in t)Array.isArray(t[l])||isObject(t[l])&&!objectHasFunction(t[l])?isUndefined(e)||isPrimitive(n[l])?n[l]=Array.isArray(t[l])?markFieldsDirty(t[l],[]):{...markFieldsDirty(t[l])}:getDirtyFieldsFromDefaultValues(t[l],isNullOrUndefined(e)?{}:e[l],n[l]):n[l]=!deepEqual$1(t[l],e[l]);return n}var getDirtyFields=(t,e)=>getDirtyFieldsFromDefaultValues(t,e,markFieldsDirty(e));const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!isUndefined(t[0].attributes.value)?isUndefined(t[0].value)||t[0].value===""?validResult:{value:t[0].value,isValid:!0}:validResult:defaultResult}return defaultResult},getFieldValueAs=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:o})=>isUndefined(t)?t:e?t===""?NaN:t&&+t:n&&isString(t)?new Date(t):o?o(t):t;const defaultReturn={isValid:!1,value:null};var getRadioValue=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,defaultReturn):defaultReturn;function getFieldValue(t){const e=t.ref;return isFileInput(e)?e.files:isRadioInput(e)?getRadioValue(t.refs).value:isMultipleSelect(e)?[...e.selectedOptions].map(({value:n})=>n):isCheckBoxInput(e)?getCheckboxValue(t.refs).value:getFieldValueAs(isUndefined(e.value)?t.ref.value:e.value,t)}var getResolverOptions=(t,e,n,o)=>{const l={};for(const d of t){const f=get(e,d);f&&set(l,d,f._f)}return{criteriaMode:n,names:[...t],fields:l,shouldUseNativeValidation:o}},isRegex=t=>t instanceof RegExp,getRuleValue=t=>isUndefined(t)?t:isRegex(t)?t.source:isObject(t)?isRegex(t.value)?t.value.source:t.value:t,getValidationModes=t=>({isOnSubmit:!t||t===VALIDATION_MODE.onSubmit,isOnBlur:t===VALIDATION_MODE.onBlur,isOnChange:t===VALIDATION_MODE.onChange,isOnAll:t===VALIDATION_MODE.all,isOnTouch:t===VALIDATION_MODE.onTouched});const ASYNC_FUNCTION="AsyncFunction";var hasPromiseValidation=t=>!!t&&!!t.validate&&!!(isFunction$3(t.validate)&&t.validate.constructor.name===ASYNC_FUNCTION||isObject(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===ASYNC_FUNCTION)),hasValidation=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),isWatched=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(o=>t.startsWith(o)&&/^\.\w+/.test(t.slice(o.length))));const iterateFieldsByAction=(t,e,n,o)=>{for(const l of n||Object.keys(t)){const d=get(t,l);if(d){const{_f:f,...g}=d;if(f){if(f.refs&&f.refs[0]&&e(f.refs[0],l)&&!o)return!0;if(f.ref&&e(f.ref,f.name)&&!o)return!0;if(iterateFieldsByAction(g,e))break}else if(isObject(g)&&iterateFieldsByAction(g,e))break}}};function schemaErrorLookup(t,e,n){const o=get(t,n);if(o||isKey(n))return{error:o,name:n};const l=n.split(".");for(;l.length;){const d=l.join("."),f=get(e,d),g=get(t,d);if(f&&!Array.isArray(f)&&n!==d)return{name:n};if(g&&g.type)return{name:d,error:g};if(g&&g.root&&g.root.type)return{name:`${d}.root`,error:g.root};l.pop()}return{name:n}}var shouldRenderFormState=(t,e,n,o)=>{n(t);const{name:l,...d}=t;return isEmptyObject$1(d)||Object.keys(d).length>=Object.keys(e).length||Object.keys(d).find(f=>e[f]===(!o||VALIDATION_MODE.all))},shouldSubscribeByName=(t,e,n)=>!t||!e||t===e||convertToArrayPayload(t).some(o=>o&&(n?o===e:o.startsWith(e)||e.startsWith(o))),skipValidation=(t,e,n,o,l)=>l.isOnAll?!1:!n&&l.isOnTouch?!(e||t):(n?o.isOnBlur:l.isOnBlur)?!t:(n?o.isOnChange:l.isOnChange)?t:!0,unsetEmptyArray=(t,e)=>!compact(get(t,e)).length&&unset(t,e),updateFieldArrayRootError=(t,e,n)=>{const o=convertToArrayPayload(get(t,n));return set(o,"root",e[n]),set(t,n,o),t},isMessage=t=>isString(t);function getValidateError(t,e,n="validate"){if(isMessage(t)||Array.isArray(t)&&t.every(isMessage)||isBoolean(t)&&!t)return{type:n,message:isMessage(t)?t:"",ref:e}}var getValueAndMessage=t=>isObject(t)&&!isRegex(t)?t:{value:t,message:""},validateField=async(t,e,n,o,l,d)=>{const{ref:f,refs:g,required:b,maxLength:_,minLength:S,min:R,max:C,pattern:E,validate:A,name:I,valueAsNumber:M,mount:j}=t._f,q=get(n,I);if(!j||e.has(I))return{};const z=g?g[0]:f,Q=Ae=>{l&&z.reportValidity&&(z.setCustomValidity(isBoolean(Ae)?"":Ae||""),z.reportValidity())},F={},V=isRadioInput(f),te=isCheckBoxInput(f),ne=V||te,se=(M||isFileInput(f))&&isUndefined(f.value)&&isUndefined(q)||isHTMLElement(f)&&f.value===""||q===""||Array.isArray(q)&&!q.length,ge=appendErrors.bind(null,I,o,F),oe=(Ae,je,Ne,Oe=INPUT_VALIDATION_RULES.maxLength,Fe=INPUT_VALIDATION_RULES.minLength)=>{const ze=Ae?je:Ne;F[I]={type:Ae?Oe:Fe,message:ze,ref:f,...ge(Ae?Oe:Fe,ze)}};if(d?!Array.isArray(q)||!q.length:b&&(!ne&&(se||isNullOrUndefined(q))||isBoolean(q)&&!q||te&&!getCheckboxValue(g).isValid||V&&!getRadioValue(g).isValid)){const{value:Ae,message:je}=isMessage(b)?{value:!!b,message:b}:getValueAndMessage(b);if(Ae&&(F[I]={type:INPUT_VALIDATION_RULES.required,message:je,ref:z,...ge(INPUT_VALIDATION_RULES.required,je)},!o))return Q(je),F}if(!se&&(!isNullOrUndefined(R)||!isNullOrUndefined(C))){let Ae,je;const Ne=getValueAndMessage(C),Oe=getValueAndMessage(R);if(!isNullOrUndefined(q)&&!isNaN(q)){const Fe=f.valueAsNumber||q&&+q;isNullOrUndefined(Ne.value)||(Ae=Fe>Ne.value),isNullOrUndefined(Oe.value)||(je=Fe<Oe.value)}else{const Fe=f.valueAsDate||new Date(q),ze=qe=>new Date(new Date().toDateString()+" "+qe),$e=f.type=="time",Be=f.type=="week";isString(Ne.value)&&q&&(Ae=$e?ze(q)>ze(Ne.value):Be?q>Ne.value:Fe>new Date(Ne.value)),isString(Oe.value)&&q&&(je=$e?ze(q)<ze(Oe.value):Be?q<Oe.value:Fe<new Date(Oe.value))}if((Ae||je)&&(oe(!!Ae,Ne.message,Oe.message,INPUT_VALIDATION_RULES.max,INPUT_VALIDATION_RULES.min),!o))return Q(F[I].message),F}if((_||S)&&!se&&(isString(q)||d&&Array.isArray(q))){const Ae=getValueAndMessage(_),je=getValueAndMessage(S),Ne=!isNullOrUndefined(Ae.value)&&q.length>+Ae.value,Oe=!isNullOrUndefined(je.value)&&q.length<+je.value;if((Ne||Oe)&&(oe(Ne,Ae.message,je.message),!o))return Q(F[I].message),F}if(E&&!se&&isString(q)){const{value:Ae,message:je}=getValueAndMessage(E);if(isRegex(Ae)&&!q.match(Ae)&&(F[I]={type:INPUT_VALIDATION_RULES.pattern,message:je,ref:f,...ge(INPUT_VALIDATION_RULES.pattern,je)},!o))return Q(je),F}if(A){if(isFunction$3(A)){const Ae=await A(q,n),je=getValidateError(Ae,z);if(je&&(F[I]={...je,...ge(INPUT_VALIDATION_RULES.validate,je.message)},!o))return Q(je.message),F}else if(isObject(A)){let Ae={};for(const je in A){if(!isEmptyObject$1(Ae)&&!o)break;const Ne=getValidateError(await A[je](q,n),z,je);Ne&&(Ae={...Ne,...ge(je,Ne.message)},Q(Ne.message),o&&(F[I]=Ae))}if(!isEmptyObject$1(Ae)&&(F[I]={ref:z,...Ae},!o))return F}}return Q(!0),F};const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(t={}){let e={...defaultOptions$1,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:isFunction$3(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const o={};let l=isObject(e.defaultValues)||isObject(e.values)?cloneObject(e.defaultValues||e.values)||{}:{},d=e.shouldUnregister?{}:cloneObject(l),f={action:!1,mount:!1,watch:!1},g={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},b,_=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let R={...S};const C={array:createSubject(),state:createSubject()},E=e.criteriaMode===VALIDATION_MODE.all,A=Ke=>at=>{clearTimeout(_),_=setTimeout(Ke,at)},I=async Ke=>{if(!e.disabled&&(S.isValid||R.isValid||Ke)){const at=e.resolver?isEmptyObject$1((await te()).errors):await se(o,!0);at!==n.isValid&&C.state.next({isValid:at})}},M=(Ke,at)=>{!e.disabled&&(S.isValidating||S.validatingFields||R.isValidating||R.validatingFields)&&((Ke||Array.from(g.mount)).forEach(Qe=>{Qe&&(at?set(n.validatingFields,Qe,at):unset(n.validatingFields,Qe))}),C.state.next({validatingFields:n.validatingFields,isValidating:!isEmptyObject$1(n.validatingFields)}))},j=(Ke,at=[],Qe,ct,ft=!0,dt=!0)=>{if(ct&&Qe&&!e.disabled){if(f.action=!0,dt&&Array.isArray(get(o,Ke))){const Rt=Qe(get(o,Ke),ct.argA,ct.argB);ft&&set(o,Ke,Rt)}if(dt&&Array.isArray(get(n.errors,Ke))){const Rt=Qe(get(n.errors,Ke),ct.argA,ct.argB);ft&&set(n.errors,Ke,Rt),unsetEmptyArray(n.errors,Ke)}if((S.touchedFields||R.touchedFields)&&dt&&Array.isArray(get(n.touchedFields,Ke))){const Rt=Qe(get(n.touchedFields,Ke),ct.argA,ct.argB);ft&&set(n.touchedFields,Ke,Rt)}(S.dirtyFields||R.dirtyFields)&&(n.dirtyFields=getDirtyFields(l,d)),C.state.next({name:Ke,isDirty:oe(Ke,at),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else set(d,Ke,at)},q=(Ke,at)=>{set(n.errors,Ke,at),C.state.next({errors:n.errors})},z=Ke=>{n.errors=Ke,C.state.next({errors:n.errors,isValid:!1})},Q=(Ke,at,Qe,ct)=>{const ft=get(o,Ke);if(ft){const dt=get(d,Ke,isUndefined(Qe)?get(l,Ke):Qe);isUndefined(dt)||ct&&ct.defaultChecked||at?set(d,Ke,at?dt:getFieldValue(ft._f)):Ne(Ke,dt),f.mount&&I()}},F=(Ke,at,Qe,ct,ft)=>{let dt=!1,Rt=!1;const zt={name:Ke};if(!e.disabled){if(!Qe||ct){(S.isDirty||R.isDirty)&&(Rt=n.isDirty,n.isDirty=zt.isDirty=oe(),dt=Rt!==zt.isDirty);const Yt=deepEqual$1(get(l,Ke),at);Rt=!!get(n.dirtyFields,Ke),Yt?unset(n.dirtyFields,Ke):set(n.dirtyFields,Ke,!0),zt.dirtyFields=n.dirtyFields,dt=dt||(S.dirtyFields||R.dirtyFields)&&Rt!==!Yt}if(Qe){const Yt=get(n.touchedFields,Ke);Yt||(set(n.touchedFields,Ke,Qe),zt.touchedFields=n.touchedFields,dt=dt||(S.touchedFields||R.touchedFields)&&Yt!==Qe)}dt&&ft&&C.state.next(zt)}return dt?zt:{}},V=(Ke,at,Qe,ct)=>{const ft=get(n.errors,Ke),dt=(S.isValid||R.isValid)&&isBoolean(at)&&n.isValid!==at;if(e.delayError&&Qe?(b=A(()=>q(Ke,Qe)),b(e.delayError)):(clearTimeout(_),b=null,Qe?set(n.errors,Ke,Qe):unset(n.errors,Ke)),(Qe?!deepEqual$1(ft,Qe):ft)||!isEmptyObject$1(ct)||dt){const Rt={...ct,...dt&&isBoolean(at)?{isValid:at}:{},errors:n.errors,name:Ke};n={...n,...Rt},C.state.next(Rt)}},te=async Ke=>{M(Ke,!0);const at=await e.resolver(d,e.context,getResolverOptions(Ke||g.mount,o,e.criteriaMode,e.shouldUseNativeValidation));return M(Ke),at},ne=async Ke=>{const{errors:at}=await te(Ke);if(Ke)for(const Qe of Ke){const ct=get(at,Qe);ct?set(n.errors,Qe,ct):unset(n.errors,Qe)}else n.errors=at;return at},se=async(Ke,at,Qe={valid:!0})=>{for(const ct in Ke){const ft=Ke[ct];if(ft){const{_f:dt,...Rt}=ft;if(dt){const zt=g.array.has(dt.name),Yt=ft._f&&hasPromiseValidation(ft._f);Yt&&S.validatingFields&&M([ct],!0);const or=await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation&&!at,zt);if(Yt&&S.validatingFields&&M([ct]),or[dt.name]&&(Qe.valid=!1,at))break;!at&&(get(or,dt.name)?zt?updateFieldArrayRootError(n.errors,or,dt.name):set(n.errors,dt.name,or[dt.name]):unset(n.errors,dt.name))}!isEmptyObject$1(Rt)&&await se(Rt,at,Qe)}}return Qe.valid},ge=()=>{for(const Ke of g.unMount){const at=get(o,Ke);at&&(at._f.refs?at._f.refs.every(Qe=>!live(Qe)):!live(at._f.ref))&&Xe(Ke)}g.unMount=new Set},oe=(Ke,at)=>!e.disabled&&(Ke&&at&&set(d,Ke,at),!deepEqual$1(qe(),l)),Ae=(Ke,at,Qe)=>generateWatchOutput(Ke,g,{...f.mount?d:isUndefined(at)?l:isString(Ke)?{[Ke]:at}:at},Qe,at),je=Ke=>compact(get(f.mount?d:l,Ke,e.shouldUnregister?get(l,Ke,[]):[])),Ne=(Ke,at,Qe={})=>{const ct=get(o,Ke);let ft=at;if(ct){const dt=ct._f;dt&&(!dt.disabled&&set(d,Ke,getFieldValueAs(at,dt)),ft=isHTMLElement(dt.ref)&&isNullOrUndefined(at)?"":at,isMultipleSelect(dt.ref)?[...dt.ref.options].forEach(Rt=>Rt.selected=ft.includes(Rt.value)):dt.refs?isCheckBoxInput(dt.ref)?dt.refs.forEach(Rt=>{(!Rt.defaultChecked||!Rt.disabled)&&(Array.isArray(ft)?Rt.checked=!!ft.find(zt=>zt===Rt.value):Rt.checked=ft===Rt.value||!!ft)}):dt.refs.forEach(Rt=>Rt.checked=Rt.value===ft):isFileInput(dt.ref)?dt.ref.value="":(dt.ref.value=ft,dt.ref.type||C.state.next({name:Ke,values:cloneObject(d)})))}(Qe.shouldDirty||Qe.shouldTouch)&&F(Ke,ft,Qe.shouldTouch,Qe.shouldDirty,!0),Qe.shouldValidate&&Be(Ke)},Oe=(Ke,at,Qe)=>{for(const ct in at){if(!at.hasOwnProperty(ct))return;const ft=at[ct],dt=Ke+"."+ct,Rt=get(o,dt);(g.array.has(Ke)||isObject(ft)||Rt&&!Rt._f)&&!isDateObject(ft)?Oe(dt,ft,Qe):Ne(dt,ft,Qe)}},Fe=(Ke,at,Qe={})=>{const ct=get(o,Ke),ft=g.array.has(Ke),dt=cloneObject(at);set(d,Ke,dt),ft?(C.array.next({name:Ke,values:cloneObject(d)}),(S.isDirty||S.dirtyFields||R.isDirty||R.dirtyFields)&&Qe.shouldDirty&&C.state.next({name:Ke,dirtyFields:getDirtyFields(l,d),isDirty:oe(Ke,dt)})):ct&&!ct._f&&!isNullOrUndefined(dt)?Oe(Ke,dt,Qe):Ne(Ke,dt,Qe),isWatched(Ke,g)&&C.state.next({...n}),C.state.next({name:f.mount?Ke:void 0,values:cloneObject(d)})},ze=async Ke=>{f.mount=!0;const at=Ke.target;let Qe=at.name,ct=!0;const ft=get(o,Qe),dt=Yt=>{ct=Number.isNaN(Yt)||isDateObject(Yt)&&isNaN(Yt.getTime())||deepEqual$1(Yt,get(d,Qe,Yt))},Rt=getValidationModes(e.mode),zt=getValidationModes(e.reValidateMode);if(ft){let Yt,or;const dr=at.type?getFieldValue(ft._f):getEventValue(Ke),pt=Ke.type===EVENTS.BLUR||Ke.type===EVENTS.FOCUS_OUT,Sr=!hasValidation(ft._f)&&!e.resolver&&!get(n.errors,Qe)&&!ft._f.deps||skipValidation(pt,get(n.touchedFields,Qe),n.isSubmitted,zt,Rt),mt=isWatched(Qe,g,pt);set(d,Qe,dr),pt?(ft._f.onBlur&&ft._f.onBlur(Ke),b&&b(0)):ft._f.onChange&&ft._f.onChange(Ke);const Zt=F(Qe,dr,pt),Wt=!isEmptyObject$1(Zt)||mt;if(!pt&&C.state.next({name:Qe,type:Ke.type,values:cloneObject(d)}),Sr)return(S.isValid||R.isValid)&&(e.mode==="onBlur"?pt&&I():pt||I()),Wt&&C.state.next({name:Qe,...mt?{}:Zt});if(!pt&&mt&&C.state.next({...n}),e.resolver){const{errors:ir}=await te([Qe]);if(dt(dr),ct){const ur=schemaErrorLookup(n.errors,o,Qe),jr=schemaErrorLookup(ir,o,ur.name||Qe);Yt=jr.error,Qe=jr.name,or=isEmptyObject$1(ir)}}else M([Qe],!0),Yt=(await validateField(ft,g.disabled,d,E,e.shouldUseNativeValidation))[Qe],M([Qe]),dt(dr),ct&&(Yt?or=!1:(S.isValid||R.isValid)&&(or=await se(o,!0)));ct&&(ft._f.deps&&Be(ft._f.deps),V(Qe,or,Yt,Zt))}},$e=(Ke,at)=>{if(get(n.errors,at)&&Ke.focus)return Ke.focus(),1},Be=async(Ke,at={})=>{let Qe,ct;const ft=convertToArrayPayload(Ke);if(e.resolver){const dt=await ne(isUndefined(Ke)?Ke:ft);Qe=isEmptyObject$1(dt),ct=Ke?!ft.some(Rt=>get(dt,Rt)):Qe}else Ke?(ct=(await Promise.all(ft.map(async dt=>{const Rt=get(o,dt);return await se(Rt&&Rt._f?{[dt]:Rt}:Rt)}))).every(Boolean),!(!ct&&!n.isValid)&&I()):ct=Qe=await se(o);return C.state.next({...!isString(Ke)||(S.isValid||R.isValid)&&Qe!==n.isValid?{}:{name:Ke},...e.resolver||!Ke?{isValid:Qe}:{},errors:n.errors}),at.shouldFocus&&!ct&&iterateFieldsByAction(o,$e,Ke?ft:g.mount),ct},qe=Ke=>{const at={...f.mount?d:l};return isUndefined(Ke)?at:isString(Ke)?get(at,Ke):Ke.map(Qe=>get(at,Qe))},Ge=(Ke,at)=>({invalid:!!get((at||n).errors,Ke),isDirty:!!get((at||n).dirtyFields,Ke),error:get((at||n).errors,Ke),isValidating:!!get(n.validatingFields,Ke),isTouched:!!get((at||n).touchedFields,Ke)}),He=Ke=>{Ke&&convertToArrayPayload(Ke).forEach(at=>unset(n.errors,at)),C.state.next({errors:Ke?n.errors:{}})},Ze=(Ke,at,Qe)=>{const ct=(get(o,Ke,{_f:{}})._f||{}).ref,ft=get(n.errors,Ke)||{},{ref:dt,message:Rt,type:zt,...Yt}=ft;set(n.errors,Ke,{...Yt,...at,ref:ct}),C.state.next({name:Ke,errors:n.errors,isValid:!1}),Qe&&Qe.shouldFocus&&ct&&ct.focus&&ct.focus()},tt=(Ke,at)=>isFunction$3(Ke)?C.state.subscribe({next:Qe=>Ke(Ae(void 0,at),Qe)}):Ae(Ke,at,!0),Ye=Ke=>C.state.subscribe({next:at=>{shouldSubscribeByName(Ke.name,at.name,Ke.exact)&&shouldRenderFormState(at,Ke.formState||S,qt,Ke.reRenderRoot)&&Ke.callback({values:{...d},...n,...at})}}).unsubscribe,rt=Ke=>(f.mount=!0,R={...R,...Ke.formState},Ye({...Ke,formState:R})),Xe=(Ke,at={})=>{for(const Qe of Ke?convertToArrayPayload(Ke):g.mount)g.mount.delete(Qe),g.array.delete(Qe),at.keepValue||(unset(o,Qe),unset(d,Qe)),!at.keepError&&unset(n.errors,Qe),!at.keepDirty&&unset(n.dirtyFields,Qe),!at.keepTouched&&unset(n.touchedFields,Qe),!at.keepIsValidating&&unset(n.validatingFields,Qe),!e.shouldUnregister&&!at.keepDefaultValue&&unset(l,Qe);C.state.next({values:cloneObject(d)}),C.state.next({...n,...at.keepDirty?{isDirty:oe()}:{}}),!at.keepIsValid&&I()},it=({disabled:Ke,name:at})=>{(isBoolean(Ke)&&f.mount||Ke||g.disabled.has(at))&&(Ke?g.disabled.add(at):g.disabled.delete(at))},et=(Ke,at={})=>{let Qe=get(o,Ke);const ct=isBoolean(at.disabled)||isBoolean(e.disabled);return set(o,Ke,{...Qe||{},_f:{...Qe&&Qe._f?Qe._f:{ref:{name:Ke}},name:Ke,mount:!0,...at}}),g.mount.add(Ke),Qe?it({disabled:isBoolean(at.disabled)?at.disabled:e.disabled,name:Ke}):Q(Ke,!0,at.value),{...ct?{disabled:at.disabled||e.disabled}:{},...e.progressive?{required:!!at.required,min:getRuleValue(at.min),max:getRuleValue(at.max),minLength:getRuleValue(at.minLength),maxLength:getRuleValue(at.maxLength),pattern:getRuleValue(at.pattern)}:{},name:Ke,onChange:ze,onBlur:ze,ref:ft=>{if(ft){et(Ke,at),Qe=get(o,Ke);const dt=isUndefined(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,Rt=isRadioOrCheckbox(dt),zt=Qe._f.refs||[];if(Rt?zt.find(Yt=>Yt===dt):dt===Qe._f.ref)return;set(o,Ke,{_f:{...Qe._f,...Rt?{refs:[...zt.filter(live),dt,...Array.isArray(get(l,Ke))?[{}]:[]],ref:{type:dt.type,name:Ke}}:{ref:dt}}}),Q(Ke,!1,void 0,dt)}else Qe=get(o,Ke,{}),Qe._f&&(Qe._f.mount=!1),(e.shouldUnregister||at.shouldUnregister)&&!(isNameInFieldArray(g.array,Ke)&&f.action)&&g.unMount.add(Ke)}}},st=()=>e.shouldFocusError&&iterateFieldsByAction(o,$e,g.mount),ot=Ke=>{isBoolean(Ke)&&(C.state.next({disabled:Ke}),iterateFieldsByAction(o,(at,Qe)=>{const ct=get(o,Qe);ct&&(at.disabled=ct._f.disabled||Ke,Array.isArray(ct._f.refs)&&ct._f.refs.forEach(ft=>{ft.disabled=ct._f.disabled||Ke}))},0,!1))},Ue=(Ke,at)=>async Qe=>{let ct;Qe&&(Qe.preventDefault&&Qe.preventDefault(),Qe.persist&&Qe.persist());let ft=cloneObject(d);if(C.state.next({isSubmitting:!0}),e.resolver){const{errors:dt,values:Rt}=await te();n.errors=dt,ft=Rt}else await se(o);if(g.disabled.size)for(const dt of g.disabled)set(ft,dt,void 0);if(unset(n.errors,"root"),isEmptyObject$1(n.errors)){C.state.next({errors:{}});try{await Ke(ft,Qe)}catch(dt){ct=dt}}else at&&await at({...n.errors},Qe),st(),setTimeout(st);if(C.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject$1(n.errors)&&!ct,submitCount:n.submitCount+1,errors:n.errors}),ct)throw ct},Ct=(Ke,at={})=>{get(o,Ke)&&(isUndefined(at.defaultValue)?Fe(Ke,cloneObject(get(l,Ke))):(Fe(Ke,at.defaultValue),set(l,Ke,cloneObject(at.defaultValue))),at.keepTouched||unset(n.touchedFields,Ke),at.keepDirty||(unset(n.dirtyFields,Ke),n.isDirty=at.defaultValue?oe(Ke,cloneObject(get(l,Ke))):oe()),at.keepError||(unset(n.errors,Ke),S.isValid&&I()),C.state.next({...n}))},Je=(Ke,at={})=>{const Qe=Ke?cloneObject(Ke):l,ct=cloneObject(Qe),ft=isEmptyObject$1(Ke),dt=ft?l:ct;if(at.keepDefaultValues||(l=Qe),!at.keepValues){if(at.keepDirtyValues){const Rt=new Set([...g.mount,...Object.keys(getDirtyFields(l,d))]);for(const zt of Array.from(Rt))get(n.dirtyFields,zt)?set(dt,zt,get(d,zt)):Fe(zt,get(dt,zt))}else{if(isWeb&&isUndefined(Ke))for(const Rt of g.mount){const zt=get(o,Rt);if(zt&&zt._f){const Yt=Array.isArray(zt._f.refs)?zt._f.refs[0]:zt._f.ref;if(isHTMLElement(Yt)){const or=Yt.closest("form");if(or){or.reset();break}}}}for(const Rt of g.mount)Fe(Rt,get(dt,Rt))}d=cloneObject(dt),C.array.next({values:{...dt}}),C.state.next({values:{...dt}})}g={mount:at.keepDirtyValues?g.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},f.mount=!S.isValid||!!at.keepIsValid||!!at.keepDirtyValues,f.watch=!!e.shouldUnregister,C.state.next({submitCount:at.keepSubmitCount?n.submitCount:0,isDirty:ft?!1:at.keepDirty?n.isDirty:!!(at.keepDefaultValues&&!deepEqual$1(Ke,l)),isSubmitted:at.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ft?{}:at.keepDirtyValues?at.keepDefaultValues&&d?getDirtyFields(l,d):n.dirtyFields:at.keepDefaultValues&&Ke?getDirtyFields(l,Ke):at.keepDirty?n.dirtyFields:{},touchedFields:at.keepTouched?n.touchedFields:{},errors:at.keepErrors?n.errors:{},isSubmitSuccessful:at.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},yt=(Ke,at)=>Je(isFunction$3(Ke)?Ke(d):Ke,at),Mt=(Ke,at={})=>{const Qe=get(o,Ke),ct=Qe&&Qe._f;if(ct){const ft=ct.refs?ct.refs[0]:ct.ref;ft.focus&&(ft.focus(),at.shouldSelect&&isFunction$3(ft.select)&&ft.select())}},qt=Ke=>{n={...n,...Ke}},Ft={control:{register:et,unregister:Xe,getFieldState:Ge,handleSubmit:Ue,setError:Ze,_subscribe:Ye,_runSchema:te,_focusError:st,_getWatch:Ae,_getDirty:oe,_setValid:I,_setFieldArray:j,_setDisabledField:it,_setErrors:z,_getFieldArray:je,_reset:Je,_resetDefaultValues:()=>isFunction$3(e.defaultValues)&&e.defaultValues().then(Ke=>{yt(Ke,e.resetOptions),C.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:ot,_subjects:C,_proxyFormState:S,get _fields(){return o},get _formValues(){return d},get _state(){return f},set _state(Ke){f=Ke},get _defaultValues(){return l},get _names(){return g},set _names(Ke){g=Ke},get _formState(){return n},get _options(){return e},set _options(Ke){e={...e,...Ke}}},subscribe:rt,trigger:Be,register:et,handleSubmit:Ue,watch:tt,setValue:Fe,getValues:qe,reset:yt,resetField:Ct,clearErrors:He,unregister:Xe,setError:Ze,setFocus:Mt,getFieldState:Ge};return{...Ft,formControl:Ft}}function useForm(t={}){const e=React.useRef(void 0),n=React.useRef(void 0),[o,l]=React.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$3(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:isFunction$3(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:createFormControl(t),formState:o},t.formControl&&t.defaultValues&&!isFunction$3(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const d=e.current.control;return d._options=t,useIsomorphicLayoutEffect$1(()=>{const f=d._subscribe({formState:d._proxyFormState,callback:()=>l({...d._formState}),reRenderRoot:!0});return l(g=>({...g,isReady:!0})),d._formState.isReady=!0,f},[d]),React.useEffect(()=>d._disableForm(t.disabled),[d,t.disabled]),React.useEffect(()=>{t.mode&&(d._options.mode=t.mode),t.reValidateMode&&(d._options.reValidateMode=t.reValidateMode)},[d,t.mode,t.reValidateMode]),React.useEffect(()=>{t.errors&&(d._setErrors(t.errors),d._focusError())},[d,t.errors]),React.useEffect(()=>{t.shouldUnregister&&d._subjects.state.next({values:d._getWatch()})},[d,t.shouldUnregister]),React.useEffect(()=>{if(d._proxyFormState.isDirty){const f=d._getDirty();f!==o.isDirty&&d._subjects.state.next({isDirty:f})}},[d,o.isDirty]),React.useEffect(()=>{t.values&&!deepEqual$1(t.values,n.current)?(d._reset(t.values,d._options.resetOptions),n.current=t.values,l(f=>({...f}))):d._resetDefaultValues()},[d,t.values]),React.useEffect(()=>{d._state.mount||(d._setValid(),d._state.mount=!0),d._state.watch&&(d._state.watch=!1,d._subjects.state.next({...d._formState})),d._removeUnmounted()}),e.current.formState=getProxyFormState(o,d),e.current}var defaultErrorHandler=function(t){process.env.NODE_ENV!=="production"&&console.error(t)},defaultWarnHandler=function(t){process.env.NODE_ENV!=="production"&&console.warn(t)},DEFAULT_INTL_CONFIG={formats:{},messages:{},timeZone:void 0,defaultLocale:"en",defaultFormats:{},fallbackOnEmptyString:!0,onError:defaultErrorHandler,onWarn:defaultWarnHandler};function invariant(t,e,n){if(n===void 0&&(n=Error),!t)throw new n(e)}function invariantIntlContext(t){invariant(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}__assign$1(__assign$1({},DEFAULT_INTL_CONFIG),{textComponent:React__namespace.Fragment});var reactIs={exports:{}},reactIs_production_min={};/** @license React v16.13.1
|
|
1054
1054
|
* react-is.production.min.js
|
|
1055
1055
|
*
|
|
1056
1056
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -1094,13 +1094,13 @@ $10 with opportunities under $1,000`:t==="D"?"$15 under $1,500":t==="E"?"Full sh
|
|
|
1094
1094
|
* @license MIT
|
|
1095
1095
|
*/function flexRender(t,e){return t?isReactComponent(t)?React__namespace.createElement(t,e):t:null}function isReactComponent(t){return isClassComponent(t)||typeof t=="function"||isExoticComponent(t)}function isClassComponent(t){return typeof t=="function"&&(()=>{const e=Object.getPrototypeOf(t);return e.prototype&&e.prototype.isReactComponent})()}function isExoticComponent(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function useReactTable(t){const e={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[n]=React__namespace.useState(()=>({current:createTable(e)})),[o,l]=React__namespace.useState(()=>n.current.initialState);return n.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:f=>{l(f),t.onStateChange==null||t.onStateChange(f)}})),n.current}function DataTable({columns:t,data:e,uniqueValues:n}){var E;const[o,l]=React.useState([]),[d,f]=React.useState([]),[g,b]=React.useState({pageIndex:0,pageSize:10}),[_,S]=React.useState(null),R=useReactTable({data:e,columns:t,getCoreRowModel:getCoreRowModel(),onSortingChange:l,getSortedRowModel:getSortedRowModel(),onColumnFiltersChange:f,getFilteredRowModel:getFilteredRowModel(),getPaginationRowModel:getPaginationRowModel(),onPaginationChange:b,state:{sorting:o,columnFilters:d,pagination:g}}),C=(A,I)=>{A.toggleSorting(I),S(null)};return jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs(ScrollArea,{className:"rounded-md border",children:[jsxRuntime.jsxs(Table,{children:[jsxRuntime.jsx(TableHeader,{children:R.getHeaderGroups().map(A=>jsxRuntime.jsx(TableRow,{children:A.headers.map(I=>{var M;return jsxRuntime.jsx(TableHead,{children:I.isPlaceholder?null:I.column.getCanSort()||I.column.getCanFilter()?jsxRuntime.jsxs(Popover,{open:_===I.id,onOpenChange:j=>S(j?I.id:null),children:[jsxRuntime.jsx(PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"pl-0",children:[flexRender(I.column.columnDef.header,I.getContext()),I.column.getIsFiltered()?jsxRuntime.jsx(Filter,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="asc"?jsxRuntime.jsx(ArrowUp,{className:"ml-2 h-4 w-4"}):I.column.getIsSorted()==="desc"?jsxRuntime.jsx(ArrowDown,{className:"ml-2 h-4 w-4"}):jsxRuntime.jsx(ArrowUpDown,{className:"ml-2 h-4 w-4"})]})}),jsxRuntime.jsx(PopoverContent,{className:"w-56",children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[I.column.getCanSort()&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!1),children:[jsxRuntime.jsx(ArrowUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),jsxRuntime.jsxs(Button,{variant:"ghost",className:"w-full justify-start",onClick:()=>C(I.column,!0),children:[jsxRuntime.jsx(ArrowDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]})]}),I.column.getCanFilter()&&jsxRuntime.jsx("div",{className:"px-2 py-1",children:n[I.column.id]?jsxRuntime.jsxs(Select,{onValueChange:j=>I.column.setFilterValue(j==="all"?void 0:[j]),children:[jsxRuntime.jsx(SelectTrigger,{children:jsxRuntime.jsx(SelectValue,{placeholder:`Filter ${I.column.columnDef.header}...`})}),jsxRuntime.jsxs(SelectContent,{children:[jsxRuntime.jsx(SelectItem,{value:"all",children:"All"}),(M=n[I.column.id])==null?void 0:M.map(j=>jsxRuntime.jsx(SelectItem,{value:j||"empty",children:j||"(Empty)"},j))]})]}):jsxRuntime.jsx(Input,{placeholder:`Filter ${I.column.columnDef.header}...`,value:I.column.getFilterValue()??"",onChange:j=>I.column.setFilterValue(j.target.value),className:"w-full"})})]})})]}):jsxRuntime.jsx("div",{className:"py-2 px-4",children:flexRender(I.column.columnDef.header,I.getContext())})},I.id)})},A.id))}),jsxRuntime.jsx(TableBody,{children:(E=R.getRowModel().rows)!=null&&E.length?R.getRowModel().rows.map(A=>jsxRuntime.jsx(TableRow,{"data-state":A.getIsSelected()&&"selected",children:A.getVisibleCells().map(I=>jsxRuntime.jsx(TableCell,{children:flexRender(I.column.columnDef.cell,I.getContext())},I.id))},A.id)):jsxRuntime.jsx(TableRow,{children:jsxRuntime.jsx(TableCell,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]}),jsxRuntime.jsx(ScrollBar,{orientation:"horizontal"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),jsxRuntime.jsxs(Select,{value:`${R.getState().pagination.pageSize}`,onValueChange:A=>{R.setPageSize(Number(A))},children:[jsxRuntime.jsx(SelectTrigger,{className:"h-8 w-[70px]",children:jsxRuntime.jsx(SelectValue,{asChild:!0,children:jsxRuntime.jsx("span",{children:R.getState().pagination.pageSize})})}),jsxRuntime.jsx(SelectContent,{side:"top",children:[10,20,30,40,50].map(A=>jsxRuntime.jsx(SelectItem,{value:`${A}`,children:jsxRuntime.jsx("span",{children:A})},A))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(0),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to first page"}),jsxRuntime.jsx(ChevronsLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.previousPage(),disabled:!R.getCanPreviousPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to previous page"}),jsxRuntime.jsx(ChevronLeft,{className:"h-4 w-4"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Page"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getState().pagination.pageIndex+1}),jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"of"}),jsxRuntime.jsx("span",{className:"text-sm font-medium",children:R.getPageCount()})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>R.nextPage(),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to next page"}),jsxRuntime.jsx(ChevronRight,{className:"h-4 w-4"})]}),jsxRuntime.jsxs(Button,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>R.setPageIndex(R.getPageCount()-1),disabled:!R.getCanNextPage(),children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Go to last page"}),jsxRuntime.jsx(ChevronsRight,{className:"h-4 w-4"})]})]})]})]})}function PartnerCard({account:t,action:e,loading:n=!1,className:o,withAbout:l=!1,withVoice:d=!0}){const[f,g]=React.useState(!1),[b,_]=React.useState(!0),[S,R]=React.useState(null),[C,E]=React.useState(!1),A=React.useMemo(()=>t!=null&&t.ApplicationId?{videoUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video`,videoExistsUrl:`https://api.randmar.io/V4/Partner/${t.ApplicationId}/Account/Video/Exists`}:null,[t==null?void 0:t.ApplicationId]);React.useEffect(()=>{if(!A||n)return;R(null);const M=async()=>{try{const q=await fetch(A.videoExistsUrl);if(q.ok){const z=await q.text();g(z.toLowerCase()==="true")}else throw new Error(`Failed to check video: ${q.status}`)}catch(q){console.error("Failed to check if video exists:",q),g(!1)}};(async()=>{M()})()},[A,n]);const I=()=>{_(!1)};return n||!t?jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"}),jsxRuntime.jsx(Skeleton,{className:"h-3 w-16"})]}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-48 mt-1"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"})]}),l&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-full"})]}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]})]})})]})}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-48"})]})]}):jsxRuntime.jsxs(Card,{className:`flex flex-col h-full ${o}`,children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ApplicationId,width:64,height:64})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Partner"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.ApplicationId})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"})]})]})}),jsxRuntime.jsxs(CardContent,{className:"pb-2 flex-grow",children:[S&&jsxRuntime.jsx("div",{className:"text-red-500 mb-4 text-sm",role:"alert",children:S}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[(t.IsManufacturer||t.IsReseller||t.IsSalesAgency)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.IsManufacturer&&jsxRuntime.jsx(Badge,{className:"manufacturer-theme",children:"Manufacturer"}),t.IsReseller&&jsxRuntime.jsx(Badge,{className:"reseller-theme",children:"Reseller"}),t.IsSalesAgency&&jsxRuntime.jsx(Badge,{children:"Agency"})]}),l&&t.About&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.About??""}}),d&&jsxRuntime.jsx("div",{className:"p-3 bg-slate-50 rounded-md",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-1 @lg:grid-cols-3 gap-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceName??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Voice Style"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.VoiceStyle??"Regular"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Scene Name"}),jsxRuntime.jsx("div",{className:"font-medium",children:t.SceneName??"N/A"})]})]})})]})]}),jsxRuntime.jsxs(CardFooter,{className:"px-6 py-4 flex justify-between gap-2 mt-auto",children:[f&&A?jsxRuntime.jsxs(Dialog,{open:C,onOpenChange:E,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"outline",className:"flex items-center gap-2",children:[jsxRuntime.jsx(Video,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:"Watch Video"})]})}),jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[360px]",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{children:[t.PublicName," Video"]})}),jsxRuntime.jsxs("div",{className:"w-full h-[640px] rounded-md overflow-hidden",children:[b&&jsxRuntime.jsx(Skeleton,{className:"w-full h-full"}),jsxRuntime.jsx("video",{src:A.videoUrl,controls:!0,preload:"auto",playsInline:!0,autoPlay:!0,"aria-label":`Video for ${t.PublicName}`,className:`w-full h-full object-cover ${b?"invisible":"visible"}`,style:{objectPosition:"center",imageRendering:"auto"},onLoadedData:I,onError:()=>_(!1)})]})]})]}):jsxRuntime.jsx("div",{}),e||jsxRuntime.jsxs(Button,{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ExternalLink,{className:"h-4 w-4"}),"Go to Partner Dashboard"]})]})]})}function ResellerCard({reseller:t,link:e,linkNewTab:n=!0,actions:o,mainAction:l,loading:d=!1}){var R,C;if(d||!t)return jsxRuntime.jsxs(Card,{className:"flex flex-col h-full",children:[jsxRuntime.jsx(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-12 rounded-md"}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-24 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-40 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-48"})]})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsx("div",{className:"flex",children:jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-16 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-14 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-32"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-40"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-4"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-36"})]})]})]})})}),jsxRuntime.jsxs(CardFooter,{className:"flex justify-between pt-2 gap-2 mt-auto",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-40"})]})]});const f=t.ResellerId||"N/A",g=[t.City,t.Province,t.Country].filter(Boolean),b=g.length>0?g.join(", "):"Location not provided",S=(E=>!E||E.length===0?[]:[...E].sort((A,I)=>(A.Day||0)-(I.Day||0)).map(A=>({date:A.Day||0,amount:A.ExtendedPrice||0})))(t.SalesStatistics);return jsxRuntime.jsxs(Card,{className:"reseller-theme flex flex-col h-full",children:[jsxRuntime.jsx(reactRouterDom.Link,{to:e??"#",target:e&&n?"_blank":"_self",children:jsxRuntime.jsxs(CardHeader,{className:"flex flex-row items-start justify-between space-y-0 pb-2 pt-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"h-12 w-12 overflow-hidden rounded-md",children:jsxRuntime.jsx(PartnerLogo,{id:t.ResellerId,width:48,height:48})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs text-primary",children:"Reseller"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"|"}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:f})]}),jsxRuntime.jsx("h3",{className:"font-semibold",children:t.PublicName||"N/A"}),t.Name&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:t.Name}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground",children:b})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col items-end gap-2",children:S.length>0&&jsxRuntime.jsx("div",{className:"h-16 w-24",children:jsxRuntime.jsx(AreaChart,{data:S,height:60,size:"mini"})})})]})}),jsxRuntime.jsx(CardContent,{className:"pb-2 flex-grow",children:jsxRuntime.jsxs("div",{className:"flex",children:[jsxRuntime.jsxs("div",{className:"flex flex-col flex-1 space-y-2",children:[(!!((R=t.Qualification)!=null&&R.QualificationId)&&((C=t.Qualification)==null?void 0:C.QualificationId)!=="Suspended"||!!t.OnHold&&t.OnHold!==0)&&jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[jsxRuntime.jsx(QualificationBadge,{qualification:t.Qualification??{}}),!!t.OnHold&&t.OnHold!==0&&jsxRuntime.jsx(Badge,{variant:"warning",children:"On Hold"})]}),jsxRuntime.jsxs("div",{className:"space-y-1 pt-2",children:[t.Phone&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`tel:${t.Phone}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Phone,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Phone})]}),t.PublicEmail&&jsxRuntime.jsxs(reactRouterDom.Link,{to:`mailto:${t.PublicEmail}`,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Mail,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.PublicEmail})]}),t.Website&&jsxRuntime.jsxs(reactRouterDom.Link,{to:t.Website,target:"_blank",className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(Globe,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.Website})]}),t.CurrencyCode&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[jsxRuntime.jsx(DollarSign,{className:"h-4 w-4"}),jsxRuntime.jsx("span",{children:t.CurrencyCode})]})]})]}),(t==null?void 0:t.SalesData)&&jsxRuntime.jsxs("div",{className:"border-l pl-2 ml-2 flex flex-col text-sm",children:[jsxRuntime.jsx("strong",{className:"",children:"YTD"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesYearToDay?formatMoney(t==null?void 0:t.SalesData.SalesYearToDay):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"3 mo."}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast3Months?formatMoney(t==null?void 0:t.SalesData.SalesLast3Months):"—"}),jsxRuntime.jsx("strong",{className:"mt-2",children:"30 days"}),jsxRuntime.jsx("p",{children:t!=null&&t.SalesData.SalesLast30Days?formatMoney(t==null?void 0:t.SalesData.SalesLast30Days):"—"})]})]})}),(o||l)&&jsxRuntime.jsxs(CardFooter,{className:"flex pt-2 gap-2 justify-between mt-auto",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:o&&o}),l&&jsxRuntime.jsx("div",{children:l})]})]})}const Table=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("div",{className:"relative w-full overflow-auto",children:jsxRuntime.jsx("table",{ref:n,className:cn("w-full caption-bottom text-sm",t),...e})}));Table.displayName="Table";const TableHeader=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("thead",{ref:n,className:cn("[&_tr]:border-b",t),...e}));TableHeader.displayName="TableHeader";const TableBody=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tbody",{ref:n,className:cn("[&_tr:last-child]:border-0",t),...e}));TableBody.displayName="TableBody";const TableFooter=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tfoot",{ref:n,className:cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));TableFooter.displayName="TableFooter";const TableRow=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("tr",{ref:n,className:cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));TableRow.displayName="TableRow";const TableHead=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("th",{ref:n,className:cn("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableHead.displayName="TableHead";const TableCell=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("td",{ref:n,className:cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e,children:React__namespace.isValidElement(e.children)&&e.children.type==="span"?e.children:jsxRuntime.jsx("span",{children:e.children})}));TableCell.displayName="TableCell";const TableCaption=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx("caption",{ref:n,className:cn("mt-4 text-sm text-muted-foreground",t),...e}));TableCaption.displayName="TableCaption";const Topbar=React.forwardRef(({onSignOut:t,handleValidSearch:e,rightMenu:n,searchPlaceholder:o},l)=>{const[d,f]=React.useState(""),g=reactRouterDom.useLocation(),{toast:b}=useToast();React.useEffect(()=>{const C=new URLSearchParams(g.search).get("q");C&&f(C)},[g.search]);const _=()=>{const R=d.trim();if(!R||R.length<2){b({title:"Enter more characters to search",description:"At least 2 characters are needed to search products.",variant:"destructive",duration:5e3});return}e(R)},S=R=>{R.key==="Enter"&&_()};return jsxRuntime.jsxs("header",{className:"flex h-16 items-center gap-4 border-b sidebar-foreground bg-sidebar px-6 fixed top-0 right-0 z-50 lg:left-64 left-0 border-sidebar-border",children:[jsxRuntime.jsx(SidebarTrigger,{className:"lg:hidden",children:jsxRuntime.jsx(Menu$1,{className:"h-6 w-6"})}),jsxRuntime.jsx("div",{className:"flex flex-1 items-center gap-4",children:jsxRuntime.jsx("div",{className:"relative w-full max-w-sm",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{type:"button",className:"absolute left-2 top-1/2 -translate-y-1/2",onClick:_,"aria-label":"Search",children:jsxRuntime.jsx(Search,{className:"h-4 w-4 text-muted-foreground"})}),jsxRuntime.jsx(Input,{placeholder:o??"Search...",className:"w-full pl-8 bg-white text-black",value:d,onChange:R=>f(R.target.value),onKeyDown:S,ref:l},"topbar-search")]})})}),n||jsxRuntime.jsx(jsxRuntime.Fragment,{}),t&&jsxRuntime.jsx("div",{className:"flex items-center gap-4",children:jsxRuntime.jsxs(Button,{variant:"ghost",size:"icon",className:"h-9 w-9",onClick:t,children:[jsxRuntime.jsx(LogOut,{className:"h-4 w-4 text-sidebar-foreground"}),jsxRuntime.jsx("span",{className:"sr-only",children:"Sign out"})]})})]})});Topbar.displayName="Topbar";function ActiveOrdersCard({orders:t,loading:e=!1}){const n=React.useMemo(()=>{if(!t||t.length===0)return{all:{orders:0,amount:0},processing:{orders:0,amount:0},shipped:{orders:0,amount:0},delayed:{orders:0,amount:0}};const l=t.filter(M=>M.DocumentType==="Order"),d=t.filter(M=>M.DocumentType==="Shipment"),f=l.filter(M=>M.WarehouseCode!=="3PLE"),g=f.reduce((M,j)=>M+(j.Quantity||0),0),b=f.reduce((M,j)=>M+(j.ExtendedPrice||0),0),_=l.filter(M=>M.WarehouseCode==="3PLE"),S=_.reduce((M,j)=>M+(j.Quantity||0),0),R=_.reduce((M,j)=>M+(j.ExtendedPrice||0),0),C=d.length,E=d.reduce((M,j)=>M+(j.ExtendedPrice||0),0),A=g+S+C,I=b+R+E;return{all:{orders:A,amount:I},processing:{orders:g,amount:b},shipped:{orders:C,amount:E},delayed:{orders:S,amount:R}}},[t]),o=[{name:"All",icon:Package,color:"bg-blue-500",textColor:"text-blue-600",orders:n.all.orders,amount:n.all.amount},{name:"Processing",icon:RefreshCcw,color:"bg-yellow-500",textColor:"text-yellow-600",orders:n.processing.orders,amount:n.processing.amount},{name:"Shipped",icon:Truck,color:"bg-green-500",textColor:"text-green-600",orders:n.shipped.orders,amount:n.shipped.amount},{name:"Delayed",icon:CircleAlert,color:"bg-red-500",textColor:"text-red-600",orders:n.delayed.orders,amount:n.delayed.amount}];return e?jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:[1,2,3,4].map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:"bg-slate-200 dark:bg-slate-700 h-[3px]"}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-8 w-8 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-7 w-12"})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx(Skeleton,{className:"h-3 w-16 mb-2"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]})]})]},l))})]}):jsxRuntime.jsxs(Card,{children:[jsxRuntime.jsx(CardHeader,{className:"pb-0",children:jsxRuntime.jsx(CardTitle,{className:"text-lg font-bold",children:"Active Orders"})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 @sm:grid-cols-2 gap-4 p-4",children:o.map(l=>jsxRuntime.jsxs("div",{className:"overflow-hidden rounded-md border",children:[jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-60 h-[3px]`}),jsxRuntime.jsxs("div",{className:"p-6 border border-t-0",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-4",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-base",children:l.name}),jsxRuntime.jsx("div",{className:`${l.color} bg-opacity-90 p-2 rounded-full`,children:jsxRuntime.jsx(l.icon,{className:"size-4 shrink-0 text-white"})})]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Orders"}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:l.orders})]}),jsxRuntime.jsxs("div",{className:"text-end",children:[jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Amount"}),jsxRuntime.jsx("p",{className:"text-base font-semibold",children:formatMoney(l.amount)})]})]})]})]},l.name))})]})}var __create=Object.create,__getProtoOf=Object.getPrototypeOf,__defProp=Object.defineProperty,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(t,e,n)=>{n=t!=null?__create(__getProtoOf(t)):{};const o=e||!t||!t.__esModule?__defProp(n,"default",{value:t,enumerable:!0}):n;for(let l of __getOwnPropNames(t))__hasOwnProp.call(o,l)||__defProp(o,l,{get:()=>t[l],enumerable:!0});return o},__commonJS=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),require_xhtml=__commonJS((t,e)=>{e.exports={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}}),require_acorn=__commonJS((t,e)=>{(function(n,o){typeof t=="object"&&typeof e<"u"?o(t):typeof define=="function"&&define.amd?define(["exports"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.acorn={}))})(t,function(n){var o=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],l=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],d="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",f="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",g={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",_={5:b,"5module":b+" export import",6:b+" const class extends export import super"},S=/^in(stanceof)?$/,R=new RegExp("["+f+"]"),C=new RegExp("["+f+d+"]");function E(O,ae){for(var Ve=65536,Le=0;Le<ae.length;Le+=2){if(Ve+=ae[Le],Ve>O)return!1;if(Ve+=ae[Le+1],Ve>=O)return!0}return!1}function A(O,ae){return O<65?O===36:O<91?!0:O<97?O===95:O<123?!0:O<=65535?O>=170&&R.test(String.fromCharCode(O)):ae===!1?!1:E(O,l)}function I(O,ae){return O<48?O===36:O<58?!0:O<65?!1:O<91?!0:O<97?O===95:O<123?!0:O<=65535?O>=170&&C.test(String.fromCharCode(O)):ae===!1?!1:E(O,l)||E(O,o)}var M=function(ae,Ve){Ve===void 0&&(Ve={}),this.label=ae,this.keyword=Ve.keyword,this.beforeExpr=!!Ve.beforeExpr,this.startsExpr=!!Ve.startsExpr,this.isLoop=!!Ve.isLoop,this.isAssign=!!Ve.isAssign,this.prefix=!!Ve.prefix,this.postfix=!!Ve.postfix,this.binop=Ve.binop||null,this.updateContext=null};function j(O,ae){return new M(O,{beforeExpr:!0,binop:ae})}var q={beforeExpr:!0},z={startsExpr:!0},Q={};function F(O,ae){return ae===void 0&&(ae={}),ae.keyword=O,Q[O]=new M(O,ae)}var V={num:new M("num",z),regexp:new M("regexp",z),string:new M("string",z),name:new M("name",z),privateId:new M("privateId",z),eof:new M("eof"),bracketL:new M("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new M("]"),braceL:new M("{",{beforeExpr:!0,startsExpr:!0}),braceR:new M("}"),parenL:new M("(",{beforeExpr:!0,startsExpr:!0}),parenR:new M(")"),comma:new M(",",q),semi:new M(";",q),colon:new M(":",q),dot:new M("."),question:new M("?",q),questionDot:new M("?."),arrow:new M("=>",q),template:new M("template"),invalidTemplate:new M("invalidTemplate"),ellipsis:new M("...",q),backQuote:new M("`",z),dollarBraceL:new M("${",{beforeExpr:!0,startsExpr:!0}),eq:new M("=",{beforeExpr:!0,isAssign:!0}),assign:new M("_=",{beforeExpr:!0,isAssign:!0}),incDec:new M("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new M("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:j("||",1),logicalAND:j("&&",2),bitwiseOR:j("|",3),bitwiseXOR:j("^",4),bitwiseAND:j("&",5),equality:j("==/!=/===/!==",6),relational:j("</>/<=/>=",7),bitShift:j("<</>>/>>>",8),plusMin:new M("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:j("%",10),star:j("*",10),slash:j("/",10),starstar:new M("**",{beforeExpr:!0}),coalesce:j("??",1),_break:F("break"),_case:F("case",q),_catch:F("catch"),_continue:F("continue"),_debugger:F("debugger"),_default:F("default",q),_do:F("do",{isLoop:!0,beforeExpr:!0}),_else:F("else",q),_finally:F("finally"),_for:F("for",{isLoop:!0}),_function:F("function",z),_if:F("if"),_return:F("return",q),_switch:F("switch"),_throw:F("throw",q),_try:F("try"),_var:F("var"),_const:F("const"),_while:F("while",{isLoop:!0}),_with:F("with"),_new:F("new",{beforeExpr:!0,startsExpr:!0}),_this:F("this",z),_super:F("super",z),_class:F("class",z),_extends:F("extends",q),_export:F("export"),_import:F("import",z),_null:F("null",z),_true:F("true",z),_false:F("false",z),_in:F("in",{beforeExpr:!0,binop:7}),_instanceof:F("instanceof",{beforeExpr:!0,binop:7}),_typeof:F("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:F("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:F("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},te=/\r\n?|\n|\u2028|\u2029/,ne=new RegExp(te.source,"g");function se(O){return O===10||O===13||O===8232||O===8233}function ge(O,ae,Ve){Ve===void 0&&(Ve=O.length);for(var Le=ae;Le<Ve;Le++){var We=O.charCodeAt(Le);if(se(We))return Le<Ve-1&&We===13&&O.charCodeAt(Le+1)===10?Le+2:Le+1}return-1}var oe=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,Ae=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,je=Object.prototype,Ne=je.hasOwnProperty,Oe=je.toString,Fe=Object.hasOwn||function(O,ae){return Ne.call(O,ae)},ze=Array.isArray||function(O){return Oe.call(O)==="[object Array]"},$e=Object.create(null);function Be(O){return $e[O]||($e[O]=new RegExp("^(?:"+O.replace(/ /g,"|")+")$"))}function qe(O){return O<=65535?String.fromCharCode(O):(O-=65536,String.fromCharCode((O>>10)+55296,(O&1023)+56320))}var Ge=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,He=function(ae,Ve){this.line=ae,this.column=Ve};He.prototype.offset=function(ae){return new He(this.line,this.column+ae)};var Ze=function(ae,Ve,Le){this.start=Ve,this.end=Le,ae.sourceFile!==null&&(this.source=ae.sourceFile)};function tt(O,ae){for(var Ve=1,Le=0;;){var We=ge(O,Le,ae);if(We<0)return new He(Ve,ae-Le);++Ve,Le=We}}var Ye={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},rt=!1;function Xe(O){var ae={};for(var Ve in Ye)ae[Ve]=O&&Fe(O,Ve)?O[Ve]:Ye[Ve];if(ae.ecmaVersion==="latest"?ae.ecmaVersion=1e8:ae.ecmaVersion==null?(!rt&&typeof console=="object"&&console.warn&&(rt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
1096
1096
|
Defaulting to 2020, but this will stop working in the future.`)),ae.ecmaVersion=11):ae.ecmaVersion>=2015&&(ae.ecmaVersion-=2009),ae.allowReserved==null&&(ae.allowReserved=ae.ecmaVersion<5),(!O||O.allowHashBang==null)&&(ae.allowHashBang=ae.ecmaVersion>=14),ze(ae.onToken)){var Le=ae.onToken;ae.onToken=function(We){return Le.push(We)}}return ze(ae.onComment)&&(ae.onComment=it(ae,ae.onComment)),ae}function it(O,ae){return function(Ve,Le,We,lt,ut,$t){var Dt={type:Ve?"Block":"Line",value:Le,start:We,end:lt};O.locations&&(Dt.loc=new Ze(this,ut,$t)),O.ranges&&(Dt.range=[We,lt]),ae.push(Dt)}}var et=1,st=2,ot=4,Ue=8,Ct=16,Je=32,yt=64,Mt=128,qt=256,Ht=et|st|qt;function Ft(O,ae){return st|(O?ot:0)|(ae?Ue:0)}var Ke=0,at=1,Qe=2,ct=3,ft=4,dt=5,Rt=function(ae,Ve,Le){this.options=ae=Xe(ae),this.sourceFile=ae.sourceFile,this.keywords=Be(_[ae.ecmaVersion>=6?6:ae.sourceType==="module"?"5module":5]);var We="";ae.allowReserved!==!0&&(We=g[ae.ecmaVersion>=6?6:ae.ecmaVersion===5?5:3],ae.sourceType==="module"&&(We+=" await")),this.reservedWords=Be(We);var lt=(We?We+" ":"")+g.strict;this.reservedWordsStrict=Be(lt),this.reservedWordsStrictBind=Be(lt+" "+g.strictBind),this.input=String(Ve),this.containsEsc=!1,Le?(this.pos=Le,this.lineStart=this.input.lastIndexOf(`
|
|
1097
|
-
`,Le-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=V.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=ae.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&ae.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(et),this.regexpState=null,this.privateNameStack=[]},zt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Rt.prototype.parse=function(){var ae=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(ae)},zt.inFunction.get=function(){return(this.currentVarScope().flags&st)>0},zt.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0&&!this.currentVarScope().inClassFieldInit},zt.inAsync.get=function(){return(this.currentVarScope().flags&ot)>0&&!this.currentVarScope().inClassFieldInit},zt.canAwait.get=function(){for(var O=this.scopeStack.length-1;O>=0;O--){var ae=this.scopeStack[O];if(ae.inClassFieldInit||ae.flags&qt)return!1;if(ae.flags&st)return(ae.flags&ot)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},zt.allowSuper.get=function(){var O=this.currentThisScope(),ae=O.flags,Ve=O.inClassFieldInit;return(ae&yt)>0||Ve||this.options.allowSuperOutsideMethod},zt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Mt)>0},zt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},zt.allowNewDotTarget.get=function(){var O=this.currentThisScope(),ae=O.flags,Ve=O.inClassFieldInit;return(ae&(st|qt))>0||Ve},zt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&qt)>0},Rt.extend=function(){for(var ae=[],Ve=arguments.length;Ve--;)ae[Ve]=arguments[Ve];for(var Le=this,We=0;We<ae.length;We++)Le=ae[We](Le);return Le},Rt.parse=function(ae,Ve){return new this(Ve,ae).parse()},Rt.parseExpressionAt=function(ae,Ve,Le){var We=new this(Le,ae,Ve);return We.nextToken(),We.parseExpression()},Rt.tokenizer=function(ae,Ve){return new this(Ve,ae)},Object.defineProperties(Rt.prototype,zt);var Yt=Rt.prototype,or=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Yt.strictDirective=function(O){if(this.options.ecmaVersion<5)return!1;for(;;){Ae.lastIndex=O,O+=Ae.exec(this.input)[0].length;var ae=or.exec(this.input.slice(O));if(!ae)return!1;if((ae[1]||ae[2])==="use strict"){Ae.lastIndex=O+ae[0].length;var Ve=Ae.exec(this.input),Le=Ve.index+Ve[0].length,We=this.input.charAt(Le);return We===";"||We==="}"||te.test(Ve[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(We)||We==="!"&&this.input.charAt(Le+1)==="=")}O+=ae[0].length,Ae.lastIndex=O,O+=Ae.exec(this.input)[0].length,this.input[O]===";"&&O++}},Yt.eat=function(O){return this.type===O?(this.next(),!0):!1},Yt.isContextual=function(O){return this.type===V.name&&this.value===O&&!this.containsEsc},Yt.eatContextual=function(O){return this.isContextual(O)?(this.next(),!0):!1},Yt.expectContextual=function(O){this.eatContextual(O)||this.unexpected()},Yt.canInsertSemicolon=function(){return this.type===V.eof||this.type===V.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},Yt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Yt.semicolon=function(){!this.eat(V.semi)&&!this.insertSemicolon()&&this.unexpected()},Yt.afterTrailingComma=function(O,ae){if(this.type===O)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),ae||this.next(),!0},Yt.expect=function(O){this.eat(O)||this.unexpected()},Yt.unexpected=function(O){this.raise(O??this.start,"Unexpected token")};var dr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Yt.checkPatternErrors=function(O,ae){if(O){O.trailingComma>-1&&this.raiseRecoverable(O.trailingComma,"Comma is not permitted after the rest element");var Ve=ae?O.parenthesizedAssign:O.parenthesizedBind;Ve>-1&&this.raiseRecoverable(Ve,ae?"Assigning to rvalue":"Parenthesized pattern")}},Yt.checkExpressionErrors=function(O,ae){if(!O)return!1;var Ve=O.shorthandAssign,Le=O.doubleProto;if(!ae)return Ve>=0||Le>=0;Ve>=0&&this.raise(Ve,"Shorthand property assignments are valid only in destructuring patterns"),Le>=0&&this.raiseRecoverable(Le,"Redefinition of __proto__ property")},Yt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Yt.isSimpleAssignTarget=function(O){return O.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(O.expression):O.type==="Identifier"||O.type==="MemberExpression"};var pt=Rt.prototype;pt.parseTopLevel=function(O){var ae=Object.create(null);for(O.body||(O.body=[]);this.type!==V.eof;){var Ve=this.parseStatement(null,!0,ae);O.body.push(Ve)}if(this.inModule)for(var Le=0,We=Object.keys(this.undefinedExports);Le<We.length;Le+=1){var lt=We[Le];this.raiseRecoverable(this.undefinedExports[lt].start,"Export '"+lt+"' is not defined")}return this.adaptDirectivePrologue(O.body),this.next(),O.sourceType=this.options.sourceType,this.finishNode(O,"Program")};var Sr={kind:"loop"},mt={kind:"switch"};pt.isLet=function(O){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Ae.lastIndex=this.pos;var ae=Ae.exec(this.input),Ve=this.pos+ae[0].length,Le=this.input.charCodeAt(Ve);if(Le===91||Le===92)return!0;if(O)return!1;if(Le===123||Le>55295&&Le<56320)return!0;if(A(Le,!0)){for(var We=Ve+1;I(Le=this.input.charCodeAt(We),!0);)++We;if(Le===92||Le>55295&&Le<56320)return!0;var lt=this.input.slice(Ve,We);if(!S.test(lt))return!0}return!1},pt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Ae.lastIndex=this.pos;var O=Ae.exec(this.input),ae=this.pos+O[0].length,Ve;return!te.test(this.input.slice(this.pos,ae))&&this.input.slice(ae,ae+8)==="function"&&(ae+8===this.input.length||!(I(Ve=this.input.charCodeAt(ae+8))||Ve>55295&&Ve<56320))},pt.parseStatement=function(O,ae,Ve){var Le=this.type,We=this.startNode(),lt;switch(this.isLet(O)&&(Le=V._var,lt="let"),Le){case V._break:case V._continue:return this.parseBreakContinueStatement(We,Le.keyword);case V._debugger:return this.parseDebuggerStatement(We);case V._do:return this.parseDoStatement(We);case V._for:return this.parseForStatement(We);case V._function:return O&&(this.strict||O!=="if"&&O!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(We,!1,!O);case V._class:return O&&this.unexpected(),this.parseClass(We,!0);case V._if:return this.parseIfStatement(We);case V._return:return this.parseReturnStatement(We);case V._switch:return this.parseSwitchStatement(We);case V._throw:return this.parseThrowStatement(We);case V._try:return this.parseTryStatement(We);case V._const:case V._var:return lt=lt||this.value,O&<!=="var"&&this.unexpected(),this.parseVarStatement(We,lt);case V._while:return this.parseWhileStatement(We);case V._with:return this.parseWithStatement(We);case V.braceL:return this.parseBlock(!0,We);case V.semi:return this.parseEmptyStatement(We);case V._export:case V._import:if(this.options.ecmaVersion>10&&Le===V._import){Ae.lastIndex=this.pos;var ut=Ae.exec(this.input),$t=this.pos+ut[0].length,Dt=this.input.charCodeAt($t);if(Dt===40||Dt===46)return this.parseExpressionStatement(We,this.parseExpression())}return this.options.allowImportExportEverywhere||(ae||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),Le===V._import?this.parseImport(We):this.parseExport(We,Ve);default:if(this.isAsyncFunction())return O&&this.unexpected(),this.next(),this.parseFunctionStatement(We,!0,!O);var Qt=this.value,Jt=this.parseExpression();return Le===V.name&&Jt.type==="Identifier"&&this.eat(V.colon)?this.parseLabeledStatement(We,Qt,Jt,O):this.parseExpressionStatement(We,Jt)}},pt.parseBreakContinueStatement=function(O,ae){var Ve=ae==="break";this.next(),this.eat(V.semi)||this.insertSemicolon()?O.label=null:this.type!==V.name?this.unexpected():(O.label=this.parseIdent(),this.semicolon());for(var Le=0;Le<this.labels.length;++Le){var We=this.labels[Le];if((O.label==null||We.name===O.label.name)&&(We.kind!=null&&(Ve||We.kind==="loop")||O.label&&Ve))break}return Le===this.labels.length&&this.raise(O.start,"Unsyntactic "+ae),this.finishNode(O,Ve?"BreakStatement":"ContinueStatement")},pt.parseDebuggerStatement=function(O){return this.next(),this.semicolon(),this.finishNode(O,"DebuggerStatement")},pt.parseDoStatement=function(O){return this.next(),this.labels.push(Sr),O.body=this.parseStatement("do"),this.labels.pop(),this.expect(V._while),O.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(V.semi):this.semicolon(),this.finishNode(O,"DoWhileStatement")},pt.parseForStatement=function(O){this.next();var ae=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Sr),this.enterScope(0),this.expect(V.parenL),this.type===V.semi)return ae>-1&&this.unexpected(ae),this.parseFor(O,null);var Ve=this.isLet();if(this.type===V._var||this.type===V._const||Ve){var Le=this.startNode(),We=Ve?"let":this.value;return this.next(),this.parseVar(Le,!0,We),this.finishNode(Le,"VariableDeclaration"),(this.type===V._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Le.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===V._in?ae>-1&&this.unexpected(ae):O.await=ae>-1),this.parseForIn(O,Le)):(ae>-1&&this.unexpected(ae),this.parseFor(O,Le))}var lt=this.isContextual("let"),ut=!1,$t=this.containsEsc,Dt=new dr,Qt=this.start,Jt=ae>-1?this.parseExprSubscripts(Dt,"await"):this.parseExpression(!0,Dt);return this.type===V._in||(ut=this.options.ecmaVersion>=6&&this.isContextual("of"))?(ae>-1?(this.type===V._in&&this.unexpected(ae),O.await=!0):ut&&this.options.ecmaVersion>=8&&(Jt.start===Qt&&!$t&&Jt.type==="Identifier"&&Jt.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(O.await=!1)),lt&&ut&&this.raise(Jt.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Jt,!1,Dt),this.checkLValPattern(Jt),this.parseForIn(O,Jt)):(this.checkExpressionErrors(Dt,!0),ae>-1&&this.unexpected(ae),this.parseFor(O,Jt))},pt.parseFunctionStatement=function(O,ae,Ve){return this.next(),this.parseFunction(O,Wt|(Ve?0:nr),!1,ae)},pt.parseIfStatement=function(O){return this.next(),O.test=this.parseParenExpression(),O.consequent=this.parseStatement("if"),O.alternate=this.eat(V._else)?this.parseStatement("if"):null,this.finishNode(O,"IfStatement")},pt.parseReturnStatement=function(O){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(V.semi)||this.insertSemicolon()?O.argument=null:(O.argument=this.parseExpression(),this.semicolon()),this.finishNode(O,"ReturnStatement")},pt.parseSwitchStatement=function(O){this.next(),O.discriminant=this.parseParenExpression(),O.cases=[],this.expect(V.braceL),this.labels.push(mt),this.enterScope(0);for(var ae,Ve=!1;this.type!==V.braceR;)if(this.type===V._case||this.type===V._default){var Le=this.type===V._case;ae&&this.finishNode(ae,"SwitchCase"),O.cases.push(ae=this.startNode()),ae.consequent=[],this.next(),Le?ae.test=this.parseExpression():(Ve&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),Ve=!0,ae.test=null),this.expect(V.colon)}else ae||this.unexpected(),ae.consequent.push(this.parseStatement(null));return this.exitScope(),ae&&this.finishNode(ae,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(O,"SwitchStatement")},pt.parseThrowStatement=function(O){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),O.argument=this.parseExpression(),this.semicolon(),this.finishNode(O,"ThrowStatement")};var Zt=[];pt.parseCatchClauseParam=function(){var O=this.parseBindingAtom(),ae=O.type==="Identifier";return this.enterScope(ae?Je:0),this.checkLValPattern(O,ae?ft:Qe),this.expect(V.parenR),O},pt.parseTryStatement=function(O){if(this.next(),O.block=this.parseBlock(),O.handler=null,this.type===V._catch){var ae=this.startNode();this.next(),this.eat(V.parenL)?ae.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),ae.param=null,this.enterScope(0)),ae.body=this.parseBlock(!1),this.exitScope(),O.handler=this.finishNode(ae,"CatchClause")}return O.finalizer=this.eat(V._finally)?this.parseBlock():null,!O.handler&&!O.finalizer&&this.raise(O.start,"Missing catch or finally clause"),this.finishNode(O,"TryStatement")},pt.parseVarStatement=function(O,ae,Ve){return this.next(),this.parseVar(O,!1,ae,Ve),this.semicolon(),this.finishNode(O,"VariableDeclaration")},pt.parseWhileStatement=function(O){return this.next(),O.test=this.parseParenExpression(),this.labels.push(Sr),O.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(O,"WhileStatement")},pt.parseWithStatement=function(O){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),O.object=this.parseParenExpression(),O.body=this.parseStatement("with"),this.finishNode(O,"WithStatement")},pt.parseEmptyStatement=function(O){return this.next(),this.finishNode(O,"EmptyStatement")},pt.parseLabeledStatement=function(O,ae,Ve,Le){for(var We=0,lt=this.labels;We<lt.length;We+=1){var ut=lt[We];ut.name===ae&&this.raise(Ve.start,"Label '"+ae+"' is already declared")}for(var $t=this.type.isLoop?"loop":this.type===V._switch?"switch":null,Dt=this.labels.length-1;Dt>=0;Dt--){var Qt=this.labels[Dt];if(Qt.statementStart===O.start)Qt.statementStart=this.start,Qt.kind=$t;else break}return this.labels.push({name:ae,kind:$t,statementStart:this.start}),O.body=this.parseStatement(Le?Le.indexOf("label")===-1?Le+"label":Le:"label"),this.labels.pop(),O.label=Ve,this.finishNode(O,"LabeledStatement")},pt.parseExpressionStatement=function(O,ae){return O.expression=ae,this.semicolon(),this.finishNode(O,"ExpressionStatement")},pt.parseBlock=function(O,ae,Ve){for(O===void 0&&(O=!0),ae===void 0&&(ae=this.startNode()),ae.body=[],this.expect(V.braceL),O&&this.enterScope(0);this.type!==V.braceR;){var Le=this.parseStatement(null);ae.body.push(Le)}return Ve&&(this.strict=!1),this.next(),O&&this.exitScope(),this.finishNode(ae,"BlockStatement")},pt.parseFor=function(O,ae){return O.init=ae,this.expect(V.semi),O.test=this.type===V.semi?null:this.parseExpression(),this.expect(V.semi),O.update=this.type===V.parenR?null:this.parseExpression(),this.expect(V.parenR),O.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(O,"ForStatement")},pt.parseForIn=function(O,ae){var Ve=this.type===V._in;return this.next(),ae.type==="VariableDeclaration"&&ae.declarations[0].init!=null&&(!Ve||this.options.ecmaVersion<8||this.strict||ae.kind!=="var"||ae.declarations[0].id.type!=="Identifier")&&this.raise(ae.start,(Ve?"for-in":"for-of")+" loop variable declaration may not have an initializer"),O.left=ae,O.right=Ve?this.parseExpression():this.parseMaybeAssign(),this.expect(V.parenR),O.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(O,Ve?"ForInStatement":"ForOfStatement")},pt.parseVar=function(O,ae,Ve,Le){for(O.declarations=[],O.kind=Ve;;){var We=this.startNode();if(this.parseVarId(We,Ve),this.eat(V.eq)?We.init=this.parseMaybeAssign(ae):!Le&&Ve==="const"&&!(this.type===V._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Le&&We.id.type!=="Identifier"&&!(ae&&(this.type===V._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):We.init=null,O.declarations.push(this.finishNode(We,"VariableDeclarator")),!this.eat(V.comma))break}return O},pt.parseVarId=function(O,ae){O.id=this.parseBindingAtom(),this.checkLValPattern(O.id,ae==="var"?at:Qe,!1)};var Wt=1,nr=2,ur=4;pt.parseFunction=function(O,ae,Ve,Le,We){this.initFunction(O),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Le)&&(this.type===V.star&&ae&nr&&this.unexpected(),O.generator=this.eat(V.star)),this.options.ecmaVersion>=8&&(O.async=!!Le),ae&Wt&&(O.id=ae&ur&&this.type!==V.name?null:this.parseIdent(),O.id&&!(ae&nr)&&this.checkLValSimple(O.id,this.strict||O.generator||O.async?this.treatFunctionsAsVar?at:Qe:ct));var lt=this.yieldPos,ut=this.awaitPos,$t=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ft(O.async,O.generator)),ae&Wt||(O.id=this.type===V.name?this.parseIdent():null),this.parseFunctionParams(O),this.parseFunctionBody(O,Ve,!1,We),this.yieldPos=lt,this.awaitPos=ut,this.awaitIdentPos=$t,this.finishNode(O,ae&Wt?"FunctionDeclaration":"FunctionExpression")},pt.parseFunctionParams=function(O){this.expect(V.parenL),O.params=this.parseBindingList(V.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},pt.parseClass=function(O,ae){this.next();var Ve=this.strict;this.strict=!0,this.parseClassId(O,ae),this.parseClassSuper(O);var Le=this.enterClassBody(),We=this.startNode(),lt=!1;for(We.body=[],this.expect(V.braceL);this.type!==V.braceR;){var ut=this.parseClassElement(O.superClass!==null);ut&&(We.body.push(ut),ut.type==="MethodDefinition"&&ut.kind==="constructor"?(lt&&this.raiseRecoverable(ut.start,"Duplicate constructor in the same class"),lt=!0):ut.key&&ut.key.type==="PrivateIdentifier"&&Nr(Le,ut)&&this.raiseRecoverable(ut.key.start,"Identifier '#"+ut.key.name+"' has already been declared"))}return this.strict=Ve,this.next(),O.body=this.finishNode(We,"ClassBody"),this.exitClassBody(),this.finishNode(O,ae?"ClassDeclaration":"ClassExpression")},pt.parseClassElement=function(O){if(this.eat(V.semi))return null;var ae=this.options.ecmaVersion,Ve=this.startNode(),Le="",We=!1,lt=!1,ut="method",$t=!1;if(this.eatContextual("static")){if(ae>=13&&this.eat(V.braceL))return this.parseClassStaticBlock(Ve),Ve;this.isClassElementNameStart()||this.type===V.star?$t=!0:Le="static"}if(Ve.static=$t,!Le&&ae>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===V.star)&&!this.canInsertSemicolon()?lt=!0:Le="async"),!Le&&(ae>=9||!lt)&&this.eat(V.star)&&(We=!0),!Le&&!lt&&!We){var Dt=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ut=Dt:Le=Dt)}if(Le?(Ve.computed=!1,Ve.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Ve.key.name=Le,this.finishNode(Ve.key,"Identifier")):this.parseClassElementName(Ve),ae<13||this.type===V.parenL||ut!=="method"||We||lt){var Qt=!Ve.static&&Tr(Ve,"constructor"),Jt=Qt&&O;Qt&&ut!=="method"&&this.raise(Ve.key.start,"Constructor can't have get/set modifier"),Ve.kind=Qt?"constructor":ut,this.parseClassMethod(Ve,We,lt,Jt)}else this.parseClassField(Ve);return Ve},pt.isClassElementNameStart=function(){return this.type===V.name||this.type===V.privateId||this.type===V.num||this.type===V.string||this.type===V.bracketL||this.type.keyword},pt.parseClassElementName=function(O){this.type===V.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),O.computed=!1,O.key=this.parsePrivateIdent()):this.parsePropertyName(O)},pt.parseClassMethod=function(O,ae,Ve,Le){var We=O.key;O.kind==="constructor"?(ae&&this.raise(We.start,"Constructor can't be a generator"),Ve&&this.raise(We.start,"Constructor can't be an async method")):O.static&&Tr(O,"prototype")&&this.raise(We.start,"Classes may not have a static property named prototype");var lt=O.value=this.parseMethod(ae,Ve,Le);return O.kind==="get"&<.params.length!==0&&this.raiseRecoverable(lt.start,"getter should have no params"),O.kind==="set"&<.params.length!==1&&this.raiseRecoverable(lt.start,"setter should have exactly one param"),O.kind==="set"&<.params[0].type==="RestElement"&&this.raiseRecoverable(lt.params[0].start,"Setter cannot use rest params"),this.finishNode(O,"MethodDefinition")},pt.parseClassField=function(O){if(Tr(O,"constructor")?this.raise(O.key.start,"Classes can't have a field named 'constructor'"):O.static&&Tr(O,"prototype")&&this.raise(O.key.start,"Classes can't have a static field named 'prototype'"),this.eat(V.eq)){var ae=this.currentThisScope(),Ve=ae.inClassFieldInit;ae.inClassFieldInit=!0,O.value=this.parseMaybeAssign(),ae.inClassFieldInit=Ve}else O.value=null;return this.semicolon(),this.finishNode(O,"PropertyDefinition")},pt.parseClassStaticBlock=function(O){O.body=[];var ae=this.labels;for(this.labels=[],this.enterScope(qt|yt);this.type!==V.braceR;){var Ve=this.parseStatement(null);O.body.push(Ve)}return this.next(),this.exitScope(),this.labels=ae,this.finishNode(O,"StaticBlock")},pt.parseClassId=function(O,ae){this.type===V.name?(O.id=this.parseIdent(),ae&&this.checkLValSimple(O.id,Qe,!1)):(ae===!0&&this.unexpected(),O.id=null)},pt.parseClassSuper=function(O){O.superClass=this.eat(V._extends)?this.parseExprSubscripts(null,!1):null},pt.enterClassBody=function(){var O={declared:Object.create(null),used:[]};return this.privateNameStack.push(O),O.declared},pt.exitClassBody=function(){var O=this.privateNameStack.pop(),ae=O.declared,Ve=O.used;if(this.options.checkPrivateFields)for(var Le=this.privateNameStack.length,We=Le===0?null:this.privateNameStack[Le-1],lt=0;lt<Ve.length;++lt){var ut=Ve[lt];Fe(ae,ut.name)||(We?We.used.push(ut):this.raiseRecoverable(ut.start,"Private field '#"+ut.name+"' must be declared in an enclosing class"))}};function Nr(O,ae){var Ve=ae.key.name,Le=O[Ve],We="true";return ae.type==="MethodDefinition"&&(ae.kind==="get"||ae.kind==="set")&&(We=(ae.static?"s":"i")+ae.kind),Le==="iget"&&We==="iset"||Le==="iset"&&We==="iget"||Le==="sget"&&We==="sset"||Le==="sset"&&We==="sget"?(O[Ve]="true",!1):Le?!0:(O[Ve]=We,!1)}function Tr(O,ae){var Ve=O.computed,Le=O.key;return!Ve&&(Le.type==="Identifier"&&Le.name===ae||Le.type==="Literal"&&Le.value===ae)}pt.parseExportAllDeclaration=function(O,ae){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(O.exported=this.parseModuleExportName(),this.checkExport(ae,O.exported,this.lastTokStart)):O.exported=null),this.expectContextual("from"),this.type!==V.string&&this.unexpected(),O.source=this.parseExprAtom(),this.semicolon(),this.finishNode(O,"ExportAllDeclaration")},pt.parseExport=function(O,ae){if(this.next(),this.eat(V.star))return this.parseExportAllDeclaration(O,ae);if(this.eat(V._default))return this.checkExport(ae,"default",this.lastTokStart),O.declaration=this.parseExportDefaultDeclaration(),this.finishNode(O,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())O.declaration=this.parseExportDeclaration(O),O.declaration.type==="VariableDeclaration"?this.checkVariableExport(ae,O.declaration.declarations):this.checkExport(ae,O.declaration.id,O.declaration.id.start),O.specifiers=[],O.source=null;else{if(O.declaration=null,O.specifiers=this.parseExportSpecifiers(ae),this.eatContextual("from"))this.type!==V.string&&this.unexpected(),O.source=this.parseExprAtom();else{for(var Ve=0,Le=O.specifiers;Ve<Le.length;Ve+=1){var We=Le[Ve];this.checkUnreserved(We.local),this.checkLocalExport(We.local),We.local.type==="Literal"&&this.raise(We.local.start,"A string literal cannot be used as an exported binding without `from`.")}O.source=null}this.semicolon()}return this.finishNode(O,"ExportNamedDeclaration")},pt.parseExportDeclaration=function(O){return this.parseStatement(null)},pt.parseExportDefaultDeclaration=function(){var O;if(this.type===V._function||(O=this.isAsyncFunction())){var ae=this.startNode();return this.next(),O&&this.next(),this.parseFunction(ae,Wt|ur,!1,O)}else if(this.type===V._class){var Ve=this.startNode();return this.parseClass(Ve,"nullableID")}else{var Le=this.parseMaybeAssign();return this.semicolon(),Le}},pt.checkExport=function(O,ae,Ve){O&&(typeof ae!="string"&&(ae=ae.type==="Identifier"?ae.name:ae.value),Fe(O,ae)&&this.raiseRecoverable(Ve,"Duplicate export '"+ae+"'"),O[ae]=!0)},pt.checkPatternExport=function(O,ae){var Ve=ae.type;if(Ve==="Identifier")this.checkExport(O,ae,ae.start);else if(Ve==="ObjectPattern")for(var Le=0,We=ae.properties;Le<We.length;Le+=1){var lt=We[Le];this.checkPatternExport(O,lt)}else if(Ve==="ArrayPattern")for(var ut=0,$t=ae.elements;ut<$t.length;ut+=1){var Dt=$t[ut];Dt&&this.checkPatternExport(O,Dt)}else Ve==="Property"?this.checkPatternExport(O,ae.value):Ve==="AssignmentPattern"?this.checkPatternExport(O,ae.left):Ve==="RestElement"&&this.checkPatternExport(O,ae.argument)},pt.checkVariableExport=function(O,ae){if(O)for(var Ve=0,Le=ae;Ve<Le.length;Ve+=1){var We=Le[Ve];this.checkPatternExport(O,We.id)}},pt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},pt.parseExportSpecifier=function(O){var ae=this.startNode();return ae.local=this.parseModuleExportName(),ae.exported=this.eatContextual("as")?this.parseModuleExportName():ae.local,this.checkExport(O,ae.exported,ae.exported.start),this.finishNode(ae,"ExportSpecifier")},pt.parseExportSpecifiers=function(O){var ae=[],Ve=!0;for(this.expect(V.braceL);!this.eat(V.braceR);){if(Ve)Ve=!1;else if(this.expect(V.comma),this.afterTrailingComma(V.braceR))break;ae.push(this.parseExportSpecifier(O))}return ae},pt.parseImport=function(O){return this.next(),this.type===V.string?(O.specifiers=Zt,O.source=this.parseExprAtom()):(O.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),O.source=this.type===V.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(O,"ImportDeclaration")},pt.parseImportSpecifier=function(){var O=this.startNode();return O.imported=this.parseModuleExportName(),this.eatContextual("as")?O.local=this.parseIdent():(this.checkUnreserved(O.imported),O.local=O.imported),this.checkLValSimple(O.local,Qe),this.finishNode(O,"ImportSpecifier")},pt.parseImportDefaultSpecifier=function(){var O=this.startNode();return O.local=this.parseIdent(),this.checkLValSimple(O.local,Qe),this.finishNode(O,"ImportDefaultSpecifier")},pt.parseImportNamespaceSpecifier=function(){var O=this.startNode();return this.next(),this.expectContextual("as"),O.local=this.parseIdent(),this.checkLValSimple(O.local,Qe),this.finishNode(O,"ImportNamespaceSpecifier")},pt.parseImportSpecifiers=function(){var O=[],ae=!0;if(this.type===V.name&&(O.push(this.parseImportDefaultSpecifier()),!this.eat(V.comma)))return O;if(this.type===V.star)return O.push(this.parseImportNamespaceSpecifier()),O;for(this.expect(V.braceL);!this.eat(V.braceR);){if(ae)ae=!1;else if(this.expect(V.comma),this.afterTrailingComma(V.braceR))break;O.push(this.parseImportSpecifier())}return O},pt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===V.string){var O=this.parseLiteral(this.value);return Ge.test(O.value)&&this.raise(O.start,"An export name cannot include a lone surrogate."),O}return this.parseIdent(!0)},pt.adaptDirectivePrologue=function(O){for(var ae=0;ae<O.length&&this.isDirectiveCandidate(O[ae]);++ae)O[ae].directive=O[ae].expression.raw.slice(1,-1)},pt.isDirectiveCandidate=function(O){return this.options.ecmaVersion>=5&&O.type==="ExpressionStatement"&&O.expression.type==="Literal"&&typeof O.expression.value=="string"&&(this.input[O.start]==='"'||this.input[O.start]==="'")};var gr=Rt.prototype;gr.toAssignable=function(O,ae,Ve){if(this.options.ecmaVersion>=6&&O)switch(O.type){case"Identifier":this.inAsync&&O.name==="await"&&this.raise(O.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":O.type="ObjectPattern",Ve&&this.checkPatternErrors(Ve,!0);for(var Le=0,We=O.properties;Le<We.length;Le+=1){var lt=We[Le];this.toAssignable(lt,ae),lt.type==="RestElement"&&(lt.argument.type==="ArrayPattern"||lt.argument.type==="ObjectPattern")&&this.raise(lt.argument.start,"Unexpected token")}break;case"Property":O.kind!=="init"&&this.raise(O.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(O.value,ae);break;case"ArrayExpression":O.type="ArrayPattern",Ve&&this.checkPatternErrors(Ve,!0),this.toAssignableList(O.elements,ae);break;case"SpreadElement":O.type="RestElement",this.toAssignable(O.argument,ae),O.argument.type==="AssignmentPattern"&&this.raise(O.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":O.operator!=="="&&this.raise(O.left.end,"Only '=' operator can be used for specifying default value."),O.type="AssignmentPattern",delete O.operator,this.toAssignable(O.left,ae);break;case"ParenthesizedExpression":this.toAssignable(O.expression,ae,Ve);break;case"ChainExpression":this.raiseRecoverable(O.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ae)break;default:this.raise(O.start,"Assigning to rvalue")}else Ve&&this.checkPatternErrors(Ve,!0);return O},gr.toAssignableList=function(O,ae){for(var Ve=O.length,Le=0;Le<Ve;Le++){var We=O[Le];We&&this.toAssignable(We,ae)}if(Ve){var lt=O[Ve-1];this.options.ecmaVersion===6&&ae&<&<.type==="RestElement"&<.argument.type!=="Identifier"&&this.unexpected(lt.argument.start)}return O},gr.parseSpread=function(O){var ae=this.startNode();return this.next(),ae.argument=this.parseMaybeAssign(!1,O),this.finishNode(ae,"SpreadElement")},gr.parseRestBinding=function(){var O=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==V.name&&this.unexpected(),O.argument=this.parseBindingAtom(),this.finishNode(O,"RestElement")},gr.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case V.bracketL:var O=this.startNode();return this.next(),O.elements=this.parseBindingList(V.bracketR,!0,!0),this.finishNode(O,"ArrayPattern");case V.braceL:return this.parseObj(!0)}return this.parseIdent()},gr.parseBindingList=function(O,ae,Ve,Le){for(var We=[],lt=!0;!this.eat(O);)if(lt?lt=!1:this.expect(V.comma),ae&&this.type===V.comma)We.push(null);else{if(Ve&&this.afterTrailingComma(O))break;if(this.type===V.ellipsis){var ut=this.parseRestBinding();this.parseBindingListItem(ut),We.push(ut),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(O);break}else We.push(this.parseAssignableListItem(Le))}return We},gr.parseAssignableListItem=function(O){var ae=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ae),ae},gr.parseBindingListItem=function(O){return O},gr.parseMaybeDefault=function(O,ae,Ve){if(Ve=Ve||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(V.eq))return Ve;var Le=this.startNodeAt(O,ae);return Le.left=Ve,Le.right=this.parseMaybeAssign(),this.finishNode(Le,"AssignmentPattern")},gr.checkLValSimple=function(O,ae,Ve){ae===void 0&&(ae=Ke);var Le=ae!==Ke;switch(O.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(O.name)&&this.raiseRecoverable(O.start,(Le?"Binding ":"Assigning to ")+O.name+" in strict mode"),Le&&(ae===Qe&&O.name==="let"&&this.raiseRecoverable(O.start,"let is disallowed as a lexically bound name"),Ve&&(Fe(Ve,O.name)&&this.raiseRecoverable(O.start,"Argument name clash"),Ve[O.name]=!0),ae!==dt&&this.declareName(O.name,ae,O.start));break;case"ChainExpression":this.raiseRecoverable(O.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Le&&this.raiseRecoverable(O.start,"Binding member expression");break;case"ParenthesizedExpression":return Le&&this.raiseRecoverable(O.start,"Binding parenthesized expression"),this.checkLValSimple(O.expression,ae,Ve);default:this.raise(O.start,(Le?"Binding":"Assigning to")+" rvalue")}},gr.checkLValPattern=function(O,ae,Ve){switch(ae===void 0&&(ae=Ke),O.type){case"ObjectPattern":for(var Le=0,We=O.properties;Le<We.length;Le+=1){var lt=We[Le];this.checkLValInnerPattern(lt,ae,Ve)}break;case"ArrayPattern":for(var ut=0,$t=O.elements;ut<$t.length;ut+=1){var Dt=$t[ut];Dt&&this.checkLValInnerPattern(Dt,ae,Ve)}break;default:this.checkLValSimple(O,ae,Ve)}},gr.checkLValInnerPattern=function(O,ae,Ve){switch(ae===void 0&&(ae=Ke),O.type){case"Property":this.checkLValInnerPattern(O.value,ae,Ve);break;case"AssignmentPattern":this.checkLValPattern(O.left,ae,Ve);break;case"RestElement":this.checkLValPattern(O.argument,ae,Ve);break;default:this.checkLValPattern(O,ae,Ve)}};var xr=function(ae,Ve,Le,We,lt){this.token=ae,this.isExpr=!!Ve,this.preserveSpace=!!Le,this.override=We,this.generator=!!lt},er={b_stat:new xr("{",!1),b_expr:new xr("{",!0),b_tmpl:new xr("${",!1),p_stat:new xr("(",!1),p_expr:new xr("(",!0),q_tmpl:new xr("`",!0,!0,function(O){return O.tryReadTemplateToken()}),f_stat:new xr("function",!1),f_expr:new xr("function",!0),f_expr_gen:new xr("function",!0,!1,null,!0),f_gen:new xr("function",!1,!1,null,!0)},Mr=Rt.prototype;Mr.initialContext=function(){return[er.b_stat]},Mr.curContext=function(){return this.context[this.context.length-1]},Mr.braceIsBlock=function(O){var ae=this.curContext();return ae===er.f_expr||ae===er.f_stat?!0:O===V.colon&&(ae===er.b_stat||ae===er.b_expr)?!ae.isExpr:O===V._return||O===V.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):O===V._else||O===V.semi||O===V.eof||O===V.parenR||O===V.arrow?!0:O===V.braceL?ae===er.b_stat:O===V._var||O===V._const||O===V.name?!1:!this.exprAllowed},Mr.inGeneratorContext=function(){for(var O=this.context.length-1;O>=1;O--){var ae=this.context[O];if(ae.token==="function")return ae.generator}return!1},Mr.updateContext=function(O){var ae,Ve=this.type;Ve.keyword&&O===V.dot?this.exprAllowed=!1:(ae=Ve.updateContext)?ae.call(this,O):this.exprAllowed=Ve.beforeExpr},Mr.overrideContext=function(O){this.curContext()!==O&&(this.context[this.context.length-1]=O)},V.parenR.updateContext=V.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var O=this.context.pop();O===er.b_stat&&this.curContext().token==="function"&&(O=this.context.pop()),this.exprAllowed=!O.isExpr},V.braceL.updateContext=function(O){this.context.push(this.braceIsBlock(O)?er.b_stat:er.b_expr),this.exprAllowed=!0},V.dollarBraceL.updateContext=function(){this.context.push(er.b_tmpl),this.exprAllowed=!0},V.parenL.updateContext=function(O){var ae=O===V._if||O===V._for||O===V._with||O===V._while;this.context.push(ae?er.p_stat:er.p_expr),this.exprAllowed=!0},V.incDec.updateContext=function(){},V._function.updateContext=V._class.updateContext=function(O){O.beforeExpr&&O!==V._else&&!(O===V.semi&&this.curContext()!==er.p_stat)&&!(O===V._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((O===V.colon||O===V.braceL)&&this.curContext()===er.b_stat)?this.context.push(er.f_expr):this.context.push(er.f_stat),this.exprAllowed=!1},V.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},V.backQuote.updateContext=function(){this.curContext()===er.q_tmpl?this.context.pop():this.context.push(er.q_tmpl),this.exprAllowed=!1},V.star.updateContext=function(O){if(O===V._function){var ae=this.context.length-1;this.context[ae]===er.f_expr?this.context[ae]=er.f_expr_gen:this.context[ae]=er.f_gen}this.exprAllowed=!0},V.name.updateContext=function(O){var ae=!1;this.options.ecmaVersion>=6&&O!==V.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(ae=!0),this.exprAllowed=ae};var Xt=Rt.prototype;Xt.checkPropClash=function(O,ae,Ve){if(!(this.options.ecmaVersion>=9&&O.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(O.computed||O.method||O.shorthand))){var Le=O.key,We;switch(Le.type){case"Identifier":We=Le.name;break;case"Literal":We=String(Le.value);break;default:return}var lt=O.kind;if(this.options.ecmaVersion>=6){We==="__proto__"&<==="init"&&(ae.proto&&(Ve?Ve.doubleProto<0&&(Ve.doubleProto=Le.start):this.raiseRecoverable(Le.start,"Redefinition of __proto__ property")),ae.proto=!0);return}We="$"+We;var ut=ae[We];if(ut){var $t;lt==="init"?$t=this.strict&&ut.init||ut.get||ut.set:$t=ut.init||ut[lt],$t&&this.raiseRecoverable(Le.start,"Redefinition of property")}else ut=ae[We]={init:!1,get:!1,set:!1};ut[lt]=!0}},Xt.parseExpression=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseMaybeAssign(O,ae);if(this.type===V.comma){var lt=this.startNodeAt(Ve,Le);for(lt.expressions=[We];this.eat(V.comma);)lt.expressions.push(this.parseMaybeAssign(O,ae));return this.finishNode(lt,"SequenceExpression")}return We},Xt.parseMaybeAssign=function(O,ae,Ve){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(O);this.exprAllowed=!1}var Le=!1,We=-1,lt=-1,ut=-1;ae?(We=ae.parenthesizedAssign,lt=ae.trailingComma,ut=ae.doubleProto,ae.parenthesizedAssign=ae.trailingComma=-1):(ae=new dr,Le=!0);var $t=this.start,Dt=this.startLoc;(this.type===V.parenL||this.type===V.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=O==="await");var Qt=this.parseMaybeConditional(O,ae);if(Ve&&(Qt=Ve.call(this,Qt,$t,Dt)),this.type.isAssign){var Jt=this.startNodeAt($t,Dt);return Jt.operator=this.value,this.type===V.eq&&(Qt=this.toAssignable(Qt,!1,ae)),Le||(ae.parenthesizedAssign=ae.trailingComma=ae.doubleProto=-1),ae.shorthandAssign>=Qt.start&&(ae.shorthandAssign=-1),this.type===V.eq?this.checkLValPattern(Qt):this.checkLValSimple(Qt),Jt.left=Qt,this.next(),Jt.right=this.parseMaybeAssign(O),ut>-1&&(ae.doubleProto=ut),this.finishNode(Jt,"AssignmentExpression")}else Le&&this.checkExpressionErrors(ae,!0);return We>-1&&(ae.parenthesizedAssign=We),lt>-1&&(ae.trailingComma=lt),Qt},Xt.parseMaybeConditional=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseExprOps(O,ae);if(this.checkExpressionErrors(ae))return We;if(this.eat(V.question)){var lt=this.startNodeAt(Ve,Le);return lt.test=We,lt.consequent=this.parseMaybeAssign(),this.expect(V.colon),lt.alternate=this.parseMaybeAssign(O),this.finishNode(lt,"ConditionalExpression")}return We},Xt.parseExprOps=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseMaybeUnary(ae,!1,!1,O);return this.checkExpressionErrors(ae)||We.start===Ve&&We.type==="ArrowFunctionExpression"?We:this.parseExprOp(We,Ve,Le,-1,O)},Xt.parseExprOp=function(O,ae,Ve,Le,We){var lt=this.type.binop;if(lt!=null&&(!We||this.type!==V._in)&<>Le){var ut=this.type===V.logicalOR||this.type===V.logicalAND,$t=this.type===V.coalesce;$t&&(lt=V.logicalAND.binop);var Dt=this.value;this.next();var Qt=this.start,Jt=this.startLoc,yr=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,We),Qt,Jt,lt,We),Fr=this.buildBinary(ae,Ve,O,yr,Dt,ut||$t);return(ut&&this.type===V.coalesce||$t&&(this.type===V.logicalOR||this.type===V.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(Fr,ae,Ve,Le,We)}return O},Xt.buildBinary=function(O,ae,Ve,Le,We,lt){Le.type==="PrivateIdentifier"&&this.raise(Le.start,"Private identifier can only be left side of binary expression");var ut=this.startNodeAt(O,ae);return ut.left=Ve,ut.operator=We,ut.right=Le,this.finishNode(ut,lt?"LogicalExpression":"BinaryExpression")},Xt.parseMaybeUnary=function(O,ae,Ve,Le){var We=this.start,lt=this.startLoc,ut;if(this.isContextual("await")&&this.canAwait)ut=this.parseAwait(Le),ae=!0;else if(this.type.prefix){var $t=this.startNode(),Dt=this.type===V.incDec;$t.operator=this.value,$t.prefix=!0,this.next(),$t.argument=this.parseMaybeUnary(null,!0,Dt,Le),this.checkExpressionErrors(O,!0),Dt?this.checkLValSimple($t.argument):this.strict&&$t.operator==="delete"&&mr($t.argument)?this.raiseRecoverable($t.start,"Deleting local variable in strict mode"):$t.operator==="delete"&&Ir($t.argument)?this.raiseRecoverable($t.start,"Private fields can not be deleted"):ae=!0,ut=this.finishNode($t,Dt?"UpdateExpression":"UnaryExpression")}else if(!ae&&this.type===V.privateId)(Le||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),ut=this.parsePrivateIdent(),this.type!==V._in&&this.unexpected();else{if(ut=this.parseExprSubscripts(O,Le),this.checkExpressionErrors(O))return ut;for(;this.type.postfix&&!this.canInsertSemicolon();){var Qt=this.startNodeAt(We,lt);Qt.operator=this.value,Qt.prefix=!1,Qt.argument=ut,this.checkLValSimple(ut),this.next(),ut=this.finishNode(Qt,"UpdateExpression")}}if(!Ve&&this.eat(V.starstar))if(ae)this.unexpected(this.lastTokStart);else return this.buildBinary(We,lt,ut,this.parseMaybeUnary(null,!1,!1,Le),"**",!1);else return ut};function mr(O){return O.type==="Identifier"||O.type==="ParenthesizedExpression"&&mr(O.expression)}function Ir(O){return O.type==="MemberExpression"&&O.property.type==="PrivateIdentifier"||O.type==="ChainExpression"&&Ir(O.expression)||O.type==="ParenthesizedExpression"&&Ir(O.expression)}Xt.parseExprSubscripts=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseExprAtom(O,ae);if(We.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return We;var lt=this.parseSubscripts(We,Ve,Le,!1,ae);return O&<.type==="MemberExpression"&&(O.parenthesizedAssign>=lt.start&&(O.parenthesizedAssign=-1),O.parenthesizedBind>=lt.start&&(O.parenthesizedBind=-1),O.trailingComma>=lt.start&&(O.trailingComma=-1)),lt},Xt.parseSubscripts=function(O,ae,Ve,Le,We){for(var lt=this.options.ecmaVersion>=8&&O.type==="Identifier"&&O.name==="async"&&this.lastTokEnd===O.end&&!this.canInsertSemicolon()&&O.end-O.start===5&&this.potentialArrowAt===O.start,ut=!1;;){var $t=this.parseSubscript(O,ae,Ve,Le,lt,ut,We);if($t.optional&&(ut=!0),$t===O||$t.type==="ArrowFunctionExpression"){if(ut){var Dt=this.startNodeAt(ae,Ve);Dt.expression=$t,$t=this.finishNode(Dt,"ChainExpression")}return $t}O=$t}},Xt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(V.arrow)},Xt.parseSubscriptAsyncArrow=function(O,ae,Ve,Le){return this.parseArrowExpression(this.startNodeAt(O,ae),Ve,!0,Le)},Xt.parseSubscript=function(O,ae,Ve,Le,We,lt,ut){var $t=this.options.ecmaVersion>=11,Dt=$t&&this.eat(V.questionDot);Le&&Dt&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var Qt=this.eat(V.bracketL);if(Qt||Dt&&this.type!==V.parenL&&this.type!==V.backQuote||this.eat(V.dot)){var Jt=this.startNodeAt(ae,Ve);Jt.object=O,Qt?(Jt.property=this.parseExpression(),this.expect(V.bracketR)):this.type===V.privateId&&O.type!=="Super"?Jt.property=this.parsePrivateIdent():Jt.property=this.parseIdent(this.options.allowReserved!=="never"),Jt.computed=!!Qt,$t&&(Jt.optional=Dt),O=this.finishNode(Jt,"MemberExpression")}else if(!Le&&this.eat(V.parenL)){var yr=new dr,Fr=this.yieldPos,en=this.awaitPos,zr=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var pn=this.parseExprList(V.parenR,this.options.ecmaVersion>=8,!1,yr);if(We&&!Dt&&this.shouldParseAsyncArrow())return this.checkPatternErrors(yr,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=Fr,this.awaitPos=en,this.awaitIdentPos=zr,this.parseSubscriptAsyncArrow(ae,Ve,pn,ut);this.checkExpressionErrors(yr,!0),this.yieldPos=Fr||this.yieldPos,this.awaitPos=en||this.awaitPos,this.awaitIdentPos=zr||this.awaitIdentPos;var Gr=this.startNodeAt(ae,Ve);Gr.callee=O,Gr.arguments=pn,$t&&(Gr.optional=Dt),O=this.finishNode(Gr,"CallExpression")}else if(this.type===V.backQuote){(Dt||lt)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Wr=this.startNodeAt(ae,Ve);Wr.tag=O,Wr.quasi=this.parseTemplate({isTagged:!0}),O=this.finishNode(Wr,"TaggedTemplateExpression")}return O},Xt.parseExprAtom=function(O,ae,Ve){this.type===V.slash&&this.readRegexp();var Le,We=this.potentialArrowAt===this.start;switch(this.type){case V._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Le=this.startNode(),this.next(),this.type===V.parenL&&!this.allowDirectSuper&&this.raise(Le.start,"super() call outside constructor of a subclass"),this.type!==V.dot&&this.type!==V.bracketL&&this.type!==V.parenL&&this.unexpected(),this.finishNode(Le,"Super");case V._this:return Le=this.startNode(),this.next(),this.finishNode(Le,"ThisExpression");case V.name:var lt=this.start,ut=this.startLoc,$t=this.containsEsc,Dt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!$t&&Dt.name==="async"&&!this.canInsertSemicolon()&&this.eat(V._function))return this.overrideContext(er.f_expr),this.parseFunction(this.startNodeAt(lt,ut),0,!1,!0,ae);if(We&&!this.canInsertSemicolon()){if(this.eat(V.arrow))return this.parseArrowExpression(this.startNodeAt(lt,ut),[Dt],!1,ae);if(this.options.ecmaVersion>=8&&Dt.name==="async"&&this.type===V.name&&!$t&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return Dt=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(V.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(lt,ut),[Dt],!0,ae)}return Dt;case V.regexp:var Qt=this.value;return Le=this.parseLiteral(Qt.value),Le.regex={pattern:Qt.pattern,flags:Qt.flags},Le;case V.num:case V.string:return this.parseLiteral(this.value);case V._null:case V._true:case V._false:return Le=this.startNode(),Le.value=this.type===V._null?null:this.type===V._true,Le.raw=this.type.keyword,this.next(),this.finishNode(Le,"Literal");case V.parenL:var Jt=this.start,yr=this.parseParenAndDistinguishExpression(We,ae);return O&&(O.parenthesizedAssign<0&&!this.isSimpleAssignTarget(yr)&&(O.parenthesizedAssign=Jt),O.parenthesizedBind<0&&(O.parenthesizedBind=Jt)),yr;case V.bracketL:return Le=this.startNode(),this.next(),Le.elements=this.parseExprList(V.bracketR,!0,!0,O),this.finishNode(Le,"ArrayExpression");case V.braceL:return this.overrideContext(er.b_expr),this.parseObj(!1,O);case V._function:return Le=this.startNode(),this.next(),this.parseFunction(Le,0);case V._class:return this.parseClass(this.startNode(),!1);case V._new:return this.parseNew();case V.backQuote:return this.parseTemplate();case V._import:return this.options.ecmaVersion>=11?this.parseExprImport(Ve):this.unexpected();default:return this.parseExprAtomDefault()}},Xt.parseExprAtomDefault=function(){this.unexpected()},Xt.parseExprImport=function(O){var ae=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===V.parenL&&!O)return this.parseDynamicImport(ae);if(this.type===V.dot){var Ve=this.startNodeAt(ae.start,ae.loc&&ae.loc.start);return Ve.name="import",ae.meta=this.finishNode(Ve,"Identifier"),this.parseImportMeta(ae)}else this.unexpected()},Xt.parseDynamicImport=function(O){if(this.next(),O.source=this.parseMaybeAssign(),!this.eat(V.parenR)){var ae=this.start;this.eat(V.comma)&&this.eat(V.parenR)?this.raiseRecoverable(ae,"Trailing comma is not allowed in import()"):this.unexpected(ae)}return this.finishNode(O,"ImportExpression")},Xt.parseImportMeta=function(O){this.next();var ae=this.containsEsc;return O.property=this.parseIdent(!0),O.property.name!=="meta"&&this.raiseRecoverable(O.property.start,"The only valid meta property for import is 'import.meta'"),ae&&this.raiseRecoverable(O.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(O.start,"Cannot use 'import.meta' outside a module"),this.finishNode(O,"MetaProperty")},Xt.parseLiteral=function(O){var ae=this.startNode();return ae.value=O,ae.raw=this.input.slice(this.start,this.end),ae.raw.charCodeAt(ae.raw.length-1)===110&&(ae.bigint=ae.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(ae,"Literal")},Xt.parseParenExpression=function(){this.expect(V.parenL);var O=this.parseExpression();return this.expect(V.parenR),O},Xt.shouldParseArrow=function(O){return!this.canInsertSemicolon()},Xt.parseParenAndDistinguishExpression=function(O,ae){var Ve=this.start,Le=this.startLoc,We,lt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ut=this.start,$t=this.startLoc,Dt=[],Qt=!0,Jt=!1,yr=new dr,Fr=this.yieldPos,en=this.awaitPos,zr;for(this.yieldPos=0,this.awaitPos=0;this.type!==V.parenR;)if(Qt?Qt=!1:this.expect(V.comma),lt&&this.afterTrailingComma(V.parenR,!0)){Jt=!0;break}else if(this.type===V.ellipsis){zr=this.start,Dt.push(this.parseParenItem(this.parseRestBinding())),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Dt.push(this.parseMaybeAssign(!1,yr,this.parseParenItem));var pn=this.lastTokEnd,Gr=this.lastTokEndLoc;if(this.expect(V.parenR),O&&this.shouldParseArrow(Dt)&&this.eat(V.arrow))return this.checkPatternErrors(yr,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Fr,this.awaitPos=en,this.parseParenArrowList(Ve,Le,Dt,ae);(!Dt.length||Jt)&&this.unexpected(this.lastTokStart),zr&&this.unexpected(zr),this.checkExpressionErrors(yr,!0),this.yieldPos=Fr||this.yieldPos,this.awaitPos=en||this.awaitPos,Dt.length>1?(We=this.startNodeAt(ut,$t),We.expressions=Dt,this.finishNodeAt(We,"SequenceExpression",pn,Gr)):We=Dt[0]}else We=this.parseParenExpression();if(this.options.preserveParens){var Wr=this.startNodeAt(Ve,Le);return Wr.expression=We,this.finishNode(Wr,"ParenthesizedExpression")}else return We},Xt.parseParenItem=function(O){return O},Xt.parseParenArrowList=function(O,ae,Ve,Le){return this.parseArrowExpression(this.startNodeAt(O,ae),Ve,!1,Le)};var hn=[];Xt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var O=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===V.dot){var ae=this.startNodeAt(O.start,O.loc&&O.loc.start);ae.name="new",O.meta=this.finishNode(ae,"Identifier"),this.next();var Ve=this.containsEsc;return O.property=this.parseIdent(!0),O.property.name!=="target"&&this.raiseRecoverable(O.property.start,"The only valid meta property for new is 'new.target'"),Ve&&this.raiseRecoverable(O.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(O.start,"'new.target' can only be used in functions and class static block"),this.finishNode(O,"MetaProperty")}var Le=this.start,We=this.startLoc;return O.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Le,We,!0,!1),this.eat(V.parenL)?O.arguments=this.parseExprList(V.parenR,this.options.ecmaVersion>=8,!1):O.arguments=hn,this.finishNode(O,"NewExpression")},Xt.parseTemplateElement=function(O){var ae=O.isTagged,Ve=this.startNode();return this.type===V.invalidTemplate?(ae||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),Ve.value={raw:this.value.replace(/\r\n?/g,`
|
|
1097
|
+
`,Le-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(te).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=V.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=ae.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&ae.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(et),this.regexpState=null,this.privateNameStack=[]},zt={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};Rt.prototype.parse=function(){var ae=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(ae)},zt.inFunction.get=function(){return(this.currentVarScope().flags&st)>0},zt.inGenerator.get=function(){return(this.currentVarScope().flags&Ue)>0&&!this.currentVarScope().inClassFieldInit},zt.inAsync.get=function(){return(this.currentVarScope().flags&ot)>0&&!this.currentVarScope().inClassFieldInit},zt.canAwait.get=function(){for(var O=this.scopeStack.length-1;O>=0;O--){var ae=this.scopeStack[O];if(ae.inClassFieldInit||ae.flags&qt)return!1;if(ae.flags&st)return(ae.flags&ot)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},zt.allowSuper.get=function(){var O=this.currentThisScope(),ae=O.flags,Ve=O.inClassFieldInit;return(ae&yt)>0||Ve||this.options.allowSuperOutsideMethod},zt.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Mt)>0},zt.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},zt.allowNewDotTarget.get=function(){var O=this.currentThisScope(),ae=O.flags,Ve=O.inClassFieldInit;return(ae&(st|qt))>0||Ve},zt.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&qt)>0},Rt.extend=function(){for(var ae=[],Ve=arguments.length;Ve--;)ae[Ve]=arguments[Ve];for(var Le=this,We=0;We<ae.length;We++)Le=ae[We](Le);return Le},Rt.parse=function(ae,Ve){return new this(Ve,ae).parse()},Rt.parseExpressionAt=function(ae,Ve,Le){var We=new this(Le,ae,Ve);return We.nextToken(),We.parseExpression()},Rt.tokenizer=function(ae,Ve){return new this(Ve,ae)},Object.defineProperties(Rt.prototype,zt);var Yt=Rt.prototype,or=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Yt.strictDirective=function(O){if(this.options.ecmaVersion<5)return!1;for(;;){Ae.lastIndex=O,O+=Ae.exec(this.input)[0].length;var ae=or.exec(this.input.slice(O));if(!ae)return!1;if((ae[1]||ae[2])==="use strict"){Ae.lastIndex=O+ae[0].length;var Ve=Ae.exec(this.input),Le=Ve.index+Ve[0].length,We=this.input.charAt(Le);return We===";"||We==="}"||te.test(Ve[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(We)||We==="!"&&this.input.charAt(Le+1)==="=")}O+=ae[0].length,Ae.lastIndex=O,O+=Ae.exec(this.input)[0].length,this.input[O]===";"&&O++}},Yt.eat=function(O){return this.type===O?(this.next(),!0):!1},Yt.isContextual=function(O){return this.type===V.name&&this.value===O&&!this.containsEsc},Yt.eatContextual=function(O){return this.isContextual(O)?(this.next(),!0):!1},Yt.expectContextual=function(O){this.eatContextual(O)||this.unexpected()},Yt.canInsertSemicolon=function(){return this.type===V.eof||this.type===V.braceR||te.test(this.input.slice(this.lastTokEnd,this.start))},Yt.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},Yt.semicolon=function(){!this.eat(V.semi)&&!this.insertSemicolon()&&this.unexpected()},Yt.afterTrailingComma=function(O,ae){if(this.type===O)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),ae||this.next(),!0},Yt.expect=function(O){this.eat(O)||this.unexpected()},Yt.unexpected=function(O){this.raise(O??this.start,"Unexpected token")};var dr=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Yt.checkPatternErrors=function(O,ae){if(O){O.trailingComma>-1&&this.raiseRecoverable(O.trailingComma,"Comma is not permitted after the rest element");var Ve=ae?O.parenthesizedAssign:O.parenthesizedBind;Ve>-1&&this.raiseRecoverable(Ve,ae?"Assigning to rvalue":"Parenthesized pattern")}},Yt.checkExpressionErrors=function(O,ae){if(!O)return!1;var Ve=O.shorthandAssign,Le=O.doubleProto;if(!ae)return Ve>=0||Le>=0;Ve>=0&&this.raise(Ve,"Shorthand property assignments are valid only in destructuring patterns"),Le>=0&&this.raiseRecoverable(Le,"Redefinition of __proto__ property")},Yt.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},Yt.isSimpleAssignTarget=function(O){return O.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(O.expression):O.type==="Identifier"||O.type==="MemberExpression"};var pt=Rt.prototype;pt.parseTopLevel=function(O){var ae=Object.create(null);for(O.body||(O.body=[]);this.type!==V.eof;){var Ve=this.parseStatement(null,!0,ae);O.body.push(Ve)}if(this.inModule)for(var Le=0,We=Object.keys(this.undefinedExports);Le<We.length;Le+=1){var lt=We[Le];this.raiseRecoverable(this.undefinedExports[lt].start,"Export '"+lt+"' is not defined")}return this.adaptDirectivePrologue(O.body),this.next(),O.sourceType=this.options.sourceType,this.finishNode(O,"Program")};var Sr={kind:"loop"},mt={kind:"switch"};pt.isLet=function(O){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;Ae.lastIndex=this.pos;var ae=Ae.exec(this.input),Ve=this.pos+ae[0].length,Le=this.input.charCodeAt(Ve);if(Le===91||Le===92)return!0;if(O)return!1;if(Le===123||Le>55295&&Le<56320)return!0;if(A(Le,!0)){for(var We=Ve+1;I(Le=this.input.charCodeAt(We),!0);)++We;if(Le===92||Le>55295&&Le<56320)return!0;var lt=this.input.slice(Ve,We);if(!S.test(lt))return!0}return!1},pt.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;Ae.lastIndex=this.pos;var O=Ae.exec(this.input),ae=this.pos+O[0].length,Ve;return!te.test(this.input.slice(this.pos,ae))&&this.input.slice(ae,ae+8)==="function"&&(ae+8===this.input.length||!(I(Ve=this.input.charCodeAt(ae+8))||Ve>55295&&Ve<56320))},pt.parseStatement=function(O,ae,Ve){var Le=this.type,We=this.startNode(),lt;switch(this.isLet(O)&&(Le=V._var,lt="let"),Le){case V._break:case V._continue:return this.parseBreakContinueStatement(We,Le.keyword);case V._debugger:return this.parseDebuggerStatement(We);case V._do:return this.parseDoStatement(We);case V._for:return this.parseForStatement(We);case V._function:return O&&(this.strict||O!=="if"&&O!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(We,!1,!O);case V._class:return O&&this.unexpected(),this.parseClass(We,!0);case V._if:return this.parseIfStatement(We);case V._return:return this.parseReturnStatement(We);case V._switch:return this.parseSwitchStatement(We);case V._throw:return this.parseThrowStatement(We);case V._try:return this.parseTryStatement(We);case V._const:case V._var:return lt=lt||this.value,O&<!=="var"&&this.unexpected(),this.parseVarStatement(We,lt);case V._while:return this.parseWhileStatement(We);case V._with:return this.parseWithStatement(We);case V.braceL:return this.parseBlock(!0,We);case V.semi:return this.parseEmptyStatement(We);case V._export:case V._import:if(this.options.ecmaVersion>10&&Le===V._import){Ae.lastIndex=this.pos;var ut=Ae.exec(this.input),$t=this.pos+ut[0].length,Dt=this.input.charCodeAt($t);if(Dt===40||Dt===46)return this.parseExpressionStatement(We,this.parseExpression())}return this.options.allowImportExportEverywhere||(ae||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),Le===V._import?this.parseImport(We):this.parseExport(We,Ve);default:if(this.isAsyncFunction())return O&&this.unexpected(),this.next(),this.parseFunctionStatement(We,!0,!O);var er=this.value,Jt=this.parseExpression();return Le===V.name&&Jt.type==="Identifier"&&this.eat(V.colon)?this.parseLabeledStatement(We,er,Jt,O):this.parseExpressionStatement(We,Jt)}},pt.parseBreakContinueStatement=function(O,ae){var Ve=ae==="break";this.next(),this.eat(V.semi)||this.insertSemicolon()?O.label=null:this.type!==V.name?this.unexpected():(O.label=this.parseIdent(),this.semicolon());for(var Le=0;Le<this.labels.length;++Le){var We=this.labels[Le];if((O.label==null||We.name===O.label.name)&&(We.kind!=null&&(Ve||We.kind==="loop")||O.label&&Ve))break}return Le===this.labels.length&&this.raise(O.start,"Unsyntactic "+ae),this.finishNode(O,Ve?"BreakStatement":"ContinueStatement")},pt.parseDebuggerStatement=function(O){return this.next(),this.semicolon(),this.finishNode(O,"DebuggerStatement")},pt.parseDoStatement=function(O){return this.next(),this.labels.push(Sr),O.body=this.parseStatement("do"),this.labels.pop(),this.expect(V._while),O.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(V.semi):this.semicolon(),this.finishNode(O,"DoWhileStatement")},pt.parseForStatement=function(O){this.next();var ae=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Sr),this.enterScope(0),this.expect(V.parenL),this.type===V.semi)return ae>-1&&this.unexpected(ae),this.parseFor(O,null);var Ve=this.isLet();if(this.type===V._var||this.type===V._const||Ve){var Le=this.startNode(),We=Ve?"let":this.value;return this.next(),this.parseVar(Le,!0,We),this.finishNode(Le,"VariableDeclaration"),(this.type===V._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Le.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===V._in?ae>-1&&this.unexpected(ae):O.await=ae>-1),this.parseForIn(O,Le)):(ae>-1&&this.unexpected(ae),this.parseFor(O,Le))}var lt=this.isContextual("let"),ut=!1,$t=this.containsEsc,Dt=new dr,er=this.start,Jt=ae>-1?this.parseExprSubscripts(Dt,"await"):this.parseExpression(!0,Dt);return this.type===V._in||(ut=this.options.ecmaVersion>=6&&this.isContextual("of"))?(ae>-1?(this.type===V._in&&this.unexpected(ae),O.await=!0):ut&&this.options.ecmaVersion>=8&&(Jt.start===er&&!$t&&Jt.type==="Identifier"&&Jt.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(O.await=!1)),lt&&ut&&this.raise(Jt.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(Jt,!1,Dt),this.checkLValPattern(Jt),this.parseForIn(O,Jt)):(this.checkExpressionErrors(Dt,!0),ae>-1&&this.unexpected(ae),this.parseFor(O,Jt))},pt.parseFunctionStatement=function(O,ae,Ve){return this.next(),this.parseFunction(O,Wt|(Ve?0:ir),!1,ae)},pt.parseIfStatement=function(O){return this.next(),O.test=this.parseParenExpression(),O.consequent=this.parseStatement("if"),O.alternate=this.eat(V._else)?this.parseStatement("if"):null,this.finishNode(O,"IfStatement")},pt.parseReturnStatement=function(O){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(V.semi)||this.insertSemicolon()?O.argument=null:(O.argument=this.parseExpression(),this.semicolon()),this.finishNode(O,"ReturnStatement")},pt.parseSwitchStatement=function(O){this.next(),O.discriminant=this.parseParenExpression(),O.cases=[],this.expect(V.braceL),this.labels.push(mt),this.enterScope(0);for(var ae,Ve=!1;this.type!==V.braceR;)if(this.type===V._case||this.type===V._default){var Le=this.type===V._case;ae&&this.finishNode(ae,"SwitchCase"),O.cases.push(ae=this.startNode()),ae.consequent=[],this.next(),Le?ae.test=this.parseExpression():(Ve&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),Ve=!0,ae.test=null),this.expect(V.colon)}else ae||this.unexpected(),ae.consequent.push(this.parseStatement(null));return this.exitScope(),ae&&this.finishNode(ae,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(O,"SwitchStatement")},pt.parseThrowStatement=function(O){return this.next(),te.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),O.argument=this.parseExpression(),this.semicolon(),this.finishNode(O,"ThrowStatement")};var Zt=[];pt.parseCatchClauseParam=function(){var O=this.parseBindingAtom(),ae=O.type==="Identifier";return this.enterScope(ae?Je:0),this.checkLValPattern(O,ae?ft:Qe),this.expect(V.parenR),O},pt.parseTryStatement=function(O){if(this.next(),O.block=this.parseBlock(),O.handler=null,this.type===V._catch){var ae=this.startNode();this.next(),this.eat(V.parenL)?ae.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),ae.param=null,this.enterScope(0)),ae.body=this.parseBlock(!1),this.exitScope(),O.handler=this.finishNode(ae,"CatchClause")}return O.finalizer=this.eat(V._finally)?this.parseBlock():null,!O.handler&&!O.finalizer&&this.raise(O.start,"Missing catch or finally clause"),this.finishNode(O,"TryStatement")},pt.parseVarStatement=function(O,ae,Ve){return this.next(),this.parseVar(O,!1,ae,Ve),this.semicolon(),this.finishNode(O,"VariableDeclaration")},pt.parseWhileStatement=function(O){return this.next(),O.test=this.parseParenExpression(),this.labels.push(Sr),O.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(O,"WhileStatement")},pt.parseWithStatement=function(O){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),O.object=this.parseParenExpression(),O.body=this.parseStatement("with"),this.finishNode(O,"WithStatement")},pt.parseEmptyStatement=function(O){return this.next(),this.finishNode(O,"EmptyStatement")},pt.parseLabeledStatement=function(O,ae,Ve,Le){for(var We=0,lt=this.labels;We<lt.length;We+=1){var ut=lt[We];ut.name===ae&&this.raise(Ve.start,"Label '"+ae+"' is already declared")}for(var $t=this.type.isLoop?"loop":this.type===V._switch?"switch":null,Dt=this.labels.length-1;Dt>=0;Dt--){var er=this.labels[Dt];if(er.statementStart===O.start)er.statementStart=this.start,er.kind=$t;else break}return this.labels.push({name:ae,kind:$t,statementStart:this.start}),O.body=this.parseStatement(Le?Le.indexOf("label")===-1?Le+"label":Le:"label"),this.labels.pop(),O.label=Ve,this.finishNode(O,"LabeledStatement")},pt.parseExpressionStatement=function(O,ae){return O.expression=ae,this.semicolon(),this.finishNode(O,"ExpressionStatement")},pt.parseBlock=function(O,ae,Ve){for(O===void 0&&(O=!0),ae===void 0&&(ae=this.startNode()),ae.body=[],this.expect(V.braceL),O&&this.enterScope(0);this.type!==V.braceR;){var Le=this.parseStatement(null);ae.body.push(Le)}return Ve&&(this.strict=!1),this.next(),O&&this.exitScope(),this.finishNode(ae,"BlockStatement")},pt.parseFor=function(O,ae){return O.init=ae,this.expect(V.semi),O.test=this.type===V.semi?null:this.parseExpression(),this.expect(V.semi),O.update=this.type===V.parenR?null:this.parseExpression(),this.expect(V.parenR),O.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(O,"ForStatement")},pt.parseForIn=function(O,ae){var Ve=this.type===V._in;return this.next(),ae.type==="VariableDeclaration"&&ae.declarations[0].init!=null&&(!Ve||this.options.ecmaVersion<8||this.strict||ae.kind!=="var"||ae.declarations[0].id.type!=="Identifier")&&this.raise(ae.start,(Ve?"for-in":"for-of")+" loop variable declaration may not have an initializer"),O.left=ae,O.right=Ve?this.parseExpression():this.parseMaybeAssign(),this.expect(V.parenR),O.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(O,Ve?"ForInStatement":"ForOfStatement")},pt.parseVar=function(O,ae,Ve,Le){for(O.declarations=[],O.kind=Ve;;){var We=this.startNode();if(this.parseVarId(We,Ve),this.eat(V.eq)?We.init=this.parseMaybeAssign(ae):!Le&&Ve==="const"&&!(this.type===V._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!Le&&We.id.type!=="Identifier"&&!(ae&&(this.type===V._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):We.init=null,O.declarations.push(this.finishNode(We,"VariableDeclarator")),!this.eat(V.comma))break}return O},pt.parseVarId=function(O,ae){O.id=this.parseBindingAtom(),this.checkLValPattern(O.id,ae==="var"?at:Qe,!1)};var Wt=1,ir=2,ur=4;pt.parseFunction=function(O,ae,Ve,Le,We){this.initFunction(O),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!Le)&&(this.type===V.star&&ae&ir&&this.unexpected(),O.generator=this.eat(V.star)),this.options.ecmaVersion>=8&&(O.async=!!Le),ae&Wt&&(O.id=ae&ur&&this.type!==V.name?null:this.parseIdent(),O.id&&!(ae&ir)&&this.checkLValSimple(O.id,this.strict||O.generator||O.async?this.treatFunctionsAsVar?at:Qe:ct));var lt=this.yieldPos,ut=this.awaitPos,$t=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ft(O.async,O.generator)),ae&Wt||(O.id=this.type===V.name?this.parseIdent():null),this.parseFunctionParams(O),this.parseFunctionBody(O,Ve,!1,We),this.yieldPos=lt,this.awaitPos=ut,this.awaitIdentPos=$t,this.finishNode(O,ae&Wt?"FunctionDeclaration":"FunctionExpression")},pt.parseFunctionParams=function(O){this.expect(V.parenL),O.params=this.parseBindingList(V.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},pt.parseClass=function(O,ae){this.next();var Ve=this.strict;this.strict=!0,this.parseClassId(O,ae),this.parseClassSuper(O);var Le=this.enterClassBody(),We=this.startNode(),lt=!1;for(We.body=[],this.expect(V.braceL);this.type!==V.braceR;){var ut=this.parseClassElement(O.superClass!==null);ut&&(We.body.push(ut),ut.type==="MethodDefinition"&&ut.kind==="constructor"?(lt&&this.raiseRecoverable(ut.start,"Duplicate constructor in the same class"),lt=!0):ut.key&&ut.key.type==="PrivateIdentifier"&&jr(Le,ut)&&this.raiseRecoverable(ut.key.start,"Identifier '#"+ut.key.name+"' has already been declared"))}return this.strict=Ve,this.next(),O.body=this.finishNode(We,"ClassBody"),this.exitClassBody(),this.finishNode(O,ae?"ClassDeclaration":"ClassExpression")},pt.parseClassElement=function(O){if(this.eat(V.semi))return null;var ae=this.options.ecmaVersion,Ve=this.startNode(),Le="",We=!1,lt=!1,ut="method",$t=!1;if(this.eatContextual("static")){if(ae>=13&&this.eat(V.braceL))return this.parseClassStaticBlock(Ve),Ve;this.isClassElementNameStart()||this.type===V.star?$t=!0:Le="static"}if(Ve.static=$t,!Le&&ae>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===V.star)&&!this.canInsertSemicolon()?lt=!0:Le="async"),!Le&&(ae>=9||!lt)&&this.eat(V.star)&&(We=!0),!Le&&!lt&&!We){var Dt=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?ut=Dt:Le=Dt)}if(Le?(Ve.computed=!1,Ve.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Ve.key.name=Le,this.finishNode(Ve.key,"Identifier")):this.parseClassElementName(Ve),ae<13||this.type===V.parenL||ut!=="method"||We||lt){var er=!Ve.static&&wr(Ve,"constructor"),Jt=er&&O;er&&ut!=="method"&&this.raise(Ve.key.start,"Constructor can't have get/set modifier"),Ve.kind=er?"constructor":ut,this.parseClassMethod(Ve,We,lt,Jt)}else this.parseClassField(Ve);return Ve},pt.isClassElementNameStart=function(){return this.type===V.name||this.type===V.privateId||this.type===V.num||this.type===V.string||this.type===V.bracketL||this.type.keyword},pt.parseClassElementName=function(O){this.type===V.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),O.computed=!1,O.key=this.parsePrivateIdent()):this.parsePropertyName(O)},pt.parseClassMethod=function(O,ae,Ve,Le){var We=O.key;O.kind==="constructor"?(ae&&this.raise(We.start,"Constructor can't be a generator"),Ve&&this.raise(We.start,"Constructor can't be an async method")):O.static&&wr(O,"prototype")&&this.raise(We.start,"Classes may not have a static property named prototype");var lt=O.value=this.parseMethod(ae,Ve,Le);return O.kind==="get"&<.params.length!==0&&this.raiseRecoverable(lt.start,"getter should have no params"),O.kind==="set"&<.params.length!==1&&this.raiseRecoverable(lt.start,"setter should have exactly one param"),O.kind==="set"&<.params[0].type==="RestElement"&&this.raiseRecoverable(lt.params[0].start,"Setter cannot use rest params"),this.finishNode(O,"MethodDefinition")},pt.parseClassField=function(O){if(wr(O,"constructor")?this.raise(O.key.start,"Classes can't have a field named 'constructor'"):O.static&&wr(O,"prototype")&&this.raise(O.key.start,"Classes can't have a static field named 'prototype'"),this.eat(V.eq)){var ae=this.currentThisScope(),Ve=ae.inClassFieldInit;ae.inClassFieldInit=!0,O.value=this.parseMaybeAssign(),ae.inClassFieldInit=Ve}else O.value=null;return this.semicolon(),this.finishNode(O,"PropertyDefinition")},pt.parseClassStaticBlock=function(O){O.body=[];var ae=this.labels;for(this.labels=[],this.enterScope(qt|yt);this.type!==V.braceR;){var Ve=this.parseStatement(null);O.body.push(Ve)}return this.next(),this.exitScope(),this.labels=ae,this.finishNode(O,"StaticBlock")},pt.parseClassId=function(O,ae){this.type===V.name?(O.id=this.parseIdent(),ae&&this.checkLValSimple(O.id,Qe,!1)):(ae===!0&&this.unexpected(),O.id=null)},pt.parseClassSuper=function(O){O.superClass=this.eat(V._extends)?this.parseExprSubscripts(null,!1):null},pt.enterClassBody=function(){var O={declared:Object.create(null),used:[]};return this.privateNameStack.push(O),O.declared},pt.exitClassBody=function(){var O=this.privateNameStack.pop(),ae=O.declared,Ve=O.used;if(this.options.checkPrivateFields)for(var Le=this.privateNameStack.length,We=Le===0?null:this.privateNameStack[Le-1],lt=0;lt<Ve.length;++lt){var ut=Ve[lt];Fe(ae,ut.name)||(We?We.used.push(ut):this.raiseRecoverable(ut.start,"Private field '#"+ut.name+"' must be declared in an enclosing class"))}};function jr(O,ae){var Ve=ae.key.name,Le=O[Ve],We="true";return ae.type==="MethodDefinition"&&(ae.kind==="get"||ae.kind==="set")&&(We=(ae.static?"s":"i")+ae.kind),Le==="iget"&&We==="iset"||Le==="iset"&&We==="iget"||Le==="sget"&&We==="sset"||Le==="sset"&&We==="sget"?(O[Ve]="true",!1):Le?!0:(O[Ve]=We,!1)}function wr(O,ae){var Ve=O.computed,Le=O.key;return!Ve&&(Le.type==="Identifier"&&Le.name===ae||Le.type==="Literal"&&Le.value===ae)}pt.parseExportAllDeclaration=function(O,ae){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(O.exported=this.parseModuleExportName(),this.checkExport(ae,O.exported,this.lastTokStart)):O.exported=null),this.expectContextual("from"),this.type!==V.string&&this.unexpected(),O.source=this.parseExprAtom(),this.semicolon(),this.finishNode(O,"ExportAllDeclaration")},pt.parseExport=function(O,ae){if(this.next(),this.eat(V.star))return this.parseExportAllDeclaration(O,ae);if(this.eat(V._default))return this.checkExport(ae,"default",this.lastTokStart),O.declaration=this.parseExportDefaultDeclaration(),this.finishNode(O,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())O.declaration=this.parseExportDeclaration(O),O.declaration.type==="VariableDeclaration"?this.checkVariableExport(ae,O.declaration.declarations):this.checkExport(ae,O.declaration.id,O.declaration.id.start),O.specifiers=[],O.source=null;else{if(O.declaration=null,O.specifiers=this.parseExportSpecifiers(ae),this.eatContextual("from"))this.type!==V.string&&this.unexpected(),O.source=this.parseExprAtom();else{for(var Ve=0,Le=O.specifiers;Ve<Le.length;Ve+=1){var We=Le[Ve];this.checkUnreserved(We.local),this.checkLocalExport(We.local),We.local.type==="Literal"&&this.raise(We.local.start,"A string literal cannot be used as an exported binding without `from`.")}O.source=null}this.semicolon()}return this.finishNode(O,"ExportNamedDeclaration")},pt.parseExportDeclaration=function(O){return this.parseStatement(null)},pt.parseExportDefaultDeclaration=function(){var O;if(this.type===V._function||(O=this.isAsyncFunction())){var ae=this.startNode();return this.next(),O&&this.next(),this.parseFunction(ae,Wt|ur,!1,O)}else if(this.type===V._class){var Ve=this.startNode();return this.parseClass(Ve,"nullableID")}else{var Le=this.parseMaybeAssign();return this.semicolon(),Le}},pt.checkExport=function(O,ae,Ve){O&&(typeof ae!="string"&&(ae=ae.type==="Identifier"?ae.name:ae.value),Fe(O,ae)&&this.raiseRecoverable(Ve,"Duplicate export '"+ae+"'"),O[ae]=!0)},pt.checkPatternExport=function(O,ae){var Ve=ae.type;if(Ve==="Identifier")this.checkExport(O,ae,ae.start);else if(Ve==="ObjectPattern")for(var Le=0,We=ae.properties;Le<We.length;Le+=1){var lt=We[Le];this.checkPatternExport(O,lt)}else if(Ve==="ArrayPattern")for(var ut=0,$t=ae.elements;ut<$t.length;ut+=1){var Dt=$t[ut];Dt&&this.checkPatternExport(O,Dt)}else Ve==="Property"?this.checkPatternExport(O,ae.value):Ve==="AssignmentPattern"?this.checkPatternExport(O,ae.left):Ve==="RestElement"&&this.checkPatternExport(O,ae.argument)},pt.checkVariableExport=function(O,ae){if(O)for(var Ve=0,Le=ae;Ve<Le.length;Ve+=1){var We=Le[Ve];this.checkPatternExport(O,We.id)}},pt.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()},pt.parseExportSpecifier=function(O){var ae=this.startNode();return ae.local=this.parseModuleExportName(),ae.exported=this.eatContextual("as")?this.parseModuleExportName():ae.local,this.checkExport(O,ae.exported,ae.exported.start),this.finishNode(ae,"ExportSpecifier")},pt.parseExportSpecifiers=function(O){var ae=[],Ve=!0;for(this.expect(V.braceL);!this.eat(V.braceR);){if(Ve)Ve=!1;else if(this.expect(V.comma),this.afterTrailingComma(V.braceR))break;ae.push(this.parseExportSpecifier(O))}return ae},pt.parseImport=function(O){return this.next(),this.type===V.string?(O.specifiers=Zt,O.source=this.parseExprAtom()):(O.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),O.source=this.type===V.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(O,"ImportDeclaration")},pt.parseImportSpecifier=function(){var O=this.startNode();return O.imported=this.parseModuleExportName(),this.eatContextual("as")?O.local=this.parseIdent():(this.checkUnreserved(O.imported),O.local=O.imported),this.checkLValSimple(O.local,Qe),this.finishNode(O,"ImportSpecifier")},pt.parseImportDefaultSpecifier=function(){var O=this.startNode();return O.local=this.parseIdent(),this.checkLValSimple(O.local,Qe),this.finishNode(O,"ImportDefaultSpecifier")},pt.parseImportNamespaceSpecifier=function(){var O=this.startNode();return this.next(),this.expectContextual("as"),O.local=this.parseIdent(),this.checkLValSimple(O.local,Qe),this.finishNode(O,"ImportNamespaceSpecifier")},pt.parseImportSpecifiers=function(){var O=[],ae=!0;if(this.type===V.name&&(O.push(this.parseImportDefaultSpecifier()),!this.eat(V.comma)))return O;if(this.type===V.star)return O.push(this.parseImportNamespaceSpecifier()),O;for(this.expect(V.braceL);!this.eat(V.braceR);){if(ae)ae=!1;else if(this.expect(V.comma),this.afterTrailingComma(V.braceR))break;O.push(this.parseImportSpecifier())}return O},pt.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===V.string){var O=this.parseLiteral(this.value);return Ge.test(O.value)&&this.raise(O.start,"An export name cannot include a lone surrogate."),O}return this.parseIdent(!0)},pt.adaptDirectivePrologue=function(O){for(var ae=0;ae<O.length&&this.isDirectiveCandidate(O[ae]);++ae)O[ae].directive=O[ae].expression.raw.slice(1,-1)},pt.isDirectiveCandidate=function(O){return this.options.ecmaVersion>=5&&O.type==="ExpressionStatement"&&O.expression.type==="Literal"&&typeof O.expression.value=="string"&&(this.input[O.start]==='"'||this.input[O.start]==="'")};var gr=Rt.prototype;gr.toAssignable=function(O,ae,Ve){if(this.options.ecmaVersion>=6&&O)switch(O.type){case"Identifier":this.inAsync&&O.name==="await"&&this.raise(O.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":O.type="ObjectPattern",Ve&&this.checkPatternErrors(Ve,!0);for(var Le=0,We=O.properties;Le<We.length;Le+=1){var lt=We[Le];this.toAssignable(lt,ae),lt.type==="RestElement"&&(lt.argument.type==="ArrayPattern"||lt.argument.type==="ObjectPattern")&&this.raise(lt.argument.start,"Unexpected token")}break;case"Property":O.kind!=="init"&&this.raise(O.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(O.value,ae);break;case"ArrayExpression":O.type="ArrayPattern",Ve&&this.checkPatternErrors(Ve,!0),this.toAssignableList(O.elements,ae);break;case"SpreadElement":O.type="RestElement",this.toAssignable(O.argument,ae),O.argument.type==="AssignmentPattern"&&this.raise(O.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":O.operator!=="="&&this.raise(O.left.end,"Only '=' operator can be used for specifying default value."),O.type="AssignmentPattern",delete O.operator,this.toAssignable(O.left,ae);break;case"ParenthesizedExpression":this.toAssignable(O.expression,ae,Ve);break;case"ChainExpression":this.raiseRecoverable(O.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!ae)break;default:this.raise(O.start,"Assigning to rvalue")}else Ve&&this.checkPatternErrors(Ve,!0);return O},gr.toAssignableList=function(O,ae){for(var Ve=O.length,Le=0;Le<Ve;Le++){var We=O[Le];We&&this.toAssignable(We,ae)}if(Ve){var lt=O[Ve-1];this.options.ecmaVersion===6&&ae&<&<.type==="RestElement"&<.argument.type!=="Identifier"&&this.unexpected(lt.argument.start)}return O},gr.parseSpread=function(O){var ae=this.startNode();return this.next(),ae.argument=this.parseMaybeAssign(!1,O),this.finishNode(ae,"SpreadElement")},gr.parseRestBinding=function(){var O=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==V.name&&this.unexpected(),O.argument=this.parseBindingAtom(),this.finishNode(O,"RestElement")},gr.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case V.bracketL:var O=this.startNode();return this.next(),O.elements=this.parseBindingList(V.bracketR,!0,!0),this.finishNode(O,"ArrayPattern");case V.braceL:return this.parseObj(!0)}return this.parseIdent()},gr.parseBindingList=function(O,ae,Ve,Le){for(var We=[],lt=!0;!this.eat(O);)if(lt?lt=!1:this.expect(V.comma),ae&&this.type===V.comma)We.push(null);else{if(Ve&&this.afterTrailingComma(O))break;if(this.type===V.ellipsis){var ut=this.parseRestBinding();this.parseBindingListItem(ut),We.push(ut),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(O);break}else We.push(this.parseAssignableListItem(Le))}return We},gr.parseAssignableListItem=function(O){var ae=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(ae),ae},gr.parseBindingListItem=function(O){return O},gr.parseMaybeDefault=function(O,ae,Ve){if(Ve=Ve||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(V.eq))return Ve;var Le=this.startNodeAt(O,ae);return Le.left=Ve,Le.right=this.parseMaybeAssign(),this.finishNode(Le,"AssignmentPattern")},gr.checkLValSimple=function(O,ae,Ve){ae===void 0&&(ae=Ke);var Le=ae!==Ke;switch(O.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(O.name)&&this.raiseRecoverable(O.start,(Le?"Binding ":"Assigning to ")+O.name+" in strict mode"),Le&&(ae===Qe&&O.name==="let"&&this.raiseRecoverable(O.start,"let is disallowed as a lexically bound name"),Ve&&(Fe(Ve,O.name)&&this.raiseRecoverable(O.start,"Argument name clash"),Ve[O.name]=!0),ae!==dt&&this.declareName(O.name,ae,O.start));break;case"ChainExpression":this.raiseRecoverable(O.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":Le&&this.raiseRecoverable(O.start,"Binding member expression");break;case"ParenthesizedExpression":return Le&&this.raiseRecoverable(O.start,"Binding parenthesized expression"),this.checkLValSimple(O.expression,ae,Ve);default:this.raise(O.start,(Le?"Binding":"Assigning to")+" rvalue")}},gr.checkLValPattern=function(O,ae,Ve){switch(ae===void 0&&(ae=Ke),O.type){case"ObjectPattern":for(var Le=0,We=O.properties;Le<We.length;Le+=1){var lt=We[Le];this.checkLValInnerPattern(lt,ae,Ve)}break;case"ArrayPattern":for(var ut=0,$t=O.elements;ut<$t.length;ut+=1){var Dt=$t[ut];Dt&&this.checkLValInnerPattern(Dt,ae,Ve)}break;default:this.checkLValSimple(O,ae,Ve)}},gr.checkLValInnerPattern=function(O,ae,Ve){switch(ae===void 0&&(ae=Ke),O.type){case"Property":this.checkLValInnerPattern(O.value,ae,Ve);break;case"AssignmentPattern":this.checkLValPattern(O.left,ae,Ve);break;case"RestElement":this.checkLValPattern(O.argument,ae,Ve);break;default:this.checkLValPattern(O,ae,Ve)}};var xr=function(ae,Ve,Le,We,lt){this.token=ae,this.isExpr=!!Ve,this.preserveSpace=!!Le,this.override=We,this.generator=!!lt},tr={b_stat:new xr("{",!1),b_expr:new xr("{",!0),b_tmpl:new xr("${",!1),p_stat:new xr("(",!1),p_expr:new xr("(",!0),q_tmpl:new xr("`",!0,!0,function(O){return O.tryReadTemplateToken()}),f_stat:new xr("function",!1),f_expr:new xr("function",!0),f_expr_gen:new xr("function",!0,!1,null,!0),f_gen:new xr("function",!1,!1,null,!0)},$r=Rt.prototype;$r.initialContext=function(){return[tr.b_stat]},$r.curContext=function(){return this.context[this.context.length-1]},$r.braceIsBlock=function(O){var ae=this.curContext();return ae===tr.f_expr||ae===tr.f_stat?!0:O===V.colon&&(ae===tr.b_stat||ae===tr.b_expr)?!ae.isExpr:O===V._return||O===V.name&&this.exprAllowed?te.test(this.input.slice(this.lastTokEnd,this.start)):O===V._else||O===V.semi||O===V.eof||O===V.parenR||O===V.arrow?!0:O===V.braceL?ae===tr.b_stat:O===V._var||O===V._const||O===V.name?!1:!this.exprAllowed},$r.inGeneratorContext=function(){for(var O=this.context.length-1;O>=1;O--){var ae=this.context[O];if(ae.token==="function")return ae.generator}return!1},$r.updateContext=function(O){var ae,Ve=this.type;Ve.keyword&&O===V.dot?this.exprAllowed=!1:(ae=Ve.updateContext)?ae.call(this,O):this.exprAllowed=Ve.beforeExpr},$r.overrideContext=function(O){this.curContext()!==O&&(this.context[this.context.length-1]=O)},V.parenR.updateContext=V.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var O=this.context.pop();O===tr.b_stat&&this.curContext().token==="function"&&(O=this.context.pop()),this.exprAllowed=!O.isExpr},V.braceL.updateContext=function(O){this.context.push(this.braceIsBlock(O)?tr.b_stat:tr.b_expr),this.exprAllowed=!0},V.dollarBraceL.updateContext=function(){this.context.push(tr.b_tmpl),this.exprAllowed=!0},V.parenL.updateContext=function(O){var ae=O===V._if||O===V._for||O===V._with||O===V._while;this.context.push(ae?tr.p_stat:tr.p_expr),this.exprAllowed=!0},V.incDec.updateContext=function(){},V._function.updateContext=V._class.updateContext=function(O){O.beforeExpr&&O!==V._else&&!(O===V.semi&&this.curContext()!==tr.p_stat)&&!(O===V._return&&te.test(this.input.slice(this.lastTokEnd,this.start)))&&!((O===V.colon||O===V.braceL)&&this.curContext()===tr.b_stat)?this.context.push(tr.f_expr):this.context.push(tr.f_stat),this.exprAllowed=!1},V.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0},V.backQuote.updateContext=function(){this.curContext()===tr.q_tmpl?this.context.pop():this.context.push(tr.q_tmpl),this.exprAllowed=!1},V.star.updateContext=function(O){if(O===V._function){var ae=this.context.length-1;this.context[ae]===tr.f_expr?this.context[ae]=tr.f_expr_gen:this.context[ae]=tr.f_gen}this.exprAllowed=!0},V.name.updateContext=function(O){var ae=!1;this.options.ecmaVersion>=6&&O!==V.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(ae=!0),this.exprAllowed=ae};var Xt=Rt.prototype;Xt.checkPropClash=function(O,ae,Ve){if(!(this.options.ecmaVersion>=9&&O.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(O.computed||O.method||O.shorthand))){var Le=O.key,We;switch(Le.type){case"Identifier":We=Le.name;break;case"Literal":We=String(Le.value);break;default:return}var lt=O.kind;if(this.options.ecmaVersion>=6){We==="__proto__"&<==="init"&&(ae.proto&&(Ve?Ve.doubleProto<0&&(Ve.doubleProto=Le.start):this.raiseRecoverable(Le.start,"Redefinition of __proto__ property")),ae.proto=!0);return}We="$"+We;var ut=ae[We];if(ut){var $t;lt==="init"?$t=this.strict&&ut.init||ut.get||ut.set:$t=ut.init||ut[lt],$t&&this.raiseRecoverable(Le.start,"Redefinition of property")}else ut=ae[We]={init:!1,get:!1,set:!1};ut[lt]=!0}},Xt.parseExpression=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseMaybeAssign(O,ae);if(this.type===V.comma){var lt=this.startNodeAt(Ve,Le);for(lt.expressions=[We];this.eat(V.comma);)lt.expressions.push(this.parseMaybeAssign(O,ae));return this.finishNode(lt,"SequenceExpression")}return We},Xt.parseMaybeAssign=function(O,ae,Ve){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(O);this.exprAllowed=!1}var Le=!1,We=-1,lt=-1,ut=-1;ae?(We=ae.parenthesizedAssign,lt=ae.trailingComma,ut=ae.doubleProto,ae.parenthesizedAssign=ae.trailingComma=-1):(ae=new dr,Le=!0);var $t=this.start,Dt=this.startLoc;(this.type===V.parenL||this.type===V.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=O==="await");var er=this.parseMaybeConditional(O,ae);if(Ve&&(er=Ve.call(this,er,$t,Dt)),this.type.isAssign){var Jt=this.startNodeAt($t,Dt);return Jt.operator=this.value,this.type===V.eq&&(er=this.toAssignable(er,!1,ae)),Le||(ae.parenthesizedAssign=ae.trailingComma=ae.doubleProto=-1),ae.shorthandAssign>=er.start&&(ae.shorthandAssign=-1),this.type===V.eq?this.checkLValPattern(er):this.checkLValSimple(er),Jt.left=er,this.next(),Jt.right=this.parseMaybeAssign(O),ut>-1&&(ae.doubleProto=ut),this.finishNode(Jt,"AssignmentExpression")}else Le&&this.checkExpressionErrors(ae,!0);return We>-1&&(ae.parenthesizedAssign=We),lt>-1&&(ae.trailingComma=lt),er},Xt.parseMaybeConditional=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseExprOps(O,ae);if(this.checkExpressionErrors(ae))return We;if(this.eat(V.question)){var lt=this.startNodeAt(Ve,Le);return lt.test=We,lt.consequent=this.parseMaybeAssign(),this.expect(V.colon),lt.alternate=this.parseMaybeAssign(O),this.finishNode(lt,"ConditionalExpression")}return We},Xt.parseExprOps=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseMaybeUnary(ae,!1,!1,O);return this.checkExpressionErrors(ae)||We.start===Ve&&We.type==="ArrowFunctionExpression"?We:this.parseExprOp(We,Ve,Le,-1,O)},Xt.parseExprOp=function(O,ae,Ve,Le,We){var lt=this.type.binop;if(lt!=null&&(!We||this.type!==V._in)&<>Le){var ut=this.type===V.logicalOR||this.type===V.logicalAND,$t=this.type===V.coalesce;$t&&(lt=V.logicalAND.binop);var Dt=this.value;this.next();var er=this.start,Jt=this.startLoc,yr=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,We),er,Jt,lt,We),Ur=this.buildBinary(ae,Ve,O,yr,Dt,ut||$t);return(ut&&this.type===V.coalesce||$t&&(this.type===V.logicalOR||this.type===V.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(Ur,ae,Ve,Le,We)}return O},Xt.buildBinary=function(O,ae,Ve,Le,We,lt){Le.type==="PrivateIdentifier"&&this.raise(Le.start,"Private identifier can only be left side of binary expression");var ut=this.startNodeAt(O,ae);return ut.left=Ve,ut.operator=We,ut.right=Le,this.finishNode(ut,lt?"LogicalExpression":"BinaryExpression")},Xt.parseMaybeUnary=function(O,ae,Ve,Le){var We=this.start,lt=this.startLoc,ut;if(this.isContextual("await")&&this.canAwait)ut=this.parseAwait(Le),ae=!0;else if(this.type.prefix){var $t=this.startNode(),Dt=this.type===V.incDec;$t.operator=this.value,$t.prefix=!0,this.next(),$t.argument=this.parseMaybeUnary(null,!0,Dt,Le),this.checkExpressionErrors(O,!0),Dt?this.checkLValSimple($t.argument):this.strict&&$t.operator==="delete"&&mr($t.argument)?this.raiseRecoverable($t.start,"Deleting local variable in strict mode"):$t.operator==="delete"&&Mr($t.argument)?this.raiseRecoverable($t.start,"Private fields can not be deleted"):ae=!0,ut=this.finishNode($t,Dt?"UpdateExpression":"UnaryExpression")}else if(!ae&&this.type===V.privateId)(Le||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),ut=this.parsePrivateIdent(),this.type!==V._in&&this.unexpected();else{if(ut=this.parseExprSubscripts(O,Le),this.checkExpressionErrors(O))return ut;for(;this.type.postfix&&!this.canInsertSemicolon();){var er=this.startNodeAt(We,lt);er.operator=this.value,er.prefix=!1,er.argument=ut,this.checkLValSimple(ut),this.next(),ut=this.finishNode(er,"UpdateExpression")}}if(!Ve&&this.eat(V.starstar))if(ae)this.unexpected(this.lastTokStart);else return this.buildBinary(We,lt,ut,this.parseMaybeUnary(null,!1,!1,Le),"**",!1);else return ut};function mr(O){return O.type==="Identifier"||O.type==="ParenthesizedExpression"&&mr(O.expression)}function Mr(O){return O.type==="MemberExpression"&&O.property.type==="PrivateIdentifier"||O.type==="ChainExpression"&&Mr(O.expression)||O.type==="ParenthesizedExpression"&&Mr(O.expression)}Xt.parseExprSubscripts=function(O,ae){var Ve=this.start,Le=this.startLoc,We=this.parseExprAtom(O,ae);if(We.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return We;var lt=this.parseSubscripts(We,Ve,Le,!1,ae);return O&<.type==="MemberExpression"&&(O.parenthesizedAssign>=lt.start&&(O.parenthesizedAssign=-1),O.parenthesizedBind>=lt.start&&(O.parenthesizedBind=-1),O.trailingComma>=lt.start&&(O.trailingComma=-1)),lt},Xt.parseSubscripts=function(O,ae,Ve,Le,We){for(var lt=this.options.ecmaVersion>=8&&O.type==="Identifier"&&O.name==="async"&&this.lastTokEnd===O.end&&!this.canInsertSemicolon()&&O.end-O.start===5&&this.potentialArrowAt===O.start,ut=!1;;){var $t=this.parseSubscript(O,ae,Ve,Le,lt,ut,We);if($t.optional&&(ut=!0),$t===O||$t.type==="ArrowFunctionExpression"){if(ut){var Dt=this.startNodeAt(ae,Ve);Dt.expression=$t,$t=this.finishNode(Dt,"ChainExpression")}return $t}O=$t}},Xt.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(V.arrow)},Xt.parseSubscriptAsyncArrow=function(O,ae,Ve,Le){return this.parseArrowExpression(this.startNodeAt(O,ae),Ve,!0,Le)},Xt.parseSubscript=function(O,ae,Ve,Le,We,lt,ut){var $t=this.options.ecmaVersion>=11,Dt=$t&&this.eat(V.questionDot);Le&&Dt&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var er=this.eat(V.bracketL);if(er||Dt&&this.type!==V.parenL&&this.type!==V.backQuote||this.eat(V.dot)){var Jt=this.startNodeAt(ae,Ve);Jt.object=O,er?(Jt.property=this.parseExpression(),this.expect(V.bracketR)):this.type===V.privateId&&O.type!=="Super"?Jt.property=this.parsePrivateIdent():Jt.property=this.parseIdent(this.options.allowReserved!=="never"),Jt.computed=!!er,$t&&(Jt.optional=Dt),O=this.finishNode(Jt,"MemberExpression")}else if(!Le&&this.eat(V.parenL)){var yr=new dr,Ur=this.yieldPos,rn=this.awaitPos,Wr=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var mn=this.parseExprList(V.parenR,this.options.ecmaVersion>=8,!1,yr);if(We&&!Dt&&this.shouldParseAsyncArrow())return this.checkPatternErrors(yr,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=Ur,this.awaitPos=rn,this.awaitIdentPos=Wr,this.parseSubscriptAsyncArrow(ae,Ve,mn,ut);this.checkExpressionErrors(yr,!0),this.yieldPos=Ur||this.yieldPos,this.awaitPos=rn||this.awaitPos,this.awaitIdentPos=Wr||this.awaitIdentPos;var Kr=this.startNodeAt(ae,Ve);Kr.callee=O,Kr.arguments=mn,$t&&(Kr.optional=Dt),O=this.finishNode(Kr,"CallExpression")}else if(this.type===V.backQuote){(Dt||lt)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var Yr=this.startNodeAt(ae,Ve);Yr.tag=O,Yr.quasi=this.parseTemplate({isTagged:!0}),O=this.finishNode(Yr,"TaggedTemplateExpression")}return O},Xt.parseExprAtom=function(O,ae,Ve){this.type===V.slash&&this.readRegexp();var Le,We=this.potentialArrowAt===this.start;switch(this.type){case V._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),Le=this.startNode(),this.next(),this.type===V.parenL&&!this.allowDirectSuper&&this.raise(Le.start,"super() call outside constructor of a subclass"),this.type!==V.dot&&this.type!==V.bracketL&&this.type!==V.parenL&&this.unexpected(),this.finishNode(Le,"Super");case V._this:return Le=this.startNode(),this.next(),this.finishNode(Le,"ThisExpression");case V.name:var lt=this.start,ut=this.startLoc,$t=this.containsEsc,Dt=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!$t&&Dt.name==="async"&&!this.canInsertSemicolon()&&this.eat(V._function))return this.overrideContext(tr.f_expr),this.parseFunction(this.startNodeAt(lt,ut),0,!1,!0,ae);if(We&&!this.canInsertSemicolon()){if(this.eat(V.arrow))return this.parseArrowExpression(this.startNodeAt(lt,ut),[Dt],!1,ae);if(this.options.ecmaVersion>=8&&Dt.name==="async"&&this.type===V.name&&!$t&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return Dt=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(V.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(lt,ut),[Dt],!0,ae)}return Dt;case V.regexp:var er=this.value;return Le=this.parseLiteral(er.value),Le.regex={pattern:er.pattern,flags:er.flags},Le;case V.num:case V.string:return this.parseLiteral(this.value);case V._null:case V._true:case V._false:return Le=this.startNode(),Le.value=this.type===V._null?null:this.type===V._true,Le.raw=this.type.keyword,this.next(),this.finishNode(Le,"Literal");case V.parenL:var Jt=this.start,yr=this.parseParenAndDistinguishExpression(We,ae);return O&&(O.parenthesizedAssign<0&&!this.isSimpleAssignTarget(yr)&&(O.parenthesizedAssign=Jt),O.parenthesizedBind<0&&(O.parenthesizedBind=Jt)),yr;case V.bracketL:return Le=this.startNode(),this.next(),Le.elements=this.parseExprList(V.bracketR,!0,!0,O),this.finishNode(Le,"ArrayExpression");case V.braceL:return this.overrideContext(tr.b_expr),this.parseObj(!1,O);case V._function:return Le=this.startNode(),this.next(),this.parseFunction(Le,0);case V._class:return this.parseClass(this.startNode(),!1);case V._new:return this.parseNew();case V.backQuote:return this.parseTemplate();case V._import:return this.options.ecmaVersion>=11?this.parseExprImport(Ve):this.unexpected();default:return this.parseExprAtomDefault()}},Xt.parseExprAtomDefault=function(){this.unexpected()},Xt.parseExprImport=function(O){var ae=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===V.parenL&&!O)return this.parseDynamicImport(ae);if(this.type===V.dot){var Ve=this.startNodeAt(ae.start,ae.loc&&ae.loc.start);return Ve.name="import",ae.meta=this.finishNode(Ve,"Identifier"),this.parseImportMeta(ae)}else this.unexpected()},Xt.parseDynamicImport=function(O){if(this.next(),O.source=this.parseMaybeAssign(),!this.eat(V.parenR)){var ae=this.start;this.eat(V.comma)&&this.eat(V.parenR)?this.raiseRecoverable(ae,"Trailing comma is not allowed in import()"):this.unexpected(ae)}return this.finishNode(O,"ImportExpression")},Xt.parseImportMeta=function(O){this.next();var ae=this.containsEsc;return O.property=this.parseIdent(!0),O.property.name!=="meta"&&this.raiseRecoverable(O.property.start,"The only valid meta property for import is 'import.meta'"),ae&&this.raiseRecoverable(O.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(O.start,"Cannot use 'import.meta' outside a module"),this.finishNode(O,"MetaProperty")},Xt.parseLiteral=function(O){var ae=this.startNode();return ae.value=O,ae.raw=this.input.slice(this.start,this.end),ae.raw.charCodeAt(ae.raw.length-1)===110&&(ae.bigint=ae.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(ae,"Literal")},Xt.parseParenExpression=function(){this.expect(V.parenL);var O=this.parseExpression();return this.expect(V.parenR),O},Xt.shouldParseArrow=function(O){return!this.canInsertSemicolon()},Xt.parseParenAndDistinguishExpression=function(O,ae){var Ve=this.start,Le=this.startLoc,We,lt=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var ut=this.start,$t=this.startLoc,Dt=[],er=!0,Jt=!1,yr=new dr,Ur=this.yieldPos,rn=this.awaitPos,Wr;for(this.yieldPos=0,this.awaitPos=0;this.type!==V.parenR;)if(er?er=!1:this.expect(V.comma),lt&&this.afterTrailingComma(V.parenR,!0)){Jt=!0;break}else if(this.type===V.ellipsis){Wr=this.start,Dt.push(this.parseParenItem(this.parseRestBinding())),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else Dt.push(this.parseMaybeAssign(!1,yr,this.parseParenItem));var mn=this.lastTokEnd,Kr=this.lastTokEndLoc;if(this.expect(V.parenR),O&&this.shouldParseArrow(Dt)&&this.eat(V.arrow))return this.checkPatternErrors(yr,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=Ur,this.awaitPos=rn,this.parseParenArrowList(Ve,Le,Dt,ae);(!Dt.length||Jt)&&this.unexpected(this.lastTokStart),Wr&&this.unexpected(Wr),this.checkExpressionErrors(yr,!0),this.yieldPos=Ur||this.yieldPos,this.awaitPos=rn||this.awaitPos,Dt.length>1?(We=this.startNodeAt(ut,$t),We.expressions=Dt,this.finishNodeAt(We,"SequenceExpression",mn,Kr)):We=Dt[0]}else We=this.parseParenExpression();if(this.options.preserveParens){var Yr=this.startNodeAt(Ve,Le);return Yr.expression=We,this.finishNode(Yr,"ParenthesizedExpression")}else return We},Xt.parseParenItem=function(O){return O},Xt.parseParenArrowList=function(O,ae,Ve,Le){return this.parseArrowExpression(this.startNodeAt(O,ae),Ve,!1,Le)};var gn=[];Xt.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var O=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===V.dot){var ae=this.startNodeAt(O.start,O.loc&&O.loc.start);ae.name="new",O.meta=this.finishNode(ae,"Identifier"),this.next();var Ve=this.containsEsc;return O.property=this.parseIdent(!0),O.property.name!=="target"&&this.raiseRecoverable(O.property.start,"The only valid meta property for new is 'new.target'"),Ve&&this.raiseRecoverable(O.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(O.start,"'new.target' can only be used in functions and class static block"),this.finishNode(O,"MetaProperty")}var Le=this.start,We=this.startLoc;return O.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),Le,We,!0,!1),this.eat(V.parenL)?O.arguments=this.parseExprList(V.parenR,this.options.ecmaVersion>=8,!1):O.arguments=gn,this.finishNode(O,"NewExpression")},Xt.parseTemplateElement=function(O){var ae=O.isTagged,Ve=this.startNode();return this.type===V.invalidTemplate?(ae||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),Ve.value={raw:this.value.replace(/\r\n?/g,`
|
|
1098
1098
|
`),cooked:null}):Ve.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
|
|
1099
|
-
`),cooked:this.value},this.next(),Ve.tail=this.type===V.backQuote,this.finishNode(Ve,"TemplateElement")},Xt.parseTemplate=function(O){O===void 0&&(O={});var ae=O.isTagged;ae===void 0&&(ae=!1);var Ve=this.startNode();this.next(),Ve.expressions=[];var Le=this.parseTemplateElement({isTagged:ae});for(Ve.quasis=[Le];!Le.tail;)this.type===V.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(V.dollarBraceL),Ve.expressions.push(this.parseExpression()),this.expect(V.braceR),Ve.quasis.push(Le=this.parseTemplateElement({isTagged:ae}));return this.next(),this.finishNode(Ve,"TemplateLiteral")},Xt.isAsyncProp=function(O){return!O.computed&&O.key.type==="Identifier"&&O.key.name==="async"&&(this.type===V.name||this.type===V.num||this.type===V.string||this.type===V.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===V.star)&&!te.test(this.input.slice(this.lastTokEnd,this.start))},Xt.parseObj=function(O,ae){var Ve=this.startNode(),Le=!0,We={};for(Ve.properties=[],this.next();!this.eat(V.braceR);){if(Le)Le=!1;else if(this.expect(V.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(V.braceR))break;var lt=this.parseProperty(O,ae);O||this.checkPropClash(lt,We,ae),Ve.properties.push(lt)}return this.finishNode(Ve,O?"ObjectPattern":"ObjectExpression")},Xt.parseProperty=function(O,ae){var Ve=this.startNode(),Le,We,lt,ut;if(this.options.ecmaVersion>=9&&this.eat(V.ellipsis))return O?(Ve.argument=this.parseIdent(!1),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(Ve,"RestElement")):(Ve.argument=this.parseMaybeAssign(!1,ae),this.type===V.comma&&ae&&ae.trailingComma<0&&(ae.trailingComma=this.start),this.finishNode(Ve,"SpreadElement"));this.options.ecmaVersion>=6&&(Ve.method=!1,Ve.shorthand=!1,(O||ae)&&(lt=this.start,ut=this.startLoc),O||(Le=this.eat(V.star)));var $t=this.containsEsc;return this.parsePropertyName(Ve),!O&&!$t&&this.options.ecmaVersion>=8&&!Le&&this.isAsyncProp(Ve)?(We=!0,Le=this.options.ecmaVersion>=9&&this.eat(V.star),this.parsePropertyName(Ve)):We=!1,this.parsePropertyValue(Ve,O,Le,We,lt,ut,ae,$t),this.finishNode(Ve,"Property")},Xt.parseGetterSetter=function(O){O.kind=O.key.name,this.parsePropertyName(O),O.value=this.parseMethod(!1);var ae=O.kind==="get"?0:1;if(O.value.params.length!==ae){var Ve=O.value.start;O.kind==="get"?this.raiseRecoverable(Ve,"getter should have no params"):this.raiseRecoverable(Ve,"setter should have exactly one param")}else O.kind==="set"&&O.value.params[0].type==="RestElement"&&this.raiseRecoverable(O.value.params[0].start,"Setter cannot use rest params")},Xt.parsePropertyValue=function(O,ae,Ve,Le,We,lt,ut,$t){(Ve||Le)&&this.type===V.colon&&this.unexpected(),this.eat(V.colon)?(O.value=ae?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,ut),O.kind="init"):this.options.ecmaVersion>=6&&this.type===V.parenL?(ae&&this.unexpected(),O.kind="init",O.method=!0,O.value=this.parseMethod(Ve,Le)):!ae&&!$t&&this.options.ecmaVersion>=5&&!O.computed&&O.key.type==="Identifier"&&(O.key.name==="get"||O.key.name==="set")&&this.type!==V.comma&&this.type!==V.braceR&&this.type!==V.eq?((Ve||Le)&&this.unexpected(),this.parseGetterSetter(O)):this.options.ecmaVersion>=6&&!O.computed&&O.key.type==="Identifier"?((Ve||Le)&&this.unexpected(),this.checkUnreserved(O.key),O.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=We),O.kind="init",ae?O.value=this.parseMaybeDefault(We,lt,this.copyNode(O.key)):this.type===V.eq&&ut?(ut.shorthandAssign<0&&(ut.shorthandAssign=this.start),O.value=this.parseMaybeDefault(We,lt,this.copyNode(O.key))):O.value=this.copyNode(O.key),O.shorthand=!0):this.unexpected()},Xt.parsePropertyName=function(O){if(this.options.ecmaVersion>=6){if(this.eat(V.bracketL))return O.computed=!0,O.key=this.parseMaybeAssign(),this.expect(V.bracketR),O.key;O.computed=!1}return O.key=this.type===V.num||this.type===V.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},Xt.initFunction=function(O){O.id=null,this.options.ecmaVersion>=6&&(O.generator=O.expression=!1),this.options.ecmaVersion>=8&&(O.async=!1)},Xt.parseMethod=function(O,ae,Ve){var Le=this.startNode(),We=this.yieldPos,lt=this.awaitPos,ut=this.awaitIdentPos;return this.initFunction(Le),this.options.ecmaVersion>=6&&(Le.generator=O),this.options.ecmaVersion>=8&&(Le.async=!!ae),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ft(ae,Le.generator)|yt|(Ve?Mt:0)),this.expect(V.parenL),Le.params=this.parseBindingList(V.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Le,!1,!0,!1),this.yieldPos=We,this.awaitPos=lt,this.awaitIdentPos=ut,this.finishNode(Le,"FunctionExpression")},Xt.parseArrowExpression=function(O,ae,Ve,Le){var We=this.yieldPos,lt=this.awaitPos,ut=this.awaitIdentPos;return this.enterScope(Ft(Ve,!1)|Ct),this.initFunction(O),this.options.ecmaVersion>=8&&(O.async=!!Ve),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,O.params=this.toAssignableList(ae,!0),this.parseFunctionBody(O,!0,!1,Le),this.yieldPos=We,this.awaitPos=lt,this.awaitIdentPos=ut,this.finishNode(O,"ArrowFunctionExpression")},Xt.parseFunctionBody=function(O,ae,Ve,Le){var We=ae&&this.type!==V.braceL,lt=this.strict,ut=!1;if(We)O.body=this.parseMaybeAssign(Le),O.expression=!0,this.checkParams(O,!1);else{var $t=this.options.ecmaVersion>=7&&!this.isSimpleParamList(O.params);(!lt||$t)&&(ut=this.strictDirective(this.end),ut&&$t&&this.raiseRecoverable(O.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var Dt=this.labels;this.labels=[],ut&&(this.strict=!0),this.checkParams(O,!lt&&!ut&&!ae&&!Ve&&this.isSimpleParamList(O.params)),this.strict&&O.id&&this.checkLValSimple(O.id,dt),O.body=this.parseBlock(!1,void 0,ut&&!lt),O.expression=!1,this.adaptDirectivePrologue(O.body.body),this.labels=Dt}this.exitScope()},Xt.isSimpleParamList=function(O){for(var ae=0,Ve=O;ae<Ve.length;ae+=1){var Le=Ve[ae];if(Le.type!=="Identifier")return!1}return!0},Xt.checkParams=function(O,ae){for(var Ve=Object.create(null),Le=0,We=O.params;Le<We.length;Le+=1){var lt=We[Le];this.checkLValInnerPattern(lt,at,ae?null:Ve)}},Xt.parseExprList=function(O,ae,Ve,Le){for(var We=[],lt=!0;!this.eat(O);){if(lt)lt=!1;else if(this.expect(V.comma),ae&&this.afterTrailingComma(O))break;var ut=void 0;Ve&&this.type===V.comma?ut=null:this.type===V.ellipsis?(ut=this.parseSpread(Le),Le&&this.type===V.comma&&Le.trailingComma<0&&(Le.trailingComma=this.start)):ut=this.parseMaybeAssign(!1,Le),We.push(ut)}return We},Xt.checkUnreserved=function(O){var ae=O.start,Ve=O.end,Le=O.name;if(this.inGenerator&&Le==="yield"&&this.raiseRecoverable(ae,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&Le==="await"&&this.raiseRecoverable(ae,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&Le==="arguments"&&this.raiseRecoverable(ae,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(Le==="arguments"||Le==="await")&&this.raise(ae,"Cannot use "+Le+" in class static initialization block"),this.keywords.test(Le)&&this.raise(ae,"Unexpected keyword '"+Le+"'"),!(this.options.ecmaVersion<6&&this.input.slice(ae,Ve).indexOf("\\")!==-1)){var We=this.strict?this.reservedWordsStrict:this.reservedWords;We.test(Le)&&(!this.inAsync&&Le==="await"&&this.raiseRecoverable(ae,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(ae,"The keyword '"+Le+"' is reserved"))}},Xt.parseIdent=function(O){var ae=this.parseIdentNode();return this.next(!!O),this.finishNode(ae,"Identifier"),O||(this.checkUnreserved(ae),ae.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=ae.start)),ae},Xt.parseIdentNode=function(){var O=this.startNode();return this.type===V.name?O.name=this.value:this.type.keyword?(O.name=this.type.keyword,(O.name==="class"||O.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=V.name):this.unexpected(),O},Xt.parsePrivateIdent=function(){var O=this.startNode();return this.type===V.privateId?O.name=this.value:this.unexpected(),this.next(),this.finishNode(O,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(O.start,"Private field '#"+O.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(O)),O},Xt.parseYield=function(O){this.yieldPos||(this.yieldPos=this.start);var ae=this.startNode();return this.next(),this.type===V.semi||this.canInsertSemicolon()||this.type!==V.star&&!this.type.startsExpr?(ae.delegate=!1,ae.argument=null):(ae.delegate=this.eat(V.star),ae.argument=this.parseMaybeAssign(O)),this.finishNode(ae,"YieldExpression")},Xt.parseAwait=function(O){this.awaitPos||(this.awaitPos=this.start);var ae=this.startNode();return this.next(),ae.argument=this.parseMaybeUnary(null,!0,!1,O),this.finishNode(ae,"AwaitExpression")};var Dr=Rt.prototype;Dr.raise=function(O,ae){var Ve=tt(this.input,O);ae+=" ("+Ve.line+":"+Ve.column+")";var Le=new SyntaxError(ae);throw Le.pos=O,Le.loc=Ve,Le.raisedAt=this.pos,Le},Dr.raiseRecoverable=Dr.raise,Dr.curPosition=function(){if(this.options.locations)return new He(this.curLine,this.pos-this.lineStart)};var wr=Rt.prototype,nn=function(ae){this.flags=ae,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};wr.enterScope=function(O){this.scopeStack.push(new nn(O))},wr.exitScope=function(){this.scopeStack.pop()},wr.treatFunctionsAsVarInScope=function(O){return O.flags&st||!this.inModule&&O.flags&et},wr.declareName=function(O,ae,Ve){var Le=!1;if(ae===Qe){var We=this.currentScope();Le=We.lexical.indexOf(O)>-1||We.functions.indexOf(O)>-1||We.var.indexOf(O)>-1,We.lexical.push(O),this.inModule&&We.flags&et&&delete this.undefinedExports[O]}else if(ae===ft){var lt=this.currentScope();lt.lexical.push(O)}else if(ae===ct){var ut=this.currentScope();this.treatFunctionsAsVar?Le=ut.lexical.indexOf(O)>-1:Le=ut.lexical.indexOf(O)>-1||ut.var.indexOf(O)>-1,ut.functions.push(O)}else for(var $t=this.scopeStack.length-1;$t>=0;--$t){var Dt=this.scopeStack[$t];if(Dt.lexical.indexOf(O)>-1&&!(Dt.flags&Je&&Dt.lexical[0]===O)||!this.treatFunctionsAsVarInScope(Dt)&&Dt.functions.indexOf(O)>-1){Le=!0;break}if(Dt.var.push(O),this.inModule&&Dt.flags&et&&delete this.undefinedExports[O],Dt.flags&Ht)break}Le&&this.raiseRecoverable(Ve,"Identifier '"+O+"' has already been declared")},wr.checkLocalExport=function(O){this.scopeStack[0].lexical.indexOf(O.name)===-1&&this.scopeStack[0].var.indexOf(O.name)===-1&&(this.undefinedExports[O.name]=O)},wr.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},wr.currentVarScope=function(){for(var O=this.scopeStack.length-1;;O--){var ae=this.scopeStack[O];if(ae.flags&Ht)return ae}},wr.currentThisScope=function(){for(var O=this.scopeStack.length-1;;O--){var ae=this.scopeStack[O];if(ae.flags&Ht&&!(ae.flags&Ct))return ae}};var Or=function(ae,Ve,Le){this.type="",this.start=Ve,this.end=0,ae.options.locations&&(this.loc=new Ze(ae,Le)),ae.options.directSourceFile&&(this.sourceFile=ae.options.directSourceFile),ae.options.ranges&&(this.range=[Ve,0])},Br=Rt.prototype;Br.startNode=function(){return new Or(this,this.start,this.startLoc)},Br.startNodeAt=function(O,ae){return new Or(this,O,ae)};function Rr(O,ae,Ve,Le){return O.type=ae,O.end=Ve,this.options.locations&&(O.loc.end=Le),this.options.ranges&&(O.range[1]=Ve),O}Br.finishNode=function(O,ae){return Rr.call(this,O,ae,this.lastTokEnd,this.lastTokEndLoc)},Br.finishNodeAt=function(O,ae,Ve,Le){return Rr.call(this,O,ae,Ve,Le)},Br.copyNode=function(O){var ae=new Or(this,O.start,this.startLoc);for(var Ve in O)ae[Ve]=O[Ve];return ae};var jr="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Yr=jr+" Extended_Pictographic",Zr=Yr,Hr=Zr+" EBase EComp EMod EPres ExtPict",Xr=Hr,Ar=Xr,an={9:jr,10:Yr,11:Zr,12:Hr,13:Xr,14:Ar},sn="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",on={9:"",10:"",11:"",12:"",13:"",14:sn},Jr="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",un="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Kt=un+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",nt=Kt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",It=nt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ut=It+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",cr=Ut+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",vr={9:un,10:Kt,11:nt,12:It,13:Ut,14:cr},pr={};function _r(O){var ae=pr[O]={binary:Be(an[O]+" "+Jr),binaryOfStrings:Be(on[O]),nonBinary:{General_Category:Be(Jr),Script:Be(vr[O])}};ae.nonBinary.Script_Extensions=ae.nonBinary.Script,ae.nonBinary.gc=ae.nonBinary.General_Category,ae.nonBinary.sc=ae.nonBinary.Script,ae.nonBinary.scx=ae.nonBinary.Script_Extensions}for(var Pr=0,Vr=[9,10,11,12,13,14];Pr<Vr.length;Pr+=1){var Qr=Vr[Pr];_r(Qr)}var Vt=Rt.prototype,Lr=function(ae,Ve){this.parent=ae,this.base=Ve||this};Lr.prototype.separatedFrom=function(ae){for(var Ve=this;Ve;Ve=Ve.parent)for(var Le=ae;Le;Le=Le.parent)if(Ve.base===Le.base&&Ve!==Le)return!0;return!1},Lr.prototype.sibling=function(){return new Lr(this.parent,this.base)};var Cr=function(ae){this.parser=ae,this.validFlags="gim"+(ae.options.ecmaVersion>=6?"uy":"")+(ae.options.ecmaVersion>=9?"s":"")+(ae.options.ecmaVersion>=13?"d":"")+(ae.options.ecmaVersion>=15?"v":""),this.unicodeProperties=pr[ae.options.ecmaVersion>=14?14:ae.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Cr.prototype.reset=function(ae,Ve,Le){var We=Le.indexOf("v")!==-1,lt=Le.indexOf("u")!==-1;this.start=ae|0,this.source=Ve+"",this.flags=Le,We&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=lt&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=lt&&this.parser.options.ecmaVersion>=9)},Cr.prototype.raise=function(ae){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+ae)},Cr.prototype.at=function(ae,Ve){Ve===void 0&&(Ve=!1);var Le=this.source,We=Le.length;if(ae>=We)return-1;var lt=Le.charCodeAt(ae);if(!(Ve||this.switchU)||lt<=55295||lt>=57344||ae+1>=We)return lt;var ut=Le.charCodeAt(ae+1);return ut>=56320&&ut<=57343?(lt<<10)+ut-56613888:lt},Cr.prototype.nextIndex=function(ae,Ve){Ve===void 0&&(Ve=!1);var Le=this.source,We=Le.length;if(ae>=We)return We;var lt=Le.charCodeAt(ae),ut;return!(Ve||this.switchU)||lt<=55295||lt>=57344||ae+1>=We||(ut=Le.charCodeAt(ae+1))<56320||ut>57343?ae+1:ae+2},Cr.prototype.current=function(ae){return ae===void 0&&(ae=!1),this.at(this.pos,ae)},Cr.prototype.lookahead=function(ae){return ae===void 0&&(ae=!1),this.at(this.nextIndex(this.pos,ae),ae)},Cr.prototype.advance=function(ae){ae===void 0&&(ae=!1),this.pos=this.nextIndex(this.pos,ae)},Cr.prototype.eat=function(ae,Ve){return Ve===void 0&&(Ve=!1),this.current(Ve)===ae?(this.advance(Ve),!0):!1},Cr.prototype.eatChars=function(ae,Ve){Ve===void 0&&(Ve=!1);for(var Le=this.pos,We=0,lt=ae;We<lt.length;We+=1){var ut=lt[We],$t=this.at(Le,Ve);if($t===-1||$t!==ut)return!1;Le=this.nextIndex(Le,Ve)}return this.pos=Le,!0},Vt.validateRegExpFlags=function(O){for(var ae=O.validFlags,Ve=O.flags,Le=!1,We=!1,lt=0;lt<Ve.length;lt++){var ut=Ve.charAt(lt);ae.indexOf(ut)===-1&&this.raise(O.start,"Invalid regular expression flag"),Ve.indexOf(ut,lt+1)>-1&&this.raise(O.start,"Duplicate regular expression flag"),ut==="u"&&(Le=!0),ut==="v"&&(We=!0)}this.options.ecmaVersion>=15&&Le&&We&&this.raise(O.start,"Invalid regular expression flag")};function Mn(O){for(var ae in O)return!0;return!1}Vt.validateRegExpPattern=function(O){this.regexp_pattern(O),!O.switchN&&this.options.ecmaVersion>=9&&Mn(O.groupNames)&&(O.switchN=!0,this.regexp_pattern(O))},Vt.regexp_pattern=function(O){O.pos=0,O.lastIntValue=0,O.lastStringValue="",O.lastAssertionIsQuantifiable=!1,O.numCapturingParens=0,O.maxBackReference=0,O.groupNames=Object.create(null),O.backReferenceNames.length=0,O.branchID=null,this.regexp_disjunction(O),O.pos!==O.source.length&&(O.eat(41)&&O.raise("Unmatched ')'"),(O.eat(93)||O.eat(125))&&O.raise("Lone quantifier brackets")),O.maxBackReference>O.numCapturingParens&&O.raise("Invalid escape");for(var ae=0,Ve=O.backReferenceNames;ae<Ve.length;ae+=1){var Le=Ve[ae];O.groupNames[Le]||O.raise("Invalid named capture referenced")}},Vt.regexp_disjunction=function(O){var ae=this.options.ecmaVersion>=16;for(ae&&(O.branchID=new Lr(O.branchID,null)),this.regexp_alternative(O);O.eat(124);)ae&&(O.branchID=O.branchID.sibling()),this.regexp_alternative(O);ae&&(O.branchID=O.branchID.parent),this.regexp_eatQuantifier(O,!0)&&O.raise("Nothing to repeat"),O.eat(123)&&O.raise("Lone quantifier brackets")},Vt.regexp_alternative=function(O){for(;O.pos<O.source.length&&this.regexp_eatTerm(O););},Vt.regexp_eatTerm=function(O){return this.regexp_eatAssertion(O)?(O.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(O)&&O.switchU&&O.raise("Invalid quantifier"),!0):(O.switchU?this.regexp_eatAtom(O):this.regexp_eatExtendedAtom(O))?(this.regexp_eatQuantifier(O),!0):!1},Vt.regexp_eatAssertion=function(O){var ae=O.pos;if(O.lastAssertionIsQuantifiable=!1,O.eat(94)||O.eat(36))return!0;if(O.eat(92)){if(O.eat(66)||O.eat(98))return!0;O.pos=ae}if(O.eat(40)&&O.eat(63)){var Ve=!1;if(this.options.ecmaVersion>=9&&(Ve=O.eat(60)),O.eat(61)||O.eat(33))return this.regexp_disjunction(O),O.eat(41)||O.raise("Unterminated group"),O.lastAssertionIsQuantifiable=!Ve,!0}return O.pos=ae,!1},Vt.regexp_eatQuantifier=function(O,ae){return ae===void 0&&(ae=!1),this.regexp_eatQuantifierPrefix(O,ae)?(O.eat(63),!0):!1},Vt.regexp_eatQuantifierPrefix=function(O,ae){return O.eat(42)||O.eat(43)||O.eat(63)||this.regexp_eatBracedQuantifier(O,ae)},Vt.regexp_eatBracedQuantifier=function(O,ae){var Ve=O.pos;if(O.eat(123)){var Le=0,We=-1;if(this.regexp_eatDecimalDigits(O)&&(Le=O.lastIntValue,O.eat(44)&&this.regexp_eatDecimalDigits(O)&&(We=O.lastIntValue),O.eat(125)))return We!==-1&&We<Le&&!ae&&O.raise("numbers out of order in {} quantifier"),!0;O.switchU&&!ae&&O.raise("Incomplete quantifier"),O.pos=Ve}return!1},Vt.regexp_eatAtom=function(O){return this.regexp_eatPatternCharacters(O)||O.eat(46)||this.regexp_eatReverseSolidusAtomEscape(O)||this.regexp_eatCharacterClass(O)||this.regexp_eatUncapturingGroup(O)||this.regexp_eatCapturingGroup(O)},Vt.regexp_eatReverseSolidusAtomEscape=function(O){var ae=O.pos;if(O.eat(92)){if(this.regexp_eatAtomEscape(O))return!0;O.pos=ae}return!1},Vt.regexp_eatUncapturingGroup=function(O){var ae=O.pos;if(O.eat(40)){if(O.eat(63)&&O.eat(58)){if(this.regexp_disjunction(O),O.eat(41))return!0;O.raise("Unterminated group")}O.pos=ae}return!1},Vt.regexp_eatCapturingGroup=function(O){if(O.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(O):O.current()===63&&O.raise("Invalid group"),this.regexp_disjunction(O),O.eat(41))return O.numCapturingParens+=1,!0;O.raise("Unterminated group")}return!1},Vt.regexp_eatExtendedAtom=function(O){return O.eat(46)||this.regexp_eatReverseSolidusAtomEscape(O)||this.regexp_eatCharacterClass(O)||this.regexp_eatUncapturingGroup(O)||this.regexp_eatCapturingGroup(O)||this.regexp_eatInvalidBracedQuantifier(O)||this.regexp_eatExtendedPatternCharacter(O)},Vt.regexp_eatInvalidBracedQuantifier=function(O){return this.regexp_eatBracedQuantifier(O,!0)&&O.raise("Nothing to repeat"),!1},Vt.regexp_eatSyntaxCharacter=function(O){var ae=O.current();return _n(ae)?(O.lastIntValue=ae,O.advance(),!0):!1};function _n(O){return O===36||O>=40&&O<=43||O===46||O===63||O>=91&&O<=94||O>=123&&O<=125}Vt.regexp_eatPatternCharacters=function(O){for(var ae=O.pos,Ve=0;(Ve=O.current())!==-1&&!_n(Ve);)O.advance();return O.pos!==ae},Vt.regexp_eatExtendedPatternCharacter=function(O){var ae=O.current();return ae!==-1&&ae!==36&&!(ae>=40&&ae<=43)&&ae!==46&&ae!==63&&ae!==91&&ae!==94&&ae!==124?(O.advance(),!0):!1},Vt.regexp_groupSpecifier=function(O){if(O.eat(63)){this.regexp_eatGroupName(O)||O.raise("Invalid group");var ae=this.options.ecmaVersion>=16,Ve=O.groupNames[O.lastStringValue];if(Ve)if(ae)for(var Le=0,We=Ve;Le<We.length;Le+=1){var lt=We[Le];lt.separatedFrom(O.branchID)||O.raise("Duplicate capture group name")}else O.raise("Duplicate capture group name");ae?(Ve||(O.groupNames[O.lastStringValue]=[])).push(O.branchID):O.groupNames[O.lastStringValue]=!0}},Vt.regexp_eatGroupName=function(O){if(O.lastStringValue="",O.eat(60)){if(this.regexp_eatRegExpIdentifierName(O)&&O.eat(62))return!0;O.raise("Invalid capture group name")}return!1},Vt.regexp_eatRegExpIdentifierName=function(O){if(O.lastStringValue="",this.regexp_eatRegExpIdentifierStart(O)){for(O.lastStringValue+=qe(O.lastIntValue);this.regexp_eatRegExpIdentifierPart(O);)O.lastStringValue+=qe(O.lastIntValue);return!0}return!1},Vt.regexp_eatRegExpIdentifierStart=function(O){var ae=O.pos,Ve=this.options.ecmaVersion>=11,Le=O.current(Ve);return O.advance(Ve),Le===92&&this.regexp_eatRegExpUnicodeEscapeSequence(O,Ve)&&(Le=O.lastIntValue),jn(Le)?(O.lastIntValue=Le,!0):(O.pos=ae,!1)};function jn(O){return A(O,!0)||O===36||O===95}Vt.regexp_eatRegExpIdentifierPart=function(O){var ae=O.pos,Ve=this.options.ecmaVersion>=11,Le=O.current(Ve);return O.advance(Ve),Le===92&&this.regexp_eatRegExpUnicodeEscapeSequence(O,Ve)&&(Le=O.lastIntValue),$n(Le)?(O.lastIntValue=Le,!0):(O.pos=ae,!1)};function $n(O){return I(O,!0)||O===36||O===95||O===8204||O===8205}Vt.regexp_eatAtomEscape=function(O){return this.regexp_eatBackReference(O)||this.regexp_eatCharacterClassEscape(O)||this.regexp_eatCharacterEscape(O)||O.switchN&&this.regexp_eatKGroupName(O)?!0:(O.switchU&&(O.current()===99&&O.raise("Invalid unicode escape"),O.raise("Invalid escape")),!1)},Vt.regexp_eatBackReference=function(O){var ae=O.pos;if(this.regexp_eatDecimalEscape(O)){var Ve=O.lastIntValue;if(O.switchU)return Ve>O.maxBackReference&&(O.maxBackReference=Ve),!0;if(Ve<=O.numCapturingParens)return!0;O.pos=ae}return!1},Vt.regexp_eatKGroupName=function(O){if(O.eat(107)){if(this.regexp_eatGroupName(O))return O.backReferenceNames.push(O.lastStringValue),!0;O.raise("Invalid named reference")}return!1},Vt.regexp_eatCharacterEscape=function(O){return this.regexp_eatControlEscape(O)||this.regexp_eatCControlLetter(O)||this.regexp_eatZero(O)||this.regexp_eatHexEscapeSequence(O)||this.regexp_eatRegExpUnicodeEscapeSequence(O,!1)||!O.switchU&&this.regexp_eatLegacyOctalEscapeSequence(O)||this.regexp_eatIdentityEscape(O)},Vt.regexp_eatCControlLetter=function(O){var ae=O.pos;if(O.eat(99)){if(this.regexp_eatControlLetter(O))return!0;O.pos=ae}return!1},Vt.regexp_eatZero=function(O){return O.current()===48&&!dn(O.lookahead())?(O.lastIntValue=0,O.advance(),!0):!1},Vt.regexp_eatControlEscape=function(O){var ae=O.current();return ae===116?(O.lastIntValue=9,O.advance(),!0):ae===110?(O.lastIntValue=10,O.advance(),!0):ae===118?(O.lastIntValue=11,O.advance(),!0):ae===102?(O.lastIntValue=12,O.advance(),!0):ae===114?(O.lastIntValue=13,O.advance(),!0):!1},Vt.regexp_eatControlLetter=function(O){var ae=O.current();return Sn(ae)?(O.lastIntValue=ae%32,O.advance(),!0):!1};function Sn(O){return O>=65&&O<=90||O>=97&&O<=122}Vt.regexp_eatRegExpUnicodeEscapeSequence=function(O,ae){ae===void 0&&(ae=!1);var Ve=O.pos,Le=ae||O.switchU;if(O.eat(117)){if(this.regexp_eatFixedHexDigits(O,4)){var We=O.lastIntValue;if(Le&&We>=55296&&We<=56319){var lt=O.pos;if(O.eat(92)&&O.eat(117)&&this.regexp_eatFixedHexDigits(O,4)){var ut=O.lastIntValue;if(ut>=56320&&ut<=57343)return O.lastIntValue=(We-55296)*1024+(ut-56320)+65536,!0}O.pos=lt,O.lastIntValue=We}return!0}if(Le&&O.eat(123)&&this.regexp_eatHexDigits(O)&&O.eat(125)&&On(O.lastIntValue))return!0;Le&&O.raise("Invalid unicode escape"),O.pos=Ve}return!1};function On(O){return O>=0&&O<=1114111}Vt.regexp_eatIdentityEscape=function(O){if(O.switchU)return this.regexp_eatSyntaxCharacter(O)?!0:O.eat(47)?(O.lastIntValue=47,!0):!1;var ae=O.current();return ae!==99&&(!O.switchN||ae!==107)?(O.lastIntValue=ae,O.advance(),!0):!1},Vt.regexp_eatDecimalEscape=function(O){O.lastIntValue=0;var ae=O.current();if(ae>=49&&ae<=57){do O.lastIntValue=10*O.lastIntValue+(ae-48),O.advance();while((ae=O.current())>=48&&ae<=57);return!0}return!1};var Rn=0,$r=1,Er=2;Vt.regexp_eatCharacterClassEscape=function(O){var ae=O.current();if(Vn(ae))return O.lastIntValue=-1,O.advance(),$r;var Ve=!1;if(O.switchU&&this.options.ecmaVersion>=9&&((Ve=ae===80)||ae===112)){O.lastIntValue=-1,O.advance();var Le;if(O.eat(123)&&(Le=this.regexp_eatUnicodePropertyValueExpression(O))&&O.eat(125))return Ve&&Le===Er&&O.raise("Invalid property name"),Le;O.raise("Invalid property name")}return Rn};function Vn(O){return O===100||O===68||O===115||O===83||O===119||O===87}Vt.regexp_eatUnicodePropertyValueExpression=function(O){var ae=O.pos;if(this.regexp_eatUnicodePropertyName(O)&&O.eat(61)){var Ve=O.lastStringValue;if(this.regexp_eatUnicodePropertyValue(O)){var Le=O.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(O,Ve,Le),$r}}if(O.pos=ae,this.regexp_eatLoneUnicodePropertyNameOrValue(O)){var We=O.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(O,We)}return Rn},Vt.regexp_validateUnicodePropertyNameAndValue=function(O,ae,Ve){Fe(O.unicodeProperties.nonBinary,ae)||O.raise("Invalid property name"),O.unicodeProperties.nonBinary[ae].test(Ve)||O.raise("Invalid property value")},Vt.regexp_validateUnicodePropertyNameOrValue=function(O,ae){if(O.unicodeProperties.binary.test(ae))return $r;if(O.switchV&&O.unicodeProperties.binaryOfStrings.test(ae))return Er;O.raise("Invalid property name")},Vt.regexp_eatUnicodePropertyName=function(O){var ae=0;for(O.lastStringValue="";Pn(ae=O.current());)O.lastStringValue+=qe(ae),O.advance();return O.lastStringValue!==""};function Pn(O){return Sn(O)||O===95}Vt.regexp_eatUnicodePropertyValue=function(O){var ae=0;for(O.lastStringValue="";Dn(ae=O.current());)O.lastStringValue+=qe(ae),O.advance();return O.lastStringValue!==""};function Dn(O){return Pn(O)||dn(O)}Vt.regexp_eatLoneUnicodePropertyNameOrValue=function(O){return this.regexp_eatUnicodePropertyValue(O)},Vt.regexp_eatCharacterClass=function(O){if(O.eat(91)){var ae=O.eat(94),Ve=this.regexp_classContents(O);return O.eat(93)||O.raise("Unterminated character class"),ae&&Ve===Er&&O.raise("Negated character class may contain strings"),!0}return!1},Vt.regexp_classContents=function(O){return O.current()===93?$r:O.switchV?this.regexp_classSetExpression(O):(this.regexp_nonEmptyClassRanges(O),$r)},Vt.regexp_nonEmptyClassRanges=function(O){for(;this.regexp_eatClassAtom(O);){var ae=O.lastIntValue;if(O.eat(45)&&this.regexp_eatClassAtom(O)){var Ve=O.lastIntValue;O.switchU&&(ae===-1||Ve===-1)&&O.raise("Invalid character class"),ae!==-1&&Ve!==-1&&ae>Ve&&O.raise("Range out of order in character class")}}},Vt.regexp_eatClassAtom=function(O){var ae=O.pos;if(O.eat(92)){if(this.regexp_eatClassEscape(O))return!0;if(O.switchU){var Ve=O.current();(Ve===99||wn(Ve))&&O.raise("Invalid class escape"),O.raise("Invalid escape")}O.pos=ae}var Le=O.current();return Le!==93?(O.lastIntValue=Le,O.advance(),!0):!1},Vt.regexp_eatClassEscape=function(O){var ae=O.pos;if(O.eat(98))return O.lastIntValue=8,!0;if(O.switchU&&O.eat(45))return O.lastIntValue=45,!0;if(!O.switchU&&O.eat(99)){if(this.regexp_eatClassControlLetter(O))return!0;O.pos=ae}return this.regexp_eatCharacterClassEscape(O)||this.regexp_eatCharacterEscape(O)},Vt.regexp_classSetExpression=function(O){var ae=$r,Ve;if(!this.regexp_eatClassSetRange(O))if(Ve=this.regexp_eatClassSetOperand(O)){Ve===Er&&(ae=Er);for(var Le=O.pos;O.eatChars([38,38]);){if(O.current()!==38&&(Ve=this.regexp_eatClassSetOperand(O))){Ve!==Er&&(ae=$r);continue}O.raise("Invalid character in character class")}if(Le!==O.pos)return ae;for(;O.eatChars([45,45]);)this.regexp_eatClassSetOperand(O)||O.raise("Invalid character in character class");if(Le!==O.pos)return ae}else O.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(O)){if(Ve=this.regexp_eatClassSetOperand(O),!Ve)return ae;Ve===Er&&(ae=Er)}},Vt.regexp_eatClassSetRange=function(O){var ae=O.pos;if(this.regexp_eatClassSetCharacter(O)){var Ve=O.lastIntValue;if(O.eat(45)&&this.regexp_eatClassSetCharacter(O)){var Le=O.lastIntValue;return Ve!==-1&&Le!==-1&&Ve>Le&&O.raise("Range out of order in character class"),!0}O.pos=ae}return!1},Vt.regexp_eatClassSetOperand=function(O){return this.regexp_eatClassSetCharacter(O)?$r:this.regexp_eatClassStringDisjunction(O)||this.regexp_eatNestedClass(O)},Vt.regexp_eatNestedClass=function(O){var ae=O.pos;if(O.eat(91)){var Ve=O.eat(94),Le=this.regexp_classContents(O);if(O.eat(93))return Ve&&Le===Er&&O.raise("Negated character class may contain strings"),Le;O.pos=ae}if(O.eat(92)){var We=this.regexp_eatCharacterClassEscape(O);if(We)return We;O.pos=ae}return null},Vt.regexp_eatClassStringDisjunction=function(O){var ae=O.pos;if(O.eatChars([92,113])){if(O.eat(123)){var Ve=this.regexp_classStringDisjunctionContents(O);if(O.eat(125))return Ve}else O.raise("Invalid escape");O.pos=ae}return null},Vt.regexp_classStringDisjunctionContents=function(O){for(var ae=this.regexp_classString(O);O.eat(124);)this.regexp_classString(O)===Er&&(ae=Er);return ae},Vt.regexp_classString=function(O){for(var ae=0;this.regexp_eatClassSetCharacter(O);)ae++;return ae===1?$r:Er},Vt.regexp_eatClassSetCharacter=function(O){var ae=O.pos;if(O.eat(92))return this.regexp_eatCharacterEscape(O)||this.regexp_eatClassSetReservedPunctuator(O)?!0:O.eat(98)?(O.lastIntValue=8,!0):(O.pos=ae,!1);var Ve=O.current();return Ve<0||Ve===O.lookahead()&&Bn(Ve)||Ln(Ve)?!1:(O.advance(),O.lastIntValue=Ve,!0)};function Bn(O){return O===33||O>=35&&O<=38||O>=42&&O<=44||O===46||O>=58&&O<=64||O===94||O===96||O===126}function Ln(O){return O===40||O===41||O===45||O===47||O>=91&&O<=93||O>=123&&O<=125}Vt.regexp_eatClassSetReservedPunctuator=function(O){var ae=O.current();return Fn(ae)?(O.lastIntValue=ae,O.advance(),!0):!1};function Fn(O){return O===33||O===35||O===37||O===38||O===44||O===45||O>=58&&O<=62||O===64||O===96||O===126}Vt.regexp_eatClassControlLetter=function(O){var ae=O.current();return dn(ae)||ae===95?(O.lastIntValue=ae%32,O.advance(),!0):!1},Vt.regexp_eatHexEscapeSequence=function(O){var ae=O.pos;if(O.eat(120)){if(this.regexp_eatFixedHexDigits(O,2))return!0;O.switchU&&O.raise("Invalid escape"),O.pos=ae}return!1},Vt.regexp_eatDecimalDigits=function(O){var ae=O.pos,Ve=0;for(O.lastIntValue=0;dn(Ve=O.current());)O.lastIntValue=10*O.lastIntValue+(Ve-48),O.advance();return O.pos!==ae};function dn(O){return O>=48&&O<=57}Vt.regexp_eatHexDigits=function(O){var ae=O.pos,Ve=0;for(O.lastIntValue=0;Cn(Ve=O.current());)O.lastIntValue=16*O.lastIntValue+Tn(Ve),O.advance();return O.pos!==ae};function Cn(O){return O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102}function Tn(O){return O>=65&&O<=70?10+(O-65):O>=97&&O<=102?10+(O-97):O-48}Vt.regexp_eatLegacyOctalEscapeSequence=function(O){if(this.regexp_eatOctalDigit(O)){var ae=O.lastIntValue;if(this.regexp_eatOctalDigit(O)){var Ve=O.lastIntValue;ae<=3&&this.regexp_eatOctalDigit(O)?O.lastIntValue=ae*64+Ve*8+O.lastIntValue:O.lastIntValue=ae*8+Ve}else O.lastIntValue=ae;return!0}return!1},Vt.regexp_eatOctalDigit=function(O){var ae=O.current();return wn(ae)?(O.lastIntValue=ae-48,O.advance(),!0):(O.lastIntValue=0,!1)};function wn(O){return O>=48&&O<=55}Vt.regexp_eatFixedHexDigits=function(O,ae){var Ve=O.pos;O.lastIntValue=0;for(var Le=0;Le<ae;++Le){var We=O.current();if(!Cn(We))return O.pos=Ve,!1;O.lastIntValue=16*O.lastIntValue+Tn(We),O.advance()}return!0};var fn=function(ae){this.type=ae.type,this.value=ae.value,this.start=ae.start,this.end=ae.end,ae.options.locations&&(this.loc=new Ze(ae,ae.startLoc,ae.endLoc)),ae.options.ranges&&(this.range=[ae.start,ae.end])},rr=Rt.prototype;rr.next=function(O){!O&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new fn(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},rr.getToken=function(){return this.next(),new fn(this)},typeof Symbol<"u"&&(rr[Symbol.iterator]=function(){var O=this;return{next:function(){var ae=O.getToken();return{done:ae.type===V.eof,value:ae}}}}),rr.nextToken=function(){var O=this.curContext();if((!O||!O.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(V.eof);if(O.override)return O.override(this);this.readToken(this.fullCharCodeAtPos())},rr.readToken=function(O){return A(O,this.options.ecmaVersion>=6)||O===92?this.readWord():this.getTokenFromCode(O)},rr.fullCharCodeAtPos=function(){var O=this.input.charCodeAt(this.pos);if(O<=55295||O>=56320)return O;var ae=this.input.charCodeAt(this.pos+1);return ae<=56319||ae>=57344?O:(O<<10)+ae-56613888},rr.skipBlockComment=function(){var O=this.options.onComment&&this.curPosition(),ae=this.pos,Ve=this.input.indexOf("*/",this.pos+=2);if(Ve===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=Ve+2,this.options.locations)for(var Le=void 0,We=ae;(Le=ge(this.input,We,this.pos))>-1;)++this.curLine,We=this.lineStart=Le;this.options.onComment&&this.options.onComment(!0,this.input.slice(ae+2,Ve),ae,this.pos,O,this.curPosition())},rr.skipLineComment=function(O){for(var ae=this.pos,Ve=this.options.onComment&&this.curPosition(),Le=this.input.charCodeAt(this.pos+=O);this.pos<this.input.length&&!se(Le);)Le=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(ae+O,this.pos),ae,this.pos,Ve,this.curPosition())},rr.skipSpace=function(){e:for(;this.pos<this.input.length;){var O=this.input.charCodeAt(this.pos);switch(O){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(O>8&&O<14||O>=5760&&oe.test(String.fromCharCode(O)))++this.pos;else break e}}},rr.finishToken=function(O,ae){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var Ve=this.type;this.type=O,this.value=ae,this.updateContext(Ve)},rr.readToken_dot=function(){var O=this.input.charCodeAt(this.pos+1);if(O>=48&&O<=57)return this.readNumber(!0);var ae=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&O===46&&ae===46?(this.pos+=3,this.finishToken(V.ellipsis)):(++this.pos,this.finishToken(V.dot))},rr.readToken_slash=function(){var O=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):O===61?this.finishOp(V.assign,2):this.finishOp(V.slash,1)},rr.readToken_mult_modulo_exp=function(O){var ae=this.input.charCodeAt(this.pos+1),Ve=1,Le=O===42?V.star:V.modulo;return this.options.ecmaVersion>=7&&O===42&&ae===42&&(++Ve,Le=V.starstar,ae=this.input.charCodeAt(this.pos+2)),ae===61?this.finishOp(V.assign,Ve+1):this.finishOp(Le,Ve)},rr.readToken_pipe_amp=function(O){var ae=this.input.charCodeAt(this.pos+1);if(ae===O){if(this.options.ecmaVersion>=12){var Ve=this.input.charCodeAt(this.pos+2);if(Ve===61)return this.finishOp(V.assign,3)}return this.finishOp(O===124?V.logicalOR:V.logicalAND,2)}return ae===61?this.finishOp(V.assign,2):this.finishOp(O===124?V.bitwiseOR:V.bitwiseAND,1)},rr.readToken_caret=function(){var O=this.input.charCodeAt(this.pos+1);return O===61?this.finishOp(V.assign,2):this.finishOp(V.bitwiseXOR,1)},rr.readToken_plus_min=function(O){var ae=this.input.charCodeAt(this.pos+1);return ae===O?ae===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||te.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(V.incDec,2):ae===61?this.finishOp(V.assign,2):this.finishOp(V.plusMin,1)},rr.readToken_lt_gt=function(O){var ae=this.input.charCodeAt(this.pos+1),Ve=1;return ae===O?(Ve=O===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Ve)===61?this.finishOp(V.assign,Ve+1):this.finishOp(V.bitShift,Ve)):ae===33&&O===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(ae===61&&(Ve=2),this.finishOp(V.relational,Ve))},rr.readToken_eq_excl=function(O){var ae=this.input.charCodeAt(this.pos+1);return ae===61?this.finishOp(V.equality,this.input.charCodeAt(this.pos+2)===61?3:2):O===61&&ae===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(V.arrow)):this.finishOp(O===61?V.eq:V.prefix,1)},rr.readToken_question=function(){var O=this.options.ecmaVersion;if(O>=11){var ae=this.input.charCodeAt(this.pos+1);if(ae===46){var Ve=this.input.charCodeAt(this.pos+2);if(Ve<48||Ve>57)return this.finishOp(V.questionDot,2)}if(ae===63){if(O>=12){var Le=this.input.charCodeAt(this.pos+2);if(Le===61)return this.finishOp(V.assign,3)}return this.finishOp(V.coalesce,2)}}return this.finishOp(V.question,1)},rr.readToken_numberSign=function(){var O=this.options.ecmaVersion,ae=35;if(O>=13&&(++this.pos,ae=this.fullCharCodeAtPos(),A(ae,!0)||ae===92))return this.finishToken(V.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+qe(ae)+"'")},rr.getTokenFromCode=function(O){switch(O){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(V.parenL);case 41:return++this.pos,this.finishToken(V.parenR);case 59:return++this.pos,this.finishToken(V.semi);case 44:return++this.pos,this.finishToken(V.comma);case 91:return++this.pos,this.finishToken(V.bracketL);case 93:return++this.pos,this.finishToken(V.bracketR);case 123:return++this.pos,this.finishToken(V.braceL);case 125:return++this.pos,this.finishToken(V.braceR);case 58:return++this.pos,this.finishToken(V.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(V.backQuote);case 48:var ae=this.input.charCodeAt(this.pos+1);if(ae===120||ae===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(ae===111||ae===79)return this.readRadixNumber(8);if(ae===98||ae===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(O);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(O);case 124:case 38:return this.readToken_pipe_amp(O);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(O);case 60:case 62:return this.readToken_lt_gt(O);case 61:case 33:return this.readToken_eq_excl(O);case 63:return this.readToken_question();case 126:return this.finishOp(V.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+qe(O)+"'")},rr.finishOp=function(O,ae){var Ve=this.input.slice(this.pos,this.pos+ae);return this.pos+=ae,this.finishToken(O,Ve)},rr.readRegexp=function(){for(var O,ae,Ve=this.pos;;){this.pos>=this.input.length&&this.raise(Ve,"Unterminated regular expression");var Le=this.input.charAt(this.pos);if(te.test(Le)&&this.raise(Ve,"Unterminated regular expression"),O)O=!1;else{if(Le==="[")ae=!0;else if(Le==="]"&&ae)ae=!1;else if(Le==="/"&&!ae)break;O=Le==="\\"}++this.pos}var We=this.input.slice(Ve,this.pos);++this.pos;var lt=this.pos,ut=this.readWord1();this.containsEsc&&this.unexpected(lt);var $t=this.regexpState||(this.regexpState=new Cr(this));$t.reset(Ve,We,ut),this.validateRegExpFlags($t),this.validateRegExpPattern($t);var Dt=null;try{Dt=new RegExp(We,ut)}catch{}return this.finishToken(V.regexp,{pattern:We,flags:ut,value:Dt})},rr.readInt=function(O,ae,Ve){for(var Le=this.options.ecmaVersion>=12&&ae===void 0,We=Ve&&this.input.charCodeAt(this.pos)===48,lt=this.pos,ut=0,$t=0,Dt=0,Qt=ae??1/0;Dt<Qt;++Dt,++this.pos){var Jt=this.input.charCodeAt(this.pos),yr=void 0;if(Le&&Jt===95){We&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),$t===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),Dt===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),$t=Jt;continue}if(Jt>=97?yr=Jt-97+10:Jt>=65?yr=Jt-65+10:Jt>=48&&Jt<=57?yr=Jt-48:yr=1/0,yr>=O)break;$t=Jt,ut=ut*O+yr}return Le&&$t===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===lt||ae!=null&&this.pos-lt!==ae?null:ut};function qn(O,ae){return ae?parseInt(O,8):parseFloat(O.replace(/_/g,""))}function En(O){return typeof BigInt!="function"?null:BigInt(O.replace(/_/g,""))}rr.readRadixNumber=function(O){var ae=this.pos;this.pos+=2;var Ve=this.readInt(O);return Ve==null&&this.raise(this.start+2,"Expected number in radix "+O),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(Ve=En(this.input.slice(ae,this.pos)),++this.pos):A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(V.num,Ve)},rr.readNumber=function(O){var ae=this.pos;!O&&this.readInt(10,void 0,!0)===null&&this.raise(ae,"Invalid number");var Ve=this.pos-ae>=2&&this.input.charCodeAt(ae)===48;Ve&&this.strict&&this.raise(ae,"Invalid number");var Le=this.input.charCodeAt(this.pos);if(!Ve&&!O&&this.options.ecmaVersion>=11&&Le===110){var We=En(this.input.slice(ae,this.pos));return++this.pos,A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(V.num,We)}Ve&&/[89]/.test(this.input.slice(ae,this.pos))&&(Ve=!1),Le===46&&!Ve&&(++this.pos,this.readInt(10),Le=this.input.charCodeAt(this.pos)),(Le===69||Le===101)&&!Ve&&(Le=this.input.charCodeAt(++this.pos),(Le===43||Le===45)&&++this.pos,this.readInt(10)===null&&this.raise(ae,"Invalid number")),A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var lt=qn(this.input.slice(ae,this.pos),Ve);return this.finishToken(V.num,lt)},rr.readCodePoint=function(){var O=this.input.charCodeAt(this.pos),ae;if(O===123){this.options.ecmaVersion<6&&this.unexpected();var Ve=++this.pos;ae=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ae>1114111&&this.invalidStringToken(Ve,"Code point out of bounds")}else ae=this.readHexChar(4);return ae},rr.readString=function(O){for(var ae="",Ve=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var Le=this.input.charCodeAt(this.pos);if(Le===O)break;Le===92?(ae+=this.input.slice(Ve,this.pos),ae+=this.readEscapedChar(!1),Ve=this.pos):Le===8232||Le===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(se(Le)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return ae+=this.input.slice(Ve,this.pos++),this.finishToken(V.string,ae)};var An={};rr.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(O){if(O===An)this.readInvalidTemplateToken();else throw O}this.inTemplateElement=!1},rr.invalidStringToken=function(O,ae){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw An;this.raise(O,ae)},rr.readTmplToken=function(){for(var O="",ae=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var Ve=this.input.charCodeAt(this.pos);if(Ve===96||Ve===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===V.template||this.type===V.invalidTemplate)?Ve===36?(this.pos+=2,this.finishToken(V.dollarBraceL)):(++this.pos,this.finishToken(V.backQuote)):(O+=this.input.slice(ae,this.pos),this.finishToken(V.template,O));if(Ve===92)O+=this.input.slice(ae,this.pos),O+=this.readEscapedChar(!0),ae=this.pos;else if(se(Ve)){switch(O+=this.input.slice(ae,this.pos),++this.pos,Ve){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:O+=`
|
|
1100
|
-
`;break;default:O+=String.fromCharCode(Ve);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),ae=this.pos}else++this.pos}},
|
|
1099
|
+
`),cooked:this.value},this.next(),Ve.tail=this.type===V.backQuote,this.finishNode(Ve,"TemplateElement")},Xt.parseTemplate=function(O){O===void 0&&(O={});var ae=O.isTagged;ae===void 0&&(ae=!1);var Ve=this.startNode();this.next(),Ve.expressions=[];var Le=this.parseTemplateElement({isTagged:ae});for(Ve.quasis=[Le];!Le.tail;)this.type===V.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(V.dollarBraceL),Ve.expressions.push(this.parseExpression()),this.expect(V.braceR),Ve.quasis.push(Le=this.parseTemplateElement({isTagged:ae}));return this.next(),this.finishNode(Ve,"TemplateLiteral")},Xt.isAsyncProp=function(O){return!O.computed&&O.key.type==="Identifier"&&O.key.name==="async"&&(this.type===V.name||this.type===V.num||this.type===V.string||this.type===V.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===V.star)&&!te.test(this.input.slice(this.lastTokEnd,this.start))},Xt.parseObj=function(O,ae){var Ve=this.startNode(),Le=!0,We={};for(Ve.properties=[],this.next();!this.eat(V.braceR);){if(Le)Le=!1;else if(this.expect(V.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(V.braceR))break;var lt=this.parseProperty(O,ae);O||this.checkPropClash(lt,We,ae),Ve.properties.push(lt)}return this.finishNode(Ve,O?"ObjectPattern":"ObjectExpression")},Xt.parseProperty=function(O,ae){var Ve=this.startNode(),Le,We,lt,ut;if(this.options.ecmaVersion>=9&&this.eat(V.ellipsis))return O?(Ve.argument=this.parseIdent(!1),this.type===V.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(Ve,"RestElement")):(Ve.argument=this.parseMaybeAssign(!1,ae),this.type===V.comma&&ae&&ae.trailingComma<0&&(ae.trailingComma=this.start),this.finishNode(Ve,"SpreadElement"));this.options.ecmaVersion>=6&&(Ve.method=!1,Ve.shorthand=!1,(O||ae)&&(lt=this.start,ut=this.startLoc),O||(Le=this.eat(V.star)));var $t=this.containsEsc;return this.parsePropertyName(Ve),!O&&!$t&&this.options.ecmaVersion>=8&&!Le&&this.isAsyncProp(Ve)?(We=!0,Le=this.options.ecmaVersion>=9&&this.eat(V.star),this.parsePropertyName(Ve)):We=!1,this.parsePropertyValue(Ve,O,Le,We,lt,ut,ae,$t),this.finishNode(Ve,"Property")},Xt.parseGetterSetter=function(O){O.kind=O.key.name,this.parsePropertyName(O),O.value=this.parseMethod(!1);var ae=O.kind==="get"?0:1;if(O.value.params.length!==ae){var Ve=O.value.start;O.kind==="get"?this.raiseRecoverable(Ve,"getter should have no params"):this.raiseRecoverable(Ve,"setter should have exactly one param")}else O.kind==="set"&&O.value.params[0].type==="RestElement"&&this.raiseRecoverable(O.value.params[0].start,"Setter cannot use rest params")},Xt.parsePropertyValue=function(O,ae,Ve,Le,We,lt,ut,$t){(Ve||Le)&&this.type===V.colon&&this.unexpected(),this.eat(V.colon)?(O.value=ae?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,ut),O.kind="init"):this.options.ecmaVersion>=6&&this.type===V.parenL?(ae&&this.unexpected(),O.kind="init",O.method=!0,O.value=this.parseMethod(Ve,Le)):!ae&&!$t&&this.options.ecmaVersion>=5&&!O.computed&&O.key.type==="Identifier"&&(O.key.name==="get"||O.key.name==="set")&&this.type!==V.comma&&this.type!==V.braceR&&this.type!==V.eq?((Ve||Le)&&this.unexpected(),this.parseGetterSetter(O)):this.options.ecmaVersion>=6&&!O.computed&&O.key.type==="Identifier"?((Ve||Le)&&this.unexpected(),this.checkUnreserved(O.key),O.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=We),O.kind="init",ae?O.value=this.parseMaybeDefault(We,lt,this.copyNode(O.key)):this.type===V.eq&&ut?(ut.shorthandAssign<0&&(ut.shorthandAssign=this.start),O.value=this.parseMaybeDefault(We,lt,this.copyNode(O.key))):O.value=this.copyNode(O.key),O.shorthand=!0):this.unexpected()},Xt.parsePropertyName=function(O){if(this.options.ecmaVersion>=6){if(this.eat(V.bracketL))return O.computed=!0,O.key=this.parseMaybeAssign(),this.expect(V.bracketR),O.key;O.computed=!1}return O.key=this.type===V.num||this.type===V.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")},Xt.initFunction=function(O){O.id=null,this.options.ecmaVersion>=6&&(O.generator=O.expression=!1),this.options.ecmaVersion>=8&&(O.async=!1)},Xt.parseMethod=function(O,ae,Ve){var Le=this.startNode(),We=this.yieldPos,lt=this.awaitPos,ut=this.awaitIdentPos;return this.initFunction(Le),this.options.ecmaVersion>=6&&(Le.generator=O),this.options.ecmaVersion>=8&&(Le.async=!!ae),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ft(ae,Le.generator)|yt|(Ve?Mt:0)),this.expect(V.parenL),Le.params=this.parseBindingList(V.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(Le,!1,!0,!1),this.yieldPos=We,this.awaitPos=lt,this.awaitIdentPos=ut,this.finishNode(Le,"FunctionExpression")},Xt.parseArrowExpression=function(O,ae,Ve,Le){var We=this.yieldPos,lt=this.awaitPos,ut=this.awaitIdentPos;return this.enterScope(Ft(Ve,!1)|Ct),this.initFunction(O),this.options.ecmaVersion>=8&&(O.async=!!Ve),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,O.params=this.toAssignableList(ae,!0),this.parseFunctionBody(O,!0,!1,Le),this.yieldPos=We,this.awaitPos=lt,this.awaitIdentPos=ut,this.finishNode(O,"ArrowFunctionExpression")},Xt.parseFunctionBody=function(O,ae,Ve,Le){var We=ae&&this.type!==V.braceL,lt=this.strict,ut=!1;if(We)O.body=this.parseMaybeAssign(Le),O.expression=!0,this.checkParams(O,!1);else{var $t=this.options.ecmaVersion>=7&&!this.isSimpleParamList(O.params);(!lt||$t)&&(ut=this.strictDirective(this.end),ut&&$t&&this.raiseRecoverable(O.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var Dt=this.labels;this.labels=[],ut&&(this.strict=!0),this.checkParams(O,!lt&&!ut&&!ae&&!Ve&&this.isSimpleParamList(O.params)),this.strict&&O.id&&this.checkLValSimple(O.id,dt),O.body=this.parseBlock(!1,void 0,ut&&!lt),O.expression=!1,this.adaptDirectivePrologue(O.body.body),this.labels=Dt}this.exitScope()},Xt.isSimpleParamList=function(O){for(var ae=0,Ve=O;ae<Ve.length;ae+=1){var Le=Ve[ae];if(Le.type!=="Identifier")return!1}return!0},Xt.checkParams=function(O,ae){for(var Ve=Object.create(null),Le=0,We=O.params;Le<We.length;Le+=1){var lt=We[Le];this.checkLValInnerPattern(lt,at,ae?null:Ve)}},Xt.parseExprList=function(O,ae,Ve,Le){for(var We=[],lt=!0;!this.eat(O);){if(lt)lt=!1;else if(this.expect(V.comma),ae&&this.afterTrailingComma(O))break;var ut=void 0;Ve&&this.type===V.comma?ut=null:this.type===V.ellipsis?(ut=this.parseSpread(Le),Le&&this.type===V.comma&&Le.trailingComma<0&&(Le.trailingComma=this.start)):ut=this.parseMaybeAssign(!1,Le),We.push(ut)}return We},Xt.checkUnreserved=function(O){var ae=O.start,Ve=O.end,Le=O.name;if(this.inGenerator&&Le==="yield"&&this.raiseRecoverable(ae,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&Le==="await"&&this.raiseRecoverable(ae,"Cannot use 'await' as identifier inside an async function"),this.currentThisScope().inClassFieldInit&&Le==="arguments"&&this.raiseRecoverable(ae,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(Le==="arguments"||Le==="await")&&this.raise(ae,"Cannot use "+Le+" in class static initialization block"),this.keywords.test(Le)&&this.raise(ae,"Unexpected keyword '"+Le+"'"),!(this.options.ecmaVersion<6&&this.input.slice(ae,Ve).indexOf("\\")!==-1)){var We=this.strict?this.reservedWordsStrict:this.reservedWords;We.test(Le)&&(!this.inAsync&&Le==="await"&&this.raiseRecoverable(ae,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(ae,"The keyword '"+Le+"' is reserved"))}},Xt.parseIdent=function(O){var ae=this.parseIdentNode();return this.next(!!O),this.finishNode(ae,"Identifier"),O||(this.checkUnreserved(ae),ae.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=ae.start)),ae},Xt.parseIdentNode=function(){var O=this.startNode();return this.type===V.name?O.name=this.value:this.type.keyword?(O.name=this.type.keyword,(O.name==="class"||O.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=V.name):this.unexpected(),O},Xt.parsePrivateIdent=function(){var O=this.startNode();return this.type===V.privateId?O.name=this.value:this.unexpected(),this.next(),this.finishNode(O,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(O.start,"Private field '#"+O.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(O)),O},Xt.parseYield=function(O){this.yieldPos||(this.yieldPos=this.start);var ae=this.startNode();return this.next(),this.type===V.semi||this.canInsertSemicolon()||this.type!==V.star&&!this.type.startsExpr?(ae.delegate=!1,ae.argument=null):(ae.delegate=this.eat(V.star),ae.argument=this.parseMaybeAssign(O)),this.finishNode(ae,"YieldExpression")},Xt.parseAwait=function(O){this.awaitPos||(this.awaitPos=this.start);var ae=this.startNode();return this.next(),ae.argument=this.parseMaybeUnary(null,!0,!1,O),this.finishNode(ae,"AwaitExpression")};var Lr=Rt.prototype;Lr.raise=function(O,ae){var Ve=tt(this.input,O);ae+=" ("+Ve.line+":"+Ve.column+")";var Le=new SyntaxError(ae);throw Le.pos=O,Le.loc=Ve,Le.raisedAt=this.pos,Le},Lr.raiseRecoverable=Lr.raise,Lr.curPosition=function(){if(this.options.locations)return new He(this.curLine,this.pos-this.lineStart)};var Er=Rt.prototype,sn=function(ae){this.flags=ae,this.var=[],this.lexical=[],this.functions=[],this.inClassFieldInit=!1};Er.enterScope=function(O){this.scopeStack.push(new sn(O))},Er.exitScope=function(){this.scopeStack.pop()},Er.treatFunctionsAsVarInScope=function(O){return O.flags&st||!this.inModule&&O.flags&et},Er.declareName=function(O,ae,Ve){var Le=!1;if(ae===Qe){var We=this.currentScope();Le=We.lexical.indexOf(O)>-1||We.functions.indexOf(O)>-1||We.var.indexOf(O)>-1,We.lexical.push(O),this.inModule&&We.flags&et&&delete this.undefinedExports[O]}else if(ae===ft){var lt=this.currentScope();lt.lexical.push(O)}else if(ae===ct){var ut=this.currentScope();this.treatFunctionsAsVar?Le=ut.lexical.indexOf(O)>-1:Le=ut.lexical.indexOf(O)>-1||ut.var.indexOf(O)>-1,ut.functions.push(O)}else for(var $t=this.scopeStack.length-1;$t>=0;--$t){var Dt=this.scopeStack[$t];if(Dt.lexical.indexOf(O)>-1&&!(Dt.flags&Je&&Dt.lexical[0]===O)||!this.treatFunctionsAsVarInScope(Dt)&&Dt.functions.indexOf(O)>-1){Le=!0;break}if(Dt.var.push(O),this.inModule&&Dt.flags&et&&delete this.undefinedExports[O],Dt.flags&Ht)break}Le&&this.raiseRecoverable(Ve,"Identifier '"+O+"' has already been declared")},Er.checkLocalExport=function(O){this.scopeStack[0].lexical.indexOf(O.name)===-1&&this.scopeStack[0].var.indexOf(O.name)===-1&&(this.undefinedExports[O.name]=O)},Er.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Er.currentVarScope=function(){for(var O=this.scopeStack.length-1;;O--){var ae=this.scopeStack[O];if(ae.flags&Ht)return ae}},Er.currentThisScope=function(){for(var O=this.scopeStack.length-1;;O--){var ae=this.scopeStack[O];if(ae.flags&Ht&&!(ae.flags&Ct))return ae}};var Dr=function(ae,Ve,Le){this.type="",this.start=Ve,this.end=0,ae.options.locations&&(this.loc=new Ze(ae,Le)),ae.options.directSourceFile&&(this.sourceFile=ae.options.directSourceFile),ae.options.ranges&&(this.range=[Ve,0])},Fr=Rt.prototype;Fr.startNode=function(){return new Dr(this,this.start,this.startLoc)},Fr.startNodeAt=function(O,ae){return new Dr(this,O,ae)};function Rr(O,ae,Ve,Le){return O.type=ae,O.end=Ve,this.options.locations&&(O.loc.end=Le),this.options.ranges&&(O.range[1]=Ve),O}Fr.finishNode=function(O,ae){return Rr.call(this,O,ae,this.lastTokEnd,this.lastTokEndLoc)},Fr.finishNodeAt=function(O,ae,Ve,Le){return Rr.call(this,O,ae,Ve,Le)},Fr.copyNode=function(O){var ae=new Dr(this,O.start,this.startLoc);for(var Ve in O)ae[Ve]=O[Ve];return ae};var Or="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Xr=Or+" Extended_Pictographic",Jr=Xr,Gr=Jr+" EBase EComp EMod EPres ExtPict",Qr=Gr,Ir=Qr,on={9:Or,10:Xr,11:Jr,12:Gr,13:Qr,14:Ir},un="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",dn={9:"",10:"",11:"",12:"",13:"",14:un},en="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",fn="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Kt=fn+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",nt=Kt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",It=nt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ut=It+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",cr=Ut+" Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz",vr={9:fn,10:Kt,11:nt,12:It,13:Ut,14:cr},pr={};function _r(O){var ae=pr[O]={binary:Be(on[O]+" "+en),binaryOfStrings:Be(dn[O]),nonBinary:{General_Category:Be(en),Script:Be(vr[O])}};ae.nonBinary.Script_Extensions=ae.nonBinary.Script,ae.nonBinary.gc=ae.nonBinary.General_Category,ae.nonBinary.sc=ae.nonBinary.Script,ae.nonBinary.scx=ae.nonBinary.Script_Extensions}for(var Pr=0,Br=[9,10,11,12,13,14];Pr<Br.length;Pr+=1){var tn=Br[Pr];_r(tn)}var Vt=Rt.prototype,qr=function(ae,Ve){this.parent=ae,this.base=Ve||this};qr.prototype.separatedFrom=function(ae){for(var Ve=this;Ve;Ve=Ve.parent)for(var Le=ae;Le;Le=Le.parent)if(Ve.base===Le.base&&Ve!==Le)return!0;return!1},qr.prototype.sibling=function(){return new qr(this.parent,this.base)};var Cr=function(ae){this.parser=ae,this.validFlags="gim"+(ae.options.ecmaVersion>=6?"uy":"")+(ae.options.ecmaVersion>=9?"s":"")+(ae.options.ecmaVersion>=13?"d":"")+(ae.options.ecmaVersion>=15?"v":""),this.unicodeProperties=pr[ae.options.ecmaVersion>=14?14:ae.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Cr.prototype.reset=function(ae,Ve,Le){var We=Le.indexOf("v")!==-1,lt=Le.indexOf("u")!==-1;this.start=ae|0,this.source=Ve+"",this.flags=Le,We&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=lt&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=lt&&this.parser.options.ecmaVersion>=9)},Cr.prototype.raise=function(ae){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+ae)},Cr.prototype.at=function(ae,Ve){Ve===void 0&&(Ve=!1);var Le=this.source,We=Le.length;if(ae>=We)return-1;var lt=Le.charCodeAt(ae);if(!(Ve||this.switchU)||lt<=55295||lt>=57344||ae+1>=We)return lt;var ut=Le.charCodeAt(ae+1);return ut>=56320&&ut<=57343?(lt<<10)+ut-56613888:lt},Cr.prototype.nextIndex=function(ae,Ve){Ve===void 0&&(Ve=!1);var Le=this.source,We=Le.length;if(ae>=We)return We;var lt=Le.charCodeAt(ae),ut;return!(Ve||this.switchU)||lt<=55295||lt>=57344||ae+1>=We||(ut=Le.charCodeAt(ae+1))<56320||ut>57343?ae+1:ae+2},Cr.prototype.current=function(ae){return ae===void 0&&(ae=!1),this.at(this.pos,ae)},Cr.prototype.lookahead=function(ae){return ae===void 0&&(ae=!1),this.at(this.nextIndex(this.pos,ae),ae)},Cr.prototype.advance=function(ae){ae===void 0&&(ae=!1),this.pos=this.nextIndex(this.pos,ae)},Cr.prototype.eat=function(ae,Ve){return Ve===void 0&&(Ve=!1),this.current(Ve)===ae?(this.advance(Ve),!0):!1},Cr.prototype.eatChars=function(ae,Ve){Ve===void 0&&(Ve=!1);for(var Le=this.pos,We=0,lt=ae;We<lt.length;We+=1){var ut=lt[We],$t=this.at(Le,Ve);if($t===-1||$t!==ut)return!1;Le=this.nextIndex(Le,Ve)}return this.pos=Le,!0},Vt.validateRegExpFlags=function(O){for(var ae=O.validFlags,Ve=O.flags,Le=!1,We=!1,lt=0;lt<Ve.length;lt++){var ut=Ve.charAt(lt);ae.indexOf(ut)===-1&&this.raise(O.start,"Invalid regular expression flag"),Ve.indexOf(ut,lt+1)>-1&&this.raise(O.start,"Duplicate regular expression flag"),ut==="u"&&(Le=!0),ut==="v"&&(We=!0)}this.options.ecmaVersion>=15&&Le&&We&&this.raise(O.start,"Invalid regular expression flag")};function $n(O){for(var ae in O)return!0;return!1}Vt.validateRegExpPattern=function(O){this.regexp_pattern(O),!O.switchN&&this.options.ecmaVersion>=9&&$n(O.groupNames)&&(O.switchN=!0,this.regexp_pattern(O))},Vt.regexp_pattern=function(O){O.pos=0,O.lastIntValue=0,O.lastStringValue="",O.lastAssertionIsQuantifiable=!1,O.numCapturingParens=0,O.maxBackReference=0,O.groupNames=Object.create(null),O.backReferenceNames.length=0,O.branchID=null,this.regexp_disjunction(O),O.pos!==O.source.length&&(O.eat(41)&&O.raise("Unmatched ')'"),(O.eat(93)||O.eat(125))&&O.raise("Lone quantifier brackets")),O.maxBackReference>O.numCapturingParens&&O.raise("Invalid escape");for(var ae=0,Ve=O.backReferenceNames;ae<Ve.length;ae+=1){var Le=Ve[ae];O.groupNames[Le]||O.raise("Invalid named capture referenced")}},Vt.regexp_disjunction=function(O){var ae=this.options.ecmaVersion>=16;for(ae&&(O.branchID=new qr(O.branchID,null)),this.regexp_alternative(O);O.eat(124);)ae&&(O.branchID=O.branchID.sibling()),this.regexp_alternative(O);ae&&(O.branchID=O.branchID.parent),this.regexp_eatQuantifier(O,!0)&&O.raise("Nothing to repeat"),O.eat(123)&&O.raise("Lone quantifier brackets")},Vt.regexp_alternative=function(O){for(;O.pos<O.source.length&&this.regexp_eatTerm(O););},Vt.regexp_eatTerm=function(O){return this.regexp_eatAssertion(O)?(O.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(O)&&O.switchU&&O.raise("Invalid quantifier"),!0):(O.switchU?this.regexp_eatAtom(O):this.regexp_eatExtendedAtom(O))?(this.regexp_eatQuantifier(O),!0):!1},Vt.regexp_eatAssertion=function(O){var ae=O.pos;if(O.lastAssertionIsQuantifiable=!1,O.eat(94)||O.eat(36))return!0;if(O.eat(92)){if(O.eat(66)||O.eat(98))return!0;O.pos=ae}if(O.eat(40)&&O.eat(63)){var Ve=!1;if(this.options.ecmaVersion>=9&&(Ve=O.eat(60)),O.eat(61)||O.eat(33))return this.regexp_disjunction(O),O.eat(41)||O.raise("Unterminated group"),O.lastAssertionIsQuantifiable=!Ve,!0}return O.pos=ae,!1},Vt.regexp_eatQuantifier=function(O,ae){return ae===void 0&&(ae=!1),this.regexp_eatQuantifierPrefix(O,ae)?(O.eat(63),!0):!1},Vt.regexp_eatQuantifierPrefix=function(O,ae){return O.eat(42)||O.eat(43)||O.eat(63)||this.regexp_eatBracedQuantifier(O,ae)},Vt.regexp_eatBracedQuantifier=function(O,ae){var Ve=O.pos;if(O.eat(123)){var Le=0,We=-1;if(this.regexp_eatDecimalDigits(O)&&(Le=O.lastIntValue,O.eat(44)&&this.regexp_eatDecimalDigits(O)&&(We=O.lastIntValue),O.eat(125)))return We!==-1&&We<Le&&!ae&&O.raise("numbers out of order in {} quantifier"),!0;O.switchU&&!ae&&O.raise("Incomplete quantifier"),O.pos=Ve}return!1},Vt.regexp_eatAtom=function(O){return this.regexp_eatPatternCharacters(O)||O.eat(46)||this.regexp_eatReverseSolidusAtomEscape(O)||this.regexp_eatCharacterClass(O)||this.regexp_eatUncapturingGroup(O)||this.regexp_eatCapturingGroup(O)},Vt.regexp_eatReverseSolidusAtomEscape=function(O){var ae=O.pos;if(O.eat(92)){if(this.regexp_eatAtomEscape(O))return!0;O.pos=ae}return!1},Vt.regexp_eatUncapturingGroup=function(O){var ae=O.pos;if(O.eat(40)){if(O.eat(63)&&O.eat(58)){if(this.regexp_disjunction(O),O.eat(41))return!0;O.raise("Unterminated group")}O.pos=ae}return!1},Vt.regexp_eatCapturingGroup=function(O){if(O.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(O):O.current()===63&&O.raise("Invalid group"),this.regexp_disjunction(O),O.eat(41))return O.numCapturingParens+=1,!0;O.raise("Unterminated group")}return!1},Vt.regexp_eatExtendedAtom=function(O){return O.eat(46)||this.regexp_eatReverseSolidusAtomEscape(O)||this.regexp_eatCharacterClass(O)||this.regexp_eatUncapturingGroup(O)||this.regexp_eatCapturingGroup(O)||this.regexp_eatInvalidBracedQuantifier(O)||this.regexp_eatExtendedPatternCharacter(O)},Vt.regexp_eatInvalidBracedQuantifier=function(O){return this.regexp_eatBracedQuantifier(O,!0)&&O.raise("Nothing to repeat"),!1},Vt.regexp_eatSyntaxCharacter=function(O){var ae=O.current();return Rn(ae)?(O.lastIntValue=ae,O.advance(),!0):!1};function Rn(O){return O===36||O>=40&&O<=43||O===46||O===63||O>=91&&O<=94||O>=123&&O<=125}Vt.regexp_eatPatternCharacters=function(O){for(var ae=O.pos,Ve=0;(Ve=O.current())!==-1&&!Rn(Ve);)O.advance();return O.pos!==ae},Vt.regexp_eatExtendedPatternCharacter=function(O){var ae=O.current();return ae!==-1&&ae!==36&&!(ae>=40&&ae<=43)&&ae!==46&&ae!==63&&ae!==91&&ae!==94&&ae!==124?(O.advance(),!0):!1},Vt.regexp_groupSpecifier=function(O){if(O.eat(63)){this.regexp_eatGroupName(O)||O.raise("Invalid group");var ae=this.options.ecmaVersion>=16,Ve=O.groupNames[O.lastStringValue];if(Ve)if(ae)for(var Le=0,We=Ve;Le<We.length;Le+=1){var lt=We[Le];lt.separatedFrom(O.branchID)||O.raise("Duplicate capture group name")}else O.raise("Duplicate capture group name");ae?(Ve||(O.groupNames[O.lastStringValue]=[])).push(O.branchID):O.groupNames[O.lastStringValue]=!0}},Vt.regexp_eatGroupName=function(O){if(O.lastStringValue="",O.eat(60)){if(this.regexp_eatRegExpIdentifierName(O)&&O.eat(62))return!0;O.raise("Invalid capture group name")}return!1},Vt.regexp_eatRegExpIdentifierName=function(O){if(O.lastStringValue="",this.regexp_eatRegExpIdentifierStart(O)){for(O.lastStringValue+=qe(O.lastIntValue);this.regexp_eatRegExpIdentifierPart(O);)O.lastStringValue+=qe(O.lastIntValue);return!0}return!1},Vt.regexp_eatRegExpIdentifierStart=function(O){var ae=O.pos,Ve=this.options.ecmaVersion>=11,Le=O.current(Ve);return O.advance(Ve),Le===92&&this.regexp_eatRegExpUnicodeEscapeSequence(O,Ve)&&(Le=O.lastIntValue),On(Le)?(O.lastIntValue=Le,!0):(O.pos=ae,!1)};function On(O){return A(O,!0)||O===36||O===95}Vt.regexp_eatRegExpIdentifierPart=function(O){var ae=O.pos,Ve=this.options.ecmaVersion>=11,Le=O.current(Ve);return O.advance(Ve),Le===92&&this.regexp_eatRegExpUnicodeEscapeSequence(O,Ve)&&(Le=O.lastIntValue),Vn(Le)?(O.lastIntValue=Le,!0):(O.pos=ae,!1)};function Vn(O){return I(O,!0)||O===36||O===95||O===8204||O===8205}Vt.regexp_eatAtomEscape=function(O){return this.regexp_eatBackReference(O)||this.regexp_eatCharacterClassEscape(O)||this.regexp_eatCharacterEscape(O)||O.switchN&&this.regexp_eatKGroupName(O)?!0:(O.switchU&&(O.current()===99&&O.raise("Invalid unicode escape"),O.raise("Invalid escape")),!1)},Vt.regexp_eatBackReference=function(O){var ae=O.pos;if(this.regexp_eatDecimalEscape(O)){var Ve=O.lastIntValue;if(O.switchU)return Ve>O.maxBackReference&&(O.maxBackReference=Ve),!0;if(Ve<=O.numCapturingParens)return!0;O.pos=ae}return!1},Vt.regexp_eatKGroupName=function(O){if(O.eat(107)){if(this.regexp_eatGroupName(O))return O.backReferenceNames.push(O.lastStringValue),!0;O.raise("Invalid named reference")}return!1},Vt.regexp_eatCharacterEscape=function(O){return this.regexp_eatControlEscape(O)||this.regexp_eatCControlLetter(O)||this.regexp_eatZero(O)||this.regexp_eatHexEscapeSequence(O)||this.regexp_eatRegExpUnicodeEscapeSequence(O,!1)||!O.switchU&&this.regexp_eatLegacyOctalEscapeSequence(O)||this.regexp_eatIdentityEscape(O)},Vt.regexp_eatCControlLetter=function(O){var ae=O.pos;if(O.eat(99)){if(this.regexp_eatControlLetter(O))return!0;O.pos=ae}return!1},Vt.regexp_eatZero=function(O){return O.current()===48&&!pn(O.lookahead())?(O.lastIntValue=0,O.advance(),!0):!1},Vt.regexp_eatControlEscape=function(O){var ae=O.current();return ae===116?(O.lastIntValue=9,O.advance(),!0):ae===110?(O.lastIntValue=10,O.advance(),!0):ae===118?(O.lastIntValue=11,O.advance(),!0):ae===102?(O.lastIntValue=12,O.advance(),!0):ae===114?(O.lastIntValue=13,O.advance(),!0):!1},Vt.regexp_eatControlLetter=function(O){var ae=O.current();return Pn(ae)?(O.lastIntValue=ae%32,O.advance(),!0):!1};function Pn(O){return O>=65&&O<=90||O>=97&&O<=122}Vt.regexp_eatRegExpUnicodeEscapeSequence=function(O,ae){ae===void 0&&(ae=!1);var Ve=O.pos,Le=ae||O.switchU;if(O.eat(117)){if(this.regexp_eatFixedHexDigits(O,4)){var We=O.lastIntValue;if(Le&&We>=55296&&We<=56319){var lt=O.pos;if(O.eat(92)&&O.eat(117)&&this.regexp_eatFixedHexDigits(O,4)){var ut=O.lastIntValue;if(ut>=56320&&ut<=57343)return O.lastIntValue=(We-55296)*1024+(ut-56320)+65536,!0}O.pos=lt,O.lastIntValue=We}return!0}if(Le&&O.eat(123)&&this.regexp_eatHexDigits(O)&&O.eat(125)&&Dn(O.lastIntValue))return!0;Le&&O.raise("Invalid unicode escape"),O.pos=Ve}return!1};function Dn(O){return O>=0&&O<=1114111}Vt.regexp_eatIdentityEscape=function(O){if(O.switchU)return this.regexp_eatSyntaxCharacter(O)?!0:O.eat(47)?(O.lastIntValue=47,!0):!1;var ae=O.current();return ae!==99&&(!O.switchN||ae!==107)?(O.lastIntValue=ae,O.advance(),!0):!1},Vt.regexp_eatDecimalEscape=function(O){O.lastIntValue=0;var ae=O.current();if(ae>=49&&ae<=57){do O.lastIntValue=10*O.lastIntValue+(ae-48),O.advance();while((ae=O.current())>=48&&ae<=57);return!0}return!1};var Cn=0,Vr=1,Ar=2;Vt.regexp_eatCharacterClassEscape=function(O){var ae=O.current();if(Bn(ae))return O.lastIntValue=-1,O.advance(),Vr;var Ve=!1;if(O.switchU&&this.options.ecmaVersion>=9&&((Ve=ae===80)||ae===112)){O.lastIntValue=-1,O.advance();var Le;if(O.eat(123)&&(Le=this.regexp_eatUnicodePropertyValueExpression(O))&&O.eat(125))return Ve&&Le===Ar&&O.raise("Invalid property name"),Le;O.raise("Invalid property name")}return Cn};function Bn(O){return O===100||O===68||O===115||O===83||O===119||O===87}Vt.regexp_eatUnicodePropertyValueExpression=function(O){var ae=O.pos;if(this.regexp_eatUnicodePropertyName(O)&&O.eat(61)){var Ve=O.lastStringValue;if(this.regexp_eatUnicodePropertyValue(O)){var Le=O.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(O,Ve,Le),Vr}}if(O.pos=ae,this.regexp_eatLoneUnicodePropertyNameOrValue(O)){var We=O.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(O,We)}return Cn},Vt.regexp_validateUnicodePropertyNameAndValue=function(O,ae,Ve){Fe(O.unicodeProperties.nonBinary,ae)||O.raise("Invalid property name"),O.unicodeProperties.nonBinary[ae].test(Ve)||O.raise("Invalid property value")},Vt.regexp_validateUnicodePropertyNameOrValue=function(O,ae){if(O.unicodeProperties.binary.test(ae))return Vr;if(O.switchV&&O.unicodeProperties.binaryOfStrings.test(ae))return Ar;O.raise("Invalid property name")},Vt.regexp_eatUnicodePropertyName=function(O){var ae=0;for(O.lastStringValue="";Tn(ae=O.current());)O.lastStringValue+=qe(ae),O.advance();return O.lastStringValue!==""};function Tn(O){return Pn(O)||O===95}Vt.regexp_eatUnicodePropertyValue=function(O){var ae=0;for(O.lastStringValue="";Ln(ae=O.current());)O.lastStringValue+=qe(ae),O.advance();return O.lastStringValue!==""};function Ln(O){return Tn(O)||pn(O)}Vt.regexp_eatLoneUnicodePropertyNameOrValue=function(O){return this.regexp_eatUnicodePropertyValue(O)},Vt.regexp_eatCharacterClass=function(O){if(O.eat(91)){var ae=O.eat(94),Ve=this.regexp_classContents(O);return O.eat(93)||O.raise("Unterminated character class"),ae&&Ve===Ar&&O.raise("Negated character class may contain strings"),!0}return!1},Vt.regexp_classContents=function(O){return O.current()===93?Vr:O.switchV?this.regexp_classSetExpression(O):(this.regexp_nonEmptyClassRanges(O),Vr)},Vt.regexp_nonEmptyClassRanges=function(O){for(;this.regexp_eatClassAtom(O);){var ae=O.lastIntValue;if(O.eat(45)&&this.regexp_eatClassAtom(O)){var Ve=O.lastIntValue;O.switchU&&(ae===-1||Ve===-1)&&O.raise("Invalid character class"),ae!==-1&&Ve!==-1&&ae>Ve&&O.raise("Range out of order in character class")}}},Vt.regexp_eatClassAtom=function(O){var ae=O.pos;if(O.eat(92)){if(this.regexp_eatClassEscape(O))return!0;if(O.switchU){var Ve=O.current();(Ve===99||An(Ve))&&O.raise("Invalid class escape"),O.raise("Invalid escape")}O.pos=ae}var Le=O.current();return Le!==93?(O.lastIntValue=Le,O.advance(),!0):!1},Vt.regexp_eatClassEscape=function(O){var ae=O.pos;if(O.eat(98))return O.lastIntValue=8,!0;if(O.switchU&&O.eat(45))return O.lastIntValue=45,!0;if(!O.switchU&&O.eat(99)){if(this.regexp_eatClassControlLetter(O))return!0;O.pos=ae}return this.regexp_eatCharacterClassEscape(O)||this.regexp_eatCharacterEscape(O)},Vt.regexp_classSetExpression=function(O){var ae=Vr,Ve;if(!this.regexp_eatClassSetRange(O))if(Ve=this.regexp_eatClassSetOperand(O)){Ve===Ar&&(ae=Ar);for(var Le=O.pos;O.eatChars([38,38]);){if(O.current()!==38&&(Ve=this.regexp_eatClassSetOperand(O))){Ve!==Ar&&(ae=Vr);continue}O.raise("Invalid character in character class")}if(Le!==O.pos)return ae;for(;O.eatChars([45,45]);)this.regexp_eatClassSetOperand(O)||O.raise("Invalid character in character class");if(Le!==O.pos)return ae}else O.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(O)){if(Ve=this.regexp_eatClassSetOperand(O),!Ve)return ae;Ve===Ar&&(ae=Ar)}},Vt.regexp_eatClassSetRange=function(O){var ae=O.pos;if(this.regexp_eatClassSetCharacter(O)){var Ve=O.lastIntValue;if(O.eat(45)&&this.regexp_eatClassSetCharacter(O)){var Le=O.lastIntValue;return Ve!==-1&&Le!==-1&&Ve>Le&&O.raise("Range out of order in character class"),!0}O.pos=ae}return!1},Vt.regexp_eatClassSetOperand=function(O){return this.regexp_eatClassSetCharacter(O)?Vr:this.regexp_eatClassStringDisjunction(O)||this.regexp_eatNestedClass(O)},Vt.regexp_eatNestedClass=function(O){var ae=O.pos;if(O.eat(91)){var Ve=O.eat(94),Le=this.regexp_classContents(O);if(O.eat(93))return Ve&&Le===Ar&&O.raise("Negated character class may contain strings"),Le;O.pos=ae}if(O.eat(92)){var We=this.regexp_eatCharacterClassEscape(O);if(We)return We;O.pos=ae}return null},Vt.regexp_eatClassStringDisjunction=function(O){var ae=O.pos;if(O.eatChars([92,113])){if(O.eat(123)){var Ve=this.regexp_classStringDisjunctionContents(O);if(O.eat(125))return Ve}else O.raise("Invalid escape");O.pos=ae}return null},Vt.regexp_classStringDisjunctionContents=function(O){for(var ae=this.regexp_classString(O);O.eat(124);)this.regexp_classString(O)===Ar&&(ae=Ar);return ae},Vt.regexp_classString=function(O){for(var ae=0;this.regexp_eatClassSetCharacter(O);)ae++;return ae===1?Vr:Ar},Vt.regexp_eatClassSetCharacter=function(O){var ae=O.pos;if(O.eat(92))return this.regexp_eatCharacterEscape(O)||this.regexp_eatClassSetReservedPunctuator(O)?!0:O.eat(98)?(O.lastIntValue=8,!0):(O.pos=ae,!1);var Ve=O.current();return Ve<0||Ve===O.lookahead()&&Fn(Ve)||qn(Ve)?!1:(O.advance(),O.lastIntValue=Ve,!0)};function Fn(O){return O===33||O>=35&&O<=38||O>=42&&O<=44||O===46||O>=58&&O<=64||O===94||O===96||O===126}function qn(O){return O===40||O===41||O===45||O===47||O>=91&&O<=93||O>=123&&O<=125}Vt.regexp_eatClassSetReservedPunctuator=function(O){var ae=O.current();return Un(ae)?(O.lastIntValue=ae,O.advance(),!0):!1};function Un(O){return O===33||O===35||O===37||O===38||O===44||O===45||O>=58&&O<=62||O===64||O===96||O===126}Vt.regexp_eatClassControlLetter=function(O){var ae=O.current();return pn(ae)||ae===95?(O.lastIntValue=ae%32,O.advance(),!0):!1},Vt.regexp_eatHexEscapeSequence=function(O){var ae=O.pos;if(O.eat(120)){if(this.regexp_eatFixedHexDigits(O,2))return!0;O.switchU&&O.raise("Invalid escape"),O.pos=ae}return!1},Vt.regexp_eatDecimalDigits=function(O){var ae=O.pos,Ve=0;for(O.lastIntValue=0;pn(Ve=O.current());)O.lastIntValue=10*O.lastIntValue+(Ve-48),O.advance();return O.pos!==ae};function pn(O){return O>=48&&O<=57}Vt.regexp_eatHexDigits=function(O){var ae=O.pos,Ve=0;for(O.lastIntValue=0;wn(Ve=O.current());)O.lastIntValue=16*O.lastIntValue+En(Ve),O.advance();return O.pos!==ae};function wn(O){return O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102}function En(O){return O>=65&&O<=70?10+(O-65):O>=97&&O<=102?10+(O-97):O-48}Vt.regexp_eatLegacyOctalEscapeSequence=function(O){if(this.regexp_eatOctalDigit(O)){var ae=O.lastIntValue;if(this.regexp_eatOctalDigit(O)){var Ve=O.lastIntValue;ae<=3&&this.regexp_eatOctalDigit(O)?O.lastIntValue=ae*64+Ve*8+O.lastIntValue:O.lastIntValue=ae*8+Ve}else O.lastIntValue=ae;return!0}return!1},Vt.regexp_eatOctalDigit=function(O){var ae=O.current();return An(ae)?(O.lastIntValue=ae-48,O.advance(),!0):(O.lastIntValue=0,!1)};function An(O){return O>=48&&O<=55}Vt.regexp_eatFixedHexDigits=function(O,ae){var Ve=O.pos;O.lastIntValue=0;for(var Le=0;Le<ae;++Le){var We=O.current();if(!wn(We))return O.pos=Ve,!1;O.lastIntValue=16*O.lastIntValue+En(We),O.advance()}return!0};var hn=function(ae){this.type=ae.type,this.value=ae.value,this.start=ae.start,this.end=ae.end,ae.options.locations&&(this.loc=new Ze(ae,ae.startLoc,ae.endLoc)),ae.options.ranges&&(this.range=[ae.start,ae.end])},nr=Rt.prototype;nr.next=function(O){!O&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new hn(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},nr.getToken=function(){return this.next(),new hn(this)},typeof Symbol<"u"&&(nr[Symbol.iterator]=function(){var O=this;return{next:function(){var ae=O.getToken();return{done:ae.type===V.eof,value:ae}}}}),nr.nextToken=function(){var O=this.curContext();if((!O||!O.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(V.eof);if(O.override)return O.override(this);this.readToken(this.fullCharCodeAtPos())},nr.readToken=function(O){return A(O,this.options.ecmaVersion>=6)||O===92?this.readWord():this.getTokenFromCode(O)},nr.fullCharCodeAtPos=function(){var O=this.input.charCodeAt(this.pos);if(O<=55295||O>=56320)return O;var ae=this.input.charCodeAt(this.pos+1);return ae<=56319||ae>=57344?O:(O<<10)+ae-56613888},nr.skipBlockComment=function(){var O=this.options.onComment&&this.curPosition(),ae=this.pos,Ve=this.input.indexOf("*/",this.pos+=2);if(Ve===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=Ve+2,this.options.locations)for(var Le=void 0,We=ae;(Le=ge(this.input,We,this.pos))>-1;)++this.curLine,We=this.lineStart=Le;this.options.onComment&&this.options.onComment(!0,this.input.slice(ae+2,Ve),ae,this.pos,O,this.curPosition())},nr.skipLineComment=function(O){for(var ae=this.pos,Ve=this.options.onComment&&this.curPosition(),Le=this.input.charCodeAt(this.pos+=O);this.pos<this.input.length&&!se(Le);)Le=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(ae+O,this.pos),ae,this.pos,Ve,this.curPosition())},nr.skipSpace=function(){e:for(;this.pos<this.input.length;){var O=this.input.charCodeAt(this.pos);switch(O){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(O>8&&O<14||O>=5760&&oe.test(String.fromCharCode(O)))++this.pos;else break e}}},nr.finishToken=function(O,ae){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var Ve=this.type;this.type=O,this.value=ae,this.updateContext(Ve)},nr.readToken_dot=function(){var O=this.input.charCodeAt(this.pos+1);if(O>=48&&O<=57)return this.readNumber(!0);var ae=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&O===46&&ae===46?(this.pos+=3,this.finishToken(V.ellipsis)):(++this.pos,this.finishToken(V.dot))},nr.readToken_slash=function(){var O=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):O===61?this.finishOp(V.assign,2):this.finishOp(V.slash,1)},nr.readToken_mult_modulo_exp=function(O){var ae=this.input.charCodeAt(this.pos+1),Ve=1,Le=O===42?V.star:V.modulo;return this.options.ecmaVersion>=7&&O===42&&ae===42&&(++Ve,Le=V.starstar,ae=this.input.charCodeAt(this.pos+2)),ae===61?this.finishOp(V.assign,Ve+1):this.finishOp(Le,Ve)},nr.readToken_pipe_amp=function(O){var ae=this.input.charCodeAt(this.pos+1);if(ae===O){if(this.options.ecmaVersion>=12){var Ve=this.input.charCodeAt(this.pos+2);if(Ve===61)return this.finishOp(V.assign,3)}return this.finishOp(O===124?V.logicalOR:V.logicalAND,2)}return ae===61?this.finishOp(V.assign,2):this.finishOp(O===124?V.bitwiseOR:V.bitwiseAND,1)},nr.readToken_caret=function(){var O=this.input.charCodeAt(this.pos+1);return O===61?this.finishOp(V.assign,2):this.finishOp(V.bitwiseXOR,1)},nr.readToken_plus_min=function(O){var ae=this.input.charCodeAt(this.pos+1);return ae===O?ae===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||te.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(V.incDec,2):ae===61?this.finishOp(V.assign,2):this.finishOp(V.plusMin,1)},nr.readToken_lt_gt=function(O){var ae=this.input.charCodeAt(this.pos+1),Ve=1;return ae===O?(Ve=O===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Ve)===61?this.finishOp(V.assign,Ve+1):this.finishOp(V.bitShift,Ve)):ae===33&&O===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(ae===61&&(Ve=2),this.finishOp(V.relational,Ve))},nr.readToken_eq_excl=function(O){var ae=this.input.charCodeAt(this.pos+1);return ae===61?this.finishOp(V.equality,this.input.charCodeAt(this.pos+2)===61?3:2):O===61&&ae===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(V.arrow)):this.finishOp(O===61?V.eq:V.prefix,1)},nr.readToken_question=function(){var O=this.options.ecmaVersion;if(O>=11){var ae=this.input.charCodeAt(this.pos+1);if(ae===46){var Ve=this.input.charCodeAt(this.pos+2);if(Ve<48||Ve>57)return this.finishOp(V.questionDot,2)}if(ae===63){if(O>=12){var Le=this.input.charCodeAt(this.pos+2);if(Le===61)return this.finishOp(V.assign,3)}return this.finishOp(V.coalesce,2)}}return this.finishOp(V.question,1)},nr.readToken_numberSign=function(){var O=this.options.ecmaVersion,ae=35;if(O>=13&&(++this.pos,ae=this.fullCharCodeAtPos(),A(ae,!0)||ae===92))return this.finishToken(V.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+qe(ae)+"'")},nr.getTokenFromCode=function(O){switch(O){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(V.parenL);case 41:return++this.pos,this.finishToken(V.parenR);case 59:return++this.pos,this.finishToken(V.semi);case 44:return++this.pos,this.finishToken(V.comma);case 91:return++this.pos,this.finishToken(V.bracketL);case 93:return++this.pos,this.finishToken(V.bracketR);case 123:return++this.pos,this.finishToken(V.braceL);case 125:return++this.pos,this.finishToken(V.braceR);case 58:return++this.pos,this.finishToken(V.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(V.backQuote);case 48:var ae=this.input.charCodeAt(this.pos+1);if(ae===120||ae===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(ae===111||ae===79)return this.readRadixNumber(8);if(ae===98||ae===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(O);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(O);case 124:case 38:return this.readToken_pipe_amp(O);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(O);case 60:case 62:return this.readToken_lt_gt(O);case 61:case 33:return this.readToken_eq_excl(O);case 63:return this.readToken_question();case 126:return this.finishOp(V.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+qe(O)+"'")},nr.finishOp=function(O,ae){var Ve=this.input.slice(this.pos,this.pos+ae);return this.pos+=ae,this.finishToken(O,Ve)},nr.readRegexp=function(){for(var O,ae,Ve=this.pos;;){this.pos>=this.input.length&&this.raise(Ve,"Unterminated regular expression");var Le=this.input.charAt(this.pos);if(te.test(Le)&&this.raise(Ve,"Unterminated regular expression"),O)O=!1;else{if(Le==="[")ae=!0;else if(Le==="]"&&ae)ae=!1;else if(Le==="/"&&!ae)break;O=Le==="\\"}++this.pos}var We=this.input.slice(Ve,this.pos);++this.pos;var lt=this.pos,ut=this.readWord1();this.containsEsc&&this.unexpected(lt);var $t=this.regexpState||(this.regexpState=new Cr(this));$t.reset(Ve,We,ut),this.validateRegExpFlags($t),this.validateRegExpPattern($t);var Dt=null;try{Dt=new RegExp(We,ut)}catch{}return this.finishToken(V.regexp,{pattern:We,flags:ut,value:Dt})},nr.readInt=function(O,ae,Ve){for(var Le=this.options.ecmaVersion>=12&&ae===void 0,We=Ve&&this.input.charCodeAt(this.pos)===48,lt=this.pos,ut=0,$t=0,Dt=0,er=ae??1/0;Dt<er;++Dt,++this.pos){var Jt=this.input.charCodeAt(this.pos),yr=void 0;if(Le&&Jt===95){We&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),$t===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),Dt===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),$t=Jt;continue}if(Jt>=97?yr=Jt-97+10:Jt>=65?yr=Jt-65+10:Jt>=48&&Jt<=57?yr=Jt-48:yr=1/0,yr>=O)break;$t=Jt,ut=ut*O+yr}return Le&&$t===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===lt||ae!=null&&this.pos-lt!==ae?null:ut};function Hn(O,ae){return ae?parseInt(O,8):parseFloat(O.replace(/_/g,""))}function In(O){return typeof BigInt!="function"?null:BigInt(O.replace(/_/g,""))}nr.readRadixNumber=function(O){var ae=this.pos;this.pos+=2;var Ve=this.readInt(O);return Ve==null&&this.raise(this.start+2,"Expected number in radix "+O),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(Ve=In(this.input.slice(ae,this.pos)),++this.pos):A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(V.num,Ve)},nr.readNumber=function(O){var ae=this.pos;!O&&this.readInt(10,void 0,!0)===null&&this.raise(ae,"Invalid number");var Ve=this.pos-ae>=2&&this.input.charCodeAt(ae)===48;Ve&&this.strict&&this.raise(ae,"Invalid number");var Le=this.input.charCodeAt(this.pos);if(!Ve&&!O&&this.options.ecmaVersion>=11&&Le===110){var We=In(this.input.slice(ae,this.pos));return++this.pos,A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(V.num,We)}Ve&&/[89]/.test(this.input.slice(ae,this.pos))&&(Ve=!1),Le===46&&!Ve&&(++this.pos,this.readInt(10),Le=this.input.charCodeAt(this.pos)),(Le===69||Le===101)&&!Ve&&(Le=this.input.charCodeAt(++this.pos),(Le===43||Le===45)&&++this.pos,this.readInt(10)===null&&this.raise(ae,"Invalid number")),A(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var lt=Hn(this.input.slice(ae,this.pos),Ve);return this.finishToken(V.num,lt)},nr.readCodePoint=function(){var O=this.input.charCodeAt(this.pos),ae;if(O===123){this.options.ecmaVersion<6&&this.unexpected();var Ve=++this.pos;ae=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,ae>1114111&&this.invalidStringToken(Ve,"Code point out of bounds")}else ae=this.readHexChar(4);return ae},nr.readString=function(O){for(var ae="",Ve=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var Le=this.input.charCodeAt(this.pos);if(Le===O)break;Le===92?(ae+=this.input.slice(Ve,this.pos),ae+=this.readEscapedChar(!1),Ve=this.pos):Le===8232||Le===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(se(Le)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return ae+=this.input.slice(Ve,this.pos++),this.finishToken(V.string,ae)};var kn={};nr.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(O){if(O===kn)this.readInvalidTemplateToken();else throw O}this.inTemplateElement=!1},nr.invalidStringToken=function(O,ae){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw kn;this.raise(O,ae)},nr.readTmplToken=function(){for(var O="",ae=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var Ve=this.input.charCodeAt(this.pos);if(Ve===96||Ve===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===V.template||this.type===V.invalidTemplate)?Ve===36?(this.pos+=2,this.finishToken(V.dollarBraceL)):(++this.pos,this.finishToken(V.backQuote)):(O+=this.input.slice(ae,this.pos),this.finishToken(V.template,O));if(Ve===92)O+=this.input.slice(ae,this.pos),O+=this.readEscapedChar(!0),ae=this.pos;else if(se(Ve)){switch(O+=this.input.slice(ae,this.pos),++this.pos,Ve){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:O+=`
|
|
1100
|
+
`;break;default:O+=String.fromCharCode(Ve);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),ae=this.pos}else++this.pos}},nr.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(V.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
1101
1101
|
`&&++this.pos;case`
|
|
1102
|
-
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},
|
|
1103
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return qe(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),O){var Ve=this.pos-1;this.invalidStringToken(Ve,"Invalid escape sequence in template string")}default:if(ae>=48&&ae<=55){var Le=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],We=parseInt(Le,8);return We>255&&(Le=Le.slice(0,-1),We=parseInt(Le,8)),this.pos+=Le.length-1,ae=this.input.charCodeAt(this.pos),(Le!=="0"||ae===56||ae===57)&&(this.strict||O)&&this.invalidStringToken(this.pos-1-Le.length,O?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(We)}return se(ae)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(ae)}},
|
|
1102
|
+
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},nr.readEscapedChar=function(O){var ae=this.input.charCodeAt(++this.pos);switch(++this.pos,ae){case 110:return`
|
|
1103
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return qe(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),O){var Ve=this.pos-1;this.invalidStringToken(Ve,"Invalid escape sequence in template string")}default:if(ae>=48&&ae<=55){var Le=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],We=parseInt(Le,8);return We>255&&(Le=Le.slice(0,-1),We=parseInt(Le,8)),this.pos+=Le.length-1,ae=this.input.charCodeAt(this.pos),(Le!=="0"||ae===56||ae===57)&&(this.strict||O)&&this.invalidStringToken(this.pos-1-Le.length,O?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(We)}return se(ae)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(ae)}},nr.readHexChar=function(O){var ae=this.pos,Ve=this.readInt(16,O);return Ve===null&&this.invalidStringToken(ae,"Bad character escape sequence"),Ve},nr.readWord1=function(){this.containsEsc=!1;for(var O="",ae=!0,Ve=this.pos,Le=this.options.ecmaVersion>=6;this.pos<this.input.length;){var We=this.fullCharCodeAtPos();if(I(We,Le))this.pos+=We<=65535?1:2;else if(We===92){this.containsEsc=!0,O+=this.input.slice(Ve,this.pos);var lt=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var ut=this.readCodePoint();(ae?A:I)(ut,Le)||this.invalidStringToken(lt,"Invalid Unicode escape"),O+=qe(ut),Ve=this.pos}else break;ae=!1}return O+this.input.slice(Ve,this.pos)},nr.readWord=function(){var O=this.readWord1(),ae=V.name;return this.keywords.test(O)&&(ae=Q[O]),this.finishToken(ae,O)};var Nn="8.12.1";Rt.acorn={Parser:Rt,version:Nn,defaultOptions:Ye,Position:He,SourceLocation:Ze,getLineInfo:tt,Node:Dr,TokenType:M,tokTypes:V,keywordTypes:Q,TokContext:xr,tokContexts:tr,isIdentifierChar:I,isIdentifierStart:A,Token:hn,isNewLine:se,lineBreak:te,lineBreakG:ne,nonASCIIwhitespace:oe};function zn(O,ae){return Rt.parse(O,ae)}function Gn(O,ae,Ve){return Rt.parseExpressionAt(O,ae,Ve)}function Wn(O,ae){return Rt.tokenizer(O,ae)}n.Node=Dr,n.Parser=Rt,n.Position=He,n.SourceLocation=Ze,n.TokContext=xr,n.Token=hn,n.TokenType=M,n.defaultOptions=Ye,n.getLineInfo=tt,n.isIdentifierChar=I,n.isIdentifierStart=A,n.isNewLine=se,n.keywordTypes=Q,n.lineBreak=te,n.lineBreakG=ne,n.nonASCIIwhitespace=oe,n.parse=zn,n.parseExpressionAt=Gn,n.tokContexts=tr,n.tokTypes=V,n.tokenizer=Wn,n.version=Nn})}),require_acorn_jsx=__commonJS((t,e)=>{var n=require_xhtml(),o=/^[\da-fA-F]+$/,l=/^\d+$/,d=new WeakMap;function f(_){_=_.Parser.acorn||_;let S=d.get(_);if(!S){const R=_.tokTypes,C=_.TokContext,E=_.TokenType,A=new C("<tag",!1),I=new C("</tag",!1),M=new C("<tag>...</tag>",!0,!0),j={tc_oTag:A,tc_cTag:I,tc_expr:M},q={jsxName:new E("jsxName"),jsxText:new E("jsxText",{beforeExpr:!0}),jsxTagStart:new E("jsxTagStart",{startsExpr:!0}),jsxTagEnd:new E("jsxTagEnd")};q.jsxTagStart.updateContext=function(){this.context.push(M),this.context.push(A),this.exprAllowed=!1},q.jsxTagEnd.updateContext=function(z){let Q=this.context.pop();Q===A&&z===R.slash||Q===I?(this.context.pop(),this.exprAllowed=this.curContext()===M):this.exprAllowed=!0},S={tokContexts:j,tokTypes:q},d.set(_,S)}return S}function g(_){if(!_)return _;if(_.type==="JSXIdentifier")return _.name;if(_.type==="JSXNamespacedName")return _.namespace.name+":"+_.name.name;if(_.type==="JSXMemberExpression")return g(_.object)+"."+g(_.property)}e.exports=function(_){return _=_||{},function(S){return b({allowNamespaces:_.allowNamespaces!==!1,allowNamespacedObjects:!!_.allowNamespacedObjects,autoCloseVoidElements:!!_.autoCloseVoidElements},S)}},Object.defineProperty(e.exports,"tokTypes",{get:function(){return f(require_acorn()).tokTypes},configurable:!0,enumerable:!0});function b(_,S){const R=S.acorn||require_acorn(),C=f(R),E=R.tokTypes,A=C.tokTypes,I=R.tokContexts,M=C.tokContexts.tc_oTag,j=C.tokContexts.tc_cTag,q=C.tokContexts.tc_expr,z=R.isNewLine,Q=R.isIdentifierStart,F=R.isIdentifierChar;return class extends S{static get acornJsx(){return C}jsx_readToken(){let V="",te=this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated JSX contents");let ne=this.input.charCodeAt(this.pos);switch(ne){case 60:case 123:return this.pos===this.start?ne===60&&this.exprAllowed?(++this.pos,this.finishToken(A.jsxTagStart)):this.getTokenFromCode(ne):(V+=this.input.slice(te,this.pos),this.finishToken(A.jsxText,V));case 38:V+=this.input.slice(te,this.pos),V+=this.jsx_readEntity(),te=this.pos;break;case 62:case 125:this.raise(this.pos,"Unexpected token `"+this.input[this.pos]+"`. Did you mean `"+(ne===62?">":"}")+'` or `{"'+this.input[this.pos]+'"}`?');default:z(ne)?(V+=this.input.slice(te,this.pos),V+=this.jsx_readNewLine(!0),te=this.pos):++this.pos}}}jsx_readNewLine(V){let te=this.input.charCodeAt(this.pos),ne;return++this.pos,te===13&&this.input.charCodeAt(this.pos)===10?(++this.pos,ne=V?`
|
|
1104
1104
|
`:`\r
|
|
1105
1105
|
`):ne=String.fromCharCode(te),this.options.locations&&(++this.curLine,this.lineStart=this.pos),ne}jsx_readString(V){let te="",ne=++this.pos;for(;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");let se=this.input.charCodeAt(this.pos);if(se===V)break;se===38?(te+=this.input.slice(ne,this.pos),te+=this.jsx_readEntity(),ne=this.pos):z(se)?(te+=this.input.slice(ne,this.pos),te+=this.jsx_readNewLine(!1),ne=this.pos):++this.pos}return te+=this.input.slice(ne,this.pos++),this.finishToken(E.string,te)}jsx_readEntity(){let V="",te=0,ne,se=this.input[this.pos];se!=="&"&&this.raise(this.pos,"Entity must start with an ampersand");let ge=++this.pos;for(;this.pos<this.input.length&&te++<10;){if(se=this.input[this.pos++],se===";"){V[0]==="#"?V[1]==="x"?(V=V.substr(2),o.test(V)&&(ne=String.fromCharCode(parseInt(V,16)))):(V=V.substr(1),l.test(V)&&(ne=String.fromCharCode(parseInt(V,10)))):ne=n[V];break}V+=se}return ne||(this.pos=ge,"&")}jsx_readWord(){let V,te=this.pos;do V=this.input.charCodeAt(++this.pos);while(F(V)||V===45);return this.finishToken(A.jsxName,this.input.slice(te,this.pos))}jsx_parseIdentifier(){let V=this.startNode();return this.type===A.jsxName?V.name=this.value:this.type.keyword?V.name=this.type.keyword:this.unexpected(),this.next(),this.finishNode(V,"JSXIdentifier")}jsx_parseNamespacedName(){let V=this.start,te=this.startLoc,ne=this.jsx_parseIdentifier();if(!_.allowNamespaces||!this.eat(E.colon))return ne;var se=this.startNodeAt(V,te);return se.namespace=ne,se.name=this.jsx_parseIdentifier(),this.finishNode(se,"JSXNamespacedName")}jsx_parseElementName(){if(this.type===A.jsxTagEnd)return"";let V=this.start,te=this.startLoc,ne=this.jsx_parseNamespacedName();for(this.type===E.dot&&ne.type==="JSXNamespacedName"&&!_.allowNamespacedObjects&&this.unexpected();this.eat(E.dot);){let se=this.startNodeAt(V,te);se.object=ne,se.property=this.jsx_parseIdentifier(),ne=this.finishNode(se,"JSXMemberExpression")}return ne}jsx_parseAttributeValue(){switch(this.type){case E.braceL:let V=this.jsx_parseExpressionContainer();return V.expression.type==="JSXEmptyExpression"&&this.raise(V.start,"JSX attributes must only be assigned a non-empty expression"),V;case A.jsxTagStart:case E.string:return this.parseExprAtom();default:this.raise(this.start,"JSX value should be either an expression or a quoted JSX text")}}jsx_parseEmptyExpression(){let V=this.startNodeAt(this.lastTokEnd,this.lastTokEndLoc);return this.finishNodeAt(V,"JSXEmptyExpression",this.start,this.startLoc)}jsx_parseExpressionContainer(){let V=this.startNode();return this.next(),V.expression=this.type===E.braceR?this.jsx_parseEmptyExpression():this.parseExpression(),this.expect(E.braceR),this.finishNode(V,"JSXExpressionContainer")}jsx_parseAttribute(){let V=this.startNode();return this.eat(E.braceL)?(this.expect(E.ellipsis),V.argument=this.parseMaybeAssign(),this.expect(E.braceR),this.finishNode(V,"JSXSpreadAttribute")):(V.name=this.jsx_parseNamespacedName(),V.value=this.eat(E.eq)?this.jsx_parseAttributeValue():null,this.finishNode(V,"JSXAttribute"))}jsx_parseOpeningElementAt(V,te){let ne=this.startNodeAt(V,te);ne.attributes=[];let se=this.jsx_parseElementName();for(se&&(ne.name=se);this.type!==E.slash&&this.type!==A.jsxTagEnd;)ne.attributes.push(this.jsx_parseAttribute());ne.selfClosing=this.eat(E.slash),this.expect(A.jsxTagEnd);const ge=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];return _.autoCloseVoidElements&&se&&ge.includes(se.name)&&(ne.selfClosing=!0),this.finishNode(ne,se?"JSXOpeningElement":"JSXOpeningFragment")}jsx_parseClosingElementAt(V,te){let ne=this.startNodeAt(V,te),se=this.jsx_parseElementName();return se&&(ne.name=se),this.expect(A.jsxTagEnd),this.finishNode(ne,se?"JSXClosingElement":"JSXClosingFragment")}jsx_parseElementAt(V,te){let ne=this.startNodeAt(V,te),se=[],ge=this.jsx_parseOpeningElementAt(V,te),oe=null;if(!ge.selfClosing){e:for(;;)switch(this.type){case A.jsxTagStart:if(V=this.start,te=this.startLoc,this.next(),this.eat(E.slash)){oe=this.jsx_parseClosingElementAt(V,te);break e}se.push(this.jsx_parseElementAt(V,te));break;case A.jsxText:se.push(this.parseExprAtom());break;case E.braceL:se.push(this.jsx_parseExpressionContainer());break;default:this.unexpected()}g(oe.name)!==g(ge.name)&&this.raise(oe.start,"Expected corresponding JSX closing tag for <"+g(ge.name)+">")}let Ae=ge.name?"Element":"Fragment";return ne["opening"+Ae]=ge,ne["closing"+Ae]=oe,ne.children=se,this.type===E.relational&&this.value==="<"&&this.raise(this.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(ne,"JSX"+Ae)}jsx_parseText(){let V=this.parseLiteral(this.value);return V.type="JSXText",V}jsx_parseElement(){let V=this.start,te=this.startLoc;return this.next(),this.jsx_parseElementAt(V,te)}parseExprAtom(V){return this.type===A.jsxText?this.jsx_parseText():this.type===A.jsxTagStart?this.jsx_parseElement():super.parseExprAtom(V)}readToken(V){let te=this.curContext();if(te===q)return this.jsx_readToken();if(te===M||te===j){if(Q(V))return this.jsx_readWord();if(V==62)return++this.pos,this.finishToken(A.jsxTagEnd);if((V===34||V===39)&&te==M)return this.jsx_readString(V)}return V===60&&this.exprAllowed&&this.input.charCodeAt(this.pos+1)!==33?(++this.pos,this.finishToken(A.jsxTagStart)):super.readToken(V)}updateContext(V){if(this.type==E.braceL){var te=this.curContext();te==M?this.context.push(I.b_expr):te==q?this.context.push(I.b_tmpl):super.updateContext(V),this.exprAllowed=!0}else if(this.type===E.slash&&V===A.jsxTagStart)this.context.length-=2,this.context.push(j),this.exprAllowed=!1;else return super.updateContext(V)}}}}),astralIdentifierCodes=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,81,2,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,9,5351,0,7,14,13835,9,87,9,39,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,4706,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,983,6,110,6,6,9,4759,9,787719,239],astralIdentifierStartCodes=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,68,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,4026,582,8634,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,757,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],nonASCIIidentifierChars="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࢘-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟊꟐꟑꟓꟕ-ꟙꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",reservedWords={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",keywords$1={5:ecma5AndLessKeywords,"5module":ecma5AndLessKeywords+" export import",6:ecma5AndLessKeywords+" const class extends export import super"},keywordRelationalOperator=/^in(stanceof)?$/,nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]"),nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");function isInAstralSet(t,e){for(var n=65536,o=0;o<e.length;o+=2){if(n+=e[o],n>t)return!1;if(n+=e[o+1],n>=t)return!0}return!1}function isIdentifierStart(t,e){return t<65?t===36:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&nonASCIIidentifierStart.test(String.fromCharCode(t)):e===!1?!1:isInAstralSet(t,astralIdentifierStartCodes)}function isIdentifierChar(t,e){return t<48?t===36:t<58?!0:t<65?!1:t<91?!0:t<97?t===95:t<123?!0:t<=65535?t>=170&&nonASCIIidentifier.test(String.fromCharCode(t)):e===!1?!1:isInAstralSet(t,astralIdentifierStartCodes)||isInAstralSet(t,astralIdentifierCodes)}var TokenType=function t(e,n){n===void 0&&(n={}),this.label=e,this.keyword=n.keyword,this.beforeExpr=!!n.beforeExpr,this.startsExpr=!!n.startsExpr,this.isLoop=!!n.isLoop,this.isAssign=!!n.isAssign,this.prefix=!!n.prefix,this.postfix=!!n.postfix,this.binop=n.binop||null,this.updateContext=null};function binop(t,e){return new TokenType(t,{beforeExpr:!0,binop:e})}var beforeExpr={beforeExpr:!0},startsExpr={startsExpr:!0},keywords={};function kw(t,e){return e===void 0&&(e={}),e.keyword=t,keywords[t]=new TokenType(t,e)}var types$1={num:new TokenType("num",startsExpr),regexp:new TokenType("regexp",startsExpr),string:new TokenType("string",startsExpr),name:new TokenType("name",startsExpr),privateId:new TokenType("privateId",startsExpr),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:!0,startsExpr:!0}),braceR:new TokenType("}"),parenL:new TokenType("(",{beforeExpr:!0,startsExpr:!0}),parenR:new TokenType(")"),comma:new TokenType(",",beforeExpr),semi:new TokenType(";",beforeExpr),colon:new TokenType(":",beforeExpr),dot:new TokenType("."),question:new TokenType("?",beforeExpr),questionDot:new TokenType("?."),arrow:new TokenType("=>",beforeExpr),template:new TokenType("template"),invalidTemplate:new TokenType("invalidTemplate"),ellipsis:new TokenType("...",beforeExpr),backQuote:new TokenType("`",startsExpr),dollarBraceL:new TokenType("${",{beforeExpr:!0,startsExpr:!0}),eq:new TokenType("=",{beforeExpr:!0,isAssign:!0}),assign:new TokenType("_=",{beforeExpr:!0,isAssign:!0}),incDec:new TokenType("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new TokenType("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:binop("||",1),logicalAND:binop("&&",2),bitwiseOR:binop("|",3),bitwiseXOR:binop("^",4),bitwiseAND:binop("&",5),equality:binop("==/!=/===/!==",6),relational:binop("</>/<=/>=",7),bitShift:binop("<</>>/>>>",8),plusMin:new TokenType("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:binop("%",10),star:binop("*",10),slash:binop("/",10),starstar:new TokenType("**",{beforeExpr:!0}),coalesce:binop("??",1),_break:kw("break"),_case:kw("case",beforeExpr),_catch:kw("catch"),_continue:kw("continue"),_debugger:kw("debugger"),_default:kw("default",beforeExpr),_do:kw("do",{isLoop:!0,beforeExpr:!0}),_else:kw("else",beforeExpr),_finally:kw("finally"),_for:kw("for",{isLoop:!0}),_function:kw("function",startsExpr),_if:kw("if"),_return:kw("return",beforeExpr),_switch:kw("switch"),_throw:kw("throw",beforeExpr),_try:kw("try"),_var:kw("var"),_const:kw("const"),_while:kw("while",{isLoop:!0}),_with:kw("with"),_new:kw("new",{beforeExpr:!0,startsExpr:!0}),_this:kw("this",startsExpr),_super:kw("super",startsExpr),_class:kw("class",startsExpr),_extends:kw("extends",beforeExpr),_export:kw("export"),_import:kw("import",startsExpr),_null:kw("null",startsExpr),_true:kw("true",startsExpr),_false:kw("false",startsExpr),_in:kw("in",{beforeExpr:!0,binop:7}),_instanceof:kw("instanceof",{beforeExpr:!0,binop:7}),_typeof:kw("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:kw("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:kw("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},lineBreak=/\r\n?|\n|\u2028|\u2029/,lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(t){return t===10||t===13||t===8232||t===8233}function nextLineBreak(t,e,n){n===void 0&&(n=t.length);for(var o=e;o<n;o++){var l=t.charCodeAt(o);if(isNewLine(l))return o<n-1&&l===13&&t.charCodeAt(o+1)===10?o+2:o+1}return-1}var nonASCIIwhitespace=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ref=Object.prototype,hasOwnProperty=ref.hasOwnProperty,toString=ref.toString,hasOwn=Object.hasOwn||function(t,e){return hasOwnProperty.call(t,e)},isArray=Array.isArray||function(t){return toString.call(t)==="[object Array]"},regexpCache=Object.create(null);function wordsRegexp(t){return regexpCache[t]||(regexpCache[t]=new RegExp("^(?:"+t.replace(/ /g,"|")+")$"))}function codePointToString(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}var loneSurrogate=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Position=function t(e,n){this.line=e,this.column=n};Position.prototype.offset=function t(e){return new Position(this.line,this.column+e)};var SourceLocation=function t(e,n,o){this.start=n,this.end=o,e.sourceFile!==null&&(this.source=e.sourceFile)};function getLineInfo(t,e){for(var n=1,o=0;;){var l=nextLineBreak(t,o,e);if(l<0)return new Position(n,e-o);++n,o=l}}var defaultOptions={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},warnedAboutEcmaVersion=!1;function getOptions(t){var e={};for(var n in defaultOptions)e[n]=t&&hasOwn(t,n)?t[n]:defaultOptions[n];if(e.ecmaVersion==="latest"?e.ecmaVersion=1e8:e.ecmaVersion==null?(!warnedAboutEcmaVersion&&typeof console=="object"&&console.warn&&(warnedAboutEcmaVersion=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
|
|
1106
1106
|
Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=11):e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),e.allowReserved==null&&(e.allowReserved=e.ecmaVersion<5),(!t||t.allowHashBang==null)&&(e.allowHashBang=e.ecmaVersion>=14),isArray(e.onToken)){var o=e.onToken;e.onToken=function(l){return o.push(l)}}return isArray(e.onComment)&&(e.onComment=pushComment(e,e.onComment)),e}function pushComment(t,e){return function(n,o,l,d,f,g){var b={type:n?"Block":"Line",value:o,start:l,end:d};t.locations&&(b.loc=new SourceLocation(this,f,g)),t.ranges&&(b.range=[l,d]),e.push(b)}}var SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_ASYNC=4,SCOPE_GENERATOR=8,SCOPE_ARROW=16,SCOPE_SIMPLE_CATCH=32,SCOPE_SUPER=64,SCOPE_DIRECT_SUPER=128,SCOPE_CLASS_STATIC_BLOCK=256,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION|SCOPE_CLASS_STATIC_BLOCK;function functionFlags(t,e){return SCOPE_FUNCTION|(t?SCOPE_ASYNC:0)|(e?SCOPE_GENERATOR:0)}var BIND_NONE=0,BIND_VAR=1,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,BIND_OUTSIDE=5,Parser=function t(e,n,o){this.options=e=getOptions(e),this.sourceFile=e.sourceFile,this.keywords=wordsRegexp(keywords$1[e.ecmaVersion>=6?6:e.sourceType==="module"?"5module":5]);var l="";e.allowReserved!==!0&&(l=reservedWords[e.ecmaVersion>=6?6:e.ecmaVersion===5?5:3],e.sourceType==="module"&&(l+=" await")),this.reservedWords=wordsRegexp(l);var d=(l?l+" ":"")+reservedWords.strict;this.reservedWordsStrict=wordsRegexp(d),this.reservedWordsStrictBind=wordsRegexp(d+" "+reservedWords.strictBind),this.input=String(n),this.containsEsc=!1,o?(this.pos=o,this.lineStart=this.input.lastIndexOf(`
|
|
@@ -1110,7 +1110,7 @@ Defaulting to 2020, but this will stop working in the future.`)),e.ecmaVersion=1
|
|
|
1110
1110
|
`;break;default:t+=String.fromCharCode(n);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
|
|
1111
1111
|
`&&++this.pos;case`
|
|
1112
1112
|
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return`
|
|
1113
|
-
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}return isNewLine(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},pp.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(e?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),t+=codePointToString(f),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)},pp.readWord=function(){var t=this.readWord1(),e=types$1.name;return this.keywords.test(t)&&(e=keywords[t]),this.finishToken(e,t)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node:Node$3,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(t){return VOID_ELEMENTS.indexOf(t.toLowerCase())===-1}function canHaveWhitespace(t){return NO_WHITESPACE.indexOf(t.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(e="Nullish value encountered"){super(e),this.name="NullishShortCircuit"}}var hash=(t="",e=16)=>{const n=String(t);let o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).toString(e)},randomHash=()=>hash(Math.random().toString()),camelCase=t=>t.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(e=>e).map((e,n)=>n>0?e[0].toUpperCase()+e.slice(1):e).join(""),parseStyle=t=>{switch(typeof t){case"string":return t.split(";").filter(e=>e).reduce((e,n)=>{const o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...e,[camelCase(o)]:l}},{});case"object":return t;default:return}},pathToArrayPath=t=>t==null||t===""?[]:t.split("."),resolveArrayPath=(t,e)=>{const[n,...o]=e;if(!(t==null||n==null))return o.length===0?t[n]:resolveArrayPath(t[n],o)},resolvePath=(t,e)=>resolveArrayPath(t,pathToArrayPath(e));function handleNaN(t){return Number.isNaN(t)?"NaN":t}class JsxParser extends React.Component{constructor(){super(...arguments);ir(this,"ParsedChildren",null);qr(this,lr,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>ar(this,tr).call(this,f)).filter(Boolean)});qr(this,tr,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:ar(this,tr).call(this,n.value,o);case"JSXElement":case"JSXFragment":return ar(this,Kr).call(this,n,o);case"JSXExpressionContainer":return ar(this,tr).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(A=>ar(this,tr).call(this,A,o));case"BinaryExpression":const g=ar(this,tr).call(this,n.left,o),b=ar(this,tr).call(this,n.right,o);let _;switch(n.operator){case"-":_=g-b;break;case"!=":_=g!=b;break;case"!==":_=g!==b;break;case"*":_=g*b;break;case"**":_=g**b;break;case"/":_=g/b;break;case"%":_=g%b;break;case"+":_=g+b;break;case"<":_=g<b;break;case"<=":_=g<=b;break;case"==":_=g==b;break;case"===":_=g===b;break;case">":_=g>b;break;case">=":_=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(_);case"CallExpression":const S=ar(this,tr).call(this,n.callee,o);if(S===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return S(...n.arguments.map(A=>ar(this,tr).call(this,A,o)));case"ConditionalExpression":return ar(this,tr).call(this,n.test,o)?ar(this,tr).call(this,n.consequent,o):ar(this,tr).call(this,n.alternate,o);case"ExpressionStatement":return ar(this,tr).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=ar(this,tr).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?ar(this,tr).call(this,n.right,o):!1;case"MemberExpression":return ar(this,rn).call(this,n,o);case"ChainExpression":return ar(this,tn).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(A=>{C[A.key.name||A.key.value]=ar(this,tr).call(this,A.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((A,I)=>A.start<I.start?-1:1).map(A=>ar(this,tr).call(this,A,o)).join("");case"UnaryExpression":const E=ar(this,tr).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...A)=>{const I={...o};return n.params.forEach((M,j)=>{I[M.name]=A[j]}),ar(this,tr).call(this,n.body,I)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});qr(this,tn,(n,o)=>{try{return ar(this,tr).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});qr(this,rn,(n,o)=>{const l=ar(this,tr).call(this,n.object,o);let d;if(n.computed)d=ar(this,tr).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});qr(this,Ur,n=>n.type==="JSXIdentifier"?n.name:`${ar(this,Ur).call(this,n.object)}.${ar(this,Ur).call(this,n.property)}`);qr(this,Kr,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,_=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:S=[]}=_,R=n.type==="JSXElement"?ar(this,Ur).call(this,_.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>ar(this,Kr).call(this,z,o));const A=R.trim().toLowerCase();if(E.indexOf(A)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let I,M=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(M||canHaveChildren(R)){if(I=b.map(Q=>ar(this,tr).call(this,Q,o)),R.includes(".")){const F=R.split(".").reduce((V,te)=>V?V[te]:d==null?void 0:d[te],null);F&&(M=F)}!M&&!canHaveWhitespace(R)&&(I=I.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=I.find(Q=>typeof Q=="function");I.length===0?I=void 0:z?I=z:I.length===1?[I]=I:I.length>1&&!this.props.disableKeyGeneration&&(I=I.map((Q,F)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||F}:Q))}const j={key:this.props.disableKeyGeneration?void 0:randomHash()};S.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,F=attributeNames_default[Q]||Q,V=ar(this,tr).call(this,z,o);C.filter(ne=>ne.test(F)).length===0&&(j[F]=V)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=ar(this,tr).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(F=>{const V=attributeNames_default[F]||F;C.filter(ne=>ne.test(V)).length===0&&(j[V]=Q[F])})}}),typeof j.style=="string"&&(j.style=parseStyle(j.style));const q=R.toLowerCase();return q==="option"&&(I=I.props.children),React.createElement(M||q,j,I)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=ar(this,lr).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}lr=new WeakMap,tr=new WeakMap,tn=new WeakMap,rn=new WeakMap,Ur=new WeakMap,Kr=new WeakMap,ir(JsxParser,"displayName","JsxParser"),ir(JsxParser,"defaultProps",{allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null});var source_default=JsxParser;const CountryFlag=({countryCode:t,className:e=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[t]),l||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})};function ProductCard({applicationId:t,product:e,viewProductLink:n,defaultOpportunityNumber:o="",onAddToCart:l,addingToCart:d=!1,shopifyHostname:f,customAction:g=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var st,ot,Ue,Ct,Je,yt,Mt,qt,Ht,Ft,Ke,at;const b=React.useRef(null),_=useIntersectionObserver({elementRef:b,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),{toast:S}=useToast(),[R,C]=React.useState(1),[E,A]=React.useState(null),[I,M]=React.useState(0),[j,q]=React.useState(!1),[z,Q]=React.useState(!1),[F,V]=React.useState(!1),[te]=usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),[ne,se]=React.useState(!1),[ge]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),{data:oe,isLoading:Ae,isFetching:je}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!_}),Ne=((st=e==null?void 0:e.Distribution)==null?void 0:st.Cost)||0,Oe=((ot=e==null?void 0:e.Distribution)==null?void 0:ot.RegularPrice)||0,Fe=((Ue=e==null?void 0:e.Distribution)==null?void 0:Ue.Price)||0,ze=React.useMemo(()=>{var Qe;return!((Qe=e==null?void 0:e.Distribution)!=null&&Qe.Inventory)||e.Distribution.Inventory.length===0?0:e.Distribution.Inventory.reduce((ct,ft)=>ct+(ft.PurchaseOrderQuantity||0),0)},[(Ct=e==null?void 0:e.Distribution)==null?void 0:Ct.Inventory]);React.useEffect(()=>{C(1),A(null),M(0),q(!1)},[e==null?void 0:e.RandmarSKU]),React.useEffect(()=>{var Qe;if(e&&o){const ct=(Qe=e.Opportunities)==null?void 0:Qe.find(ft=>ft.BidNumber==o);ct&&A(ct)}},[e,o]),React.useEffect(()=>{if(!e)return;const Qe=E!=null&&E.Price?E.Price:Fe;M(Oe>0?Math.round((Oe-Qe)/Oe*100):0)},[e,E,Fe,Oe]),React.useEffect(()=>{d||C(1)},[d]);const $e=Qe=>{if(Qe.Active!==!0)return!1;const ct=new Date().toISOString().split("T")[0];return!(Qe.EndDate&&Qe.EndDate.split("T")[0]<ct||Qe.StartDate&&Qe.StartDate.split("T")[0]>ct)};if(React.useEffect(()=>{d||C(1)},[d]),!e||Ae||je)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex products-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col products-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 products-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const Be=(e==null?void 0:e.Opportunities)||[],qe=Be.length>0,Ge=()=>{if(R==null){C(1);return}R>1&&C(R-1)},He=()=>{if(R==null){C(1);return}C(R+1)},Ze=Qe=>{const ct=Number.parseInt(Qe.target.value,10);if(!isNaN(ct)&&ct>0){C(ct);return}C(void 0)},tt=()=>{(R==null||R<1)&&C(1)},Ye=()=>{z||!(oe!=null&&oe.IsReseller)||(Q(!0),te({routeResellerId:oe.ApplicationId??"",randmarSku:e.RandmarSKU??""}).then(Qe=>{if(Qe.error){console.error(Qe.error),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"});return}S({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),V(!1)}).catch(Qe=>{console.error(Qe),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{Q(!1)}))},rt=((yt=(Je=e.Distribution)==null?void 0:Je.Inventory)==null?void 0:yt.reduce((Qe,ct)=>Qe+(ct.AvailableQuantity||0),0))||0,Xe=Qe=>{try{return new Date(Qe).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(ct){return console.error(ct),Qe.split("T")[0]||"N/A"}},it=()=>{typeof l<"u"&&l({quantity:R??1,bidNumber:(E==null?void 0:E.BidNumber)??null})},et=()=>{ne||!f||(se(!0),ge({routeResellerId:t??"",randmarSku:e.RandmarSKU??"",shopifyHostName:f}).then(Qe=>{if(Qe.error){console.error("Error syncing to Shopify:",Qe.error),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}S({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(Qe=>{console.error("Error syncing to Shopify:",Qe),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{se(!1)}))};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",ref:b,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex products-center justify-end ml-4",children:jsxRuntime.jsx(PartnerLogo,{id:e.ManufacturerId,name:e.ManufacturerName,width:96,height:40})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${(Mt=e.ManufacturerCategory)!=null&&Mt.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(qt=e.ManufacturerCategory)!=null&&qt.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",e.BodyHTML&&e.Title&&e.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UnitWeight?`${formatNumber(e.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[e.MAP?formatMoney(e.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),e.MSRP?formatMoney(e.MSRP):"N/A"]})]}),!!e.OverallPercentileRank&&!!e.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Percentile"}),jsxRuntime.jsxs("div",{className:`font-medium flex products-center ${e.OverallPercentileRank>=80?"text-green-700":""}`,children:[formatNumber(Math.round(e.OverallPercentileRank))," Overall"]}),jsxRuntime.jsxs("div",{className:"font-light flex products-center text-sm",children:[formatNumber(Math.round(e.ManufacturerPercentileRank))," with Manufacturer"]})]}),e.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex products-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:qe&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex products-center",children:"You have "+Be.length+(Be.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:Be.map((Qe,ct)=>jsxRuntime.jsxs("div",{className:`flex justify-between products-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
1113
|
+
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),t){var n=this.pos-1;this.invalidStringToken(n,"Invalid escape sequence in template string")}default:if(e>=48&&e<=55){var o=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],l=parseInt(o,8);return l>255&&(o=o.slice(0,-1),l=parseInt(o,8)),this.pos+=o.length-1,e=this.input.charCodeAt(this.pos),(o!=="0"||e===56||e===57)&&(this.strict||t)&&this.invalidStringToken(this.pos-1-o.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(l)}return isNewLine(e)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(e)}},pp.readHexChar=function(t){var e=this.pos,n=this.readInt(16,t);return n===null&&this.invalidStringToken(e,"Bad character escape sequence"),n},pp.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,n=this.pos,o=this.options.ecmaVersion>=6;this.pos<this.input.length;){var l=this.fullCharCodeAtPos();if(isIdentifierChar(l,o))this.pos+=l<=65535?1:2;else if(l===92){this.containsEsc=!0,t+=this.input.slice(n,this.pos);var d=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var f=this.readCodePoint();(e?isIdentifierStart:isIdentifierChar)(f,o)||this.invalidStringToken(d,"Invalid Unicode escape"),t+=codePointToString(f),n=this.pos}else break;e=!1}return t+this.input.slice(n,this.pos)},pp.readWord=function(){var t=this.readWord1(),e=types$1.name;return this.keywords.test(t)&&(e=keywords[t]),this.finishToken(e,t)};var version="8.12.1";Parser.acorn={Parser,version,defaultOptions,Position,SourceLocation,getLineInfo,Node:Node$3,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};var AcornJSX=__toESM(require_acorn_jsx(),1),attributeNames_default={acceptcharset:"acceptCharset",accesskey:"accessKey",allowfullscreen:"allowFullScreen",autocapitalize:"autoCapitalize",autocomplete:"autoComplete",autofocus:"autoFocus",autoplay:"autoPlay",cellpadding:"cellPadding",cellspacing:"cellSpacing",charset:"charSet",class:"className",colspan:"colSpan",contenteditable:"contentEditable",crossorigin:"crossOrigin",datetime:"dateTime",enctype:"encType",for:"htmlFor",formaction:"formAction",formenctype:"formEncType",formmethod:"formMethod",formnovalidate:"formNoValidate",formtarget:"formTarget",frameborder:"frameBorder",hreflang:"hrefLang",httpequiv:"httpEquiv",inputmode:"inputMode",keyparams:"keyParams",keytype:"keyType",marginheight:"marginHeight",marginwidth:"marginWidth",maxlength:"maxLength",mediagroup:"mediaGroup",minlength:"minLength",novalidate:"noValidate",radiogroup:"radioGroup",readonly:"readOnly",referrerpolicy:"referrerPolicy",rowspan:"rowSpan",spellcheck:"spellCheck",srcdoc:"srcDoc",srclang:"srcLang",srcset:"srcSet",tabindex:"tabIndex",usemap:"useMap"},VOID_ELEMENTS=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],NO_WHITESPACE=["table","tbody","tfoot","thead","tr"];function canHaveChildren(t){return VOID_ELEMENTS.indexOf(t.toLowerCase())===-1}function canHaveWhitespace(t){return NO_WHITESPACE.indexOf(t.toLowerCase())!==-1}class NullishShortCircuit extends Error{constructor(e="Nullish value encountered"){super(e),this.name="NullishShortCircuit"}}var hash=(t="",e=16)=>{const n=String(t);let o=0;return n.split("").forEach(l=>{o=(o<<5)-o+l.charCodeAt(0),o&=o}),Math.abs(o).toString(e)},randomHash=()=>hash(Math.random().toString()),camelCase=t=>t.replace(/([A-Z])([A-Z])/g,"$1 $2").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[^a-zA-Z\u00C0-\u00ff]/g," ").toLowerCase().split(" ").filter(e=>e).map((e,n)=>n>0?e[0].toUpperCase()+e.slice(1):e).join(""),parseStyle=t=>{switch(typeof t){case"string":return t.split(";").filter(e=>e).reduce((e,n)=>{const o=n.slice(0,n.indexOf(":")).trim(),l=n.slice(n.indexOf(":")+1).trim();return{...e,[camelCase(o)]:l}},{});case"object":return t;default:return}},pathToArrayPath=t=>t==null||t===""?[]:t.split("."),resolveArrayPath=(t,e)=>{const[n,...o]=e;if(!(t==null||n==null))return o.length===0?t[n]:resolveArrayPath(t[n],o)},resolvePath=(t,e)=>resolveArrayPath(t,pathToArrayPath(e));function handleNaN(t){return Number.isNaN(t)?"NaN":t}class JsxParser extends React.Component{constructor(){super(...arguments);Qt(this,"ParsedChildren",null);Hr(this,lr,n=>{const o=Parser.extend(AcornJSX.default({autoCloseVoidElements:this.props.autoCloseVoidElements})),l=`<root>${n}</root>`;let d=[];try{d=o.parse(l,{ecmaVersion:"latest"}),d=d.body[0].expression.children||[]}catch(f){return this.props.showWarnings&&console.warn(f),this.props.onError&&this.props.onError(f),this.props.renderError?this.props.renderError({error:String(f)}):null}return d.map(f=>ar(this,rr).call(this,f)).filter(Boolean)});Hr(this,rr,(n,o)=>{var l,d;switch(n.type){case"JSXAttribute":return n.value===null?!0:ar(this,rr).call(this,n.value,o);case"JSXElement":case"JSXFragment":return ar(this,Zr).call(this,n,o);case"JSXExpressionContainer":return ar(this,rr).call(this,n.expression,o);case"JSXText":const f=this.props.disableKeyGeneration?void 0:randomHash();return this.props.disableFragments?n.value:React.createElement(React.Fragment,{key:f},n.value);case"ArrayExpression":return n.elements.map(A=>ar(this,rr).call(this,A,o));case"BinaryExpression":const g=ar(this,rr).call(this,n.left,o),b=ar(this,rr).call(this,n.right,o);let _;switch(n.operator){case"-":_=g-b;break;case"!=":_=g!=b;break;case"!==":_=g!==b;break;case"*":_=g*b;break;case"**":_=g**b;break;case"/":_=g/b;break;case"%":_=g%b;break;case"+":_=g+b;break;case"<":_=g<b;break;case"<=":_=g<=b;break;case"==":_=g==b;break;case"===":_=g===b;break;case">":_=g>b;break;case">=":_=g>=b;break;default:this.props.onError(new Error(`Unsupported binary operator: ${n.operator}`));return}return handleNaN(_);case"CallExpression":const S=ar(this,rr).call(this,n.callee,o);if(S===void 0){if(n.optional)throw new NullishShortCircuit;this.props.onError(new Error(`The expression '${n.callee}' could not be resolved, resulting in an undefined return value.`));return}return S(...n.arguments.map(A=>ar(this,rr).call(this,A,o)));case"ConditionalExpression":return ar(this,rr).call(this,n.test,o)?ar(this,rr).call(this,n.consequent,o):ar(this,rr).call(this,n.alternate,o);case"ExpressionStatement":return ar(this,rr).call(this,n.expression,o);case"Identifier":return n.name==="Infinity"?1/0:n.name==="-Infinity"?-1/0:n.name==="NaN"?NaN:o&&n.name in o?handleNaN(o[n.name]):handleNaN((this.props.bindings||{})[n.name]);case"Literal":return n.value;case"LogicalExpression":const R=ar(this,rr).call(this,n.left,o);return n.operator==="||"&&R?R:n.operator==="&&"&&R||n.operator==="||"&&!R?ar(this,rr).call(this,n.right,o):!1;case"MemberExpression":return ar(this,an).call(this,n,o);case"ChainExpression":return ar(this,nn).call(this,n,o);case"ObjectExpression":const C={};return n.properties.forEach(A=>{C[A.key.name||A.key.value]=ar(this,rr).call(this,A.value,o)}),C;case"TemplateElement":return n.value.cooked;case"TemplateLiteral":return[...n.expressions,...n.quasis].sort((A,I)=>A.start<I.start?-1:1).map(A=>ar(this,rr).call(this,A,o)).join("");case"UnaryExpression":const E=ar(this,rr).call(this,n.argument,o);switch(n.operator){case"+":return+E;case"-":return-E;case"!":return!E}return;case"ArrowFunctionExpression":return(n.async||n.generator)&&((d=(l=this.props).onError)==null||d.call(l,new Error("Async and generator arrow functions are not supported."))),(...A)=>{const I={...o};return n.params.forEach((M,j)=>{I[M.name]=A[j]}),ar(this,rr).call(this,n.body,I)};default:this.props.onError(new Error(`The expression type '${n.type}' is not supported.`));return}});Hr(this,nn,(n,o)=>{try{return ar(this,rr).call(this,n.expression,o)}catch(l){if(l instanceof NullishShortCircuit)return;throw l}});Hr(this,an,(n,o)=>{const l=ar(this,rr).call(this,n.object,o);let d;if(n.computed)d=ar(this,rr).call(this,n.property,o);else if(n.property.type==="Identifier")d=n.property.name;else{this.props.onError(new Error("Only simple MemberExpressions are supported."));return}if(l==null&&n.optional)throw new NullishShortCircuit;let f;try{f=l[d]}catch{this.props.onError(new Error(`The property '${d}' could not be resolved on the object '${l}'.`));return}return typeof f=="function"?f.bind(l):f});Hr(this,zr,n=>n.type==="JSXIdentifier"?n.name:`${ar(this,zr).call(this,n.object)}.${ar(this,zr).call(this,n.property)}`);Hr(this,Zr,(n,o)=>{const{allowUnknownElements:l,components:d,componentsOnly:f,onError:g}=this.props,{children:b=[]}=n,_=n.type==="JSXElement"?n.openingElement:n.openingFragment,{attributes:S=[]}=_,R=n.type==="JSXElement"?ar(this,zr).call(this,_.name):"",C=(this.props.blacklistedAttrs||[]).map(z=>z instanceof RegExp?z:new RegExp(z,"i")),E=(this.props.blacklistedTags||[]).map(z=>z.trim().toLowerCase()).filter(Boolean);if(/^(html|head|body)$/i.test(R))return b.map(z=>ar(this,Zr).call(this,z,o));const A=R.trim().toLowerCase();if(E.indexOf(A)!==-1)return g(new Error(`The tag <${R}> is blacklisted, and will not be rendered.`)),null;if(R!==""&&!resolvePath(d,R)){if(f)return g(new Error(`The component <${R}> is unrecognized, and will not be rendered.`)),this.props.renderUnrecognized(R);if(!l&&document.createElement(R)instanceof HTMLUnknownElement)return g(new Error(`The tag <${R}> is unrecognized in this browser, and will not be rendered.`)),this.props.renderUnrecognized(R)}let I,M=n.type==="JSXElement"?resolvePath(d,R):React.Fragment;if(M||canHaveChildren(R)){if(I=b.map(Q=>ar(this,rr).call(this,Q,o)),R.includes(".")){const F=R.split(".").reduce((V,te)=>V?V[te]:d==null?void 0:d[te],null);F&&(M=F)}!M&&!canHaveWhitespace(R)&&(I=I.filter(Q=>typeof Q!="string"||!/^\s*$/.test(Q)));const z=I.find(Q=>typeof Q=="function");I.length===0?I=void 0:z?I=z:I.length===1?[I]=I:I.length>1&&!this.props.disableKeyGeneration&&(I=I.map((Q,F)=>Q!=null&&Q.type&&!(Q!=null&&Q.key)?{...Q,key:Q.key||F}:Q))}const j={key:this.props.disableKeyGeneration?void 0:randomHash()};S.forEach(z=>{if(z.type==="JSXAttribute"){const Q=z.name.name,F=attributeNames_default[Q]||Q,V=ar(this,rr).call(this,z,o);C.filter(ne=>ne.test(F)).length===0&&(j[F]=V)}else if(z.type==="JSXSpreadAttribute"&&z.argument.type==="Identifier"||z.argument.type==="MemberExpression"){const Q=ar(this,rr).call(this,z.argument,o);typeof Q=="object"&&Object.keys(Q).forEach(F=>{const V=attributeNames_default[F]||F;C.filter(ne=>ne.test(V)).length===0&&(j[V]=Q[F])})}}),typeof j.style=="string"&&(j.style=parseStyle(j.style));const q=R.toLowerCase();return q==="option"&&(I=I.props.children),React.createElement(M||q,j,I)})}render(){const n=(this.props.jsx||"").trim().replace(/<!DOCTYPE([^>]*)>/g,"");this.ParsedChildren=ar(this,lr).call(this,n);const o=[...new Set(["jsx-parser",...String(this.props.className).split(" ")])].filter(Boolean).join(" ");return this.props.renderInWrapper?React.createElement("div",{className:o},this.ParsedChildren):this.ParsedChildren}}lr=new WeakMap,rr=new WeakMap,nn=new WeakMap,an=new WeakMap,zr=new WeakMap,Zr=new WeakMap,Qt(JsxParser,"displayName","JsxParser"),Qt(JsxParser,"defaultProps",{allowUnknownElements:!0,autoCloseVoidElements:!1,bindings:{},blacklistedAttrs:[/^on.+/i],blacklistedTags:["script"],className:"",components:{},componentsOnly:!1,disableFragments:!1,disableKeyGeneration:!1,jsx:"",onError:()=>{},showWarnings:!1,renderError:void 0,renderInWrapper:!0,renderUnrecognized:()=>null});var source_default=JsxParser;const CountryFlag=({countryCode:t,className:e=""})=>{const[n,o]=React.useState(null),[l,d]=React.useState(!1);return React.useEffect(()=>{if(!t)return;const g=`https://purecatamphetamine.github.io/country-flag-icons/3x2/${t.toUpperCase()}.svg`;fetch(g,{method:"HEAD"}).then(b=>{b.ok?(o(g),d(!1)):d(!0)}).catch(()=>{d(!0)})},[t]),l||!n?jsxRuntime.jsx("span",{className:e,children:t}):jsxRuntime.jsx("img",{src:n,alt:`${t} flag`,className:`inline-block ${e}`,style:{width:"24px",height:"auto"}})};function ProductCard({applicationId:t,product:e,viewProductLink:n,defaultOpportunityNumber:o="",onAddToCart:l,addingToCart:d=!1,shopifyHostname:f,customAction:g=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var st,ot,Ue,Ct,Je,yt,Mt,qt,Ht,Ft,Ke,at;const b=React.useRef(null),_=useIntersectionObserver({elementRef:b,threshold:.1,rootMargin:"100px",freezeOnceVisible:!0}),{toast:S}=useToast(),[R,C]=React.useState(1),[E,A]=React.useState(null),[I,M]=React.useState(0),[j,q]=React.useState(!1),[z,Q]=React.useState(!1),[F,V]=React.useState(!1),[te]=usePutV4ResellerByRouteResellerIdProductAndRandmarSkuRequisitionMutation(),[ne,se]=React.useState(!1),[ge]=usePostV4ResellerByRouteResellerIdProductAndRandmarSkuShopifyMutation(),{data:oe,isLoading:Ae,isFetching:je}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t||!_}),Ne=((st=e==null?void 0:e.Distribution)==null?void 0:st.Cost)||0,Oe=((ot=e==null?void 0:e.Distribution)==null?void 0:ot.RegularPrice)||0,Fe=((Ue=e==null?void 0:e.Distribution)==null?void 0:Ue.Price)||0,ze=React.useMemo(()=>{var Qe;return!((Qe=e==null?void 0:e.Distribution)!=null&&Qe.Inventory)||e.Distribution.Inventory.length===0?0:e.Distribution.Inventory.reduce((ct,ft)=>ct+(ft.PurchaseOrderQuantity||0),0)},[(Ct=e==null?void 0:e.Distribution)==null?void 0:Ct.Inventory]);React.useEffect(()=>{C(1),A(null),M(0),q(!1)},[e==null?void 0:e.RandmarSKU]),React.useEffect(()=>{var Qe;if(e&&o){const ct=(Qe=e.Opportunities)==null?void 0:Qe.find(ft=>ft.BidNumber==o);ct&&A(ct)}},[e,o]),React.useEffect(()=>{if(!e)return;const Qe=E!=null&&E.Price?E.Price:Fe;M(Oe>0?Math.round((Oe-Qe)/Oe*100):0)},[e,E,Fe,Oe]),React.useEffect(()=>{d||C(1)},[d]);const $e=Qe=>{if(Qe.Active!==!0)return!1;const ct=new Date().toISOString().split("T")[0];return!(Qe.EndDate&&Qe.EndDate.split("T")[0]<ct||Qe.StartDate&&Qe.StartDate.split("T")[0]>ct)};if(React.useEffect(()=>{d||C(1)},[d]),!e||Ae||je)return jsxRuntime.jsx(Card,{children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx(Skeleton,{className:"h-7 w-3/4"}),jsxRuntime.jsx("div",{className:"h-10 w-24 flex products-center justify-end ml-4",children:jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"})})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-6 w-20 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24 rounded-full"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-28 rounded-full"})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-6 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-20 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-16"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-12 mb-1"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-20"})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx("div",{className:"w-60 h-40",children:jsxRuntime.jsx(Skeleton,{className:"w-full h-full rounded-lg"})})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx(Skeleton,{className:"h-4 w-24 mb-3"}),jsxRuntime.jsx(Skeleton,{className:"h-16 w-full rounded-md"})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-32 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24 mt-4"})]})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsxs("div",{className:"flex flex-col products-start gap-1 mb-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-8 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 products-center gap-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-10 w-24 rounded-md"}),jsxRuntime.jsx(Skeleton,{className:"h-10 flex-1 rounded-md"})]})]})]})});const Be=(e==null?void 0:e.Opportunities)||[],qe=Be.length>0,Ge=()=>{if(R==null){C(1);return}R>1&&C(R-1)},He=()=>{if(R==null){C(1);return}C(R+1)},Ze=Qe=>{const ct=Number.parseInt(Qe.target.value,10);if(!isNaN(ct)&&ct>0){C(ct);return}C(void 0)},tt=()=>{(R==null||R<1)&&C(1)},Ye=()=>{z||!(oe!=null&&oe.IsReseller)||(Q(!0),te({routeResellerId:oe.ApplicationId??"",randmarSku:e.RandmarSKU??""}).then(Qe=>{if(Qe.error){console.error(Qe.error),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"});return}S({title:"Success",description:"Qualification successfully submitted.",variant:"success"}),V(!1)}).catch(Qe=>{console.error(Qe),S({title:"Error",description:"Error submitting your qualification.",variant:"destructive"})}).finally(()=>{Q(!1)}))},rt=((yt=(Je=e.Distribution)==null?void 0:Je.Inventory)==null?void 0:yt.reduce((Qe,ct)=>Qe+(ct.AvailableQuantity||0),0))||0,Xe=Qe=>{try{return new Date(Qe).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch(ct){return console.error(ct),Qe.split("T")[0]||"N/A"}},it=()=>{typeof l<"u"&&l({quantity:R??1,bidNumber:(E==null?void 0:E.BidNumber)??null})},et=()=>{ne||!f||(se(!0),ge({routeResellerId:t??"",randmarSku:e.RandmarSKU??"",shopifyHostName:f}).then(Qe=>{if(Qe.error){console.error("Error syncing to Shopify:",Qe.error),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"});return}S({title:"Product synced",description:"Product synced to Shopify successfully",variant:"success"})}).catch(Qe=>{console.error("Error syncing to Shopify:",Qe),S({title:"Product synced failed.",description:"Error syncing to Shopify:",variant:"destructive"})}).finally(()=>{se(!1)}))};return jsxRuntime.jsx(Card,{className:"hover:shadow-lg transition-shadow",ref:b,children:jsxRuntime.jsxs(CardContent,{className:"p-6",children:[jsxRuntime.jsxs("div",{className:"flex justify-between products-start mb-3",children:[jsxRuntime.jsx("h3",{className:"font-semibold text-xl",children:e.Title||e.RandmarTitle}),jsxRuntime.jsx("div",{className:"w-24 h-10 flex products-center justify-end ml-4",children:jsxRuntime.jsx(PartnerLogo,{id:e.ManufacturerId,name:e.ManufacturerName,width:96,height:40})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.State&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.State==="Active"?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Check,{size:"12",className:"mr-1.5"})," ",e.State]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.SerialNumber?"bg-green-50 text-green-700 hover:bg-green-50":"bg-yellow-50 text-yellow-700 hover:bg-yellow-50"}`,children:[jsxRuntime.jsx(QrCode,{size:"12",className:"mr-1.5"})," ",e.SerialNumber?"Serialized":"Unserialized"]}),e.TransparencyCode&&jsxRuntime.jsxs(Badge,{variant:"outline",className:"rounded-full px-3 bg-green-50 text-green-700 hover:bg-green-50",children:[jsxRuntime.jsx(CircleDashed,{size:"12",className:"mr-1.5"})," Transparency Code"]}),e.AvailableToBuy!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AvailableToBuy?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(ShoppingCart,{size:"12",className:"mr-1.5"})," ",e.AvailableToBuy?"Available":"Unavailable"]}),e.ManufacturerCategory!==void 0&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${(Mt=e.ManufacturerCategory)!=null&&Mt.QualificationRequired?"bg-blue-50 text-blue-700 hover:bg-blue-50":"bg-neutral-50 text-neutral-700 hover:bg-neutral-50"}`,children:[jsxRuntime.jsx(ShieldCheck,{size:"12",className:"mr-1.5"})," ",(qt=e.ManufacturerCategory)!=null&&qt.QualificationRequired?"Qualified Only":"Available to all"]}),e.ManufacturerId&&jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.AutoUpdate?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(RefreshCw,{size:"12",className:"mr-1.5"})," ",e.AutoUpdate?`Automatic Reorder (${e.MasterCarton})`:"Manually Reorders"]}),jsxRuntime.jsxs(Badge,{variant:"outline",className:`rounded-full px-3 ${e.BodyHTML&&e.Title&&e.MAP?"bg-green-50 text-green-700 hover:bg-green-50":"bg-red-50 text-red-700 hover:bg-red-50"}`,children:[jsxRuntime.jsx(Store,{size:"12",className:"mr-1.5"})," ",e.BodyHTML&&e.Title&&e.MAP?"Shopify Ready":"Not Shopify Ready"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-4 flex-1",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"MPN"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.MPN||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"UPC"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UPC||"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Unit Weight"}),jsxRuntime.jsx("div",{className:"font-medium",children:e.UnitWeight?`${formatNumber(e.UnitWeight)} lbs`:"N/A"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"text-sm text-muted-foreground",children:["MAP",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),"MSRP"]}),jsxRuntime.jsxs("div",{className:"font-medium",children:[e.MAP?formatMoney(e.MAP):"N/A",jsxRuntime.jsx("span",{className:"text-primary",children:" / "}),e.MSRP?formatMoney(e.MSRP):"N/A"]})]}),!!e.OverallPercentileRank&&!!e.ManufacturerPercentileRank&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Percentile"}),jsxRuntime.jsxs("div",{className:`font-medium flex products-center ${e.OverallPercentileRank>=80?"text-green-700":""}`,children:[formatNumber(Math.round(e.OverallPercentileRank))," Overall"]}),jsxRuntime.jsxs("div",{className:"font-light flex products-center text-sm",children:[formatNumber(Math.round(e.ManufacturerPercentileRank))," with Manufacturer"]})]}),e.CountryCodeOfOrigin&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"text-sm text-muted-foreground",children:"Origin"}),jsxRuntime.jsxs("div",{className:"font-medium flex products-center",children:[jsxRuntime.jsx(CountryFlag,{countryCode:e.CountryCodeOfOrigin,className:"mr-2"}),e.CountryCodeOfOrigin]})]})]})]}),jsxRuntime.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsx(ProductImage,{randmarSKU:e.RandmarSKU||"",alt:e.RandmarTitle||""})})]}),jsxRuntime.jsxs("div",{className:"flex gap-6 mt-4",children:[jsxRuntime.jsx("div",{className:"flex flex-1",children:qe&&e.Distribution&&jsxRuntime.jsxs("div",{className:"w-full",children:[jsxRuntime.jsx("div",{className:"flex products-center",children:"You have "+Be.length+(Be.length>1?" opportunities":" opportunity")+" for this product:"}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-[200px] overflow-y-auto p-2 mt-1",children:Be.map((Qe,ct)=>jsxRuntime.jsxs("div",{className:`flex justify-between products-center rounded-lg transition-colors py-2 px-4 bg-purple-100 border border-muted
|
|
1114
1114
|
${Qe.BidNumber==(E==null?void 0:E.BidNumber)?"cursor-pointer border-2 border-purple-900":$e(Qe)?"hover:bg-purple-200 cursor-pointer":"!bg-neutral-50"}
|
|
1115
1115
|
`,onClick:()=>{$e(Qe)&&A(Qe.BidNumber!=(E==null?void 0:E.BidNumber)?Qe:null)},children:[jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"font-medium text-sm",children:Qe.Opportunity}),jsxRuntime.jsxs("span",{className:"text-xs text-neutral-900",children:[Qe.BidNumber," ",!$e(Qe)&&jsxRuntime.jsx(Badge,{variant:"outline",className:"text-xs mx-1 h-5 bg-gray-100",children:"Currently unavailable"})]})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-end",children:[jsxRuntime.jsx("span",{className:"font-semibold",children:formatMoney(Qe.Price??0)}),Qe.Rebate&&Qe.Rebate>0&&jsxRuntime.jsxs("span",{className:"text-xs text-green-600",children:["Rebate: ",formatMoney(Qe.Rebate)]}),Qe.EndDate&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral-600",children:["Ends: ",Xe(Qe.EndDate)]})]})]},ct))})]})}),jsxRuntime.jsxs("div",{className:"flex flex-col products-center",children:[n&&jsxRuntime.jsx(reactRouterDom.Link,{to:n,children:jsxRuntime.jsxs(Button,{variant:"secondary",children:[jsxRuntime.jsx(Eye,{className:"mr-2"}),"View Product"]})}),((Ht=e.Distribution)==null?void 0:Ht.Inventory)&&jsxRuntime.jsx("div",{className:"mt-4",children:oe!=null&&oe.IsReseller&&rt<=0&&ze<=0?jsxRuntime.jsxs(Dialog,{open:F,onOpenChange:V,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"flex products-center text-sm reseller-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),"Request to stock"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-md",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsx(DialogTitle,{children:"Request to stock"})}),jsxRuntime.jsx("p",{className:"py-4",children:"Are you sure you want to request this product to be stocked?"}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2",children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>V(!1),disabled:z,children:"Cancel"}),jsxRuntime.jsx(Button,{onClick:Ye,disabled:z,children:z?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Requesting..."]}):"Confirm"})]})]})]}):rt<=0&&ze>0?jsxRuntime.jsxs(Dialog,{open:j,onOpenChange:q,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:"flex products-center text-sm manufacturer-theme text-primary",children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),formatNumber(ze)," Incoming"]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex products-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]}):jsxRuntime.jsxs(Dialog,{open:j,onOpenChange:q,children:[jsxRuntime.jsx(DialogTrigger,{asChild:!0,children:jsxRuntime.jsxs(Button,{variant:"ghost",className:`flex products-center text-sm ${rt>0?"text-green-700":"text-red-700"}`,children:[jsxRuntime.jsx(Warehouse,{size:"16",className:"mr-2"}),rt>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[formatNumber(rt)," in stock"]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Out of stock"})]})}),jsxRuntime.jsxs(DialogContent,{className:"max-w-4xl",children:[jsxRuntime.jsx(DialogHeader,{children:jsxRuntime.jsxs(DialogTitle,{className:"flex products-center",children:[jsxRuntime.jsx(Warehouse,{className:"mr-2",size:18}),"Inventory Information"]})}),jsxRuntime.jsx(ProductInventoryGrid,{inventory:e.Distribution.Inventory})]})]})})]})]}),e.Distribution&&jsxRuntime.jsxs("div",{className:"flex justify-between products-end mt-4",children:[jsxRuntime.jsx("div",{className:"flex-shrink-1 flex flex-col products-start gap-1",children:Ne>0?jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs("span",{className:"text-2xl font-bold whitespace-nowrap",children:["Cost: ",formatMoney(Ne)]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex products-center flex-wrap",children:[jsxRuntime.jsx("span",{className:"text-2xl font-bold whitespace-nowrap",children:formatMoney((E?(Ke=(Ft=e.Opportunities)==null?void 0:Ft.find(Qe=>Qe.BidNumber==E.BidNumber))==null?void 0:Ke.Price:Fe)??0)}),I>0&&jsxRuntime.jsx("span",{className:"text-muted-foreground line-through ml-2 whitespace-nowrap",children:formatMoney(Oe)})]}),I>0&&jsxRuntime.jsx("div",{className:"flex products-center",children:jsxRuntime.jsxs(Badge,{variant:"outline",className:"bg-red-50 text-red-700 rounded-full px-3 whitespace-nowrap",children:[jsxRuntime.jsxs("span",{children:[I,"% OFF"]}),((at=e.InstantRebate)==null?void 0:at.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",e.InstantRebate.EndDate.split("T")[0]]}),(E==null?void 0:E.EndDate)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1.5",children:"●"})," Ends ",E.EndDate.split("T")[0]]})]})})]})}),jsxRuntime.jsxs("div",{className:"flex flex-shrink-0 gap-2 ml-4",children:[typeof l<"u"&&jsxRuntime.jsxs("div",{className:"flex products-center border rounded-md",children:[jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-r-none",onClick:Ge,disabled:typeof R<"u"&&(R<=1||!e.AvailableToBuy||d),children:"-"}),jsxRuntime.jsx("input",{value:R,onChange:Ze,onBlur:tt,onClick:Qe=>Qe.currentTarget.select(),className:`w-12 text-center border-0 focus:ring-0 focus:outline-none ${!e.AvailableToBuy||d?"text-gray-400":""}`,disabled:!e.AvailableToBuy||d}),jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"rounded-l-none",onClick:He,disabled:!e.AvailableToBuy||d,children:"+"})]}),typeof l<"u"&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap",onClick:it,disabled:!e.AvailableToBuy||d,children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Adding..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Add to Cart"]})}),f&&jsxRuntime.jsx(Button,{className:"gap-2 whitespace-nowrap bg-green-600 hover:bg-green-700",onClick:et,disabled:ne,children:ne?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),"Syncing..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ShoppingCart,{className:"mr-2"}),"Sync to Shopify"]})}),g]})]})]})})}const complexComponents=[`----
|
|
1116
1116
|
PartnerCard: For data that fits this shape:
|
|
@@ -1136,8 +1136,8 @@ You can add a description to the \`${CONTENT_NAME}\` by passing a \`${DESCRIPTIO
|
|
|
1136
1136
|
|
|
1137
1137
|
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${CONTENT_NAME}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
1138
1138
|
|
|
1139
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return React__namespace.useEffect(()=>{var o;document.getElementById((o=t.current)==null?void 0:o.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Root2=AlertDialog$1,Trigger2=AlertDialogTrigger$1,Portal2=AlertDialogPortal$1,Overlay2=AlertDialogOverlay$1,Content2=AlertDialogContent$1,Action=AlertDialogAction$1,Cancel=AlertDialogCancel$1,Title2=AlertDialogTitle$1,Description2=AlertDialogDescription$1;const AlertDialog=Root2,AlertDialogTrigger=Trigger2,AlertDialogPortal=Portal2,AlertDialogOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay2,{className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));AlertDialogOverlay.displayName=Overlay2.displayName;const AlertDialogContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsxs(AlertDialogPortal,{children:[jsxRuntime.jsx(AlertDialogOverlay,{}),jsxRuntime.jsx(Content2,{ref:n,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));AlertDialogContent.displayName=Content2.displayName;const AlertDialogHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});AlertDialogHeader.displayName="AlertDialogHeader";const AlertDialogFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});AlertDialogFooter.displayName="AlertDialogFooter";const AlertDialogTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title2,{ref:n,className:cn("text-lg font-semibold",t),...e}));AlertDialogTitle.displayName=Title2.displayName;const AlertDialogDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description2,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));AlertDialogDescription.displayName=Description2.displayName;const AlertDialogAction=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Action,{ref:n,className:cn(buttonVariants(),t),...e}));AlertDialogAction.displayName=Action.displayName;const AlertDialogCancel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Cancel,{ref:n,className:cn(buttonVariants({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));AlertDialogCancel.displayName=Cancel.displayName;function PageHeader({title:t,children:e,className:n}){return jsxRuntime.jsxs("div",{className:"relative pb-4",children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-0 w-full h-24 bg-sidebar z-[-20]"}),jsxRuntime.jsxs("div",{className:cn("relative container pt-6 flex justify-between",n),children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold text-sidebar-foreground inline",children:t}),e]})]})}function OrderedMap(t){this.content=t}OrderedMap.prototype={constructor:OrderedMap,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,l=o.find(t),d=o.content.slice();return l==-1?d.push(n||t,e):(d[l+1]=e,n&&(d[l]=n)),new OrderedMap(d)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new OrderedMap(n)},addToStart:function(t,e){return new OrderedMap([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new OrderedMap(n)},addBefore:function(t,e,n){var o=this.remove(e),l=o.content.slice(),d=o.find(t);return l.splice(d==-1?l.length:d,0,e,n),new OrderedMap(l)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=OrderedMap.from(t),t.size?new OrderedMap(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=OrderedMap.from(t),t.size?new OrderedMap(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=OrderedMap.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},OrderedMap.from=function(t){if(t instanceof OrderedMap)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new OrderedMap(e)};function findDiffStart(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let l=t.child(o),d=e.child(o);if(l==d){n+=l.nodeSize;continue}if(!l.sameMarkup(d))return n;if(l.isText&&l.text!=d.text){for(let f=0;l.text[f]==d.text[f];f++)n++;return n}if(l.content.size||d.content.size){let f=findDiffStart(l.content,d.content,n+1);if(f!=null)return f}n+=l.nodeSize}}function findDiffEnd(t,e,n,o){for(let l=t.childCount,d=e.childCount;;){if(l==0||d==0)return l==d?null:{a:n,b:o};let f=t.child(--l),g=e.child(--d),b=f.nodeSize;if(f==g){n-=b,o-=b;continue}if(!f.sameMarkup(g))return{a:n,b:o};if(f.isText&&f.text!=g.text){let _=0,S=Math.min(f.text.length,g.text.length);for(;_<S&&f.text[f.text.length-_-1]==g.text[g.text.length-_-1];)_++,n--,o--;return{a:n,b:o}}if(f.content.size||g.content.size){let _=findDiffEnd(f.content,g.content,n-1,o-1);if(_)return _}n-=b,o-=b}}class Fragment{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,l=0,d){for(let f=0,g=0;g<n;f++){let b=this.content[f],_=g+b.nodeSize;if(_>e&&o(b,l+g,d||null,f)!==!1&&b.content.size){let S=g+1;b.nodesBetween(Math.max(0,e-S),Math.min(b.content.size,n-S),o,l+S)}g=_}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,l){let d="",f=!0;return this.nodesBetween(e,n,(g,b)=>{let _=g.isText?g.text.slice(Math.max(e,b)-b,n-b):g.isLeaf?l?typeof l=="function"?l(g):l:g.type.spec.leafText?g.type.spec.leafText(g):"":"";g.isBlock&&(g.isLeaf&&_||g.isTextblock)&&o&&(f?f=!1:d+=o),d+=_},0),d}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,l=this.content.slice(),d=0;for(n.isText&&n.sameMarkup(o)&&(l[l.length-1]=n.withText(n.text+o.text),d=1);d<e.content.length;d++)l.push(e.content[d]);return new Fragment(l,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],l=0;if(n>e)for(let d=0,f=0;f<n;d++){let g=this.content[d],b=f+g.nodeSize;b>e&&((f<e||b>n)&&(g.isText?g=g.cut(Math.max(0,e-f),Math.min(g.text.length,n-f)):g=g.cut(Math.max(0,e-f-1),Math.min(g.content.size,n-f-1))),o.push(g),l+=g.nodeSize),f=b}return new Fragment(o,l)}cutByIndex(e,n){return e==n?Fragment.empty:e==0&&n==this.content.length?this:new Fragment(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let l=this.content.slice(),d=this.size+n.nodeSize-o.nodeSize;return l[e]=n,new Fragment(l,d)}addToStart(e){return new Fragment([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Fragment(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let l=this.content[n];e(l,o,n),o+=l.nodeSize}}findDiffStart(e,n=0){return findDiffStart(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return findDiffEnd(this,e,n,o)}findIndex(e,n=-1){if(e==0)return retIndex(0,e);if(e==this.size)return retIndex(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,l=0;;o++){let d=this.child(o),f=l+d.nodeSize;if(f>=e)return f==e||n>0?retIndex(o+1,f):retIndex(o,l);l=f}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Fragment.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fragment(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Fragment.empty;let n,o=0;for(let l=0;l<e.length;l++){let d=e[l];o+=d.nodeSize,l&&d.isText&&e[l-1].sameMarkup(d)?(n||(n=e.slice(0,l)),n[n.length-1]=d.withText(n[n.length-1].text+d.text)):n&&n.push(d)}return new Fragment(n||e,o)}static from(e){if(!e)return Fragment.empty;if(e instanceof Fragment)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Fragment([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fragment.empty=new Fragment([],0);const found={index:0,offset:0};function retIndex(t,e){return found.index=t,found.offset=e,found}function compareDeep(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!compareDeep(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!compareDeep(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let Mark$1=class yn{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let l=0;l<e.length;l++){let d=e[l];if(this.eq(d))return e;if(this.type.excludes(d.type))n||(n=e.slice(0,l));else{if(d.type.excludes(this.type))return e;!o&&d.type.rank>this.type.rank&&(n||(n=e.slice(0,l)),n.push(this),o=!0),n&&n.push(d)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&compareDeep(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let l=o.create(n.attrs);return o.checkAttrs(l.attrs),l}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return yn.none;if(e instanceof yn)return[e];let n=e.slice();return n.sort((o,l)=>o.type.rank-l.type.rank),n}};Mark$1.none=[];class ReplaceError extends Error{}class Slice{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=insertInto(this.content,e+this.openStart,n);return o&&new Slice(o,this.openStart,this.openEnd)}removeBetween(e,n){return new Slice(removeRange(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Slice.empty;let o=n.openStart||0,l=n.openEnd||0;if(typeof o!="number"||typeof l!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Slice(Fragment.fromJSON(e,n.content),o,l)}static maxOpen(e,n=!0){let o=0,l=0;for(let d=e.firstChild;d&&!d.isLeaf&&(n||!d.type.spec.isolating);d=d.firstChild)o++;for(let d=e.lastChild;d&&!d.isLeaf&&(n||!d.type.spec.isolating);d=d.lastChild)l++;return new Slice(e,o,l)}}Slice.empty=new Slice(Fragment.empty,0,0);function removeRange(t,e,n){let{index:o,offset:l}=t.findIndex(e),d=t.maybeChild(o),{index:f,offset:g}=t.findIndex(n);if(l==e||d.isText){if(g!=n&&!t.child(f).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=f)throw new RangeError("Removing non-flat range");return t.replaceChild(o,d.copy(removeRange(d.content,e-l-1,n-l-1)))}function insertInto(t,e,n,o){let{index:l,offset:d}=t.findIndex(e),f=t.maybeChild(l);if(d==e||f.isText)return t.cut(0,e).append(n).append(t.cut(e));let g=insertInto(f.content,e-d-1,n);return g&&t.replaceChild(l,f.copy(g))}function replace(t,e,n){if(n.openStart>t.depth)throw new ReplaceError("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter(t,e,n,0)}function replaceOuter(t,e,n,o){let l=t.index(o),d=t.node(o);if(l==e.index(o)&&o<t.depth-n.openStart){let f=replaceOuter(t,e,n,o+1);return d.copy(d.content.replaceChild(l,f))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let f=t.parent,g=f.content;return close(f,g.cut(0,t.parentOffset).append(n.content).append(g.cut(e.parentOffset)))}else{let{start:f,end:g}=prepareSliceForReplace(n,t);return close(d,replaceThreeWay(t,f,g,e,o))}else return close(d,replaceTwoWay(t,e,o))}function checkJoin(t,e){if(!e.type.compatibleContent(t.type))throw new ReplaceError("Cannot join "+e.type.name+" onto "+t.type.name)}function joinable$1(t,e,n){let o=t.node(n);return checkJoin(o,e.node(n)),o}function addNode(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function addRange(t,e,n,o){let l=(e||t).node(n),d=0,f=e?e.index(n):l.childCount;t&&(d=t.index(n),t.depth>n?d++:t.textOffset&&(addNode(t.nodeAfter,o),d++));for(let g=d;g<f;g++)addNode(l.child(g),o);e&&e.depth==n&&e.textOffset&&addNode(e.nodeBefore,o)}function close(t,e){return t.type.checkContent(e),t.copy(e)}function replaceThreeWay(t,e,n,o,l){let d=t.depth>l&&joinable$1(t,e,l+1),f=o.depth>l&&joinable$1(n,o,l+1),g=[];return addRange(null,t,l,g),d&&f&&e.index(l)==n.index(l)?(checkJoin(d,f),addNode(close(d,replaceThreeWay(t,e,n,o,l+1)),g)):(d&&addNode(close(d,replaceTwoWay(t,e,l+1)),g),addRange(e,n,l,g),f&&addNode(close(f,replaceTwoWay(n,o,l+1)),g)),addRange(o,null,l,g),new Fragment(g)}function replaceTwoWay(t,e,n){let o=[];if(addRange(null,t,n,o),t.depth>n){let l=joinable$1(t,e,n+1);addNode(close(l,replaceTwoWay(t,e,n+1)),o)}return addRange(e,null,n,o),new Fragment(o)}function prepareSliceForReplace(t,e){let n=e.depth-t.openStart,l=e.node(n).copy(t.content);for(let d=n-1;d>=0;d--)l=e.node(d).copy(Fragment.from(l));return{start:l.resolveNoCache(t.openStart+n),end:l.resolveNoCache(l.content.size-t.openEnd-n)}}class ResolvedPos{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],l=e.child(n);return o?e.child(n).cut(o):l}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],l=n==0?0:this.path[n*3-1]+1;for(let d=0;d<e;d++)l+=o.child(d).nodeSize;return l}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Mark$1.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),l=e.maybeChild(n);if(!o){let g=o;o=l,l=g}let d=o.marks;for(var f=0;f<d.length;f++)d[f].type.spec.inclusive===!1&&(!l||!d[f].isInSet(l.marks))&&(d=d[f--].removeFromSet(d));return d}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,l=e.parent.maybeChild(e.index());for(var d=0;d<o.length;d++)o[d].type.spec.inclusive===!1&&(!l||!o[d].isInSet(l.marks))&&(o=o[d--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new NodeRange(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],l=0,d=n;for(let f=e;;){let{index:g,offset:b}=f.content.findIndex(d),_=d-b;if(o.push(f,g,l+b),!_||(f=f.child(g),f.isText))break;d=_-1,l+=b+1}return new ResolvedPos(n,o,d)}static resolveCached(e,n){let o=resolveCache.get(e);if(o)for(let d=0;d<o.elts.length;d++){let f=o.elts[d];if(f.pos==n)return f}else resolveCache.set(e,o=new ResolveCache);let l=o.elts[o.i]=ResolvedPos.resolve(e,n);return o.i=(o.i+1)%resolveCacheSize,l}}class ResolveCache{constructor(){this.elts=[],this.i=0}}const resolveCacheSize=12,resolveCache=new WeakMap;class NodeRange{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const emptyAttrs=Object.create(null);let Node$2=class vn{constructor(e,n,o,l=Mark$1.none){this.type=e,this.attrs=n,this.marks=l,this.content=o||Fragment.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,l=0){this.content.nodesBetween(e,n,o,l,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,l){return this.content.textBetween(e,n,o,l)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&compareDeep(this.attrs,n||e.defaultAttrs||emptyAttrs)&&Mark$1.sameSet(this.marks,o||Mark$1.none)}copy(e=null){return e==this.content?this:new vn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new vn(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return Slice.empty;let l=this.resolve(e),d=this.resolve(n),f=o?0:l.sharedDepth(n),g=l.start(f),_=l.node(f).content.cut(l.pos-g,d.pos-g);return new Slice(_,l.depth-f,d.depth-f)}replace(e,n,o){return replace(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:l}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(l==e||n.isText)return n;e-=l+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let l=this.content.child(n-1);return{node:l,index:n-1,offset:o-l.nodeSize}}resolve(e){return ResolvedPos.resolveCached(this,e)}resolveNoCache(e){return ResolvedPos.resolve(this,e)}rangeHasMark(e,n,o){let l=!1;return n>e&&this.nodesBetween(e,n,d=>(o.isInSet(d.marks)&&(l=!0),!l)),l}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=Fragment.empty,l=0,d=o.childCount){let f=this.contentMatchAt(e).matchFragment(o,l,d),g=f&&f.matchFragment(this.content,n);if(!g||!g.validEnd)return!1;for(let b=l;b<d;b++)if(!this.type.allowsMarks(o.child(b).marks))return!1;return!0}canReplaceWith(e,n,o,l){if(l&&!this.type.allowsMarks(l))return!1;let d=this.contentMatchAt(e).matchType(o),f=d&&d.matchFragment(this.content,n);return f?f.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Mark$1.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Mark$1.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let l=Fragment.fromJSON(e,n.content),d=e.nodeType(n.type).create(n.attrs,l,o);return d.type.checkAttrs(d.attrs),d}};Node$2.prototype.text=void 0;class TextNode extends Node$2{constructor(e,n,o,l){if(super(e,n,null,l),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new TextNode(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new TextNode(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function wrapMarks(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ContentMatch{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new TokenStream(e,n);if(o.next==null)return ContentMatch.empty;let l=parseExpr(o);o.next&&o.err("Unexpected trailing text");let d=dfa(nfa(l));return checkForDeadEnds(d,o),d}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let l=this;for(let d=n;l&&d<o;d++)l=l.matchType(e.child(d).type);return l}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let l=[this];function d(f,g){let b=f.matchFragment(e,o);if(b&&(!n||b.validEnd))return Fragment.from(g.map(_=>_.createAndFill()));for(let _=0;_<f.next.length;_++){let{type:S,next:R}=f.next[_];if(!(S.isText||S.hasRequiredAttrs())&&l.indexOf(R)==-1){l.push(R);let C=d(R,g.concat(S));if(C)return C}}return null}return d(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let l=o.shift(),d=l.match;if(d.matchType(e)){let f=[];for(let g=l;g.type;g=g.via)f.push(g.type);return f.reverse()}for(let f=0;f<d.next.length;f++){let{type:g,next:b}=d.next[f];!g.isLeaf&&!g.hasRequiredAttrs()&&!(g.name in n)&&(!l.type||b.validEnd)&&(o.push({match:g.contentMatch,type:g,via:l}),n[g.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let l=0;l<o.next.length;l++)e.indexOf(o.next[l].next)==-1&&n(o.next[l].next)}return n(this),e.map((o,l)=>{let d=l+(o.validEnd?"*":" ")+" ";for(let f=0;f<o.next.length;f++)d+=(f?", ":"")+o.next[f].type.name+"->"+e.indexOf(o.next[f].next);return d}).join(`
|
|
1140
|
-
`)}}ContentMatch.empty=new ContentMatch(!0);class TokenStream{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function parseExpr(t){let e=[];do e.push(parseExprSeq(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function parseExprSeq(t){let e=[];do e.push(parseExprSubscript(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function parseExprSubscript(t){let e=parseExprAtom(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=parseExprRange(t,e);else break;return e}function parseNum(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function parseExprRange(t,e){let n=parseNum(t),o=n;return t.eat(",")&&(t.next!="}"?o=parseNum(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function resolveName(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let l=[];for(let d in n){let f=n[d];f.isInGroup(e)&&l.push(f)}return l.length==0&&t.err("No node type or group '"+e+"' found"),l}function parseExprAtom(t){if(t.eat("(")){let e=parseExpr(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=resolveName(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nfa(t){let e=[[]];return l(d(t,0),n()),e;function n(){return e.push([])-1}function o(f,g,b){let _={term:b,to:g};return e[f].push(_),_}function l(f,g){f.forEach(b=>b.to=g)}function d(f,g){if(f.type=="choice")return f.exprs.reduce((b,_)=>b.concat(d(_,g)),[]);if(f.type=="seq")for(let b=0;;b++){let _=d(f.exprs[b],g);if(b==f.exprs.length-1)return _;l(_,g=n())}else if(f.type=="star"){let b=n();return o(g,b),l(d(f.expr,b),b),[o(b)]}else if(f.type=="plus"){let b=n();return l(d(f.expr,g),b),l(d(f.expr,b),b),[o(b)]}else{if(f.type=="opt")return[o(g)].concat(d(f.expr,g));if(f.type=="range"){let b=g;for(let _=0;_<f.min;_++){let S=n();l(d(f.expr,b),S),b=S}if(f.max==-1)l(d(f.expr,b),b);else for(let _=f.min;_<f.max;_++){let S=n();o(b,S),l(d(f.expr,b),S),b=S}return[o(b)]}else{if(f.type=="name")return[o(g,void 0,f.value)];throw new Error("Unknown expr type")}}}}function cmp(t,e){return e-t}function nullFrom(t,e){let n=[];return o(e),n.sort(cmp);function o(l){let d=t[l];if(d.length==1&&!d[0].term)return o(d[0].to);n.push(l);for(let f=0;f<d.length;f++){let{term:g,to:b}=d[f];!g&&n.indexOf(b)==-1&&o(b)}}}function dfa(t){let e=Object.create(null);return n(nullFrom(t,0));function n(o){let l=[];o.forEach(f=>{t[f].forEach(({term:g,to:b})=>{if(!g)return;let _;for(let S=0;S<l.length;S++)l[S][0]==g&&(_=l[S][1]);nullFrom(t,b).forEach(S=>{_||l.push([g,_=[]]),_.indexOf(S)==-1&&_.push(S)})})});let d=e[o.join(",")]=new ContentMatch(o.indexOf(t.length-1)>-1);for(let f=0;f<l.length;f++){let g=l[f][1].sort(cmp);d.next.push({type:l[f][0],next:e[g.join(",")]||n(g)})}return d}}function checkForDeadEnds(t,e){for(let n=0,o=[t];n<o.length;n++){let l=o[n],d=!l.validEnd,f=[];for(let g=0;g<l.next.length;g++){let{type:b,next:_}=l.next[g];f.push(b.name),d&&!(b.isText||b.hasRequiredAttrs())&&(d=!1),o.indexOf(_)==-1&&o.push(_)}d&&e.err("Only non-generatable nodes ("+f.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function defaultAttrs(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function computeAttrs(t,e){let n=Object.create(null);for(let o in t){let l=e&&e[o];if(l===void 0){let d=t[o];if(d.hasDefault)l=d.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=l}return n}function checkAttrs(t,e,n,o){for(let l in e)if(!(l in t))throw new RangeError(`Unsupported attribute ${l} for ${n} of type ${l}`);for(let l in t){let d=t[l];d.validate&&d.validate(e[l])}}function initAttrs(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new Attribute(t,o,e[o]);return n}let NodeType$1=class Nn{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=initAttrs(e,o.attrs),this.defaultAttrs=defaultAttrs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ContentMatch.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:computeAttrs(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Node$2(this,this.computeAttrs(e),Fragment.from(n),Mark$1.setFrom(o))}createChecked(e=null,n,o){return n=Fragment.from(n),this.checkContent(n),new Node$2(this,this.computeAttrs(e),n,Mark$1.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=Fragment.from(n),n.size){let f=this.contentMatch.fillBefore(n);if(!f)return null;n=f.append(n)}let l=this.contentMatch.matchFragment(n),d=l&&l.fillBefore(Fragment.empty,!0);return d?new Node$2(this,e,n.append(d),Mark$1.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){checkAttrs(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:Mark$1.none:e}static compile(e,n){let o=Object.create(null);e.forEach((d,f)=>o[d]=new Nn(d,n,f));let l=n.spec.topNode||"doc";if(!o[l])throw new RangeError("Schema is missing its top node type ('"+l+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let d in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function validateType(t,e,n){let o=n.split("|");return l=>{let d=l===null?"null":typeof l;if(o.indexOf(d)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${d}`)}}class Attribute{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?validateType(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class MarkType{constructor(e,n,o,l){this.name=e,this.rank=n,this.schema=o,this.spec=l,this.attrs=initAttrs(e,l.attrs),this.excluded=null;let d=defaultAttrs(this.attrs);this.instance=d?new Mark$1(this,d):null}create(e=null){return!e&&this.instance?this.instance:new Mark$1(this,computeAttrs(this.attrs,e))}static compile(e,n){let o=Object.create(null),l=0;return e.forEach((d,f)=>o[d]=new MarkType(d,l++,n,f)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){checkAttrs(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Schema{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let l in e)n[l]=e[l];n.nodes=OrderedMap.from(e.nodes),n.marks=OrderedMap.from(e.marks||{}),this.nodes=NodeType$1.compile(this.spec.nodes,this),this.marks=MarkType.compile(this.spec.marks,this);let o=Object.create(null);for(let l in this.nodes){if(l in this.marks)throw new RangeError(l+" can not be both a node and a mark");let d=this.nodes[l],f=d.spec.content||"",g=d.spec.marks;if(d.contentMatch=o[f]||(o[f]=ContentMatch.parse(f,this.nodes)),d.inlineContent=d.contentMatch.inlineContent,d.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!d.isInline||!d.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=d}d.markSet=g=="_"?null:g?gatherMarks(this,g.split(" ")):g==""||!d.inlineContent?[]:null}for(let l in this.marks){let d=this.marks[l],f=d.spec.excludes;d.excluded=f==null?[d]:f==""?[]:gatherMarks(this,f.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,l){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof NodeType$1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,l)}text(e,n){let o=this.nodes.text;return new TextNode(o,o.defaultAttrs,e,Mark$1.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Node$2.fromJSON(this,e)}markFromJSON(e){return Mark$1.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function gatherMarks(t,e){let n=[];for(let o=0;o<e.length;o++){let l=e[o],d=t.marks[l],f=d;if(d)n.push(d);else for(let g in t.marks){let b=t.marks[g];(l=="_"||b.spec.group&&b.spec.group.split(" ").indexOf(l)>-1)&&n.push(f=b)}if(!f)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function isTagRule(t){return t.tag!=null}function isStyleRule(t){return t.style!=null}let DOMParser$1=class xn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(l=>{if(isTagRule(l))this.tags.push(l);else if(isStyleRule(l)){let d=/[^=]*/.exec(l.style)[0];o.indexOf(d)<0&&o.push(d),this.styles.push(l)}}),this.normalizeLists=!this.tags.some(l=>{if(!/^(ul|ol)\b/.test(l.tag)||!l.node)return!1;let d=e.nodes[l.node];return d.contentMatch.matchType(d)})}parse(e,n={}){let o=new ParseContext(this,n,!1);return o.addAll(e,Mark$1.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new ParseContext(this,n,!0);return o.addAll(e,Mark$1.none,n.from,n.to),Slice.maxOpen(o.finish())}matchTag(e,n,o){for(let l=o?this.tags.indexOf(o)+1:0;l<this.tags.length;l++){let d=this.tags[l];if(matches(e,d.tag)&&(d.namespace===void 0||e.namespaceURI==d.namespace)&&(!d.context||n.matchesContext(d.context))){if(d.getAttrs){let f=d.getAttrs(e);if(f===!1)continue;d.attrs=f||void 0}return d}}}matchStyle(e,n,o,l){for(let d=l?this.styles.indexOf(l)+1:0;d<this.styles.length;d++){let f=this.styles[d],g=f.style;if(!(g.indexOf(e)!=0||f.context&&!o.matchesContext(f.context)||g.length>e.length&&(g.charCodeAt(e.length)!=61||g.slice(e.length+1)!=n))){if(f.getAttrs){let b=f.getAttrs(n);if(b===!1)continue;f.attrs=b||void 0}return f}}}static schemaRules(e){let n=[];function o(l){let d=l.priority==null?50:l.priority,f=0;for(;f<n.length;f++){let g=n[f];if((g.priority==null?50:g.priority)<d)break}n.splice(f,0,l)}for(let l in e.marks){let d=e.marks[l].spec.parseDOM;d&&d.forEach(f=>{o(f=copy(f)),f.mark||f.ignore||f.clearMark||(f.mark=l)})}for(let l in e.nodes){let d=e.nodes[l].spec.parseDOM;d&&d.forEach(f=>{o(f=copy(f)),f.node||f.ignore||f.mark||(f.node=l)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xn(e,xn.schemaRules(e)))}};const blockTags={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ignoreTags={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},listTags={ol:!0,ul:!0},OPT_PRESERVE_WS=1,OPT_PRESERVE_WS_FULL=2,OPT_OPEN_LEFT=4;function wsOptionsFor(t,e,n){return e!=null?(e?OPT_PRESERVE_WS:0)|(e==="full"?OPT_PRESERVE_WS_FULL:0):t&&t.whitespace=="pre"?OPT_PRESERVE_WS|OPT_PRESERVE_WS_FULL:n&~OPT_OPEN_LEFT}class NodeContext{constructor(e,n,o,l,d,f){this.type=e,this.attrs=n,this.marks=o,this.solid=l,this.options=f,this.content=[],this.activeMarks=Mark$1.none,this.match=d||(f&OPT_OPEN_LEFT?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fragment.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,l;return(l=o.findWrapping(e.type))?(this.match=o,l):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&OPT_PRESERVE_WS)){let o=this.content[this.content.length-1],l;if(o&&o.isText&&(l=/[ \t\r\n\u000c]+$/.exec(o.text))){let d=o;o.text.length==l[0].length?this.content.pop():this.content[this.content.length-1]=d.withText(d.text.slice(0,d.text.length-l[0].length))}}let n=Fragment.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Fragment.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!blockTags.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ParseContext{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let l=n.topNode,d,f=wsOptionsFor(null,n.preserveWhitespace,0)|(o?OPT_OPEN_LEFT:0);l?d=new NodeContext(l.type,l.attrs,Mark$1.none,!0,n.topMatch||l.type.contentMatch,f):o?d=new NodeContext(null,null,Mark$1.none,!0,null,f):d=new NodeContext(e.schema.topNodeType,null,Mark$1.none,!0,null,f),this.nodes=[d],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,l=this.top,d=l.options&OPT_PRESERVE_WS_FULL?"full":this.localPreserveWS||(l.options&OPT_PRESERVE_WS)>0;if(d==="full"||l.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(d)d!=="full"?o=o.replace(/\r?\n|\r/g," "):o=o.replace(/\r\n?/g,`
|
|
1139
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return React__namespace.useEffect(()=>{var o;document.getElementById((o=t.current)==null?void 0:o.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Root2=AlertDialog$1,Trigger2=AlertDialogTrigger$1,Portal2=AlertDialogPortal$1,Overlay2=AlertDialogOverlay$1,Content2=AlertDialogContent$1,Action=AlertDialogAction$1,Cancel=AlertDialogCancel$1,Title2=AlertDialogTitle$1,Description2=AlertDialogDescription$1;const AlertDialog=Root2,AlertDialogTrigger=Trigger2,AlertDialogPortal=Portal2,AlertDialogOverlay=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Overlay2,{className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));AlertDialogOverlay.displayName=Overlay2.displayName;const AlertDialogContent=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsxs(AlertDialogPortal,{children:[jsxRuntime.jsx(AlertDialogOverlay,{}),jsxRuntime.jsx(Content2,{ref:n,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));AlertDialogContent.displayName=Content2.displayName;const AlertDialogHeader=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});AlertDialogHeader.displayName="AlertDialogHeader";const AlertDialogFooter=({className:t,...e})=>jsxRuntime.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});AlertDialogFooter.displayName="AlertDialogFooter";const AlertDialogTitle=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Title2,{ref:n,className:cn("text-lg font-semibold",t),...e}));AlertDialogTitle.displayName=Title2.displayName;const AlertDialogDescription=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Description2,{ref:n,className:cn("text-sm text-muted-foreground",t),...e}));AlertDialogDescription.displayName=Description2.displayName;const AlertDialogAction=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Action,{ref:n,className:cn(buttonVariants(),t),...e}));AlertDialogAction.displayName=Action.displayName;const AlertDialogCancel=React__namespace.forwardRef(({className:t,...e},n)=>jsxRuntime.jsx(Cancel,{ref:n,className:cn(buttonVariants({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));AlertDialogCancel.displayName=Cancel.displayName;function PageHeader({title:t,children:e,className:n}){return jsxRuntime.jsxs("div",{className:"relative pb-4",children:[jsxRuntime.jsx("div",{className:"absolute top-0 left-0 w-full h-24 bg-sidebar z-[-20]"}),jsxRuntime.jsxs("div",{className:cn("relative container pt-6 flex justify-between",n),children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold text-sidebar-foreground inline",children:t}),e]})]})}function OrderedMap(t){this.content=t}OrderedMap.prototype={constructor:OrderedMap,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,l=o.find(t),d=o.content.slice();return l==-1?d.push(n||t,e):(d[l+1]=e,n&&(d[l]=n)),new OrderedMap(d)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new OrderedMap(n)},addToStart:function(t,e){return new OrderedMap([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new OrderedMap(n)},addBefore:function(t,e,n){var o=this.remove(e),l=o.content.slice(),d=o.find(t);return l.splice(d==-1?l.length:d,0,e,n),new OrderedMap(l)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=OrderedMap.from(t),t.size?new OrderedMap(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=OrderedMap.from(t),t.size?new OrderedMap(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=OrderedMap.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},OrderedMap.from=function(t){if(t instanceof OrderedMap)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new OrderedMap(e)};function findDiffStart(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let l=t.child(o),d=e.child(o);if(l==d){n+=l.nodeSize;continue}if(!l.sameMarkup(d))return n;if(l.isText&&l.text!=d.text){for(let f=0;l.text[f]==d.text[f];f++)n++;return n}if(l.content.size||d.content.size){let f=findDiffStart(l.content,d.content,n+1);if(f!=null)return f}n+=l.nodeSize}}function findDiffEnd(t,e,n,o){for(let l=t.childCount,d=e.childCount;;){if(l==0||d==0)return l==d?null:{a:n,b:o};let f=t.child(--l),g=e.child(--d),b=f.nodeSize;if(f==g){n-=b,o-=b;continue}if(!f.sameMarkup(g))return{a:n,b:o};if(f.isText&&f.text!=g.text){let _=0,S=Math.min(f.text.length,g.text.length);for(;_<S&&f.text[f.text.length-_-1]==g.text[g.text.length-_-1];)_++,n--,o--;return{a:n,b:o}}if(f.content.size||g.content.size){let _=findDiffEnd(f.content,g.content,n-1,o-1);if(_)return _}n-=b,o-=b}}class Fragment{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,l=0,d){for(let f=0,g=0;g<n;f++){let b=this.content[f],_=g+b.nodeSize;if(_>e&&o(b,l+g,d||null,f)!==!1&&b.content.size){let S=g+1;b.nodesBetween(Math.max(0,e-S),Math.min(b.content.size,n-S),o,l+S)}g=_}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,l){let d="",f=!0;return this.nodesBetween(e,n,(g,b)=>{let _=g.isText?g.text.slice(Math.max(e,b)-b,n-b):g.isLeaf?l?typeof l=="function"?l(g):l:g.type.spec.leafText?g.type.spec.leafText(g):"":"";g.isBlock&&(g.isLeaf&&_||g.isTextblock)&&o&&(f?f=!1:d+=o),d+=_},0),d}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,l=this.content.slice(),d=0;for(n.isText&&n.sameMarkup(o)&&(l[l.length-1]=n.withText(n.text+o.text),d=1);d<e.content.length;d++)l.push(e.content[d]);return new Fragment(l,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],l=0;if(n>e)for(let d=0,f=0;f<n;d++){let g=this.content[d],b=f+g.nodeSize;b>e&&((f<e||b>n)&&(g.isText?g=g.cut(Math.max(0,e-f),Math.min(g.text.length,n-f)):g=g.cut(Math.max(0,e-f-1),Math.min(g.content.size,n-f-1))),o.push(g),l+=g.nodeSize),f=b}return new Fragment(o,l)}cutByIndex(e,n){return e==n?Fragment.empty:e==0&&n==this.content.length?this:new Fragment(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let l=this.content.slice(),d=this.size+n.nodeSize-o.nodeSize;return l[e]=n,new Fragment(l,d)}addToStart(e){return new Fragment([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Fragment(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let l=this.content[n];e(l,o,n),o+=l.nodeSize}}findDiffStart(e,n=0){return findDiffStart(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return findDiffEnd(this,e,n,o)}findIndex(e,n=-1){if(e==0)return retIndex(0,e);if(e==this.size)return retIndex(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let o=0,l=0;;o++){let d=this.child(o),f=l+d.nodeSize;if(f>=e)return f==e||n>0?retIndex(o+1,f):retIndex(o,l);l=f}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return Fragment.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fragment(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Fragment.empty;let n,o=0;for(let l=0;l<e.length;l++){let d=e[l];o+=d.nodeSize,l&&d.isText&&e[l-1].sameMarkup(d)?(n||(n=e.slice(0,l)),n[n.length-1]=d.withText(n[n.length-1].text+d.text)):n&&n.push(d)}return new Fragment(n||e,o)}static from(e){if(!e)return Fragment.empty;if(e instanceof Fragment)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Fragment([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fragment.empty=new Fragment([],0);const found={index:0,offset:0};function retIndex(t,e){return found.index=t,found.offset=e,found}function compareDeep(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!compareDeep(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!compareDeep(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let Mark$1=class xn{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let l=0;l<e.length;l++){let d=e[l];if(this.eq(d))return e;if(this.type.excludes(d.type))n||(n=e.slice(0,l));else{if(d.type.excludes(this.type))return e;!o&&d.type.rank>this.type.rank&&(n||(n=e.slice(0,l)),n.push(this),o=!0),n&&n.push(d)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&compareDeep(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let l=o.create(n.attrs);return o.checkAttrs(l.attrs),l}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return xn.none;if(e instanceof xn)return[e];let n=e.slice();return n.sort((o,l)=>o.type.rank-l.type.rank),n}};Mark$1.none=[];class ReplaceError extends Error{}class Slice{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=insertInto(this.content,e+this.openStart,n);return o&&new Slice(o,this.openStart,this.openEnd)}removeBetween(e,n){return new Slice(removeRange(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return Slice.empty;let o=n.openStart||0,l=n.openEnd||0;if(typeof o!="number"||typeof l!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Slice(Fragment.fromJSON(e,n.content),o,l)}static maxOpen(e,n=!0){let o=0,l=0;for(let d=e.firstChild;d&&!d.isLeaf&&(n||!d.type.spec.isolating);d=d.firstChild)o++;for(let d=e.lastChild;d&&!d.isLeaf&&(n||!d.type.spec.isolating);d=d.lastChild)l++;return new Slice(e,o,l)}}Slice.empty=new Slice(Fragment.empty,0,0);function removeRange(t,e,n){let{index:o,offset:l}=t.findIndex(e),d=t.maybeChild(o),{index:f,offset:g}=t.findIndex(n);if(l==e||d.isText){if(g!=n&&!t.child(f).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=f)throw new RangeError("Removing non-flat range");return t.replaceChild(o,d.copy(removeRange(d.content,e-l-1,n-l-1)))}function insertInto(t,e,n,o){let{index:l,offset:d}=t.findIndex(e),f=t.maybeChild(l);if(d==e||f.isText)return t.cut(0,e).append(n).append(t.cut(e));let g=insertInto(f.content,e-d-1,n);return g&&t.replaceChild(l,f.copy(g))}function replace(t,e,n){if(n.openStart>t.depth)throw new ReplaceError("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter(t,e,n,0)}function replaceOuter(t,e,n,o){let l=t.index(o),d=t.node(o);if(l==e.index(o)&&o<t.depth-n.openStart){let f=replaceOuter(t,e,n,o+1);return d.copy(d.content.replaceChild(l,f))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let f=t.parent,g=f.content;return close(f,g.cut(0,t.parentOffset).append(n.content).append(g.cut(e.parentOffset)))}else{let{start:f,end:g}=prepareSliceForReplace(n,t);return close(d,replaceThreeWay(t,f,g,e,o))}else return close(d,replaceTwoWay(t,e,o))}function checkJoin(t,e){if(!e.type.compatibleContent(t.type))throw new ReplaceError("Cannot join "+e.type.name+" onto "+t.type.name)}function joinable$1(t,e,n){let o=t.node(n);return checkJoin(o,e.node(n)),o}function addNode(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function addRange(t,e,n,o){let l=(e||t).node(n),d=0,f=e?e.index(n):l.childCount;t&&(d=t.index(n),t.depth>n?d++:t.textOffset&&(addNode(t.nodeAfter,o),d++));for(let g=d;g<f;g++)addNode(l.child(g),o);e&&e.depth==n&&e.textOffset&&addNode(e.nodeBefore,o)}function close(t,e){return t.type.checkContent(e),t.copy(e)}function replaceThreeWay(t,e,n,o,l){let d=t.depth>l&&joinable$1(t,e,l+1),f=o.depth>l&&joinable$1(n,o,l+1),g=[];return addRange(null,t,l,g),d&&f&&e.index(l)==n.index(l)?(checkJoin(d,f),addNode(close(d,replaceThreeWay(t,e,n,o,l+1)),g)):(d&&addNode(close(d,replaceTwoWay(t,e,l+1)),g),addRange(e,n,l,g),f&&addNode(close(f,replaceTwoWay(n,o,l+1)),g)),addRange(o,null,l,g),new Fragment(g)}function replaceTwoWay(t,e,n){let o=[];if(addRange(null,t,n,o),t.depth>n){let l=joinable$1(t,e,n+1);addNode(close(l,replaceTwoWay(t,e,n+1)),o)}return addRange(e,null,n,o),new Fragment(o)}function prepareSliceForReplace(t,e){let n=e.depth-t.openStart,l=e.node(n).copy(t.content);for(let d=n-1;d>=0;d--)l=e.node(d).copy(Fragment.from(l));return{start:l.resolveNoCache(t.openStart+n),end:l.resolveNoCache(l.content.size-t.openEnd-n)}}class ResolvedPos{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],l=e.child(n);return o?e.child(n).cut(o):l}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],l=n==0?0:this.path[n*3-1]+1;for(let d=0;d<e;d++)l+=o.child(d).nodeSize;return l}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Mark$1.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),l=e.maybeChild(n);if(!o){let g=o;o=l,l=g}let d=o.marks;for(var f=0;f<d.length;f++)d[f].type.spec.inclusive===!1&&(!l||!d[f].isInSet(l.marks))&&(d=d[f--].removeFromSet(d));return d}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,l=e.parent.maybeChild(e.index());for(var d=0;d<o.length;d++)o[d].type.spec.inclusive===!1&&(!l||!o[d].isInSet(l.marks))&&(o=o[d--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new NodeRange(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],l=0,d=n;for(let f=e;;){let{index:g,offset:b}=f.content.findIndex(d),_=d-b;if(o.push(f,g,l+b),!_||(f=f.child(g),f.isText))break;d=_-1,l+=b+1}return new ResolvedPos(n,o,d)}static resolveCached(e,n){let o=resolveCache.get(e);if(o)for(let d=0;d<o.elts.length;d++){let f=o.elts[d];if(f.pos==n)return f}else resolveCache.set(e,o=new ResolveCache);let l=o.elts[o.i]=ResolvedPos.resolve(e,n);return o.i=(o.i+1)%resolveCacheSize,l}}class ResolveCache{constructor(){this.elts=[],this.i=0}}const resolveCacheSize=12,resolveCache=new WeakMap;class NodeRange{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const emptyAttrs=Object.create(null);let Node$2=class bn{constructor(e,n,o,l=Mark$1.none){this.type=e,this.attrs=n,this.marks=l,this.content=o||Fragment.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,l=0){this.content.nodesBetween(e,n,o,l,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,l){return this.content.textBetween(e,n,o,l)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&compareDeep(this.attrs,n||e.defaultAttrs||emptyAttrs)&&Mark$1.sameSet(this.marks,o||Mark$1.none)}copy(e=null){return e==this.content?this:new bn(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new bn(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return Slice.empty;let l=this.resolve(e),d=this.resolve(n),f=o?0:l.sharedDepth(n),g=l.start(f),_=l.node(f).content.cut(l.pos-g,d.pos-g);return new Slice(_,l.depth-f,d.depth-f)}replace(e,n,o){return replace(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:l}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(l==e||n.isText)return n;e-=l+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let l=this.content.child(n-1);return{node:l,index:n-1,offset:o-l.nodeSize}}resolve(e){return ResolvedPos.resolveCached(this,e)}resolveNoCache(e){return ResolvedPos.resolve(this,e)}rangeHasMark(e,n,o){let l=!1;return n>e&&this.nodesBetween(e,n,d=>(o.isInSet(d.marks)&&(l=!0),!l)),l}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=Fragment.empty,l=0,d=o.childCount){let f=this.contentMatchAt(e).matchFragment(o,l,d),g=f&&f.matchFragment(this.content,n);if(!g||!g.validEnd)return!1;for(let b=l;b<d;b++)if(!this.type.allowsMarks(o.child(b).marks))return!1;return!0}canReplaceWith(e,n,o,l){if(l&&!this.type.allowsMarks(l))return!1;let d=this.contentMatchAt(e).matchType(o),f=d&&d.matchFragment(this.content,n);return f?f.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Mark$1.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Mark$1.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let l=Fragment.fromJSON(e,n.content),d=e.nodeType(n.type).create(n.attrs,l,o);return d.type.checkAttrs(d.attrs),d}};Node$2.prototype.text=void 0;class TextNode extends Node$2{constructor(e,n,o,l){if(super(e,n,null,l),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new TextNode(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new TextNode(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function wrapMarks(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ContentMatch{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new TokenStream(e,n);if(o.next==null)return ContentMatch.empty;let l=parseExpr(o);o.next&&o.err("Unexpected trailing text");let d=dfa(nfa(l));return checkForDeadEnds(d,o),d}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let l=this;for(let d=n;l&&d<o;d++)l=l.matchType(e.child(d).type);return l}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let l=[this];function d(f,g){let b=f.matchFragment(e,o);if(b&&(!n||b.validEnd))return Fragment.from(g.map(_=>_.createAndFill()));for(let _=0;_<f.next.length;_++){let{type:S,next:R}=f.next[_];if(!(S.isText||S.hasRequiredAttrs())&&l.indexOf(R)==-1){l.push(R);let C=d(R,g.concat(S));if(C)return C}}return null}return d(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let l=o.shift(),d=l.match;if(d.matchType(e)){let f=[];for(let g=l;g.type;g=g.via)f.push(g.type);return f.reverse()}for(let f=0;f<d.next.length;f++){let{type:g,next:b}=d.next[f];!g.isLeaf&&!g.hasRequiredAttrs()&&!(g.name in n)&&(!l.type||b.validEnd)&&(o.push({match:g.contentMatch,type:g,via:l}),n[g.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let l=0;l<o.next.length;l++)e.indexOf(o.next[l].next)==-1&&n(o.next[l].next)}return n(this),e.map((o,l)=>{let d=l+(o.validEnd?"*":" ")+" ";for(let f=0;f<o.next.length;f++)d+=(f?", ":"")+o.next[f].type.name+"->"+e.indexOf(o.next[f].next);return d}).join(`
|
|
1140
|
+
`)}}ContentMatch.empty=new ContentMatch(!0);class TokenStream{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function parseExpr(t){let e=[];do e.push(parseExprSeq(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function parseExprSeq(t){let e=[];do e.push(parseExprSubscript(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function parseExprSubscript(t){let e=parseExprAtom(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=parseExprRange(t,e);else break;return e}function parseNum(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function parseExprRange(t,e){let n=parseNum(t),o=n;return t.eat(",")&&(t.next!="}"?o=parseNum(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function resolveName(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let l=[];for(let d in n){let f=n[d];f.isInGroup(e)&&l.push(f)}return l.length==0&&t.err("No node type or group '"+e+"' found"),l}function parseExprAtom(t){if(t.eat("(")){let e=parseExpr(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=resolveName(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function nfa(t){let e=[[]];return l(d(t,0),n()),e;function n(){return e.push([])-1}function o(f,g,b){let _={term:b,to:g};return e[f].push(_),_}function l(f,g){f.forEach(b=>b.to=g)}function d(f,g){if(f.type=="choice")return f.exprs.reduce((b,_)=>b.concat(d(_,g)),[]);if(f.type=="seq")for(let b=0;;b++){let _=d(f.exprs[b],g);if(b==f.exprs.length-1)return _;l(_,g=n())}else if(f.type=="star"){let b=n();return o(g,b),l(d(f.expr,b),b),[o(b)]}else if(f.type=="plus"){let b=n();return l(d(f.expr,g),b),l(d(f.expr,b),b),[o(b)]}else{if(f.type=="opt")return[o(g)].concat(d(f.expr,g));if(f.type=="range"){let b=g;for(let _=0;_<f.min;_++){let S=n();l(d(f.expr,b),S),b=S}if(f.max==-1)l(d(f.expr,b),b);else for(let _=f.min;_<f.max;_++){let S=n();o(b,S),l(d(f.expr,b),S),b=S}return[o(b)]}else{if(f.type=="name")return[o(g,void 0,f.value)];throw new Error("Unknown expr type")}}}}function cmp(t,e){return e-t}function nullFrom(t,e){let n=[];return o(e),n.sort(cmp);function o(l){let d=t[l];if(d.length==1&&!d[0].term)return o(d[0].to);n.push(l);for(let f=0;f<d.length;f++){let{term:g,to:b}=d[f];!g&&n.indexOf(b)==-1&&o(b)}}}function dfa(t){let e=Object.create(null);return n(nullFrom(t,0));function n(o){let l=[];o.forEach(f=>{t[f].forEach(({term:g,to:b})=>{if(!g)return;let _;for(let S=0;S<l.length;S++)l[S][0]==g&&(_=l[S][1]);nullFrom(t,b).forEach(S=>{_||l.push([g,_=[]]),_.indexOf(S)==-1&&_.push(S)})})});let d=e[o.join(",")]=new ContentMatch(o.indexOf(t.length-1)>-1);for(let f=0;f<l.length;f++){let g=l[f][1].sort(cmp);d.next.push({type:l[f][0],next:e[g.join(",")]||n(g)})}return d}}function checkForDeadEnds(t,e){for(let n=0,o=[t];n<o.length;n++){let l=o[n],d=!l.validEnd,f=[];for(let g=0;g<l.next.length;g++){let{type:b,next:_}=l.next[g];f.push(b.name),d&&!(b.isText||b.hasRequiredAttrs())&&(d=!1),o.indexOf(_)==-1&&o.push(_)}d&&e.err("Only non-generatable nodes ("+f.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function defaultAttrs(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function computeAttrs(t,e){let n=Object.create(null);for(let o in t){let l=e&&e[o];if(l===void 0){let d=t[o];if(d.hasDefault)l=d.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=l}return n}function checkAttrs(t,e,n,o){for(let l in e)if(!(l in t))throw new RangeError(`Unsupported attribute ${l} for ${n} of type ${l}`);for(let l in t){let d=t[l];d.validate&&d.validate(e[l])}}function initAttrs(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new Attribute(t,o,e[o]);return n}let NodeType$1=class jn{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=initAttrs(e,o.attrs),this.defaultAttrs=defaultAttrs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ContentMatch.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:computeAttrs(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Node$2(this,this.computeAttrs(e),Fragment.from(n),Mark$1.setFrom(o))}createChecked(e=null,n,o){return n=Fragment.from(n),this.checkContent(n),new Node$2(this,this.computeAttrs(e),n,Mark$1.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=Fragment.from(n),n.size){let f=this.contentMatch.fillBefore(n);if(!f)return null;n=f.append(n)}let l=this.contentMatch.matchFragment(n),d=l&&l.fillBefore(Fragment.empty,!0);return d?new Node$2(this,e,n.append(d),Mark$1.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){checkAttrs(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:Mark$1.none:e}static compile(e,n){let o=Object.create(null);e.forEach((d,f)=>o[d]=new jn(d,n,f));let l=n.spec.topNode||"doc";if(!o[l])throw new RangeError("Schema is missing its top node type ('"+l+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let d in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function validateType(t,e,n){let o=n.split("|");return l=>{let d=l===null?"null":typeof l;if(o.indexOf(d)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${d}`)}}class Attribute{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?validateType(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class MarkType{constructor(e,n,o,l){this.name=e,this.rank=n,this.schema=o,this.spec=l,this.attrs=initAttrs(e,l.attrs),this.excluded=null;let d=defaultAttrs(this.attrs);this.instance=d?new Mark$1(this,d):null}create(e=null){return!e&&this.instance?this.instance:new Mark$1(this,computeAttrs(this.attrs,e))}static compile(e,n){let o=Object.create(null),l=0;return e.forEach((d,f)=>o[d]=new MarkType(d,l++,n,f)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){checkAttrs(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Schema{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let l in e)n[l]=e[l];n.nodes=OrderedMap.from(e.nodes),n.marks=OrderedMap.from(e.marks||{}),this.nodes=NodeType$1.compile(this.spec.nodes,this),this.marks=MarkType.compile(this.spec.marks,this);let o=Object.create(null);for(let l in this.nodes){if(l in this.marks)throw new RangeError(l+" can not be both a node and a mark");let d=this.nodes[l],f=d.spec.content||"",g=d.spec.marks;if(d.contentMatch=o[f]||(o[f]=ContentMatch.parse(f,this.nodes)),d.inlineContent=d.contentMatch.inlineContent,d.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!d.isInline||!d.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=d}d.markSet=g=="_"?null:g?gatherMarks(this,g.split(" ")):g==""||!d.inlineContent?[]:null}for(let l in this.marks){let d=this.marks[l],f=d.spec.excludes;d.excluded=f==null?[d]:f==""?[]:gatherMarks(this,f.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,l){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof NodeType$1){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,l)}text(e,n){let o=this.nodes.text;return new TextNode(o,o.defaultAttrs,e,Mark$1.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Node$2.fromJSON(this,e)}markFromJSON(e){return Mark$1.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function gatherMarks(t,e){let n=[];for(let o=0;o<e.length;o++){let l=e[o],d=t.marks[l],f=d;if(d)n.push(d);else for(let g in t.marks){let b=t.marks[g];(l=="_"||b.spec.group&&b.spec.group.split(" ").indexOf(l)>-1)&&n.push(f=b)}if(!f)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function isTagRule(t){return t.tag!=null}function isStyleRule(t){return t.style!=null}let DOMParser$1=class _n{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(l=>{if(isTagRule(l))this.tags.push(l);else if(isStyleRule(l)){let d=/[^=]*/.exec(l.style)[0];o.indexOf(d)<0&&o.push(d),this.styles.push(l)}}),this.normalizeLists=!this.tags.some(l=>{if(!/^(ul|ol)\b/.test(l.tag)||!l.node)return!1;let d=e.nodes[l.node];return d.contentMatch.matchType(d)})}parse(e,n={}){let o=new ParseContext(this,n,!1);return o.addAll(e,Mark$1.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new ParseContext(this,n,!0);return o.addAll(e,Mark$1.none,n.from,n.to),Slice.maxOpen(o.finish())}matchTag(e,n,o){for(let l=o?this.tags.indexOf(o)+1:0;l<this.tags.length;l++){let d=this.tags[l];if(matches(e,d.tag)&&(d.namespace===void 0||e.namespaceURI==d.namespace)&&(!d.context||n.matchesContext(d.context))){if(d.getAttrs){let f=d.getAttrs(e);if(f===!1)continue;d.attrs=f||void 0}return d}}}matchStyle(e,n,o,l){for(let d=l?this.styles.indexOf(l)+1:0;d<this.styles.length;d++){let f=this.styles[d],g=f.style;if(!(g.indexOf(e)!=0||f.context&&!o.matchesContext(f.context)||g.length>e.length&&(g.charCodeAt(e.length)!=61||g.slice(e.length+1)!=n))){if(f.getAttrs){let b=f.getAttrs(n);if(b===!1)continue;f.attrs=b||void 0}return f}}}static schemaRules(e){let n=[];function o(l){let d=l.priority==null?50:l.priority,f=0;for(;f<n.length;f++){let g=n[f];if((g.priority==null?50:g.priority)<d)break}n.splice(f,0,l)}for(let l in e.marks){let d=e.marks[l].spec.parseDOM;d&&d.forEach(f=>{o(f=copy(f)),f.mark||f.ignore||f.clearMark||(f.mark=l)})}for(let l in e.nodes){let d=e.nodes[l].spec.parseDOM;d&&d.forEach(f=>{o(f=copy(f)),f.node||f.ignore||f.mark||(f.node=l)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new _n(e,_n.schemaRules(e)))}};const blockTags={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ignoreTags={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},listTags={ol:!0,ul:!0},OPT_PRESERVE_WS=1,OPT_PRESERVE_WS_FULL=2,OPT_OPEN_LEFT=4;function wsOptionsFor(t,e,n){return e!=null?(e?OPT_PRESERVE_WS:0)|(e==="full"?OPT_PRESERVE_WS_FULL:0):t&&t.whitespace=="pre"?OPT_PRESERVE_WS|OPT_PRESERVE_WS_FULL:n&~OPT_OPEN_LEFT}class NodeContext{constructor(e,n,o,l,d,f){this.type=e,this.attrs=n,this.marks=o,this.solid=l,this.options=f,this.content=[],this.activeMarks=Mark$1.none,this.match=d||(f&OPT_OPEN_LEFT?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Fragment.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,l;return(l=o.findWrapping(e.type))?(this.match=o,l):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&OPT_PRESERVE_WS)){let o=this.content[this.content.length-1],l;if(o&&o.isText&&(l=/[ \t\r\n\u000c]+$/.exec(o.text))){let d=o;o.text.length==l[0].length?this.content.pop():this.content[this.content.length-1]=d.withText(d.text.slice(0,d.text.length-l[0].length))}}let n=Fragment.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(Fragment.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!blockTags.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ParseContext{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let l=n.topNode,d,f=wsOptionsFor(null,n.preserveWhitespace,0)|(o?OPT_OPEN_LEFT:0);l?d=new NodeContext(l.type,l.attrs,Mark$1.none,!0,n.topMatch||l.type.contentMatch,f):o?d=new NodeContext(null,null,Mark$1.none,!0,null,f):d=new NodeContext(e.schema.topNodeType,null,Mark$1.none,!0,null,f),this.nodes=[d],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,l=this.top,d=l.options&OPT_PRESERVE_WS_FULL?"full":this.localPreserveWS||(l.options&OPT_PRESERVE_WS)>0;if(d==="full"||l.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(d)d!=="full"?o=o.replace(/\r?\n|\r/g," "):o=o.replace(/\r\n?/g,`
|
|
1141
1141
|
`);else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let f=l.content[l.content.length-1],g=e.previousSibling;(!f||g&&g.nodeName=="BR"||f.isText&&/[ \t\r\n\u000c]$/.test(f.text))&&(o=o.slice(1))}o&&this.insertNode(this.parser.schema.text(o),n,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let l=this.localPreserveWS,d=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let f=e.nodeName.toLowerCase(),g;listTags.hasOwnProperty(f)&&this.parser.normalizeLists&&normalizeList(e);let b=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(g=this.parser.matchTag(e,this,o));e:if(b?b.ignore:ignoreTags.hasOwnProperty(f))this.findInside(e),this.ignoreFallback(e,n);else if(!b||b.skip||b.closeParent){b&&b.closeParent?this.open=Math.max(0,this.open-1):b&&b.skip.nodeType&&(e=b.skip);let _,S=this.needsBlock;if(blockTags.hasOwnProperty(f))d.content.length&&d.content[0].isInline&&this.open&&(this.open--,d=this.top),_=!0,d.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let R=b&&b.skip?n:this.readStyles(e,n);R&&this.addAll(e,R),_&&this.sync(d),this.needsBlock=S}else{let _=this.readStyles(e,n);_&&this.addElementByRule(e,b,_,b.consuming===!1?g:void 0)}this.localPreserveWS=l}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
1142
1142
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let l=0;l<this.parser.matchedStyles.length;l++){let d=this.parser.matchedStyles[l],f=o.getPropertyValue(d);if(f)for(let g=void 0;;){let b=this.parser.matchStyle(d,f,this,g);if(!b)break;if(b.ignore)return null;if(b.clearMark?n=n.filter(_=>!b.clearMark(_)):n=n.concat(this.parser.schema.marks[b.mark].create(b.attrs)),b.consuming===!1)g=b;else break}}return n}addElementByRule(e,n,o,l){let d,f;if(n.node)if(f=this.parser.schema.nodes[n.node],f.isLeaf)this.insertNode(f.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let b=this.enter(f,n.attrs||null,o,n.preserveWhitespace);b&&(d=!0,o=b)}else{let b=this.parser.schema.marks[n.mark];o=o.concat(b.create(n.attrs))}let g=this.top;if(f&&f.isLeaf)this.findInside(e);else if(l)this.addElement(e,o,l);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(b=>this.insertNode(b,o,!1));else{let b=e;typeof n.contentElement=="string"?b=e.querySelector(n.contentElement):typeof n.contentElement=="function"?b=n.contentElement(e):n.contentElement&&(b=n.contentElement),this.findAround(e,b,!0),this.addAll(b,o),this.findAround(e,b,!1)}d&&this.sync(g)&&this.open--}addAll(e,n,o,l){let d=o||0;for(let f=o?e.childNodes[o]:e.firstChild,g=l==null?null:e.childNodes[l];f!=g;f=f.nextSibling,++d)this.findAtPoint(e,d),this.addDOM(f,n);this.findAtPoint(e,d)}findPlace(e,n,o){let l,d;for(let f=this.open,g=0;f>=0;f--){let b=this.nodes[f],_=b.findWrapping(e);if(_&&(!l||l.length>_.length+g)&&(l=_,d=b,!_.length))break;if(b.solid){if(o)break;g+=2}}if(!l)return null;this.sync(d);for(let f=0;f<l.length;f++)n=this.enterInner(l[f],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let d=this.textblockFromContext();d&&(n=this.enterInner(d,null,n))}let l=this.findPlace(e,n,o);if(l){this.closeExtra();let d=this.top;d.match&&(d.match=d.match.matchType(e.type));let f=Mark$1.none;for(let g of l.concat(e.marks))(d.type?d.type.allowsMarkType(g.type):markMayApply(g.type,e.type))&&(f=g.addToSet(f));return d.content.push(e.mark(f)),!0}return!1}enter(e,n,o,l){let d=this.findPlace(e.create(n),o,!1);return d&&(d=this.enterInner(e,n,o,!0,l)),d}enterInner(e,n,o,l=!1,d){this.closeExtra();let f=this.top;f.match=f.match&&f.match.matchType(e);let g=wsOptionsFor(e,d,f.options);f.options&OPT_OPEN_LEFT&&f.content.length==0&&(g|=OPT_OPEN_LEFT);let b=Mark$1.none;return o=o.filter(_=>(f.type?f.type.allowsMarkType(_.type):markMayApply(_.type,e))?(b=_.addToSet(b),!1):!0),this.nodes.push(new NodeContext(e,n,b,l,null,g)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=OPT_PRESERVE_WS)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let l=o.length-1;l>=0;l--)e+=o[l].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let l=0;l<this.find.length;l++)this.find[l].pos==null&&e.nodeType==1&&e.contains(this.find[l].node)&&n.compareDocumentPosition(this.find[l].node)&(o?2:4)&&(this.find[l].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,l=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),d=-(o?o.depth+1:0)+(l?0:1),f=(g,b)=>{for(;g>=0;g--){let _=n[g];if(_==""){if(g==n.length-1||g==0)continue;for(;b>=d;b--)if(f(g-1,b))return!0;return!1}else{let S=b>0||b==0&&l?this.nodes[b].type:o&&b>=d?o.node(b-d).type:null;if(!S||S.name!=_&&!S.isInGroup(_))return!1;b--}}return!0};return f(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function normalizeList(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&listTags.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function matches(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function copy(t){let e={};for(let n in t)e[n]=t[n];return e}function markMayApply(t,e){let n=e.schema.nodes;for(let o in n){let l=n[o];if(!l.allowsMarkType(t))continue;let d=[],f=g=>{d.push(g);for(let b=0;b<g.edgeCount;b++){let{type:_,next:S}=g.edge(b);if(_==e||d.indexOf(S)<0&&f(S))return!0}};if(f(l.contentMatch))return!0}}class DOMSerializer{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=doc$1(n).createDocumentFragment());let l=o,d=[];return e.forEach(f=>{if(d.length||f.marks.length){let g=0,b=0;for(;g<d.length&&b<f.marks.length;){let _=f.marks[b];if(!this.marks[_.type.name]){b++;continue}if(!_.eq(d[g][0])||_.type.spec.spanning===!1)break;g++,b++}for(;g<d.length;)l=d.pop()[1];for(;b<f.marks.length;){let _=f.marks[b++],S=this.serializeMark(_,f.isInline,n);S&&(d.push([_,l]),l.appendChild(S.dom),l=S.contentDOM||S.dom)}}l.appendChild(this.serializeNodeInner(f,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:l}=renderSpec(doc$1(n),this.nodes[e.type.name](e),null,e.attrs);if(l){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,l)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let l=e.marks.length-1;l>=0;l--){let d=this.serializeMark(e.marks[l],e.isInline,n);d&&((d.contentDOM||d.dom).appendChild(o),o=d.dom)}return o}serializeMark(e,n,o={}){let l=this.marks[e.type.name];return l&&renderSpec(doc$1(o),l(e,n),null,e.attrs)}static renderSpec(e,n,o=null,l){return renderSpec(e,n,o,l)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new DOMSerializer(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=gatherToDOM(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return gatherToDOM(e.marks)}}function gatherToDOM(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function doc$1(t){return t.document||window.document}const suspiciousAttributeCache=new WeakMap;function suspiciousAttributes(t){let e=suspiciousAttributeCache.get(t);return e===void 0&&suspiciousAttributeCache.set(t,e=suspiciousAttributesInner(t)),e}function suspiciousAttributesInner(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let l=0;l<o.length;l++)n(o[l]);else for(let l in o)n(o[l])}return n(t),e}function renderSpec(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let l=e[0],d;if(typeof l!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(d=suspiciousAttributes(o))&&d.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let f=l.indexOf(" ");f>0&&(n=l.slice(0,f),l=l.slice(f+1));let g,b=n?t.createElementNS(n,l):t.createElement(l),_=e[1],S=1;if(_&&typeof _=="object"&&_.nodeType==null&&!Array.isArray(_)){S=2;for(let R in _)if(_[R]!=null){let C=R.indexOf(" ");C>0?b.setAttributeNS(R.slice(0,C),R.slice(C+1),_[R]):b.setAttribute(R,_[R])}}for(let R=S;R<e.length;R++){let C=e[R];if(C===0){if(R<e.length-1||R>S)throw new RangeError("Content hole must be the only child of its parent node");return{dom:b,contentDOM:b}}else{let{dom:E,contentDOM:A}=renderSpec(t,C,n,o);if(b.appendChild(E),A){if(g)throw new RangeError("Multiple content holes");g=A}}}return{dom:b,contentDOM:g}}const lower16=65535,factor16=Math.pow(2,16);function makeRecover(t,e){return t+e*factor16}function recoverIndex(t){return t&lower16}function recoverOffset(t){return(t-(t&lower16))/factor16}const DEL_BEFORE=1,DEL_AFTER=2,DEL_ACROSS=4,DEL_SIDE=8;class MapResult{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&DEL_SIDE)>0}get deletedBefore(){return(this.delInfo&(DEL_BEFORE|DEL_ACROSS))>0}get deletedAfter(){return(this.delInfo&(DEL_AFTER|DEL_ACROSS))>0}get deletedAcross(){return(this.delInfo&DEL_ACROSS)>0}}class StepMap{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&StepMap.empty)return StepMap.empty}recover(e){let n=0,o=recoverIndex(e);if(!this.inverted)for(let l=0;l<o;l++)n+=this.ranges[l*3+2]-this.ranges[l*3+1];return this.ranges[o*3]+n+recoverOffset(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let l=0,d=this.inverted?2:1,f=this.inverted?1:2;for(let g=0;g<this.ranges.length;g+=3){let b=this.ranges[g]-(this.inverted?l:0);if(b>e)break;let _=this.ranges[g+d],S=this.ranges[g+f],R=b+_;if(e<=R){let C=_?e==b?-1:e==R?1:n:n,E=b+l+(C<0?0:S);if(o)return E;let A=e==(n<0?b:R)?null:makeRecover(g/3,e-b),I=e==b?DEL_AFTER:e==R?DEL_BEFORE:DEL_ACROSS;return(n<0?e!=b:e!=R)&&(I|=DEL_SIDE),new MapResult(E,I,A)}l+=S-_}return o?e+l:new MapResult(e+l,0,null)}touches(e,n){let o=0,l=recoverIndex(n),d=this.inverted?2:1,f=this.inverted?1:2;for(let g=0;g<this.ranges.length;g+=3){let b=this.ranges[g]-(this.inverted?o:0);if(b>e)break;let _=this.ranges[g+d],S=b+_;if(e<=S&&g==l*3)return!0;o+=this.ranges[g+f]-_}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let l=0,d=0;l<this.ranges.length;l+=3){let f=this.ranges[l],g=f-(this.inverted?d:0),b=f+(this.inverted?0:d),_=this.ranges[l+n],S=this.ranges[l+o];e(g,g+_,b,b+S),d+=S-_}}invert(){return new StepMap(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?StepMap.empty:new StepMap(e<0?[0,-e,0]:[0,0,e])}}StepMap.empty=new StepMap([]);class Mapping{constructor(e,n,o=0,l=e?e.length:0){this.mirror=n,this.from=o,this.to=l,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Mapping(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let l=e.getMirror(n);this.appendMap(e._maps[n],l!=null&&l<n?o+l:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let l=e.getMirror(n);this.appendMap(e._maps[n].invert(),l!=null&&l>n?o-l-1:void 0)}}invert(){let e=new Mapping;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let l=0;for(let d=this.from;d<this.to;d++){let f=this._maps[d],g=f.mapResult(e,n);if(g.recover!=null){let b=this.getMirror(d);if(b!=null&&b>d&&b<this.to){d=b,e=this._maps[b].recover(g.recover);continue}}l|=g.delInfo,e=g.pos}return o?e:new MapResult(e,l,null)}}const stepsByID=Object.create(null);class Step{getMap(){return StepMap.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=stepsByID[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in stepsByID)throw new RangeError("Duplicate use of step JSON ID "+e);return stepsByID[e]=n,n.prototype.jsonID=e,n}}class StepResult{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new StepResult(e,null)}static fail(e){return new StepResult(null,e)}static fromReplace(e,n,o,l){try{return StepResult.ok(e.replace(n,o,l))}catch(d){if(d instanceof ReplaceError)return StepResult.fail(d.message);throw d}}}function mapFragment(t,e,n){let o=[];for(let l=0;l<t.childCount;l++){let d=t.child(l);d.content.size&&(d=d.copy(mapFragment(d.content,e,d))),d.isInline&&(d=e(d,n,l)),o.push(d)}return Fragment.fromArray(o)}class AddMarkStep extends Step{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),l=o.node(o.sharedDepth(this.to)),d=new Slice(mapFragment(n.content,(f,g)=>!f.isAtom||!g.type.allowsMarkType(this.mark.type)?f:f.mark(this.mark.addToSet(f.marks)),l),n.openStart,n.openEnd);return StepResult.fromReplace(e,this.from,this.to,d)}invert(){return new RemoveMarkStep(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new AddMarkStep(n.pos,o.pos,this.mark)}merge(e){return e instanceof AddMarkStep&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new AddMarkStep(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new AddMarkStep(n.from,n.to,e.markFromJSON(n.mark))}}Step.jsonID("addMark",AddMarkStep);class RemoveMarkStep extends Step{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new Slice(mapFragment(n.content,l=>l.mark(this.mark.removeFromSet(l.marks)),e),n.openStart,n.openEnd);return StepResult.fromReplace(e,this.from,this.to,o)}invert(){return new AddMarkStep(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new RemoveMarkStep(n.pos,o.pos,this.mark)}merge(e){return e instanceof RemoveMarkStep&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new RemoveMarkStep(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new RemoveMarkStep(n.from,n.to,e.markFromJSON(n.mark))}}Step.jsonID("removeMark",RemoveMarkStep);class AddNodeMarkStep extends Step{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return StepResult.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return StepResult.fromReplace(e,this.pos,this.pos+1,new Slice(Fragment.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let l=0;l<n.marks.length;l++)if(!n.marks[l].isInSet(o))return new AddNodeMarkStep(this.pos,n.marks[l]);return new AddNodeMarkStep(this.pos,this.mark)}}return new RemoveNodeMarkStep(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new AddNodeMarkStep(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new AddNodeMarkStep(n.pos,e.markFromJSON(n.mark))}}Step.jsonID("addNodeMark",AddNodeMarkStep);class RemoveNodeMarkStep extends Step{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return StepResult.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return StepResult.fromReplace(e,this.pos,this.pos+1,new Slice(Fragment.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new AddNodeMarkStep(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new RemoveNodeMarkStep(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new RemoveNodeMarkStep(n.pos,e.markFromJSON(n.mark))}}Step.jsonID("removeNodeMark",RemoveNodeMarkStep);class ReplaceStep extends Step{constructor(e,n,o,l=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=l}apply(e){return this.structure&&contentBetween(e,this.from,this.to)?StepResult.fail("Structure replace would overwrite content"):StepResult.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new StepMap([this.from,this.to-this.from,this.slice.size])}invert(e){return new ReplaceStep(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ReplaceStep(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ReplaceStep)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Slice.empty:new Slice(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ReplaceStep(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Slice.empty:new Slice(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ReplaceStep(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ReplaceStep(n.from,n.to,Slice.fromJSON(e,n.slice),!!n.structure)}}Step.jsonID("replace",ReplaceStep);class ReplaceAroundStep extends Step{constructor(e,n,o,l,d,f,g=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=l,this.slice=d,this.insert=f,this.structure=g}apply(e){if(this.structure&&(contentBetween(e,this.from,this.gapFrom)||contentBetween(e,this.gapTo,this.to)))return StepResult.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return StepResult.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?StepResult.fromReplace(e,this.from,this.to,o):StepResult.fail("Content does not fit in gap")}getMap(){return new StepMap([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new ReplaceAroundStep(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),l=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),d=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||l<n.pos||d>o.pos?null:new ReplaceAroundStep(n.pos,o.pos,l,d,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ReplaceAroundStep(n.from,n.to,n.gapFrom,n.gapTo,Slice.fromJSON(e,n.slice),n.insert,!!n.structure)}}Step.jsonID("replaceAround",ReplaceAroundStep);function contentBetween(t,e,n){let o=t.resolve(e),l=n-e,d=o.depth;for(;l>0&&d>0&&o.indexAfter(d)==o.node(d).childCount;)d--,l--;if(l>0){let f=o.node(d).maybeChild(o.indexAfter(d));for(;l>0;){if(!f||f.isLeaf)return!0;f=f.firstChild,l--}}return!1}function addMark(t,e,n,o){let l=[],d=[],f,g;t.doc.nodesBetween(e,n,(b,_,S)=>{if(!b.isInline)return;let R=b.marks;if(!o.isInSet(R)&&S.type.allowsMarkType(o.type)){let C=Math.max(_,e),E=Math.min(_+b.nodeSize,n),A=o.addToSet(R);for(let I=0;I<R.length;I++)R[I].isInSet(A)||(f&&f.to==C&&f.mark.eq(R[I])?f.to=E:l.push(f=new RemoveMarkStep(C,E,R[I])));g&&g.to==C?g.to=E:d.push(g=new AddMarkStep(C,E,o))}}),l.forEach(b=>t.step(b)),d.forEach(b=>t.step(b))}function removeMark(t,e,n,o){let l=[],d=0;t.doc.nodesBetween(e,n,(f,g)=>{if(!f.isInline)return;d++;let b=null;if(o instanceof MarkType){let _=f.marks,S;for(;S=o.isInSet(_);)(b||(b=[])).push(S),_=S.removeFromSet(_)}else o?o.isInSet(f.marks)&&(b=[o]):b=f.marks;if(b&&b.length){let _=Math.min(g+f.nodeSize,n);for(let S=0;S<b.length;S++){let R=b[S],C;for(let E=0;E<l.length;E++){let A=l[E];A.step==d-1&&R.eq(l[E].style)&&(C=A)}C?(C.to=_,C.step=d):l.push({style:R,from:Math.max(g,e),to:_,step:d})}}}),l.forEach(f=>t.step(new RemoveMarkStep(f.from,f.to,f.style)))}function clearIncompatible(t,e,n,o=n.contentMatch,l=!0){let d=t.doc.nodeAt(e),f=[],g=e+1;for(let b=0;b<d.childCount;b++){let _=d.child(b),S=g+_.nodeSize,R=o.matchType(_.type);if(!R)f.push(new ReplaceStep(g,S,Slice.empty));else{o=R;for(let C=0;C<_.marks.length;C++)n.allowsMarkType(_.marks[C].type)||t.step(new RemoveMarkStep(g,S,_.marks[C]));if(l&&_.isText&&n.whitespace!="pre"){let C,E=/\r?\n|\r/g,A;for(;C=E.exec(_.text);)A||(A=new Slice(Fragment.from(n.schema.text(" ",n.allowedMarks(_.marks))),0,0)),f.push(new ReplaceStep(g+C.index,g+C.index+C[0].length,A))}}g=S}if(!o.validEnd){let b=o.fillBefore(Fragment.empty,!0);t.replace(g,g,new Slice(b,0,0))}for(let b=f.length-1;b>=0;b--)t.step(f[b])}function canCut(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function liftTarget(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth;;--o){let l=t.$from.node(o),d=t.$from.index(o),f=t.$to.indexAfter(o);if(o<t.depth&&l.canReplace(d,f,n))return o;if(o==0||l.type.spec.isolating||!canCut(l,d,f))break}return null}function lift$2(t,e,n){let{$from:o,$to:l,depth:d}=e,f=o.before(d+1),g=l.after(d+1),b=f,_=g,S=Fragment.empty,R=0;for(let A=d,I=!1;A>n;A--)I||o.index(A)>0?(I=!0,S=Fragment.from(o.node(A).copy(S)),R++):b--;let C=Fragment.empty,E=0;for(let A=d,I=!1;A>n;A--)I||l.after(A+1)<l.end(A)?(I=!0,C=Fragment.from(l.node(A).copy(C)),E++):_++;t.step(new ReplaceAroundStep(b,_,f,g,new Slice(S.append(C),R,E),S.size-R,!0))}function findWrapping(t,e,n=null,o=t){let l=findWrappingOutside(t,e),d=l&&findWrappingInside(o,e);return d?l.map(withAttrs).concat({type:e,attrs:n}).concat(d.map(withAttrs)):null}function withAttrs(t){return{type:t,attrs:null}}function findWrappingOutside(t,e){let{parent:n,startIndex:o,endIndex:l}=t,d=n.contentMatchAt(o).findWrapping(e);if(!d)return null;let f=d.length?d[0]:e;return n.canReplaceWith(o,l,f)?d:null}function findWrappingInside(t,e){let{parent:n,startIndex:o,endIndex:l}=t,d=n.child(o),f=e.contentMatch.findWrapping(d.type);if(!f)return null;let b=(f.length?f[f.length-1]:e).contentMatch;for(let _=o;b&&_<l;_++)b=b.matchType(n.child(_).type);return!b||!b.validEnd?null:f}function wrap(t,e,n){let o=Fragment.empty;for(let f=n.length-1;f>=0;f--){if(o.size){let g=n[f].type.contentMatch.matchFragment(o);if(!g||!g.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=Fragment.from(n[f].type.create(n[f].attrs,o))}let l=e.start,d=e.end;t.step(new ReplaceAroundStep(l,d,l,d,new Slice(o,0,0),n.length,!0))}function setBlockType$1(t,e,n,o,l){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let d=t.steps.length;t.doc.nodesBetween(e,n,(f,g)=>{let b=typeof l=="function"?l(f):l;if(f.isTextblock&&!f.hasMarkup(o,b)&&canChangeType(t.doc,t.mapping.slice(d).map(g),o)){let _=null;if(o.schema.linebreakReplacement){let E=o.whitespace=="pre",A=!!o.contentMatch.matchType(o.schema.linebreakReplacement);E&&!A?_=!1:!E&&A&&(_=!0)}_===!1&&replaceLinebreaks(t,f,g,d),clearIncompatible(t,t.mapping.slice(d).map(g,1),o,void 0,_===null);let S=t.mapping.slice(d),R=S.map(g,1),C=S.map(g+f.nodeSize,1);return t.step(new ReplaceAroundStep(R,C,R+1,C-1,new Slice(Fragment.from(o.create(b,null,f.marks)),0,0),1,!0)),_===!0&&replaceNewlines(t,f,g,d),!1}})}function replaceNewlines(t,e,n,o){e.forEach((l,d)=>{if(l.isText){let f,g=/\r?\n|\r/g;for(;f=g.exec(l.text);){let b=t.mapping.slice(o).map(n+1+d+f.index);t.replaceWith(b,b+1,e.type.schema.linebreakReplacement.create())}}})}function replaceLinebreaks(t,e,n,o){e.forEach((l,d)=>{if(l.type==l.type.schema.linebreakReplacement){let f=t.mapping.slice(o).map(n+1+d);t.replaceWith(f,f+1,e.type.schema.text(`
|
|
1143
1143
|
`))}})}function canChangeType(t,e,n){let o=t.resolve(e),l=o.index();return o.parent.canReplaceWith(l,l+1,n)}function setNodeMarkup(t,e,n,o,l){let d=t.doc.nodeAt(e);if(!d)throw new RangeError("No node at given position");n||(n=d.type);let f=n.create(o,null,l||d.marks);if(d.isLeaf)return t.replaceWith(e,e+d.nodeSize,f);if(!n.validContent(d.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new ReplaceAroundStep(e,e+d.nodeSize,e+1,e+d.nodeSize-1,new Slice(Fragment.from(f),0,0),1,!0))}function canSplit(t,e,n=1,o){let l=t.resolve(e),d=l.depth-n,f=o&&o[o.length-1]||l.parent;if(d<0||l.parent.type.spec.isolating||!l.parent.canReplace(l.index(),l.parent.childCount)||!f.type.validContent(l.parent.content.cutByIndex(l.index(),l.parent.childCount)))return!1;for(let _=l.depth-1,S=n-2;_>d;_--,S--){let R=l.node(_),C=l.index(_);if(R.type.spec.isolating)return!1;let E=R.content.cutByIndex(C,R.childCount),A=o&&o[S+1];A&&(E=E.replaceChild(0,A.type.create(A.attrs)));let I=o&&o[S]||R;if(!R.canReplace(C+1,R.childCount)||!I.type.validContent(E))return!1}let g=l.indexAfter(d),b=o&&o[0];return l.node(d).canReplaceWith(g,g,b?b.type:l.node(d+1).type)}function split(t,e,n=1,o){let l=t.doc.resolve(e),d=Fragment.empty,f=Fragment.empty;for(let g=l.depth,b=l.depth-n,_=n-1;g>b;g--,_--){d=Fragment.from(l.node(g).copy(d));let S=o&&o[_];f=Fragment.from(S?S.type.create(S.attrs,f):l.node(g).copy(f))}t.step(new ReplaceStep(e,e,new Slice(d.append(f),n,n),!0))}function canJoin(t,e){let n=t.resolve(e),o=n.index();return joinable(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function canAppendWithSubstitutedLinebreaks(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let l=0;l<e.childCount;l++){let d=e.child(l),f=d.type==o?t.type.schema.nodes.text:d.type;if(n=n.matchType(f),!n||!t.type.allowsMarks(d.marks))return!1}return n.validEnd}function joinable(t,e){return!!(t&&e&&!t.isLeaf&&canAppendWithSubstitutedLinebreaks(t,e))}function joinPoint(t,e,n=-1){let o=t.resolve(e);for(let l=o.depth;;l--){let d,f,g=o.index(l);if(l==o.depth?(d=o.nodeBefore,f=o.nodeAfter):n>0?(d=o.node(l+1),g++,f=o.node(l).maybeChild(g)):(d=o.node(l).maybeChild(g-1),f=o.node(l+1)),d&&!d.isTextblock&&joinable(d,f)&&o.node(l).canReplace(g,g+1))return e;if(l==0)break;e=n<0?o.before(l):o.after(l)}}function join(t,e,n){let o=null,{linebreakReplacement:l}=t.doc.type.schema,d=t.doc.resolve(e-n),f=d.node().type;if(l&&f.inlineContent){let S=f.whitespace=="pre",R=!!f.contentMatch.matchType(l);S&&!R?o=!1:!S&&R&&(o=!0)}let g=t.steps.length;if(o===!1){let S=t.doc.resolve(e+n);replaceLinebreaks(t,S.node(),S.before(),g)}f.inlineContent&&clearIncompatible(t,e+n-1,f,d.node().contentMatchAt(d.index()),o==null);let b=t.mapping.slice(g),_=b.map(e-n);if(t.step(new ReplaceStep(_,b.map(e+n,-1),Slice.empty,!0)),o===!0){let S=t.doc.resolve(_);replaceNewlines(t,S.node(),S.before(),t.steps.length)}return t}function insertPoint(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let l=o.depth-1;l>=0;l--){let d=o.index(l);if(o.node(l).canReplaceWith(d,d,n))return o.before(l+1);if(d>0)return null}if(o.parentOffset==o.parent.content.size)for(let l=o.depth-1;l>=0;l--){let d=o.indexAfter(l);if(o.node(l).canReplaceWith(d,d,n))return o.after(l+1);if(d<o.node(l).childCount)return null}return null}function dropPoint(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let l=n.content;for(let d=0;d<n.openStart;d++)l=l.firstChild.content;for(let d=1;d<=(n.openStart==0&&n.size?2:1);d++)for(let f=o.depth;f>=0;f--){let g=f==o.depth?0:o.pos<=(o.start(f+1)+o.end(f+1))/2?-1:1,b=o.index(f)+(g>0?1:0),_=o.node(f),S=!1;if(d==1)S=_.canReplace(b,b,l);else{let R=_.contentMatchAt(b).findWrapping(l.firstChild.type);S=R&&_.canReplaceWith(b,b,R[0])}if(S)return g==0?o.pos:g<0?o.before(f+1):o.after(f+1)}return null}function replaceStep(t,e,n=e,o=Slice.empty){if(e==n&&!o.size)return null;let l=t.resolve(e),d=t.resolve(n);return fitsTrivially(l,d,o)?new ReplaceStep(e,n,o):new Fitter(l,d,o).fit()}function fitsTrivially(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Fitter{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=Fragment.empty;for(let l=0;l<=e.depth;l++){let d=e.node(l);this.frontier.push({type:d.type,match:d.contentMatchAt(e.indexAfter(l))})}for(let l=e.depth;l>0;l--)this.placed=Fragment.from(e.node(l).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let _=this.findFittable();_?this.placeNodes(_):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,l=this.close(e<0?this.$to:o.doc.resolve(e));if(!l)return null;let d=this.placed,f=o.depth,g=l.depth;for(;f&&g&&d.childCount==1;)d=d.firstChild.content,f--,g--;let b=new Slice(d,f,g);return e>-1?new ReplaceAroundStep(o.pos,e,this.$to.pos,this.$to.end(),b,n):b.size||o.pos!=this.$to.pos?new ReplaceStep(o.pos,l.pos,b):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,l=this.unplaced.openEnd;o<e;o++){let d=n.firstChild;if(n.childCount>1&&(l=0),d.type.spec.isolating&&l<=o){e=o;break}n=d.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let l,d=null;o?(d=contentAt(this.unplaced.content,o-1).firstChild,l=d.content):l=this.unplaced.content;let f=l.firstChild;for(let g=this.depth;g>=0;g--){let{type:b,match:_}=this.frontier[g],S,R=null;if(n==1&&(f?_.matchType(f.type)||(R=_.fillBefore(Fragment.from(f),!1)):d&&b.compatibleContent(d.type)))return{sliceDepth:o,frontierDepth:g,parent:d,inject:R};if(n==2&&f&&(S=_.findWrapping(f.type)))return{sliceDepth:o,frontierDepth:g,parent:d,wrap:S};if(d&&_.matchType(d.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,l=contentAt(e,n);return!l.childCount||l.firstChild.isLeaf?!1:(this.unplaced=new Slice(e,n+1,Math.max(o,l.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,l=contentAt(e,n);if(l.childCount<=1&&n>0){let d=e.size-n<=n+l.size;this.unplaced=new Slice(dropFromFragment(e,n-1,1),n-1,d?n-1:o)}else this.unplaced=new Slice(dropFromFragment(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:l,wrap:d}){for(;this.depth>n;)this.closeFrontierNode();if(d)for(let I=0;I<d.length;I++)this.openFrontierNode(d[I]);let f=this.unplaced,g=o?o.content:f.content,b=f.openStart-e,_=0,S=[],{match:R,type:C}=this.frontier[n];if(l){for(let I=0;I<l.childCount;I++)S.push(l.child(I));R=R.matchFragment(l)}let E=g.size+e-(f.content.size-f.openEnd);for(;_<g.childCount;){let I=g.child(_),M=R.matchType(I.type);if(!M)break;_++,(_>1||b==0||I.content.size)&&(R=M,S.push(closeNodeStart(I.mark(C.allowedMarks(I.marks)),_==1?b:0,_==g.childCount?E:-1)))}let A=_==g.childCount;A||(E=-1),this.placed=addToFragment(this.placed,n,Fragment.from(S)),this.frontier[n].match=R,A&&E<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let I=0,M=g;I<E;I++){let j=M.lastChild;this.frontier.push({type:j.type,match:j.contentMatchAt(j.childCount)}),M=j.content}this.unplaced=A?e==0?Slice.empty:new Slice(dropFromFragment(f.content,e-1,1),e-1,E<0?f.openEnd:e-1):new Slice(dropFromFragment(f.content,e,_),f.openStart,f.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!contentAfterFits(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,l=this.$to.after(o);for(;o>1&&l==this.$to.end(--o);)++l;return l}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:l}=this.frontier[n],d=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),f=contentAfterFits(e,n,l,o,d);if(f){for(let g=n-1;g>=0;g--){let{match:b,type:_}=this.frontier[g],S=contentAfterFits(e,g,_,b,!0);if(!S||S.childCount)continue e}return{depth:n,fit:f,move:d?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=addToFragment(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let l=e.node(o),d=l.type.contentMatch.fillBefore(l.content,!0,e.index(o));this.openFrontierNode(l.type,l.attrs,d)}return e}openFrontierNode(e,n=null,o){let l=this.frontier[this.depth];l.match=l.match.matchType(e),this.placed=addToFragment(this.placed,this.depth,Fragment.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Fragment.empty,!0);n.childCount&&(this.placed=addToFragment(this.placed,this.frontier.length,n))}}function dropFromFragment(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(dropFromFragment(t.firstChild.content,e-1,n)))}function addToFragment(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(addToFragment(t.lastChild.content,e-1,n)))}function contentAt(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function closeNodeStart(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,closeNodeStart(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(Fragment.empty,!0)))),t.copy(o)}function contentAfterFits(t,e,n,o,l){let d=t.node(e),f=l?t.indexAfter(e):t.index(e);if(f==d.childCount&&!n.compatibleContent(d.type))return null;let g=o.fillBefore(d.content,!0,f);return g&&!invalidMarks(n,d.content,f)?g:null}function invalidMarks(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function definesContent(t){return t.spec.defining||t.spec.definingForContent}function replaceRange(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let l=t.doc.resolve(e),d=t.doc.resolve(n);if(fitsTrivially(l,d,o))return t.step(new ReplaceStep(e,n,o));let f=coveredDepths(l,t.doc.resolve(n));f[f.length-1]==0&&f.pop();let g=-(l.depth+1);f.unshift(g);for(let C=l.depth,E=l.pos-1;C>0;C--,E--){let A=l.node(C).type.spec;if(A.defining||A.definingAsContext||A.isolating)break;f.indexOf(C)>-1?g=C:l.before(C)==E&&f.splice(1,0,-C)}let b=f.indexOf(g),_=[],S=o.openStart;for(let C=o.content,E=0;;E++){let A=C.firstChild;if(_.push(A),E==o.openStart)break;C=A.content}for(let C=S-1;C>=0;C--){let E=_[C],A=definesContent(E.type);if(A&&!E.sameMarkup(l.node(Math.abs(g)-1)))S=C;else if(A||!E.type.isTextblock)break}for(let C=o.openStart;C>=0;C--){let E=(C+S+1)%(o.openStart+1),A=_[E];if(A)for(let I=0;I<f.length;I++){let M=f[(I+b)%f.length],j=!0;M<0&&(j=!1,M=-M);let q=l.node(M-1),z=l.index(M-1);if(q.canReplaceWith(z,z,A.type,A.marks))return t.replace(l.before(M),j?d.after(M):n,new Slice(closeFragment(o.content,0,o.openStart,E),E,o.openEnd))}}let R=t.steps.length;for(let C=f.length-1;C>=0&&(t.replace(e,n,o),!(t.steps.length>R));C--){let E=f[C];E<0||(e=l.before(E),n=d.after(E))}}function closeFragment(t,e,n,o,l){if(e<n){let d=t.firstChild;t=t.replaceChild(0,d.copy(closeFragment(d.content,e+1,n,o,d)))}if(e>o){let d=l.contentMatchAt(0),f=d.fillBefore(t).append(t);t=f.append(d.matchFragment(f).fillBefore(Fragment.empty,!0))}return t}function replaceRangeWith(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let l=insertPoint(t.doc,e,o.type);l!=null&&(e=n=l)}t.replaceRange(e,n,new Slice(Fragment.from(o),0,0))}function deleteRange$1(t,e,n){let o=t.doc.resolve(e),l=t.doc.resolve(n),d=coveredDepths(o,l);for(let f=0;f<d.length;f++){let g=d[f],b=f==d.length-1;if(b&&g==0||o.node(g).type.contentMatch.validEnd)return t.delete(o.start(g),l.end(g));if(g>0&&(b||o.node(g-1).canReplace(o.index(g-1),l.indexAfter(g-1))))return t.delete(o.before(g),l.after(g))}for(let f=1;f<=o.depth&&f<=l.depth;f++)if(e-o.start(f)==o.depth-f&&n>o.end(f)&&l.end(f)-n!=l.depth-f&&o.start(f-1)==l.start(f-1)&&o.node(f-1).canReplace(o.index(f-1),l.index(f-1)))return t.delete(o.before(f),n);t.delete(e,n)}function coveredDepths(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let l=o;l>=0;l--){let d=t.start(l);if(d<t.pos-(t.depth-l)||e.end(l)>e.pos+(e.depth-l)||t.node(l).type.spec.isolating||e.node(l).type.spec.isolating)break;(d==e.start(l)||l==t.depth&&l==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&l&&e.start(l-1)==d-1)&&n.push(l)}return n}class AttrStep extends Step{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return StepResult.fail("No node at attribute step's position");let o=Object.create(null);for(let d in n.attrs)o[d]=n.attrs[d];o[this.attr]=this.value;let l=n.type.create(o,null,n.marks);return StepResult.fromReplace(e,this.pos,this.pos+1,new Slice(Fragment.from(l),0,n.isLeaf?0:1))}getMap(){return StepMap.empty}invert(e){return new AttrStep(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new AttrStep(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new AttrStep(n.pos,n.attr,n.value)}}Step.jsonID("attr",AttrStep);class DocAttrStep extends Step{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let l in e.attrs)n[l]=e.attrs[l];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return StepResult.ok(o)}getMap(){return StepMap.empty}invert(e){return new DocAttrStep(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new DocAttrStep(n.attr,n.value)}}Step.jsonID("docAttr",DocAttrStep);let TransformError=class extends Error{};TransformError=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},TransformError.prototype=Object.create(Error.prototype),TransformError.prototype.constructor=TransformError,TransformError.prototype.name="TransformError";class Transform{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Mapping}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new TransformError(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=Slice.empty){let l=replaceStep(this.doc,e,n,o);return l&&this.step(l),this}replaceWith(e,n,o){return this.replace(e,n,new Slice(Fragment.from(o),0,0))}delete(e,n){return this.replace(e,n,Slice.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return replaceRange(this,e,n,o),this}replaceRangeWith(e,n,o){return replaceRangeWith(this,e,n,o),this}deleteRange(e,n){return deleteRange$1(this,e,n),this}lift(e,n){return lift$2(this,e,n),this}join(e,n=1){return join(this,e,n),this}wrap(e,n){return wrap(this,e,n),this}setBlockType(e,n=e,o,l=null){return setBlockType$1(this,e,n,o,l),this}setNodeMarkup(e,n,o=null,l){return setNodeMarkup(this,e,n,o,l),this}setNodeAttribute(e,n,o){return this.step(new AttrStep(e,n,o)),this}setDocAttribute(e,n){return this.step(new DocAttrStep(e,n)),this}addNodeMark(e,n){return this.step(new AddNodeMarkStep(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof Mark$1)n.isInSet(o.marks)&&this.step(new RemoveNodeMarkStep(e,n));else{let l=o.marks,d,f=[];for(;d=n.isInSet(l);)f.push(new RemoveNodeMarkStep(e,d)),l=d.removeFromSet(l);for(let g=f.length-1;g>=0;g--)this.step(f[g])}return this}split(e,n=1,o){return split(this,e,n,o),this}addMark(e,n,o){return addMark(this,e,n,o),this}removeMark(e,n,o){return removeMark(this,e,n,o),this}clearIncompatible(e,n,o){return clearIncompatible(this,e,n,o),this}}const classesById=Object.create(null);class Selection{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new SelectionRange(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Slice.empty){let o=n.content.lastChild,l=null;for(let g=0;g<n.openEnd;g++)l=o,o=o.lastChild;let d=e.steps.length,f=this.ranges;for(let g=0;g<f.length;g++){let{$from:b,$to:_}=f[g],S=e.mapping.slice(d);e.replaceRange(S.map(b.pos),S.map(_.pos),g?Slice.empty:n),g==0&&selectionToInsertionEnd$1(e,d,(o?o.isInline:l&&l.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,l=this.ranges;for(let d=0;d<l.length;d++){let{$from:f,$to:g}=l[d],b=e.mapping.slice(o),_=b.map(f.pos),S=b.map(g.pos);d?e.deleteRange(_,S):(e.replaceRangeWith(_,S,n),selectionToInsertionEnd$1(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let l=e.parent.inlineContent?new TextSelection(e):findSelectionIn(e.node(0),e.parent,e.pos,e.index(),n,o);if(l)return l;for(let d=e.depth-1;d>=0;d--){let f=n<0?findSelectionIn(e.node(0),e.node(d),e.before(d+1),e.index(d),n,o):findSelectionIn(e.node(0),e.node(d),e.after(d+1),e.index(d)+1,n,o);if(f)return f}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new AllSelection(e.node(0))}static atStart(e){return findSelectionIn(e,e,0,0,1)||new AllSelection(e)}static atEnd(e){return findSelectionIn(e,e,e.content.size,e.childCount,-1)||new AllSelection(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=classesById[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in classesById)throw new RangeError("Duplicate use of selection JSON ID "+e);return classesById[e]=n,n.prototype.jsonID=e,n}getBookmark(){return TextSelection.between(this.$anchor,this.$head).getBookmark()}}Selection.prototype.visible=!0;class SelectionRange{constructor(e,n){this.$from=e,this.$to=n}}let warnedAboutTextSelection=!1;function checkTextSelection(t){!warnedAboutTextSelection&&!t.parent.inlineContent&&(warnedAboutTextSelection=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class TextSelection extends Selection{constructor(e,n=e){checkTextSelection(e),checkTextSelection(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return Selection.near(o);let l=e.resolve(n.map(this.anchor));return new TextSelection(l.parent.inlineContent?l:o,o)}replace(e,n=Slice.empty){if(super.replace(e,n),n==Slice.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof TextSelection&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new TextBookmark(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new TextSelection(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let l=e.resolve(n);return new this(l,o==n?l:e.resolve(o))}static between(e,n,o){let l=e.pos-n.pos;if((!o||l)&&(o=l>=0?1:-1),!n.parent.inlineContent){let d=Selection.findFrom(n,o,!0)||Selection.findFrom(n,-o,!0);if(d)n=d.$head;else return Selection.near(n,o)}return e.parent.inlineContent||(l==0?e=n:(e=(Selection.findFrom(e,-o,!0)||Selection.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=l<0&&(e=n))),new TextSelection(e,n)}}Selection.jsonID("text",TextSelection);class TextBookmark{constructor(e,n){this.anchor=e,this.head=n}map(e){return new TextBookmark(e.map(this.anchor),e.map(this.head))}resolve(e){return TextSelection.between(e.resolve(this.anchor),e.resolve(this.head))}}class NodeSelection extends Selection{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:l}=n.mapResult(this.anchor),d=e.resolve(l);return o?Selection.near(d):new NodeSelection(d)}content(){return new Slice(Fragment.from(this.node),0,0)}eq(e){return e instanceof NodeSelection&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new NodeBookmark(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new NodeSelection(e.resolve(n.anchor))}static create(e,n){return new NodeSelection(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}NodeSelection.prototype.visible=!1,Selection.jsonID("node",NodeSelection);class NodeBookmark{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new TextBookmark(o,o):new NodeBookmark(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&NodeSelection.isSelectable(o)?new NodeSelection(n):Selection.near(n)}}class AllSelection extends Selection{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Slice.empty){if(n==Slice.empty){e.delete(0,e.doc.content.size);let o=Selection.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new AllSelection(e)}map(e){return new AllSelection(e)}eq(e){return e instanceof AllSelection}getBookmark(){return AllBookmark}}Selection.jsonID("all",AllSelection);const AllBookmark={map(){return this},resolve(t){return new AllSelection(t)}};function findSelectionIn(t,e,n,o,l,d=!1){if(e.inlineContent)return TextSelection.create(t,n);for(let f=o-(l>0?0:1);l>0?f<e.childCount:f>=0;f+=l){let g=e.child(f);if(g.isAtom){if(!d&&NodeSelection.isSelectable(g))return NodeSelection.create(t,n-(l<0?g.nodeSize:0))}else{let b=findSelectionIn(t,g,n+l,l<0?g.childCount:0,l,d);if(b)return b}n+=g.nodeSize*l}return null}function selectionToInsertionEnd$1(t,e,n){let o=t.steps.length-1;if(o<e)return;let l=t.steps[o];if(!(l instanceof ReplaceStep||l instanceof ReplaceAroundStep))return;let d=t.mapping.maps[o],f;d.forEach((g,b,_,S)=>{f==null&&(f=S)}),t.setSelection(Selection.near(t.doc.resolve(f),n))}const UPDATED_SEL=1,UPDATED_MARKS=2,UPDATED_SCROLL=4;class Transaction extends Transform{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|UPDATED_SEL)&~UPDATED_MARKS,this.storedMarks=null,this}get selectionSet(){return(this.updated&UPDATED_SEL)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=UPDATED_MARKS,this}ensureMarks(e){return Mark$1.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&UPDATED_MARKS)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~UPDATED_MARKS,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Mark$1.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let l=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(l.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),o=o??n,!e)return this.deleteRange(n,o);let d=this.storedMarks;if(!d){let f=this.doc.resolve(n);d=o==n?f.marks():f.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,l.text(e,d)),this.selection.empty||this.setSelection(Selection.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=UPDATED_SCROLL,this}get scrolledIntoView(){return(this.updated&UPDATED_SCROLL)>0}}function bind(t,e){return!e||!t?t:t.bind(e)}class FieldDesc{constructor(e,n,o){this.name=e,this.init=bind(n.init,o),this.apply=bind(n.apply,o)}}const baseFields=[new FieldDesc("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new FieldDesc("selection",{init(t,e){return t.selection||Selection.atStart(e.doc)},apply(t){return t.selection}}),new FieldDesc("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new FieldDesc("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Configuration{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=baseFields.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new FieldDesc(o.key,o.spec.state,o))})}}class EditorState{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let l=this.config.plugins[o];if(l.spec.filterTransaction&&!l.spec.filterTransaction.call(l,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),l=null;for(;;){let d=!1;for(let f=0;f<this.config.plugins.length;f++){let g=this.config.plugins[f];if(g.spec.appendTransaction){let b=l?l[f].n:0,_=l?l[f].state:this,S=b<n.length&&g.spec.appendTransaction.call(g,b?n.slice(b):n,_,o);if(S&&o.filterTransaction(S,f)){if(S.setMeta("appendedTransaction",e),!l){l=[];for(let R=0;R<this.config.plugins.length;R++)l.push(R<f?{state:o,n:n.length}:{state:this,n:0})}n.push(S),o=o.applyInner(S),d=!0}l&&(l[f]={state:o,n:n.length})}}if(!d)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new EditorState(this.config),o=this.config.fields;for(let l=0;l<o.length;l++){let d=o[l];n[d.name]=d.apply(e,this[d.name],this,n)}return n}get tr(){return new Transaction(this)}static create(e){let n=new Configuration(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new EditorState(n);for(let l=0;l<n.fields.length;l++)o[n.fields[l].name]=n.fields[l].init(e,o);return o}reconfigure(e){let n=new Configuration(this.schema,e.plugins),o=n.fields,l=new EditorState(n);for(let d=0;d<o.length;d++){let f=o[d].name;l[f]=this.hasOwnProperty(f)?this[f]:o[d].init(e,l)}return l}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let l=e[o],d=l.spec.state;d&&d.toJSON&&(n[o]=d.toJSON.call(l,this[l.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let l=new Configuration(e.schema,e.plugins),d=new EditorState(l);return l.fields.forEach(f=>{if(f.name=="doc")d.doc=Node$2.fromJSON(e.schema,n.doc);else if(f.name=="selection")d.selection=Selection.fromJSON(d.doc,n.selection);else if(f.name=="storedMarks")n.storedMarks&&(d.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let g in o){let b=o[g],_=b.spec.state;if(b.key==f.name&&_&&_.fromJSON&&Object.prototype.hasOwnProperty.call(n,g)){d[f.name]=_.fromJSON.call(b,e,n[g],d);return}}d[f.name]=f.init(e,d)}}),d}}function bindProps(t,e,n){for(let o in t){let l=t[o];l instanceof Function?l=l.bind(e):o=="handleDOMEvents"&&(l=bindProps(l,e,{})),n[o]=l}return n}class Plugin{constructor(e){this.spec=e,this.props={},e.props&&bindProps(e.props,this,this.props),this.key=e.key?e.key.key:createKey("plugin")}getState(e){return e[this.key]}}const keys=Object.create(null);function createKey(t){return t in keys?t+"$"+ ++keys[t]:(keys[t]=0,t+"$")}class PluginKey{constructor(e="key"){this.key=createKey(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const domIndex=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},parentNode=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let reusedRange=null;const textRange=function(t,e,n){let o=reusedRange||(reusedRange=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},clearReusedRange=function(){reusedRange=null},isEquivalentPosition=function(t,e,n,o){return n&&(scanFor(t,e,n,o,-1)||scanFor(t,e,n,o,1))},atomElements=/^(img|br|input|textarea|hr)$/i;function scanFor(t,e,n,o,l){for(var d;;){if(t==n&&e==o)return!0;if(e==(l<0?0:nodeSize(t))){let f=t.parentNode;if(!f||f.nodeType!=1||hasBlockDesc(t)||atomElements.test(t.nodeName)||t.contentEditable=="false")return!1;e=domIndex(t)+(l<0?0:1),t=f}else if(t.nodeType==1){let f=t.childNodes[e+(l<0?-1:0)];if(f.nodeType==1&&f.contentEditable=="false")if(!((d=f.pmViewDesc)===null||d===void 0)&&d.ignoreForSelection)e+=l;else return!1;else t=f,e=l<0?nodeSize(t):0}else return!1}}function nodeSize(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function textNodeBefore$1(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=nodeSize(t)}else if(t.parentNode&&!hasBlockDesc(t))e=domIndex(t),t=t.parentNode;else return null}}function textNodeAfter$1(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!hasBlockDesc(t))e=domIndex(t)+1,t=t.parentNode;else return null}}function isOnEdge(t,e,n){for(let o=e==0,l=e==nodeSize(t);o||l;){if(t==n)return!0;let d=domIndex(t);if(t=t.parentNode,!t)return!1;o=o&&d==0,l=l&&d==nodeSize(t)}}function hasBlockDesc(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const selectionCollapsed=function(t){return t.focusNode&&isEquivalentPosition(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function keyEvent(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function deepActiveElement(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function caretFromPoint(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(nodeSize(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(nodeSize(o.startContainer),o.startOffset)}}}const nav=typeof navigator<"u"?navigator:null,doc=typeof document<"u"?document:null,agent=nav&&nav.userAgent||"",ie_edge=/Edge\/(\d+)/.exec(agent),ie_upto10=/MSIE \d/.exec(agent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent),ie$1=!!(ie_upto10||ie_11up||ie_edge),ie_version=ie_upto10?document.documentMode:ie_11up?+ie_11up[1]:ie_edge?+ie_edge[1]:0,gecko=!ie$1&&/gecko\/(\d+)/i.test(agent);gecko&&+(/Firefox\/(\d+)/.exec(agent)||[0,0])[1];const _chrome=!ie$1&&/Chrome\/(\d+)/.exec(agent),chrome=!!_chrome,chrome_version=_chrome?+_chrome[1]:0,safari=!ie$1&&!!nav&&/Apple Computer/.test(nav.vendor),ios=safari&&(/Mobile\/\w+/.test(agent)||!!nav&&nav.maxTouchPoints>2),mac$2=ios||(nav?/Mac/.test(nav.platform):!1),windows$1=nav?/Win/.test(nav.platform):!1,android=/Android \d/.test(agent),webkit=!!doc&&"webkitFontSmoothing"in doc.documentElement.style,webkit_version=webkit?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function windowRect(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function getSide(t,e){return typeof t=="number"?t:t[e]}function clientRect(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function scrollRectIntoView(t,e,n){let o=t.someProp("scrollThreshold")||0,l=t.someProp("scrollMargin")||5,d=t.dom.ownerDocument;for(let f=n||t.dom;f;){if(f.nodeType!=1){f=parentNode(f);continue}let g=f,b=g==d.body,_=b?windowRect(d):clientRect(g),S=0,R=0;if(e.top<_.top+getSide(o,"top")?R=-(_.top-e.top+getSide(l,"top")):e.bottom>_.bottom-getSide(o,"bottom")&&(R=e.bottom-e.top>_.bottom-_.top?e.top+getSide(l,"top")-_.top:e.bottom-_.bottom+getSide(l,"bottom")),e.left<_.left+getSide(o,"left")?S=-(_.left-e.left+getSide(l,"left")):e.right>_.right-getSide(o,"right")&&(S=e.right-_.right+getSide(l,"right")),S||R)if(b)d.defaultView.scrollBy(S,R);else{let E=g.scrollLeft,A=g.scrollTop;R&&(g.scrollTop+=R),S&&(g.scrollLeft+=S);let I=g.scrollLeft-E,M=g.scrollTop-A;e={left:e.left-I,top:e.top-M,right:e.right-I,bottom:e.bottom-M}}let C=b?"fixed":getComputedStyle(f).position;if(/^(fixed|sticky)$/.test(C))break;f=C=="absolute"?f.offsetParent:parentNode(f)}}function storeScrollPos(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,l;for(let d=(e.left+e.right)/2,f=n+1;f<Math.min(innerHeight,e.bottom);f+=5){let g=t.root.elementFromPoint(d,f);if(!g||g==t.dom||!t.dom.contains(g))continue;let b=g.getBoundingClientRect();if(b.top>=n-20){o=g,l=b.top;break}}return{refDOM:o,refTop:l,stack:scrollStack(t.dom)}}function scrollStack(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=parentNode(o));return e}function resetScrollPos({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;restoreScrollStack(n,o==0?0:o-e)}function restoreScrollStack(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:l,left:d}=t[n];o.scrollTop!=l+e&&(o.scrollTop=l+e),o.scrollLeft!=d&&(o.scrollLeft=d)}}let preventScrollSupported=null;function focusPreventScroll(t){if(t.setActive)return t.setActive();if(preventScrollSupported)return t.focus(preventScrollSupported);let e=scrollStack(t);t.focus(preventScrollSupported==null?{get preventScroll(){return preventScrollSupported={preventScroll:!0},!0}}:void 0),preventScrollSupported||(preventScrollSupported=!1,restoreScrollStack(e,0))}function findOffsetInNode(t,e){let n,o=2e8,l,d=0,f=e.top,g=e.top,b,_;for(let S=t.firstChild,R=0;S;S=S.nextSibling,R++){let C;if(S.nodeType==1)C=S.getClientRects();else if(S.nodeType==3)C=textRange(S).getClientRects();else continue;for(let E=0;E<C.length;E++){let A=C[E];if(A.top<=f&&A.bottom>=g){f=Math.max(A.bottom,f),g=Math.min(A.top,g);let I=A.left>e.left?A.left-e.left:A.right<e.left?e.left-A.right:0;if(I<o){n=S,o=I,l=I&&n.nodeType==3?{left:A.right<e.left?A.right:A.left,top:e.top}:e,S.nodeType==1&&I&&(d=R+(e.left>=(A.left+A.right)/2?1:0));continue}}else A.top>e.top&&!b&&A.left<=e.left&&A.right>=e.left&&(b=S,_={left:Math.max(A.left,Math.min(A.right,e.left)),top:A.top});!n&&(e.left>=A.right&&e.top>=A.top||e.left>=A.left&&e.top>=A.bottom)&&(d=R+1)}}return!n&&b&&(n=b,l=_,o=0),n&&n.nodeType==3?findOffsetInText(n,l):!n||o&&n.nodeType==1?{node:t,offset:d}:findOffsetInNode(n,l)}function findOffsetInText(t,e){let n=t.nodeValue.length,o=document.createRange();for(let l=0;l<n;l++){o.setEnd(t,l+1),o.setStart(t,l);let d=singleRect(o,1);if(d.top!=d.bottom&&inRect(e,d))return{node:t,offset:l+(e.left>=(d.left+d.right)/2?1:0)}}return{node:t,offset:0}}function inRect(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function targetKludge(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function posFromElement(t,e,n){let{node:o,offset:l}=findOffsetInNode(e,n),d=-1;if(o.nodeType==1&&!o.firstChild){let f=o.getBoundingClientRect();d=f.left!=f.right&&n.left>(f.left+f.right)/2?1:-1}return t.docView.posFromDOM(o,l,d)}function posFromCaret(t,e,n,o){let l=-1;for(let d=e,f=!1;d!=t.dom;){let g=t.docView.nearestDesc(d,!0),b;if(!g)return null;if(g.dom.nodeType==1&&(g.node.isBlock&&g.parent||!g.contentDOM)&&((b=g.dom.getBoundingClientRect()).width||b.height)&&(g.node.isBlock&&g.parent&&(!f&&b.left>o.left||b.top>o.top?l=g.posBefore:(!f&&b.right<o.left||b.bottom<o.top)&&(l=g.posAfter),f=!0),!g.contentDOM&&l<0&&!g.node.isText))return(g.node.isBlock?o.top<(b.top+b.bottom)/2:o.left<(b.left+b.right)/2)?g.posBefore:g.posAfter;d=g.dom.parentNode}return l>-1?l:t.docView.posFromDOM(e,n,-1)}function elementFromPoint(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let l=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),d=l;;){let f=t.childNodes[d];if(f.nodeType==1){let g=f.getClientRects();for(let b=0;b<g.length;b++){let _=g[b];if(inRect(e,_))return elementFromPoint(f,e,_)}}if((d=(d+1)%o)==l)break}return t}function posAtCoords(t,e){let n=t.dom.ownerDocument,o,l=0,d=caretFromPoint(n,e.left,e.top);d&&({node:o,offset:l}=d);let f=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),g;if(!f||!t.dom.contains(f.nodeType!=1?f.parentNode:f)){let _=t.dom.getBoundingClientRect();if(!inRect(e,_)||(f=elementFromPoint(t.dom,e,_),!f))return null}if(safari)for(let _=f;o&&_;_=parentNode(_))_.draggable&&(o=void 0);if(f=targetKludge(f,e),o){if(gecko&&o.nodeType==1&&(l=Math.min(l,o.childNodes.length),l<o.childNodes.length)){let S=o.childNodes[l],R;S.nodeName=="IMG"&&(R=S.getBoundingClientRect()).right<=e.left&&R.bottom>e.top&&l++}let _;webkit&&l&&o.nodeType==1&&(_=o.childNodes[l-1]).nodeType==1&&_.contentEditable=="false"&&_.getBoundingClientRect().top>=e.top&&l--,o==t.dom&&l==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?g=t.state.doc.content.size:(l==0||o.nodeType!=1||o.childNodes[l-1].nodeName!="BR")&&(g=posFromCaret(t,o,l,e))}g==null&&(g=posFromElement(t,f,e));let b=t.docView.nearestDesc(f,!0);return{pos:g,inside:b?b.posAtStart-b.border:-1}}function nonZero(t){return t.top<t.bottom||t.left<t.right}function singleRect(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(nonZero(o))return o}return Array.prototype.find.call(n,nonZero)||t.getBoundingClientRect()}const BIDI=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function coordsAtPos(t,e,n){let{node:o,offset:l,atom:d}=t.docView.domFromPos(e,n<0?-1:1),f=webkit||gecko;if(o.nodeType==3)if(f&&(BIDI.test(o.nodeValue)||(n<0?!l:l==o.nodeValue.length))){let b=singleRect(textRange(o,l,l),n);if(gecko&&l&&/\s/.test(o.nodeValue[l-1])&&l<o.nodeValue.length){let _=singleRect(textRange(o,l-1,l-1),-1);if(_.top==b.top){let S=singleRect(textRange(o,l,l+1),-1);if(S.top!=b.top)return flattenV(S,S.left<_.left)}}return b}else{let b=l,_=l,S=n<0?1:-1;return n<0&&!l?(_++,S=-1):n>=0&&l==o.nodeValue.length?(b--,S=1):n<0?b--:_++,flattenV(singleRect(textRange(o,b,_),S),S<0)}if(!t.state.doc.resolve(e-(d||0)).parent.inlineContent){if(d==null&&l&&(n<0||l==nodeSize(o))){let b=o.childNodes[l-1];if(b.nodeType==1)return flattenH(b.getBoundingClientRect(),!1)}if(d==null&&l<nodeSize(o)){let b=o.childNodes[l];if(b.nodeType==1)return flattenH(b.getBoundingClientRect(),!0)}return flattenH(o.getBoundingClientRect(),n>=0)}if(d==null&&l&&(n<0||l==nodeSize(o))){let b=o.childNodes[l-1],_=b.nodeType==3?textRange(b,nodeSize(b)-(f?0:1)):b.nodeType==1&&(b.nodeName!="BR"||!b.nextSibling)?b:null;if(_)return flattenV(singleRect(_,1),!1)}if(d==null&&l<nodeSize(o)){let b=o.childNodes[l];for(;b.pmViewDesc&&b.pmViewDesc.ignoreForCoords;)b=b.nextSibling;let _=b?b.nodeType==3?textRange(b,0,f?0:1):b.nodeType==1?b:null:null;if(_)return flattenV(singleRect(_,-1),!0)}return flattenV(singleRect(o.nodeType==3?textRange(o):o,-n),n>=0)}function flattenV(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function flattenH(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function withFlushedState(t,e,n){let o=t.state,l=t.root.activeElement;o!=e&&t.updateState(e),l!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),l!=t.dom&&l&&l.focus()}}function endOfTextblockVertical(t,e,n){let o=e.selection,l=n=="up"?o.$from:o.$to;return withFlushedState(t,e,()=>{let{node:d}=t.docView.domFromPos(l.pos,n=="up"?-1:1);for(;;){let g=t.docView.nearestDesc(d,!0);if(!g)break;if(g.node.isBlock){d=g.contentDOM||g.dom;break}d=g.dom.parentNode}let f=coordsAtPos(t,l.pos,1);for(let g=d.firstChild;g;g=g.nextSibling){let b;if(g.nodeType==1)b=g.getClientRects();else if(g.nodeType==3)b=textRange(g,0,g.nodeValue.length).getClientRects();else continue;for(let _=0;_<b.length;_++){let S=b[_];if(S.bottom>S.top+1&&(n=="up"?f.top-S.top>(S.bottom-f.top)*2:S.bottom-f.bottom>(f.bottom-S.top)*2))return!1}}return!0})}const maybeRTL=/[\u0590-\u08ac]/;function endOfTextblockHorizontal(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let l=o.parentOffset,d=!l,f=l==o.parent.content.size,g=t.domSelection();return g?!maybeRTL.test(o.parent.textContent)||!g.modify?n=="left"||n=="backward"?d:f:withFlushedState(t,e,()=>{let{focusNode:b,focusOffset:_,anchorNode:S,anchorOffset:R}=t.domSelectionRange(),C=g.caretBidiLevel;g.modify("move",n,"character");let E=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:A,focusOffset:I}=t.domSelectionRange(),M=A&&!E.contains(A.nodeType==1?A:A.parentNode)||b==A&&_==I;try{g.collapse(S,R),b&&(b!=S||_!=R)&&g.extend&&g.extend(b,_)}catch{}return C!=null&&(g.caretBidiLevel=C),M}):o.pos==o.start()||o.pos==o.end()}let cachedState=null,cachedDir=null,cachedResult=!1;function endOfTextblock(t,e,n){return cachedState==e&&cachedDir==n?cachedResult:(cachedState=e,cachedDir=n,cachedResult=n=="up"||n=="down"?endOfTextblockVertical(t,e,n):endOfTextblockHorizontal(t,e,n))}const NOT_DIRTY=0,CHILD_DIRTY=1,CONTENT_DIRTY=2,NODE_DIRTY=3;class ViewDesc{constructor(e,n,o,l){this.parent=e,this.children=n,this.dom=o,this.contentDOM=l,this.dirty=NOT_DIRTY,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let l=this.children[n];if(l==e)return o;o+=l.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let d,f;if(e==this.contentDOM)d=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;d=e.previousSibling}for(;d&&!((f=d.pmViewDesc)&&f.parent==this);)d=d.previousSibling;return d?this.posBeforeChild(f)+f.size:this.posAtStart}else{let d,f;if(e==this.contentDOM)d=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;d=e.nextSibling}for(;d&&!((f=d.pmViewDesc)&&f.parent==this);)d=d.nextSibling;return d?this.posBeforeChild(f):this.posAtEnd}let l;if(e==this.dom&&this.contentDOM)l=n>domIndex(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))l=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let d=e;;d=d.parentNode){if(d==this.dom){l=!1;break}if(d.previousSibling)break}if(l==null&&n==e.childNodes.length)for(let d=e;;d=d.parentNode){if(d==this.dom){l=!0;break}if(d.nextSibling)break}}return l??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,l=e;l;l=l.parentNode){let d=this.getDesc(l),f;if(d&&(!n||d.node))if(o&&(f=d.nodeDOM)&&!(f.nodeType==1?f.contains(e.nodeType==1?e:e.parentNode):f==e))o=!1;else return d}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let l=e;l;l=l.parentNode){let d=this.getDesc(l);if(d)return d.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let l=this.children[n],d=o+l.size;if(o==e&&d!=o){for(;!l.border&&l.children.length;)for(let f=0;f<l.children.length;f++){let g=l.children[f];if(g.size){l=g;break}}return l}if(e<d)return l.descAt(e-o-l.border);o=d}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,l=0;for(let d=0;o<this.children.length;o++){let f=this.children[o],g=d+f.size;if(g>e||f instanceof TrailingHackViewDesc){l=e-d;break}d=g}if(l)return this.children[o].domFromPos(l-this.children[o].border,n);for(let d;o&&!(d=this.children[o-1]).size&&d instanceof WidgetViewDesc&&d.side>=0;o--);if(n<=0){let d,f=!0;for(;d=o?this.children[o-1]:null,!(!d||d.dom.parentNode==this.contentDOM);o--,f=!1);return d&&n&&f&&!d.border&&!d.domAtom?d.domFromPos(d.size,n):{node:this.contentDOM,offset:d?domIndex(d.dom)+1:0}}else{let d,f=!0;for(;d=o<this.children.length?this.children[o]:null,!(!d||d.dom.parentNode==this.contentDOM);o++,f=!1);return d&&f&&!d.border&&!d.domAtom?d.domFromPos(0,n):{node:this.contentDOM,offset:d?domIndex(d.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let l=-1,d=-1;for(let f=o,g=0;;g++){let b=this.children[g],_=f+b.size;if(l==-1&&e<=_){let S=f+b.border;if(e>=S&&n<=_-b.border&&b.node&&b.contentDOM&&this.contentDOM.contains(b.contentDOM))return b.parseRange(e,n,S);e=f;for(let R=g;R>0;R--){let C=this.children[R-1];if(C.size&&C.dom.parentNode==this.contentDOM&&!C.emptyChildAt(1)){l=domIndex(C.dom)+1;break}e-=C.size}l==-1&&(l=0)}if(l>-1&&(_>n||g==this.children.length-1)){n=_;for(let S=g+1;S<this.children.length;S++){let R=this.children[S];if(R.size&&R.dom.parentNode==this.contentDOM&&!R.emptyChildAt(-1)){d=domIndex(R.dom);break}n+=R.size}d==-1&&(d=this.contentDOM.childNodes.length);break}f=_}return{node:this.contentDOM,from:e,to:n,fromOffset:l,toOffset:d}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,l=!1){let d=Math.min(e,n),f=Math.max(e,n);for(let E=0,A=0;E<this.children.length;E++){let I=this.children[E],M=A+I.size;if(d>A&&f<M)return I.setSelection(e-A-I.border,n-A-I.border,o,l);A=M}let g=this.domFromPos(e,e?-1:1),b=n==e?g:this.domFromPos(n,n?-1:1),_=o.root.getSelection(),S=o.domSelectionRange(),R=!1;if((gecko||safari)&&e==n){let{node:E,offset:A}=g;if(E.nodeType==3){if(R=!!(A&&E.nodeValue[A-1]==`
|
|
@@ -1224,7 +1224,7 @@ img.ProseMirror-separator {
|
|
|
1224
1224
|
opacity: 0
|
|
1225
1225
|
}`;function createStyleTag(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const l=document.createElement("style");return e&&l.setAttribute("nonce",e),l.setAttribute("data-tiptap-style",""),l.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(l),l}class Editor extends EventEmitter{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:o,moved:l})=>this.options.onDrop(n,o,l)),this.on("paste",({event:n,slice:o})=>this.options.onPaste(n,o)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=createStyleTag(style,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const o=isFunction(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],l=this.state.reconfigure({plugins:o});return this.view.updateState(l),l}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let o=n;if([].concat(e).forEach(d=>{const f=typeof d=="string"?`${d}$`:d.key;o=o.filter(g=>!g.key.startsWith(f))}),n.length===o.length)return;const l=this.state.reconfigure({plugins:o});return this.view.updateState(l),l}createExtensionManager(){var e,n;const l=[...this.options.enableCoreExtensions?[Editable,ClipboardTextSerializer.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),Commands,FocusEvents,Keymap,Tabindex,Drop,Paste].filter(d=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[d.name]!==!1:!0):[],...this.options.extensions].filter(d=>["extension","node","mark"].includes(d==null?void 0:d.type));this.extensionManager=new ExtensionManager(l,this)}createCommandManager(){this.commandManager=new CommandManager({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=createDocument(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(f){if(!(f instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(f.message))throw f;this.emit("contentError",{editor:this,error:f,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(g=>g.name!=="collaboration"),this.createExtensionManager()}}),n=createDocument(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const o=resolveFocusPosition(n,this.options.autofocus);this.view=new EditorView(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:EditorState.create({doc:n,selection:o||void 0})});const l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.createNodeViews(),this.prependClass();const d=this.view.dom;d.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(f=>{var g;return(g=this.capturedTransaction)===null||g===void 0?void 0:g.step(f)});return}const n=this.state.apply(e),o=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=e.getMeta("focus"),d=e.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:e}),d&&this.emit("blur",{editor:this,event:d.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return getAttributes(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,l=typeof e=="string"?n:e;return isActive(this.state,o,l)}getJSON(){return this.state.doc.toJSON()}getHTML(){return getHTMLFromFragment(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
1226
1226
|
|
|
1227
|
-
`,textSerializers:o={}}=e||{};return getText(this.state.doc,{blockSeparator:n,textSerializers:{...getTextSerializersFromSchema(this.schema),...o}})}get isEmpty(){return isNodeEmpty(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new NodePos(n,this)}get $doc(){return this.$pos(0)}}function markInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o})=>{const l=callOrReturn(t.getAttributes,void 0,o);if(l===!1||l===null)return null;const{tr:d}=e,f=o[o.length-1],g=o[0];if(f){const b=g.search(/\S/),_=n.from+g.indexOf(f),S=_+f.length;if(getMarksBetween(n.from,n.to,e.doc).filter(E=>E.mark.type.excluded.find(I=>I===t.type&&I!==E.mark.type)).filter(E=>E.to>_).length)return null;S<n.to&&d.delete(S,n.to),_>n.from&&d.delete(n.from+b,_);const C=n.from+b+f.length;d.addMark(n.from+b,C,t.type.create(l||{})),d.removeStoredMark(t.type)}}})}function nodeInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o})=>{const l=callOrReturn(t.getAttributes,void 0,o)||{},{tr:d}=e,f=n.from;let g=n.to;const b=t.type.create(l);if(o[1]){const _=o[0].lastIndexOf(o[1]);let S=f+_;S>g?S=g:g=S+o[1].length;const R=o[0][o[0].length-1];d.insertText(R,f+o[0].length-1),d.replaceWith(S,g,b)}else if(o[0]){const _=t.type.isInline?f:f-1;d.insert(_,t.type.create(l)).delete(d.mapping.map(f),d.mapping.map(g))}d.scrollIntoView()}})}function textblockTypeInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o})=>{const l=e.doc.resolve(n.from),d=callOrReturn(t.getAttributes,void 0,o)||{};if(!l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,d)}})}function wrappingInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o,chain:l})=>{const d=callOrReturn(t.getAttributes,void 0,o)||{},f=e.tr.delete(n.from,n.to),b=f.doc.resolve(n.from).blockRange(),_=b&&findWrapping(b,t.type,d);if(!_)return null;if(f.wrap(b,_),t.keepMarks&&t.editor){const{selection:R,storedMarks:C}=e,{splittableMarks:E}=t.editor.extensionManager,A=C||R.$to.parentOffset&&R.$from.marks();if(A){const I=A.filter(M=>E.includes(M.type.name));f.ensureMarks(I)}}if(t.keepAttributes){const R=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";l().updateAttributes(R,d).run()}const S=f.doc.resolve(n.from-1).nodeBefore;S&&S.type===t.type&&canJoin(f.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,S))&&f.join(n.from-1)}})}let Node$1=class
|
|
1227
|
+
`,textSerializers:o={}}=e||{};return getText(this.state.doc,{blockSeparator:n,textSerializers:{...getTextSerializersFromSchema(this.schema),...o}})}get isEmpty(){return isNodeEmpty(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)===null||o===void 0?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new NodePos(n,this)}get $doc(){return this.$pos(0)}}function markInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o})=>{const l=callOrReturn(t.getAttributes,void 0,o);if(l===!1||l===null)return null;const{tr:d}=e,f=o[o.length-1],g=o[0];if(f){const b=g.search(/\S/),_=n.from+g.indexOf(f),S=_+f.length;if(getMarksBetween(n.from,n.to,e.doc).filter(E=>E.mark.type.excluded.find(I=>I===t.type&&I!==E.mark.type)).filter(E=>E.to>_).length)return null;S<n.to&&d.delete(S,n.to),_>n.from&&d.delete(n.from+b,_);const C=n.from+b+f.length;d.addMark(n.from+b,C,t.type.create(l||{})),d.removeStoredMark(t.type)}}})}function nodeInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o})=>{const l=callOrReturn(t.getAttributes,void 0,o)||{},{tr:d}=e,f=n.from;let g=n.to;const b=t.type.create(l);if(o[1]){const _=o[0].lastIndexOf(o[1]);let S=f+_;S>g?S=g:g=S+o[1].length;const R=o[0][o[0].length-1];d.insertText(R,f+o[0].length-1),d.replaceWith(S,g,b)}else if(o[0]){const _=t.type.isInline?f:f-1;d.insert(_,t.type.create(l)).delete(d.mapping.map(f),d.mapping.map(g))}d.scrollIntoView()}})}function textblockTypeInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o})=>{const l=e.doc.resolve(n.from),d=callOrReturn(t.getAttributes,void 0,o)||{};if(!l.node(-1).canReplaceWith(l.index(-1),l.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,d)}})}function wrappingInputRule(t){return new InputRule({find:t.find,handler:({state:e,range:n,match:o,chain:l})=>{const d=callOrReturn(t.getAttributes,void 0,o)||{},f=e.tr.delete(n.from,n.to),b=f.doc.resolve(n.from).blockRange(),_=b&&findWrapping(b,t.type,d);if(!_)return null;if(f.wrap(b,_),t.keepMarks&&t.editor){const{selection:R,storedMarks:C}=e,{splittableMarks:E}=t.editor.extensionManager,A=C||R.$to.parentOffset&&R.$from.marks();if(A){const I=A.filter(M=>E.includes(M.type.name));f.ensureMarks(I)}}if(t.keepAttributes){const R=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";l().updateAttributes(R,d).run()}const S=f.doc.resolve(n.from-1).nodeBefore;S&&S.type===t.type&&canJoin(f.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,S))&&f.join(n.from-1)}})}let Node$1=class Sn{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Sn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>mergeDeep(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Sn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=callOrReturn(getExtensionField(n,"addOptions",{name:n.name})),n.storage=callOrReturn(getExtensionField(n,"addStorage",{name:n.name,options:n.options})),n}};function markPasteRule(t){return new PasteRule({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:l})=>{const d=callOrReturn(t.getAttributes,void 0,o,l);if(d===!1||d===null)return null;const{tr:f}=e,g=o[o.length-1],b=o[0];let _=n.to;if(g){const S=b.search(/\S/),R=n.from+b.indexOf(g),C=R+g.length;if(getMarksBetween(n.from,n.to,e.doc).filter(A=>A.mark.type.excluded.find(M=>M===t.type&&M!==A.mark.type)).filter(A=>A.to>R).length)return null;C<n.to&&f.delete(C,n.to),R>n.from&&f.delete(n.from+S,R),_=n.from+S+g.length,f.addMark(n.from+S,_,t.type.create(d||{})),f.removeStoredMark(t.type)}}})}function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var shim={exports:{}},useSyncExternalStoreShim_production_min={};/**
|
|
1228
1228
|
* @license React
|
|
1229
1229
|
* use-sync-external-store-shim.production.min.js
|
|
1230
1230
|
*
|
|
@@ -1314,4 +1314,6 @@ img.ProseMirror-separator {
|
|
|
1314
1314
|
.ProseMirror p {
|
|
1315
1315
|
margin-bottom: 0.5em;
|
|
1316
1316
|
}
|
|
1317
|
-
`;function RichTextEditor({id:t,name:e,value:n,onChange:o,placeholder:l,className:d,...f}){const[g,b]=React.useState(!1),_=React.useRef(null),S=React.useRef(null),R=useEditor({extensions:[StarterKit,Underline],content:n,editorProps:{attributes:{class:"prose prose-sm sm:prose dark:prose-invert focus:outline-none",id:t??"",name:e??""}},onUpdate:({editor:j})=>{const q=j.getHTML();o({target:{id:t,name:e,value:q}})}});React.useEffect(()=>{R&&n!==R.getHTML()&&R.commands.setContent(n)},[n,R]);const C=React.useCallback(j=>{if(R)if(R.chain().focus(),j==="paragraph")R.chain().setParagraph().run();else{const q=Number.parseInt(j.slice(1));R.chain().setHeading({level:q}).run()}},[R]),E=React.useCallback(j=>{if(R)switch(R.chain().focus(),j){case"bold":R.chain().toggleBold().run();break;case"italic":R.chain().toggleItalic().run();break;case"underline":R.chain().toggleUnderline().run();break;case"strike":R.chain().toggleStrike().run();break;case"bulletList":R.chain().toggleBulletList().run();break;case"orderedList":R.chain().toggleOrderedList().run();break}},[R]),A=React.useCallback(()=>{b(j=>!j)},[]),I=React.useCallback(j=>{const q=j.target.value;R&&R.commands.setContent(q),o({target:{id:t,name:e,value:q}})},[o,R,t,e]),M=React.useCallback(()=>{!g&&R&&R.commands.focus()},[g,R]);return R?jsxRuntime.jsxs("div",{ref:S,className:cn("border border-input rounded-md overflow-hidden focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring",d),onClick:M,...f,children:[jsxRuntime.jsx("style",{children:editorStyles}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center p-2 border-b border-input gap-2 bg-background",children:[jsxRuntime.jsxs(Select,{onValueChange:C,disabled:g,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[160px]",children:jsxRuntime.jsx(SelectValue,{placeholder:"Format"})}),jsxRuntime.jsx(SelectContent,{children:formatOptions.map(j=>jsxRuntime.jsx(SelectItem,{value:j.value,children:j.label},j.value))})]}),["bold","italic","underline","strike","bulletList","orderedList"].map(j=>jsxRuntime.jsxs(Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(j),className:R.isActive(j)?"bg-muted":"",disabled:g,children:[j==="bold"&&jsxRuntime.jsx(Bold$1,{className:"h-4 w-4"}),j==="italic"&&jsxRuntime.jsx(Italic$1,{className:"h-4 w-4"}),j==="underline"&&jsxRuntime.jsx(Underline$1,{className:"h-4 w-4"}),j==="strike"&&jsxRuntime.jsx(Strikethrough,{className:"h-4 w-4"}),j==="bulletList"&&jsxRuntime.jsx(List$1,{className:"h-4 w-4"}),j==="orderedList"&&jsxRuntime.jsx(ListOrdered,{className:"h-4 w-4"})]},j)),jsxRuntime.jsx(Button,{type:"button",variant:"ghost",size:"sm",onClick:A,className:g?"bg-muted":"",children:jsxRuntime.jsx(Code$1,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"p-3",children:g?jsxRuntime.jsx(Textarea,{ref:_,id:t,name:e,value:R.getHTML(),onChange:I,className:cn("min-h-[150px] font-mono text-sm resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",d),placeholder:l}):jsxRuntime.jsx(EditorContent,{editor:R})})]}):null}function formatYYYYMMDDIntToDateString$1(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function OrdersTable({orders:t=null,loading:e=!1,title:n="Order Details"}){const o=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:f})=>f.original.DocumentNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:f})=>formatYYYYMMDDIntToDateString$1(f.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:f})=>f.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>f.original.UnitPrice?formatMoney(f.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(C=>C.WarehouseCode).filter(C=>C!=null)));f.WarehouseCode=g;const b=Array.from(new Set(t.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=b;const _=Array.from(new Set(t.map(C=>C.DocumentNumber).filter(C=>C!=null)));f.DocumentNumber=_;const S=Array.from(new Set(t.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=S;const R=Array.from(new Set(t.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=R}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function formatYYYYMMDDIntToDateString(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function ReceiptsTable({receipts:t=null,loading:e=!1,title:n="Latest Warehouse Receivings"}){const o=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(_=>_.Location).filter(_=>_!=null)));f.Location=g;const b=Array.from(new Set(t.map(_=>formatYYYYMMDDIntToDateString(_.ReceiptDate)).filter(_=>_!=="N/A"&&_!=="Invalid Date"))).sort((_,S)=>new Date(S).getTime()-new Date(_).getTime());f.ReceiptDate=b}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-56"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}const formatDate$1=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}},getStatusVariant=t=>{const e=(t==null?void 0:t.toLowerCase())||"";return e.includes("accepted")?"success":e.includes("error")||e.includes("rejected")?"destructive":"neutral"};function ReturnsTable({applicationId:t,returns:e=null,loading:n=!1}){const o=React.useMemo(()=>[{accessorKey:"ReturnNumber1",header:"RMA Number",cell:({row:f})=>{const g=f.original.ReturnNumber1||f.original.ReturnNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Return/${g}`,className:"font-medium text-blue-600 hover:underline dark:text-blue-400",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for return ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"RequestDate",header:"Request Date",cell:({row:f})=>formatDate$1(f.original.RequestDate),enableSorting:!0},{accessorKey:"InvoiceNumber",header:"Invoice Number",cell:({row:f})=>{const g=f.original.InvoiceNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g}`,className:"text-blue-600 hover:underline dark:text-blue-400",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for invoice ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"0",enableSorting:!0},{accessorKey:"ReasonForReturn",header:"Return Reason",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ReasonForReturn??"—"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"Status",header:"Status",cell:({row:f})=>{const g=f.original.Status,b=getStatusVariant(g);let _="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return b==="success"?_="border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400":b==="destructive"&&(_="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400"),g?jsxRuntime.jsx(Badge,{variant:"outline",className:`${_} font-medium`,children:g}):"—"},enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseLocation",header:"Warehouse",cell:({row:f})=>f.original.WarehouseLocation??"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"LastUpdatedDate",header:"Last Update",cell:({row:f})=>formatDate$1(f.original.LastUpdatedDate)!=="N/A"?formatDate$1(f.original.LastUpdatedDate):"—",enableSorting:!0}],[t]),l=React.useMemo(()=>{const f={};if(e){const g=Array.from(new Set(e.map(S=>S.Status).filter(Boolean)));f.Status=g;const b=Array.from(new Set(e.map(S=>S.ReasonForReturn).filter(Boolean)));f.ReasonForReturn=b;const _=Array.from(new Set(e.map(S=>S.WarehouseLocation).filter(Boolean)));f.WarehouseLocation=_}return f},[e]),d=React.useMemo(()=>e?[...e].sort((g,b)=>(b.ReturnNumber1||b.ReturnNumber||"").localeCompare(g.ReturnNumber1||g.ReturnNumber||"")):[],[e]);return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):!d||d.length===0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Returns"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"flex justify-center items-center h-24",children:jsxRuntime.jsx("p",{className:"text-muted-foreground",children:"There are no returns to display."})})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Returns"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var C,E,A,I,M,j,q,z,Q;const{data:g,isLoading:b}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!1},{skip:!t||!e}),{data:_,isLoading:S}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!0},{skip:!g}),R=(g==null?void 0:g.ManufacturerId)!==t;return console.log("readonly",R),jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @sm:grid-cols-2 @md:grid-cols-3",children:[jsxRuntime.jsx("div",{className:"@md:col-span-2",children:jsxRuntime.jsx(ProductCard,{applicationId:t,product:_||g,defaultOpportunityNumber:n,onAddToCart:o,addingToCart:l,shopifyHostname:d,customAction:f})}),jsxRuntime.jsxs(Card,{className:"flex flex-col",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{children:[jsxRuntime.jsx(Info,{className:"h-5 w-5 inline mr-2"})," Additionnal information"]})}),jsxRuntime.jsx(CardContent,{className:"basis-0 grow overflow-y-auto",children:b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-1 w-full my-6"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-1"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Cateory Name"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.ProductType)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Master Carton"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.MasterCarton)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Skid Quantity"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.SkidQuantity)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Automatic Reorder"}),jsxRuntime.jsx("span",{className:"font-medium",children:g!=null&&g.AutoUpdate?"Yes":"No"})]}),((g==null?void 0:g.VoiceoverCaption)||(g==null?void 0:g.BodyHTML))&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("hr",{className:"my-6"}),jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2",children:"Description"}),(g==null?void 0:g.VoiceoverCaption)&&jsxRuntime.jsx("div",{children:g==null?void 0:g.VoiceoverCaption}),(g==null?void 0:g.BodyHTML)&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:(g==null?void 0:g.BodyHTML)??""}})]})]})})]})]}),jsxRuntime.jsx("div",{className:"my-4",children:b?jsxRuntime.jsx("div",{className:"mx-auto flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})}):jsxRuntime.jsxs(Tabs,{defaultValue:"stats",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[jsxRuntime.jsx(TabsTrigger,{value:"stats",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((C=_==null?void 0:_.SalesStatistics)==null?void 0:C.length)??0)<=0,children:"Statistics"}),jsxRuntime.jsx(TabsTrigger,{value:"opportunities",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((E=_==null?void 0:_.Opportunities)==null?void 0:E.length)??0)<=0,children:"Opportunities"}),jsxRuntime.jsx(TabsTrigger,{value:"orders",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((A=_==null?void 0:_.ActiveOrderDetails)==null?void 0:A.length)??0)<=0&&(((I=_==null?void 0:_.CompletedOrderDetails)==null?void 0:I.length)??0)<=0&&(((M=_==null?void 0:_.Returns)==null?void 0:M.length)??0)<=0,children:"Orders"}),jsxRuntime.jsx(TabsTrigger,{value:"warehouse",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((j=_==null?void 0:_.Receipts)==null?void 0:j.length)??0)<=0,children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChart,{salesData:(_==null?void 0:_.SalesStatistics)??[],isLoading:S,units:""})})}),jsxRuntime.jsx(TabsContent,{value:"opportunities",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:g==null?void 0:g.Opportunities,loading:b})})}),jsxRuntime.jsxs(TabsContent,{value:"orders",children:[(S||((q=_==null?void 0:_.ActiveOrderDetails)==null?void 0:q.length)!==0)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Open Orders",orders:_==null?void 0:_.ActiveOrderDetails,loading:S})}),(S||((z=_==null?void 0:_.CompletedOrderDetails)==null?void 0:z.length)!==0)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Completed Orders",orders:_==null?void 0:_.CompletedOrderDetails,loading:S})}),(S||((Q=_==null?void 0:_.CompletedOrderDetails)==null?void 0:Q.length)!==0)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:_==null?void 0:_.Returns,loading:S})})]}),jsxRuntime.jsx(TabsContent,{value:"warehouse",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReceiptsTable,{receipts:_==null?void 0:_.Receipts,loading:S})})})]})})]})}function AssistantChat(t){return jsxRuntime.jsx(Card,{className:"max-w-6xl",children:jsxRuntime.jsx(ChatLayout,{className:"h-[40em]",userId:t.userId,userName:t.userName,assistantOnly:!0,initialPrompt:t.initialPrompt})})}function getEndDateStatus(t){if(!t)return{text:"No End Date",variant:"neutral",daysRemaining:null};const e=new Date(t);if(isNaN(e.getTime()))return{text:"Invalid Date",variant:"neutral",daysRemaining:null};const n=new Date,o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),d=o.getTime()-l.getTime(),f=Math.ceil(d/(1e3*60*60*24));return f<0?{text:`Ended ${Math.abs(f)}d ago`,variant:"destructive",daysRemaining:f}:f===0?{text:"Ends today",variant:"destructive",daysRemaining:f}:f<=7?{text:`Ends in ${f}d`,variant:"destructive",daysRemaining:f}:f<=30?{text:`Ends in ${f}d`,variant:"warning",daysRemaining:f}:{text:`Ends in ${f}d`,variant:"neutral",daysRemaining:f}}const formatDate=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}};function OpportunitiesTable({applicationId:t,opportunities:e=null,loading:n=!1}){var te;const{toast:o}=useToast(),[l,d]=React.useState({}),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,R]=React.useState(null),{data:C}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t}),E=React.useCallback((ne,se,ge)=>{d(oe=>({...oe,[ne]:{...oe[ne],[se]:ge}}))},[]),[A]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),I=React.useCallback(async ne=>{if(!(C!=null&&C.IsReseller))return;if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot set default.",variant:"destructive"});return}const se=ne.BidNumber;E(se,"isSettingDefault",!0),A({routeResellerId:t,manufacturerId:ne.ManufacturerId??"",opportunityNumber:se}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${ne.OpportunityName||ne.Opportunity||se}" was successfully set as default.`,variant:"success"})}).catch(ge=>{var oe;console.error("Set as default error:",ge),o({title:"Error",description:((oe=ge.data)==null?void 0:oe.message)||ge.message||"An error occurred while setting this opportunity as default.",variant:"destructive"})}).finally(()=>{E(se,"isSettingDefault",!1)})},[t,A,o,E]),[M]=usePostV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmailMutation(),j=React.useCallback(ne=>{if(C!=null&&C.IsReseller){if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot prepare report.",variant:"destructive"});return}R(ne),_(""),g(!0)}},[o]),q=React.useCallback(async()=>{if(!(C!=null&&C.IsReseller))return;if(!S||!S.BidNumber){o({title:"Error",description:"No opportunity selected or Bid Number is missing.",variant:"destructive"});return}if(!b.trim()||!/\S+@\S+\.\S+/.test(b)){o({title:"Validation Error",description:"Please enter a valid email address.",variant:"destructive"});return}const ne=S.BidNumber;E(ne,"isSendingReport",!0),M({routeResellerId:t,manufacturerId:S.ManufacturerId??"",bidNumber:ne,emailAddress:b}).unwrap().then(()=>{o({title:"Success",description:`A report for "${S.OpportunityName||S.Opportunity||ne}" was successfully sent to ${b}.`,variant:"success"}),g(!1)}).catch(se=>{var ge;console.error("Send report by email error:",se),o({title:"Error",description:((ge=se.data)==null?void 0:ge.message)||se.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{E(ne,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,M,o,E,g]),z=React.useMemo(()=>[{accessorKey:"ManufacturerId",header:"Manuf.",cell:({row:ne})=>jsxRuntime.jsx("div",{className:"w-20 h-8",children:jsxRuntime.jsx(PartnerLogo,{id:ne.original.ManufacturerId,width:80,height:32})}),enableSorting:!0,enableFiltering:!0},{id:"opportunityDisplay",accessorFn:ne=>ne.OpportunityName||ne.Opportunity,header:"Opportunity",cell:({getValue:ne})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:ne()??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"BidNumber",header:"Bid Number",cell:({row:ne})=>ne.original.BidNumber??"N/A",enableSorting:!0,enableFiltering:!0},{id:"statusInfo",header:"Status",cell:({row:ne})=>{const se=ne.original,ge=se.Active===!0,oe=getEndDateStatus(se.EndDate);let Ae="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return oe.variant==="destructive"?Ae="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400":oe.variant==="warning"&&(Ae="border-yellow-500 bg-yellow-100 text-yellow-700 dark:border-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400"),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 min-w-[200px]",children:[jsxRuntime.jsx(Badge,{variant:"outline",className:ge?"border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400 font-medium":"border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400 font-medium",children:ge?"Active":"Inactive"}),se.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${Ae} font-medium`,children:oe.text}),jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent",children:jsxRuntime.jsx(Info,{className:"h-4 w-4 text-muted-foreground"})})}),jsxRuntime.jsx(TooltipContent,{side:"top",align:"center",className:"bg-popover text-popover-foreground p-2 rounded shadow-lg",children:jsxRuntime.jsxs("div",{className:"text-sm space-y-1",children:[jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Start:"})," ",formatDate(se.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(se.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(se.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:ne})=>{var Oe,Fe;const se=ne.original;if(!se.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const ge=se.BidNumber,oe=(Oe=l[ge])==null?void 0:Oe.isSettingDefault,Ae=(S==null?void 0:S.BidNumber)===ge&&((Fe=l[ge])==null?void 0:Fe.isSendingReport),je=oe||Ae,Ne=se.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`/${t}/Opportunity/${se.ManufacturerId}/${se.BidNumber}`,children:jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center",children:[jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," View"]})}),(C==null?void 0:C.IsReseller)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>I(se),disabled:je||!Ne,title:Ne?"Set as default":"This opportunity cannot be set as default",className:"flex items-center",children:[oe?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," Set Default"]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>j(se),disabled:je,title:"Send report by email",className:"flex items-center",children:[Ae?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"})," Send Report"]})]})]})}}],[l,I,j,S]),Q=React.useMemo(()=>{const ne={};if(e){const se=Array.from(new Set(e.map(oe=>oe.ManufacturerId).filter(oe=>oe!=null)));ne.ManufacturerId=se;const ge=Array.from(new Set(e.map(oe=>oe.OpportunityName||oe.Opportunity).filter(oe=>oe!=null)));ne.opportunityDisplay=ge}return ne},[e]),F=e||[],V=S!=null&&S.BidNumber?(te=l[S.BidNumber])==null?void 0:te.isSendingReport:!1;return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Opportunities"})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:z,data:F,uniqueValues:Q})})]}),jsxRuntime.jsx(Dialog,{open:f,onOpenChange:ne=>{g(ne),ne||(R(null),_(""))},children:jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Opportunity Report"}),jsxRuntime.jsxs(DialogDescription,{children:["Enter the email address to send the report for opportunity: ",jsxRuntime.jsx("br",{}),jsxRuntime.jsx("span",{className:"font-semibold",children:(S==null?void 0:S.OpportunityName)||(S==null?void 0:S.Opportunity)||"N/A"}),(S==null?void 0:S.BidNumber)&&jsxRuntime.jsxs("span",{className:"block text-sm text-muted-foreground",children:["Bid Number: ",S.BidNumber]})]})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:b,onChange:ne=>_(ne.target.value),placeholder:"recipient@example.com",className:"col-span-3",disabled:V})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:V,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:q,disabled:V,children:[V&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function SalesChart({salesData:t,chartHeight:e=300,units:n="$",unitsPosition:o="left",className:l,isLoading:d=!1}){const[f,g]=React.useState([]),[b,_]=React.useState(!1),S=!d;return React.useEffect(()=>{if(d){g([]);return}const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),I=`${C}-${(E+1).toString().padStart(2,"0")}`,M=[];for(let Q=11;Q>=0;Q--){const F=new Date(C,E-Q,1),V=F.getFullYear(),te=(F.getMonth()+1).toString().padStart(2,"0");M.push(`${V}-${te}`)}const j={};M.forEach(Q=>{j[Q]=0}),t&&t.length>0&&t.forEach(Q=>{const F=Q.Day??0,V=Math.floor(F).toString();if(V.length!==8||isNaN(Number.parseInt(V))){console.warn(`Skipping invalid Day format: ${Q.Day}`);return}const te=V.substring(0,4),ne=V.substring(4,6),se=`${te}-${ne}`;M.includes(se)&&(j[se]=(j[se]||0)+(Q.ExtendedPrice??0))});const q={...j};if(b&&j[I]>0){const Q=q[I],F=new Date(C,E+1,0).getDate();if(A<F&&A>0){const te=Q/A*F;q[I]=te}}const z=M.map(Q=>{const F=q[Q],[V,te]=Q.split("-").map(Number);return{month:new Date(V,te-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:F}});g(z)},[t,b,d]),d?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:e},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"})]}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-3/4 mt-1"})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsx(CardContent,{children:f.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:e,className:l}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Switch,{checked:b,onCheckedChange:_,id:"extrapolate-switch","aria-label":"Toggle sales extrapolation"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"* Sales for the current month are projected, not actual."})]})]}):jsxRuntime.jsx("div",{style:{height:e},className:l||"p-4 text-center text-muted-foreground flex items-center justify-center",children:"No sales data available."})})]})}exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.Topbar=Topbar,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1317
|
+
`;function RichTextEditor({id:t,name:e,value:n,onChange:o,placeholder:l,className:d,...f}){const[g,b]=React.useState(!1),_=React.useRef(null),S=React.useRef(null),R=useEditor({extensions:[StarterKit,Underline],content:n,editorProps:{attributes:{class:"prose prose-sm sm:prose dark:prose-invert focus:outline-none",id:t??"",name:e??""}},onUpdate:({editor:j})=>{const q=j.getHTML();o({target:{id:t,name:e,value:q}})}});React.useEffect(()=>{R&&n!==R.getHTML()&&R.commands.setContent(n)},[n,R]);const C=React.useCallback(j=>{if(R)if(R.chain().focus(),j==="paragraph")R.chain().setParagraph().run();else{const q=Number.parseInt(j.slice(1));R.chain().setHeading({level:q}).run()}},[R]),E=React.useCallback(j=>{if(R)switch(R.chain().focus(),j){case"bold":R.chain().toggleBold().run();break;case"italic":R.chain().toggleItalic().run();break;case"underline":R.chain().toggleUnderline().run();break;case"strike":R.chain().toggleStrike().run();break;case"bulletList":R.chain().toggleBulletList().run();break;case"orderedList":R.chain().toggleOrderedList().run();break}},[R]),A=React.useCallback(()=>{b(j=>!j)},[]),I=React.useCallback(j=>{const q=j.target.value;R&&R.commands.setContent(q),o({target:{id:t,name:e,value:q}})},[o,R,t,e]),M=React.useCallback(()=>{!g&&R&&R.commands.focus()},[g,R]);return R?jsxRuntime.jsxs("div",{ref:S,className:cn("border border-input rounded-md overflow-hidden focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring",d),onClick:M,...f,children:[jsxRuntime.jsx("style",{children:editorStyles}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center p-2 border-b border-input gap-2 bg-background",children:[jsxRuntime.jsxs(Select,{onValueChange:C,disabled:g,children:[jsxRuntime.jsx(SelectTrigger,{className:"w-[160px]",children:jsxRuntime.jsx(SelectValue,{placeholder:"Format"})}),jsxRuntime.jsx(SelectContent,{children:formatOptions.map(j=>jsxRuntime.jsx(SelectItem,{value:j.value,children:j.label},j.value))})]}),["bold","italic","underline","strike","bulletList","orderedList"].map(j=>jsxRuntime.jsxs(Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>E(j),className:R.isActive(j)?"bg-muted":"",disabled:g,children:[j==="bold"&&jsxRuntime.jsx(Bold$1,{className:"h-4 w-4"}),j==="italic"&&jsxRuntime.jsx(Italic$1,{className:"h-4 w-4"}),j==="underline"&&jsxRuntime.jsx(Underline$1,{className:"h-4 w-4"}),j==="strike"&&jsxRuntime.jsx(Strikethrough,{className:"h-4 w-4"}),j==="bulletList"&&jsxRuntime.jsx(List$1,{className:"h-4 w-4"}),j==="orderedList"&&jsxRuntime.jsx(ListOrdered,{className:"h-4 w-4"})]},j)),jsxRuntime.jsx(Button,{type:"button",variant:"ghost",size:"sm",onClick:A,className:g?"bg-muted":"",children:jsxRuntime.jsx(Code$1,{className:"h-4 w-4"})})]}),jsxRuntime.jsx("div",{className:"p-3",children:g?jsxRuntime.jsx(Textarea,{ref:_,id:t,name:e,value:R.getHTML(),onChange:I,className:cn("min-h-[150px] font-mono text-sm resize-none border-0 focus-visible:ring-0 focus-visible:ring-offset-0",d),placeholder:l}):jsxRuntime.jsx(EditorContent,{editor:R})})]}):null}function formatYYYYMMDDIntToDateString$1(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function OrdersTable({orders:t=null,loading:e=!1,title:n="Order Details"}){const o=React.useMemo(()=>[{accessorKey:"DocumentNumber",header:"Document Number",cell:({row:f})=>f.original.DocumentNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"DocumentDate",header:"Document Date",cell:({row:f})=>formatYYYYMMDDIntToDateString$1(f.original.DocumentDate),enableSorting:!0,enableFiltering:!1},{accessorKey:"OrderNumber",header:"Order Number",cell:({row:f})=>f.original.OrderNumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"PONumber",header:"PO Number",cell:({row:f})=>f.original.PONumber??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseCode",header:"Warehouse",cell:({row:f})=>f.original.WarehouseCode??"N/A",enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!1},{accessorKey:"ShipToName",header:"Name",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ShipToName??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"UnitPrice",header:"Unit Price",cell:({row:f})=>f.original.UnitPrice?formatMoney(f.original.UnitPrice):"N/A",enableSorting:!0,enableFiltering:!1}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(C=>C.WarehouseCode).filter(C=>C!=null)));f.WarehouseCode=g;const b=Array.from(new Set(t.map(C=>C.ShipToName).filter(C=>C!=null)));f.ShipToName=b;const _=Array.from(new Set(t.map(C=>C.DocumentNumber).filter(C=>C!=null)));f.DocumentNumber=_;const S=Array.from(new Set(t.map(C=>C.OrderNumber).filter(C=>C!=null)));f.OrderNumber=S;const R=Array.from(new Set(t.map(C=>C.PONumber).filter(C=>C!=null)));f.PONumber=R}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function formatYYYYMMDDIntToDateString(t){if(t===null||typeof t>"u")return"N/A";const e=t.toString();return e.length===8?`${e.substring(0,4)}-${e.substring(4,6)}-${e.substring(6,8)}`:e}function ReceiptsTable({receipts:t=null,loading:e=!1,title:n="Latest Warehouse Receivings"}){const o=React.useMemo(()=>[{accessorKey:"Location",header:"Location",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.Location??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"ReceiptDate",header:"Date",cell:({row:f})=>formatYYYYMMDDIntToDateString(f.original.ReceiptDate),enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"N/A",enableSorting:!0,enableFiltering:!0}],[]),l=React.useMemo(()=>{const f={};if(t){const g=Array.from(new Set(t.map(_=>_.Location).filter(_=>_!=null)));f.Location=g;const b=Array.from(new Set(t.map(_=>formatYYYYMMDDIntToDateString(_.ReceiptDate)).filter(_=>_!=="N/A"&&_!=="Invalid Date"))).sort((_,S)=>new Date(S).getTime()-new Date(_).getTime());f.ReceiptDate=b}return f},[t]),d=t||[];return e?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-56"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-10 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:n})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}const formatDate$1=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}},getStatusVariant=t=>{const e=(t==null?void 0:t.toLowerCase())||"";return e.includes("accepted")?"success":e.includes("error")||e.includes("rejected")?"destructive":"neutral"};function ReturnsTable({applicationId:t,returns:e=null,loading:n=!1}){const o=React.useMemo(()=>[{accessorKey:"ReturnNumber1",header:"RMA Number",cell:({row:f})=>{const g=f.original.ReturnNumber1||f.original.ReturnNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Return/${g}`,className:"font-medium text-blue-600 hover:underline dark:text-blue-400",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for return ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"RequestDate",header:"Request Date",cell:({row:f})=>formatDate$1(f.original.RequestDate),enableSorting:!0},{accessorKey:"InvoiceNumber",header:"Invoice Number",cell:({row:f})=>{const g=f.original.InvoiceNumber;return g?jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(reactRouterDom.Link,{to:`/${t}/Document/${g}`,className:"text-blue-600 hover:underline dark:text-blue-400",children:g})}),jsxRuntime.jsx(TooltipContent,{children:jsxRuntime.jsxs("p",{children:["View details for invoice ",g]})})]})}):"N/A"},enableSorting:!0,enableFiltering:!0},{accessorKey:"Quantity",header:"Quantity",cell:({row:f})=>f.original.Quantity??"0",enableSorting:!0},{accessorKey:"ReasonForReturn",header:"Return Reason",cell:({row:f})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:f.original.ReasonForReturn??"—"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"Status",header:"Status",cell:({row:f})=>{const g=f.original.Status,b=getStatusVariant(g);let _="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return b==="success"?_="border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400":b==="destructive"&&(_="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400"),g?jsxRuntime.jsx(Badge,{variant:"outline",className:`${_} font-medium`,children:g}):"—"},enableSorting:!0,enableFiltering:!0},{accessorKey:"WarehouseLocation",header:"Warehouse",cell:({row:f})=>f.original.WarehouseLocation??"—",enableSorting:!0,enableFiltering:!0},{accessorKey:"LastUpdatedDate",header:"Last Update",cell:({row:f})=>formatDate$1(f.original.LastUpdatedDate)!=="N/A"?formatDate$1(f.original.LastUpdatedDate):"—",enableSorting:!0}],[t]),l=React.useMemo(()=>{const f={};if(e){const g=Array.from(new Set(e.map(S=>S.Status).filter(Boolean)));f.Status=g;const b=Array.from(new Set(e.map(S=>S.ReasonForReturn).filter(Boolean)));f.ReasonForReturn=b;const _=Array.from(new Set(e.map(S=>S.WarehouseLocation).filter(Boolean)));f.WarehouseLocation=_}return f},[e]),d=React.useMemo(()=>e?[...e].sort((g,b)=>(b.ReturnNumber1||b.ReturnNumber||"").localeCompare(g.ReturnNumber1||g.ReturnNumber||"")):[],[e]);return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"}),jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):!d||d.length===0?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Returns"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx("div",{className:"flex justify-center items-center h-24",children:jsxRuntime.jsx("p",{className:"text-muted-foreground",children:"There are no returns to display."})})})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Returns"})}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:o,data:d,uniqueValues:l})})]})}function ProductOverviewPage({applicationId:t,sku:e,productDefaultOpportunityNumber:n="",productOnAddToCart:o,productAddingToCart:l=!1,productShopifyHostname:d,productCustomAction:f=jsxRuntime.jsx(jsxRuntime.Fragment,{})}){var C,E,A,I,M,j,q,z,Q;const{data:g,isLoading:b}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!1},{skip:!t||!e}),{data:_,isLoading:S}=useGetV4PartnerByRouteApplicationIdProductAndRandmarSkuQuery({routeApplicationId:t,randmarSku:e,withSpecification:!0},{skip:!g}),R=(g==null?void 0:g.ManufacturerId)!==t;return console.log("readonly",R),jsxRuntime.jsxs("div",{className:"@container",children:[jsxRuntime.jsxs("div",{className:"grid gap-4 grid-cols-1 @sm:grid-cols-2 @md:grid-cols-3",children:[jsxRuntime.jsx("div",{className:"@md:col-span-2",children:jsxRuntime.jsx(ProductCard,{applicationId:t,product:_||g,defaultOpportunityNumber:n,onAddToCart:o,addingToCart:l,shopifyHostname:d,customAction:f})}),jsxRuntime.jsxs(Card,{className:"flex flex-col",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsxs(CardTitle,{children:[jsxRuntime.jsx(Info,{className:"h-5 w-5 inline mr-2"})," Additionnal information"]})}),jsxRuntime.jsx(CardContent,{className:"basis-0 grow overflow-y-auto",children:b?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-32"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"})]}),jsxRuntime.jsx(Skeleton,{className:"h-1 w-full my-6"}),jsxRuntime.jsx(Skeleton,{className:"h-5 w-24"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-2"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-full mt-1"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Cateory Name"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.ProductType)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Master Carton"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.MasterCarton)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Skid Quantity"}),jsxRuntime.jsx("span",{className:"font-medium",children:(g==null?void 0:g.SkidQuantity)||"N/A"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between mt-2",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Automatic Reorder"}),jsxRuntime.jsx("span",{className:"font-medium",children:g!=null&&g.AutoUpdate?"Yes":"No"})]}),((g==null?void 0:g.VoiceoverCaption)||(g==null?void 0:g.BodyHTML))&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("hr",{className:"my-6"}),jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2",children:"Description"}),(g==null?void 0:g.VoiceoverCaption)&&jsxRuntime.jsx("div",{children:g==null?void 0:g.VoiceoverCaption}),(g==null?void 0:g.BodyHTML)&&jsxRuntime.jsx("div",{className:"prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:(g==null?void 0:g.BodyHTML)??""}})]})]})})]})]}),jsxRuntime.jsx("div",{className:"my-4",children:b?jsxRuntime.jsx("div",{className:"mx-auto flex justify-center items-center h-32",children:jsxRuntime.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin text-primary"})}):jsxRuntime.jsxs(Tabs,{defaultValue:"stats",children:[jsxRuntime.jsxs(TabsList,{className:"inline-flex h-auto items-center justify-center rounded-none border-b bg-transparent p-0",children:[jsxRuntime.jsx(TabsTrigger,{value:"stats",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((C=_==null?void 0:_.SalesStatistics)==null?void 0:C.length)??0)<=0,children:"Statistics"}),jsxRuntime.jsx(TabsTrigger,{value:"opportunities",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((E=_==null?void 0:_.Opportunities)==null?void 0:E.length)??0)<=0,children:"Opportunities"}),jsxRuntime.jsx(TabsTrigger,{value:"orders",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((A=_==null?void 0:_.ActiveOrderDetails)==null?void 0:A.length)??0)<=0&&(((I=_==null?void 0:_.CompletedOrderDetails)==null?void 0:I.length)??0)<=0&&(((M=_==null?void 0:_.Returns)==null?void 0:M.length)??0)<=0,children:"Orders"}),jsxRuntime.jsx(TabsTrigger,{value:"warehouse",className:"relative h-12 rounded-none border-b-2 border-b-transparent bg-transparent px-4 pb-3 pt-2 text-sm font-medium text-muted-foreground shadow-none transition-none hover:text-foreground data-[state=active]:border-b-primary data-[state=active]:text-foreground data-[state=active]:shadow-none cursor-pointer",disabled:!S&&(((j=_==null?void 0:_.Receipts)==null?void 0:j.length)??0)<=0,children:"Latest Warehouse Receiving"})]}),jsxRuntime.jsx(TabsContent,{value:"stats",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(SalesChart,{salesData:(_==null?void 0:_.SalesStatistics)??[],isLoading:S,units:""})})}),jsxRuntime.jsx(TabsContent,{value:"opportunities",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OpportunitiesTable,{applicationId:t,opportunities:g==null?void 0:g.Opportunities,loading:b})})}),jsxRuntime.jsxs(TabsContent,{value:"orders",children:[(S||((q=_==null?void 0:_.ActiveOrderDetails)==null?void 0:q.length)!==0)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Open Orders",orders:_==null?void 0:_.ActiveOrderDetails,loading:S})}),(S||((z=_==null?void 0:_.CompletedOrderDetails)==null?void 0:z.length)!==0)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(OrdersTable,{title:"Completed Orders",orders:_==null?void 0:_.CompletedOrderDetails,loading:S})}),(S||((Q=_==null?void 0:_.CompletedOrderDetails)==null?void 0:Q.length)!==0)&&jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReturnsTable,{applicationId:t,returns:_==null?void 0:_.Returns,loading:S})})]}),jsxRuntime.jsx(TabsContent,{value:"warehouse",children:jsxRuntime.jsx("div",{className:"mt-4",children:jsxRuntime.jsx(ReceiptsTable,{receipts:_==null?void 0:_.Receipts,loading:S})})})]})})]})}function AssistantChat(t){return jsxRuntime.jsx(Card,{className:"max-w-6xl",children:jsxRuntime.jsx(ChatLayout,{className:"h-[40em]",userId:t.userId,userName:t.userName,assistantOnly:!0,initialPrompt:t.initialPrompt})})}function getEndDateStatus(t){if(!t)return{text:"No End Date",variant:"neutral",daysRemaining:null};const e=new Date(t);if(isNaN(e.getTime()))return{text:"Invalid Date",variant:"neutral",daysRemaining:null};const n=new Date,o=new Date(e.getFullYear(),e.getMonth(),e.getDate()),l=new Date(n.getFullYear(),n.getMonth(),n.getDate()),d=o.getTime()-l.getTime(),f=Math.ceil(d/(1e3*60*60*24));return f<0?{text:`Ended ${Math.abs(f)}d ago`,variant:"destructive",daysRemaining:f}:f===0?{text:"Ends today",variant:"destructive",daysRemaining:f}:f<=7?{text:`Ends in ${f}d`,variant:"destructive",daysRemaining:f}:f<=30?{text:`Ends in ${f}d`,variant:"warning",daysRemaining:f}:{text:`Ends in ${f}d`,variant:"neutral",daysRemaining:f}}const formatDate=t=>{if(!t)return"N/A";try{const e=new Date(t);return isNaN(e.getTime())?"Invalid Date":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return"Invalid Date"}};function OpportunitiesTable({applicationId:t,opportunities:e=null,loading:n=!1}){var te;const{toast:o}=useToast(),[l,d]=React.useState({}),[f,g]=React.useState(!1),[b,_]=React.useState(""),[S,R]=React.useState(null),{data:C}=useGetV4PartnerByApplicationIdAccountQuery({applicationId:t},{skip:!t}),E=React.useCallback((ne,se,ge)=>{d(oe=>({...oe,[ne]:{...oe[ne],[se]:ge}}))},[]),[A]=usePutV4ResellerByRouteResellerIdOpportunityAndManufacturerIdDefaultMutation(),I=React.useCallback(async ne=>{if(!(C!=null&&C.IsReseller))return;if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot set default.",variant:"destructive"});return}const se=ne.BidNumber;E(se,"isSettingDefault",!0),A({routeResellerId:t,manufacturerId:ne.ManufacturerId??"",opportunityNumber:se}).unwrap().then(()=>{o({title:"Success",description:`Opportunity "${ne.OpportunityName||ne.Opportunity||se}" was successfully set as default.`,variant:"success"})}).catch(ge=>{var oe;console.error("Set as default error:",ge),o({title:"Error",description:((oe=ge.data)==null?void 0:oe.message)||ge.message||"An error occurred while setting this opportunity as default.",variant:"destructive"})}).finally(()=>{E(se,"isSettingDefault",!1)})},[t,A,o,E]),[M]=usePostV4ResellerByRouteResellerIdOpportunityAndManufacturerIdBidNumberEmailMutation(),j=React.useCallback(ne=>{if(C!=null&&C.IsReseller){if(!ne.BidNumber){o({title:"Error",description:"Bid Number is missing, cannot prepare report.",variant:"destructive"});return}R(ne),_(""),g(!0)}},[o]),q=React.useCallback(async()=>{if(!(C!=null&&C.IsReseller))return;if(!S||!S.BidNumber){o({title:"Error",description:"No opportunity selected or Bid Number is missing.",variant:"destructive"});return}if(!b.trim()||!/\S+@\S+\.\S+/.test(b)){o({title:"Validation Error",description:"Please enter a valid email address.",variant:"destructive"});return}const ne=S.BidNumber;E(ne,"isSendingReport",!0),M({routeResellerId:t,manufacturerId:S.ManufacturerId??"",bidNumber:ne,emailAddress:b}).unwrap().then(()=>{o({title:"Success",description:`A report for "${S.OpportunityName||S.Opportunity||ne}" was successfully sent to ${b}.`,variant:"success"}),g(!1)}).catch(se=>{var ge;console.error("Send report by email error:",se),o({title:"Error",description:((ge=se.data)==null?void 0:ge.message)||se.message||"An error occurred while sending the report by email.",variant:"destructive"})}).finally(()=>{E(ne,"isSendingReport",!1),f||(R(null),_(""))})},[S,b,t,M,o,E,g]),z=React.useMemo(()=>[{accessorKey:"ManufacturerId",header:"Manuf.",cell:({row:ne})=>jsxRuntime.jsx("div",{className:"w-20 h-8",children:jsxRuntime.jsx(PartnerLogo,{id:ne.original.ManufacturerId,width:80,height:32})}),enableSorting:!0,enableFiltering:!0},{id:"opportunityDisplay",accessorFn:ne=>ne.OpportunityName||ne.Opportunity,header:"Opportunity",cell:({getValue:ne})=>jsxRuntime.jsx("div",{className:"min-w-[150px]",children:ne()??"N/A"}),enableSorting:!0,enableFiltering:!0},{accessorKey:"BidNumber",header:"Bid Number",cell:({row:ne})=>ne.original.BidNumber??"N/A",enableSorting:!0,enableFiltering:!0},{id:"statusInfo",header:"Status",cell:({row:ne})=>{const se=ne.original,ge=se.Active===!0,oe=getEndDateStatus(se.EndDate);let Ae="border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400";return oe.variant==="destructive"?Ae="border-red-500 bg-red-100 text-red-700 dark:border-red-600 dark:bg-red-900/50 dark:text-red-400":oe.variant==="warning"&&(Ae="border-yellow-500 bg-yellow-100 text-yellow-700 dark:border-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400"),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 min-w-[200px]",children:[jsxRuntime.jsx(Badge,{variant:"outline",className:ge?"border-green-500 bg-green-100 text-green-700 dark:border-green-600 dark:bg-green-900/50 dark:text-green-400 font-medium":"border-gray-400 bg-gray-100 text-gray-600 dark:border-gray-600 dark:bg-gray-800/50 dark:text-gray-400 font-medium",children:ge?"Active":"Inactive"}),se.EndDate&&jsxRuntime.jsx(Badge,{variant:"outline",className:`${Ae} font-medium`,children:oe.text}),jsxRuntime.jsx(TooltipProvider,{delayDuration:100,children:jsxRuntime.jsxs(Tooltip$1,{children:[jsxRuntime.jsx(TooltipTrigger,{asChild:!0,children:jsxRuntime.jsx(Button,{variant:"ghost",size:"icon",className:"h-6 w-6 p-0 data-[state=delayed-open]:bg-accent data-[state=instant-open]:bg-accent",children:jsxRuntime.jsx(Info,{className:"h-4 w-4 text-muted-foreground"})})}),jsxRuntime.jsx(TooltipContent,{side:"top",align:"center",className:"bg-popover text-popover-foreground p-2 rounded shadow-lg",children:jsxRuntime.jsxs("div",{className:"text-sm space-y-1",children:[jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Start:"})," ",formatDate(se.StartDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"End:"})," ",formatDate(se.EndDate)]}),jsxRuntime.jsxs("p",{children:[jsxRuntime.jsx("strong",{children:"Updated:"})," ",formatDate(se.LastUpdate)]})]})})]})})]})},enableFiltering:!1},{id:"actions",header:"Actions",cell:({row:ne})=>{var Oe,Fe;const se=ne.original;if(!se.BidNumber)return jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:"Actions unavailable"});const ge=se.BidNumber,oe=(Oe=l[ge])==null?void 0:Oe.isSettingDefault,Ae=(S==null?void 0:S.BidNumber)===ge&&((Fe=l[ge])==null?void 0:Fe.isSendingReport),je=oe||Ae,Ne=se.CanBeSetAsDefault===!0;return jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("a",{href:`/${t}/Opportunity/${se.ManufacturerId}/${se.BidNumber}`,children:jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",className:"flex items-center",children:[jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," View"]})}),(C==null?void 0:C.IsReseller)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>I(se),disabled:je||!Ne,title:Ne?"Set as default":"This opportunity cannot be set as default",className:"flex items-center",children:[oe?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Star,{className:"mr-2 h-4 w-4"})," Set Default"]}),jsxRuntime.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>j(se),disabled:je,title:"Send report by email",className:"flex items-center",children:[Ae?jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}):jsxRuntime.jsx(Send,{className:"mr-2 h-4 w-4"})," Send Report"]})]})]})}}],[l,I,j,S]),Q=React.useMemo(()=>{const ne={};if(e){const se=Array.from(new Set(e.map(oe=>oe.ManufacturerId).filter(oe=>oe!=null)));ne.ManufacturerId=se;const ge=Array.from(new Set(e.map(oe=>oe.OpportunityName||oe.Opportunity).filter(oe=>oe!=null)));ne.opportunityDisplay=ge}return ne},[e]),F=e||[],V=S!=null&&S.BidNumber?(te=l[S.BidNumber])==null?void 0:te.isSendingReport:!1;return n?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(Skeleton,{className:"h-7 w-48"})," "]}),jsxRuntime.jsxs(CardContent,{className:"space-y-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-12 w-full rounded-md border"}),jsxRuntime.jsx(Skeleton,{className:"h-48 w-full rounded-md border"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between pt-4",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-[130px]"}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-9 w-20"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-24"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})," ",jsxRuntime.jsx(Skeleton,{className:"h-9 w-9"})]})]})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsxs(CardHeader,{children:[" ",jsxRuntime.jsx(CardTitle,{className:"text-1xl font-bold",children:"Opportunities"})," "]}),jsxRuntime.jsx(CardContent,{children:jsxRuntime.jsx(DataTable,{columns:z,data:F,uniqueValues:Q})})]}),jsxRuntime.jsx(Dialog,{open:f,onOpenChange:ne=>{g(ne),ne||(R(null),_(""))},children:jsxRuntime.jsxs(DialogContent,{className:"@sm:max-w-[425px]",children:[jsxRuntime.jsxs(DialogHeader,{children:[jsxRuntime.jsx(DialogTitle,{children:"Send Opportunity Report"}),jsxRuntime.jsxs(DialogDescription,{children:["Enter the email address to send the report for opportunity: ",jsxRuntime.jsx("br",{}),jsxRuntime.jsx("span",{className:"font-semibold",children:(S==null?void 0:S.OpportunityName)||(S==null?void 0:S.Opportunity)||"N/A"}),(S==null?void 0:S.BidNumber)&&jsxRuntime.jsxs("span",{className:"block text-sm text-muted-foreground",children:["Bid Number: ",S.BidNumber]})]})]}),jsxRuntime.jsx("div",{className:"grid gap-4 py-4",children:jsxRuntime.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[jsxRuntime.jsx(Label$2,{htmlFor:"email",className:"text-right",children:"Email"}),jsxRuntime.jsx(Input,{id:"email",type:"email",value:b,onChange:ne=>_(ne.target.value),placeholder:"recipient@example.com",className:"col-span-3",disabled:V})]})}),jsxRuntime.jsxs(DialogFooter,{children:[jsxRuntime.jsx(Button,{variant:"outline",onClick:()=>g(!1),disabled:V,children:"Cancel"}),jsxRuntime.jsxs(Button,{type:"submit",onClick:q,disabled:V,children:[V&&jsxRuntime.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"})," Send Report"]})]})]})})]})}function SalesChart({salesData:t,chartHeight:e=300,units:n="$",unitsPosition:o="left",className:l,isLoading:d=!1}){const[f,g]=React.useState([]),[b,_]=React.useState(!1),S=!d;return React.useEffect(()=>{if(d){g([]);return}const R=new Date,C=R.getFullYear(),E=R.getMonth(),A=R.getDate(),I=`${C}-${(E+1).toString().padStart(2,"0")}`,M=[];for(let Q=11;Q>=0;Q--){const F=new Date(C,E-Q,1),V=F.getFullYear(),te=(F.getMonth()+1).toString().padStart(2,"0");M.push(`${V}-${te}`)}const j={};M.forEach(Q=>{j[Q]=0}),t&&t.length>0&&t.forEach(Q=>{const F=Q.Day??0,V=Math.floor(F).toString();if(V.length!==8||isNaN(Number.parseInt(V))){console.warn(`Skipping invalid Day format: ${Q.Day}`);return}const te=V.substring(0,4),ne=V.substring(4,6),se=`${te}-${ne}`;M.includes(se)&&(j[se]=(j[se]||0)+(Q.ExtendedPrice??0))});const q={...j};if(b&&j[I]>0){const Q=q[I],F=new Date(C,E+1,0).getDate();if(A<F&&A>0){const te=Q/A*F;q[I]=te}}const z=M.map(Q=>{const F=q[Q],[V,te]=Q.split("-").map(Number);return{month:new Date(V,te-1).toLocaleString("default",{month:"short",year:"numeric"}),sales:F}});g(z)},[t,b,d]),d?jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(Skeleton,{className:"h-6 w-24"})}),jsxRuntime.jsxs(CardContent,{children:[jsxRuntime.jsx("div",{style:{height:e},children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full rounded-md"})}),jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Skeleton,{className:"h-5 w-10"}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-20"})]}),jsxRuntime.jsx(Skeleton,{className:"h-4 w-3/4 mt-1"})]})]}):jsxRuntime.jsxs(Card,{className:"w-full",children:[jsxRuntime.jsx(CardHeader,{children:jsxRuntime.jsx(CardTitle,{children:"Sales"})}),jsxRuntime.jsx(CardContent,{children:f.length>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AreaChart,{data:f,units:n,unitsPosition:o,height:e,className:l}),S&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 my-1 pt-2",children:[jsxRuntime.jsx(Switch,{checked:b,onCheckedChange:_,id:"extrapolate-switch","aria-label":"Toggle sales extrapolation"}),jsxRuntime.jsx(Label$2,{htmlFor:"extrapolate-switch",children:"Extrapolate"})]}),b&&jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"* Sales for the current month are projected, not actual."})]})]}):jsxRuntime.jsx("div",{style:{height:e},className:l||"p-4 text-center text-muted-foreground flex items-center justify-center",children:"No sales data available."})})]})}function useLoadScript(t){const[e,n]=React.useState(!0),[o,l]=React.useState(null),[d,f]=React.useState(!1),g=()=>{n(!1),f(!0)};return React.useEffect(()=>{if(!document){const R=new Error(`[ScriptLoadingError] document not defined when attempting to load ${t}`);l(R);return}const b=document.querySelector(`script[src="${t}"]`);if(b!=null&&b.dataset.loaded){g();return}const _=b||document.createElement("script");b||(_.src=t);const S=()=>{_.dataset.loaded="1",g()};_.addEventListener("load",S),_.addEventListener("error",R=>{console.error("Failed to load script:",t,R);const C=new Error(`[ScriptLoadingError] Failed to load script: ${t}`);l(C)}),b||document.head.append(_)},[]),{isLoading:e,error:o,isSuccess:d}}const isGoogleReady=t=>t&&t.charts,isGoogleChartsReady=(t,e)=>{const{controls:n,toolbarItems:o,getChartEditor:l}=t;return e&&e.charts&&e.visualization&&e.visualization.ChartWrapper&&e.visualization.Dashboard&&(!n||e.visualization.ChartWrapper)&&(!l||e.visualization.ChartEditor)&&(!o||e.visualization.drawToolbar)},getGoogleInstanceFromWindow=t=>window.google;function useLoadGoogleCharts(t){const{chartVersion:e="current",chartPackages:n=["corechart","controls"],chartLanguage:o="en",mapsApiKey:l}=t,[d,f]=React.useState(null),[g,b]=React.useState(null),[_,S]=React.useState(null),{isLoading:R,error:C,isSuccess:E}=useLoadScript(t.chartLoaderScriptUrl||"https://www.gstatic.com/charts/loader.js");return React.useEffect(()=>{if(!E)return;const A=getGoogleInstanceFromWindow();if(!isGoogleReady(A)){const I=new Error("[ScriptInitializationError] Script loaded but Google not attached to window.");b(I);return}if(isGoogleChartsReady(t,A)){f(A);return}A.charts.load(e,{packages:n,language:o,mapsApiKey:l}),A.charts.setOnLoadCallback(()=>{if(!isGoogleChartsReady(t,A)){const I=new Error("[GoogleChartsInitializationError] Google Charts not ready after load callback.");console.error(I),S(I);return}f(A)})},[E]),{error:C||g||_,isLoading:R,google:d}}const chartDefaultProps={legend_toggle:!1,options:{},legendToggle:!1,getChartWrapper:()=>{},spreadSheetQueryParameters:{headers:1,gid:1},rootProps:{},chartWrapperParams:{},chartLoaderScriptUrl:"https://www.gstatic.com/charts/loader.js"},GoogleChartControls=t=>{const{isReady:e,chartControls:n,filter:o}=t;return!e||!n||!(n!=null&&n.length)?null:React.createElement(React.Fragment,null,n.filter(l=>{let{controlProp:d,control:f}=l;return o?o({control:f,controlProp:d}):!0}).map(l=>{let{control:d}=l;return React.createElement("div",{key:d.getContainerId(),id:d.getContainerId()})}))};let uniqueID=0;const generateUniqueID=()=>(uniqueID+=1,`reactgooglegraph-${uniqueID}`),Nr=class Nr{};Qt(Nr,"initializeControls",e=>{for(let n=0;n<e.length;n+=1){const{controlType:o,options:l,controlWrapperParams:d}=e[n].controlProp;d&&"state"in d&&e[n].control.setState(d.state),e[n].control.setOptions(l),e[n].control.setControlType(o)}}),Qt(Nr,"listenToControlEvents",(e,n)=>{const{google:o}=n;return e.flatMap(l=>{const{control:d,controlProp:f}=l,{controlEvents:g=[]}=f;return g.map(b=>{const{callback:_,eventName:S}=b;return o.visualization.events.addListener(d,S,function(){for(var R=arguments.length,C=new Array(R),E=0;E<R;E++)C[E]=arguments[E];_({chartWrapper:null,controlWrapper:d,props:n,google:o,eventArgs:C})})})})}),Qt(Nr,"createControlId",e=>{let n;return typeof e>"u"?n=`googlechart-control-${generateUniqueID()}`:n=e,n}),Qt(Nr,"createChartControls",e=>{const{controls:n,google:o}=e;return n?n.map((l,d)=>{const{controlID:f,controlType:g,options:b,controlWrapperParams:_}=l,S=Nr.createControlId(f);return{controlProp:l,control:new o.visualization.ControlWrapper({containerId:S,controlType:g,options:b,..._})}}):null}),Qt(Nr,"addControls",e=>{const{chartWrapper:n,chartDashboard:o}=e,l=Nr.createChartControls(e);return!l||!o||!n?null:(o.bind(l.map(d=>{let{control:f}=d;return f}),n),Nr.initializeControls(l),l)});let GoogleChartControlsInternal=Nr;const useCreateChartControls=t=>{const[e,n]=React__namespace.useState(null);return[React__namespace.useMemo(()=>!e||!t?null:t.map((l,d)=>{const f=e[d];return f?{controlProp:l,control:f}:void 0}).flatMap(l=>l?[l]:[]),[e,t]),n]},useListenToControlEvents=(t,e)=>{React__namespace.useEffect(()=>{const n=GoogleChartControlsInternal.listenToControlEvents(t??[],e);return()=>{n.forEach(o=>{e.google.visualization.events.removeListener(o)})}},[t,e])},useChartControls=t=>{const[e,n]=useCreateChartControls(t.controls);return useListenToControlEvents(e??[],t),{addControls:l=>{const d=GoogleChartControlsInternal.addControls(l);n((d==null?void 0:d.map(f=>f.control))??null)},renderControl:l=>{const{chartWrapper:d,chartDashboard:f}=t;return React__namespace.createElement(GoogleChartControls,{...t,isReady:!!(d&&f),chartControls:e,filter:l})}}},useChartId=t=>{const e=React__namespace.useRef(null);return{chartId:(()=>{const{graphID:l,graph_id:d}=t,f=l||d;let g;return f?g=f:g=e.current||generateUniqueID(),e.current=g,e.current})()}},DEFAULT_CHART_COLORS=["#3366CC","#DC3912","#FF9900","#109618","#990099","#3B3EAC","#0099C6","#DD4477","#66AA00","#B82E2E","#316395","#994499","#22AA99","#AAAA11","#6633CC","#E67300","#8B0707","#329262","#5574A6","#3B3EAC"],loadDataTableFromSpreadSheet=async function(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return new Promise((o,l)=>{const d=`${n.headers?`headers=${n.headers}`:"headers=0"}`,f=`${n.query?`&tq=${encodeURIComponent(n.query)}`:""}`,g=`${n.gid?`&gid=${n.gid}`:""}`,b=`${n.sheet?`&sheet=${n.sheet}`:""}`,_=`${n.access_token?`&access_token=${n.access_token}`:""}`,S=`${d}${g}${b}${f}${_}`,R=`${e}/gviz/tq?${S}`;new t.visualization.Query(R).send(E=>{E.isError()?l(`Error in query: ${E.getMessage()} ${E.getDetailedMessage()}`):o(E.getDataTable())})})},GRAY_COLOR="#CCCCCC",Tr=class Tr{};Qt(Tr,"grayOutHiddenColumnsLabel",(e,n)=>{const{googleChartWrapper:o,options:l}=e;if(!o){console.error("googleChartWrapper is not defined");return}const d=o.getDataTable();if(!d)return;const f=d.getNumberOfColumns();if(n.length>0===!1)return;const b=Array.from({length:f-1}).map((_,S)=>{const R=Tr.getColumnId(d,S+1);return n.includes(R)?GRAY_COLOR:l&&l.colors?l.colors[S]:DEFAULT_CHART_COLORS[S]});o.setOptions({...l,colors:b}),o.draw()}),Qt(Tr,"listenToLegendToggle",(e,n)=>{const[o,l]=n,{google:d,googleChartWrapper:f}=e;if(!f){console.error("googleChartWrapper is not defined");return}return d.visualization.events.addListener(f,"select",()=>{const b=f.getChart().getSelection(),_=f.getDataTable();if(b.length===0||b[0].row!==null||!_)return;const S=b[0].column,R=Tr.getColumnId(_,S);o!=null&&o.includes(R)?l(C=>[...C.filter(E=>E!==R)]):l(C=>[...C,R])})}),Qt(Tr,"draw",async e=>{const{data:n,diffdata:o,rows:l,columns:d,options:f,chartType:g,formatters:b,spreadSheetUrl:_,spreadSheetQueryParameters:S,googleChartDashboard:R,googleChartWrapper:C,google:E,hiddenColumns:A,legendToggle:I,legend_toggle:M}=e;if(!C){console.error("draw was called with googleChartWrapper = null");return}let j,q=null;if(o){const te=E.visualization.arrayToDataTable(o.old),ne=E.visualization.arrayToDataTable(o.new);q=E.visualization[g].prototype.computeDiff(te,ne)}n?n instanceof E.visualization.DataTable?j=n:Array.isArray(n)?j=E.visualization.arrayToDataTable(n):j=new E.visualization.DataTable(n):l&&d?j=E.visualization.arrayToDataTable([d,...l]):_?j=await loadDataTableFromSpreadSheet(E,_,S):j=E.visualization.arrayToDataTable([]);const z=j.getNumberOfColumns(),Q=Array(z).fill(0).map((te,ne)=>{const se=Tr.getColumnId(j,ne);return A.includes(se)?{label:j.getColumnLabel(ne),type:j.getColumnType(ne),calc:()=>null}:ne}),F=C.getChart();C.getChartType()==="Timeline"&&F&&F.clearChart(),C.setChartType(g),C.setOptions(f||{});const V=new E.visualization.DataView(j);V.setColumns(Q),C.setDataTable(V),C.draw(),R&&R.draw(j),q&&(C.setDataTable(q),C.draw()),b&&(Tr.applyFormatters({dataTable:j,formatters:b,google:E}),C.setDataTable(j),C.draw()),(I===!0||M===!0)&&Tr.grayOutHiddenColumnsLabel(e,A)}),Qt(Tr,"getColumnId",(e,n)=>e.getColumnId(n)||e.getColumnLabel(n)),Qt(Tr,"applyFormatters",e=>{let{dataTable:n,formatters:o,google:l}=e;for(let d of o)switch(d.type){case"ArrowFormat":{new l.visualization.ArrowFormat(d.options).format(n,d.column);return}case"BarFormat":{new l.visualization.BarFormat(d.options).format(n,d.column);return}case"ColorFormat":{const f=new l.visualization.ColorFormat(d.options),{ranges:g}=d;if(g)for(let b of g)f.addRange(...b);f.format(n,d.column);return}case"DateFormat":{new l.visualization.DateFormat(d.options).format(n,d.column);return}case"NumberFormat":{new l.visualization.NumberFormat(d.options).format(n,d.column);return}case"PatternFormat":{new l.visualization.PatternFormat(d.options).format(n,d.column);return}default:{console.warn(`Unknown formatter type: ${d.type}`);return}}});let GoogleChartInternal=Tr;const useGoogleChartDataTable=t=>{const{google:e,googleChartWrapper:n,googleChartDashboard:o}=t,[l,d]=React__namespace.useState([]);React__namespace.useEffect(()=>{n&&GoogleChartInternal.draw({...t,hiddenColumns:l,googleChartWrapper:n,googleChartDashboard:o,google:e})},[l,t.data,t.rows,t.columns,t.options,t.chartLoaderScriptUrl,t.chartType,t.formatters,t.spreadSheetUrl,t.spreadSheetQueryParameters,t.legendToggle,t.legend_toggle]);const f=()=>{const{googleChartWrapper:_}=t;_&&_.draw()},g=_=>{const S=[],{legendToggle:R,legend_toggle:C}=t;if(GoogleChartInternal.draw({...t,hiddenColumns:l,googleChartWrapper:_,googleChartDashboard:o,google:e}),window.addEventListener("resize",f),C||R){const E=GoogleChartInternal.listenToLegendToggle(t,[l,d]);E&&S.push(E)}return S},b=(_,S)=>{window.removeEventListener("resize",f),S.forEach(R=>{e.visualization.events.removeListener(R)}),_.getChartType()==="Timeline"&&_.getChart()&&_.getChart().clearChart()};React__namespace.useEffect(()=>{if(!n)return;const _=g(n);return()=>{b(n,_)}},[n,g,b])},listenToEvents=t=>{const{chartEvents:e,google:n,googleChartWrapper:o}=t;if(e){if(!o){console.warn("listenToEvents was called before chart wrapper ready.");return}return e.map(l=>{let{eventName:d,callback:f}=l;return n.visualization.events.addListener(o,d,function(){for(var g=arguments.length,b=new Array(g),_=0;_<g;_++)b[_]=arguments[_];f({chartWrapper:o,props:t,google:n,eventArgs:b})})})}},useGoogleChartEvents=t=>{React.useEffect(()=>{if(!t.googleChartWrapper)return;const e=listenToEvents(t);return()=>{e==null||e.forEach(n=>{t.google.visualization.events.removeListener(n)})}},[t])},GoogleChart=t=>{const[e,n]=React__namespace.useState(null),[o,l]=React__namespace.useState(null),{addControls:d,renderControl:f}=useChartControls({...t,chartDashboard:o,chartWrapper:e});useGoogleChartEvents({...t,googleChartWrapper:e});const{chartId:g}=useChartId(t),b=React__namespace.useRef(null),_=React__namespace.useRef(null);React__namespace.useEffect(()=>{const{options:j,google:q,chartType:z,chartWrapperParams:Q,toolbarItems:F,getChartEditor:V,getChartWrapper:te,onLoad:ne}=t,se={chartType:z,options:j,containerId:g,...Q},ge=new q.visualization.ChartWrapper(se);ge.setOptions(j||{}),te==null||te(ge,q);const oe=new q.visualization.Dashboard(b.current);F&&q.visualization.drawToolbar(_.current,F);let Ae=null;V&&(Ae=new q.visualization.ChartEditor,V({chartEditor:Ae,chartWrapper:ge,google:q})),d({...t,chartDashboard:oe,chartWrapper:ge}),n(ge),l(oe),ne==null||ne(q,{google:q,chartWrapper:ge,chartEditor:Ae,chartDashboard:oe})},[]),useGoogleChartDataTable({...t,googleChartWrapper:e,googleChartDashboard:o});const S=()=>{const{width:j,height:q,options:z,style:Q,className:F,rootProps:V,google:te}=t,ne={height:q||z&&z.height,width:j||z&&z.width,...Q};return React__namespace.createElement("div",{id:g,style:ne,className:F,...V})},R=()=>t.toolbarItems?React__namespace.createElement("div",{ref:_}):null,{width:C,height:E,options:A,style:I}=t,M={height:E||A&&A.height,width:C||A&&A.width,...I};return t.render?React__namespace.createElement("div",{ref:b,style:M},React__namespace.createElement("div",{ref:_,id:"toolbar"}),t.render({renderChart:S,renderControl:f,renderToolbar:R})):React__namespace.createElement("div",{ref:b,style:M},f(j=>{let{controlProp:q}=j;return q.controlPosition!=="bottom"}),S(),f(j=>{let{controlProp:q}=j;return q.controlPosition==="bottom"}),R())},ChartContext=React__namespace.createContext(chartDefaultProps),ContextProvider=t=>{let{children:e,value:n}=t;return React__namespace.createElement(ChartContext.Provider,{value:n},e)},ChartView=t=>{const{google:e,isLoading:n,error:o}=useLoadGoogleCharts(t);return n?t.loader??null:o?t.errorElement??null:e?React.createElement(GoogleChart,{google:e,...t}):null},Chart=t=>{const e={...chartDefaultProps,...t};return React.createElement(ContextProvider,{value:e},React.createElement(ChartView,e))};var GoogleDataTableColumnRoleType;(function(t){t.annotation="annotation",t.annotationText="annotationText",t.certainty="certainty",t.emphasis="emphasis",t.interval="interval",t.scope="scope",t.style="style",t.tooltip="tooltip",t.domain="domain"})(GoogleDataTableColumnRoleType||(GoogleDataTableColumnRoleType={}));function parseHsl(t){const e=t.match(/(\d+\.?\d*)\s*(\d+\.?\d*)%\s*(\d+\.?\d*)%/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:null}function hslToHex(t,e,n){n/=100;const o=e*Math.min(n,1-n)/100,l=d=>{const f=(d+t/30)%12,g=n-o*Math.max(Math.min(f-3,9-f,1),-1);return Math.round(255*g).toString(16).padStart(2,"0")};return`#${l(0)}${l(8)}${l(4)}`}const Treemap=React__namespace.forwardRef(({data:t,options:e,height:n="500px",className:o,loading:l,...d},f)=>{const g=React__namespace.useRef(null),[b,_]=React__namespace.useState(null);React__namespace.useEffect(()=>{if(!g.current)return;const R=getComputedStyle(g.current).getPropertyValue("--primary"),C=parseHsl(R.trim());if(C){const{h:E,s:A,l:I}=C;_({minColor:hslToHex(E,A,Math.min(100,I+50)),midColor:hslToHex(E,A,Math.min(100,I+35)),maxColor:hslToHex(E,A,Math.min(100,I+20))})}},[]);const S=React__namespace.useMemo(()=>{const R={headerHeight:24,fontSize:14,showScale:!0,isHtml:!0,generateTooltip:(C,E)=>{var M;const A=(M=t[C+1])==null?void 0:M[0];if(!A)return"";const I=formatMoney(E);return`<div class="p-2 bg-background text-foreground border rounded-md shadow-lg">
|
|
1318
|
+
<strong>${A}</strong><br>Value: ${I}
|
|
1319
|
+
</div>`}};return b&&(!e||!e.colorAxis)&&(R.minColor=b.minColor,R.midColor=b.midColor,R.maxColor=b.maxColor),{...R,...e}},[t,e,b]);return React__namespace.useImperativeHandle(f,()=>g.current,[]),l?jsxRuntime.jsx("div",{ref:g,className:cn("w-full",o),style:{height:n},...d,children:jsxRuntime.jsx(Skeleton,{className:"h-full w-full"})}):jsxRuntime.jsx("div",{ref:g,className:cn("w-full",o),style:{height:n},...d,children:jsxRuntime.jsx(Chart,{chartType:"TreeMap",width:"100%",height:"100%",data:t,options:S,loader:jsxRuntime.jsx(Skeleton,{className:"h-full w-full"})})})});Treemap.displayName="Treemap";const TopPercentTreemap=({data:t,topPercent:e=80,title:n,...o})=>{const l=React__namespace.useMemo(()=>{if(!t||t.length===0)return[["ID","Parent","Value"],["Root",null,0]];const f=[...t].sort((E,A)=>A.value-E.value),b=f.reduce((E,A)=>E+A.value,0)*(e/100),_=[["ID","Parent","Value"],["Root",null,0]],S=[],R=[];let C=0;for(const E of f)C<b?(S.push(E),C+=E.value):R.push(E);if(S.forEach(E=>{_.push([E.name,"Root",E.value])}),R.length>0){const E=`More... (${R.length} items)`;_.push([E,"Root",0]),R.forEach(A=>{_.push([A.name,E,A.value])})}return _},[t,e]),d=React__namespace.useMemo(()=>({title:n,maxDepth:1,goUpButton:{text:"← Go Back to Top Level",visible:!0}}),[n]);return jsxRuntime.jsx(Treemap,{data:l,options:d,className:cn("h-full",o.className),...o})};exports.ActiveOrdersCard=ActiveOrdersCard,exports.AiGeneratedContent=AiGeneratedContent,exports.Alert=Alert,exports.AlertDescription=AlertDescription,exports.AlertDialog=AlertDialog,exports.AlertDialogAction=AlertDialogAction,exports.AlertDialogCancel=AlertDialogCancel,exports.AlertDialogContent=AlertDialogContent,exports.AlertDialogDescription=AlertDialogDescription,exports.AlertDialogFooter=AlertDialogFooter,exports.AlertDialogHeader=AlertDialogHeader,exports.AlertDialogTitle=AlertDialogTitle,exports.AlertDialogTrigger=AlertDialogTrigger,exports.AlertTitle=AlertTitle,exports.AreaChart=AreaChart,exports.AssistantChat=AssistantChat,exports.Avatar=Avatar,exports.AvatarFallback=AvatarFallback,exports.AvatarFooter=AvatarFooter,exports.AvatarImage=AvatarImage,exports.Badge=Badge,exports.Button=Button,exports.Card=Card,exports.CardContent=CardContent,exports.CardDescription=CardDescription,exports.CardFooter=CardFooter,exports.CardHeader=CardHeader,exports.CardTitle=CardTitle,exports.ChatLayout=ChatLayout,exports.ChatProvider=ChatProvider,exports.Checkbox=Checkbox,exports.Command=Command,exports.CommandDialog=CommandDialog,exports.CommandEmpty=CommandEmpty,exports.CommandGroup=CommandGroup,exports.CommandInput=CommandInput,exports.CommandItem=CommandItem,exports.CommandList=CommandList,exports.CommandSeparator=CommandSeparator,exports.CommandShortcut=CommandShortcut,exports.CountryFlag=CountryFlag,exports.DataTable=DataTable,exports.Dialog=Dialog,exports.DialogClose=DialogClose,exports.DialogContent=DialogContent,exports.DialogDescription=DialogDescription,exports.DialogFooter=DialogFooter,exports.DialogHeader=DialogHeader,exports.DialogOverlay=DialogOverlay,exports.DialogPortal=DialogPortal,exports.DialogTitle=DialogTitle,exports.DialogTrigger=DialogTrigger,exports.DropdownMenu=DropdownMenu,exports.DropdownMenuCheckboxItem=DropdownMenuCheckboxItem,exports.DropdownMenuContent=DropdownMenuContent,exports.DropdownMenuGroup=DropdownMenuGroup,exports.DropdownMenuItem=DropdownMenuItem,exports.DropdownMenuLabel=DropdownMenuLabel,exports.DropdownMenuPortal=DropdownMenuPortal,exports.DropdownMenuRadioGroup=DropdownMenuRadioGroup,exports.DropdownMenuRadioItem=DropdownMenuRadioItem,exports.DropdownMenuSeparator=DropdownMenuSeparator,exports.DropdownMenuShortcut=DropdownMenuShortcut,exports.DropdownMenuSub=DropdownMenuSub,exports.DropdownMenuSubContent=DropdownMenuSubContent,exports.DropdownMenuSubTrigger=DropdownMenuSubTrigger,exports.DropdownMenuTrigger=DropdownMenuTrigger,exports.ExploreManufacturers=ExploreManufacturers,exports.GeminiApiKeyProvider=GeminiApiKeyProvider,exports.GeneralDocumentCard=GeneralDocumentCard,exports.Input=Input,exports.InputOTP=InputOTP,exports.InputOTPGroup=InputOTPGroup,exports.InputOTPSeparator=InputOTPSeparator,exports.InputOTPSlot=InputOTPSlot,exports.Label=Label$2,exports.Layout=Layout,exports.ManufacturerCard=ManufacturerCard,exports.ManufacturerGetStartedButton=ManufacturerGetStartedButton,exports.ManufacturerOverviewPage=ManufacturerOverviewPage,exports.ManufacturerReorderingCard=ManufacturerReorderingCard,exports.MultiSelect=MultiSelect,exports.Navbar=Navbar,exports.OpportunitiesTable=OpportunitiesTable,exports.PageHeader=PageHeader,exports.PartnerCard=PartnerCard,exports.PartnerRelationshipPage=PartnerRelationshipPage,exports.Popover=Popover,exports.PopoverAnchor=PopoverAnchor,exports.PopoverContent=PopoverContent,exports.PopoverTrigger=PopoverTrigger,exports.Preloader=Preloader,exports.ProductCard=ProductCard,exports.ProductImage=ProductImage,exports.ProductInventoryGrid=ProductInventoryGrid,exports.ProductOverviewPage=ProductOverviewPage,exports.Progress=Progress,exports.RadioGroup=RadioGroup$1,exports.RadioGroupItem=RadioGroupItem,exports.ResellerBillingOverviewCard=ResellerBillingOverviewCard,exports.ResellerCard=ResellerCard,exports.ResellerOverview=ResellerOverview,exports.ResellerQualificationsCard=ResellerQualificationsCard,exports.ReturnsTable=ReturnsTable,exports.RichTextEditor=RichTextEditor,exports.SalesChart=SalesChart,exports.SalesOverviewCard=SalesOverviewCard,exports.ScrollArea=ScrollArea,exports.ScrollBar=ScrollBar,exports.Select=Select,exports.SelectContent=SelectContent,exports.SelectGroup=SelectGroup,exports.SelectItem=SelectItem,exports.SelectLabel=SelectLabel,exports.SelectScrollDownButton=SelectScrollDownButton,exports.SelectScrollUpButton=SelectScrollUpButton,exports.SelectTrigger=SelectTrigger,exports.SelectValue=SelectValue,exports.Separator=Separator$1,exports.Sheet=Sheet,exports.SheetClose=SheetClose,exports.SheetContent=SheetContent,exports.SheetDescription=SheetDescription,exports.SheetFooter=SheetFooter,exports.SheetHeader=SheetHeader,exports.SheetOverlay=SheetOverlay,exports.SheetPortal=SheetPortal,exports.SheetTitle=SheetTitle,exports.SheetTrigger=SheetTrigger,exports.Sidebar=Sidebar,exports.SidebarContent=SidebarContent,exports.SidebarFooter=SidebarFooter,exports.SidebarGroup=SidebarGroup,exports.SidebarGroupAction=SidebarGroupAction,exports.SidebarGroupContent=SidebarGroupContent,exports.SidebarGroupLabel=SidebarGroupLabel,exports.SidebarHeader=SidebarHeader,exports.SidebarInput=SidebarInput,exports.SidebarInset=SidebarInset,exports.SidebarMenu=SidebarMenu,exports.SidebarMenuAction=SidebarMenuAction,exports.SidebarMenuBadge=SidebarMenuBadge,exports.SidebarMenuButton=SidebarMenuButton,exports.SidebarMenuItem=SidebarMenuItem,exports.SidebarMenuSkeleton=SidebarMenuSkeleton,exports.SidebarMenuSub=SidebarMenuSub,exports.SidebarMenuSubButton=SidebarMenuSubButton,exports.SidebarMenuSubItem=SidebarMenuSubItem,exports.SidebarProvider=SidebarProvider,exports.SidebarRail=SidebarRail,exports.SidebarSeparator=SidebarSeparator,exports.SidebarTrigger=SidebarTrigger,exports.Skeleton=Skeleton,exports.Switch=Switch,exports.Table=Table,exports.TableBody=TableBody,exports.TableCaption=TableCaption,exports.TableCell=TableCell,exports.TableFooter=TableFooter,exports.TableHead=TableHead,exports.TableHeader=TableHeader,exports.TableRow=TableRow,exports.Tabs=Tabs,exports.TabsContent=TabsContent,exports.TabsList=TabsList,exports.TabsTrigger=TabsTrigger,exports.Textarea=Textarea,exports.Toast=Toast,exports.ToastAction=ToastAction,exports.ToastClose=ToastClose,exports.ToastDescription=ToastDescription,exports.ToastProvider=ToastProvider,exports.ToastTitle=ToastTitle,exports.ToastViewport=ToastViewport,exports.Toaster=Toaster,exports.Tooltip=Tooltip$1,exports.TooltipContent=TooltipContent,exports.TooltipProvider=TooltipProvider,exports.TooltipTrigger=TooltipTrigger,exports.TopPercentTreemap=TopPercentTreemap,exports.Topbar=Topbar,exports.Treemap=Treemap,exports.badgeVariants=badgeVariants,exports.buttonVariants=buttonVariants,exports.toast=toast,exports.useChat=useChat,exports.useGeminiApiKey=useGeminiApiKey,exports.useIsMobile=useIsMobile,exports.useSidebar=useSidebar,exports.useToast=useToast,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|