@capitol.ai/ui
Version:
Library of React components from Capitol AI
37 lines • 253 kB
JavaScript
(function(J,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],d):(J=typeof globalThis<"u"?globalThis:J||self,d(J["capitolai-ui"]={},J.React.jsxRuntime,J.React))})(this,function(J,d,Z){"use strict";const Qt=()=>d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.jsx("g",{id:"marker-pin-01",children:d.jsxs("g",{id:"Icon",children:[d.jsx("path",{d:"M10 10.8333C11.3807 10.8333 12.5 9.71404 12.5 8.33332C12.5 6.95261 11.3807 5.83332 10 5.83332C8.61929 5.83332 7.5 6.95261 7.5 8.33332C7.5 9.71404 8.61929 10.8333 10 10.8333Z",stroke:"#242329",strokeOpacity:"0.64",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M10 18.3333C13.3333 15 16.6667 12.0152 16.6667 8.33332C16.6667 4.65142 13.6819 1.66666 10 1.66666C6.3181 1.66666 3.33333 4.65142 3.33333 8.33332C3.33333 12.0152 6.66667 15 10 18.3333Z",stroke:"#242329",strokeOpacity:"0.64",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),Jt=({color:e="#6B757B"})=>d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.jsx("path",{d:"M17.5 17.5L13.875 13.875M15.8333 9.16667C15.8333 12.8486 12.8486 15.8333 9.16667 15.8333C5.48477 15.8333 2.5 12.8486 2.5 9.16667C2.5 5.48477 5.48477 2.5 9.16667 2.5C12.8486 2.5 15.8333 5.48477 15.8333 9.16667Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),$n=({color:e="currentColor"})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:d.jsx("path",{d:"M8.75036 10.0001H4.16702M4.09648 10.243L2.15071 16.0552C1.99785 16.5119 1.92142 16.7402 1.97627 16.8808C2.0239 17.0029 2.1262 17.0954 2.25244 17.1307C2.3978 17.1712 2.61736 17.0724 3.05647 16.8748L16.9827 10.608C17.4113 10.4151 17.6256 10.3187 17.6918 10.1847C17.7494 10.0684 17.7494 9.93179 17.6918 9.8154C17.6256 9.68143 17.4113 9.585 16.9827 9.39212L3.05161 3.12317C2.61383 2.92617 2.39493 2.82767 2.24971 2.86807C2.1236 2.90317 2.0213 2.99549 1.97351 3.11736C1.91847 3.25769 1.99408 3.4855 2.14531 3.94113L4.09702 9.82134C4.12299 9.8996 4.13598 9.93873 4.14111 9.97874C4.14565 10.0143 4.14561 10.0502 4.14097 10.0857C4.13574 10.1257 4.12265 10.1648 4.09648 10.243Z",stroke:e,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Tl=({color:e="#242329"})=>d.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:d.jsx("path",{d:"M10.0003 4.16699V15.8337M10.0003 15.8337L15.8337 10.0003M10.0003 15.8337L4.16699 10.0003",stroke:e,strokeOpacity:"0.64",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),_l=({color:e="#6b7280",className:n=""})=>d.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[d.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),d.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Il=({accentColor:e="#1C76F3",arrowColor:n="#fff",onSubmitPrompt:t,disabled:r=!1})=>d.jsx("button",{className:"submitButton",style:e?{background:e}:{},onClick:t,disabled:r,"aria-label":"Submit prompt",children:d.jsx($n,{color:n})}),Dl=({setPrompt:e,prompt:n})=>d.jsx("textarea",{suppressContentEditableWarning:!0,role:"textbox",id:"capitolai-summary__prompt",className:"border-2 rounded-lg p-4 mt-4 whitespace-pre-wrap",style:{minHeight:"200px"},onKeyUp:t=>{let r=t.currentTarget.lastElementChild;r&&r.tagName==="BR"&&r.remove()},onInput:t=>{const r=t.target.value;e(r)},value:n}),Nl=({placeholderText:e,minHeight:n,setPrompt:t,onSubmitPrompt:r,isEditable:i=!0,onChange:l})=>d.jsx("div",{suppressContentEditableWarning:!0,role:"textbox",id:"capitolai-summary__prompt",className:"contentEditable",style:n?{minHeight:`${n}px`}:{},contentEditable:i,"data-placeholder":e,onKeyUp:o=>{let a=o.currentTarget.lastElementChild;a&&a.tagName==="BR"&&a.remove()},onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),r())},onInput:o=>{const a=o.currentTarget.textContent||"";t(a),l&&l(a)},"aria-placeholder":e}),Hn=({placeholderText:e="Enter prompt",minHeight:n,accentColor:t,arrowColor:r="#fff",onSubmit:i=()=>{},onChange:l=()=>{},disabled:o=!1,enableFormatPrompt:a=!1,defaultFormatPrompt:s=""})=>{const[u,p]=Z.useState(""),[c,h]=Z.useState(s),f=()=>{if(a&&c&&c.length>0?i(u,c):i(u),p(""),typeof document<"u"){const g=document.getElementById("capitolai-summary__prompt");g&&(g.textContent="")}};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"promptContainer",id:"capitolai-summary__prompt-container",children:[d.jsx("div",{className:"promptWrapper",children:d.jsx(Nl,{placeholderText:e,minHeight:n,setPrompt:p,onSubmitPrompt:f,isEditable:!o,onChange:l})}),d.jsx("div",{className:"buttonWrapper",children:d.jsx(Il,{onSubmitPrompt:f,accentColor:t,arrowColor:r,disabled:o})})]}),a&&d.jsx(Dl,{setPrompt:h,prompt:c})]})},Ml=({onSubmit:e})=>d.jsxs("div",{className:"fancyPromptContainer","data-testid":"fancy-prompt-container",children:[d.jsx(Hn,{placeholderText:"Ask a question",minHeight:100,accentColor:"#d02523",onSubmit:e}),d.jsx("div",{className:"fancyPromptFooter","data-testid":"fancy-prompt-footer",children:"TODO"})]}),Pl=({prompt:e,onClickHandler:n,arrowColor:t="#000",arrowComp:r=d.jsx($n,{color:t})})=>d.jsxs("div",{className:"rounded-lg border-2 border-gray-200 py-2 px-4 flex items-center hover:bg-stone-100 cursor-pointer capitolai-summary__prompt-suggestion",onClick:()=>{n(e)},children:[d.jsx("div",{className:"flex-1 text-[13px] ",children:e}),d.jsx("div",{className:"stroke-gray-500 pl-2",children:r})]}),er=({prompts:e=[],onClickHandler:n=()=>{},title:t="Suggestions",arrowColor:r="#000",arrowComp:i})=>e.length===0?null:d.jsxs("div",{className:"capitolai-summary__prompt-suggestions-container",children:[d.jsx("div",{className:"font-bold text-xl pb-4",children:t}),d.jsx("div",{className:"grid grid-cols-1 justify-between gap-2 sm:grid-cols-2",children:e.map((l,o)=>d.jsx(Pl,{prompt:l,onClickHandler:n,arrowColor:r,arrowComp:i},o))})]}),nr=({className:e=""})=>d.jsx("div",{className:`${e}`,children:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-arrow-left-icon lucide-arrow-left",children:[d.jsx("path",{d:"m12 19-7-7 7-7"}),d.jsx("path",{d:"M19 12H5"})]})}),tr=({className:e=""})=>d.jsx("div",{className:`${e}`,children:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-arrow-right-icon lucide-arrow-right",children:[d.jsx("path",{d:"M5 12h14"}),d.jsx("path",{d:"m12 5 7 7-7 7"})]})}),rr=({currentPage:e,totalPages:n,onPageChange:t,maxVisiblePages:r=5,selectedPageColor:i="bg-blue-500",hoverPageColor:l="bg-gray-100",useArrows:o=!1,rounded:a})=>{if(n<=1)return null;const s=()=>{const h=Math.floor(r/2);let f=Math.max(1,e-h),g=Math.min(n,f+r-1);return g-f+1<r&&(f=Math.max(1,g-r+1)),Array.from({length:g-f+1},(y,C)=>f+C)},u=h=>!!h&&(h.startsWith("#")||/^rgb\(|^hsl\(|^rgba\(|^hsla\(/.test(h)||/^[a-zA-Z]+$/.test(h)&&!h.includes("-")&&!h.includes(":")),p=Z.useMemo(()=>u(i)?{backgroundColor:i,color:"#fff"}:void 0,[i]),c=Z.useMemo(()=>u(l)?{backgroundColor:l}:void 0,[l]);return Z.useEffect(()=>{if(typeof window<"u"&&!document.getElementById("pagination-custom-hover")){const h=document.createElement("style");return h.id="pagination-custom-hover",h.innerHTML=`
.custom-hover-color:hover {
filter: brightness(0.9);
}
`,document.head.appendChild(h),()=>{h.parentNode&&h.parentNode.removeChild(h)}}},[]),d.jsxs("div",{className:`flex justify-center items-center mt-6${a!==void 0?" gap-2":" space-x-2"}`,children:[d.jsx("button",{onClick:()=>t(e-1),disabled:e===1,className:`py-1 rounded${a?`-${a} px-1`:" px-3"} capitolai-pagination__previous-button ${e===1?o?"bg-transparent text-gray-300 cursor-not-allowed capitolai-pagination__previous-button__disabled":"bg-gray-200 text-gray-500 cursor-not-allowed capitolai-pagination__previous-button__disabled":o?"bg-transparent text-gray-700 capitolai-pagination__previous-button__active":"bg-white text-gray-700 hover:bg-gray-100 capitolai-pagination__previous-button__active"}`,children:o?d.jsx(nr,{className:"w-6 h-6"}):"Previous"}),s().map(h=>{const f=e===h;return d.jsx("button",{onClick:()=>t(h),className:`px-3 py-1 rounded${a?`-${a}`:""} capitolai-pagination__page-number ${f?u(i)?"capitolai-pagination__page-number__selected":`${i} text-white capitolai-pagination__page-number__selected`:u(l)?"bg-white text-gray-700 capitolai-pagination__page-number__not-selected custom-hover-color":`bg-white text-gray-700 hover:${l} capitolai-pagination__page-number__not-selected`}`,style:f&&u(i)?p:!f&&u(l)?c:void 0,children:h},h)}),d.jsx("button",{onClick:()=>t(e+1),disabled:e===n,className:`py-1 rounded${a?`-${a} px-1`:" px-3"} capitolai-pagination__next-button ${e===n?o?"bg-transparent text-gray-300 cursor-not-allowed capitolai-pagination__next-button__disabled":"bg-gray-200 text-gray-500 cursor-not-allowed capitolai-pagination__next-button__disabled":o?"bg-transparent text-gray-700 capitolai-pagination__next-button__active":"bg-white text-gray-700 hover:bg-gray-100 capitolai-pagination__next-button__active"}`,children:o?d.jsx(tr,{className:"w-6 h-6"}):"Next"})]})},jn={primaryColor:"#007bff",background:"#fff",textColor:"#222",borderRadius:"8px",inputInnerBorderRadius:"12px",inputBackground:"#f5f5f5",inputTextColor:"#222",inputBorderColor:"#ccc",rowBackground:"#fff",placeholderColor:"#6B757B",boxShadow:"0px 8px 10px -8px rgba(0, 0, 0, 0.20), 0px 16px 24px -16px rgba(0, 0, 0, 0.14), 0px 6px 30px -6px rgba(0, 0, 0, 0.12)",outerBorderColor:"#DFE5E4",isDarkMode:!1,isLightMode:!0,cardBackground:"#f5f5f4",cardHoverBackground:"#e7e5e4",secondaryTextColor:"#6b7280",badgeBackground:"#d1d5db",badgeTextColor:"#374151"},zl={primaryColor:"#31B455",background:"#181A1B",textColor:"#E6F3E9",borderRadius:"8px",inputInnerBorderRadius:"12px",inputBackground:"#232323",inputTextColor:"#E6F3E9",inputBorderColor:"#212120",rowBackground:"#232323",placeholderColor:"rgba(230, 243, 233, 0.7)",boxShadow:"0px 0px 25px 11px rgba(19, 19, 19, 0.75)",outerBorderColor:"#212120",isDarkMode:!0,isLightMode:!1,cardBackground:"#2a2a2a",cardHoverBackground:"#333",secondaryTextColor:"#9ca3af",badgeBackground:"#4a4a4a",badgeTextColor:"#e5e7eb"},ir=Z.createContext(jn),Fl=({theme:e=jn,children:n})=>d.jsx(ir.Provider,{value:e,children:n}),De=()=>Z.useContext(ir),lr=({currentPage:e,totalPages:n,onPageChange:t,maxVisiblePages:r=5,useArrows:i=!1,rounded:l,selectedPageColor:o,hoverPageColor:a,buttonBackground:s,buttonTextColor:u,disabledButtonColor:p,disabledTextColor:c,borderRadius:h,boxShadow:f,className:g="",style:y={}})=>{const C=De();if(n<=1)return null;const k=()=>{const j=Math.floor(r/2);let K=Math.max(1,e-j),x=Math.min(n,K+r-1);return x-K+1<r&&(K=Math.max(1,x-r+1)),Array.from({length:x-K+1},(re,se)=>K+se)},S=h||C.borderRadius||"8px",A=f||"none",z=o||C.primaryColor||"#007bff",O=a||(C.isDarkMode?"#2a2a2a":"#f0f0f0"),v=s||C.rowBackground||"#fff",F=u||C.textColor||"#222",$=p||(C.isDarkMode?"#2a2a2a":"#f5f5f5"),L=c||C.placeholderColor||"#6B757B",w=j=>!!j&&(j.startsWith("#")||/^rgb\(|^hsl\(|^rgba\(|^hsla\(/.test(j)||/^[a-zA-Z]+$/.test(j)&&!j.includes("-")&&!j.includes(":")),D=Z.useMemo(()=>w(z)?{backgroundColor:z,color:"#fff"}:void 0,[z]);Z.useMemo(()=>w(O)?{backgroundColor:O}:void 0,[O]);const N=Z.useMemo(()=>w(v)?{backgroundColor:v,color:F}:void 0,[v,F]),T=Z.useMemo(()=>w($)?{backgroundColor:$,color:L}:void 0,[$,L]),M=()=>l?`rounded-${l}`:"",b=`px-3 py-1 transition-colors duration-200${l?` ${M()}`:""} capitolai-pagination__button`,H=`px-3 py-1 transition-colors duration-200${l?` ${M()}`:""} capitolai-pagination__page-number`,G=(j,K)=>j?"":K?"custom-hover-color":"hover:bg-gray-100",ie=(j,K,x,re)=>j?T:K&&x?x:re,le=(j,K)=>{if(K)return j?D:N;if(C.isDarkMode)return j?{backgroundColor:"#3b82f6",color:"#ffffff"}:{backgroundColor:"#1f2937",color:"#e5e7eb"}},m=(j,K)=>{let x=`${H} ${j?"capitolai-pagination__page-number__selected":"capitolai-pagination__page-number__not-selected"}`;return K||(j?x+=" bg-blue-500 text-white":x+=" bg-white text-gray-700"),x};return Z.useEffect(()=>{if(typeof window<"u"&&!document.getElementById("pagination-custom-hover")){const j=document.createElement("style");return j.id="pagination-custom-hover",j.innerHTML=`
.custom-hover-color:hover {
filter: brightness(0.9);
}
`,document.head.appendChild(j),()=>{j.parentNode&&j.parentNode.removeChild(j)}}},[]),d.jsxs("div",{className:`flex justify-center items-center mt-6 gap-2 capitolai-pagination ${g}`,style:{borderRadius:S,boxShadow:A,...y},children:[d.jsx("button",{onClick:()=>t(e-1),disabled:e===1,className:`${b} capitolai-pagination__previous-button ${e===1?"capitolai-pagination__previous-button__disabled":"capitolai-pagination__previous-button__active"}`,style:ie(e===1,!!(s&&w(s)),N,{backgroundColor:v,color:F,...C.isDarkMode?{backgroundColor:"#2a2a2a",color:"#e5e5e5"}:{}}),children:i?d.jsx(nr,{className:"w-6 h-6"}):"Previous"}),k().map(j=>{const K=e===j,x=!!(o&&w(o)),re=!!(a&&w(a)),se=!!(s&&w(s)),Q=x||re||se,Se=G(K,Q),he=m(K,Q),be=le(K,Q);return d.jsx("button",{onClick:()=>t(j),className:`${he} ${Se}`,style:be,children:j},j)}),d.jsx("button",{onClick:()=>t(e+1),disabled:e===n,className:`${b} capitolai-pagination__next-button ${e===n?"capitolai-pagination__next-button__disabled":"capitolai-pagination__next-button__active"}`,style:ie(e===n,!!(s&&w(s)),N,{backgroundColor:v,color:F,...C.isDarkMode?{backgroundColor:"#2a2a2a",color:"#e5e5e5"}:{}}),children:i?d.jsx(tr,{className:"w-6 h-6"}):"Next"})]})},or=({sources:e=[],initialItemsCount:n=3,expandButtonText:t="Show all Sources",expandedHeaderText:r="Viewing all sources",horizontalBreakpoint:i=768,className:l="",style:o={}})=>{const[a,s]=Z.useState(!1),u=De(),p=`${i}px`,c=i,[h,f]=Z.useState(typeof window<"u"&&window.innerWidth<i);Z.useEffect(()=>{const y=()=>{f(window.innerWidth<i)};return window.addEventListener("resize",y),y(),()=>{window.removeEventListener("resize",y)}},[i]);const g=a||h?e:e.slice(0,n);return d.jsxs("div",{className:l,style:o,children:[a&&!h&&d.jsxs("div",{className:"flex items-center justify-between",style:{padding:"12px 0px 12px 16px"},children:[d.jsx("span",{className:"font-semibold text-sm",style:{color:u.textColor},children:r}),d.jsx("button",{onClick:()=>s(!1),className:"p-1 rounded-full transition-colors duration-200",style:{background:"transparent",color:u.secondaryTextColor||"#6b7280",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:y=>{y.currentTarget.style.background=u.isDarkMode?"#4a4a4a":"#e5e7eb"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:d.jsx(_l,{color:u.secondaryTextColor||"#6b7280"})})]}),d.jsxs("div",{className:"capitolai__summary-sources__list",style:{"--breakpoint":p},children:[d.jsx("style",{children:`
.capitolai__summary-sources__list {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
}
.capitolai__summary-sources__list > div {
width: auto;
}
@media (max-width: ${c-1}px) {
.capitolai__summary-sources__list {
display: flex;
overflow-x: auto;
padding-bottom: 8px;
gap: 8px;
scrollbar-width: thin;
scrollbar-color: ${u.secondaryTextColor||"#6b7280"} transparent;
}
.capitolai__summary-sources__list > div {
flex-shrink: 0;
width: 252px;
}
}
@media (min-width: 768px) and (max-width: ${c-1}px) {
.capitolai__summary-sources__list > div {
width: 340px;
}
}
`}),g.map((y,C)=>d.jsx("div",{className:"",children:d.jsx(ar,{source:y,index:C,isMasonryLayout:!0})},C))]}),e.length>n&&!a&&!h&&d.jsxs("div",{className:"flex items-center justify-center gap-2 mt-1 p-3 cursor-pointer rounded-lg transition-colors duration-200",style:{background:"transparent"},onClick:()=>s(!0),onMouseEnter:y=>{y.currentTarget.style.background=u.cardBackground||u.rowBackground||"#f5f5f4"},onMouseLeave:y=>{y.currentTarget.style.background="transparent"},children:[d.jsx(Tl,{color:u.isDarkMode?"#FFF":"#242329"}),d.jsx("span",{className:"capitolai__summary-sources__expand-button",style:{color:u.textColor,fontSize:"13px",fontStyle:"normal",fontWeight:700,lineHeight:"20px"},children:t})]})]})},ar=({source:e,index:n,isMasonryLayout:t=!1})=>{const r=De();function i(p){return new URL(p).hostname}const l=i(e.url),o=l,a=(e==null?void 0:e.title)||l,s=(e==null?void 0:e.description)||a,u=e==null?void 0:e.image;return d.jsxs("div",{className:"group p-4 rounded-lg flex cursor-pointer capitolai-pagination__sources__source-block",style:{background:t&&(r.cardBackground||r.rowBackground)||"transparent",borderRadius:r.borderRadius},onMouseEnter:p=>{t?p.currentTarget.style.background=r.cardHoverBackground||r.cardBackground||r.rowBackground||"transparent":p.currentTarget.style.background=r.cardBackground||r.rowBackground||"transparent"},onMouseLeave:p=>{t?p.currentTarget.style.background=r.cardBackground||r.rowBackground||"transparent":p.currentTarget.style.background="transparent"},children:[d.jsxs("div",{onClick:()=>{typeof window<"u"&&window.open(e.url,"_blank")},className:"flex-1","data-testid":"source-clickable",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx("div",{className:"w-5 h-5 min-w-5 rounded-full flex items-center justify-center text-xs",style:{background:r.badgeBackground||"#d1d5db",color:r.badgeTextColor||"#374151"},children:n+1}),d.jsx("img",{style:{marginLeft:"-4px"},className:"w-5 h-5 rounded-full flex items-center justify-center",src:`https://www.google.com/s2/favicons?sz=18&domain=${l}`}),d.jsx("div",{className:"pl-2 uppercase font-medium text-[11px] line-clamp-1 break-all",style:{color:r.secondaryTextColor||"#6b7280"},children:o})]}),!t&&d.jsx("div",{className:"font-bold text-[19px] mt-2 line-clamp-1 break-all group-hover:underline py-1",style:{color:r.textColor},children:a}),d.jsx("div",{className:t?"text-[13px] pt-2 font-bold group-hover:underline line-clamp-3":"text-[15px] line-clamp-3",style:{color:t?r.textColor:r.secondaryTextColor||"#6b7280"},children:s})]},`source-${n}`),t?null:u?d.jsx("img",{className:"w-[174px] h-[116px] ml-12 object-cover",src:u}):d.jsx("div",{className:"w-[174px] h-[116px] ml-12"})]})},sr=({sources:e=[],itemsPerPage:n=4,layout:t="default",paginationConfig:r={},showTitle:i=!0})=>{const[l,o]=Z.useState(1),a=t==="masonry",s=Math.ceil(e.length/n),u=(l-1)*n,p=u+n,c=e.slice(u,p);switch(t){case"compact":return d.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-2 bg-[rgba(36,35,41,0.06)] rounded-full",children:[i&&d.jsx("div",{className:"flex items-center gap-1",children:d.jsxs("span",{className:"text-[13px] font-normal text-[rgba(36,35,41,0.8)]",children:[e.length," Source",e.length!==1?"s":""]})}),d.jsx("div",{className:"flex -space-x-1.5",children:e.map((h,f)=>{const g=new URL(h.url).hostname;return d.jsxs("div",{onClick:()=>window.open(h.url,"_blank"),className:"group relative w-5 h-5 rounded-full bg-[#E7E7E7] border border-white shadow-[0px_1px_5px_-1px_rgba(0,0,0,0.12),0px_2px_2px_-2px_rgba(0,0,0,0.14),0px_3px_1px_-3px_rgba(0,0,0,0.2)] overflow-visible cursor-pointer hover:scale-110 hover:z-20 transition-transform duration-200",children:[d.jsx("img",{src:`https://www.google.com/s2/favicons?sz=32&domain=${g}`,alt:`${g} favicon`,className:"w-full h-full object-cover"}),d.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-gray-700 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap pointer-events-none z-30",children:[h.url,d.jsx("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 rotate-45 w-2 h-2 bg-gray-700"})]})]},h.url)})})]});case"ai-summary":return d.jsx(or,{sources:e});case"masonry":case"default":default:return d.jsxs("div",{children:[i&&d.jsx("div",{className:`font-bold text-xl capitolai-pagination__sources__title ${a?"pb-6":"pb-12"} `,children:`${e.length} source${e.length>0?"s":""}`}),d.jsx("div",{className:`grid grid-cols-1 justify-between capitolai-pagination__sources__list ${a?"gap-2 sm:grid-cols-2":"gap-6"}`,children:c.map((h,f)=>d.jsx(ar,{source:h,index:u+f,isMasonryLayout:a},f))}),(()=>{const{useV2:h,...f}=r,g={currentPage:l,totalPages:s,onPageChange:o,...f};return h?d.jsx(lr,{...g}):d.jsx(rr,{...g})})()]})}};let tn=class{constructor(n,t,r){this.property=n,this.normal=t,r&&(this.space=r)}};tn.prototype.property={},tn.prototype.normal={},tn.prototype.space=null;function ur(e,n){const t={},r={};let i=-1;for(;++i<e.length;)Object.assign(t,e[i].property),Object.assign(r,e[i].normal);return new tn(t,r,n)}function rn(e){return e.toLowerCase()}let Ce=class{constructor(n,t){this.property=n,this.attribute=t}};Ce.prototype.space=null,Ce.prototype.boolean=!1,Ce.prototype.booleanish=!1,Ce.prototype.overloadedBoolean=!1,Ce.prototype.number=!1,Ce.prototype.commaSeparated=!1,Ce.prototype.spaceSeparated=!1,Ce.prototype.commaOrSpaceSeparated=!1,Ce.prototype.mustUseProperty=!1,Ce.prototype.defined=!1;let Ol=0;const U=je(),oe=je(),cr=je(),_=je(),ne=je(),We=je(),ge=je();function je(){return 2**++Ol}const Vn=Object.freeze(Object.defineProperty({__proto__:null,boolean:U,booleanish:oe,commaOrSpaceSeparated:ge,commaSeparated:We,number:_,overloadedBoolean:cr,spaceSeparated:ne},Symbol.toStringTag,{value:"Module"})),Un=Object.keys(Vn);let qn=class extends Ce{constructor(n,t,r,i){let l=-1;if(super(n,t),pr(this,"space",i),typeof r=="number")for(;++l<Un.length;){const o=Un[l];pr(this,Un[l],(r&Vn[o])===Vn[o])}}};qn.prototype.defined=!0;function pr(e,n,t){t&&(e[n]=t)}const Bl={}.hasOwnProperty;function Re(e){const n={},t={};let r;for(r in e.properties)if(Bl.call(e.properties,r)){const i=e.properties[r],l=new qn(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),n[r]=l,t[rn(r)]=r,t[rn(l.attribute)]=r}return new tn(n,t,e.space)}const fr=Re({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),hr=Re({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function dr(e,n){return n in e?e[n]:n}function mr(e,n){return dr(e,n.toLowerCase())}const gr=Re({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:mr,properties:{xmlns:null,xmlnsXLink:null}}),xr=Re({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:oe,ariaAutoComplete:null,ariaBusy:oe,ariaChecked:oe,ariaColCount:_,ariaColIndex:_,ariaColSpan:_,ariaControls:ne,ariaCurrent:null,ariaDescribedBy:ne,ariaDetails:null,ariaDisabled:oe,ariaDropEffect:ne,ariaErrorMessage:null,ariaExpanded:oe,ariaFlowTo:ne,ariaGrabbed:oe,ariaHasPopup:null,ariaHidden:oe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ne,ariaLevel:_,ariaLive:null,ariaModal:oe,ariaMultiLine:oe,ariaMultiSelectable:oe,ariaOrientation:null,ariaOwns:ne,ariaPlaceholder:null,ariaPosInSet:_,ariaPressed:oe,ariaReadOnly:oe,ariaRelevant:null,ariaRequired:oe,ariaRoleDescription:ne,ariaRowCount:_,ariaRowIndex:_,ariaRowSpan:_,ariaSelected:oe,ariaSetSize:_,ariaSort:null,ariaValueMax:_,ariaValueMin:_,ariaValueNow:_,ariaValueText:null,role:null}}),$l=Re({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:mr,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:We,acceptCharset:ne,accessKey:ne,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:ne,autoFocus:U,autoPlay:U,blocking:ne,capture:null,charSet:null,checked:U,cite:null,className:ne,cols:_,colSpan:null,content:null,contentEditable:oe,controls:U,controlsList:ne,coords:_|We,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:cr,draggable:oe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:ne,height:_,hidden:U,high:_,href:null,hrefLang:null,htmlFor:ne,httpEquiv:ne,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:ne,itemRef:ne,itemScope:U,itemType:ne,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:_,manifest:null,max:null,maxLength:_,media:null,method:null,min:null,minLength:_,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:_,pattern:null,ping:ne,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:ne,required:U,reversed:U,rows:_,rowSpan:_,sandbox:ne,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:_,sizes:null,slot:null,span:_,spellCheck:oe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_,step:null,style:null,tabIndex:_,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:oe,width:_,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ne,axis:null,background:null,bgColor:null,border:_,borderColor:null,bottomMargin:_,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:_,leftMargin:_,link:null,longDesc:null,lowSrc:null,marginHeight:_,marginWidth:_,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:_,rules:null,scheme:null,scrolling:oe,standby:null,summary:null,text:null,topMargin:_,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:_,security:null,unselectable:null}}),Hl=Re({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:dr,properties:{about:ge,accentHeight:_,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_,amplitude:_,arabicForm:null,ascent:_,attributeName:null,attributeType:null,azimuth:_,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_,by:null,calcMode:null,capHeight:_,className:ne,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:_,diffuseConstant:_,direction:null,display:null,dur:null,divisor:_,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:_,enableBackground:null,end:null,event:null,exponent:_,externalResourcesRequired:null,fill:null,fillOpacity:_,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:We,g2:We,glyphName:We,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_,horizOriginX:_,horizOriginY:_,id:null,ideographic:_,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_,k:_,k1:_,k2:_,k3:_,k4:_,kernelMatrix:ge,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:_,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:_,overlineThickness:_,paintOrder:null,panose1:null,path:null,pathLength:_,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ne,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_,pointsAtY:_,pointsAtZ:_,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ge,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ge,rev:ge,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ge,requiredFeatures:ge,requiredFonts:ge,requiredFormats:ge,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:_,specularExponent:_,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_,strikethroughThickness:_,string:null,stroke:null,strokeDashArray:ge,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_,strokeOpacity:_,strokeWidth:null,style:null,surfaceScale:_,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ge,tabIndex:_,tableValues:null,target:null,targetX:_,targetY:_,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ge,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_,underlineThickness:_,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_,values:null,vAlphabetic:_,vMathematical:_,vectorEffect:null,vHanging:_,vIdeographic:_,version:null,vertAdvY:_,vertOriginX:_,vertOriginY:_,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),jl=/^data[-\w.:]+$/i,yr=/-[a-z]/g,Vl=/[A-Z]/g;function Ul(e,n){const t=rn(n);let r=n,i=Ce;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&jl.test(n)){if(n.charAt(4)==="-"){const l=n.slice(5).replace(yr,Wl);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=n.slice(4);if(!yr.test(l)){let o=l.replace(Vl,ql);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}i=qn}return new i(r,n)}function ql(e){return"-"+e.toLowerCase()}function Wl(e){return e.charAt(1).toUpperCase()}const Rl=ur([hr,fr,gr,xr,$l],"html");ur([hr,fr,gr,xr,Hl],"svg");const br=/[#.]/g;function Zl(e,n){const t=e||"",r={};let i=0,l,o;for(;i<t.length;){br.lastIndex=i;const a=br.exec(t),s=t.slice(i,a?a.index:t.length);s&&(l?l==="#"?r.id=s:Array.isArray(r.className)?r.className.push(s):r.className=[s]:o=s,i+=s.length),a&&(l=a[0],i++)}return{type:"element",tagName:o||n||"div",properties:r,children:[]}}function kr(e){const n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}function Yl(e){return e.join(" ").trim()}function wr(e){const n=[],t=String(e||"");let r=t.indexOf(","),i=0,l=!1;for(;!l;){r===-1&&(r=t.length,l=!0);const o=t.slice(i,r).trim();(o||!l)&&n.push(o),i=r+1,r=t.indexOf(",",i)}return n}function Xl(e,n){const t={};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const Gl=new Set(["menu","submit","reset","button"]),Cr={}.hasOwnProperty;function Kl(e,n,t){return function(i,l,...o){let a=-1,s;if(i==null)s={type:"root",children:[]},o.unshift(l);else if(s=Zl(i,n),s.tagName=s.tagName.toLowerCase(),Ql(l,s.tagName)){let u;for(u in l)Cr.call(l,u)&&Jl(e,s.properties,u,l[u])}else o.unshift(l);for(;++a<o.length;)Wn(s.children,o[a]);return s.type==="element"&&s.tagName==="template"&&(s.content={type:"root",children:s.children},s.children=[]),s}}function Ql(e,n){return e==null||typeof e!="object"||Array.isArray(e)?!1:n==="input"||!e.type||typeof e.type!="string"?!0:"children"in e&&Array.isArray(e.children)?!1:n==="button"?Gl.has(e.type.toLowerCase()):!("value"in e)}function Jl(e,n,t,r){const i=Ul(e,t);let l=-1,o;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;o=r}else typeof r=="boolean"?o=r:typeof r=="string"?i.spaceSeparated?o=kr(r):i.commaSeparated?o=wr(r):i.commaOrSpaceSeparated?o=kr(wr(r).join(" ")):o=vr(i,i.property,r):Array.isArray(r)?o=r.concat():o=i.property==="style"?eo(r):String(r);if(Array.isArray(o)){const a=[];for(;++l<o.length;)a[l]=vr(i,i.property,o[l]);o=a}i.property==="className"&&Array.isArray(n.className)&&(o=n.className.concat(o)),n[i.property]=o}}function Wn(e,n){let t=-1;if(n!=null)if(typeof n=="string"||typeof n=="number")e.push({type:"text",value:String(n)});else if(Array.isArray(n))for(;++t<n.length;)Wn(e,n[t]);else if(typeof n=="object"&&"type"in n)n.type==="root"?Wn(e,n.children):e.push(n);else throw new Error("Expected node, nodes, or string, got `"+n+"`")}function vr(e,n,t){if(typeof t=="string"){if(e.number&&t&&!Number.isNaN(Number(t)))return Number(t);if((e.boolean||e.overloadedBoolean)&&(t===""||rn(t)===rn(n)))return!0}return t}function eo(e){const n=[];let t;for(t in e)Cr.call(e,t)&&n.push([t,e[t]].join(": "));return n.join("; ")}const no=Kl(Rl,"div");function to(e,n){return t(e,null,null);function t(r,i,l){const o=Object.assign({},n(r,i,l));return"children"in r&&(o.children=r.children.map(function(a,s){return t(a,s,r)})),o}}const ro=e=>{const{type:n}=e;return n==="textDirective"||n==="leafDirective"||n==="containerDirective"},io=e=>{if(ro(e)){const{properties:n,tagName:t}=no(e.name,e.attributes);return Object.assign(Object.assign({},e),{data:{hName:t,hProperties:n}})}return e},lo=e=>to(e,io),oo=()=>lo;function bn(e,n){const t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+n.length);return r}function Oh(){}function Bh(){}const ao=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Sr={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function Er(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=48&&n<=57}function so(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=97&&n<=102||n>=65&&n<=70||n>=48&&n<=57}function uo(e){const n=typeof e=="string"?e.charCodeAt(0):e;return n>=97&&n<=122||n>=65&&n<=90}function Lr(e){return uo(e)||Er(e)}const Ar=document.createElement("i");function ln(e){const n="&"+e+";";Ar.innerHTML=n;const t=Ar.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}const co=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function Rn(e,n){const t=n||{},r=typeof t.additional=="string"?t.additional.charCodeAt(0):t.additional,i=[];let l=0,o=-1,a="",s,u;t.position&&("start"in t.position||"indent"in t.position?(u=t.position.indent,s=t.position.start):s=t.position);let p=(s?s.line:0)||1,c=(s?s.column:0)||1,h=g(),f;for(l--;++l<=e.length;)if(f===10&&(c=(u?u[o]:0)||1),f=e.charCodeAt(l),f===38){const k=e.charCodeAt(l+1);if(k===9||k===10||k===12||k===32||k===38||k===60||Number.isNaN(k)||r&&k===r){a+=String.fromCharCode(f),c++;continue}const S=l+1;let A=S,z=S,O;if(k===35){z=++A;const T=e.charCodeAt(z);T===88||T===120?(O="hexadecimal",z=++A):O="decimal"}else O="named";let v="",F="",$="";const L=O==="named"?Lr:O==="decimal"?Er:so;for(z--;++z<=e.length;){const T=e.charCodeAt(z);if(!L(T))break;$+=String.fromCharCode(T),O==="named"&&ao.includes($)&&(v=$,F=ln($))}let w=e.charCodeAt(z)===59;if(w){z++;const T=O==="named"?ln($):!1;T&&(v=$,F=T)}let D=1+z-S,N="";if(!(!w&&t.nonTerminated===!1))if(!$)O!=="named"&&y(4,D);else if(O==="named"){if(w&&!F)y(5,1);else if(v!==$&&(z=A+v.length,D=1+z-A,w=!1),!w){const T=v?1:3;if(t.attribute){const M=e.charCodeAt(z);M===61?(y(T,D),F=""):Lr(M)?F="":y(T,D)}else y(T,D)}N=F}else{w||y(2,D);let T=Number.parseInt($,O==="hexadecimal"?16:10);if(po(T))y(7,D),N="�";else if(T in Sr)y(6,D),N=Sr[T];else{let M="";fo(T)&&y(6,D),T>65535&&(T-=65536,M+=String.fromCharCode(T>>>10|55296),T=56320|T&1023),N=M+String.fromCharCode(T)}}if(N){C(),h=g(),l=z-1,c+=z-S+1,i.push(N);const T=g();T.offset++,t.reference&&t.reference.call(t.referenceContext||void 0,N,{start:h,end:T},e.slice(S-1,z)),h=T}else $=e.slice(S-1,z),a+=$,c+=$.length,l=z-1}else f===10&&(p++,o++,c=0),Number.isNaN(f)?C():(a+=String.fromCharCode(f),c++);return i.join("");function g(){return{line:p,column:c,offset:l+((s?s.offset:0)||0)}}function y(k,S){let A;t.warning&&(A=g(),A.column+=S,A.offset+=S,t.warning.call(t.warningContext||void 0,co[k],A,k))}function C(){a&&(i.push(a),t.text&&t.text.call(t.textContext||void 0,a,{start:h,end:g()}),a="")}}function po(e){return e>=55296&&e<=57343||e>1114111}function fo(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}const ho=/["&'<>`]/g,mo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,go=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,xo=/[|\\{}()[\]^$+*?.]/g,Tr=new WeakMap;function yo(e,n){if(e=e.replace(n.subset?bo(n.subset):ho,r),n.subset||n.escapeOnly)return e;return e.replace(mo,t).replace(go,r);function t(i,l,o){return n.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(l+2),n)}function r(i,l,o){return n.format(i.charCodeAt(0),o.charCodeAt(l+1),n)}}function bo(e){let n=Tr.get(e);return n||(n=ko(e),Tr.set(e,n)),n}function ko(e){const n=[];let t=-1;for(;++t<e.length;)n.push(e[t].replace(xo,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}function wo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Co(e,n){return yo(e,Object.assign({format:wo},n))}const kn=function(e){if(e==null)return Lo;if(typeof e=="function")return wn(e);if(typeof e=="object")return Array.isArray(e)?vo(e):So(e);if(typeof e=="string")return Eo(e);throw new Error("Expected function, string, or object as test")};function vo(e){const n=[];let t=-1;for(;++t<e.length;)n[t]=kn(e[t]);return wn(r);function r(...i){let l=-1;for(;++l<n.length;)if(n[l].apply(this,i))return!0;return!1}}function So(e){const n=e;return wn(t);function t(r){const i=r;let l;for(l in e)if(i[l]!==n[l])return!1;return!0}}function Eo(e){return wn(n);function n(t){return t&&t.type===e}}function wn(e){return n;function n(t,r,i){return!!(Ao(t)&&e.call(this,t,typeof r=="number"?r:void 0,i||void 0))}}function Lo(){return!0}function Ao(e){return e!==null&&typeof e=="object"&&"type"in e}function $h(e){return e}const _r=[],To=!0,Zn=!1,_o="skip";function Yn(e,n,t,r){let i;typeof n=="function"&&typeof t!="function"?(r=t,t=n):i=n;const l=kn(i),o=r?-1:1;a(e,void 0,[])();function a(s,u,p){const c=s&&typeof s=="object"?s:{};if(typeof c.type=="string"){const f=typeof c.tagName=="string"?c.tagName:typeof c.name=="string"?c.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(s.type+(f?"<"+f+">":""))+")"})}return h;function h(){let f=_r,g,y,C;if((!n||l(s,u,p[p.length-1]||void 0))&&(f=Io(t(s,p)),f[0]===Zn))return f;if("children"in s&&s.children){const k=s;if(k.children&&f[0]!==_o)for(y=(r?k.children.length:-1)+o,C=p.concat(k);y>-1&&y<k.children.length;){const S=k.children[y];if(g=a(S,y,C)(),g[0]===Zn)return g;y=typeof g[1]=="number"?g[1]:y+o}}return f}}}function Io(e){return Array.isArray(e)?e:typeof e=="number"?[To,e]:e==null?_r:[e]}const Do={}.hasOwnProperty,No={},Ir=/^[^\t\n\r "#'.<=>`}]+$/,Mo=/^[^\t\n\r "'<=>`}]+$/;function Po(){return{canContainEols:["textDirective"],enter:{directiveContainer:Fo,directiveContainerAttributes:Kn,directiveContainerLabel:$o,directiveLeaf:Oo,directiveLeafAttributes:Kn,directiveText:Bo,directiveTextAttributes:Kn},exit:{directiveContainer:rt,directiveContainerAttributeClassValue:Jn,directiveContainerAttributeIdValue:Qn,directiveContainerAttributeName:nt,directiveContainerAttributeValue:et,directiveContainerAttributes:tt,directiveContainerLabel:Ho,directiveContainerName:Gn,directiveLeaf:rt,directiveLeafAttributeClassValue:Jn,directiveLeafAttributeIdValue:Qn,directiveLeafAttributeName:nt,directiveLeafAttributeValue:et,directiveLeafAttributes:tt,directiveLeafName:Gn,directiveText:rt,directiveTextAttributeClassValue:Jn,directiveTextAttributeIdValue:Qn,directiveTextAttributeName:nt,directiveTextAttributeValue:et,directiveTextAttributes:tt,directiveTextName:Gn}}}function zo(e){const n=No;if(n.quote!=='"'&&n.quote!=="'"&&n.quote!==null&&n.quote!==void 0)throw new Error("Invalid quote `"+n.quote+"`, expected `'` or `\"`");return t.peek=jo,{handlers:{containerDirective:t,leafDirective:t,textDirective:t},unsafe:[{character:"\r",inConstruct:["leafDirectiveLabel","containerDirecti