ragbits-chat 1.4.0.dev202601130240__py3-none-any.whl → 1.4.0.dev202601261217__py3-none-any.whl

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.
Files changed (31) hide show
  1. ragbits/chat/api.py +2 -18
  2. ragbits/chat/auth/backends.py +3 -7
  3. ragbits/chat/auth/oauth2_providers.py +68 -57
  4. ragbits/chat/config.py +14 -0
  5. ragbits/chat/interface/types.py +14 -1
  6. ragbits/chat/ui-build/assets/{AuthGuard-Bq7UOJ7y.js → AuthGuard-Cx5RMDp4.js} +1 -1
  7. ragbits/chat/ui-build/assets/{ChatHistory-B2hLBYMJ.js → ChatHistory-B3UBsNvZ.js} +2 -2
  8. ragbits/chat/ui-build/assets/{ChatOptionsForm-bfNG8UIW.js → ChatOptionsForm-BrCE2xzb.js} +1 -1
  9. ragbits/chat/ui-build/assets/{CredentialsLogin-0g5-w2vR.js → CredentialsLogin-CEK3mRK4.js} +1 -1
  10. ragbits/chat/ui-build/assets/{FeedbackForm-oSbly5oN.js → FeedbackForm-DPvg41JE.js} +1 -1
  11. ragbits/chat/ui-build/assets/{Login-DSW_CNFu.js → Login-BXQQneyo.js} +1 -1
  12. ragbits/chat/ui-build/assets/{LogoutButton-BQE8NNsg.js → LogoutButton-Ces7BeFM.js} +1 -1
  13. ragbits/chat/ui-build/assets/{OAuth2Login-EmJ39PUe.js → OAuth2Login-DLVcE-N3.js} +1 -1
  14. ragbits/chat/ui-build/assets/{ShareButton-B7DyIVH0.js → ShareButton-Db-ETLGk.js} +1 -1
  15. ragbits/chat/ui-build/assets/{UsageButton-BABA7a-w.js → UsageButton-Bu4FCWlg.js} +1 -1
  16. ragbits/chat/ui-build/assets/{authStore-BfGlL8rp.js → authStore-Cp9xyIuV.js} +1 -1
  17. ragbits/chat/ui-build/assets/{chunk-IGSAU2ZA-NXd1g0Qd.js → chunk-IGSAU2ZA-DHvCEIx7.js} +1 -1
  18. ragbits/chat/ui-build/assets/{chunk-SSA7SXE4-CJa0HuAU.js → chunk-SSA7SXE4-BCYHNA13.js} +1 -1
  19. ragbits/chat/ui-build/assets/index-B-88tkTe.js +1 -0
  20. ragbits/chat/ui-build/assets/{index-BZLU40Mk.js → index-B4zFOTZJ.js} +6 -6
  21. ragbits/chat/ui-build/assets/{index-Be0kkf3d.js → index-CDEUYvL4.js} +2 -2
  22. ragbits/chat/ui-build/assets/{index-Ceq7Rkzy.js → index-ImQERw7x.js} +1 -1
  23. ragbits/chat/ui-build/assets/{useInitializeUserStore-DyHP7g8x.js → useInitializeUserStore-DgAMSA_P.js} +1 -1
  24. ragbits/chat/ui-build/assets/{useMenuTriggerState-SaFmATkk.js → useMenuTriggerState-DSUFgtjp.js} +1 -1
  25. ragbits/chat/ui-build/assets/{useSelectableItem-DhuFnc0W.js → useSelectableItem-DaVTqvPd.js} +1 -1
  26. ragbits/chat/ui-build/index.html +1 -1
  27. {ragbits_chat-1.4.0.dev202601130240.dist-info → ragbits_chat-1.4.0.dev202601261217.dist-info}/METADATA +2 -2
  28. ragbits_chat-1.4.0.dev202601261217.dist-info/RECORD +59 -0
  29. ragbits/chat/ui-build/assets/index-Bvn9K6h_.js +0 -1
  30. ragbits_chat-1.4.0.dev202601130240.dist-info/RECORD +0 -58
  31. {ragbits_chat-1.4.0.dev202601130240.dist-info → ragbits_chat-1.4.0.dev202601261217.dist-info}/WHEEL +0 -0
@@ -1,2 +1,2 @@
1
- import{ar as An,r as K,c as Sn,j as le,aq as Rn,aG as yn,d as On}from"./index-BZLU40Mk.js";var $e,Nt;function Mt(){if(Nt)return $e;Nt=1;const{entries:Z,setPrototypeOf:C,isFrozen:w,getPrototypeOf:ye,getOwnPropertyDescriptor:ce}=Object;let{freeze:T,seal:y,create:k}=Object,{apply:z,construct:H}=typeof Reflect<"u"&&Reflect;T||(T=function(o){return o}),y||(y=function(o){return o}),z||(z=function(o,l){for(var r=arguments.length,c=new Array(r>2?r-2:0),O=2;O<r;O++)c[O-2]=arguments[O];return o.apply(l,c)}),H||(H=function(o){for(var l=arguments.length,r=new Array(l>1?l-1:0),c=1;c<l;c++)r[c-1]=arguments[c];return new o(...r)});const G=A(Array.prototype.forEach),ue=A(Array.prototype.lastIndexOf),fe=A(Array.prototype.pop),b=A(Array.prototype.push),wt=A(Array.prototype.splice),me=A(String.prototype.toLowerCase),Oe=A(String.prototype.toString),Le=A(String.prototype.match),J=A(String.prototype.replace),xt=A(String.prototype.indexOf),Pt=A(String.prototype.trim),D=A(Object.prototype.hasOwnProperty),h=A(RegExp.prototype.test),Q=vt(TypeError);function A(s){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var l=arguments.length,r=new Array(l>1?l-1:0),c=1;c<l;c++)r[c-1]=arguments[c];return z(s,o,r)}}function vt(s){return function(){for(var o=arguments.length,l=new Array(o),r=0;r<o;r++)l[r]=arguments[r];return H(s,l)}}function a(s,o){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:me;C&&C(s,null);let r=o.length;for(;r--;){let c=o[r];if(typeof c=="string"){const O=l(c);O!==c&&(w(o)||(o[r]=O),c=O)}s[c]=!0}return s}function kt(s){for(let o=0;o<s.length;o++)D(s,o)||(s[o]=null);return s}function I(s){const o=k(null);for(const[l,r]of Z(s))D(s,l)&&(Array.isArray(r)?o[l]=kt(r):r&&typeof r=="object"&&r.constructor===Object?o[l]=I(r):o[l]=r);return o}function ee(s,o){for(;s!==null;){const r=ce(s,o);if(r){if(r.get)return A(r.get);if(typeof r.value=="function")return A(r.value)}s=ye(s)}function l(){return null}return l}const Ve=T(["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","search","section","select","shadow","slot","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"]),be=T(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),De=T(["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"]),Ft=T(["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"]),Ie=T(["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"]),Ut=T(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ke=T(["#text"]),Ze=T(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ne=T(["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","mask-type","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"]),Je=T(["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"]),pe=T(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zt=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ht=y(/<%[\w\W]*|[\w\W]*%>/gm),Gt=y(/\$\{[\w\W]*/gm),Wt=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bt=y(/^aria-[\-\w]+$/),Qe=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yt=y(/^(?:\w+script|data):/i),jt=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),et=y(/^html$/i),Xt=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var tt=Object.freeze({__proto__:null,ARIA_ATTR:Bt,ATTR_WHITESPACE:jt,CUSTOM_ELEMENT:Xt,DATA_ATTR:Wt,DOCTYPE_NAME:et,ERB_EXPR:Ht,IS_ALLOWED_URI:Qe,IS_SCRIPT_OR_DATA:Yt,MUSTACHE_EXPR:zt,TMPLIT_EXPR:Gt});const te={element:1,text:3,progressingInstruction:7,comment:8,document:9},$t=function(){return typeof window>"u"?null:window},qt=function(o,l){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let r=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(r=l.getAttribute(c));const O="dompurify"+(r?"#"+r:"");try{return o.createPolicy(O,{createHTML(W){return W},createScriptURL(W){return W}})}catch{return console.warn("TrustedTypes policy "+O+" could not be created."),null}},nt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ot(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$t();const o=i=>ot(i);if(o.version="3.3.1",o.removed=[],!s||!s.document||s.document.nodeType!==te.document||!s.Element)return o.isSupported=!1,o;let{document:l}=s;const r=l,c=r.currentScript,{DocumentFragment:O,HTMLTemplateElement:W,Node:Me,Element:it,NodeFilter:ne,NamedNodeMap:Kt=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:Zt,DOMParser:Jt,trustedTypes:de}=s,oe=it.prototype,Qt=ee(oe,"cloneNode"),en=ee(oe,"remove"),tn=ee(oe,"nextSibling"),nn=ee(oe,"childNodes"),Te=ee(oe,"parentNode");if(typeof W=="function"){const i=l.createElement("template");i.content&&i.content.ownerDocument&&(l=i.content.ownerDocument)}let S,ie="";const{implementation:Ce,createNodeIterator:on,createDocumentFragment:rn,getElementsByTagName:an}=l,{importNode:sn}=r;let R=nt();o.isSupported=typeof Z=="function"&&typeof Te=="function"&&Ce&&Ce.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:we,ERB_EXPR:xe,TMPLIT_EXPR:Pe,DATA_ATTR:ln,ARIA_ATTR:cn,IS_SCRIPT_OR_DATA:un,ATTR_WHITESPACE:rt,CUSTOM_ELEMENT:fn}=tt;let{IS_ALLOWED_URI:at}=tt,d=null;const st=a({},[...Ve,...be,...De,...Ie,...Ke]);let E=null;const lt=a({},[...Ze,...Ne,...Je,...pe]);let f=Object.seal(k(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}})),re=null,ve=null;const B=Object.seal(k(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ct=!0,ke=!0,ut=!1,ft=!0,Y=!1,Ee=!0,F=!1,Fe=!1,Ue=!1,j=!1,_e=!1,ge=!1,mt=!0,pt=!1;const mn="user-content-";let ze=!0,ae=!1,X={},N=null;const He=a({},["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 dt=null;const Tt=a({},["audio","video","img","source","image","track"]);let Ge=null;const Et=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",Ae="http://www.w3.org/2000/svg",x="http://www.w3.org/1999/xhtml";let $=x,We=!1,Be=null;const pn=a({},[he,Ae,x],Oe);let Se=a({},["mi","mo","mn","ms","mtext"]),Re=a({},["annotation-xml"]);const dn=a({},["title","style","font","a","script"]);let se=null;const Tn=["application/xhtml+xml","text/html"],En="text/html";let p=null,q=null;const _n=l.createElement("form"),_t=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(q&&q===e)){if((!e||typeof e!="object")&&(e={}),e=I(e),se=Tn.indexOf(e.PARSER_MEDIA_TYPE)===-1?En:e.PARSER_MEDIA_TYPE,p=se==="application/xhtml+xml"?Oe:me,d=D(e,"ALLOWED_TAGS")?a({},e.ALLOWED_TAGS,p):st,E=D(e,"ALLOWED_ATTR")?a({},e.ALLOWED_ATTR,p):lt,Be=D(e,"ALLOWED_NAMESPACES")?a({},e.ALLOWED_NAMESPACES,Oe):pn,Ge=D(e,"ADD_URI_SAFE_ATTR")?a(I(Et),e.ADD_URI_SAFE_ATTR,p):Et,dt=D(e,"ADD_DATA_URI_TAGS")?a(I(Tt),e.ADD_DATA_URI_TAGS,p):Tt,N=D(e,"FORBID_CONTENTS")?a({},e.FORBID_CONTENTS,p):He,re=D(e,"FORBID_TAGS")?a({},e.FORBID_TAGS,p):I({}),ve=D(e,"FORBID_ATTR")?a({},e.FORBID_ATTR,p):I({}),X=D(e,"USE_PROFILES")?e.USE_PROFILES:!1,ct=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,ut=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ft=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,F=e.WHOLE_DOCUMENT||!1,j=e.RETURN_DOM||!1,_e=e.RETURN_DOM_FRAGMENT||!1,ge=e.RETURN_TRUSTED_TYPE||!1,Ue=e.FORCE_BODY||!1,mt=e.SANITIZE_DOM!==!1,pt=e.SANITIZE_NAMED_PROPS||!1,ze=e.KEEP_CONTENT!==!1,ae=e.IN_PLACE||!1,at=e.ALLOWED_URI_REGEXP||Qe,$=e.NAMESPACE||x,Se=e.MATHML_TEXT_INTEGRATION_POINTS||Se,Re=e.HTML_INTEGRATION_POINTS||Re,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(ke=!1),_e&&(j=!0),X&&(d=a({},Ke),E=[],X.html===!0&&(a(d,Ve),a(E,Ze)),X.svg===!0&&(a(d,be),a(E,Ne),a(E,pe)),X.svgFilters===!0&&(a(d,De),a(E,Ne),a(E,pe)),X.mathMl===!0&&(a(d,Ie),a(E,Je),a(E,pe))),e.ADD_TAGS&&(typeof e.ADD_TAGS=="function"?B.tagCheck=e.ADD_TAGS:(d===st&&(d=I(d)),a(d,e.ADD_TAGS,p))),e.ADD_ATTR&&(typeof e.ADD_ATTR=="function"?B.attributeCheck=e.ADD_ATTR:(E===lt&&(E=I(E)),a(E,e.ADD_ATTR,p))),e.ADD_URI_SAFE_ATTR&&a(Ge,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(N===He&&(N=I(N)),a(N,e.FORBID_CONTENTS,p)),e.ADD_FORBID_CONTENTS&&(N===He&&(N=I(N)),a(N,e.ADD_FORBID_CONTENTS,p)),ze&&(d["#text"]=!0),F&&a(d,["html","head","body"]),d.table&&(a(d,["tbody"]),delete re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=e.TRUSTED_TYPES_POLICY,ie=S.createHTML("")}else S===void 0&&(S=qt(de,c)),S!==null&&typeof ie=="string"&&(ie=S.createHTML(""));T&&T(e),q=e}},gt=a({},[...be,...De,...Ft]),ht=a({},[...Ie,...Ut]),gn=function(e){let t=Te(e);(!t||!t.tagName)&&(t={namespaceURI:$,tagName:"template"});const n=me(e.tagName),u=me(t.tagName);return Be[e.namespaceURI]?e.namespaceURI===Ae?t.namespaceURI===x?n==="svg":t.namespaceURI===he?n==="svg"&&(u==="annotation-xml"||Se[u]):!!gt[n]:e.namespaceURI===he?t.namespaceURI===x?n==="math":t.namespaceURI===Ae?n==="math"&&Re[u]:!!ht[n]:e.namespaceURI===x?t.namespaceURI===Ae&&!Re[u]||t.namespaceURI===he&&!Se[u]?!1:!ht[n]&&(dn[n]||!gt[n]):!!(se==="application/xhtml+xml"&&Be[e.namespaceURI]):!1},M=function(e){b(o.removed,{element:e});try{Te(e).removeChild(e)}catch{en(e)}},U=function(e,t){try{b(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{b(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(j||_e)try{M(t)}catch{}else try{t.setAttribute(e,"")}catch{}},At=function(e){let t=null,n=null;if(Ue)e="<remove></remove>"+e;else{const m=Le(e,/^[\r\n\t ]+/);n=m&&m[0]}se==="application/xhtml+xml"&&$===x&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const u=S?S.createHTML(e):e;if($===x)try{t=new Jt().parseFromString(u,se)}catch{}if(!t||!t.documentElement){t=Ce.createDocument($,"template",null);try{t.documentElement.innerHTML=We?ie:u}catch{}}const g=t.body||t.documentElement;return e&&n&&g.insertBefore(l.createTextNode(n),g.childNodes[0]||null),$===x?an.call(t,F?"html":"body")[0]:F?t.documentElement:g},St=function(e){return on.call(e.ownerDocument||e,e,ne.SHOW_ELEMENT|ne.SHOW_COMMENT|ne.SHOW_TEXT|ne.SHOW_PROCESSING_INSTRUCTION|ne.SHOW_CDATA_SECTION,null)},je=function(e){return e instanceof Zt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Kt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},Rt=function(e){return typeof Me=="function"&&e instanceof Me};function P(i,e,t){G(i,n=>{n.call(o,e,t,q)})}const yt=function(e){let t=null;if(P(R.beforeSanitizeElements,e,null),je(e))return M(e),!0;const n=p(e.nodeName);if(P(R.uponSanitizeElement,e,{tagName:n,allowedTags:d}),Ee&&e.hasChildNodes()&&!Rt(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===te.progressingInstruction||Ee&&e.nodeType===te.comment&&h(/<[/\w]/g,e.data))return M(e),!0;if(!(B.tagCheck instanceof Function&&B.tagCheck(n))&&(!d[n]||re[n])){if(!re[n]&&Lt(n)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n)))return!1;if(ze&&!N[n]){const u=Te(e)||e.parentNode,g=nn(e)||e.childNodes;if(g&&u){const m=g.length;for(let L=m-1;L>=0;--L){const v=Qt(g[L],!0);v.__removalCount=(e.__removalCount||0)+1,u.insertBefore(v,tn(e))}}}return M(e),!0}return e instanceof it&&!gn(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(M(e),!0):(Y&&e.nodeType===te.text&&(t=e.textContent,G([we,xe,Pe],u=>{t=J(t,u," ")}),e.textContent!==t&&(b(o.removed,{element:e.cloneNode()}),e.textContent=t)),P(R.afterSanitizeElements,e,null),!1)},Ot=function(e,t,n){if(mt&&(t==="id"||t==="name")&&(n in l||n in _n))return!1;if(!(ke&&!ve[t]&&h(ln,t))){if(!(ct&&h(cn,t))){if(!(B.attributeCheck instanceof Function&&B.attributeCheck(t,e))){if(!E[t]||ve[t]){if(!(Lt(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t,e))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n))))return!1}else if(!Ge[t]){if(!h(at,J(n,rt,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&xt(n,"data:")===0&&dt[e])){if(!(ut&&!h(un,J(n,rt,"")))){if(n)return!1}}}}}}}return!0},Lt=function(e){return e!=="annotation-xml"&&Le(e,fn)},bt=function(e){P(R.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||je(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0};let u=t.length;for(;u--;){const g=t[u],{name:m,namespaceURI:L,value:v}=g,V=p(m),Xe=v;let _=m==="value"?Xe:Pt(Xe);if(n.attrName=V,n.attrValue=_,n.keepAttr=!0,n.forceKeepAttr=void 0,P(R.uponSanitizeAttribute,e,n),_=n.attrValue,pt&&(V==="id"||V==="name")&&(U(m,e),_=mn+_),Ee&&h(/((--!?|])>)|<\/(style|title|textarea)/i,_)){U(m,e);continue}if(V==="attributename"&&Le(_,"href")){U(m,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){U(m,e);continue}if(!ft&&h(/\/>/i,_)){U(m,e);continue}Y&&G([we,xe,Pe],It=>{_=J(_,It," ")});const Dt=p(e.nodeName);if(!Ot(Dt,V,_)){U(m,e);continue}if(S&&typeof de=="object"&&typeof de.getAttributeType=="function"&&!L)switch(de.getAttributeType(Dt,V)){case"TrustedHTML":{_=S.createHTML(_);break}case"TrustedScriptURL":{_=S.createScriptURL(_);break}}if(_!==Xe)try{L?e.setAttributeNS(L,m,_):e.setAttribute(m,_),je(e)?M(e):fe(o.removed)}catch{U(m,e)}}P(R.afterSanitizeAttributes,e,null)},hn=function i(e){let t=null;const n=St(e);for(P(R.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)P(R.uponSanitizeShadowNode,t,null),yt(t),bt(t),t.content instanceof O&&i(t.content);P(R.afterSanitizeShadowDOM,e,null)};return o.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,u=null,g=null;if(We=!i,We&&(i="<!-->"),typeof i!="string"&&!Rt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw Q("dirty is not a string, aborting")}else throw Q("toString is not a function");if(!o.isSupported)return i;if(Fe||Ye(e),o.removed=[],typeof i=="string"&&(ae=!1),ae){if(i.nodeName){const v=p(i.nodeName);if(!d[v]||re[v])throw Q("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof Me)t=At("<!---->"),n=t.ownerDocument.importNode(i,!0),n.nodeType===te.element&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!j&&!Y&&!F&&i.indexOf("<")===-1)return S&&ge?S.createHTML(i):i;if(t=At(i),!t)return j?null:ge?ie:""}t&&Ue&&M(t.firstChild);const m=St(ae?i:t);for(;u=m.nextNode();)yt(u),bt(u),u.content instanceof O&&hn(u.content);if(ae)return i;if(j){if(_e)for(g=rn.call(t.ownerDocument);t.firstChild;)g.appendChild(t.firstChild);else g=t;return(E.shadowroot||E.shadowrootmode)&&(g=sn.call(r,g,!0)),g}let L=F?t.outerHTML:t.innerHTML;return F&&d["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(et,t.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
1
+ import{ar as An,r as K,c as Sn,j as le,aq as Rn,aG as yn,d as On}from"./index-B4zFOTZJ.js";var $e,Nt;function Mt(){if(Nt)return $e;Nt=1;const{entries:Z,setPrototypeOf:C,isFrozen:w,getPrototypeOf:ye,getOwnPropertyDescriptor:ce}=Object;let{freeze:T,seal:y,create:k}=Object,{apply:z,construct:H}=typeof Reflect<"u"&&Reflect;T||(T=function(o){return o}),y||(y=function(o){return o}),z||(z=function(o,l){for(var r=arguments.length,c=new Array(r>2?r-2:0),O=2;O<r;O++)c[O-2]=arguments[O];return o.apply(l,c)}),H||(H=function(o){for(var l=arguments.length,r=new Array(l>1?l-1:0),c=1;c<l;c++)r[c-1]=arguments[c];return new o(...r)});const G=A(Array.prototype.forEach),ue=A(Array.prototype.lastIndexOf),fe=A(Array.prototype.pop),b=A(Array.prototype.push),wt=A(Array.prototype.splice),me=A(String.prototype.toLowerCase),Oe=A(String.prototype.toString),Le=A(String.prototype.match),J=A(String.prototype.replace),xt=A(String.prototype.indexOf),Pt=A(String.prototype.trim),D=A(Object.prototype.hasOwnProperty),h=A(RegExp.prototype.test),Q=vt(TypeError);function A(s){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var l=arguments.length,r=new Array(l>1?l-1:0),c=1;c<l;c++)r[c-1]=arguments[c];return z(s,o,r)}}function vt(s){return function(){for(var o=arguments.length,l=new Array(o),r=0;r<o;r++)l[r]=arguments[r];return H(s,l)}}function a(s,o){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:me;C&&C(s,null);let r=o.length;for(;r--;){let c=o[r];if(typeof c=="string"){const O=l(c);O!==c&&(w(o)||(o[r]=O),c=O)}s[c]=!0}return s}function kt(s){for(let o=0;o<s.length;o++)D(s,o)||(s[o]=null);return s}function I(s){const o=k(null);for(const[l,r]of Z(s))D(s,l)&&(Array.isArray(r)?o[l]=kt(r):r&&typeof r=="object"&&r.constructor===Object?o[l]=I(r):o[l]=r);return o}function ee(s,o){for(;s!==null;){const r=ce(s,o);if(r){if(r.get)return A(r.get);if(typeof r.value=="function")return A(r.value)}s=ye(s)}function l(){return null}return l}const Ve=T(["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","search","section","select","shadow","slot","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"]),be=T(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),De=T(["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"]),Ft=T(["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"]),Ie=T(["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"]),Ut=T(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ke=T(["#text"]),Ze=T(["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","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","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","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ne=T(["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","mask-type","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"]),Je=T(["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"]),pe=T(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zt=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ht=y(/<%[\w\W]*|[\w\W]*%>/gm),Gt=y(/\$\{[\w\W]*/gm),Wt=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bt=y(/^aria-[\-\w]+$/),Qe=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yt=y(/^(?:\w+script|data):/i),jt=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),et=y(/^html$/i),Xt=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var tt=Object.freeze({__proto__:null,ARIA_ATTR:Bt,ATTR_WHITESPACE:jt,CUSTOM_ELEMENT:Xt,DATA_ATTR:Wt,DOCTYPE_NAME:et,ERB_EXPR:Ht,IS_ALLOWED_URI:Qe,IS_SCRIPT_OR_DATA:Yt,MUSTACHE_EXPR:zt,TMPLIT_EXPR:Gt});const te={element:1,text:3,progressingInstruction:7,comment:8,document:9},$t=function(){return typeof window>"u"?null:window},qt=function(o,l){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let r=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(r=l.getAttribute(c));const O="dompurify"+(r?"#"+r:"");try{return o.createPolicy(O,{createHTML(W){return W},createScriptURL(W){return W}})}catch{return console.warn("TrustedTypes policy "+O+" could not be created."),null}},nt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ot(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$t();const o=i=>ot(i);if(o.version="3.3.1",o.removed=[],!s||!s.document||s.document.nodeType!==te.document||!s.Element)return o.isSupported=!1,o;let{document:l}=s;const r=l,c=r.currentScript,{DocumentFragment:O,HTMLTemplateElement:W,Node:Me,Element:it,NodeFilter:ne,NamedNodeMap:Kt=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:Zt,DOMParser:Jt,trustedTypes:de}=s,oe=it.prototype,Qt=ee(oe,"cloneNode"),en=ee(oe,"remove"),tn=ee(oe,"nextSibling"),nn=ee(oe,"childNodes"),Te=ee(oe,"parentNode");if(typeof W=="function"){const i=l.createElement("template");i.content&&i.content.ownerDocument&&(l=i.content.ownerDocument)}let S,ie="";const{implementation:Ce,createNodeIterator:on,createDocumentFragment:rn,getElementsByTagName:an}=l,{importNode:sn}=r;let R=nt();o.isSupported=typeof Z=="function"&&typeof Te=="function"&&Ce&&Ce.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:we,ERB_EXPR:xe,TMPLIT_EXPR:Pe,DATA_ATTR:ln,ARIA_ATTR:cn,IS_SCRIPT_OR_DATA:un,ATTR_WHITESPACE:rt,CUSTOM_ELEMENT:fn}=tt;let{IS_ALLOWED_URI:at}=tt,d=null;const st=a({},[...Ve,...be,...De,...Ie,...Ke]);let E=null;const lt=a({},[...Ze,...Ne,...Je,...pe]);let f=Object.seal(k(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}})),re=null,ve=null;const B=Object.seal(k(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ct=!0,ke=!0,ut=!1,ft=!0,Y=!1,Ee=!0,F=!1,Fe=!1,Ue=!1,j=!1,_e=!1,ge=!1,mt=!0,pt=!1;const mn="user-content-";let ze=!0,ae=!1,X={},N=null;const He=a({},["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 dt=null;const Tt=a({},["audio","video","img","source","image","track"]);let Ge=null;const Et=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),he="http://www.w3.org/1998/Math/MathML",Ae="http://www.w3.org/2000/svg",x="http://www.w3.org/1999/xhtml";let $=x,We=!1,Be=null;const pn=a({},[he,Ae,x],Oe);let Se=a({},["mi","mo","mn","ms","mtext"]),Re=a({},["annotation-xml"]);const dn=a({},["title","style","font","a","script"]);let se=null;const Tn=["application/xhtml+xml","text/html"],En="text/html";let p=null,q=null;const _n=l.createElement("form"),_t=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(q&&q===e)){if((!e||typeof e!="object")&&(e={}),e=I(e),se=Tn.indexOf(e.PARSER_MEDIA_TYPE)===-1?En:e.PARSER_MEDIA_TYPE,p=se==="application/xhtml+xml"?Oe:me,d=D(e,"ALLOWED_TAGS")?a({},e.ALLOWED_TAGS,p):st,E=D(e,"ALLOWED_ATTR")?a({},e.ALLOWED_ATTR,p):lt,Be=D(e,"ALLOWED_NAMESPACES")?a({},e.ALLOWED_NAMESPACES,Oe):pn,Ge=D(e,"ADD_URI_SAFE_ATTR")?a(I(Et),e.ADD_URI_SAFE_ATTR,p):Et,dt=D(e,"ADD_DATA_URI_TAGS")?a(I(Tt),e.ADD_DATA_URI_TAGS,p):Tt,N=D(e,"FORBID_CONTENTS")?a({},e.FORBID_CONTENTS,p):He,re=D(e,"FORBID_TAGS")?a({},e.FORBID_TAGS,p):I({}),ve=D(e,"FORBID_ATTR")?a({},e.FORBID_ATTR,p):I({}),X=D(e,"USE_PROFILES")?e.USE_PROFILES:!1,ct=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,ut=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ft=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Y=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,F=e.WHOLE_DOCUMENT||!1,j=e.RETURN_DOM||!1,_e=e.RETURN_DOM_FRAGMENT||!1,ge=e.RETURN_TRUSTED_TYPE||!1,Ue=e.FORCE_BODY||!1,mt=e.SANITIZE_DOM!==!1,pt=e.SANITIZE_NAMED_PROPS||!1,ze=e.KEEP_CONTENT!==!1,ae=e.IN_PLACE||!1,at=e.ALLOWED_URI_REGEXP||Qe,$=e.NAMESPACE||x,Se=e.MATHML_TEXT_INTEGRATION_POINTS||Se,Re=e.HTML_INTEGRATION_POINTS||Re,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(ke=!1),_e&&(j=!0),X&&(d=a({},Ke),E=[],X.html===!0&&(a(d,Ve),a(E,Ze)),X.svg===!0&&(a(d,be),a(E,Ne),a(E,pe)),X.svgFilters===!0&&(a(d,De),a(E,Ne),a(E,pe)),X.mathMl===!0&&(a(d,Ie),a(E,Je),a(E,pe))),e.ADD_TAGS&&(typeof e.ADD_TAGS=="function"?B.tagCheck=e.ADD_TAGS:(d===st&&(d=I(d)),a(d,e.ADD_TAGS,p))),e.ADD_ATTR&&(typeof e.ADD_ATTR=="function"?B.attributeCheck=e.ADD_ATTR:(E===lt&&(E=I(E)),a(E,e.ADD_ATTR,p))),e.ADD_URI_SAFE_ATTR&&a(Ge,e.ADD_URI_SAFE_ATTR,p),e.FORBID_CONTENTS&&(N===He&&(N=I(N)),a(N,e.FORBID_CONTENTS,p)),e.ADD_FORBID_CONTENTS&&(N===He&&(N=I(N)),a(N,e.ADD_FORBID_CONTENTS,p)),ze&&(d["#text"]=!0),F&&a(d,["html","head","body"]),d.table&&(a(d,["tbody"]),delete re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=e.TRUSTED_TYPES_POLICY,ie=S.createHTML("")}else S===void 0&&(S=qt(de,c)),S!==null&&typeof ie=="string"&&(ie=S.createHTML(""));T&&T(e),q=e}},gt=a({},[...be,...De,...Ft]),ht=a({},[...Ie,...Ut]),gn=function(e){let t=Te(e);(!t||!t.tagName)&&(t={namespaceURI:$,tagName:"template"});const n=me(e.tagName),u=me(t.tagName);return Be[e.namespaceURI]?e.namespaceURI===Ae?t.namespaceURI===x?n==="svg":t.namespaceURI===he?n==="svg"&&(u==="annotation-xml"||Se[u]):!!gt[n]:e.namespaceURI===he?t.namespaceURI===x?n==="math":t.namespaceURI===Ae?n==="math"&&Re[u]:!!ht[n]:e.namespaceURI===x?t.namespaceURI===Ae&&!Re[u]||t.namespaceURI===he&&!Se[u]?!1:!ht[n]&&(dn[n]||!gt[n]):!!(se==="application/xhtml+xml"&&Be[e.namespaceURI]):!1},M=function(e){b(o.removed,{element:e});try{Te(e).removeChild(e)}catch{en(e)}},U=function(e,t){try{b(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{b(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(j||_e)try{M(t)}catch{}else try{t.setAttribute(e,"")}catch{}},At=function(e){let t=null,n=null;if(Ue)e="<remove></remove>"+e;else{const m=Le(e,/^[\r\n\t ]+/);n=m&&m[0]}se==="application/xhtml+xml"&&$===x&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const u=S?S.createHTML(e):e;if($===x)try{t=new Jt().parseFromString(u,se)}catch{}if(!t||!t.documentElement){t=Ce.createDocument($,"template",null);try{t.documentElement.innerHTML=We?ie:u}catch{}}const g=t.body||t.documentElement;return e&&n&&g.insertBefore(l.createTextNode(n),g.childNodes[0]||null),$===x?an.call(t,F?"html":"body")[0]:F?t.documentElement:g},St=function(e){return on.call(e.ownerDocument||e,e,ne.SHOW_ELEMENT|ne.SHOW_COMMENT|ne.SHOW_TEXT|ne.SHOW_PROCESSING_INSTRUCTION|ne.SHOW_CDATA_SECTION,null)},je=function(e){return e instanceof Zt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Kt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},Rt=function(e){return typeof Me=="function"&&e instanceof Me};function P(i,e,t){G(i,n=>{n.call(o,e,t,q)})}const yt=function(e){let t=null;if(P(R.beforeSanitizeElements,e,null),je(e))return M(e),!0;const n=p(e.nodeName);if(P(R.uponSanitizeElement,e,{tagName:n,allowedTags:d}),Ee&&e.hasChildNodes()&&!Rt(e.firstElementChild)&&h(/<[/\w!]/g,e.innerHTML)&&h(/<[/\w!]/g,e.textContent)||e.nodeType===te.progressingInstruction||Ee&&e.nodeType===te.comment&&h(/<[/\w]/g,e.data))return M(e),!0;if(!(B.tagCheck instanceof Function&&B.tagCheck(n))&&(!d[n]||re[n])){if(!re[n]&&Lt(n)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n)))return!1;if(ze&&!N[n]){const u=Te(e)||e.parentNode,g=nn(e)||e.childNodes;if(g&&u){const m=g.length;for(let L=m-1;L>=0;--L){const v=Qt(g[L],!0);v.__removalCount=(e.__removalCount||0)+1,u.insertBefore(v,tn(e))}}}return M(e),!0}return e instanceof it&&!gn(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&h(/<\/no(script|embed|frames)/i,e.innerHTML)?(M(e),!0):(Y&&e.nodeType===te.text&&(t=e.textContent,G([we,xe,Pe],u=>{t=J(t,u," ")}),e.textContent!==t&&(b(o.removed,{element:e.cloneNode()}),e.textContent=t)),P(R.afterSanitizeElements,e,null),!1)},Ot=function(e,t,n){if(mt&&(t==="id"||t==="name")&&(n in l||n in _n))return!1;if(!(ke&&!ve[t]&&h(ln,t))){if(!(ct&&h(cn,t))){if(!(B.attributeCheck instanceof Function&&B.attributeCheck(t,e))){if(!E[t]||ve[t]){if(!(Lt(e)&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&h(f.attributeNameCheck,t)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(t,e))||t==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&h(f.tagNameCheck,n)||f.tagNameCheck instanceof Function&&f.tagNameCheck(n))))return!1}else if(!Ge[t]){if(!h(at,J(n,rt,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&xt(n,"data:")===0&&dt[e])){if(!(ut&&!h(un,J(n,rt,"")))){if(n)return!1}}}}}}}return!0},Lt=function(e){return e!=="annotation-xml"&&Le(e,fn)},bt=function(e){P(R.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||je(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:E,forceKeepAttr:void 0};let u=t.length;for(;u--;){const g=t[u],{name:m,namespaceURI:L,value:v}=g,V=p(m),Xe=v;let _=m==="value"?Xe:Pt(Xe);if(n.attrName=V,n.attrValue=_,n.keepAttr=!0,n.forceKeepAttr=void 0,P(R.uponSanitizeAttribute,e,n),_=n.attrValue,pt&&(V==="id"||V==="name")&&(U(m,e),_=mn+_),Ee&&h(/((--!?|])>)|<\/(style|title|textarea)/i,_)){U(m,e);continue}if(V==="attributename"&&Le(_,"href")){U(m,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){U(m,e);continue}if(!ft&&h(/\/>/i,_)){U(m,e);continue}Y&&G([we,xe,Pe],It=>{_=J(_,It," ")});const Dt=p(e.nodeName);if(!Ot(Dt,V,_)){U(m,e);continue}if(S&&typeof de=="object"&&typeof de.getAttributeType=="function"&&!L)switch(de.getAttributeType(Dt,V)){case"TrustedHTML":{_=S.createHTML(_);break}case"TrustedScriptURL":{_=S.createScriptURL(_);break}}if(_!==Xe)try{L?e.setAttributeNS(L,m,_):e.setAttribute(m,_),je(e)?M(e):fe(o.removed)}catch{U(m,e)}}P(R.afterSanitizeAttributes,e,null)},hn=function i(e){let t=null;const n=St(e);for(P(R.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)P(R.uponSanitizeShadowNode,t,null),yt(t),bt(t),t.content instanceof O&&i(t.content);P(R.afterSanitizeShadowDOM,e,null)};return o.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,u=null,g=null;if(We=!i,We&&(i="<!-->"),typeof i!="string"&&!Rt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw Q("dirty is not a string, aborting")}else throw Q("toString is not a function");if(!o.isSupported)return i;if(Fe||Ye(e),o.removed=[],typeof i=="string"&&(ae=!1),ae){if(i.nodeName){const v=p(i.nodeName);if(!d[v]||re[v])throw Q("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof Me)t=At("<!---->"),n=t.ownerDocument.importNode(i,!0),n.nodeType===te.element&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!j&&!Y&&!F&&i.indexOf("<")===-1)return S&&ge?S.createHTML(i):i;if(t=At(i),!t)return j?null:ge?ie:""}t&&Ue&&M(t.firstChild);const m=St(ae?i:t);for(;u=m.nextNode();)yt(u),bt(u),u.content instanceof O&&hn(u.content);if(ae)return i;if(j){if(_e)for(g=rn.call(t.ownerDocument);t.firstChild;)g.appendChild(t.firstChild);else g=t;return(E.shadowroot||E.shadowrootmode)&&(g=sn.call(r,g,!0)),g}let L=F?t.outerHTML:t.innerHTML;return F&&d["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&h(et,t.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
2
2
  `+L),Y&&G([we,xe,Pe],v=>{L=J(L,v," ")}),S&&ge?S.createHTML(L):L},o.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(i),Fe=!0},o.clearConfig=function(){q=null,Fe=!1},o.isValidAttribute=function(i,e,t){q||Ye({});const n=p(i),u=p(e);return Ot(n,u,t)},o.addHook=function(i,e){typeof e=="function"&&b(R[i],e)},o.removeHook=function(i,e){if(e!==void 0){const t=ue(R[i],e);return t===-1?void 0:wt(R[i],t,1)[0]}return fe(R[i])},o.removeHooks=function(i){R[i]=[]},o.removeAllHooks=function(){R=nt()},o}var Vt=ot();return $e=Vt,$e}var qe,Ct;function Ln(){return Ct||(Ct=1,qe=self.DOMPurify||(self.DOMPurify=Mt().default||Mt())),qe}var bn=Ln();const Dn=An(bn);function Nn({provider:Z,displayName:C,visualConfig:w}){const[ye,ce]=K.useState(!1),[T,y]=K.useState(""),[k,z]=K.useState(!1),H=Sn("/api/auth/authorize/:provider"),G=K.useCallback(async()=>{ce(!1),z(!0);try{const b=await H.call({pathParams:{provider:Z}});if(!b.authorize_url)throw new Error(`Failed to get ${C} authorization URL`);window.location.href=b.authorize_url}catch(b){ce(!0),y(`Failed to initiate ${C} login: ${b}`),console.error(`Failed to start ${C} login`,b)}finally{z(!1)}},[H,C,Z]),ue=K.useMemo(()=>{if(w?.buttonColor)return{backgroundColor:w.buttonColor,color:w.textColor||"#FFFFFF"}},[w]),fe=K.useMemo(()=>{if(k||!w?.iconSvg)return null;const b=Dn.sanitize(w.iconSvg,{USE_PROFILES:{svg:!0}});return le.jsx("span",{className:"flex items-center justify-center",dangerouslySetInnerHTML:{__html:b}})},[k,w?.iconSvg]);return le.jsxs("div",{className:"flex flex-col gap-4",children:[le.jsx(Rn,{children:ye&&le.jsx(yn.div,{className:"text-small text-danger",initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.3,ease:"easeOut"},children:T||`Failed to sign in with ${C}`})}),le.jsx(On,{onPress:G,color:ue?void 0:"primary",style:ue,isLoading:k,startContent:fe,children:k?"Redirecting...":`Sign in with ${C}`})]})}export{Nn as default};
@@ -1 +1 @@
1
- import{av as Gr,u as Jr,r as hr,i as Wr,j as I,D as qr,d as gr,I as Yr,m as Kr,e as Lr,f as Qr,aw as Vr}from"./index-BZLU40Mk.js";import{m as Xr}from"./chunk-IGSAU2ZA-NXd1g0Qd.js";var T=Uint8Array,$=Uint16Array,jr=Int32Array,lr=new T([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sr=new T([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pr=new T([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nr=function(r,e){for(var a=new $(31),n=0;n<31;++n)a[n]=e+=1<<r[n-1];for(var t=new jr(a[30]),n=1;n<30;++n)for(var o=a[n];o<a[n+1];++o)t[o]=o-a[n]<<5|n;return{b:a,r:t}},_r=Nr(lr,2),zr=_r.b,mr=_r.r;zr[28]=258,mr[258]=28;var Rr=Nr(sr,0),Zr=Rr.b,Mr=Rr.r,Cr=new $(32768);for(var y=0;y<32768;++y){var Q=(y&43690)>>1|(y&21845)<<1;Q=(Q&52428)>>2|(Q&13107)<<2,Q=(Q&61680)>>4|(Q&3855)<<4,Cr[y]=((Q&65280)>>8|(Q&255)<<8)>>1}var q=(function(r,e,a){for(var n=r.length,t=0,o=new $(e);t<n;++t)r[t]&&++o[r[t]-1];var v=new $(e);for(t=1;t<e;++t)v[t]=v[t-1]+o[t-1]<<1;var l;if(a){l=new $(1<<e);var h=15-e;for(t=0;t<n;++t)if(r[t])for(var c=t<<4|r[t],f=e-r[t],i=v[r[t]-1]++<<f,u=i|(1<<f)-1;i<=u;++i)l[Cr[i]>>h]=c}else for(l=new $(n),t=0;t<n;++t)r[t]&&(l[t]=Cr[v[r[t]-1]++]>>15-r[t]);return l}),V=new T(288);for(var y=0;y<144;++y)V[y]=8;for(var y=144;y<256;++y)V[y]=9;for(var y=256;y<280;++y)V[y]=7;for(var y=280;y<288;++y)V[y]=8;var fr=new T(32);for(var y=0;y<32;++y)fr[y]=5;var re=q(V,9,0),ee=q(V,9,1),ae=q(fr,5,0),ne=q(fr,5,1),wr=function(r){for(var e=r[0],a=1;a<r.length;++a)r[a]>e&&(e=r[a]);return e},J=function(r,e,a){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&a},xr=function(r,e){var a=e/8|0;return(r[a]|r[a+1]<<8|r[a+2]<<16)>>(e&7)},Ar=function(r){return(r+7)/8|0},cr=function(r,e,a){return(e==null||e<0)&&(e=0),(a==null||a>r.length)&&(a=r.length),new T(r.subarray(e,a))},te=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(r,e,a){var n=new Error(e||te[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,G),!a)throw n;return n},oe=function(r,e,a,n){var t=r.length,o=0;if(!t||e.f&&!e.l)return a||new T(0);var v=!a,l=v||e.i!=2,h=e.i;v&&(a=new T(t*3));var c=function(ar){var nr=a.length;if(ar>nr){var rr=new T(Math.max(nr*2,ar));rr.set(a),a=rr}},f=e.f||0,i=e.p||0,u=e.b||0,x=e.l,S=e.d,w=e.m,d=e.n,m=t*8;do{if(!x){f=J(r,i,1);var R=J(r,i+1,3);if(i+=3,R)if(R==1)x=ee,S=ne,w=9,d=5;else if(R==2){var N=J(r,i,31)+257,A=J(r,i+10,15)+4,g=N+J(r,i+5,31)+1;i+=14;for(var s=new T(g),M=new T(19),C=0;C<A;++C)M[pr[C]]=J(r,i+C*3,7);i+=A*3;for(var k=wr(M),L=(1<<k)-1,U=q(M,k,1),C=0;C<g;){var _=U[J(r,i,L)];i+=_&15;var j=_>>4;if(j<16)s[C++]=j;else{var E=0,b=0;for(j==16?(b=3+J(r,i,3),i+=2,E=s[C-1]):j==17?(b=3+J(r,i,7),i+=3):j==18&&(b=11+J(r,i,127),i+=7);b--;)s[C++]=E}}var z=s.subarray(0,N),F=s.subarray(N);w=wr(z),d=wr(F),x=q(z,w,1),S=q(F,d,1)}else G(1);else{var j=Ar(i)+4,D=r[j-4]|r[j-3]<<8,O=j+D;if(O>t){h&&G(0);break}l&&c(u+D),a.set(r.subarray(j,O),u),e.b=u+=D,e.p=i=O*8,e.f=f;continue}if(i>m){h&&G(0);break}}l&&c(u+131072);for(var er=(1<<w)-1,B=(1<<d)-1,Y=i;;Y=i){var E=x[xr(r,i)&er],H=E>>4;if(i+=E&15,i>m){h&&G(0);break}if(E||G(2),H<256)a[u++]=H;else if(H==256){Y=i,x=null;break}else{var P=H-254;if(H>264){var C=H-257,p=lr[C];P=J(r,i,(1<<p)-1)+zr[C],i+=p}var W=S[xr(r,i)&B],X=W>>4;W||G(3),i+=W&15;var F=Zr[X];if(X>3){var p=sr[X];F+=xr(r,i)&(1<<p)-1,i+=p}if(i>m){h&&G(0);break}l&&c(u+131072);var Z=u+P;if(u<F){var ir=o-F,vr=Math.min(F,Z);for(ir+u<0&&G(3);u<vr;++u)a[u]=n[ir+u]}for(;u<Z;++u)a[u]=a[u-F]}}e.l=x,e.p=Y,e.b=u,e.f=f,x&&(f=1,e.m=w,e.d=S,e.n=d)}while(!f);return u!=a.length&&v?cr(a,0,u):a.subarray(0,u)},K=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8},tr=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8,r[n+2]|=a>>16},yr=function(r,e){for(var a=[],n=0;n<r.length;++n)r[n]&&a.push({s:n,f:r[n]});var t=a.length,o=a.slice();if(!t)return{t:Hr,l:0};if(t==1){var v=new T(a[0].s+1);return v[a[0].s]=1,{t:v,l:1}}a.sort(function(O,N){return O.f-N.f}),a.push({s:-1,f:25001});var l=a[0],h=a[1],c=0,f=1,i=2;for(a[0]={s:-1,f:l.f+h.f,l,r:h};f!=t-1;)l=a[a[c].f<a[i].f?c++:i++],h=a[c!=f&&a[c].f<a[i].f?c++:i++],a[f++]={s:-1,f:l.f+h.f,l,r:h};for(var u=o[0].s,n=1;n<t;++n)o[n].s>u&&(u=o[n].s);var x=new $(u+1),S=Tr(a[f-1],x,0);if(S>e){var n=0,w=0,d=S-e,m=1<<d;for(o.sort(function(N,A){return x[A.s]-x[N.s]||N.f-A.f});n<t;++n){var R=o[n].s;if(x[R]>e)w+=m-(1<<S-x[R]),x[R]=e;else break}for(w>>=d;w>0;){var j=o[n].s;x[j]<e?w-=1<<e-x[j]++-1:++n}for(;n>=0&&w;--n){var D=o[n].s;x[D]==e&&(--x[D],++w)}S=e}return{t:new T(x),l:S}},Tr=function(r,e,a){return r.s==-1?Math.max(Tr(r.l,e,a+1),Tr(r.r,e,a+1)):e[r.s]=a},Er=function(r){for(var e=r.length;e&&!r[--e];);for(var a=new $(++e),n=0,t=r[0],o=1,v=function(h){a[n++]=h},l=1;l<=e;++l)if(r[l]==t&&l!=e)++o;else{if(!t&&o>2){for(;o>138;o-=138)v(32754);o>2&&(v(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(v(t),--o;o>6;o-=6)v(8304);o>2&&(v(o-3<<5|8208),o=0)}for(;o--;)v(t);o=1,t=r[l]}return{c:a.subarray(0,n),n:e}},or=function(r,e){for(var a=0,n=0;n<e.length;++n)a+=r[n]*e[n];return a},Ur=function(r,e,a){var n=a.length,t=Ar(e+2);r[t]=n&255,r[t+1]=n>>8,r[t+2]=r[t]^255,r[t+3]=r[t+1]^255;for(var o=0;o<n;++o)r[t+o+4]=a[o];return(t+4+n)*8},Fr=function(r,e,a,n,t,o,v,l,h,c,f){K(e,f++,a),++t[256];for(var i=yr(t,15),u=i.t,x=i.l,S=yr(o,15),w=S.t,d=S.l,m=Er(u),R=m.c,j=m.n,D=Er(w),O=D.c,N=D.n,A=new $(19),g=0;g<R.length;++g)++A[R[g]&31];for(var g=0;g<O.length;++g)++A[O[g]&31];for(var s=yr(A,7),M=s.t,C=s.l,k=19;k>4&&!M[pr[k-1]];--k);var L=c+5<<3,U=or(t,V)+or(o,fr)+v,_=or(t,u)+or(o,w)+v+14+3*k+or(A,M)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&L<=U&&L<=_)return Ur(e,f,r.subarray(h,h+c));var E,b,z,F;if(K(e,f,1+(_<U)),f+=2,_<U){E=q(u,x,0),b=u,z=q(w,d,0),F=w;var er=q(M,C,0);K(e,f,j-257),K(e,f+5,N-1),K(e,f+10,k-4),f+=14;for(var g=0;g<k;++g)K(e,f+3*g,M[pr[g]]);f+=3*k;for(var B=[R,O],Y=0;Y<2;++Y)for(var H=B[Y],g=0;g<H.length;++g){var P=H[g]&31;K(e,f,er[P]),f+=M[P],P>15&&(K(e,f,H[g]>>5&127),f+=H[g]>>12)}}else E=re,b=V,z=ae,F=fr;for(var g=0;g<l;++g){var p=n[g];if(p>255){var P=p>>18&31;tr(e,f,E[P+257]),f+=b[P+257],P>7&&(K(e,f,p>>23&31),f+=lr[P]);var W=p&31;tr(e,f,z[W]),f+=F[W],W>3&&(tr(e,f,p>>5&8191),f+=sr[W])}else tr(e,f,E[p]),f+=b[p]}return tr(e,f,E[256]),f+b[256]},fe=new jr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=new T(0),ie=function(r,e,a,n,t,o){var v=o.z||r.length,l=new T(n+v+5*(1+Math.ceil(v/7e3))+t),h=l.subarray(n,l.length-t),c=o.l,f=(o.r||0)&7;if(e){f&&(h[0]=o.r>>3);for(var i=fe[e-1],u=i>>13,x=i&8191,S=(1<<a)-1,w=o.p||new $(32768),d=o.h||new $(S+1),m=Math.ceil(a/3),R=2*m,j=function(ur){return(r[ur]^r[ur+1]<<m^r[ur+2]<<R)&S},D=new jr(25e3),O=new $(288),N=new $(32),A=0,g=0,s=o.i||0,M=0,C=o.w||0,k=0;s+2<v;++s){var L=j(s),U=s&32767,_=d[L];if(w[U]=_,d[L]=U,C<=s){var E=v-s;if((A>7e3||M>24576)&&(E>423||!c)){f=Fr(r,h,0,D,O,N,g,M,k,s-k,f),M=A=g=0,k=s;for(var b=0;b<286;++b)O[b]=0;for(var b=0;b<30;++b)N[b]=0}var z=2,F=0,er=x,B=U-_&32767;if(E>2&&L==j(s-B))for(var Y=Math.min(u,E)-1,H=Math.min(32767,s),P=Math.min(258,E);B<=H&&--er&&U!=_;){if(r[s+z]==r[s+z-B]){for(var p=0;p<P&&r[s+p]==r[s+p-B];++p);if(p>z){if(z=p,F=B,p>Y)break;for(var W=Math.min(B,p-2),X=0,b=0;b<W;++b){var Z=s-B+b&32767,ir=w[Z],vr=Z-ir&32767;vr>X&&(X=vr,_=Z)}}}U=_,_=w[U],B+=U-_&32767}if(F){D[M++]=268435456|mr[z]<<18|Mr[F];var ar=mr[z]&31,nr=Mr[F]&31;g+=lr[ar]+sr[nr],++O[257+ar],++N[nr],C=s+z,++A}else D[M++]=r[s],++O[r[s]]}}for(s=Math.max(s,C);s<v;++s)D[M++]=r[s],++O[r[s]];f=Fr(r,h,c,D,O,N,g,M,k,s-k,f),c||(o.r=f&7|h[f/8|0]<<3,f-=7,o.h=d,o.p=w,o.i=s,o.w=C)}else{for(var s=o.w||0;s<v+c;s+=65535){var rr=s+65535;rr>=v&&(h[f/8|0]=c,rr=v),f=Ur(h,f+1,r.subarray(s,rr))}o.i=v}return cr(l,0,n+Ar(f)+t)},Pr=function(){var r=1,e=0;return{p:function(a){for(var n=r,t=e,o=a.length|0,v=0;v!=o;){for(var l=Math.min(v+2655,o);v<l;++v)t+=n+=a[v];n=(n&65535)+15*(n>>16),t=(t&65535)+15*(t>>16)}r=n,e=t},d:function(){return r%=65521,e%=65521,(r&255)<<24|(r&65280)<<8|(e&255)<<8|e>>8}}},ve=function(r,e,a,n,t){if(!t&&(t={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),v=new T(o.length+r.length);v.set(o),v.set(r,o.length),r=v,t.w=o.length}return ie(r,e.level==null?6:e.level,e.mem==null?t.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,a,n,t)},$r=function(r,e,a){for(;a;++e)r[e]=a,a>>>=8},le=function(r,e){var a=e.level,n=a==0?0:a<6?1:a==9?3:2;if(r[0]=120,r[1]=n<<6|(e.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,e.dictionary){var t=Pr();t.p(e.dictionary),$r(r,2,t.d())}},se=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&G(6,"invalid zlib data"),(r[1]>>5&1)==1&&G(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function ce(r,e){e||(e={});var a=Pr();a.p(r);var n=ve(r,e,e.dictionary?6:2,4);return le(n,e),$r(n,n.length-4,a.d()),n}function ue(r,e){return oe(r.subarray(se(r),-4),{i:2},e,e)}var Or=typeof TextEncoder<"u"&&new TextEncoder,dr=typeof TextDecoder<"u"&&new TextDecoder,he=0;try{dr.decode(Hr,{stream:!0}),he=1}catch{}var ge=function(r){for(var e="",a=0;;){var n=r[a++],t=(n>127)+(n>223)+(n>239);if(a+t>r.length)return{s:e,r:cr(r,a-1)};t?t==3?(n=((n&15)<<18|(r[a++]&63)<<12|(r[a++]&63)<<6|r[a++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):t&1?e+=String.fromCharCode((n&31)<<6|r[a++]&63):e+=String.fromCharCode((n&15)<<12|(r[a++]&63)<<6|r[a++]&63):e+=String.fromCharCode(n)}};function kr(r,e){if(e){for(var a=new T(r.length),n=0;n<r.length;++n)a[n]=r.charCodeAt(n);return a}if(Or)return Or.encode(r);for(var t=r.length,o=new T(r.length+(r.length>>1)),v=0,l=function(f){o[v++]=f},n=0;n<t;++n){if(v+5>o.length){var h=new T(v+8+(t-n<<1));h.set(o),o=h}var c=r.charCodeAt(n);c<128||e?l(c):c<2048?(l(192|c>>6),l(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++n)&1023,l(240|c>>18),l(128|c>>12&63),l(128|c>>6&63),l(128|c&63)):(l(224|c>>12),l(128|c>>6&63),l(128|c&63))}return cr(o,0,v)}function Ir(r,e){if(e){for(var a="",n=0;n<r.length;n+=16384)a+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return a}else{if(dr)return dr.decode(r);var t=ge(r),o=t.s,a=t.r;return a.length&&G(8),o}}const Dr="heroicons:share",we="heroicons:check",Br="RAGBITS-STATE",Sr=`<${Br}>`,br=`</${Br}>`;function xe(r){if(typeof r!="object"||r===null)return!1;const e=r;return!(typeof e.history!="object"||"followupMessages"in e&&typeof e.followupMessages!="object"||"chatOptions"in e&&typeof e.chatOptions!="object"||"serverState"in e&&typeof e.serverState!="object"||"conversationId"in e&&typeof e.conversationId!="string"&&typeof e.conversationId!="object")}function be(){const{restore:r}=Gr(),{isOpen:e,onOpen:a,onClose:n}=Jr(),[t,o]=hr.useState(Dr),v=hr.useRef(null),{getCurrentConversation:l}=Wr(f=>f.primitives),h=()=>{const{chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}=l(),w=Vr({chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}),d=kr(`${Sr}${JSON.stringify(w)}${br}`),m=btoa(Ir(ce(d,{level:9}),!0));navigator.clipboard.writeText(m),o(we),n(),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{o(Dr)},2e3)},c=()=>{n()};return hr.useEffect(()=>{const f=i=>{if(!i.clipboardData)return;const u=i.clipboardData.types;if(!u.includes("text/plain")&&!u.includes("text"))return;const x=i.clipboardData.getData("text/plain")??i.clipboardData.getData("text");try{const S=atob(x);if(!S.startsWith("xÚ"))return;const w=Ir(ue(kr(S,!0)));if(!w.startsWith(Sr)||!w.endsWith(br))return;i.preventDefault(),i.stopPropagation();const d=w.slice(Sr.length,-br.length),m=JSON.parse(d);if(!xe(m))return;r(m.history,m.followupMessages,m.chatOptions,m.serverState,m.conversationId)}catch(S){console.error("Couldn't parse pasted string as valid Ragbits state",S)}};return window.addEventListener("paste",f),()=>{window.removeEventListener("paste",f)}}),I.jsxs(I.Fragment,{children:[I.jsx(qr,{content:"Share conversation",placement:"bottom",children:I.jsx(gr,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Share conversation",onPress:a,children:I.jsx(Yr,{icon:t})})}),I.jsx(Kr,{isOpen:e,onOpenChange:c,children:I.jsx(Lr,{children:f=>I.jsxs(I.Fragment,{children:[I.jsx(Xr,{className:"text-default-900 flex flex-col gap-1",children:"Share conversation"}),I.jsx(Qr,{children:I.jsxs("div",{className:"flex flex-col gap-4",children:[I.jsx("p",{className:"text-medium text-default-500",children:"You are about to copy a code that allows sharing and storing your current app state. Once copied, you can paste this code anywhere on the site to instantly return to this exact setup. It’s a quick way to save your progress or share it with others."}),I.jsxs("div",{className:"flex justify-end gap-4 py-4",children:[I.jsx(gr,{color:"danger",variant:"light",onPress:f,"aria-label":"Close share modal",children:"Cancel"}),I.jsx(gr,{color:"primary",onPress:h,"aria-label":"Copy to clipboard to share the conversation",children:"Copy to clipboard"})]})]})})]})})})]})}export{be as default};
1
+ import{av as Gr,u as Jr,r as hr,i as Wr,j as I,D as qr,d as gr,I as Yr,m as Kr,e as Lr,f as Qr,aw as Vr}from"./index-B4zFOTZJ.js";import{m as Xr}from"./chunk-IGSAU2ZA-DHvCEIx7.js";var T=Uint8Array,$=Uint16Array,jr=Int32Array,lr=new T([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sr=new T([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pr=new T([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nr=function(r,e){for(var a=new $(31),n=0;n<31;++n)a[n]=e+=1<<r[n-1];for(var t=new jr(a[30]),n=1;n<30;++n)for(var o=a[n];o<a[n+1];++o)t[o]=o-a[n]<<5|n;return{b:a,r:t}},_r=Nr(lr,2),zr=_r.b,mr=_r.r;zr[28]=258,mr[258]=28;var Rr=Nr(sr,0),Zr=Rr.b,Mr=Rr.r,Cr=new $(32768);for(var y=0;y<32768;++y){var Q=(y&43690)>>1|(y&21845)<<1;Q=(Q&52428)>>2|(Q&13107)<<2,Q=(Q&61680)>>4|(Q&3855)<<4,Cr[y]=((Q&65280)>>8|(Q&255)<<8)>>1}var q=(function(r,e,a){for(var n=r.length,t=0,o=new $(e);t<n;++t)r[t]&&++o[r[t]-1];var v=new $(e);for(t=1;t<e;++t)v[t]=v[t-1]+o[t-1]<<1;var l;if(a){l=new $(1<<e);var h=15-e;for(t=0;t<n;++t)if(r[t])for(var c=t<<4|r[t],f=e-r[t],i=v[r[t]-1]++<<f,u=i|(1<<f)-1;i<=u;++i)l[Cr[i]>>h]=c}else for(l=new $(n),t=0;t<n;++t)r[t]&&(l[t]=Cr[v[r[t]-1]++]>>15-r[t]);return l}),V=new T(288);for(var y=0;y<144;++y)V[y]=8;for(var y=144;y<256;++y)V[y]=9;for(var y=256;y<280;++y)V[y]=7;for(var y=280;y<288;++y)V[y]=8;var fr=new T(32);for(var y=0;y<32;++y)fr[y]=5;var re=q(V,9,0),ee=q(V,9,1),ae=q(fr,5,0),ne=q(fr,5,1),wr=function(r){for(var e=r[0],a=1;a<r.length;++a)r[a]>e&&(e=r[a]);return e},J=function(r,e,a){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&a},xr=function(r,e){var a=e/8|0;return(r[a]|r[a+1]<<8|r[a+2]<<16)>>(e&7)},Ar=function(r){return(r+7)/8|0},cr=function(r,e,a){return(e==null||e<0)&&(e=0),(a==null||a>r.length)&&(a=r.length),new T(r.subarray(e,a))},te=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(r,e,a){var n=new Error(e||te[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,G),!a)throw n;return n},oe=function(r,e,a,n){var t=r.length,o=0;if(!t||e.f&&!e.l)return a||new T(0);var v=!a,l=v||e.i!=2,h=e.i;v&&(a=new T(t*3));var c=function(ar){var nr=a.length;if(ar>nr){var rr=new T(Math.max(nr*2,ar));rr.set(a),a=rr}},f=e.f||0,i=e.p||0,u=e.b||0,x=e.l,S=e.d,w=e.m,d=e.n,m=t*8;do{if(!x){f=J(r,i,1);var R=J(r,i+1,3);if(i+=3,R)if(R==1)x=ee,S=ne,w=9,d=5;else if(R==2){var N=J(r,i,31)+257,A=J(r,i+10,15)+4,g=N+J(r,i+5,31)+1;i+=14;for(var s=new T(g),M=new T(19),C=0;C<A;++C)M[pr[C]]=J(r,i+C*3,7);i+=A*3;for(var k=wr(M),L=(1<<k)-1,U=q(M,k,1),C=0;C<g;){var _=U[J(r,i,L)];i+=_&15;var j=_>>4;if(j<16)s[C++]=j;else{var E=0,b=0;for(j==16?(b=3+J(r,i,3),i+=2,E=s[C-1]):j==17?(b=3+J(r,i,7),i+=3):j==18&&(b=11+J(r,i,127),i+=7);b--;)s[C++]=E}}var z=s.subarray(0,N),F=s.subarray(N);w=wr(z),d=wr(F),x=q(z,w,1),S=q(F,d,1)}else G(1);else{var j=Ar(i)+4,D=r[j-4]|r[j-3]<<8,O=j+D;if(O>t){h&&G(0);break}l&&c(u+D),a.set(r.subarray(j,O),u),e.b=u+=D,e.p=i=O*8,e.f=f;continue}if(i>m){h&&G(0);break}}l&&c(u+131072);for(var er=(1<<w)-1,B=(1<<d)-1,Y=i;;Y=i){var E=x[xr(r,i)&er],H=E>>4;if(i+=E&15,i>m){h&&G(0);break}if(E||G(2),H<256)a[u++]=H;else if(H==256){Y=i,x=null;break}else{var P=H-254;if(H>264){var C=H-257,p=lr[C];P=J(r,i,(1<<p)-1)+zr[C],i+=p}var W=S[xr(r,i)&B],X=W>>4;W||G(3),i+=W&15;var F=Zr[X];if(X>3){var p=sr[X];F+=xr(r,i)&(1<<p)-1,i+=p}if(i>m){h&&G(0);break}l&&c(u+131072);var Z=u+P;if(u<F){var ir=o-F,vr=Math.min(F,Z);for(ir+u<0&&G(3);u<vr;++u)a[u]=n[ir+u]}for(;u<Z;++u)a[u]=a[u-F]}}e.l=x,e.p=Y,e.b=u,e.f=f,x&&(f=1,e.m=w,e.d=S,e.n=d)}while(!f);return u!=a.length&&v?cr(a,0,u):a.subarray(0,u)},K=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8},tr=function(r,e,a){a<<=e&7;var n=e/8|0;r[n]|=a,r[n+1]|=a>>8,r[n+2]|=a>>16},yr=function(r,e){for(var a=[],n=0;n<r.length;++n)r[n]&&a.push({s:n,f:r[n]});var t=a.length,o=a.slice();if(!t)return{t:Hr,l:0};if(t==1){var v=new T(a[0].s+1);return v[a[0].s]=1,{t:v,l:1}}a.sort(function(O,N){return O.f-N.f}),a.push({s:-1,f:25001});var l=a[0],h=a[1],c=0,f=1,i=2;for(a[0]={s:-1,f:l.f+h.f,l,r:h};f!=t-1;)l=a[a[c].f<a[i].f?c++:i++],h=a[c!=f&&a[c].f<a[i].f?c++:i++],a[f++]={s:-1,f:l.f+h.f,l,r:h};for(var u=o[0].s,n=1;n<t;++n)o[n].s>u&&(u=o[n].s);var x=new $(u+1),S=Tr(a[f-1],x,0);if(S>e){var n=0,w=0,d=S-e,m=1<<d;for(o.sort(function(N,A){return x[A.s]-x[N.s]||N.f-A.f});n<t;++n){var R=o[n].s;if(x[R]>e)w+=m-(1<<S-x[R]),x[R]=e;else break}for(w>>=d;w>0;){var j=o[n].s;x[j]<e?w-=1<<e-x[j]++-1:++n}for(;n>=0&&w;--n){var D=o[n].s;x[D]==e&&(--x[D],++w)}S=e}return{t:new T(x),l:S}},Tr=function(r,e,a){return r.s==-1?Math.max(Tr(r.l,e,a+1),Tr(r.r,e,a+1)):e[r.s]=a},Er=function(r){for(var e=r.length;e&&!r[--e];);for(var a=new $(++e),n=0,t=r[0],o=1,v=function(h){a[n++]=h},l=1;l<=e;++l)if(r[l]==t&&l!=e)++o;else{if(!t&&o>2){for(;o>138;o-=138)v(32754);o>2&&(v(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(v(t),--o;o>6;o-=6)v(8304);o>2&&(v(o-3<<5|8208),o=0)}for(;o--;)v(t);o=1,t=r[l]}return{c:a.subarray(0,n),n:e}},or=function(r,e){for(var a=0,n=0;n<e.length;++n)a+=r[n]*e[n];return a},Ur=function(r,e,a){var n=a.length,t=Ar(e+2);r[t]=n&255,r[t+1]=n>>8,r[t+2]=r[t]^255,r[t+3]=r[t+1]^255;for(var o=0;o<n;++o)r[t+o+4]=a[o];return(t+4+n)*8},Fr=function(r,e,a,n,t,o,v,l,h,c,f){K(e,f++,a),++t[256];for(var i=yr(t,15),u=i.t,x=i.l,S=yr(o,15),w=S.t,d=S.l,m=Er(u),R=m.c,j=m.n,D=Er(w),O=D.c,N=D.n,A=new $(19),g=0;g<R.length;++g)++A[R[g]&31];for(var g=0;g<O.length;++g)++A[O[g]&31];for(var s=yr(A,7),M=s.t,C=s.l,k=19;k>4&&!M[pr[k-1]];--k);var L=c+5<<3,U=or(t,V)+or(o,fr)+v,_=or(t,u)+or(o,w)+v+14+3*k+or(A,M)+2*A[16]+3*A[17]+7*A[18];if(h>=0&&L<=U&&L<=_)return Ur(e,f,r.subarray(h,h+c));var E,b,z,F;if(K(e,f,1+(_<U)),f+=2,_<U){E=q(u,x,0),b=u,z=q(w,d,0),F=w;var er=q(M,C,0);K(e,f,j-257),K(e,f+5,N-1),K(e,f+10,k-4),f+=14;for(var g=0;g<k;++g)K(e,f+3*g,M[pr[g]]);f+=3*k;for(var B=[R,O],Y=0;Y<2;++Y)for(var H=B[Y],g=0;g<H.length;++g){var P=H[g]&31;K(e,f,er[P]),f+=M[P],P>15&&(K(e,f,H[g]>>5&127),f+=H[g]>>12)}}else E=re,b=V,z=ae,F=fr;for(var g=0;g<l;++g){var p=n[g];if(p>255){var P=p>>18&31;tr(e,f,E[P+257]),f+=b[P+257],P>7&&(K(e,f,p>>23&31),f+=lr[P]);var W=p&31;tr(e,f,z[W]),f+=F[W],W>3&&(tr(e,f,p>>5&8191),f+=sr[W])}else tr(e,f,E[p]),f+=b[p]}return tr(e,f,E[256]),f+b[256]},fe=new jr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=new T(0),ie=function(r,e,a,n,t,o){var v=o.z||r.length,l=new T(n+v+5*(1+Math.ceil(v/7e3))+t),h=l.subarray(n,l.length-t),c=o.l,f=(o.r||0)&7;if(e){f&&(h[0]=o.r>>3);for(var i=fe[e-1],u=i>>13,x=i&8191,S=(1<<a)-1,w=o.p||new $(32768),d=o.h||new $(S+1),m=Math.ceil(a/3),R=2*m,j=function(ur){return(r[ur]^r[ur+1]<<m^r[ur+2]<<R)&S},D=new jr(25e3),O=new $(288),N=new $(32),A=0,g=0,s=o.i||0,M=0,C=o.w||0,k=0;s+2<v;++s){var L=j(s),U=s&32767,_=d[L];if(w[U]=_,d[L]=U,C<=s){var E=v-s;if((A>7e3||M>24576)&&(E>423||!c)){f=Fr(r,h,0,D,O,N,g,M,k,s-k,f),M=A=g=0,k=s;for(var b=0;b<286;++b)O[b]=0;for(var b=0;b<30;++b)N[b]=0}var z=2,F=0,er=x,B=U-_&32767;if(E>2&&L==j(s-B))for(var Y=Math.min(u,E)-1,H=Math.min(32767,s),P=Math.min(258,E);B<=H&&--er&&U!=_;){if(r[s+z]==r[s+z-B]){for(var p=0;p<P&&r[s+p]==r[s+p-B];++p);if(p>z){if(z=p,F=B,p>Y)break;for(var W=Math.min(B,p-2),X=0,b=0;b<W;++b){var Z=s-B+b&32767,ir=w[Z],vr=Z-ir&32767;vr>X&&(X=vr,_=Z)}}}U=_,_=w[U],B+=U-_&32767}if(F){D[M++]=268435456|mr[z]<<18|Mr[F];var ar=mr[z]&31,nr=Mr[F]&31;g+=lr[ar]+sr[nr],++O[257+ar],++N[nr],C=s+z,++A}else D[M++]=r[s],++O[r[s]]}}for(s=Math.max(s,C);s<v;++s)D[M++]=r[s],++O[r[s]];f=Fr(r,h,c,D,O,N,g,M,k,s-k,f),c||(o.r=f&7|h[f/8|0]<<3,f-=7,o.h=d,o.p=w,o.i=s,o.w=C)}else{for(var s=o.w||0;s<v+c;s+=65535){var rr=s+65535;rr>=v&&(h[f/8|0]=c,rr=v),f=Ur(h,f+1,r.subarray(s,rr))}o.i=v}return cr(l,0,n+Ar(f)+t)},Pr=function(){var r=1,e=0;return{p:function(a){for(var n=r,t=e,o=a.length|0,v=0;v!=o;){for(var l=Math.min(v+2655,o);v<l;++v)t+=n+=a[v];n=(n&65535)+15*(n>>16),t=(t&65535)+15*(t>>16)}r=n,e=t},d:function(){return r%=65521,e%=65521,(r&255)<<24|(r&65280)<<8|(e&255)<<8|e>>8}}},ve=function(r,e,a,n,t){if(!t&&(t={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),v=new T(o.length+r.length);v.set(o),v.set(r,o.length),r=v,t.w=o.length}return ie(r,e.level==null?6:e.level,e.mem==null?t.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,a,n,t)},$r=function(r,e,a){for(;a;++e)r[e]=a,a>>>=8},le=function(r,e){var a=e.level,n=a==0?0:a<6?1:a==9?3:2;if(r[0]=120,r[1]=n<<6|(e.dictionary&&32),r[1]|=31-(r[0]<<8|r[1])%31,e.dictionary){var t=Pr();t.p(e.dictionary),$r(r,2,t.d())}},se=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&G(6,"invalid zlib data"),(r[1]>>5&1)==1&&G(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function ce(r,e){e||(e={});var a=Pr();a.p(r);var n=ve(r,e,e.dictionary?6:2,4);return le(n,e),$r(n,n.length-4,a.d()),n}function ue(r,e){return oe(r.subarray(se(r),-4),{i:2},e,e)}var Or=typeof TextEncoder<"u"&&new TextEncoder,dr=typeof TextDecoder<"u"&&new TextDecoder,he=0;try{dr.decode(Hr,{stream:!0}),he=1}catch{}var ge=function(r){for(var e="",a=0;;){var n=r[a++],t=(n>127)+(n>223)+(n>239);if(a+t>r.length)return{s:e,r:cr(r,a-1)};t?t==3?(n=((n&15)<<18|(r[a++]&63)<<12|(r[a++]&63)<<6|r[a++]&63)-65536,e+=String.fromCharCode(55296|n>>10,56320|n&1023)):t&1?e+=String.fromCharCode((n&31)<<6|r[a++]&63):e+=String.fromCharCode((n&15)<<12|(r[a++]&63)<<6|r[a++]&63):e+=String.fromCharCode(n)}};function kr(r,e){if(e){for(var a=new T(r.length),n=0;n<r.length;++n)a[n]=r.charCodeAt(n);return a}if(Or)return Or.encode(r);for(var t=r.length,o=new T(r.length+(r.length>>1)),v=0,l=function(f){o[v++]=f},n=0;n<t;++n){if(v+5>o.length){var h=new T(v+8+(t-n<<1));h.set(o),o=h}var c=r.charCodeAt(n);c<128||e?l(c):c<2048?(l(192|c>>6),l(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++n)&1023,l(240|c>>18),l(128|c>>12&63),l(128|c>>6&63),l(128|c&63)):(l(224|c>>12),l(128|c>>6&63),l(128|c&63))}return cr(o,0,v)}function Ir(r,e){if(e){for(var a="",n=0;n<r.length;n+=16384)a+=String.fromCharCode.apply(null,r.subarray(n,n+16384));return a}else{if(dr)return dr.decode(r);var t=ge(r),o=t.s,a=t.r;return a.length&&G(8),o}}const Dr="heroicons:share",we="heroicons:check",Br="RAGBITS-STATE",Sr=`<${Br}>`,br=`</${Br}>`;function xe(r){if(typeof r!="object"||r===null)return!1;const e=r;return!(typeof e.history!="object"||"followupMessages"in e&&typeof e.followupMessages!="object"||"chatOptions"in e&&typeof e.chatOptions!="object"||"serverState"in e&&typeof e.serverState!="object"||"conversationId"in e&&typeof e.conversationId!="string"&&typeof e.conversationId!="object")}function be(){const{restore:r}=Gr(),{isOpen:e,onOpen:a,onClose:n}=Jr(),[t,o]=hr.useState(Dr),v=hr.useRef(null),{getCurrentConversation:l}=Wr(f=>f.primitives),h=()=>{const{chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}=l(),w=Vr({chatOptions:f,history:i,serverState:u,conversationId:x,followupMessages:S}),d=kr(`${Sr}${JSON.stringify(w)}${br}`),m=btoa(Ir(ce(d,{level:9}),!0));navigator.clipboard.writeText(m),o(we),n(),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{o(Dr)},2e3)},c=()=>{n()};return hr.useEffect(()=>{const f=i=>{if(!i.clipboardData)return;const u=i.clipboardData.types;if(!u.includes("text/plain")&&!u.includes("text"))return;const x=i.clipboardData.getData("text/plain")??i.clipboardData.getData("text");try{const S=atob(x);if(!S.startsWith("xÚ"))return;const w=Ir(ue(kr(S,!0)));if(!w.startsWith(Sr)||!w.endsWith(br))return;i.preventDefault(),i.stopPropagation();const d=w.slice(Sr.length,-br.length),m=JSON.parse(d);if(!xe(m))return;r(m.history,m.followupMessages,m.chatOptions,m.serverState,m.conversationId)}catch(S){console.error("Couldn't parse pasted string as valid Ragbits state",S)}};return window.addEventListener("paste",f),()=>{window.removeEventListener("paste",f)}}),I.jsxs(I.Fragment,{children:[I.jsx(qr,{content:"Share conversation",placement:"bottom",children:I.jsx(gr,{isIconOnly:!0,variant:"ghost",className:"p-0","aria-label":"Share conversation",onPress:a,children:I.jsx(Yr,{icon:t})})}),I.jsx(Kr,{isOpen:e,onOpenChange:c,children:I.jsx(Lr,{children:f=>I.jsxs(I.Fragment,{children:[I.jsx(Xr,{className:"text-default-900 flex flex-col gap-1",children:"Share conversation"}),I.jsx(Qr,{children:I.jsxs("div",{className:"flex flex-col gap-4",children:[I.jsx("p",{className:"text-medium text-default-500",children:"You are about to copy a code that allows sharing and storing your current app state. Once copied, you can paste this code anywhere on the site to instantly return to this exact setup. It’s a quick way to save your progress or share it with others."}),I.jsxs("div",{className:"flex justify-end gap-4 py-4",children:[I.jsx(gr,{color:"danger",variant:"light",onPress:f,"aria-label":"Close share modal",children:"Cancel"}),I.jsx(gr,{color:"primary",onPress:h,"aria-label":"Copy to clipboard to share the conversation",children:"Copy to clipboard"})]})]})})]})})})]})}export{be as default};